summaryrefslogtreecommitdiff
path: root/lisp/emacs-lisp
diff options
context:
space:
mode:
authorStefan Monnier <monnier@iro.umontreal.ca>2001-11-30 08:23:25 +0000
committerStefan Monnier <monnier@iro.umontreal.ca>2001-11-30 08:23:25 +0000
commit2fa5eef4caa14950d4e08e93922288c6d7af4d16 (patch)
tree06e7e62edbc33b3d73c27edfecff1b904e73355a /lisp/emacs-lisp
parentd006d95766d167759962b916cacbc2fd7c94d05c (diff)
downloademacs-2fa5eef4caa14950d4e08e93922288c6d7af4d16.tar.gz
emacs-2fa5eef4caa14950d4e08e93922288c6d7af4d16.tar.bz2
emacs-2fa5eef4caa14950d4e08e93922288c6d7af4d16.zip
(shiftf): Fix more. Simplify.
Diffstat (limited to 'lisp/emacs-lisp')
-rw-r--r--lisp/emacs-lisp/cl-macs.el25
1 files changed, 8 insertions, 17 deletions
diff --git a/lisp/emacs-lisp/cl-macs.el b/lisp/emacs-lisp/cl-macs.el
index feb1a2f956b..c4761e93bc6 100644
--- a/lisp/emacs-lisp/cl-macs.el
+++ b/lisp/emacs-lisp/cl-macs.el
@@ -1844,23 +1844,14 @@ The form returns true if TAG was found and removed, nil otherwise."
"(shiftf PLACE PLACE... VAL): shift left among PLACEs.
Example: (shiftf A B C) sets A to B, B to C, and returns the old A.
Each PLACE may be a symbol, or any generalized variable allowed by `setf'."
- (if (not (memq nil (mapcar 'symbolp (butlast (cons place args)))))
- (list 'prog1 place
- (let ((sets nil))
- (while args
- (cl-push (list 'setq place (car args)) sets)
- (setq place (cl-pop args)))
- `(setq ,(cadar sets)
- (prog1 ,(caddar sets)
- ,@(nreverse (cdr sets))))))
- (let* ((places (reverse (cons place args)))
- (form (cl-pop places)))
- (while places
- (let ((method (cl-setf-do-modify (cl-pop places) 'unsafe)))
- (setq form (list 'let* (car method)
- (list 'prog1 (nth 2 method)
- (cl-setf-do-store (nth 1 method) form))))))
- form)))
+ (cond
+ ((null args) place)
+ ((symbolp place) `(prog1 ,place (setq ,place (shiftf ,@args))))
+ (t
+ (let ((method (cl-setf-do-modify place 'unsafe)))
+ `(let* ,(car method)
+ (prog1 ,(nth 2 method)
+ ,(cl-setf-do-store (nth 1 method) `(shiftf ,@args))))))))
(defmacro rotatef (&rest args)
"(rotatef PLACE...): rotate left among PLACEs.