[climacs-cvs] CVS update: climacs/gui.lisp

Matthieu Villeneuve mvilleneuve at common-lisp.net
Thu Jan 20 23:42:06 UTC 2005


Update of /project/climacs/cvsroot/climacs
In directory common-lisp.net:/tmp/cvs-serv867

Modified Files:
	gui.lisp 
Log Message:
Added command fill-paragraph (bound to M-q)
Date: Thu Jan 20 15:42:05 2005
Author: mvilleneuve

Index: climacs/gui.lisp
diff -u climacs/gui.lisp:1.89 climacs/gui.lisp:1.90
--- climacs/gui.lisp:1.89	Thu Jan 20 11:12:48 2005
+++ climacs/gui.lisp	Thu Jan 20 15:42:04 2005
@@ -505,6 +505,26 @@
   (let ((buffer (buffer (current-window))))
     (setf (auto-fill-mode buffer) (not (auto-fill-mode buffer)))))
 
+(define-named-command com-fill-paragraph ()
+  (let* ((pane (current-window))
+         (buffer (buffer pane))
+         (syntax (syntax buffer))
+	 (point (point pane))
+         (begin-mark (clone-mark point))
+         (end-mark (clone-mark point)))
+    (unless (eql (object-before begin-mark) #\Newline)
+      (beginning-of-paragraph begin-mark syntax))
+    (unless (eql (object-after end-mark) #\Newline)
+      (end-of-paragraph end-mark syntax))
+    (do-buffer-region (object offset buffer
+                       (offset begin-mark) (offset end-mark))
+      (when (eql object #\Newline)
+        (setf object #\Space)))
+    (let ((point-backup (clone-mark point)))
+      (setf (offset point) (offset end-mark))
+      (possibly-fill-line)
+      (setf (offset point) (offset point-backup)))))
+
 (define-command com-extended-command ()
   (let ((item (accept 'command :prompt "Extended Command")))
     (execute-frame-command *application-frame* item)))
@@ -1003,6 +1023,7 @@
 (global-set-key '(#\> :shift :meta) 'com-end-of-buffer)
 (global-set-key '(#\m :meta) 'com-back-to-indentation)
 (global-set-key '(#\^ :shift :meta) 'com-delete-indentation)
+(global-set-key '(#\q :meta) 'com-fill-paragraph)
 (global-set-key '(#\d :meta) 'com-delete-word)
 (global-set-key '(#\Backspace :meta) 'com-backward-delete-word)
 (global-set-key '(#\/ :meta) 'com-dabbrev-expand)




More information about the Climacs-cvs mailing list