emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

master ca709f9c066 4/4: Merge branch 'master' of git.sv.gnu.org:/srv/git


From: Michael Albinus
Subject: master ca709f9c066 4/4: Merge branch 'master' of git.sv.gnu.org:/srv/git/emacs
Date: Sat, 9 Dec 2023 04:26:18 -0500 (EST)

branch: master
commit ca709f9c0667c8919396f86dc41d8ad4b921c7c6
Merge: a3a7613fd95 4925f0ad228
Author: Michael Albinus <michael.albinus@gmx.de>
Commit: Michael Albinus <michael.albinus@gmx.de>

    Merge branch 'master' of git.sv.gnu.org:/srv/git/emacs
---
 etc/NEWS                      |  4 ++--
 lisp/completion-preview.el    | 16 +++++++++++++++-
 lisp/emacs-lisp/package-vc.el |  9 +++++----
 lisp/minibuffer.el            |  4 +++-
 4 files changed, 25 insertions(+), 8 deletions(-)

diff --git a/etc/NEWS b/etc/NEWS
index e76c8ccaa6a..6dd0f9b5e4e 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -653,8 +653,8 @@ is t by default.
 
 *** New value 'historical' for user option 'completions-sort'.
 When 'completions-sort' is set to 'historical', completion candidates
-will be sorted by their chronological order in the minibuffer history,
-with more recent candidates appearing first.
+will be first sorted alphabetically, and then re-sorted by their order
+in the minibuffer history, with more recent candidates appearing first.
 
 ** Pcomplete
 
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,



reply via email to

[Prev in Thread] Current Thread [Next in Thread]