emacs-diffs
[Top][All Lists]
Advanced

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

master a3129af331: Merge from origin/emacs-28


From: Stefan Kangas
Subject: master a3129af331: Merge from origin/emacs-28
Date: Thu, 30 Dec 2021 00:49:14 -0500 (EST)

branch: master
commit a3129af331b8893cec3036f8baec26d49e339b5f
Merge: a4893515c2 06545bc0cc
Author: Stefan Kangas <stefan@marxist.se>
Commit: Stefan Kangas <stefan@marxist.se>

    Merge from origin/emacs-28
    
    06545bc0cc CC Mode: c-update-brace-stack: After struct foo *, do not ...
    f11779f01b Improve documentation of 'M-X' and related features
    
    # Conflicts:
    #       etc/NEWS
---
 doc/emacs/m-x.texi          |  1 +
 doc/lispref/commands.texi   | 28 ++++++++++++++++++++--------
 etc/NEWS.28                 | 25 +++++++++++++++++++------
 lisp/progmodes/cc-engine.el |  2 +-
 lisp/progmodes/cc-langs.el  |  4 ++--
 5 files changed, 43 insertions(+), 17 deletions(-)

diff --git a/doc/emacs/m-x.texi b/doc/emacs/m-x.texi
index 7b9b40388c..1115a32541 100644
--- a/doc/emacs/m-x.texi
+++ b/doc/emacs/m-x.texi
@@ -60,6 +60,7 @@ the option @code{read-extended-command-predicate} to exclude 
those
 irrelevant commands from completion results.
 
 @kindex M-S-x
+@kindex M-X
   Conversely, Emacs can exclude all commands except those that are
 particularly relevant to the current buffer.  The @kbd{M-S-x} (that's
 ``meta shift x'') command works just like @kbd{M-x}, but instead of
diff --git a/doc/lispref/commands.texi b/doc/lispref/commands.texi
index b833b5bf85..7b41816606 100644
--- a/doc/lispref/commands.texi
+++ b/doc/lispref/commands.texi
@@ -630,17 +630,26 @@ any modes that are derived from @code{dired-mode}).  Any 
number of
 modes can be added to the @code{interactive} form.
 
 @vindex read-extended-command-predicate
-Specifying modes may affect completion in @kbd{M-x}, depending on the
+Specifying modes affects command completion in @kbd{M-S-x}
+(@code{execute-extended-command-for-buffer}, @pxref{Interactive
+Call}).  It may also affect completion in @kbd{M-x}, depending on the
 value of @code{read-extended-command-predicate}.
 
 For instance, when using the
-@code{command-completion-default-include-p} predicate, @kbd{M-x} won't
-list commands that have been marked as being applicable to a specific
-mode (unless you are in a buffer that uses that mode, of course).
-This goes for both major and minor modes.
+@code{command-completion-default-include-p} predicate as the value of
+@code{read-extended-command-predicate}, @kbd{M-x} won't list commands
+that have been marked as being applicable to a specific mode (unless
+you are in a buffer that uses that mode, of course).  This goes for
+both major and minor modes.  (By contrast, @kbd{M-S-x} always omits
+inapplicable commands from the completion candidates.)
 
