[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] Changes to emacs/lisp/textmodes/artist.el
From: |
Richard M . Stallman |
Subject: |
[Emacs-diffs] Changes to emacs/lisp/textmodes/artist.el |
Date: |
Thu, 30 Dec 2004 18:49:21 -0500 |
Index: emacs/lisp/textmodes/artist.el
diff -c emacs/lisp/textmodes/artist.el:1.17 emacs/lisp/textmodes/artist.el:1.18
*** emacs/lisp/textmodes/artist.el:1.17 Thu Dec 30 23:33:03 2004
--- emacs/lisp/textmodes/artist.el Thu Dec 30 23:37:15 2004
***************
*** 1532,1538 ****
"Compute completion table from MENU-TABLE, suitable for `completing-read'."
(apply
'nconc
! (artist-remove-nulls
(mapcar
(lambda (element)
(let ((element-tag (artist-mt-get-tag element)))
--- 1532,1538 ----
"Compute completion table from MENU-TABLE, suitable for `completing-read'."
(apply
'nconc
! (remq nil
(mapcar
(lambda (element)
(let ((element-tag (artist-mt-get-tag element)))
***************
*** 1772,1800 ****
"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)
--- 1772,1777 ----
***************
*** 1802,1817 ****
((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)
--- 1779,1784 ----
***************
*** 3246,3259 ****
"Vaporize lines reachable from point X1, Y1."
(let ((ep-stack nil))
(mapcar
! (lambda (ep) (artist-push ep ep-stack))
(artist-vap-find-endpoints x1 y1))
(while (not (null ep-stack))
! (let* ((vaporize-point (artist-pop ep-stack))
(new-endpoints (artist-vaporize-line (car vaporize-point)
(cdr vaporize-point))))
(mapcar
! (lambda (endpoint) (artist-push endpoint ep-stack))
new-endpoints)))))
--- 3213,3226 ----
"Vaporize lines reachable from point X1, Y1."
(let ((ep-stack nil))
(mapcar
! (lambda (ep) (push ep ep-stack))
(artist-vap-find-endpoints x1 y1))
(while (not (null ep-stack))
! (let* ((vaporize-point (pop ep-stack))
(new-endpoints (artist-vaporize-line (car vaporize-point)
(cdr vaporize-point))))
(mapcar
! (lambda (endpoint) (push endpoint ep-stack))
new-endpoints)))))
***************
*** 3414,3420 ****
;; that look like: \ / instead we get: ( )
;; \ / \ /
;; --------- ---------
! (let ((last-coord (artist-last point-list)))
(if (= (artist-coord-get-new-char last-coord) ?/)
(artist-coord-set-new-char last-coord artist-ellipse-right-char)))
--- 3381,3387 ----
;; that look like: \ / instead we get: ( )
;; \ / \ /
;; --------- ---------
! (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,3453 ****
(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)))))
(append right-half left-half)))
--- 3414,3420 ----
(t c)))))
;; The cdr and butlast below is so we don't draw the middle top
;; and middle bottom char twice.
! (butlast (cdr (reverse right-half)))))
(append right-half left-half)))
***************
*** 3763,3772 ****
;; 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))
(while (not (null stack))
! (let* ((coord (artist-pop stack))
(x (artist-coord-get-x coord))
(y (artist-coord-get-y coord))
--- 3730,3739 ----
;; area we are about to fill, or, in other words, don't fill if we
;; needn't.
(if (not (= c artist-fill-char))
! (push (artist-new-coord x1 y1) stack))
(while (not (null stack))
! (let* ((coord (pop stack))
(x (artist-coord-get-x coord))
(y (artist-coord-get-y coord))
***************
*** 3798,3804 ****
(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))
(setq last-c-above c-above)))
(setq last-x x)
(setq x (- x 1)))
--- 3765,3771 ----
(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))
! (push (artist-new-coord x (- y 1)) stack))
(setq last-c-above c-above)))
(setq last-x x)
(setq x (- x 1)))
***************
*** 3812,3818 ****
(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))
(setq last-c-below c-below)))
(setq x (- x 1)))
--- 3779,3785 ----
(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))
! (push (artist-new-coord x (1+ y)) stack))
(setq last-c-below c-below)))
(setq x (- x 1)))