emacs-diffs
[Top][All Lists]
Advanced

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

scratch/etags-regen f520e5d 5/8: Merge branch 'master' into scratch/etag


From: Dmitry Gutov
Subject: scratch/etags-regen f520e5d 5/8: Merge branch 'master' into scratch/etags-regen
Date: Sun, 7 Feb 2021 21:12:02 -0500 (EST)

branch: scratch/etags-regen
commit f520e5dcfa584b28e868565ee1727cd940682ace
Merge: 3098e47 0f2d877
Author: Dmitry Gutov <dgutov@yandex.ru>
Commit: Dmitry Gutov <dgutov@yandex.ru>

    Merge branch 'master' into scratch/etags-regen
---
 doc/emacs/search.texi         |  7 +++++
 doc/lispref/frames.texi       |  2 +-
 doc/lispref/minibuf.texi      | 19 ++++++++++----
 etc/NEWS                      | 21 +++++++++++++++
 lisp/auth-source.el           |  2 +-
 lisp/dired.el                 | 21 ++++++++-------
 lisp/isearch.el               | 23 ++++++++++++++---
 lisp/mail/rmail.el            |  8 ++++++
 lisp/mail/rmailsum.el         |  5 ++--
 lisp/minibuffer.el            | 19 ++++++--------
 lisp/tab-line.el              |  4 ++-
 lisp/textmodes/sgml-mode.el   |  4 +--
 lisp/vc/vc-git.el             |  4 +--
 lisp/vc/vc-hg.el              |  3 ++-
 lisp/vc/vc.el                 |  3 +++
 src/frame.h                   |  2 +-
 src/minibuf.c                 | 60 ++++++++++++++++++++++++++++---------------
 src/nsmenu.m                  |  4 +--
 src/w32fns.c                  |  2 +-
 src/w32menu.c                 | 10 +++-----
 src/xdisp.c                   |  2 +-
 src/xmenu.c                   | 14 +++++-----
 test/lisp/minibuffer-tests.el | 24 ++++++++++++++---
 23 files changed, 181 insertions(+), 82 deletions(-)

diff --git a/doc/emacs/search.texi b/doc/emacs/search.texi
index 637867b..f3c42bc 100644
--- a/doc/emacs/search.texi
+++ b/doc/emacs/search.texi
@@ -2027,6 +2027,13 @@ highlighting:
 @item lazy-highlight-initial-delay
 @vindex lazy-highlight-initial-delay
 Time in seconds to wait before highlighting visible matches.
+Applies only if the search string is less than
+@code{lazy-highlight-no-delay-length} characters long.
+
+@item lazy-highlight-no-delay-length
+@vindex lazy-highlight-no-delay-length
+For search strings at least as long as the value of this variable,
+lazy highlighting of matches starts immediately.
 
 @item lazy-highlight-interval
 @vindex lazy-highlight-interval
diff --git a/doc/lispref/frames.texi b/doc/lispref/frames.texi
index 9b4716b..a15511d 100644
--- a/doc/lispref/frames.texi
+++ b/doc/lispref/frames.texi
@@ -2411,7 +2411,7 @@ attribute of the @code{default} face.
 
 @vindex foreground-color@r{, a frame parameter}
 @item foreground-color
-The color to use for the image of a character.  It is equivalent to
+The color to use for characters.  It is equivalent to
 the @code{:foreground} attribute of the @code{default} face.
 
 @vindex background-color@r{, a frame parameter}
diff --git a/doc/lispref/minibuf.texi b/doc/lispref/minibuf.texi
index 0ce17ed..185d355 100644
--- a/doc/lispref/minibuf.texi
+++ b/doc/lispref/minibuf.texi
@@ -1799,15 +1799,19 @@ pairs.  The following properties are supported:
 The value should be a function to add annotations in the completions
 buffer.  This function must accept one argument, a completion, and
 should either return @code{nil} or a string to be displayed next to
-the completion.
+the completion.  Unless this function puts own face on the annotation
+suffix string, the @code{completions-annotations} face is added by
+default to that string.
 
 @item :affixation-function
 The value should be a function to add prefixes and suffixes to
 completions.  This function must accept one argument, a list of
 completions, and should return such a list of completions where
 each element contains a list of three elements: a completion,
