From a4a5aa2b9ec52d60ab0de45afa04baf667fd3bec Mon Sep 17 00:00:00 2001 From: "Richard M. Stallman" Date: Thu, 30 Dec 2004 23:37:15 +0000 Subject: [PATCH] (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. --- lisp/textmodes/artist.el | 53 ++++++++-------------------------------- 1 file changed, 10 insertions(+), 43 deletions(-) diff --git a/lisp/textmodes/artist.el b/lisp/textmodes/artist.el index 0d67542e16d..2d40d6da026 100644 --- a/lisp/textmodes/artist.el +++ b/lisp/textmodes/artist.el @@ -1532,7 +1532,7 @@ The returned value is suitable for the `x-popup-menu' function." "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 @@ info-variant-part." "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 @@ With optional argument N, returns Nth-to-last link (default 1)." ((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 @@ through X1, Y1. An endpoint is a cons pair, (ENDPOINT-X . ENDPOINT-Y)." "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 @@ The POINT-LIST is expected to cover the first quadrant." ;; 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 @@ The POINT-LIST is expected to cover the first quadrant." (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 @@ original contents of that area in the buffer." ;; 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 @@ original contents of that area in the buffer." (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 @@ original contents of that area in the buffer." (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))) -- 2.39.2