Paste number 52155: Drei patches for athas

Paste number 52155: Drei patches for athas
Pasted by: hefner
When:1 year, 6 months ago
Share:Tweet this! | http://paste.lisp.org/+148R
Channel:#lisp
Paste contents:
Raw Source | XML | Display As
Index: core-commands.lisp
===================================================================
RCS file: /project/mcclim/cvsroot/mcclim/Drei/core-commands.lisp,v
retrieving revision 1.7
diff -u -9 -r1.7 core-commands.lisp
--- core-commands.lisp	8 Dec 2007 08:53:50 -0000	1.7
+++ core-commands.lisp	8 Dec 2007 23:05:24 -0000
@@ -605,33 +605,40 @@
 
 (defun insert-parentheses (mark syntax count)
   (insert-pair mark syntax count #\( #\)))
 
 (define-command (com-insert-parentheses :name t :command-table editing-table)
     ((count 'integer :prompt "Number of expressions")
      (wrap-p 'boolean :prompt "Wrap expressions?"))
   "Insert a pair of parentheses, leaving point in between.
 With a numeric argument, enclose that many expressions 
-forward (backward if negative).
-
-FIXME: no it doesn't."
+forward (backward if negative)."
   (unless wrap-p (setf count 0))
   (insert-parentheses (point) (current-syntax) count))
 
 (set-key `(com-insert-parentheses ,*numeric-argument-marker* ,*numeric-argument-p*)
 	 'editing-table
 	 '((#\( :meta)))
 
 (define-command (com-visible-region :name t :command-table marking-table) ()
   "Toggle the visibility of the region in the current pane."
   (setf (region-visible-p *drei-instance*)
         (not (region-visible-p *drei-instance*))))
 
+(define-command (com-move-past-close-and-reindent :name t :command-table editing-table)
+    ()
+  "Move past the next `)' and reindent"
+  (move-past-close-and-reindent (current-view) (point)))
+
+(set-key `(com-move-past-close-and-reindent)
+	 'editing-table
+	 '((#\) :meta)))
+
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 ;;; 
 ;;; Rectangle editing
 
 (define-command (com-kill-rectangle :name t :command-table deletion-table)
     ()
   "Kill the rectangle bounded by current point and mark.   
 
 The rectangle will be put in a rectangle kill buffer, from which it can
Index: core.lisp
===================================================================
RCS file: /project/mcclim/cvsroot/mcclim/Drei/core.lisp,v
retrieving revision 1.8
diff -u -9 -r1.8 core.lisp
--- core.lisp	8 Dec 2007 08:53:50 -0000	1.8
+++ core.lisp	8 Dec 2007 23:05:24 -0000
@@ -75,28 +75,41 @@
 (defun insert-pair (mark syntax &optional (count 0) (open #\() (close #\)))
   (cond ((> count 0)
 	 (loop while (and (not (end-of-buffer-p mark))
 			  (whitespacep syntax (object-after mark)))
 	       do (forward-object mark)))
 	((< count 0)
 	 (setf count (- count))
 	 (loop repeat count do (backward-expression mark syntax))))
   (unless (or (beginning-of-buffer-p mark)
-	      (whitespacep syntax (object-before mark)))
+              (char= open (object-before mark))
+              (whitespacep syntax (object-before mark)))
     (insert-object mark #\Space))
   (insert-object mark open)
-  (let ((here (clone-mark mark)))
+  (let ((here (clone-mark mark))
+        (saved-offset (offset mark)))
+    
     (loop repeat count
 	  do (forward-expression here syntax))
     (insert-object here close)
+
     (unless (or (end-of-buffer-p here)
-		(whitespacep syntax (object-after here)))
-      (insert-object here #\Space))))
+                (char= close (object-after here))
+		(whitespacep syntax
+                             (object-after here)))
+      (insert-object here #\Space))
+    (setf (offset mark) saved-offset)))
+
+(defun move-past-close-and-reindent (view point)
+  (loop until (eql (object-after point) #\))
+	do (forward-object point)
+	finally (forward-object point))
+  (indent-current-line view point))
 
 (defun goto-position (mark pos)
   (setf (offset mark) pos))
 
 (defun goto-line (mark line-number)
   (loop with m = (clone-mark mark :right)
 	initially (beginning-of-buffer m)
        	repeat (1- line-number)
 	until (end-of-buffer-p m)
Index: lisp-syntax-commands.lisp
===================================================================
RCS file: /project/mcclim/cvsroot/mcclim/Drei/lisp-syntax-commands.lisp,v
retrieving revision 1.11
diff -u -9 -r1.11 lisp-syntax-commands.lisp
--- lisp-syntax-commands.lisp	8 Dec 2007 08:53:50 -0000	1.11
+++ lisp-syntax-commands.lisp	8 Dec 2007 23:05:24 -0000
@@ -237,9 +237,18 @@
          '(#\Newline))
 
 (set-key 'com-eval-region
          'pane-lisp-table
          '((#\c :control) (#\r :control)))
 
 (set-key `(com-eval-last-expression ,*numeric-argument-p*)
          'pane-lisp-table
          '((#\c :control) (#\e :control)))
+
+(set-key `(com-backward-kill-expression ,*numeric-argument-marker*)
+	 'lisp-table
+	 '((#\Backspace :control :meta)))
+
+(set-key `(com-kill-expression ,*numeric-argument-marker*)
+	 'lisp-table
+	 '((#\Delete :control :meta)))
+

This paste has no annotations.

Colorize as:
Show Line Numbers

Lisppaste pastes can be made by anyone at any time. Imagine a fearsomely comprehensive disclaimer of liability. Now fear, comprehensively.