]> code.delx.au - gnu-emacs/commitdiff
Fixes: debbugs:19250
authorStefan Monnier <monnier@iro.umontreal.ca>
Wed, 3 Dec 2014 18:42:20 +0000 (13:42 -0500)
committerStefan Monnier <monnier@iro.umontreal.ca>
Wed, 3 Dec 2014 18:42:20 +0000 (13:42 -0500)
* 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).

etc/NEWS
lisp/ChangeLog
lisp/minibuffer.el
lisp/pcmpl-gnu.el
lisp/progmodes/elisp-mode.el
lisp/progmodes/octave.el

index 9786f3a66989555ef916a84f03621f0f7149f9bb..f3890a51aad353348d1ce5321a6dcd9c4002bf08 100644 (file)
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -363,6 +363,11 @@ helper functions) obsolete.
 \f
 * Incompatible Lisp Changes in Emacs 25.1
 
+** completion-table-dynamic stays in the minibuffer.
+If you want the old behavior of calling the function in the buffer
+from which the minibuffer was entered, call it with the new argument
+`switch-buffer'.
+
 ** window-configurations no longer record the buffers's marks.
 
 ** inhibit-modification-hooks now also inhibits lock-file checks, as well as
index b79b918dc77228aa3fa12ac055a84b9b21e6c042..a70917e7b92f4d1d58abb9b9826c3bfa7a01919a 100644 (file)
@@ -1,3 +1,14 @@
+2014-12-03  Stefan Monnier  <monnier@iro.umontreal.ca>
+
+       * minibuffer.el (completion-table-dynamic): Add arg `switch-buffer'
+       and change default to stay in the minibuffer when called from
+       the minibuffer (bug#19250).
+       (lazy-completion-table): Use this new argument to preserve the
+       old behavior.
+
+       * progmodes/elisp-mode.el (elisp--local-variables): Don't burp on
+       incorrect lexical elements (bug#19250).
+
 2014-12-03  Eric S. Raymond  <esr@snark.thyrsus.com>
 
        * files.el (file-tree-walk): Lisp translation of ANSI ftw(3).
@@ -23,8 +34,7 @@
        * vc-hooks.el: Bind vc-delete-file to Ctrl-x v delete.
 
        * vc.el (vc-expand-dirs): Now takes a second BACKEND argument,
-       improving behavior on directories using multiple file-oriented
-       VCSes.
+       improving behavior on directories using multiple file-oriented VCSes.
 
        * vc/vc.el and all backends: API simplification; clear-headers
        is no longer a public method.  It is now local to the one place
index c9ce381c87b28ed501883490a33b690de715faea..0bee13b155c3a0ee98dc164d875e9cf50ed5cc04 100644 (file)
@@ -169,13 +169,15 @@ ACTION can be one of nil, t or `lambda'."
       (t 'test-completion))
      string table pred))))
 
-(defun completion-table-dynamic (fun)
+(defun completion-table-dynamic (fun &optional switch-buffer)
   "Use function FUN as a dynamic completion table.
 FUN is called with one argument, the string for which completion is required,
 and it should return an alist containing all the intended possible completions.
 This alist may be a full list of possible completions so that FUN can ignore
-the value of its argument.  If completion is performed in the minibuffer,
-FUN will be called in the buffer from which the minibuffer was entered.
+the value of its argument.
+If SWITCH-BUFFER is non-nil and completion is performed in the
+minibuffer, FUN will be called in the buffer from which the minibuffer
+was entered.
 
 The result of the `completion-table-dynamic' form is a function
 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'."
         ;; `fun' is not supposed to return another function but a plain old
         ;; completion table, whose boundaries are always trivial.
         nil
-      (with-current-buffer (let ((win (minibuffer-selected-window)))
-                             (if (window-live-p win) (window-buffer win)
-                               (current-buffer)))
+      (with-current-buffer (if (not switch-buffer) (current-buffer)
+                             (let ((win (minibuffer-selected-window)))
+                               (if (window-live-p win) (window-buffer win)
+                                 (current-buffer))))
         (complete-with-action action (funcall fun string) string pred)))))
 
 (defun completion-table-with-cache (fun &optional ignore-case)
@@ -228,7 +231,8 @@ You should give VAR a non-nil `risky-local-variable' property."
       (lambda (,str)
         (when (functionp ,var)
           (setq ,var (funcall #',fun)))
-        ,var))))
+        ,var)
+      'do-switch-buffer)))
 
 (defun completion-table-case-fold (table &optional dont-fold)
   "Return new completion TABLE that is case insensitive.
index bcab1f7cb5b3adbb4bdd62031f542b003cc106b8..3d769b1fffab76a7c51b57c91a2cb6600d5da02b 100644 (file)
                 (let ((file (pcomplete-arg 1)))
                   (completion-table-dynamic
                    (lambda (_string)
-                     (pcmpl-gnu-with-file-buffer file
-                       (mapcar #'tar-header-name tar-parse-info)))))
+                     (pcmpl-gnu-with-file-buffer
+                      file (mapcar #'tar-header-name tar-parse-info)))))
              (pcomplete-entries))
            nil 'identity))))
 
index 2be81a57ebe57f37208e959334b8181b096b9e4f..ba70f903b4ba901cd13a1fd1e371020c9ff4a805 100644 (file)
@@ -293,7 +293,7 @@ Blank lines separate paragraphs.  Semicolons start comments.
       (let* ((sexp (condition-case nil
                        (car (read-from-string
                              (concat txt "elisp--witness--lisp" closer)))
-                     (end-of-file nil)))
+                     ((invalid-read-syntax end-of-file) nil)))
              (macroexpand-advice (lambda (expander form &rest args)
                                    (condition-case nil
                                        (apply expander form args)
index 25b081545a34108b58a09267dd53209d2b6f5ee3..7d963635bc0d0d7e2a35f774340ec607ec3f903a 100644 (file)
     (defun completion-table-with-cache (fun &optional ignore-case)
       ;; See eg bug#11906.
       (let* (last-arg last-result
-                      (new-fun
-                       (lambda (arg)
-                         (if (and last-arg (string-prefix-p last-arg arg ignore-case))
-                             last-result
-                           (prog1
-                               (setq last-result (funcall fun arg))
-                             (setq last-arg arg))))))
+             (new-fun
+              (lambda (arg)
+                (if (and last-arg (string-prefix-p last-arg arg ignore-case))
+                    last-result
+                  (prog1
+                      (setq last-result (funcall fun arg))
+                    (setq last-arg arg))))))
         (completion-table-dynamic new-fun)))))
 (eval-when-compile
   (unless (fboundp 'setq-local)