-a prefix string, and a suffix string.  This function takes priority
-over @code{:annotation-function}.
+a prefix string, and a suffix string.  When this function
+returns a list of two elements, it is interpreted as a list
+of a completion and a suffix string like in @code{:annotation-function}.
+This function takes priority over @code{:annotation-function}.
 
 @item :exit-function
 The value should be a function to run after performing completion.
@@ -1907,6 +1911,9 @@ The value should be a function for @dfn{annotating} 
completions.  The
 function should take one argument, @var{string}, which is a possible
 completion.  It should return a string, which is displayed after the
 completion @var{string} in the @file{*Completions*} buffer.
+Unless this function puts own face on the annotation suffix string,
+the @code{completions-annotations} face is added by default to
+that string.
 
 @item affixation-function
 The value should be a function for adding prefixes and suffixes to
@@ -1915,8 +1922,10 @@ completions.  The function should take one argument,
 return such a list of @var{completions} where each element contains a list
 of three elements: a completion, a prefix which is displayed before
 the completion string in the @file{*Completions*} buffer, and
-a suffix displayed after the completion string.  This function
-takes priority over @code{annotation-function}.
+a suffix displayed after the completion string.  When this function
+returns a list of two elements, it is interpreted as a list of
+a completion and a suffix string like in @code{annotation-function}.
+This function takes priority over @code{annotation-function}.
 
 @item display-sort-function
 The value should be a function for sorting completions.  The function
diff --git a/etc/NEWS b/etc/NEWS
index 8e233f8..2949963 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -226,6 +226,13 @@ C-M-<return> instead of <C-M-return>.  Either variant can 
be used as
 input; functions such as 'kbd' and 'read-kbd-macro' accept both styles
 as equivalent (they have done so for a long time).
 
++++
+** New user option 'lazy-highlight-no-delay-length'.
+Lazy highlighting of matches in Isearch now starts immediately if the
+search string is at least this long.  'lazy-highlight-initial-delay'
+still applies for shorter search strings, which avoids flicker in the
+search buffer due to too many matches being highlighted.
+
 
 * Editing Changes in Emacs 28.1
 
@@ -504,6 +511,12 @@ time zones will use a form like "+0100" instead of "CET".
 
 ** Dired
 
+---
+*** Behavior change on 'dired-clean-confirm-killing-deleted-buffers'.
+Previously, if 'dired-clean-up-buffers-too' was non-nil, and
+'dired-clean-confirm-killing-deleted-buffers' was nil, the buffers
+wouldn't be killed.  This combination will now kill the buffers.
+
 +++
 *** New user option 'dired-switches-in-mode-line'.
 This user option controls how 'ls' switches are displayed in the mode
@@ -1132,6 +1145,11 @@ bindings, will be aborted, and Emacs will not ask you 
whether to
 enlarge 'max-specpdl-size' to complete the rendering.  The default is
 t, which preserves the original behavior.
 
+---
+*** New user option 'rmail-show-message-set-modified'.
+If set non-nil, showing an unseen message will set the Rmail buffer's
+modified flag.
+
 ** Apropos
 
 *** New commands 'apropos-next-symbol' and 'apropos-previous-symbol'.
@@ -1999,6 +2017,9 @@ directory instead of the default directory.
 
 * Incompatible Lisp Changes in Emacs 28.1
 
+** 'completions-annotations' face is not used when the caller puts own face.
+This affects the suffix specified by completion 'annotation-function'.
+
 ** 'set-process-buffer' now updates the process mark.
 The mark will be set to point to the end of the new buffer.
 
