diff options
| author | Stefan Kangas | 2021-12-30 06:30:43 +0100 |
|---|---|---|
| committer | Stefan Kangas | 2021-12-30 06:30:43 +0100 |
| commit | a3129af331b8893cec3036f8baec26d49e339b5f (patch) | |
| tree | 330470edf3f27156973b4fca6a020a4cdb61ccc4 | |
| parent | a4893515c249386bca39f1b9a90adc6fc68b48d5 (diff) | |
| parent | 06545bc0cc533b1abd831dd521df5f3369675d61 (diff) | |
| download | emacs-a3129af331b8893cec3036f8baec26d49e339b5f.tar.gz emacs-a3129af331b8893cec3036f8baec26d49e339b5f.zip | |
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
| -rw-r--r-- | doc/emacs/m-x.texi | 1 | ||||
| -rw-r--r-- | doc/lispref/commands.texi | 28 | ||||
| -rw-r--r-- | etc/NEWS.28 | 25 | ||||
| -rw-r--r-- | lisp/progmodes/cc-engine.el | 2 | ||||
| -rw-r--r-- | 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 7b9b40388c2..1115a325412 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 | |||
| 60 | irrelevant commands from completion results. | 60 | irrelevant commands from completion results. |
| 61 | 61 | ||
| 62 | @kindex M-S-x | 62 | @kindex M-S-x |
| 63 | @kindex M-X | ||
| 63 | Conversely, Emacs can exclude all commands except those that are | 64 | Conversely, Emacs can exclude all commands except those that are |
| 64 | particularly relevant to the current buffer. The @kbd{M-S-x} (that's | 65 | particularly relevant to the current buffer. The @kbd{M-S-x} (that's |
| 65 | ``meta shift x'') command works just like @kbd{M-x}, but instead of | 66 | ``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 b833b5bf856..7b418166067 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 | |||
| 630 | modes can be added to the @code{interactive} form. | 630 | modes can be added to the @code{interactive} form. |
| 631 | 631 | ||
| 632 | @vindex read-extended-command-predicate | 632 | @vindex read-extended-command-predicate |
| 633 | Specifying modes may affect completion in @kbd{M-x}, depending on the | 633 | Specifying modes affects command completion in @kbd{M-S-x} |
| 634 | (@code{execute-extended-command-for-buffer}, @pxref{Interactive | ||
| 635 | Call}). It may also affect completion in @kbd{M-x}, depending on the | ||
| 634 | value of @code{read-extended-command-predicate}. | 636 | value of @code{read-extended-command-predicate}. |
| 635 | 637 | ||
| 636 | For instance, when using the | 638 | For instance, when using the |
| 637 | @code{command-completion-default-include-p} predicate, @kbd{M-x} won't | 639 | @code{command-completion-default-include-p} predicate as the value of |
| 638 | list commands that have been marked as being applicable to a specific | 640 | @code{read-extended-command-predicate}, @kbd{M-x} won't list commands |
| 639 | mode (unless you are in a buffer that uses that mode, of course). | 641 | that have been marked as being applicable to a specific mode (unless |
| 640 | This goes for both major and minor modes. | 642 | you are in a buffer that uses that mode, of course). This goes for |
| 643 | both major and minor modes. (By contrast, @kbd{M-S-x} always omits | ||
| 644 | inapplicable commands from the completion candidates.) | ||
| 641 | 645 | ||
| 642 | Marking commands this way will also make @kbd{C-h m} list these | 646 | By default, @code{read-extended-command-predicate} is @code{nil}, and |
| 643 | commands (if they aren't bound to any keys). | 647 | completion in @kbd{M-x} lists all the commands that match what the |
| 648 | user has typed, whether those commands are or aren't marked as | ||
| 649 | applicable to the current buffer's mode. | ||
| 650 | |||
| 651 | Marking commands to be applicable to a mode will also make @kbd{C-h m} | ||
| 652 | list these commands (if they aren't bound to any keys). | ||
| 644 | 653 | ||
| 645 | If using this extended @code{interactive} form isn't convenient | 654 | If using this extended @code{interactive} form isn't convenient |
| 646 | (because the code is supposed to work in older versions of Emacs that | 655 | (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 | |||
| 857 | that buffer. | 866 | that buffer. |
| 858 | @end deffn | 867 | @end deffn |
| 859 | 868 | ||
| 869 | @kindex @kbd{M-X} | ||
| 870 | @kindex @kbd{M-S-x} | ||
| 860 | @deffn Command execute-extended-command-for-buffer prefix-argument | 871 | @deffn Command execute-extended-command-for-buffer prefix-argument |
| 861 | This is like @code{execute-extended-command}, but limits the commands | 872 | This is like @code{execute-extended-command}, but limits the commands |
| 862 | offered for completion to those commands that are of particular | 873 | offered for completion to those commands that are of particular |
| 863 | relevance to the current major mode (and enabled minor modes). This | 874 | relevance to the current major mode (and enabled minor modes). This |
| 864 | includes commands that are tagged with the modes (@pxref{Using | 875 | includes commands that are tagged with the modes (@pxref{Using |
| 865 | Interactive}), and also commands that are bound to locally active | 876 | Interactive}), and also commands that are bound to locally active |
| 866 | keymaps. | 877 | keymaps. This command is the normal definition of @kbd{M-S-x} |
| 878 | (that's ``meta shift x''). | ||
| 867 | @end deffn | 879 | @end deffn |
| 868 | 880 | ||
| 869 | @node Distinguish Interactive | 881 | @node Distinguish Interactive |
diff --git a/etc/NEWS.28 b/etc/NEWS.28 index 1664ccfd044..f1bf2fe67d1 100644 --- a/etc/NEWS.28 +++ b/etc/NEWS.28 | |||
| @@ -3730,15 +3730,28 @@ commands as being applicable for modes derived from 'dired-mode', | |||
| 3730 | or if the mode is a minor mode, when the current buffer has that | 3730 | or if the mode is a minor mode, when the current buffer has that |
| 3731 | minor mode activated. Note that using this form will create byte code | 3731 | minor mode activated. Note that using this form will create byte code |
| 3732 | that is not compatible with byte code in previous Emacs versions. | 3732 | that is not compatible with byte code in previous Emacs versions. |
| 3733 | Also note that by default these annotations have no effect, unless the | ||
| 3734 | new option 'read-extended-command-predicate' option is customized to call | ||
| 3735 | 'command-completion-default-include-p' or a similar function. | ||
| 3733 | 3736 | ||
| 3734 | +++ | 3737 | +++ |
| 3735 | ** New forms to declare how completion should happen has been added. | 3738 | ** New 'declare' forms to control completion of commands in 'M-x'. |
| 3736 | '(declare (completion PREDICATE))' can be used as a general predicate | 3739 | '(declare (completion PREDICATE))' can be used as a general predicate |
| 3737 | to say whether the command should be present when completing with | 3740 | to say whether the command should be considered a completion candidate |
| 3738 | 'M-x TAB'. '(declare (modes MODE...))' can be used as a short-hand | 3741 | when completing with 'M-x TAB'. |
| 3739 | way of saying that the command should be present when completing from | 3742 | |
| 3740 | buffers in major modes derived from MODE..., or, if it's a minor mode, | 3743 | '(declare (modes MODE...))' can be used as a short-hand way of saying |
| 3741 | when that minor mode is enabled in the current buffer. | 3744 | that the command should be considered a completion candidate when |
| 3745 | completing on commands from buffers in major modes derived from | ||
| 3746 | MODE..., or, if it's a minor mode, when that minor mode is enabled in | ||
| 3747 | the current buffer. | ||
| 3748 | |||
| 3749 | Note that these forms will only have their effect if the | ||
| 3750 | 'read-extended-command-predicate' option is customized to call | ||
| 3751 | 'command-completion-default-include-p' or a similar function. The | ||
| 3752 | default value of 'read-extended-command-predicate' is nil, which means | ||
| 3753 | no commands that match what you have typed are excluded from being | ||
| 3754 | completion candidates. | ||
| 3742 | 3755 | ||
| 3743 | +++ | 3756 | +++ |
| 3744 | ** 'define-minor-mode' now takes an ':interactive' argument. | 3757 | ** 'define-minor-mode' now takes an ':interactive' argument. |
diff --git a/lisp/progmodes/cc-engine.el b/lisp/progmodes/cc-engine.el index d37a50997ad..d2891488748 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." | |||
| 6139 | (setq s (cons -1 (cdr s)))) | 6139 | (setq s (cons -1 (cdr s)))) |
| 6140 | ((and (equal match ",") | 6140 | ((and (equal match ",") |
| 6141 | (eq (car s) -1))) ; at "," in "class foo : bar, ..." | 6141 | (eq (car s) -1))) ; at "," in "class foo : bar, ..." |
| 6142 | ((member match '(";" "," ")")) | 6142 | ((member match '(";" "*" "," "(")) |
| 6143 | (when (and s (cdr s) (<= (car s) 0)) | 6143 | (when (and s (cdr s) (<= (car s) 0)) |
| 6144 | (setq s (cdr s)))) | 6144 | (setq s (cdr s)))) |
| 6145 | ((c-keyword-member kwd-sym 'c-flat-decl-block-kwds) | 6145 | ((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 53f6206a821..85cc8871100 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 | |||
| 3180 | (append | 3180 | (append |
| 3181 | (c-lang-const c-flat-decl-block-kwds) | 3181 | (c-lang-const c-flat-decl-block-kwds) |
| 3182 | (if (c-lang-const c-recognize-<>-arglists) | 3182 | (if (c-lang-const c-recognize-<>-arglists) |
| 3183 | '("{" "}" ";" "," ")" ":" "<") | 3183 | '("{" "}" ";" "*" "," ")" ":" "<") |
| 3184 | '("{" "}" ";" "," ")" ":"))))) | 3184 | '("{" "}" ";" "*" "," ")" ":"))))) |
| 3185 | (c-lang-defvar c-brace-stack-thing-key (c-lang-const c-brace-stack-thing-key)) | 3185 | (c-lang-defvar c-brace-stack-thing-key (c-lang-const c-brace-stack-thing-key)) |
| 3186 | 3186 | ||
| 3187 | (c-lang-defconst c-brace-stack-no-semi-key | 3187 | (c-lang-defconst c-brace-stack-no-semi-key |