diff options
Diffstat (limited to 'lisp')
-rw-r--r-- | lisp/completion-preview.el | 16 | ||||
-rw-r--r-- | lisp/emacs-lisp/package-vc.el | 9 | ||||
-rw-r--r-- | lisp/minibuffer.el | 4 |
3 files changed, 23 insertions, 6 deletions
diff --git a/lisp/completion-preview.el b/lisp/completion-preview.el index 1d5f1253702..2ed2e5dd001 100644 --- a/lisp/completion-preview.el +++ b/lisp/completion-preview.el @@ -189,10 +189,24 @@ Completion Preview mode avoids updating the preview after these commands.") "Return property PROP of the completion preview overlay." (overlay-get completion-preview--overlay prop)) +(defun completion-preview--window-selection-change (window) + "Hide completion preview in WINDOW after switching to another window. +Completion Preview mode adds this function to +`window-selection-change-functions', which see." + (unless (or (eq window (selected-window)) + (eq window (minibuffer-selected-window))) + (with-current-buffer (window-buffer window) + (completion-preview-active-mode -1)))) + (define-minor-mode completion-preview-active-mode "Mode for when the completion preview is shown." :interactive nil - (unless completion-preview-active-mode (completion-preview-hide))) + (if completion-preview-active-mode + (add-hook 'window-selection-change-functions + #'completion-preview--window-selection-change nil t) + (remove-hook 'window-selection-change-functions + #'completion-preview--window-selection-change t) + (completion-preview-hide))) (defun completion-preview--try-table (table beg end props) "Check TABLE for a completion matching the text between BEG and END. diff --git a/lisp/emacs-lisp/package-vc.el b/lisp/emacs-lisp/package-vc.el index 9780e4d53de..c23ca158b2d 100644 --- a/lisp/emacs-lisp/package-vc.el +++ b/lisp/emacs-lisp/package-vc.el @@ -503,10 +503,6 @@ identify a package as a VC package later on), building documentation and marking the package as installed." (let ((pkg-spec (package-vc--desc->spec pkg-desc)) missing) - ;; Remove any previous instance of PKG-DESC from `package-alist' - (let ((pkgs (assq (package-desc-name pkg-desc) package-alist))) - (when pkgs - (setf (cdr pkgs) (seq-remove #'package-vc-p (cdr pkgs))))) ;; In case the package was installed directly from source, the ;; dependency list wasn't know beforehand, and they might have @@ -576,6 +572,11 @@ documentation and marking the package as installed." (dolist (doc-file (ensure-list (plist-get pkg-spec :doc))) (package-vc--build-documentation pkg-desc doc-file)))) + ;; Remove any previous instance of PKG-DESC from `package-alist' + (let ((pkgs (assq (package-desc-name pkg-desc) package-alist))) + (when pkgs + (setf (cdr pkgs) (seq-remove #'package-vc-p (cdr pkgs))))) + ;; Update package-alist. (let ((new-desc (package-load-descriptor pkg-dir))) ;; Activation has to be done before compilation, so that if we're diff --git a/lisp/minibuffer.el b/lisp/minibuffer.el index d35a487a6cf..e5c5fd62f8c 100644 --- a/lisp/minibuffer.el +++ b/lisp/minibuffer.el @@ -1323,7 +1323,9 @@ If it's nil, sorting is disabled. If it's the symbol `alphabetical', candidates are sorted by `minibuffer-sort-alphabetically'. If it's the symbol `historical', candidates are sorted by -`minibuffer-sort-by-history'. +`minibuffer-sort-by-history', which first sorts alphabetically, +and then rearranges the order according to the order of the +candidates in the minibuffer history. If it's a function, the function is called to sort the candidates. The sorting function takes a list of completion candidate strings, which it may modify; it should return a sorted list, |