Commit graph

170605 commits

Author SHA1 Message Date
Eshel Yaron
bc5c729d69
; (crm-change-separator): Enable recursive minibuffers. 2024-01-21 07:57:21 +01:00
Eshel Yaron
dc4ce1052b
New command 'crm-complete-and-insert-separator'
* lisp/emacs-lisp/crm.el (crm-complete-and-insert-separator): New
command.
(completing-read-multiple-mode-map): Bind it to 'C-,'.
(crm-canonical-separator, crm-common-separators): New variables.
(completions-multi-mode): Adapt mode line lighter.
(crm-complete-and-exit): Only suggest in 'M-x' in 'minibuffer-mode'.
(crm-change-separator): (Re)set canonical separator.

* doc/lispref/minibuf.texi (Minibuffer Completion): Update.
* doc/emacs/mini.texi (Completion Multi): New subsection.
(Completion Commands): Fix markup.
(Completion)
* doc/emacs/emacs.texi (Top): Add menu entry.

* etc/NEWS: Announce 'crm-complete-and-insert-separator'.
2024-01-21 07:57:21 +01:00
Eshel Yaron
1ab31ae0e5
; Align completion annotations with spaces for multi-column format
Use actual spaces to align completion annotations instead of
"specified space" display properties, since that allows
'completion--insert-strings' to correctly align multiple completion
columns when 'completions-format' is not 'one-column'.

* lisp/minibuffer.el (completion-styles-affixation)
(completion-file-name-affixation): Align annotations with spaces
instead of using '(space :align-to ...)'  display properties.
2024-01-21 07:57:20 +01:00
Eshel Yaron
c00e059c36
Avoid slow remote file name completion annotations
* lisp/files.el (file-name-attributes-completion-annotation)
(file-name-completion-annotation): New function.
* lisp/minibuffer.el (completion-file-name-affixation): Use it.

* lisp/net/tramp-sudoedit.el (tramp-sudoedit-file-name-handler-alist)
* lisp/net/tramp-sh.el (tramp-sh-file-name-handler-alist): Register
handler function for 'file-name-completion-annotation'.
(tramp-sh-handle-file-name-completion-annotation)
* lisp/net/tramp.el (tramp-file-name-for-operation): Handle it.

* doc/lispref/files.texi (File Attributes)
(Magic File Names): Document 'file-name-completion-annotation'.

* etc/NEWS: Announce it.
2024-01-21 07:57:20 +01:00
Eshel Yaron
4f1e41bc06
; Elaborate minibuffer file name reading documentation
* doc/emacs/mini.texi (Minibuffer File): Slightly elaborate.
(Completion Commands): Fix markup.
2024-01-21 07:57:20 +01:00
Eshel Yaron
36a3131e6f
Support sorting file name completions list by last modified time
(minibuffer--sort-file-names-by-last-modified-time): New function.
(read-file-name-default): Add it to
'minibuffer-completions-sort-orders' buffer-locally.
* doc/emacs/mini.texi (Completion Commands): Elaborate about
'minibuffer-sort-completions'.
2024-01-21 07:57:20 +01:00
Eshel Yaron
cea254f148
Add completion annotations for file name completion
* lisp/minibuffer.el (completion-file-name-affixation): New function.
(completion-file-name-table): Use it as 'affixation-function'.
* doc/emacs/help.texi (Name Help): Move doc of 'completions-detailed'
from here to...
* doc/emacs/mini.texi (Completion Options): ...here.  Improve wording.
* etc/NEWS: Announce.
2024-01-21 07:57:19 +01:00
Eshel Yaron
a8434d8b28
; * etc/NEWS: (re-)announce 'completions-auto-update-mode'. 2024-01-21 07:57:19 +01:00
Eshel Yaron
41239dbc23
; Enable recursive minibuffers for reading completion restrictions
* lisp/minibuffer.el (minibuffer-widen-completions): Let-bind
'enable-recursive-minibuffers' to t.
2024-01-21 07:57:19 +01:00
Eshel Yaron
68d33f872e
Show completions category in heading line
Extend 'completions-header-format' with a placeholder for the
completions category.  Stop hard-coding the 'shadow' face for the
heading line default value, instead define a derived face.

* lisp/minibuffer.el (completions-header-format): Extend.
(completions-heading): New face.
(completion-category): New variable.
(minibuffer-completion-help): Let-bind it.
(display-completion-list): Use it.

* doc/emacs/mini.texi (Completion Options): Elaborate.

