/[climacs]/climacs/gui.lisp
ViewVC logotype

Contents of /climacs/gui.lisp

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.90 - (show annotations)
Thu Jan 20 23:42:04 2005 UTC (9 years, 2 months ago) by mvilleneuve
Branch: MAIN
Changes since 1.89: +21 -0 lines
Added command fill-paragraph (bound to M-q)
1 ;;; -*- Mode: Lisp; Package: CLIMACS-GUI -*-
2
3 ;;; (c) copyright 2004-2005 by
4 ;;; Robert Strandh (strandh@labri.fr)
5 ;;; (c) copyright 2004-2005 by
6 ;;; Elliott Johnson (ejohnson@fasl.info)
7 ;;; (c) copyright 2005 by
8 ;;; Matthieu Villeneuve (matthieu.villeneuve@free.fr)
9 ;;; (c) copyright 2005 by
10 ;;; Aleksandar Bakic (a_bakic@yahoo.com)
11
12 ;;; This library is free software; you can redistribute it and/or
13 ;;; modify it under the terms of the GNU Library General Public
14 ;;; License as published by the Free Software Foundation; either
15 ;;; version 2 of the License, or (at your option) any later version.
16 ;;;
17 ;;; This library is distributed in the hope that it will be useful,
18 ;;; but WITHOUT ANY WARRANTY; without even the implied warranty of
19 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
20 ;;; Library General Public License for more details.
21 ;;;
22 ;;; You should have received a copy of the GNU Library General Public
23 ;;; License along with this library; if not, write to the
24 ;;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
25 ;;; Boston, MA 02111-1307 USA.
26
27 ;;; GUI for the Climacs editor.
28
29 (in-package :climacs-gui)
30
31 (defclass extended-pane (climacs-pane)
32 (;; allows a certain number of commands to have some minimal memory
33 (previous-command :initform nil :accessor previous-command)
34 ;; for next-line and previous-line commands
35 (goal-column :initform nil)
36 ;; for dynamic abbrev expansion
37 (original-prefix :initform nil)
38 (prefix-start-offset :initform nil)
39 (dabbrev-expansion-mark :initform nil)
40 (overwrite-mode :initform nil)))
41
42 (defclass info-pane (application-pane)
43 ((climacs-pane :initarg :climacs-pane)))
44
45 (defclass minibuffer-pane (application-pane) ())
46
47 (defmethod stream-accept :before ((pane minibuffer-pane) type &rest args)
48 (declare (ignore type args))
49 (window-clear pane))
50
51 (define-application-frame climacs ()
52 ((windows :accessor windows)
53 (buffers :initform '() :accessor buffers)
54 (recordingp :initform nil :accessor recordingp)
55 (executingp :initform nil :accessor executingp)
56 (recorded-keys :initform '() :accessor recorded-keys)
57 (remaining-keys :initform '() :accessor remaining-keys))
58 (:panes
59 (win (let* ((extended-pane
60 (make-pane 'extended-pane
61 :width 900 :height 400
62 :name 'bla
63 :incremental-redisplay t
64 :display-function 'display-win))
65 (info-pane
66 (make-pane 'info-pane
67 :climacs-pane extended-pane
68 :width 900 :height 20 :max-height 20 :min-height 20
69 ::background +gray85+
70 :scroll-bars nil
71 :borders nil
72 :incremental-redisplay t
73 :display-function 'display-info)))
74 (vertically ()
75 (scrolling ()
76 extended-pane)
77 info-pane)))
78 (int (make-pane 'minibuffer-pane
79 :width 900 :height 20 :max-height 20 :min-height 20
80 :scroll-bars nil)))
81 (:layouts
82 (default
83 (vertically (:scroll-bars nil)
84 win
85 int)))
86 (:top-level (climacs-top-level)))
87
88 (defmacro current-window () ; shouldn't this be an inlined function? --amb
89 `(car (windows *application-frame*)))
90
91 (defmethod redisplay-frame-panes :around ((frame climacs) &rest args)
92 (declare (ignore args))
93 (let ((buffers (remove-duplicates (mapcar #'buffer (windows frame)))))
94 (loop for buffer in buffers
95 do (update-syntax buffer (syntax buffer)))
96 (call-next-method)
97 (loop for buffer in buffers
98 do (clear-modify buffer))))
99
100 (defun climacs ()
101 "Starts up a climacs session"
102 (let ((frame (make-application-frame 'climacs)))
103 (run-frame-top-level frame)))
104
105 (defun display-message (format-string &rest format-args)
106 (apply #'format *standard-input* format-string format-args))
107
108 (defun display-info (frame pane)
109 (declare (ignore frame))
110 (with-slots (climacs-pane) pane
111 (let* ((buf (buffer climacs-pane))
112 (name-info (format nil " ~a ~a Syntax: ~a~a~a ~a"
113 (if (needs-saving buf) "**" "--")
114 (name buf)
115 (name (syntax buf))
116 (if (slot-value climacs-pane 'overwrite-mode)
117 " Ovwrt"
118 "")
119 (if (auto-fill-mode buf)
120 " Fill"
121 "")
122 (if (recordingp *application-frame*)
123 "Def"
124 ""))))
125 (princ name-info pane))))
126
127 (defun display-win (frame pane)
128 "The display function used by the climacs application frame."
129 (declare (ignore frame))
130 (redisplay-pane pane (eq pane (car (windows *application-frame*)))))
131
132 (defun find-gestures (gestures start-table)
133 (loop with table = (find-command-table start-table)
134 for (gesture . rest) on gestures
135 for item = (find-keystroke-item gesture table :errorp nil)
136 while item
137 do (if (eq (command-menu-item-type item) :command)
138 (return (if (null rest) item nil))
139 (setf table (command-menu-item-value item)))
140 finally (return item)))
141
142 (defvar *kill-ring* (make-instance 'kill-ring :max-size 7))
143 (defparameter *current-gesture* nil)
144
145 (defun meta-digit (gesture)
146 (position gesture
147 '((#\0 :meta) (#\1 :meta) (#\2 :meta) (#\3 :meta) (#\4 :meta)
148 (#\5 :meta) (#\6 :meta) (#\7 :meta) (#\8 :meta) (#\9 :meta))
149 :test #'event-matches-gesture-name-p))
150
151 (defun climacs-read-gesture ()
152 (unless (null (remaining-keys *application-frame*))
153 (return-from climacs-read-gesture
154 (pop (remaining-keys *application-frame*))))
155 (loop for gesture = (read-gesture :stream *standard-input*)
156 when (event-matches-gesture-name-p gesture '(:keyboard #\g 512)) ; FIXME
157 do (throw 'outer-loop nil)
158 until (or (characterp gesture)
159 (and (typep gesture 'keyboard-event)
160 (or (keyboard-event-character gesture)
161 (not (member (keyboard-event-key-name
162 gesture)
163 '(:control-left :control-right
164 :shift-left :shift-right
165 :meta-left :meta-right
166 :super-left :super-right
167 :hyper-left :hyper-right
168 :shift-lock :caps-lock
169 :alt-left :alt-right))))))
170 finally (progn (when (recordingp *application-frame*)
171 (push gesture (recorded-keys *application-frame*)))
172 (return gesture))))
173
174 (defun climacs-unread-gesture (gesture stream)
175 (cond ((recordingp *application-frame*)
176 (pop (recorded-keys *application-frame*))
177 (unread-gesture gesture :stream stream))
178 ((executingp *application-frame*)
179 (push gesture (remaining-keys *application-frame*)))
180 (t
181 (unread-gesture gesture :stream stream))))
182
183 (defun read-numeric-argument (&key (stream *standard-input*))
184 (let ((gesture (climacs-read-gesture)))
185 (cond ((event-matches-gesture-name-p gesture '(:keyboard #\u 512)) ; FIXME
186 (let ((numarg 4))
187 (loop for gesture = (climacs-read-gesture)
188 while (event-matches-gesture-name-p gesture '(:keyboard #\u 512)) ; FIXME
189 do (setf numarg (* 4 numarg))
190 finally (climacs-unread-gesture gesture stream))
191 (let ((gesture (climacs-read-gesture)))
192 (cond ((and (characterp gesture)
193 (digit-char-p gesture 10))
194 (setf numarg (- (char-code gesture) (char-code #\0)))
195 (loop for gesture = (climacs-read-gesture)
196 while (and (characterp gesture)
197 (digit-char-p gesture 10))
198 do (setf numarg (+ (* 10 numarg)
199 (- (char-code gesture) (char-code #\0))))
200 finally (climacs-unread-gesture gesture stream)
201 (return (values numarg t))))
202 (t
203 (climacs-unread-gesture gesture stream)
204 (values numarg t))))))
205 ((meta-digit gesture)
206 (let ((numarg (meta-digit gesture)))
207 (loop for gesture = (climacs-read-gesture)
208 while (meta-digit gesture)
209 do (setf numarg (+ (* 10 numarg) (meta-digit gesture)))
210 finally (climacs-unread-gesture gesture stream)
211 (return (values numarg t)))))
212 (t (climacs-unread-gesture gesture stream)
213 (values 1 nil)))))
214
215 ;;; we know the vbox pane has a scroller pane and an info
216 ;;; pane in it. The scroller pane has a viewport in it,
217 ;;; and the viewport contains the climacs-pane as its only child.
218 (defun find-climacs-pane (vbox)
219 (first (sheet-children
220 (find-if-not (lambda (pane) (typep pane 'scroll-bar-pane))
221 (sheet-children
222 (find-if (lambda (pane) (typep pane 'scroller-pane))
223 (sheet-children vbox)))))))
224
225 (defun climacs-top-level (frame &key
226 command-parser command-unparser
227 partial-command-parser prompt)
228 (declare (ignore command-parser command-unparser partial-command-parser prompt))
229 (with-slots (windows) frame
230 (setf windows (list (find-climacs-pane (find-pane-named frame 'win))))
231 (push (buffer (car windows)) (buffers frame))
232 (let ((*standard-output* (car windows))
233 (*standard-input* (find-pane-named frame 'int))
234 (*print-pretty* nil)
235 (*abort-gestures* nil))
236 (redisplay-frame-panes frame :force-p t)
237 (loop (catch 'outer-loop
238 (loop for gestures = '()
239 for numarg = (read-numeric-argument :stream *standard-input*)
240 do (loop (setf *current-gesture* (climacs-read-gesture))
241 (setf gestures (nconc gestures (list *current-gesture*)))
242 (let ((item (find-gestures gestures 'global-climacs-table)))
243 (cond ((not item)
244 (beep) (return))
245 ((eq (command-menu-item-type item) :command)
246 (let ((command (command-menu-item-value item)))
247 (unless (consp command)
248 (setf command (list command)))
249 (setf command (substitute-numeric-argument-marker command numarg))
250 (handler-case
251 (execute-frame-command frame command)
252 (error (condition)
253 (beep)
254 (format *error-output* "~a~%" condition)))
255 (setf (previous-command *standard-output*)
256 (if (consp command)
257 (car command)
258 command))
259 (return)))
260 (t nil))))
261 (let ((buffer (buffer (current-window))))
262 (when (modified-p buffer)
263 (setf (needs-saving buffer) t)))
264 (when (null (remaining-keys *application-frame*))
265 (setf (executingp *application-frame*) nil)
266 (redisplay-frame-panes frame))))
267 (beep)
268 (let ((buffer (buffer (current-window))))
269 (when (modified-p buffer)
270 (setf (needs-saving buffer) t)))
271 (when (null (remaining-keys *application-frame*))
272 (setf (executingp *application-frame*) nil)
273 (redisplay-frame-panes frame))))))
274
275 (defun region-limits (pane)
276 (if (mark< (mark pane) (point pane))
277 (values (mark pane) (point pane))
278 (values (point pane) (mark pane))))
279
280 (defmacro define-named-command (command-name args &body body)
281 `(define-climacs-command ,(if (listp command-name)
282 `(,@command-name :name t)
283 `(,command-name :name t)) ,args ,@body))
284
285 (define-named-command (com-quit) ()
286 (frame-exit *application-frame*))
287
288 (define-named-command com-toggle-overwrite-mode ()
289 (with-slots (overwrite-mode) (current-window)
290 (setf overwrite-mode (not overwrite-mode))))
291
292 (defun possibly-fill-line ()
293 (let* ((pane (current-window))
294 (buffer (buffer pane)))
295 (when (auto-fill-mode buffer)
296 (let* ((fill-column (auto-fill-column buffer))
297 (point (point pane))
298 (offset (offset point))
299 (tab-width (tab-space-count (stream-default-view pane)))
300 (syntax (syntax buffer)))
301 (when (>= (buffer-display-column buffer offset tab-width)
302 (1- (auto-fill-column buffer)))
303 (fill-line point
304 (lambda (mark)
305 (syntax-line-indentation mark tab-width syntax))
306 fill-column
307 tab-width))))))
308
309 (defun insert-character (char)
310 (let* ((win (current-window))
311 (point (point win)))
312 (unless (constituentp char)
313 (possibly-expand-abbrev point))
314 (when (whitespacep char)
315 (possibly-fill-line))
316 (if (and (slot-value win 'overwrite-mode) (not (end-of-line-p point)))
317 (progn
318 (delete-range point)
319 (insert-object point char))
320 (insert-object point char))))
321
322 (define-command com-self-insert ()
323 (insert-character *current-gesture*))
324
325 (define-named-command com-beginning-of-line ()
326 (beginning-of-line (point (current-window))))
327
328 (define-named-command com-end-of-line ()
329 (end-of-line (point (current-window))))
330
331 (define-named-command com-delete-object ((count 'integer :prompt "Number of Objects"))
332 (delete-range (point (current-window)) count))
333
334 (define-named-command com-backward-delete-object ((count 'integer :prompt "Number of Objects"))
335 (delete-range (point (current-window)) (- count)))
336
337 (define-named-command com-transpose-objects ()
338 (let* ((point (point (current-window))))
339 (unless (beginning-of-buffer-p point)
340 (when (end-of-line-p point)
341 (backward-object point))
342 (let ((object (object-after point)))
343 (delete-range point)
344 (backward-object point)
345 (insert-object point object)
346 (forward-object point)))))
347
348 (define-named-command com-backward-object ((count 'integer :prompt "Number of Objects"))
349 (backward-object (point (current-window)) count))
350
351 (define-named-command com-forward-object ((count 'integer :prompt "Number of Objects"))
352 (forward-object (point (current-window)) count))
353
354 (define-named-command com-transpose-words ()
355 (let* ((point (point (current-window))))
356 (let (bw1 bw2 ew1 ew2)
357 (backward-word point)
358 (setf bw1 (offset point))
359 (forward-word point)
360 (setf ew1 (offset point))
361 (forward-word point)
362 (when (= (offset point) ew1)
363 ;; this is emacs' message in the minibuffer
364 (error "Don't have two things to transpose"))
365 (setf ew2 (offset point))
366 (backward-word point)
367 (setf bw2 (offset point))
368 (let ((w2 (buffer-sequence (buffer point) bw2 ew2))
369 (w1 (buffer-sequence (buffer point) bw1 ew1)))
370 (delete-word point)
371 (insert-sequence point w1)
372 (backward-word point)
373 (backward-word point)
374 (delete-word point)
375 (insert-sequence point w2)
376 (forward-word point)))))
377
378 (define-named-command com-transpose-lines ()
379 (let ((point (point (current-window))))
380 (beginning-of-line point)
381 (unless (beginning-of-buffer-p point)
382 (previous-line point))
383 (let* ((bol (offset point))
384 (eol (progn (end-of-line point)
385 (offset point)))
386 (line (buffer-sequence (buffer point) bol eol)))
387 (delete-region bol point)
388 ;; Remove newline at end of line as well.
389 (unless (end-of-buffer-p point)
390 (delete-range point))
391 ;; If the current line is at the end of the buffer, we want to
392 ;; be able to insert past it, so we need to get an extra line
393 ;; at the end.
394 (end-of-line point)
395 (when (end-of-buffer-p point)
396 (insert-object point #\Newline))
397 (next-line point 0)
398 (insert-sequence point line)
399 (insert-object point #\Newline))))
400
401 (define-named-command com-previous-line ()
402 (let* ((win (current-window))
403 (point (point win)))
404 (unless (or (eq (previous-command win) 'com-previous-line)
405 (eq (previous-command win) 'com-next-line))
406 (setf (slot-value win 'goal-column) (column-number point)))
407 (previous-line point (slot-value win 'goal-column))))
408
409 (define-named-command com-next-line ()
410 (let* ((win (current-window))
411 (point (point win)))
412 (unless (or (eq (previous-command win) 'com-previous-line)
413 (eq (previous-command win) 'com-next-line))
414 (setf (slot-value win 'goal-column) (column-number point)))
415 (next-line point (slot-value win 'goal-column))))
416
417 (define-named-command com-open-line ()
418 (open-line (point (current-window))))
419
420 (define-named-command com-kill-line ()
421 (let* ((pane (current-window))
422 (point (point pane))
423 (mark (offset point)))
424 (cond ((end-of-buffer-p point) nil)
425 ((end-of-line-p point)(forward-object point))
426 (t
427 (end-of-line point)
428 (cond ((beginning-of-buffer-p point) nil)
429 ((beginning-of-line-p point)(forward-object point)))))
430 (if (eq (previous-command pane) 'com-kill-line)
431 (kill-ring-concatenating-push *kill-ring*
432 (region-to-sequence mark point))
433 (kill-ring-standard-push *kill-ring*
434 (region-to-sequence mark point)))
435 (delete-region mark point)))
436
437 (define-named-command com-forward-word ()
438 (forward-word (point (current-window))))
439
440 (define-named-command com-backward-word ()
441 (backward-word (point (current-window))))
442
443 (define-named-command com-delete-word ()
444 (delete-word (point (current-window))))
445
446 (define-named-command com-backward-delete-word ()
447 (backward-delete-word (point (current-window))))
448
449 (define-named-command com-upcase-region ()
450 (multiple-value-bind (start end) (region-limits (current-window))
451 (upcase-region start end)))
452
453 (define-named-command com-downcase-region ()
454 (multiple-value-bind (start end) (region-limits (current-window))
455 (downcase-region start end)))
456
457 (define-named-command com-capitalize-region ()
458 (multiple-value-bind (start end) (region-limits (current-window))
459 (capitalize-region start end)))
460
461 (define-named-command com-upcase-word ()
462 (upcase-word (point (current-window))))
463
464 (define-named-command com-downcase-word ()
465 (downcase-word (point (current-window))))
466
467 (define-named-command com-capitalize-word ()
468 (capitalize-word (point (current-window))))
469
470 (define-named-command com-tabify-region ()
471 (let ((pane (current-window)))
472 (multiple-value-bind (start end) (region-limits pane)
473 (tabify-region start end (tab-space-count (stream-default-view pane))))))
474
475 (define-named-command com-untabify-region ()
476 (let ((pane (current-window)))
477 (multiple-value-bind (start end) (region-limits pane)
478 (untabify-region start end (tab-space-count (stream-default-view pane))))))
479
480 (defun indent-current-line (pane point)
481 (let* ((buffer (buffer pane))
482 (view (stream-default-view pane))
483 (tab-space-count (tab-space-count view))
484 (indentation (syntax-line-indentation point
485 tab-space-count
486 (syntax buffer))))
487 (indent-line point indentation (and (indent-tabs-mode buffer)
488 tab-space-count))))
489
490 (define-named-command com-indent-line ()
491 (let* ((pane (current-window))
492 (point (point pane)))
493 (indent-current-line pane point)))
494
495 (define-named-command com-newline-and-indent ()
496 (let* ((pane (current-window))
497 (point (point pane)))
498 (insert-object point #\Newline)
499 (indent-current-line pane point)))
500
501 (define-named-command com-delete-indentation ()
502 (delete-indentation (point (current-window))))
503
504 (define-named-command com-auto-fill-mode ()
505 (let ((buffer (buffer (current-window))))
506 (setf (auto-fill-mode buffer) (not (auto-fill-mode buffer)))))
507
508 (define-named-command com-fill-paragraph ()
509 (let* ((pane (current-window))
510 (buffer (buffer pane))
511 (syntax (syntax buffer))
512 (point (point pane))
513 (begin-mark (clone-mark point))
514 (end-mark (clone-mark point)))
515 (unless (eql (object-before begin-mark) #\Newline)
516 (beginning-of-paragraph begin-mark syntax))
517 (unless (eql (object-after end-mark) #\Newline)
518 (end-of-paragraph end-mark syntax))
519 (do-buffer-region (object offset buffer
520 (offset begin-mark) (offset end-mark))
521 (when (eql object #\Newline)
522 (setf object #\Space)))
523 (let ((point-backup (clone-mark point)))
524 (setf (offset point) (offset end-mark))
525 (possibly-fill-line)
526 (setf (offset point) (offset point-backup)))))
527
528 (define-command com-extended-command ()
529 (let ((item (accept 'command :prompt "Extended Command")))
530 (execute-frame-command *application-frame* item)))
531
532 (eval-when (:compile-toplevel :load-toplevel)
533 (define-presentation-type completable-pathname ()
534 :inherit-from 'pathname))
535
536 (defun filename-completer (so-far mode)
537 (flet ((remove-trail (s)
538 (subseq s 0 (let ((pos (position #\/ s :from-end t)))
539 (if pos (1+ pos) 0)))))
540 (let* ((directory-prefix
541 (if (and (plusp (length so-far)) (eql (aref so-far 0) #\/))
542 ""
543 (namestring #+sbcl *default-pathname-defaults*
544 #+cmu (ext:default-directory)
545 #-(or sbcl cmu) *default-pathname-defaults*)))
546 (full-so-far (concatenate 'string directory-prefix so-far))
547 (pathnames
548 (loop with length = (length full-so-far)
549 for path in (directory (concatenate 'string
550 (remove-trail so-far)
551 "*.*"))
552 when (let ((mismatch (mismatch (namestring path) full-so-far)))
553 (or (null mismatch) (= mismatch length)))
554 collect path))
555 (strings (mapcar #'namestring pathnames))
556 (first-string (car strings))
557 (length-common-prefix nil)
558 (completed-string nil)
559 (full-completed-string nil))
560 (unless (null pathnames)
561 (setf length-common-prefix
562 (loop with length = (length first-string)
563 for string in (cdr strings)
564 do (setf length (min length (or (mismatch string first-string) length)))
565 finally (return length))))
566 (unless (null pathnames)
567 (setf completed-string
568 (subseq first-string (length directory-prefix)
569 (if (null (cdr pathnames)) nil length-common-prefix)))
570 (setf full-completed-string
571 (concatenate 'string directory-prefix completed-string)))
572 (case mode
573 ((:complete-limited :complete-maximal)
574 (cond ((null pathnames)
575 (values so-far nil nil 0 nil))
576 ((null (cdr pathnames))
577 (values completed-string t (car pathnames) 1 nil))
578 (t
579 (values completed-string nil nil (length pathnames) nil))))
580 (:complete
581 (cond ((null pathnames)
582 (values so-far t so-far 1 nil))
583 ((null (cdr pathnames))
584 (values completed-string t (car pathnames) 1 nil))
585 ((find full-completed-string strings :test #'string-equal)
586 (let ((pos (position full-completed-string strings :test #'string-equal)))
587 (values completed-string
588 t (elt pathnames pos) (length pathnames) nil)))
589 (t
590 (values completed-string nil nil (length pathnames) nil))))
591 (:possibilities
592 (values nil nil nil (length pathnames)
593 (loop with length = (length directory-prefix)
594 for name in pathnames
595 collect (list (subseq (namestring name) length nil)
596 name))))))))
597
598 (define-presentation-method accept
599 ((type completable-pathname) stream (view textual-view) &key)
600 (multiple-value-bind (pathname success string)
601 (complete-input stream
602 #'filename-completer
603 :partial-completers '(#\Space)
604 :allow-any-input t)
605 (declare (ignore success))
606 (or pathname string)))
607
608 (defun pathname-filename (pathname)
609 (if (null (pathname-type pathname))
610 (pathname-name pathname)
611 (concatenate 'string (pathname-name pathname)
612 "." (pathname-type pathname))))
613
614 (define-named-command com-find-file ()
615 (let ((filename (accept 'completable-pathname
616 :prompt "Find File"))
617 (buffer (make-instance 'climacs-buffer))
618 (pane (current-window)))
619 (push buffer (buffers *application-frame*))
620 (setf (buffer (current-window)) buffer)
621 (setf (syntax buffer) (make-instance 'basic-syntax))
622 ;; Don't want to create the file if it doesn't exist.
623 (when (probe-file filename)
624 (with-open-file (stream filename :direction :input)
625 (input-from-stream stream buffer 0)))
626 (setf (filename buffer) filename
627 (name buffer) (pathname-filename filename)
628 (needs-saving buffer) nil)
629 (beginning-of-buffer (point pane))
630 ;; this one is needed so that the buffer modification protocol
631 ;; resets the low and high marks after redisplay
632 (redisplay-frame-panes *application-frame*)))
633
634 (define-named-command com-save-buffer ()
635 (let* ((buffer (buffer (current-window)))
636 (filename (or (filename buffer)
637 (accept 'completable-pathname
638 :prompt "Save Buffer to File"))))
639 (if (or (null (filename buffer))
640 (needs-saving buffer))
641 (progn (with-open-file (stream filename :direction :output :if-exists :supersede)
642 (output-to-stream stream buffer 0 (size buffer)))
643 (setf (filename buffer) filename
644 (name buffer) (pathname-filename filename))
645 (display-message "Wrote: ~a" (filename buffer)))
646 (display-message "No changes need to be saved from ~a" (name buffer)))
647 (setf (needs-saving buffer) nil)))
648
649 (define-named-command com-write-buffer ()
650 (let ((filename (accept 'completable-pathname
651 :prompt "Write Buffer to File"))
652 (buffer (buffer (current-window))))
653 (with-open-file (stream filename :direction :output :if-exists :supersede)
654 (output-to-stream stream buffer 0 (size buffer)))
655 (setf (filename buffer) filename
656 (name buffer) (pathname-filename filename)
657 (needs-saving buffer) nil)
658 (display-message "Wrote: ~a" (filename buffer))))
659
660 (define-presentation-method accept
661 ((type buffer) stream (view textual-view) &key)
662 (multiple-value-bind (object success string)
663 (complete-input stream
664 (lambda (so-far action)
665 (complete-from-possibilities
666 so-far (buffers *application-frame*) '() :action action
667 :name-key #'name
668 :value-key #'identity))
669 :partial-completers '(#\Space)
670 :allow-any-input t)
671 (declare (ignore success))
672 (or object
673 (car (push (make-instance 'climacs-buffer :name string)
674 (buffers *application-frame*))))))
675
676 (define-named-command com-switch-to-buffer ()
677 (let ((buffer (accept 'buffer
678 :prompt "Switch to buffer")))
679 (setf (buffer (current-window)) buffer)
680 (setf (syntax buffer) (make-instance 'basic-syntax))
681 (beginning-of-buffer (point (current-window)))
682 (full-redisplay (current-window))))
683
684 (define-named-command com-full-redisplay ()
685 (full-redisplay (current-window)))
686
687 (define-named-command com-load-file ()
688 (let ((filename (accept 'completable-pathname
689 :prompt "Load File")))
690 (load filename)))
691
692 (define-named-command com-beginning-of-buffer ()
693 (beginning-of-buffer (point (current-window))))
694
695 (define-named-command com-page-down ()
696 (let ((pane (current-window)))
697 (page-down pane)))
698
699 (define-named-command com-page-up ()
700 (let ((pane (current-window)))
701 (page-up pane)))
702
703 (define-named-command com-end-of-buffer ()
704 (end-of-buffer (point (current-window))))
705
706 (define-named-command com-back-to-indentation ()
707 (let ((point (point (current-window))))
708 (beginning-of-line point)
709 (loop until (end-of-line-p point)
710 while (whitespacep (object-after point))
711 do (incf (offset point)))))
712
713 (define-named-command com-goto-position ()
714 (setf (offset (point (current-window)))
715 (accept 'integer :prompt "Goto Position")))
716
717 (define-named-command com-goto-line ()
718 (loop with mark = (make-instance 'standard-right-sticky-mark
719 :buffer (buffer (current-window)))
720 do (end-of-line mark)
721 until (end-of-buffer-p mark)
722 repeat (accept 'integer :prompt "Goto Line")
723 do (incf (offset mark))
724 (end-of-line mark)
725 finally (beginning-of-line mark)
726 (setf (offset (point (current-window)))
727 (offset mark))))
728
729 (define-named-command com-browse-url ()
730 (accept 'url :prompt "Browse URL"))
731
732 (define-named-command com-set-mark ()
733 (let ((pane (current-window)))
734 (setf (mark pane) (clone-mark (point pane)))))
735
736 (define-named-command com-exchange-point-and-mark ()
737 (let ((pane (current-window)))
738 (psetf (offset (mark pane)) (offset (point pane))
739 (offset (point pane)) (offset (mark pane)))))
740
741 (define-named-command com-set-syntax ()
742 (let* ((pane (current-window))
743 (buffer (buffer pane)))
744 (setf (syntax buffer)
745 (make-instance (accept 'syntax :prompt "Set Syntax")))
746 (setf (offset (low-mark buffer)) 0
747 (offset (high-mark buffer)) (size buffer))))
748
749 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
750 ;;;
751 ;;; Keyboard macros
752
753 (define-named-command com-start-kbd-macro ()
754 (setf (recordingp *application-frame*) t)
755 (setf (recorded-keys *application-frame*) '()))
756
757 (define-named-command com-end-kbd-macro ()
758 (setf (recordingp *application-frame*) nil)
759 (setf (recorded-keys *application-frame*)
760 ;; this won't work if the command was invoked in any old way
761 (reverse (cddr (recorded-keys *application-frame*)))))
762
763 (define-named-command com-call-last-kbd-macro ()
764 (setf (remaining-keys *application-frame*)
765 (recorded-keys *application-frame*))
766 (setf (executingp *application-frame*) t))
767
768 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
769 ;;;
770 ;;; Commands for splitting windows
771
772 (defun replace-constellation (constellation additional-constellation vertical-p)
773 (let* ((parent (sheet-parent constellation))
774 (children (sheet-children parent))
775 (first (first children))
776 (second (second children)))
777 (assert (member constellation children))
778 (cond ((eq constellation first)
779 (sheet-disown-child parent constellation)
780 (let ((new (if vertical-p
781 (vertically () constellation additional-constellation)
782 (horizontally () constellation additional-constellation))))
783 (sheet-adopt-child parent new)
784 (reorder-sheets parent (list new second))))
785 (t
786 (sheet-disown-child parent constellation)
787 (let ((new (if vertical-p
788 (vertically () constellation additional-constellation)
789 (horizontally () constellation additional-constellation))))
790 (sheet-adopt-child parent new)
791 (reorder-sheets parent (list first new)))))))
792
793 (defun parent3 (sheet)
794 (sheet-parent (sheet-parent (sheet-parent sheet))))
795
796 (defun make-pane-constellation ()
797 "make a vbox containing a scroller pane as its first child and an
798 info pane as its second child. The scroller pane contains a viewport
799 which contains an extended pane. Return the vbox and the extended pane
800 as two values"
801 (let* ((extended-pane
802 (make-pane 'extended-pane
803 :width 900 :height 400
804 :name 'win
805 :incremental-redisplay t
806 :display-function 'display-win))
807 (vbox
808 (vertically ()
809 (scrolling () extended-pane)
810 (make-pane 'info-pane
811 :climacs-pane extended-pane
812 :width 900 :height 20
813 :max-height 20 :min-height 20
814 ::background +gray85+
815 :scroll-bars nil
816 :borders nil
817 :incremental-redisplay t
818 :display-function 'display-info))))
819 (values vbox extended-pane)))
820
821 (define-named-command com-split-window-vertically ()
822 (with-look-and-feel-realization
823 ((frame-manager *application-frame*) *application-frame*)
824 (multiple-value-bind (vbox new-pane) (make-pane-constellation)
825 (let* ((current-window (current-window))
826 (constellation-root (parent3 current-window)))
827 (setf (buffer new-pane) (buffer current-window))
828 (push new-pane (windows *application-frame*))
829 (replace-constellation constellation-root vbox t)
830 (full-redisplay current-window)
831 (full-redisplay new-pane)))))
832
833 (define-named-command com-split-window-horizontally ()
834 (with-look-and-feel-realization
835 ((frame-manager *application-frame*) *application-frame*)
836 (multiple-value-bind (vbox new-pane) (make-pane-constellation)
837 (let* ((current-window (current-window))
838 (constellation-root (parent3 current-window)))
839 (setf (buffer new-pane) (buffer current-window))
840 (push new-pane (windows *application-frame*))
841 (replace-constellation constellation-root vbox nil)
842 (full-redisplay current-window)
843 (full-redisplay new-pane)))))
844
845 (define-named-command com-other-window ()
846 (setf (windows *application-frame*)
847 (append (cdr (windows *application-frame*))
848 (list (car (windows *application-frame*))))))
849
850 (define-named-command com-delete-window ()
851 (unless (null (cdr (windows *application-frame*)))
852 (let* ((constellation (parent3 (current-window)))
853 (box (sheet-parent constellation))
854 (box-children (sheet-children box))
855 (other (if (eq constellation (first box-children))
856 (second box-children)
857 (first box-children)))
858 (parent (sheet-parent box))
859 (children (sheet-children parent))
860 (first (first children))
861 (second (second children)))
862 (pop (windows *application-frame*))
863 (sheet-disown-child box other)
864 (cond ((eq box first)
865 (sheet-disown-child parent box)
866 (sheet-adopt-child parent other)
867 (reorder-sheets parent (list other second)))
868 (t
869 (sheet-disown-child parent box)
870 (sheet-adopt-child parent other)
871 (reorder-sheets parent (list first other)))))))
872
873 ;;;;;;;;;;;;;;;;;;;;
874 ;; Kill ring commands
875
876 ;; Copies an element from a kill-ring to a buffer at the given offset
877 (define-named-command com-yank ()
878 (insert-sequence (point (current-window)) (kill-ring-yank *kill-ring*)))
879
880 ;; Destructively cut a given buffer region into the kill-ring
881 (define-named-command com-cut-out ()
882 (multiple-value-bind (start end) (region-limits (current-window))
883 (kill-ring-standard-push *kill-ring* (region-to-sequence start end))
884 (delete-region (offset start) end)))
885
886 ;; Non destructively copies in buffer region to the kill ring
887 (define-named-command com-copy-out ()
888 (let ((pane (current-window)))
889 (kill-ring-standard-push *kill-ring* (region-to-sequence (point pane) (mark pane)))))
890
891 (define-named-command com-rotate-yank ()
892 (let* ((pane (current-window))
893 (point (point pane))
894 (last-yank (kill-ring-yank *kill-ring*)))
895 (if (eq (previous-command pane)
896 'com-rotate-yank)
897 (progn
898 (delete-range point (* -1 (length last-yank)))
899 (rotate-yank-position *kill-ring*)))
900 (insert-sequence point (kill-ring-yank *kill-ring*))))
901
902 (define-named-command com-resize-kill-ring ()
903 (let ((size (accept 'integer :prompt "New kill ring size")))
904 (setf (kill-ring-max-size *kill-ring*) size)))
905
906 (define-named-command com-search-forward ()
907 (search-forward (point (current-window))
908 (accept 'string :prompt "Search Forward")
909 :test (lambda (a b)
910 (and (characterp b) (char-equal a b)))))
911
912 (define-named-command com-search-backward ()
913 (search-backward (point (current-window))
914 (accept 'string :prompt "Search Backward")
915 :test (lambda (a b)
916 (and (characterp b) (char-equal a b)))))
917
918 (define-named-command com-dabbrev-expand ()
919 (let* ((win (current-window))
920 (point (point win)))
921 (with-slots (original-prefix prefix-start-offset dabbrev-expansion-mark) win
922 (flet ((move () (cond ((beginning-of-buffer-p dabbrev-expansion-mark)
923 (setf (offset dabbrev-expansion-mark)
924 (offset point))
925 (forward-word dabbrev-expansion-mark))
926 ((mark< dabbrev-expansion-mark point)
927 (backward-object dabbrev-expansion-mark))
928 (t (forward-object dabbrev-expansion-mark)))))
929 (unless (or (beginning-of-buffer-p point)
930 (not (constituentp (object-before point))))
931 (unless (and (eq (previous-command win) 'com-dabbrev-expand)
932 (not (null prefix-start-offset)))
933 (setf dabbrev-expansion-mark (clone-mark point))
934 (backward-word dabbrev-expansion-mark)
935 (setf prefix-start-offset (offset dabbrev-expansion-mark))
936 (setf original-prefix (region-to-sequence prefix-start-offset point))
937 (move))
938 (loop until (or (end-of-buffer-p dabbrev-expansion-mark)
939 (and (or (beginning-of-buffer-p dabbrev-expansion-mark)
940 (not (constituentp (object-before dabbrev-expansion-mark))))
941 (looking-at dabbrev-expansion-mark original-prefix)))
942 do (move))
943 (if (end-of-buffer-p dabbrev-expansion-mark)
944 (progn (delete-region prefix-start-offset point)
945 (insert-sequence point original-prefix)
946 (setf prefix-start-offset nil))
947 (progn (delete-region prefix-start-offset point)
948 (insert-sequence point
949 (let ((offset (offset dabbrev-expansion-mark)))
950 (prog2 (forward-word dabbrev-expansion-mark)
951 (region-to-sequence offset dabbrev-expansion-mark)
952 (setf (offset dabbrev-expansion-mark) offset))))
953 (move))))))))
954
955 (define-named-command com-beginning-of-paragraph ()
956 (let* ((pane (current-window))
957 (point (point pane))
958 (syntax (syntax (buffer pane))))
959 (beginning-of-paragraph point syntax)))
960
961 (define-named-command com-end-of-paragraph ()
962 (let* ((pane (current-window))
963 (point (point pane))
964 (syntax (syntax (buffer pane))))
965 (end-of-paragraph point syntax)))
966
967 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
968 ;;;
969 ;;; Global and dead-escape command tables
970
971 (make-command-table 'global-climacs-table :errorp nil)
972
973 (make-command-table 'dead-escape-climacs-table :errorp nil)
974
975 (add-menu-item-to-command-table 'global-climacs-table "dead-escape"
976 :menu 'dead-escape-climacs-table
977 :keystroke '(:escape))
978
979 (defun dead-escape-set-key (gesture command)
980 (add-command-to-command-table command 'dead-escape-climacs-table
981 :keystroke gesture :errorp nil))
982
983 (defun global-set-key (gesture command)
984 (add-command-to-command-table command 'global-climacs-table
985 :keystroke gesture :errorp nil)
986 (when (and
987 (listp gesture)
988 (find :meta gesture))
989 (dead-escape-set-key (remove :meta gesture) command)))
990
991 (loop for code from (char-code #\Space) to (char-code #\~)
992 do (global-set-key (code-char code) 'com-self-insert))
993
994 (global-set-key #\Newline 'com-self-insert)
995 (global-set-key #\Tab 'com-indent-line)
996 (global-set-key '(#\j :control) 'com-newline-and-indent)
997 (global-set-key '(#\f :control) `(com-forward-object ,*numeric-argument-marker*))
998 (global-set-key '(#\b :control) `(com-backward-object ,*numeric-argument-marker*))
999 (global-set-key '(#\a :control) 'com-beginning-of-line)
1000 (global-set-key '(#\e :control) 'com-end-of-line)
1001 (global-set-key '(#\d :control) `(com-delete-object ,*numeric-argument-marker*))
1002 (global-set-key '(#\p :control) 'com-previous-line)
1003 (global-set-key '(#\l :control) 'com-full-redisplay)
1004 (global-set-key '(#\n :control) 'com-next-line)
1005 (global-set-key '(#\o :control) 'com-open-line)
1006 (global-set-key '(#\k :control) 'com-kill-line)
1007 (global-set-key '(#\t :control) 'com-transpose-objects)
1008 (global-set-key '(#\Space :control) 'com-set-mark)
1009 (global-set-key '(#\y :control) 'com-yank)
1010 (global-set-key '(#\w :control) 'com-cut-out)
1011 (global-set-key '(#\f :meta) 'com-forward-word)
1012 (global-set-key '(#\b :meta) 'com-backward-word)
1013 (global-set-key '(#\t :meta) 'com-transpose-words)
1014 (global-set-key '(#\u :meta) 'com-upcase-word)
1015 (global-set-key '(#\l :meta) 'com-downcase-word)
1016 (global-set-key '(#\c :meta) 'com-capitalize-word)
1017 (global-set-key '(#\x :meta) 'com-extended-command)
1018 (global-set-key '(#\y :meta) 'com-rotate-yank)
1019 (global-set-key '(#\w :meta) 'com-copy-out)
1020 (global-set-key '(#\v :control) 'com-page-down)
1021 (global-set-key '(#\v :meta) 'com-page-up)
1022 (global-set-key '(#\< :shift :meta) 'com-beginning-of-buffer)
1023 (global-set-key '(#\> :shift :meta) 'com-end-of-buffer)
1024 (global-set-key '(#\m :meta) 'com-back-to-indentation)
1025 (global-set-key '(#\^ :shift :meta) 'com-delete-indentation)
1026 (global-set-key '(#\q :meta) 'com-fill-paragraph)
1027 (global-set-key '(#\d :meta) 'com-delete-word)
1028 (global-set-key '(#\Backspace :meta) 'com-backward-delete-word)
1029 (global-set-key '(#\/ :meta) 'com-dabbrev-expand)
1030 (global-set-key '(#\a :control :meta) 'com-beginning-of-paragraph)
1031 (global-set-key '(#\e :control :meta) 'com-end-of-paragraph)
1032
1033 (global-set-key '(:up) 'com-previous-line)
1034 (global-set-key '(:down) 'com-next-line)
1035 (global-set-key '(:left) `(com-backward-object ,*numeric-argument-marker*))
1036 (global-set-key '(:right) `(com-forward-object ,*numeric-argument-marker*))
1037 (global-set-key '(:left :control) 'com-backward-word)
1038 (global-set-key '(:right :control) 'com-forward-word)
1039 (global-set-key '(:home) 'com-beginning-of-line)
1040 (global-set-key '(:end) 'com-end-of-line)
1041 (global-set-key '(:prior) 'com-page-up)
1042 (global-set-key '(:next) 'com-page-down)
1043 (global-set-key '(:home :control) 'com-beginning-of-buffer)
1044 (global-set-key '(:end :control) 'com-end-of-buffer)
1045 (global-set-key #\Rubout `(com-delete-object ,*numeric-argument-marker*))
1046 (global-set-key #\Backspace `(com-backward-delete-object ,*numeric-argument-marker*))
1047
1048 (global-set-key '(:insert) 'com-toggle-overwrite-mode)
1049
1050 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
1051 ;;;
1052 ;;; C-x command table
1053
1054 (make-command-table 'c-x-climacs-table :errorp nil)
1055
1056 (add-menu-item-to-command-table 'global-climacs-table "C-x"
1057 :menu 'c-x-climacs-table
1058 :keystroke '(#\x :control))
1059
1060 (defun c-x-set-key (gesture command)
1061 (add-command-to-command-table command 'c-x-climacs-table
1062 :keystroke gesture :errorp nil))
1063
1064 (c-x-set-key '(#\0) 'com-delete-window)
1065 (c-x-set-key '(#\2) 'com-split-window-vertically)
1066 (c-x-set-key '(#\3) 'com-split-window-horizontally)
1067 (c-x-set-key '(#\() 'com-start-kbd-macro)
1068 (c-x-set-key '(#\)) 'com-end-kbd-macro)
1069 (c-x-set-key '(#\b) 'com-switch-to-buffer)
1070 (c-x-set-key '(#\e) 'com-call-last-kbd-macro)
1071 (c-x-set-key '(#\c :control) 'com-quit)
1072 (c-x-set-key '(#\f :control) 'com-find-file)
1073 (c-x-set-key '(#\l :control) 'com-load-file)
1074 (c-x-set-key '(#\o) 'com-other-window)
1075 (c-x-set-key '(#\s :control) 'com-save-buffer)
1076 (c-x-set-key '(#\t :control) 'com-transpose-lines)
1077 (c-x-set-key '(#\w :control) 'com-write-buffer)
1078 (c-x-set-key '(#\x :control) 'com-exchange-point-and-mark)
1079
1080 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
1081 ;;;
1082 ;;; Some Unicode stuff
1083
1084 (define-named-command com-insert-charcode ((code 'integer :prompt "Code point"))
1085 (insert-object (point (current-window)) (code-char code)))
1086
1087 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
1088 ;;;
1089 ;;; Dead-acute command table
1090
1091 (make-command-table 'dead-acute-climacs-table :errorp nil)
1092
1093 (add-menu-item-to-command-table 'global-climacs-table "dead-acute"
1094 :menu 'dead-acute-climacs-table
1095 :keystroke '(:dead--acute))
1096
1097 (defun dead-acute-set-key (gesture command)
1098 (add-command-to-command-table command 'dead-acute-climacs-table
1099 :keystroke gesture :errorp nil))
1100
1101 (dead-acute-set-key '(#\A) '(com-insert-charcode 193))
1102 (dead-acute-set-key '(#\E) '(com-insert-charcode 201))
1103 (dead-acute-set-key '(#\I) '(com-insert-charcode 205))
1104 (dead-acute-set-key '(#\O) '(com-insert-charcode 211))
1105 (dead-acute-set-key '(#\U) '(com-insert-charcode 218))
1106 (dead-acute-set-key '(#\Y) '(com-insert-charcode 221))
1107 (dead-acute-set-key '(#\a) '(com-insert-charcode 225))
1108 (dead-acute-set-key '(#\e) '(com-insert-charcode 233))
1109 (dead-acute-set-key '(#\i) '(com-insert-charcode 237))
1110 (dead-acute-set-key '(#\o) '(com-insert-charcode 243))
1111 (dead-acute-set-key '(#\u) '(com-insert-charcode 250))
1112 (dead-acute-set-key '(#\y) '(com-insert-charcode 253))
1113 (dead-acute-set-key '(#\C) '(com-insert-charcode 199))
1114 (dead-acute-set-key '(#\c) '(com-insert-charcode 231))
1115 (dead-acute-set-key '(#\x) '(com-insert-charcode 215))
1116 (dead-acute-set-key '(#\-) '(com-insert-charcode 247))
1117 (dead-acute-set-key '(#\T) '(com-insert-charcode 222))
1118 (dead-acute-set-key '(#\t) '(com-insert-charcode 254))
1119 (dead-acute-set-key '(#\s) '(com-insert-charcode 223))
1120 (dead-acute-set-key '(#\Space) '(com-insert-charcode 39))
1121
1122 (make-command-table 'dead-acute-dead-accute-climacs-table :errorp nil)
1123
1124 (add-menu-item-to-command-table 'dead-acute-climacs-table "dead-acute-dead-accute"
1125 :menu 'dead-acute-dead-accute-climacs-table
1126 :keystroke '(:dead--acute))
1127
1128 (defun dead-acute-dead-accute-set-key (gesture command)
1129 (add-command-to-command-table command 'dead-acute-dead-accute-climacs-table
1130 :keystroke gesture :errorp nil))
1131
1132 (dead-acute-dead-accute-set-key '(#\A) '(com-insert-charcode 197))
1133 (dead-acute-dead-accute-set-key '(#\a) '(com-insert-charcode 229))
1134 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
1135 ;;;
1136 ;;; Dead-grave command table
1137
1138 (make-command-table 'dead-grave-climacs-table :errorp nil)
1139
1140 (add-menu-item-to-command-table 'global-climacs-table "dead-grave"
1141 :menu 'dead-grave-climacs-table
1142 :keystroke '(:dead--grave))
1143
1144 (defun dead-grave-set-key (gesture command)
1145 (add-command-to-command-table command 'dead-grave-climacs-table
1146 :keystroke gesture :errorp nil))
1147
1148 (dead-grave-set-key '(#\A) '(com-insert-charcode 192))
1149 (dead-grave-set-key '(#\E) '(com-insert-charcode 200))
1150 (dead-grave-set-key '(#\I) '(com-insert-charcode 204))
1151 (dead-grave-set-key '(#\O) '(com-insert-charcode 210))
1152 (dead-grave-set-key '(#\U) '(com-insert-charcode 217))
1153 (dead-grave-set-key '(#\a) '(com-insert-charcode 224))
1154 (dead-grave-set-key '(#\e) '(com-insert-charcode 232))
1155 (dead-grave-set-key '(#\i) '(com-insert-charcode 236))
1156 (dead-grave-set-key '(#\o) '(com-insert-charcode 242))
1157 (dead-grave-set-key '(#\u) '(com-insert-charcode 249))
1158 (dead-grave-set-key '(#\Space) '(com-insert-charcode 96))
1159
1160 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
1161 ;;;
1162 ;;; Dead-diaeresis command table
1163
1164 (make-command-table 'dead-diaeresis-climacs-table :errorp nil)
1165
1166 (add-menu-item-to-command-table 'global-climacs-table "dead-diaeresis"
1167 :menu 'dead-diaeresis-climacs-table
1168 :keystroke '(:dead--diaeresis :shift))
1169
1170 (defun dead-diaeresis-set-key (gesture command)
1171 (add-command-to-command-table command 'dead-diaeresis-climacs-table
1172 :keystroke gesture :errorp nil))
1173
1174 (dead-diaeresis-set-key '(#\A) '(com-insert-charcode 196))
1175 (dead-diaeresis-set-key '(#\E) '(com-insert-charcode 203))
1176 (dead-diaeresis-set-key '(#\I) '(com-insert-charcode 207))
1177 (dead-diaeresis-set-key '(#\O) '(com-insert-charcode 214))
1178 (dead-diaeresis-set-key '(#\U) '(com-insert-charcode 220))
1179 (dead-diaeresis-set-key '(#\a) '(com-insert-charcode 228))
1180 (dead-diaeresis-set-key '(#\e) '(com-insert-charcode 235))
1181 (dead-diaeresis-set-key '(#\i) '(com-insert-charcode 239))
1182 (dead-diaeresis-set-key '(#\o) '(com-insert-charcode 246))
1183 (dead-diaeresis-set-key '(#\u) '(com-insert-charcode 252))
1184 (dead-diaeresis-set-key '(#\y) '(com-insert-charcode 255))
1185 (dead-diaeresis-set-key '(#\Space) '(com-insert-charcode 34))
1186
1187 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
1188 ;;;
1189 ;;; Dead-tilde command table
1190
1191 (make-command-table 'dead-tilde-climacs-table :errorp nil)
1192
1193 (add-menu-item-to-command-table 'global-climacs-table "dead-tilde"
1194 :menu 'dead-tilde-climacs-table
1195 :keystroke '(:dead--tilde :shift))
1196
1197 (defun dead-tilde-set-key (gesture command)
1198 (add-command-to-command-table command 'dead-tilde-climacs-table
1199 :keystroke gesture :errorp nil))
1200
1201 (dead-tilde-set-key '(#\A) '(com-insert-charcode 195))
1202 (dead-tilde-set-key '(#\N) '(com-insert-charcode 209))
1203 (dead-tilde-set-key '(#\a) '(com-insert-charcode 227))
1204 (dead-tilde-set-key '(#\n) '(com-insert-charcode 241))
1205 (dead-tilde-set-key '(#\E) '(com-insert-charcode 198))
1206 (dead-tilde-set-key '(#\e) '(com-insert-charcode 230))
1207 (dead-tilde-set-key '(#\D) '(com-insert-charcode 208))
1208 (dead-tilde-set-key '(#\d) '(com-insert-charcode 240))
1209 (dead-tilde-set-key '(#\O) '(com-insert-charcode 216))
1210 (dead-tilde-set-key '(#\o) '(com-insert-charcode 248))
1211 (dead-tilde-set-key '(#\Space) '(com-insert-charcode 126))
1212
1213 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
1214 ;;;
1215 ;;; Dead-circumflex command table
1216
1217 (make-command-table 'dead-circumflex-climacs-table :errorp nil)
1218
1219 (add-menu-item-to-command-table 'global-climacs-table "dead-circumflex"
1220 :menu 'dead-circumflex-climacs-table
1221 :keystroke '(:dead--circumflex :shift))
1222
1223 (defun dead-circumflex-set-key (gesture command)
1224 (add-command-to-command-table command 'dead-circumflex-climacs-table
1225 :keystroke gesture :errorp nil))
1226
1227 (dead-circumflex-set-key '(#\A) '(com-insert-charcode 194))
1228 (dead-circumflex-set-key '(#\E) '(com-insert-charcode 202))
1229 (dead-circumflex-set-key '(#\I) '(com-insert-charcode 206))
1230 (dead-circumflex-set-key '(#\O) '(com-insert-charcode 212))
1231 (dead-circumflex-set-key '(#\U) '(com-insert-charcode 219))
1232 (dead-circumflex-set-key '(#\a) '(com-insert-charcode 226))
1233 (dead-circumflex-set-key '(#\e) '(com-insert-charcode 234))
1234 (dead-circumflex-set-key '(#\i) '(com-insert-charcode 238))
1235 (dead-circumflex-set-key '(#\o) '(com-insert-charcode 244))
1236 (dead-circumflex-set-key '(#\u) '(com-insert-charcode 251))
1237 (dead-circumflex-set-key '(#\Space) '(com-insert-charcode 94))

  ViewVC Help
Powered by ViewVC 1.1.5