diff --git a/lisp/auth-source.el b/lisp/auth-source.el
index ad3b690..2494040 100644
--- a/lisp/auth-source.el
+++ b/lisp/auth-source.el
@@ -588,7 +588,7 @@ Here's an example:
 \(let ((auth-source-creation-defaults \\='((user . \"defaultUser\")
                                         (A    . \"default A\")))
        (auth-source-creation-prompts
-        \\='((password . \"Enter IMAP password for %h:%p: \"))))
+        \\='((secret . \"Enter IMAP password for %h:%p: \"))))
   (auth-source-search :host \\='(\"nonesuch\" \"twosuch\") :type \\='netrc 
:max 1
                       :P \"pppp\" :Q \"qqqq\"
                       :create \\='(A B Q)))
diff --git a/lisp/dired.el b/lisp/dired.el
index 3f11936..fe6ac1e 100644
--- a/lisp/dired.el
+++ b/lisp/dired.el
@@ -3532,18 +3532,21 @@ confirmation.  To disable the confirmation, see
   (when (and (featurep 'dired-x) dired-clean-up-buffers-too)
     (let ((buf (get-file-buffer fn)))
       (and buf
-           (and dired-clean-confirm-killing-deleted-buffers
-                (funcall #'y-or-n-p
-                         (format "Kill buffer of %s, too? "
-                                 (file-name-nondirectory fn))))
+           (or (and dired-clean-confirm-killing-deleted-buffers
+                    (funcall #'y-or-n-p
+                             (format "Kill buffer of %s, too? "
+                                     (file-name-nondirectory fn))))
+               (not dired-clean-confirm-killing-deleted-buffers))
            (kill-buffer buf)))
     (let ((buf-list (dired-buffers-for-dir (expand-file-name fn))))
       (and buf-list
-           (and dired-clean-confirm-killing-deleted-buffers
-                (y-or-n-p (format (ngettext "Kill Dired buffer of %s, too? "
-                                           "Kill Dired buffers of %s, too? "
-                                           (length buf-list))
-                                  (file-name-nondirectory fn))))
+           (or (and dired-clean-confirm-killing-deleted-buffers
+                    (y-or-n-p (format
+                               (ngettext "Kill Dired buffer of %s, too? "
+                                         "Kill Dired buffers of %s, too? "
+                                         (length buf-list))
+                               (file-name-nondirectory fn))))
+               (not dired-clean-confirm-killing-deleted-buffers))
            (dolist (buf buf-list)
              (kill-buffer buf))))))
 
diff --git a/lisp/isearch.el b/lisp/isearch.el
index a1e3fe2..82d64c5 100644
--- a/lisp/isearch.el
+++ b/lisp/isearch.el
@@ -352,10 +352,20 @@ If this is nil, extra highlighting can be \"manually\" 
removed with
   :group 'lazy-highlight)
 
 (defcustom lazy-highlight-initial-delay 0.25
-  "Seconds to wait before beginning to lazily highlight all matches."
+  "Seconds to wait before beginning to lazily highlight all matches.
+This setting only has effect when the search string is less than
+`lazy-highlight-no-delay-length' characters long."
   :type 'number
   :group 'lazy-highlight)
 
+(defcustom lazy-highlight-no-delay-length 3
+  "For search strings at least this long, lazy highlight starts immediately.
+For shorter search strings, `lazy-highlight-initial-delay'
+applies."
+  :type 'integer
+  :group 'lazy-highlight
+  :version "28.1")
+
 (defcustom lazy-highlight-interval 0 ; 0.0625
   "Seconds between lazily highlighting successive matches."
   :type 'number
@@ -3356,7 +3366,7 @@ isearch-message-suffix prompt.  Otherwise, for 
isearch-message-prefix."
              (not isearch-error)
              (not isearch-suspended))
         (format format-string
-                (if isearch-forward
+                (if isearch-lazy-highlight-forward
                     isearch-lazy-count-current
                   (if (eq isearch-lazy-count-current 0)
                       0
@@ -3916,7 +3926,8 @@ by other Emacs features."
         (clrhash isearch-lazy-count-hash)
         (setq isearch-lazy-count-current nil
               isearch-lazy-count-total nil)
-        (isearch-message)))
+        ;; Delay updating the message if possible, to avoid flicker
+        (when (string-equal isearch-string "") (isearch-message))))
     (setq isearch-lazy-highlight-window-start-changed nil)
     (setq isearch-lazy-highlight-window-end-changed nil)
     (setq isearch-lazy-highlight-error isearch-error)
@@ -3961,7 +3972,11 @@ by other Emacs features."
                 (point-min))))
     (unless (equal isearch-string "")
       (setq isearch-lazy-highlight-timer
-            (run-with-idle-timer lazy-highlight-initial-delay nil
+            (run-with-idle-timer (if (>= (length isearch-string)
+                                         lazy-highlight-no-delay-length)
+                                     0
+                                   lazy-highlight-initial-delay)
+                                 nil
                                  'isearch-lazy-highlight-start))))
   ;; Update the current match number only in isearch-mode and
   ;; unless isearch-mode is used specially with isearch-message-function
diff --git a/lisp/mail/rmail.el b/lisp/mail/rmail.el
index 29460cc..9f95b62 100644
--- a/lisp/mail/rmail.el
+++ b/lisp/mail/rmail.el
@@ -2723,6 +2723,12 @@ See also `unrmail-mbox-format'."
   :version "24.4"
   :group 'rmail-files)
 
+(defcustom rmail-show-message-set-modified nil
+  "If non-nil, displaying an unseen message marks the Rmail buffer as 
modified."
+  :type 'boolean
+  :group 'rmail
+  :version "28.1")
+
 (defun rmail-show-message-1 (&optional msg)
   "Show message MSG (default: current message) using `rmail-view-buffer'.
 Return text to display in the minibuffer if MSG is out of
@@ -2750,6 +2756,8 @@ The current mail message becomes the message displayed."
        ;; Mark the message as seen, but preserve buffer modified flag.
        (let ((modiff (buffer-modified-p)))
          (rmail-set-attribute rmail-unseen-attr-index nil)
+          (and rmail-show-message-set-modified
+               (setq modiff t))
          (unless modiff
            (restore-buffer-modified-p modiff)))
        ;; bracket the message in the mail
diff --git a/lisp/mail/rmailsum.el b/lisp/mail/rmailsum.el
index d29115a..7f99ecd 100644
--- a/lisp/mail/rmailsum.el
+++ b/lisp/mail/rmailsum.el
@@ -974,8 +974,9 @@ a negative argument means to delete and move forward."
          (delete-char 1)
          (insert "D"))
        ;; Discard cached new summary line.
-       (with-current-buffer rmail-buffer
-         (aset rmail-summary-vector (1- n) nil))))
+        (when n
+         (with-current-buffer rmail-buffer
+           (aset rmail-summary-vector (1- n) nil)))))
   (beginning-of-line))
 
 (defun rmail-summary-update-line (n)
diff --git a/lisp/minibuffer.el b/lisp/minibuffer.el
index 315f2d3..03cc70c 100644
--- a/lisp/minibuffer.el
+++ b/lisp/minibuffer.el
@@ -122,7 +122,8 @@ This metadata is an alist.  Currently understood keys are:
    returns a string to append to STRING.
 - `affixation-function': function to prepend/append a prefix/suffix to
    entries.  Takes one argument (COMPLETIONS) and should return a list
-   of completions with a list of three elements: completion, its prefix
+   of completions with a list of either two elements: completion
+   and suffix, or three elements: completion, its prefix
    and suffix.  This function takes priority over `annotation-function'
    when both are provided, so only this function is used.
 - `display-sort-function': function to sort entries in *Completions*.
@@ -1785,22 +1786,17 @@ It also eliminates runs of equal strings."
                 (when prefix
                   (let ((beg (point))
                         (end (progn (insert prefix) (point))))
-                    (put-text-property beg end 'mouse-face nil)
-                    ;; When both prefix and suffix are added
-                    ;; by the caller via affixation-function,
-                    ;; then allow the caller to decide
-                    ;; what faces to put on prefix and suffix.
-                    (unless prefix
-                      (font-lock-prepend-text-property
-                       beg end 'face 'completions-annotations))))
+                    (put-text-property beg end 'mouse-face nil)))
                 (put-text-property (point) (progn (insert (car str)) (point))
                                    'mouse-face 'highlight)
                 (let ((beg (point))
                       (end (progn (insert suffix) (point))))
                   (put-text-property beg end 'mouse-face nil)
                   ;; Put the predefined face only when suffix
-                  ;; is added via annotation-function.
-                  (unless prefix
+                  ;; is added via annotation-function without prefix,
+                  ;; and when the caller doesn't use own face.
+                  (unless (or prefix (text-property-not-all
+                                      0 (length suffix) 'face nil suffix))
                     (font-lock-prepend-text-property
                      beg end 'face 'completions-annotations)))))
            (cond
@@ -1927,6 +1923,7 @@ These include:
 `:affixation-function': Function to prepend/append a prefix/suffix to
    completions.  The function must accept one argument, a list of
    completions, and return a list where each element is a list of
+   either two elements: a completion, and a suffix, or
    three elements: a completion, a prefix and a suffix.
    This function takes priority over `:annotation-function'
    when both are provided, so only this function is used.
diff --git a/lisp/tab-line.el b/lisp/tab-line.el
index 2726947..9209f2d 100644
--- a/lisp/tab-line.el
+++ b/lisp/tab-line.el
@@ -651,7 +651,9 @@ corresponding to the switched buffer."
   (if (functionp tab-line-new-tab-choice)
       (funcall tab-line-new-tab-choice)
     (let ((tab-line-tabs-buffer-groups mouse-buffer-menu-mode-groups))
-      (if (and (listp mouse-event) window-system) ; (display-popup-menus-p)
+      (if (and (listp mouse-event)
+               (display-popup-menus-p)
+               (not tty-menu-open-use-tmm))
           (mouse-buffer-menu mouse-event) ; like (buffer-menu-open)
         ;; tty menu doesn't support mouse clicks, so use tmm
         (tmm-prompt (mouse-buffer-menu-keymap))))))
diff --git a/lisp/textmodes/sgml-mode.el b/lisp/textmodes/sgml-mode.el
index 8465e82..c50c544 100644
--- a/lisp/textmodes/sgml-mode.el
+++ b/lisp/textmodes/sgml-mode.el
@@ -2402,9 +2402,9 @@ To work around that, do:
 
   (setq-local sgml-empty-tags
              ;; From HTML-4.01's loose.dtd, parsed with
-             ;; `sgml-parse-dtd', plus manual addition of "wbr".
+              ;; `sgml-parse-dtd', plus manual additions of "source" and "wbr".
              '("area" "base" "basefont" "br" "col" "frame" "hr" "img" "input"
-               "isindex" "link" "meta" "param" "wbr"))
+                "isindex" "link" "meta" "source" "param" "wbr"))
   (setq-local sgml-unclosed-tags
              ;; From HTML-4.01's loose.dtd, parsed with `sgml-parse-dtd'.
              '("body" "colgroup" "dd" "dt" "head" "html" "li" "option"
diff --git a/lisp/vc/vc-git.el b/lisp/vc/vc-git.el
index 94fac3a..d00c2c2 100644
--- a/lisp/vc/vc-git.el
+++ b/lisp/vc/vc-git.el
@@ -479,8 +479,8 @@ or an empty string if none."
      (propertize
       (format "%-12s" state)
       'face (cond ((eq state 'up-to-date) 'font-lock-builtin-face)
-                 ((eq state 'missing) 'font-lock-warning-face)
-                 (t 'font-lock-variable-name-face))
+                  ((eq state '(missing conflict)) 'font-lock-warning-face)
+                  (t 'font-lock-variable-name-face))
       'mouse-face 'highlight
       'keymap vc-dir-status-mouse-map)
      "  " (vc-git-permissions-as-string old-perm new-perm)
diff --git a/lisp/vc/vc-hg.el b/lisp/vc/vc-hg.el
index c4b82ab..1d163a6 100644
--- a/lisp/vc/vc-hg.el
+++ b/lisp/vc/vc-hg.el
@@ -1166,7 +1166,8 @@ hg binary."
 ;; Modeled after the similar function in vc-bzr.el
 (defun vc-hg-rename-file (old new)
   "Rename file from OLD to NEW using `hg mv'."
-  (vc-hg-command nil 0 new "mv" old))
+  (vc-hg-command nil 0 (expand-file-name new) "mv"
+                 (expand-file-name old)))
 
 (defun vc-hg-register (files &optional _comment)
   "Register FILES under hg. COMMENT is ignored."
diff --git a/lisp/vc/vc.el b/lisp/vc/vc.el
index bc9f112..00976a0 100644
--- a/lisp/vc/vc.el
+++ b/lisp/vc/vc.el
@@ -1549,6 +1549,9 @@ After check-out, runs the normal hook `vc-checkout-hook'."
          (vc-call-backend backend 'mark-resolved files)
          ;; FIXME: Is this TRTD?  Might not be.
          `((vc-state . edited)))
+    ;; Recompute mode lines.
+    (dolist (file files)
+      (vc-mode-line file backend))
     (message
      (substitute-command-keys
       "Conflicts have been resolved in %s.  \
diff --git a/src/frame.h b/src/frame.h
index 9b0852c..21148fe 100644
--- a/src/frame.h
+++ b/src/frame.h
@@ -1707,7 +1707,7 @@ extern Lisp_Object gui_display_get_resource (Display_Info 
*,
                                              Lisp_Object component,
                                              Lisp_Object subclass);
 
-extern void set_frame_menubar (struct frame *f, bool first_time, bool deep_p);
+extern void set_frame_menubar (struct frame *f, bool deep_p);
 extern void frame_set_mouse_pixel_position (struct frame *f, int pix_x, int 
pix_y);
 extern void free_frame_menubar (struct frame *);
 extern bool frame_ancestor_p (struct frame *af, struct frame *df);
diff --git a/src/minibuf.c b/src/minibuf.c
index 5df1045..0221f38 100644
--- a/src/minibuf.c
+++ b/src/minibuf.c
@@ -594,6 +594,18 @@ read_minibuf (Lisp_Object map, Lisp_Object initial, 
Lisp_Object prompt,
   record_unwind_protect (restore_buffer, Fcurrent_buffer ());
 
   choose_minibuf_frame ();
+  mini_frame = WINDOW_FRAME (XWINDOW (minibuf_window));
+
+  if (minibuf_level > 1
+      && minibuf_moves_frame_when_opened ()
+      && !minibuf_follows_frame ())
+    {
+      EMACS_INT i;
+
+      /* Stack up the existing minibuffers on the current mini-window */
+      for (i = 1; i < minibuf_level; i++)
+       set_window_buffer (minibuf_window, nth_minibuffer (i), 0, 0);
+    }
 
   record_unwind_protect_void (choose_minibuf_frame);
 
@@ -602,7 +614,6 @@ read_minibuf (Lisp_Object map, Lisp_Object initial, 
Lisp_Object prompt,
 
   /* If the minibuffer window is on a different frame, save that
      frame's configuration too.  */
-  mini_frame = WINDOW_FRAME (XWINDOW (minibuf_window));
   if (!EQ (mini_frame, selected_frame))
     record_unwind_protect (restore_window_configuration,
                           Fcons (/* Arrange for the frame later to be
@@ -745,17 +756,6 @@ read_minibuf (Lisp_Object map, Lisp_Object initial, 
Lisp_Object prompt,
         }
     }
 
-  if (minibuf_moves_frame_when_opened ())
-  {
-    EMACS_INT i;
-
-    /* Stack up all the (recursively) open minibuffers on the selected
-       mini_window.  */
-    for (i = 1; i < minibuf_level; i++)
-      set_window_buffer (XFRAME (mini_frame)->minibuffer_window,
-                         nth_minibuffer (i), 0, 0);
-  }
-
   /* Display this minibuffer in the proper window.  */
   /* Use set_window_buffer instead of Fset_window_buffer (see
      discussion of bug#11984, bug#12025, bug#12026).  */
@@ -926,6 +926,31 @@ nth_minibuffer (EMACS_INT depth)
   return XCAR (tail);
 }
 
+/* Set the major mode of the minibuffer BUF, depending on DEPTH, the
+   minibuffer depth.  */
+
+static void
+set_minibuffer_mode (Lisp_Object buf, EMACS_INT depth)
+{
+  ptrdiff_t count = SPECPDL_INDEX ();
+
+  record_unwind_current_buffer ();
+  Fset_buffer (buf);
+  if (depth > 0)
+    {
+      if (!NILP (Ffboundp (intern ("fundamental-mode"))))
+       call0 (intern ("fundamental-mode"));
+    }
+  else
+    {
+      if (!NILP (Ffboundp (intern ("minibuffer-inactive-mode"))))
+       call0 (intern ("minibuffer-inactive-mode"));
+      else
+       Fkill_all_local_variables ();
+    }
+  buf = unbind_to (count, buf);
+}
+
 /* Return a buffer to be used as the minibuffer at depth `depth'.
    depth = 0 is the lowest allowed argument, and that is the value
    used for nonrecursive minibuffer invocations.  */
@@ -946,7 +971,7 @@ get_minibuffer (EMACS_INT depth)
       char name[sizeof name_fmt + INT_STRLEN_BOUND (EMACS_INT)];
       AUTO_STRING_WITH_LEN (lname, name, sprintf (name, name_fmt, depth));
       buf = Fget_buffer_create (lname, Qnil);
-
+      set_minibuffer_mode (buf, depth);
       /* Although the buffer's name starts with a space, undo should be
         enabled in it.  */
       Fbuffer_enable_undo (buf);
@@ -955,19 +980,12 @@ get_minibuffer (EMACS_INT depth)
     }
   else
     {
-      ptrdiff_t count = SPECPDL_INDEX ();
       /* We have to empty both overlay lists.  Otherwise we end
         up with overlays that think they belong to this buffer
         while the buffer doesn't know about them any more.  */
       delete_all_overlays (XBUFFER (buf));
       reset_buffer (XBUFFER (buf));
-      record_unwind_current_buffer ();
-      Fset_buffer (buf);
-      if (!NILP (Ffboundp (intern ("minibuffer-inactive-mode"))))
-       call0 (intern ("minibuffer-inactive-mode"));
-      else
-        Fkill_all_local_variables ();
-      buf = unbind_to (count, buf);
+      set_minibuffer_mode (buf, depth);
     }
 
   return buf;
diff --git a/src/nsmenu.m b/src/nsmenu.m
index f8219d2..24aa5a0 100644
--- a/src/nsmenu.m
+++ b/src/nsmenu.m
@@ -405,7 +405,7 @@ ns_update_menubar (struct frame *f, bool deep_p)
    frame's menus have changed, and the *step representation should be updated
    from Lisp.  */
 void
-set_frame_menubar (struct frame *f, bool first_time, bool deep_p)
+set_frame_menubar (struct frame *f, bool deep_p)
 {
   ns_update_menubar (f, deep_p);
 }
@@ -1795,7 +1795,7 @@ DEFUN ("ns-reset-menu", Fns_reset_menu, Sns_reset_menu, 
0, 0, 0,
        doc: /* Cause the NS menu to be re-calculated.  */)
      (void)
 {
-  set_frame_menubar (SELECTED_FRAME (), 1, 0);
+  set_frame_menubar (SELECTED_FRAME (), 0);
   return Qnil;
 }
 
diff --git a/src/w32fns.c b/src/w32fns.c
index e93a0b8..5704f1d 100644
--- a/src/w32fns.c
+++ b/src/w32fns.c
@@ -1637,7 +1637,7 @@ w32_set_menu_bar_lines (struct frame *f, Lisp_Object 
value, Lisp_Object oldval)
          if (!old)
            /* Make menu bar when there was none.  Emacs 25 waited until
               the next redisplay for this to take effect.  */
-           set_frame_menubar (f, false, true);
+           set_frame_menubar (f, true);
          else
            {
              /* Remove menu bar.  */
diff --git a/src/w32menu.c b/src/w32menu.c
index 8bf0c46..3bf7666 100644
--- a/src/w32menu.c
+++ b/src/w32menu.c
@@ -155,7 +155,7 @@ w32_popup_dialog (struct frame *f, Lisp_Object header, 
Lisp_Object contents)
 void
 w32_activate_menubar (struct frame *f)
 {
-  set_frame_menubar (f, false, true);
+  set_frame_menubar (f, true);
 
   /* Lock out further menubar changes while active.  */
   f->output_data.w32->menubar_active = 1;
@@ -258,12 +258,10 @@ menubar_selection_callback (struct frame *f, void * 
client_data)
 }
 
 
-/* Set the contents of the menubar widgets of frame F.
-   The argument FIRST_TIME is currently ignored;
-   it is set the first time this is called, from initialize_frame_menubar.  */
+/* Set the contents of the menubar widgets of frame F.  */
 
 void
-set_frame_menubar (struct frame *f, bool first_time, bool deep_p)
+set_frame_menubar (struct frame *f, bool deep_p)
 {
   HMENU menubar_widget = f->output_data.w32->menubar_widget;
   Lisp_Object items;
@@ -511,7 +509,7 @@ initialize_frame_menubar (struct frame *f)
   /* This function is called before the first chance to redisplay
      the frame.  It has to be, so the frame will have the right size.  */
   fset_menu_bar_items (f, menu_bar_items (FRAME_MENU_BAR_ITEMS (f)));
-  set_frame_menubar (f, true, true);
+  set_frame_menubar (f, true);
 }
 
 /* Get rid of the menu bar of frame F, and free its storage.
diff --git a/src/xdisp.c b/src/xdisp.c
index 11b9e1b..32b3590 100644
--- a/src/xdisp.c
+++ b/src/xdisp.c
@@ -12876,7 +12876,7 @@ update_menu_bar (struct frame *f, bool save_match_data, 
bool hooks_run)
                  the selected frame should be allowed to set it.  */
               if (f == SELECTED_FRAME ())
 #endif
-               set_frame_menubar (f, false, false);
+               set_frame_menubar (f, false);
            }
          else
            /* On a terminal screen, the menu bar is an ordinary screen
diff --git a/src/xmenu.c b/src/xmenu.c
index ea3813a..a83fffb 100644
--- a/src/xmenu.c
+++ b/src/xmenu.c
@@ -289,7 +289,7 @@ DEFUN ("x-menu-bar-open-internal", 
Fx_menu_bar_open_internal, Sx_menu_bar_open_i
   block_input ();
 
   if (FRAME_EXTERNAL_MENU_BAR (f))
-    set_frame_menubar (f, false, true);
+    set_frame_menubar (f, true);
 
   menubar = FRAME_X_OUTPUT (f)->menubar_widget;
   if (menubar)
@@ -368,7 +368,7 @@ If FRAME is nil or not given, use the selected frame.  */)
   f = decode_window_system_frame (frame);
 
   if (FRAME_EXTERNAL_MENU_BAR (f))
-    set_frame_menubar (f, false, true);
+    set_frame_menubar (f, true);
 
   menubar = FRAME_X_OUTPUT (f)->menubar_widget;
   if (menubar)
@@ -433,7 +433,7 @@ x_activate_menubar (struct frame *f)
     return;
 #endif
 
-  set_frame_menubar (f, false, true);
+  set_frame_menubar (f, true);
   block_input ();
   popup_activated_flag = 1;
 #ifdef USE_GTK
@@ -677,12 +677,10 @@ apply_systemfont_to_menu (struct frame *f, Widget w)
 
 #endif
 
-/* Set the contents of the menubar widgets of frame F.
-   The argument FIRST_TIME is currently ignored;
-   it is set the first time this is called, from initialize_frame_menubar.  */
+/* Set the contents of the menubar widgets of frame F.  */
 
 void
-set_frame_menubar (struct frame *f, bool first_time, bool deep_p)
+set_frame_menubar (struct frame *f, bool deep_p)
 {
   xt_or_gtk_widget menubar_widget, old_widget;
 #ifdef USE_X_TOOLKIT
@@ -1029,7 +1027,7 @@ initialize_frame_menubar (struct frame *f)
   /* This function is called before the first chance to redisplay
      the frame.  It has to be, so the frame will have the right size.  */
   fset_menu_bar_items (f, menu_bar_items (FRAME_MENU_BAR_ITEMS (f)));
-  set_frame_menubar (f, true, true);
+  set_frame_menubar (f, true);
 }
 
 
diff --git a/test/lisp/minibuffer-tests.el b/test/lisp/minibuffer-tests.el
index 3ebca14..7349b19 100644
--- a/test/lisp/minibuffer-tests.el
+++ b/test/lisp/minibuffer-tests.el
@@ -1,4 +1,4 @@
-;;; completion-tests.el --- Tests for completion functions  -*- 
lexical-binding: t; -*-
+;;; minibuffer-tests.el --- Tests for completion functions  -*- 
lexical-binding: t; -*-
 
 ;; Copyright (C) 2013-2021 Free Software Foundation, Inc.
 
@@ -107,5 +107,23 @@
                                                 nil (length input))
                      (cons output (length output)))))))
 
-(provide 'completion-tests)
-;;; completion-tests.el ends here
+(ert-deftest completion--insert-strings-faces ()
+  (with-temp-buffer
+    (completion--insert-strings
+     '(("completion1" "suffix1")))
+    (should (equal (get-text-property 12 'face) '(completions-annotations))))
+  (with-temp-buffer
+    (completion--insert-strings
+     '(("completion1" #("suffix1" 0 7 (face shadow)))))
+    (should (equal (get-text-property 12 'face) 'shadow)))
+  (with-temp-buffer
+    (completion--insert-strings
+     '(("completion1" "prefix1" "suffix1")))
+    (should (equal (get-text-property 19 'face) nil)))
+  (with-temp-buffer
+    (completion--insert-strings
+     '(("completion1" "prefix1" #("suffix1" 0 7 (face shadow)))))
+    (should (equal (get-text-property 19 'face) 'shadow))))
+
+(provide 'minibuffer-tests)
+;;; minibuffer-tests.el ends here



reply via email to

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