* etc/NEWS: Announce.
2024-01-21 07:57:19 +01:00
Eshel Yaron
370936bef9
New helper function for creating completion tables with metadata
* lisp/minibuffer.el (completion-styles-table): Remove in favor of...
(completion-table-with-metadata): New function.
(minibuffer-set-completion-styles)
(minibuffer-narrow-buffer-completions)
(minibuffer-complete-history, minibuffer-complete-defaults)
* lisp/bookmark.el (bookmark-completing-read)
* lisp/international/emoji.el (emoji--read-emoji)
* lisp/international/mule-cmds.el (read-char-by-name)
* lisp/progmodes/project.el (project--file-completion-table)
* lisp/progmodes/xref.el (xref-show-definitions-completing-read)
* lisp/recentf.el (recentf-open)
* lisp/simple.el (read-from-kill-ring)
* lisp/tmm.el (tmm--completion-table): Use it.

* etc/NEWS: Announce it.
2024-01-21 07:57:18 +01:00
Eshel Yaron
8ecd4371b9
; Avoid attempting to restore stale previous completion input
* lisp/minibuffer.el (minibuffer--cache-completion-input): Accept the
minibuffer base contents, not just its length.
(minibuffer-restore-completion-input): Ensure cached minibuffer base
is up to date before restoring.
(completion--do-completion, completion-all-sorted-completions)
(minibuffer-completion-help): Adapt.
2024-01-21 07:57:18 +01:00
Eshel Yaron
d9cc4be14e
; (minibuffer-set-completion-styles): Enable recursive minibuffers. 2024-01-21 07:57:18 +01:00
Eshel Yaron
374614fea4
; Stop saying that 'C-o' invokes 'open-line' in the minibuffer
* doc/emacs/mini.texi (Minibuffer Edit): Update.
2024-01-21 07:57:18 +01:00
Eshel Yaron
35f0d1820d
New commands for cycling completions and restoring completed input
This adds two new minibuffer commands, 'minibuffer-cycle-completion'
and 'minibuffer-restore-completion-input', bound to 'C-o' and 'C-l',
respectively.

* lisp/minibuffer.el (completion--input): New local variable.
(minibuffer--cache-completion-input)
(completion-switch-cycling-direction): New functions.
(completion-all-sorted-completions): Respect
'minibuffer-completions-sort-function', and...
(minibuffer-completion-help)
(completion--do-completion): Cache completion input.
(completions-auto-update): Preserve 'completion--input'.
(minibuffer-force-complete): Highlight inserted candidate in
completions list if *Completions* is already visible.
(minibuffer-cycle-completion)
(minibuffer-restore-completion-input): New commands.
(minibuffer-local-completion-map): Bind them.

* doc/emacs/mini.texi (Completion Commands, Completion Options)
* doc/lispref/minibuf.texi (Completion Commands): Document them.

* etc/NEWS: Announce.

* test/lisp/minibuffer-tests.el (restore-completion-input-test):
New test.
2024-01-21 07:57:17 +01:00
Eshel Yaron
c80749e4be
; Adapt some recent changes around completion categories
* doc/lispref/minibuf.texi (Completion Variables):
* lisp/minibuffer.el (completion-extra-properties)
(completion-category-defaults): Mention 'narrow-completions-function'.
(completion-category-overrides): Do that, and improve Custom type.
2024-01-21 07:57:17 +01:00
Eshel Yaron
26bca940e1
; Fix typos in recent documentation additions
* doc/emacs/mini.texi (Narrow Completions)
* doc/lispref/minibuf.texi (Minibuffer Completion): Fix typos.
2024-01-21 07:57:17 +01:00
Eshel Yaron
c0e6d2b390
; Add menu entry for 'minibuffer-set-completion-styles'
* lisp/menu-bar.el: Bind 'minibuffer-set-completion-styles'.
2024-01-21 07:57:17 +01:00
Eshel Yaron
ca72ed2f7a
New command 'minibuffer-set-completion-styles'
Add an interactive command for setting completion styles in the
current minibuffer.

* lisp/minibuffer.el (completion-style)
(completion--matching-style, completion-local-styles): New vars.
(completion--styles): Use 'completion-local-styles' when it's non-nil.
(completion--nth-completion): Set 'completion--matching-style' to the
matching completion style.
(completion-styles-affixation, completion-styles-table): New funs.
(minibuffer-set-completion-styles): New command.
(minibuffer-local-completion-map): Bind it.
(minibuffer-completion-help): Set 'completion-style' in the
"*Completions*" buffer.
* lisp/simple.el (completion-setup-function): Keep 'completion-style'.
(completion-list-mode): Display 'completion-style' in mode line.

