changeset 59224:0bedd71fb49f

(artist-butlast-fn): Var deleted. (artist-butlast, artist-last): Functions deleted. (artist-ellipse-mirror-quadrant): Call last and butlast directly. (artist-compute-key-compl-table): Call remq directly. (artist-remove-nulls): Function deleted. (artist-vaporize-lines, artist-flood-fill): Use push and pop directly. (artist-push, artist-pop): Macro deleted.
author Richard M. Stallman <rms@gnu.org>
date Thu, 30 Dec 2004 23:37:15 +0000
parents f467c038c83e
children 5774379908fa
files lisp/textmodes/artist.el
diffstat 1 files changed, 10 insertions(+), 43 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/textmodes/artist.el	Thu Dec 30 23:33:03 2004 +0000
+++ b/lisp/textmodes/artist.el	Thu Dec 30 23:37:15 2004 +0000
@@ -1532,7 +1532,7 @@
   "Compute completion table from MENU-TABLE, suitable for `completing-read'."
   (apply
    'nconc
-   (artist-remove-nulls
+   (remq nil
     (mapcar
      (lambda (element)
        (let ((element-tag (artist-mt-get-tag element)))
@@ -1772,29 +1772,6 @@
   "Call function FN with ARGS iff FN is not nil."
   (list 'if fn (cons 'funcall (cons fn args))))
 
-(defvar artist-butlast-fn 'artist-butlast
-  "The butlast function.")
-
-(if (fboundp 'butlast)
-    (setq artist-butlast-fn 'butlast)
-  (setq artist-butlast-fn 'artist-butlast))
-
-(defun artist-butlast (l)
-  "Return the list L with all elements but the last."
-  (cond ((null l) nil)
-	((null (cdr l)) nil)
-	(t (cons (car l) (artist-butlast (cdr l))))))
-
-
-(defun artist-last (l &optional n)
-  "Return the last link in the list L.
-With optional argument N, returns Nth-to-last link (default 1)."
-  (nth (- (length l) (or n 1)) l))
-
-(defun artist-remove-nulls (l)
-  "Remove nils in list L."
-  (remq nil l))
-
 (defun artist-uniq (l)
   "Remove consecutive duplicates in list L.  Comparison is done with `equal'."
   (cond ((null l) nil)
@@ -1802,16 +1779,6 @@
 	((equal (car l) (car (cdr l))) (artist-uniq (cdr l))) ; first 2 equal
 	(t (cons (car l) (artist-uniq (cdr l)))))) ; first 2 are different
 
-(defmacro artist-push (x stack)
-  "Push element X to a STACK."
-  (list 'setq stack (list 'cons x stack)))
-
-(defmacro artist-pop (stack)
-  "Pop an element from a STACK."
-  (list 'prog1
-	(list 'car stack)
-	(list 'setq stack (list 'cdr stack))))
-
 (defun artist-string-split (str r)
   "Split string STR at occurrences of regexp R, returning a list of strings."
   (let ((res nil)
@@ -3246,14 +3213,14 @@
   "Vaporize lines reachable from point X1, Y1."
   (let ((ep-stack nil))
     (mapcar
-     (lambda (ep) (artist-push ep ep-stack))
+     (lambda (ep) (push ep ep-stack))
      (artist-vap-find-endpoints x1 y1))
     (while (not (null ep-stack))
-      (let* ((vaporize-point (artist-pop ep-stack))
+      (let* ((vaporize-point (pop ep-stack))
 	     (new-endpoints (artist-vaporize-line (car vaporize-point)
 						  (cdr vaporize-point))))
 	(mapcar
-	 (lambda (endpoint) (artist-push endpoint ep-stack))
+	 (lambda (endpoint) (push endpoint ep-stack))
 	 new-endpoints)))))
 
 
@@ -3414,7 +3381,7 @@
     ;; that look like:    \           /  instead we get:   (           )
     ;;                     \         /                      \         /
     ;;                      ---------                        ---------
-    (let ((last-coord  (artist-last point-list)))
+    (let ((last-coord  (last point-list)))
       (if (= (artist-coord-get-new-char last-coord) ?/)
 	  (artist-coord-set-new-char last-coord artist-ellipse-right-char)))
 
@@ -3447,7 +3414,7 @@
 				       (t c)))))
 	   ;; The cdr and butlast below is so we don't draw the middle top
 	   ;; and middle bottom char twice.
-	   (funcall artist-butlast-fn (cdr (reverse right-half)))))
+	   (butlast (cdr (reverse right-half)))))
     (append right-half left-half)))
 
 
@@ -3763,10 +3730,10 @@
     ;; area we are about to fill, or, in other words, don't fill if we
     ;; needn't.
     (if (not (= c artist-fill-char))
-	(artist-push (artist-new-coord x1 y1) stack))
+	(push (artist-new-coord x1 y1) stack))
 
     (while (not (null stack))
-      (let* ((coord (artist-pop stack))
+      (let* ((coord (pop stack))
 	     (x (artist-coord-get-x coord))
 	     (y (artist-coord-get-y coord))
 
@@ -3798,7 +3765,7 @@
 	  (if lines-above
 	      (let ((c-above (artist-get-char-at-xy-conv x (- y 1))))
 		(if (and (= c-above c) (/= c-above last-c-above))
-		    (artist-push (artist-new-coord x (- y 1)) stack))
+		    (push (artist-new-coord x (- y 1)) stack))
 		(setq last-c-above c-above)))
 	  (setq last-x x)
 	  (setq x (- x 1)))
@@ -3812,7 +3779,7 @@
 	  (if lines-below
 	      (let ((c-below (artist-get-char-at-xy-conv x (1+ y))))
 		(if (and (= c-below c) (/= c-below last-c-below))
-		    (artist-push (artist-new-coord x (1+ y)) stack))
+		    (push (artist-new-coord x (1+ y)) stack))
 		(setq last-c-below c-below)))
 	  (setq x (- x 1)))