\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
+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).
* 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
(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
;; `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)
(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.
(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))))
(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)
(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)