* doc/emacs/mini.texi (Completion Commands, Completion Styles):
Document new command.

* doc/lispref/minibuf.texi (Completion Commands)
(Completion Variables): Document new command and variable.

* etc/NEWS: Announce new command.
2024-01-21 07:57:16 +01:00
Eshel Yaron
4c3b73713e
; Fix 'crm-change-separator'
* lisp/emacs-lisp/crm.el (crm-current-separator): New variable.
(crm-complete-and-exit, crm-change-separator)
(completions-multi-mode): Use it instead of 'crm-separator'.
(completing-read-multiple): Let-bind 'crm-current-separator' to the
current value of 'crm-separator'.
2024-01-21 07:57:16 +01:00
Eshel Yaron
f9c59caa37
Improve handling of file name completion predicate
* lisp/minibuffer.el (completion-file-name-table): Avoid hard-coding
'file-exists-p', call predicate without directory name and set
'default-directory' to that directory instead.
(read-file-name): Update documentation.
* lisp/pcomplete.el (pcomplete--entries): Handle zero-length arg.
* doc/lispref/minibuf.texi (Reading File Names): Elaborate.
2024-01-21 07:57:16 +01:00
Eshel Yaron
0d82d262b6
; Fix completions restriction descriptions with boundaries
* lisp/minibuffer.el (minibuffer-narrow-completions-to-current):
Respect completion boundaries when formatting restriction description.
2024-01-21 07:57:16 +01:00
Eshel Yaron
b0e66d1d9c
; Bind 'minibuffer-complete-and-exit' in "Minibuf" menu
* lisp/menu-bar.el (minibuffer-local-completion-map): Bind
'minibuffer-complete-and-exit' in "Minibuf" menu bar menu, shadowing
the binding of 'exit-minibuffer' in that menu.
2024-01-21 07:57:15 +01:00
Eshel Yaron
c3f58a143a
Improve 'completing-read-multiple'
This simplifies the implementation of crm.el, making it a thin wrapper
around 'completing-read'.  This obviates the need for bespoke commands
such as 'crm-complete' and 'crm-completion-help', and allows us to
remove incorrect code in minibuffer.el that tried to accommodate for
both 'completing-read' and 'completing-read-multiple'.
'crm-complete-and-exit' is still required to get the right behavior.
While we're at it, also add a command for changing 'crm-separator'
interactively, and an indication of 'completing-read-multiple' in
the *Completions* buffer mode line.

* lisp/emacs-lisp/crm.el (crm-local-completion-map)
(crm-local-must-match-map): No longer used, replace with obsolete
aliases of 'completing-read-multiple-mode-map' in favor of third party
code that uses these variables.
(crm-completion-table, crm--current-element)
(crm--completion-command, crm-completion-help)
(crm-complete, crm-complete-word)
(crm--choose-completion-string): No longer used, remove.
(crm-complete-and-exit): Update.
(read-string-matching-regexp): New local variable.
(read-string-matching-try-exit)
(crm-change-separator): New commands.
(read-string-matching-mode-map)
(completing-read-multiple-mode-map): New keymap variables.
(read-string-matching-mode)
(completing-read-multiple-mode)
(completions-multi-mode): New minor modes.
(read-string-matching, crm-completion-setup): New functions.
(completing-read-multiple): Update.

* lisp/minibuffer.el (minibuffer-sort-completions)
(minibuffer-narrow-buffer-completions)
(minibuffer--add-completions-predicate)
(minibuffer-narrow-completions-to-current)
(minibuffer-widen-completions)
(completions-auto-update): Delegate completion boundaries calculation.