-Marking commands this way will also make @kbd{C-h m} list these
-commands (if they aren't bound to any keys).
+By default, @code{read-extended-command-predicate} is @code{nil}, and
+completion in @kbd{M-x} lists all the commands that match what the
+user has typed, whether those commands are or aren't marked as
+applicable to the current buffer's mode.
+
+Marking commands to be applicable to a mode will also make @kbd{C-h m}
+list these commands (if they aren't bound to any keys).
 
 If using this extended @code{interactive} form isn't convenient
 (because the code is supposed to work in older versions of Emacs that
@@ -857,13 +866,16 @@ non-@code{nil} if the command is to be included when 
completing in
 that buffer.
 @end deffn
 
+@kindex @kbd{M-X}
+@kindex @kbd{M-S-x}
 @deffn Command execute-extended-command-for-buffer prefix-argument
 This is like @code{execute-extended-command}, but limits the commands
 offered for completion to those commands that are of particular
 relevance to the current major mode (and enabled minor modes).  This
 includes commands that are tagged with the modes (@pxref{Using
 Interactive}), and also commands that are bound to locally active
-keymaps.
+keymaps.  This command is the normal definition of @kbd{M-S-x}
+(that's ``meta shift x'').
 @end deffn
 
 @node Distinguish Interactive
diff --git a/etc/NEWS.28 b/etc/NEWS.28
index 1664ccfd04..f1bf2fe67d 100644
--- a/etc/NEWS.28
+++ b/etc/NEWS.28
@@ -3730,15 +3730,28 @@ commands as being applicable for modes derived from 
'dired-mode',
 or if the mode is a minor mode, when the current buffer has that
 minor mode activated.  Note that using this form will create byte code
 that is not compatible with byte code in previous Emacs versions.
+Also note that by default these annotations have no effect, unless the
+new option 'read-extended-command-predicate' option is customized to call
+'command-completion-default-include-p' or a similar function.
 
 +++
-** New forms to declare how completion should happen has been added.
+** New 'declare' forms to control completion of commands in 'M-x'.
 '(declare (completion PREDICATE))' can be used as a general predicate
-to say whether the command should be present when completing with
-'M-x TAB'.  '(declare (modes MODE...))' can be used as a short-hand
-way of saying that the command should be present when completing from
-buffers in major modes derived from MODE..., or, if it's a minor mode,
-when that minor mode is enabled in the current buffer.
+to say whether the command should be considered a completion candidate
+when completing with 'M-x TAB'.
+
+'(declare (modes MODE...))' can be used as a short-hand way of saying
+that the command should be considered a completion candidate when
+completing on commands from buffers in major modes derived from
+MODE..., or, if it's a minor mode, when that minor mode is enabled in
+the current buffer.
+
+Note that these forms will only have their effect if the
+'read-extended-command-predicate' option is customized to call
+'command-completion-default-include-p' or a similar function.  The
+default value of 'read-extended-command-predicate' is nil, which means
+no commands that match what you have typed are excluded from being
+completion candidates.
 
 +++
 ** 'define-minor-mode'  now takes an ':interactive' argument.
diff --git a/lisp/progmodes/cc-engine.el b/lisp/progmodes/cc-engine.el
index d37a50997a..d289148874 100644
--- a/lisp/progmodes/cc-engine.el
+++ b/lisp/progmodes/cc-engine.el
@@ -6139,7 +6139,7 @@ comment at the start of cc-engine.el for more info."
          (setq s (cons -1 (cdr s))))
         ((and (equal match ",")
               (eq (car s) -1)))        ; at "," in "class foo : bar, ..."
-        ((member match '(";" "," ")"))
+        ((member match '(";" "*" "," "("))
          (when (and s (cdr s) (<= (car s) 0))
            (setq s (cdr s))))
         ((c-keyword-member kwd-sym 'c-flat-decl-block-kwds)
diff --git a/lisp/progmodes/cc-langs.el b/lisp/progmodes/cc-langs.el
index 53f6206a82..85cc887110 100644
--- a/lisp/progmodes/cc-langs.el
+++ b/lisp/progmodes/cc-langs.el
@@ -3180,8 +3180,8 @@ Note that Java specific rules are currently applied to 
tell this from
       (append
        (c-lang-const c-flat-decl-block-kwds)
        (if (c-lang-const c-recognize-<>-arglists)
-          '("{" "}" ";" "," ")" ":" "<")
-        '("{" "}" ";" "," ")" ":")))))
+          '("{" "}" ";" "*" "," ")" ":" "<")
+        '("{" "}" ";" "*" "," ")" ":")))))
 (c-lang-defvar c-brace-stack-thing-key (c-lang-const c-brace-stack-thing-key))
 
 (c-lang-defconst c-brace-stack-no-semi-key



reply via email to

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