diff options
| author | Stefan Monnier | 2014-12-03 13:42:20 -0500 |
|---|---|---|
| committer | Stefan Monnier | 2014-12-03 13:42:20 -0500 |
| commit | 41bb375cc71c70fbe9b405272abf0d5f345eee2a (patch) | |
| tree | 9e0cf058823558c2b170b161de6b9e9d398441ad /lisp | |
| parent | e148a1eacaaa6d6e67db09188f66dab06937ae0d (diff) | |
| download | emacs-41bb375cc71c70fbe9b405272abf0d5f345eee2a.tar.gz emacs-41bb375cc71c70fbe9b405272abf0d5f345eee2a.zip | |
Fixes: debbugs:19250
* lisp/minibuffer.el (completion-table-dynamic): Add arg `switch-buffer'
and change default to stay in the minibuffer when called from
the minibuffer.
(lazy-completion-table): Use this new argument to preserve the
old behavior.
* lisp/progmodes/elisp-mode.el (elisp--local-variables): Don't burp on
incorrect lexical elements (bug#19250).
Diffstat (limited to 'lisp')
| -rw-r--r-- | lisp/ChangeLog | 14 | ||||
| -rw-r--r-- | lisp/minibuffer.el | 18 | ||||
| -rw-r--r-- | lisp/pcmpl-gnu.el | 4 | ||||
| -rw-r--r-- | lisp/progmodes/elisp-mode.el | 2 | ||||
| -rw-r--r-- | lisp/progmodes/octave.el | 14 |
5 files changed, 33 insertions, 19 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index b79b918dc77..a70917e7b92 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,3 +1,14 @@ | |||
| 1 | 2014-12-03 Stefan Monnier <monnier@iro.umontreal.ca> | ||
| 2 | |||
| 3 | * minibuffer.el (completion-table-dynamic): Add arg `switch-buffer' | ||
| 4 | and change default to stay in the minibuffer when called from | ||
| 5 | the minibuffer (bug#19250). | ||
| 6 | (lazy-completion-table): Use this new argument to preserve the | ||
| 7 | old behavior. | ||
| 8 | |||
| 9 | * progmodes/elisp-mode.el (elisp--local-variables): Don't burp on | ||
| 10 | incorrect lexical elements (bug#19250). | ||
| 11 | |||
| 1 | 2014-12-03 Eric S. Raymond <esr@snark.thyrsus.com> | 12 | 2014-12-03 Eric S. Raymond <esr@snark.thyrsus.com> |
| 2 | 13 | ||
| 3 | * files.el (file-tree-walk): Lisp translation of ANSI ftw(3). | 14 | * files.el (file-tree-walk): Lisp translation of ANSI ftw(3). |
| @@ -23,8 +34,7 @@ | |||
| 23 | * vc-hooks.el: Bind vc-delete-file to Ctrl-x v delete. | 34 | * vc-hooks.el: Bind vc-delete-file to Ctrl-x v delete. |
| 24 | 35 | ||
| 25 | * vc.el (vc-expand-dirs): Now takes a second BACKEND argument, | 36 | * vc.el (vc-expand-dirs): Now takes a second BACKEND argument, |
| 26 | improving behavior on directories using multiple file-oriented | 37 | improving behavior on directories using multiple file-oriented VCSes. |
| 27 | VCSes. | ||
| 28 | 38 | ||
| 29 | * vc/vc.el and all backends: API simplification; clear-headers | 39 | * vc/vc.el and all backends: API simplification; clear-headers |
| 30 | is no longer a public method. It is now local to the one place | 40 | is no longer a public method. It is now local to the one place |
diff --git a/lisp/minibuffer.el b/lisp/minibuffer.el index c9ce381c87b..0bee13b155c 100644 --- a/lisp/minibuffer.el +++ b/lisp/minibuffer.el | |||
| @@ -169,13 +169,15 @@ ACTION can be one of nil, t or `lambda'." | |||
| 169 | (t 'test-completion)) | 169 | (t 'test-completion)) |
| 170 | string table pred)))) | 170 | string table pred)))) |
| 171 | 171 | ||
| 172 | (defun completion-table-dynamic (fun) | 172 | (defun completion-table-dynamic (fun &optional switch-buffer) |
| 173 | "Use function FUN as a dynamic completion table. | 173 | "Use function FUN as a dynamic completion table. |
| 174 | FUN is called with one argument, the string for which completion is required, | 174 | FUN is called with one argument, the string for which completion is required, |
| 175 | and it should return an alist containing all the intended possible completions. | 175 | and it should return an alist containing all the intended possible completions. |
| 176 | This alist may be a full list of possible completions so that FUN can ignore | 176 | This alist may be a full list of possible completions so that FUN can ignore |
| 177 | the value of its argument. If completion is performed in the minibuffer, | 177 | the value of its argument. |
| 178 | FUN will be called in the buffer from which the minibuffer was entered. | 178 | If SWITCH-BUFFER is non-nil and completion is performed in the |
| 179 | minibuffer, FUN will be called in the buffer from which the minibuffer | ||
| 180 | was entered. | ||
| 179 | 181 | ||
| 180 | The result of the `completion-table-dynamic' form is a function | 182 | The result of the `completion-table-dynamic' form is a function |
| 181 | that can be used as the COLLECTION argument to `try-completion' and | 183 | that can be used as the COLLECTION argument to `try-completion' and |
| @@ -187,9 +189,10 @@ See also the related function `completion-table-with-cache'." | |||
| 187 | ;; `fun' is not supposed to return another function but a plain old | 189 | ;; `fun' is not supposed to return another function but a plain old |
| 188 | ;; completion table, whose boundaries are always trivial. | 190 | ;; completion table, whose boundaries are always trivial. |
| 189 | nil | 191 | nil |
| 190 | (with-current-buffer (let ((win (minibuffer-selected-window))) | 192 | (with-current-buffer (if (not switch-buffer) (current-buffer) |
| 191 | (if (window-live-p win) (window-buffer win) | 193 | (let ((win (minibuffer-selected-window))) |
| 192 | (current-buffer))) | 194 | (if (window-live-p win) (window-buffer win) |
| 195 | (current-buffer)))) | ||
| 193 | (complete-with-action action (funcall fun string) string pred))))) | 196 | (complete-with-action action (funcall fun string) string pred))))) |
| 194 | 197 | ||
| 195 | (defun completion-table-with-cache (fun &optional ignore-case) | 198 | (defun completion-table-with-cache (fun &optional ignore-case) |
| @@ -228,7 +231,8 @@ You should give VAR a non-nil `risky-local-variable' property." | |||
| 228 | (lambda (,str) | 231 | (lambda (,str) |
| 229 | (when (functionp ,var) | 232 | (when (functionp ,var) |
| 230 | (setq ,var (funcall #',fun))) | 233 | (setq ,var (funcall #',fun))) |
| 231 | ,var)))) | 234 | ,var) |
| 235 | 'do-switch-buffer))) | ||
| 232 | 236 | ||
| 233 | (defun completion-table-case-fold (table &optional dont-fold) | 237 | (defun completion-table-case-fold (table &optional dont-fold) |
| 234 | "Return new completion TABLE that is case insensitive. | 238 | "Return new completion TABLE that is case insensitive. |
diff --git a/lisp/pcmpl-gnu.el b/lisp/pcmpl-gnu.el index bcab1f7cb5b..3d769b1fffa 100644 --- a/lisp/pcmpl-gnu.el +++ b/lisp/pcmpl-gnu.el | |||
| @@ -323,8 +323,8 @@ | |||
| 323 | (let ((file (pcomplete-arg 1))) | 323 | (let ((file (pcomplete-arg 1))) |
| 324 | (completion-table-dynamic | 324 | (completion-table-dynamic |
| 325 | (lambda (_string) | 325 | (lambda (_string) |
| 326 | (pcmpl-gnu-with-file-buffer file | 326 | (pcmpl-gnu-with-file-buffer |
| 327 | (mapcar #'tar-header-name tar-parse-info))))) | 327 | file (mapcar #'tar-header-name tar-parse-info))))) |
| 328 | (pcomplete-entries)) | 328 | (pcomplete-entries)) |
| 329 | nil 'identity)))) | 329 | nil 'identity)))) |
| 330 | 330 | ||
diff --git a/lisp/progmodes/elisp-mode.el b/lisp/progmodes/elisp-mode.el index 2be81a57ebe..ba70f903b4b 100644 --- a/lisp/progmodes/elisp-mode.el +++ b/lisp/progmodes/elisp-mode.el | |||
| @@ -293,7 +293,7 @@ Blank lines separate paragraphs. Semicolons start comments. | |||
| 293 | (let* ((sexp (condition-case nil | 293 | (let* ((sexp (condition-case nil |
| 294 | (car (read-from-string | 294 | (car (read-from-string |
| 295 | (concat txt "elisp--witness--lisp" closer))) | 295 | (concat txt "elisp--witness--lisp" closer))) |
| 296 | (end-of-file nil))) | 296 | ((invalid-read-syntax end-of-file) nil))) |
| 297 | (macroexpand-advice (lambda (expander form &rest args) | 297 | (macroexpand-advice (lambda (expander form &rest args) |
| 298 | (condition-case nil | 298 | (condition-case nil |
| 299 | (apply expander form args) | 299 | (apply expander form args) |
diff --git a/lisp/progmodes/octave.el b/lisp/progmodes/octave.el index 25b081545a3..7d963635bc0 100644 --- a/lisp/progmodes/octave.el +++ b/lisp/progmodes/octave.el | |||
| @@ -45,13 +45,13 @@ | |||
| 45 | (defun completion-table-with-cache (fun &optional ignore-case) | 45 | (defun completion-table-with-cache (fun &optional ignore-case) |
| 46 | ;; See eg bug#11906. | 46 | ;; See eg bug#11906. |
| 47 | (let* (last-arg last-result | 47 | (let* (last-arg last-result |
| 48 | (new-fun | 48 | (new-fun |
| 49 | (lambda (arg) | 49 | (lambda (arg) |
| 50 | (if (and last-arg (string-prefix-p last-arg arg ignore-case)) | 50 | (if (and last-arg (string-prefix-p last-arg arg ignore-case)) |
| 51 | last-result | 51 | last-result |
| 52 | (prog1 | 52 | (prog1 |
| 53 | (setq last-result (funcall fun arg)) | 53 | (setq last-result (funcall fun arg)) |
| 54 | (setq last-arg arg)))))) | 54 | (setq last-arg arg)))))) |
| 55 | (completion-table-dynamic new-fun))))) | 55 | (completion-table-dynamic new-fun))))) |
| 56 | (eval-when-compile | 56 | (eval-when-compile |
| 57 | (unless (fboundp 'setq-local) | 57 | (unless (fboundp 'setq-local) |