* doc/lispref/minibuf.texi (Minibuffer Completion): Document c-r-m.
* etc/NEWS: Announce 'crm-change-separator'.
2024-01-21 07:57:15 +01:00
Eshel Yaron
835eff5e21
Support interactively sorting minibuffer completions
* lisp/minibuffer.el (minibuffer-completions-sort-function): New var.
(minibuffer-read-sort-order-with-completion)
(minibuffer-completions-sort-orders): New user options.
(minibuffer-sort-completions): New command.
(minibuffer-local-completion-map): Bind it to 'C-x C-v'.
(display-completion-list, minibuffer-completion-help): Take
'minibuffer-completions-sort-function' into account.
(completions-header-format): Add '%t' format spec construct,
substituted with a description of the current sort order.
* lisp/menu-bar.el (minibuffer-local-completion-map): Add menu bar
menu entry for sorting completions candidates.
* doc/emacs/mini.texi (Completion Commands): Document new command.
Improve documentation and indexing of 'minibuffer-complete-and-exit'.
(Completion Exit, Completion Options): Update
* doc/lispref/minibuf.texi (Completion Commands): Document new user
options and command.
* etc/NEWS: Announce new feature.
2024-01-21 07:57:15 +01:00
Eshel Yaron
1054200149
; (completion-metadata): Mention 'narrow-completions-function'. 2024-01-21 07:57:15 +01:00
Eshel Yaron
9877858fa2
; Support removing individual completions restrictions
* lisp/minibuffer.el (minibuffer-widen-completions): New optional
argument ALL, if nil prompt for individual restrictions to remove.
Also, take into account completions boundaries when calling
'minibuffer-completion-help'.
* doc/emacs/mini.texi (Completion Commands, Narrow Completions):
Update documentation.
* lisp/menu-bar.el (map): Update help text.
2024-01-21 07:57:14 +01:00
Eshel Yaron
4f85e6f58a
; Respect 'completion-boundaries' in 'completions-auto-update'
* lisp/minibuffer.el (minibuffer-regexp-mode): Use new helper function
'minibuffer--completion-help' to compute completion boundaries.
2024-01-21 07:57:14 +01:00
Eshel Yaron
c896c757a9
; Respect 'completion-boundaries' in narrow-completions commands
* lisp/minibuffer.el (minibuffer--completion-boundaries): New helper
function, return 'completion-boundaries' for minibuffer input as
a pair of buffer positions in the minibuffer.
(minibuffer--add-completions-predicate)
(minibuffer-narrow-completions-by-regexp)
(minibuffer-narrow-completions-to-current): Use it.
2024-01-21 07:57:14 +01:00
Eshel Yaron
fd705bffff
Add Completions Auto Update minor mode
This adds a new global minor that updates the *Completions* buffer as
you type in the minibuffer.

* lisp/minibuffer.el (completions-auto-update-idle-time): New option.
(completions-auto-update-timer): New buffer-local variable.
(completions-auto-update)
(completions-auto-update-start-timer)
(completions-auto-update-setup)
(completions-auto-update-exit): New functions.
(completions-auto-update-mode): New global minor mode.
* doc/emacs/mini.texi (Completion Options): Document it.
* etc/NEWS: Announce it.
2024-01-21 07:57:14 +01:00
Eshel Yaron
aa1decd16b
; doc/emacs/mini.texi: Improve cross referencing. 2024-01-21 07:57:13 +01:00
Eshel Yaron
5725301b01
* doc/lispref/minibuf.texi (Completion Commands): Fix typos. 2024-01-21 07:57:13 +01:00
Eshel Yaron
af71861125
Support narrowing (restricting) minibuffer completions
Add new minibuffer commands for restricting the list of possible
completion candidates.

* lisp/minibuffer.el (completion-fail-discreetly): Fix docstring typo.
(minibuffer-narrow-completions-function): New variable.
(completion--fail, minibuffer-narrow-completions-p)
(minibuffer-narrow-completions-by-regexp)
(minibuffer--completion-predicate-description)
(minibuffer--add-completions-predicate): New functions.
(minibuffer-narrow-completions-to-current)
(minibuffer-narrow-completions)
(minibuffer-widen-completions): New commands.
(minibuffer-narrow-completions-map): New prefix keymap.  Bind new
commands to 'n', 'm' and 'w', respectively.
(minibuffer-local-completion-map): Bind new prefix keymap to 'C-x n'.
(completions-header-format, completion--do-completion)
(display-completion-list, minibuffer-completion-help): Update.

* lisp/simple.el (completions-narrow-mode): New minor mode.
(completion-setup-function): Enable it in *Completions* buffer when
there are completions restrictions in place.

* lisp/menu-bar.el (minibuffer-local-completion-map): Add completions
narrowing commands to "Minibuf" menu.

* lisp/help-fns.el (help--symbol-completion-table): Provide bespoke
'narrow-completions-function' that keeps only symbols with a given
symbol property.

* doc/emacs/emacs.texi (Top)
* doc/emacs/mini.texi (Completion): Update menu.
(Narrow Completions): New subsection.
(Completion Commands, Completion Styles)
(Completion Options)
* doc/emacs/help.texi (Name Help)
* doc/lispref/minibuf.texi (Completion Commands):
(Programmed Completion): Update documenation.

