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

Robert Strandh rstrandh at common-lisp.net
Thu Jan 6 16:38:56 UTC 2005


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

Modified Files:
	base.lisp 
Log Message:
modified previous-line and next-line to take an optional column 
argument.

Date: Thu Jan  6 17:38:55 2005
Author: rstrandh

Index: climacs/base.lisp
diff -u climacs/base.lisp:1.10 climacs/base.lisp:1.11
--- climacs/base.lisp:1.10	Wed Jan  5 06:09:04 2005
+++ climacs/base.lisp	Thu Jan  6 17:38:54 2005
@@ -28,29 +28,31 @@
 
 (in-package :climacs-base)
 
-(defun previous-line (mark)
+(defun previous-line (mark &optional column)
   "Move a mark up one line conserving horizontal position."
-  (let ((column (column-number mark)))
-    (beginning-of-line mark)
-    (if (beginning-of-buffer-p mark)
-	(incf (offset mark) column)
-	(progn (decf (offset mark))
-	       (when (> (column-number mark) column)
-		 (beginning-of-line mark)
-		 (incf (offset mark) column))))))
+  (unless column
+    (setf column (column-number mark)))
+  (beginning-of-line mark)
+  (if (beginning-of-buffer-p mark)
+      (incf (offset mark) column)
+      (progn (decf (offset mark))
+	     (when (> (column-number mark) column)
+	       (beginning-of-line mark)
+	       (incf (offset mark) column)))))
 
-(defun next-line (mark)
+(defun next-line (mark &optional column)
   "Move a mark down one line conserving horizontal position."
-  (let ((column (column-number mark)))
-    (end-of-line mark)
-    (if (end-of-buffer-p mark)
-	(progn (beginning-of-line mark)
-	       (incf (offset mark) column))
-	(progn (incf (offset mark))
-	       (end-of-line mark)
-	       (when (> (column-number mark) column)
-		 (beginning-of-line mark)
-		 (incf (offset mark) column))))))
+  (unless column
+    (setf column (column-number mark)))
+  (end-of-line mark)
+  (if (end-of-buffer-p mark)
+      (progn (beginning-of-line mark)
+	     (incf (offset mark) column))
+      (progn (incf (offset mark))
+	     (end-of-line mark)
+	     (when (> (column-number mark) column)
+	       (beginning-of-line mark)
+	       (incf (offset mark) column)))))
 
 (defun open-line (mark)
   "Create a new line in a buffer."




More information about the Climacs-cvs mailing list