diff options
| author | Stefan Monnier | 2012-06-23 00:24:06 -0400 |
|---|---|---|
| committer | Stefan Monnier | 2012-06-23 00:24:06 -0400 |
| commit | b68581e26c51dd78674a5a83928f680cdbd22213 (patch) | |
| tree | 77cf1f1ba408a3a8da36ed301d779bab2aa11c48 /lisp | |
| parent | e33c6771f66d18f0c4c104f50e668cbe82b7e2de (diff) | |
| download | emacs-b68581e26c51dd78674a5a83928f680cdbd22213.tar.gz emacs-b68581e26c51dd78674a5a83928f680cdbd22213.zip | |
* lisp/emacs-lisp/cl-macs.el (cl--make-usage-args): Handle improper lists.
Fixes: debbugs:11719
Diffstat (limited to 'lisp')
| -rw-r--r-- | lisp/ChangeLog | 3 | ||||
| -rw-r--r-- | lisp/emacs-lisp/cl-loaddefs.el | 4 | ||||
| -rw-r--r-- | lisp/emacs-lisp/cl-macs.el | 52 |
3 files changed, 35 insertions, 24 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 4f7f8a2d300..4f017f0f503 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,5 +1,8 @@ | |||
| 1 | 2012-06-23 Stefan Monnier <monnier@iro.umontreal.ca> | 1 | 2012-06-23 Stefan Monnier <monnier@iro.umontreal.ca> |
| 2 | 2 | ||
| 3 | * emacs-lisp/cl-macs.el (cl--make-usage-args): Handle improper lists | ||
| 4 | (bug#11719). | ||
| 5 | |||
| 3 | * minibuffer.el (completion--twq-try): Try to fail more gracefully when | 6 | * minibuffer.el (completion--twq-try): Try to fail more gracefully when |
| 4 | the requote function doesn't work properly (bug#11714). | 7 | the requote function doesn't work properly (bug#11714). |
| 5 | 8 | ||
diff --git a/lisp/emacs-lisp/cl-loaddefs.el b/lisp/emacs-lisp/cl-loaddefs.el index 79f4d775e1a..f7eaa3b9f9c 100644 --- a/lisp/emacs-lisp/cl-loaddefs.el +++ b/lisp/emacs-lisp/cl-loaddefs.el | |||
| @@ -11,7 +11,7 @@ | |||
| 11 | ;;;;;; cl--set-frame-visible-p cl--map-overlays cl--map-intervals | 11 | ;;;;;; cl--set-frame-visible-p cl--map-overlays cl--map-intervals |
| 12 | ;;;;;; cl--map-keymap-recursively cl-notevery cl-notany cl-every | 12 | ;;;;;; cl--map-keymap-recursively cl-notevery cl-notany cl-every |
| 13 | ;;;;;; cl-some cl-mapcon cl-mapcan cl-mapl cl-maplist cl-map cl--mapcar-many | 13 | ;;;;;; cl-some cl-mapcon cl-mapcan cl-mapl cl-maplist cl-map cl--mapcar-many |
| 14 | ;;;;;; cl-equalp cl-coerce) "cl-extra" "cl-extra.el" "25963dec757a527e3be3ba7f7abc49ee") | 14 | ;;;;;; cl-equalp cl-coerce) "cl-extra" "cl-extra.el" "3656b89f2196d70e50ba9d7bb9519416") |
| 15 | ;;; Generated autoloads from cl-extra.el | 15 | ;;; Generated autoloads from cl-extra.el |
| 16 | 16 | ||
| 17 | (autoload 'cl-coerce "cl-extra" "\ | 17 | (autoload 'cl-coerce "cl-extra" "\ |
| @@ -265,7 +265,7 @@ Remove from SYMBOL's plist the property PROPNAME and its value. | |||
| 265 | ;;;;;; cl-return cl-block cl-etypecase cl-typecase cl-ecase cl-case | 265 | ;;;;;; cl-return cl-block cl-etypecase cl-typecase cl-ecase cl-case |
| 266 | ;;;;;; cl-load-time-value cl-eval-when cl-destructuring-bind cl-function | 266 | ;;;;;; cl-load-time-value cl-eval-when cl-destructuring-bind cl-function |
| 267 | ;;;;;; cl-defmacro cl-defun cl-gentemp cl-gensym) "cl-macs" "cl-macs.el" | 267 | ;;;;;; cl-defmacro cl-defun cl-gentemp cl-gensym) "cl-macs" "cl-macs.el" |
| 268 | ;;;;;; "66d8d151a97f91a79ebe3d1a9d699483") | 268 | ;;;;;; "41a15289eda7e6ae03ac9edd86bbb1a6") |
| 269 | ;;; Generated autoloads from cl-macs.el | 269 | ;;; Generated autoloads from cl-macs.el |
| 270 | 270 | ||
| 271 | (autoload 'cl-gensym "cl-macs" "\ | 271 | (autoload 'cl-gensym "cl-macs" "\ |
diff --git a/lisp/emacs-lisp/cl-macs.el b/lisp/emacs-lisp/cl-macs.el index d4bd73827d2..eaa988bfb58 100644 --- a/lisp/emacs-lisp/cl-macs.el +++ b/lisp/emacs-lisp/cl-macs.el | |||
| @@ -350,28 +350,36 @@ its argument list allows full Common Lisp conventions." | |||
| 350 | (t x))) | 350 | (t x))) |
| 351 | 351 | ||
| 352 | (defun cl--make-usage-args (arglist) | 352 | (defun cl--make-usage-args (arglist) |
| 353 | ;; `orig-args' can contain &cl-defs (an internal | 353 | (if (cdr-safe (last arglist)) ;Not a proper list. |
| 354 | ;; CL thingy I don't understand), so remove it. | 354 | (let* ((last (last arglist)) |
| 355 | (let ((x (memq '&cl-defs arglist))) | 355 | (tail (cdr last))) |
| 356 | (when x (setq arglist (delq (car x) (remq (cadr x) arglist))))) | 356 | (unwind-protect |
| 357 | (let ((state nil)) | 357 | (progn |
| 358 | (mapcar (lambda (x) | 358 | (setcdr last nil) |
| 359 | (cond | 359 | (nconc (cl--make-usage-args arglist) (cl--make-usage-var tail))) |
| 360 | ((symbolp x) | 360 | (setcdr last tail))) |
| 361 | (if (eq ?\& (aref (symbol-name x) 0)) | 361 | ;; `orig-args' can contain &cl-defs (an internal |
| 362 | (setq state x) | 362 | ;; CL thingy I don't understand), so remove it. |
| 363 | (make-symbol (upcase (symbol-name x))))) | 363 | (let ((x (memq '&cl-defs arglist))) |
| 364 | ((not (consp x)) x) | 364 | (when x (setq arglist (delq (car x) (remq (cadr x) arglist))))) |
| 365 | ((memq state '(nil &rest)) (cl--make-usage-args x)) | 365 | (let ((state nil)) |
| 366 | (t ;(VAR INITFORM SVAR) or ((KEYWORD VAR) INITFORM SVAR). | 366 | (mapcar (lambda (x) |
| 367 | (cl-list* | 367 | (cond |
| 368 | (if (and (consp (car x)) (eq state '&key)) | 368 | ((symbolp x) |
| 369 | (list (caar x) (cl--make-usage-var (nth 1 (car x)))) | 369 | (if (eq ?\& (aref (symbol-name x) 0)) |
| 370 | (cl--make-usage-var (car x))) | 370 | (setq state x) |
| 371 | (nth 1 x) ;INITFORM. | 371 | (make-symbol (upcase (symbol-name x))))) |
| 372 | (cl--make-usage-args (nthcdr 2 x)) ;SVAR. | 372 | ((not (consp x)) x) |
| 373 | )))) | 373 | ((memq state '(nil &rest)) (cl--make-usage-args x)) |
| 374 | arglist))) | 374 | (t ;(VAR INITFORM SVAR) or ((KEYWORD VAR) INITFORM SVAR). |
| 375 | (cl-list* | ||
| 376 | (if (and (consp (car x)) (eq state '&key)) | ||
| 377 | (list (caar x) (cl--make-usage-var (nth 1 (car x)))) | ||
| 378 | (cl--make-usage-var (car x))) | ||
| 379 | (nth 1 x) ;INITFORM. | ||
| 380 | (cl--make-usage-args (nthcdr 2 x)) ;SVAR. | ||
| 381 | )))) | ||
| 382 | arglist)))) | ||
| 375 | 383 | ||
| 376 | (defun cl--do-arglist (args expr &optional num) ; uses bind-* | 384 | (defun cl--do-arglist (args expr &optional num) ; uses bind-* |
| 377 | (if (nlistp args) | 385 | (if (nlistp args) |