* etc/NEWS: Announce new feature.
2024-01-21 07:57:12 +01:00
Dmitry Gutov
0a07603ae8 project-recompile: New command
* lisp/progmodes/project.el (project-recompile):
New command (bug#68570).
2024-01-21 07:08:43 +02:00
Po Lu
cc8d4b0c91 ; * etc/NEWS: Improve mwheel entry. 2024-01-21 12:50:45 +08:00
Po Lu
957b4f826a Don't invert wheel event directions
* lisp/mwheel.el (mwheel--is-dir-p): In Emacs, up means down and
down means up...
2024-01-21 12:50:45 +08:00
Stefan Monnier
eca7368039 * lisp/mwheel.el (mouse-wheel-obey-old-style-wheel-buttons): Simplify 2024-01-20 23:12:36 -05:00
Stefan Monnier
ca8d451561 (define-derived-mode): Fix bug#68600
* lisp/emacs-lisp/derived.el (define-derived-mode): Use a reference
to the mode symbol instead of the mode's "pretty" name in
the hook variable's docstring.
2024-01-20 23:00:54 -05:00
Po Lu
d88f9717ae ; * msdos/sedleim.inp: Adapt to Emacs 30. 2024-01-21 10:33:30 +08:00
Po Lu
e654f9ce1e * make-dist (possibly_non_vc_files): Append exec standard files. 2024-01-21 10:04:02 +08:00
Po Lu
8da6c8c7c1 ; * exec/Makefile.in: Correct typo. 2024-01-21 09:59:47 +08:00
Po Lu
10ffe161da Suppress detection of utmpx.h on Android
* configure.ac (ac_cv_header_utmpx_h): Predefine to no when
Android is older than 34.
2024-01-21 09:59:47 +08:00
Po Lu
76efd4037e ; * exec/Makefile.in (extraclean): Remove standard files. 2024-01-21 09:59:47 +08:00
Paul Eggert
416fad04c2 Omit -DHAVE_CONFIG_H
* configure.ac (CFLAGS): Do not add -DHAVE_CONFIG_H.  It is no
longer needed now that the Android printf hack has been removed.
2024-01-20 17:28:53 -08:00
Paul Eggert
bdcd662a21 Speed up make_lisp_symbol when debugging
* src/lisp.h (make_lisp_symbol): In eassert use XBARE_SYMBOL
rather than XSYMBOL.  This is safe because the symbol must be
bare.  The change speeds up make_lisp_symbol when debugging.
2024-01-20 17:28:53 -08:00
Paul Eggert
cf26f57316 Simplify and tune XSYMBOL
* src/lisp.h (XSYMBOL): Simplify and tune.  There is no need to
examine symbols_with_pos_enabled here, since the arg must be a symbol
so if it's not a bare symbol then it must be a symbol_with_pos;
and checking whether a symbol is bare is cheap.

With Ubuntu 23.10 on a Xeon W-1350, this shrank Emacs’s executable
text size by 0.1% and sped up a default build of all *.elc files by
0.4%.

Remove unnecessary eassert, since XBARE_SYMBOL and XSYMBOL_WITH_POS
have easserts that suffice.
2024-01-20 17:28:53 -08:00
Paul Eggert
b6ed79b71c Be more systematic about parens in C source code
Be more systematic about putting space before paren in calls,
and in avoiding unnecessary parentheses in macros.
This was partly inspired by my wading through gcc -E output
while debugging something else, and seeing too many parens.

This patch does not change the generated .o files on my platform.
2024-01-20 17:28:53 -08:00
Paul Eggert
0a47a5a4be Omit some parens
* src/lisp.h (XBARE_SYMBOL, XSYMBOL): Omit parentheses that are no
longer needed now that we have symbols with positions and these
symbols are never macros.
2024-01-20 17:28:53 -08:00
Paul Eggert
973c1b8a18 Pacify gcc -Wsuggest-attribute=malloc
* src/lisp.h (hash_table_alloc_bytes):
Declare with ATTRIBUTE_MALLOC_SIZE ((1)).
2024-01-20 17:28:52 -08:00
Paul Eggert
afc9cd1721 Fix autogen.sh’s spurious ‘git diff’ output
Problem reported by Gerd Möllmann (Bug#68464).
* .gitignore: Ignore files in exec that are now copied from build-aux.
* admin/merge-gnulib (avoided_flags): Instead of clearing
autom4te.cache here ...
* autogen.sh (do_git): ... clear it here.
Use config.guess, config.sub and install-sh from
the Emacs repository, as they are more likely to be up to date.
This avoids unnecessary differences among different builders,
and avoids unnecessary ‘git diff’ output after autogen.sh.
Also, copy these files from build-aux to exec since there
should be no difference between the two copies.
* exec/config.guess, exec/config.sub, exec/install-sh:
Remove from repository, as autogen.sh now copies them from build-aux.
2024-01-20 16:35:24 -08:00