1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2026-01-12 22:40:46 -08:00
Commit graph

80333 commits

Author SHA1 Message Date
Juri Linkov
e0ebce5ce2 * lisp/help.el (describe-bindings-outline): New defcustom (bug#45147).
(describe-bindings): Use describe-bindings-outline.
(describe-bindings-internal): Remove function obsolete since 24.4.
2021-05-20 21:37:04 +03:00
Juri Linkov
9be9d1f94e * lisp/vc/diff-mode.el (diff-hunk-text): Handle better "\ No newline at end". 2021-05-20 21:23:01 +03:00
Juri Linkov
ef7a6eec20 Fix off-by-one inconsistency of 'M-y C-y' (bug#48478).
* lisp/simple.el (read-from-kill-ring): Increment kill-ring-yank-pointer by 1.
(yank-from-kill-ring): Don't increment kill-ring-yank-pointer by 1.
2021-05-20 21:02:27 +03:00
Juri Linkov
1866e66a73 * lisp/international/mule-cmds.el: Use group-function in read-char-by-name.
(mule--ucs-names-group): Simplify for using by group-function.
(read-char-by-name-group): Remove defcustom
obsoleted by completions-group.
(read-char-by-name): Mention completions-group and
completions-group-sort in docstring.  Use group-function when
completions-group is non-nil.
https://lists.gnu.org/archive/html/emacs-devel/2021-05/msg00791.html
2021-05-20 20:51:32 +03:00
Daniel Mendler
cb8b994217 (minibuffer-completion-help): Add group sorting
Sort the groups as returned by the `group-function` of the completion
table depending on the value of the customizable variable
`completions-group-sort`.  By default `completions-group-sort` is set
to nil.  The variable can be set to the symbol `alphabetical` in order
to configure alphabetical sorting.  Furthermore, a custom sorting
function can be used as value of `completions-group-sort`.

* lisp/minibuffer.el (completions-group-sort): New variable.
(minibuffer--group-by): Add SORT-FUN argument.
(minibuffer-completion-help): Pass `completions-group-sort` to
`minibuffer--group-by`.
2021-05-20 20:50:35 +03:00
Daniel Mendler
836d69bc60 (completion--insert-vertical): Separate groups completely
Insert the candidates vertically within the groups, but keep the
groups separate using the full width group separators.

* minibuffer.el (completion--insert-vertical): Adjust grouping.
2021-05-20 20:50:33 +03:00
Daniel Mendler
cacfd0321a (minibuffer-completion-help): Do not check completions-group centrally
The guard variable `completions-group` should be checked in each
completion table individually.  The guard variable
`completions-detailed` variable is used in the same way.

* minibuffer.el (minibuffer-completion-help): Remove check of
  `completions-group`.
2021-05-20 20:50:31 +03:00
Daniel Mendler
de168b70b1 (completion--insert-strings): Split function; Full group title support
Split `completion--insert-strings` into a function per completions
format in order to increase readability and extensibility.  This
change eases the addition of more formats.  Add support for group
titles to the vertical and horizontal formatting functions.

* minibuffer.el (completion--insert): Add new function.
(completion--insert-vertical, completion--insert-horizontal,
completion--insert-one-column): Extract function from
`completion--insert-strings`.  Use new function `completion--insert`.
(completion--insert-strings): Use new insertion functions.
2021-05-20 20:50:28 +03:00
Daniel Mendler
443d9efc95 (completing-read): Add group-function to the completion metadata
A completion table can specify a `group-function` in its metadata.
The group function takes two arguments, a completion candidate and a
transform argument.  The group function is used to group the
candidates after sorting and to enhance the completion UI with group
titles.

If the transform argument is nil, the function must return the title
of the group to which the completion candidate belongs.  The function
may also return nil if the candidate does not belong to a group.

If the transform argument is non-nil, the function must return the
transformed candidate.  For example, the transformation allows to
remove a redundant part of the candidate, which is then displayed in
the title.

The grouping functionality is guarded by the customizable variable
`completions-group` and turned off by default for the *Completions*
buffer.

The specific form of the `group-function` has been chosen in order to
allow allocation-free grouping.  This is important for completion UIs,
which continously update the displayed set of candidates (Icomplete,
Vertico, Ivy, etc.).  Only when the transform argument is non-nil the
candidate transformation is performed, which may involve a string
allocation as done in the function `xref--completing-read-group`.

The function `xref-show-definitions-completing-read` makes use of the
`group-function`, by moving the file name prefix to the title.  If
grouping is enabled, the *Completions* are displayed as
"linenum:summary" instead of "file:linenum:summary".  This way the
*Completions* buffer resembles the *Occur* buffer.

* doc/lispref/minibuf.texi: Add documentation.

* lisp/minibuffer.el (completion-metadata): Describe the
`group-function` in the docstring.
(completions-group): Add guard variable, off by default.
(completions-group-format): Add variable defining the format string
for the group titles.
(completions-group-title): Add face used by `completions-group-format`
for the group titles.
(completions-group-separator): Add face used by
`completions-group-format` for the group separator lines.
(minibuffer--group-by): New grouping function.
(minibuffer-completion-help): Use it.
(display-completion-list): Add optional GROUP-FUN argument.
(completion--insert-strings): Add optional GROUP-FUN argument.  Insert
group titles if `completions-format` is `one-column`.  Transform each
candidate with the GROUP-FUN.  Attach the untransformed candidate to
the property `completion--string`.

* lisp/simple.el (choose-completion): Retrieve the untransformed
completion candidate from the property `completion--string`.

* lisp/progmodes/xref.el:
(xref--completing-read-group): New grouping function.
(xref-show-definitions-completing-read): Use it.
2021-05-20 20:50:23 +03:00
Juri Linkov
1f0f922ef2 * lisp/simple.el (yank-from-kill-ring-rotate): New defcustom (bug#48478).
(read-from-kill-ring, yank-from-kill-ring): Use it.
2021-05-19 19:30:33 +03:00
Eli Zaretskii
171dbe7048 Fix rare failures in 'window-default-font-height'
* lisp/window.el (window-default-font-height): Avoid signaling an
error when a client TTY frame happens to have an X-style 'display'
parameter.  (Bug#48408)
2021-05-19 19:01:07 +03:00
Eli Zaretskii
eb9f48bfad * lisp/startup.el (command-line-1): Avoid byte-compiler warning. 2021-05-19 18:56:27 +03:00
Glenn Morris
e100ee84e3 Fix custom type of recent dired-aux additions
* lisp/dired-aux.el (dired-compress-file-default-suffix)
(dired-compress-directory-default-suffix): Fix :type.
2021-05-19 08:28:35 -07:00
Stefan Monnier
b4e1fdfe21 * lisp/kmacro.el (kmacro-lambda-form): Fix bug#48523
Re-add `counter` and `format` arguments, since they are used in
`insert-kbd-macro`.
2021-05-19 11:19:10 -04:00
Ingo Lohmar
dac694b8bb * lisp/progmodes/sql.el: `sql-postgres-statement-starters' defcustom
Recognize common table expression as statement start in Postgres.
2021-05-19 15:07:52 +02:00
Mauro Aranda
61291e06cc Lift restriction for finding theme summary line
* lisp/cus-theme.el (custom-theme-summary): Don't limit the file to
having the deftheme form as the very first form, rather look for the
deftheme form explicitly.
2021-05-19 09:57:46 -03:00
Martin Rudalics
567c31121f Fix recently introduced misbehavior of `quit-restore-window' (Bug#48493)
* lisp/window.el (quit-restore-window): Unconditionally call
`switch-to-prev-buffer' (Bug#48493).
2021-05-19 09:17:37 +02:00
Stefan Monnier
1276ba75eb * lisp/progmodes/js.el (js--make-framework-matcher): Use a closure 2021-05-18 20:30:08 -04:00
Stefan Monnier
942cbc4dea * lisp/progmodes/gud.el (gud-tooltip-tips): Use proper closures
Also prefer #' to quote function names.

(jdb): Fix $ => \'.
2021-05-18 20:21:51 -04:00
Stefan Monnier
09ed51b9c8 * lisp/org/org-timer.el (org-timer--run-countdown-timer): Use closures 2021-05-18 19:54:38 -04:00
Stefan Monnier
5746fd57ab * lisp/org/org-mouse.el: Make use of lexical scoping
(org-mouse-todo-menu): Simplify by eta-reduction.
(org-mouse-popup-global-menu): Remove redundant `eval`.
(org-mouse-keyword-menu, org-mouse-keyword-replace-menu)
(org-mouse-tag-menu, org-mouse-match-closure): Use proper closures.
2021-05-18 19:51:26 -04:00
Stefan Monnier
4e240bf096 * lisp/org/org-colview.el (org-columns-map): Use proper closures
Also prefer #' to quote function names.

(org-columns-map): Use derived-mode-p.
2021-05-18 19:36:54 -04:00
Stefan Monnier
af68b49565 * lisp/org/org-clock.el (org-clock-get-table-data): Use proper closures
Also, prefer #' to quote function names
2021-05-18 19:32:35 -04:00
Stefan Monnier
25bb250e29 * lisp/net/sieve-manage.el (sieve-sasl-auth): Use proper closures 2021-05-18 19:23:54 -04:00
Stefan Monnier
26041ec8d5 * lisp/net/shr.el (shr-image-displayer): Use proper closures 2021-05-18 19:15:04 -04:00
Stefan Monnier
5e7b57ad8f * lisp/net/imap.el (imap-mailbox-close): Use proper closures
Also, remove redundant `:group` args, and prefer #' to quote function names
2021-05-18 19:12:11 -04:00
Stefan Monnier
db8266b0b2 * lisp/net/eudc.el (eudc-menu): Use proper closures 2021-05-18 19:06:54 -04:00
Stefan Monnier
e61bb6f6fe * lisp/net/browse-url.el: Avoid `(lambda ..)
(browse-url-netscape, browse-url-mozilla, browse-url-galeon)
(browse-url-epiphany, browse-url-elinks): Use proper closures.
2021-05-18 19:05:29 -04:00
Stefan Monnier
abedac0909 * lisp/misearch.el (multi-isearch-push-state): Use proper closures 2021-05-18 19:03:06 -04:00
Stefan Monnier
41efaa54c5 * lisp/menu-bar.el: Avoid `(lambda
(menu-bar-buffer-vector, menu-bar-update-buffers): Use proper closures.
2021-05-18 19:01:49 -04:00
Stefan Monnier
de4dcd8d10 * lisp/info.el (Info-isearch-push-state): Use proper closures 2021-05-18 18:13:28 -04:00
Stefan Monnier
0ccd712ad2 * lisp/imenu.el (imenu--create-keymap): Use proper closures 2021-05-18 18:11:08 -04:00
Stefan Monnier
2520a163cb * lisp/find-dired.el (find-dired): Use a proper closure 2021-05-18 18:06:15 -04:00
Stefan Monnier
49c5299bbb * lisp/facemenu.el (facemenu-add-new-face): Use :documentation 2021-05-18 18:05:05 -04:00
Stefan Monnier
f57b0f08b4 * lisp/eshell/em-pred.el: Take advantage of lexical scoping
Also remove redundant `:group` arguments.

(eshell-parse-modifiers): Make sure we pass a function value.
(eshell-parse-arg-modifier, eshell-parse-modifiers)
(eshell-add-pred-func, eshell-pred-user-or-group)
(eshell-pred-file-time, eshell-pred-file-type, eshell-pred-file-mode)
(eshell-pred-file-links, eshell-pred-file-size)
(eshell-pred-substitute, eshell-include-members, eshell-join-members)
(eshell-split-members): Use proper closures.
2021-05-18 17:53:44 -04:00
Stefan Monnier
2c47eaa18a * lisp/emacs-lisp/eieio-core.el (eieio-defclass-internal): Use a closure 2021-05-18 17:13:52 -04:00
Juri Linkov
0fa959db20 * lisp/repeat.el (repeat-exit-timeout): New defcustom (bug#48472).
(repeat-exit-timer): New variable.
(repeat-post-hook): Run idle timer with an "exit function"
returned from set-transient-map.
Suggested by Gustavo Barros <gusbrs.2016@gmail.com>.

(repeat-echo-message): Remove own previous message when input arg is nil.

* lisp/window.el (display-buffer-override-next-command): Return exitfun.
2021-05-19 00:02:42 +03:00
Stefan Monnier
48744903de * lisp/calendar/cal-menu.el (cal-menu-holidays-menu): Use a proper closure 2021-05-18 16:59:08 -04:00
Juri Linkov
502e3ce614 * lisp/emacs-lisp/lisp-mode.el (lisp-outline-level): Fix imprecise numbers.
(lisp-outline-level): Return right levels starting from 1 instead of 5.
Suggested by Howard Melman <hmelman@gmail.com> in bug#46878.
2021-05-18 23:35:57 +03:00
Juri Linkov
83be3e9598 * lisp/simple.el (read-from-kill-ring): Add new arg PROMPT (bug#48478).
* lisp/simple.el (yank-pop, yank-from-kill-ring):
* lisp/isearch.el (isearch-yank-from-kill-ring):
Use arg PROMPT in the call read-from-kill-ring.
2021-05-18 23:23:50 +03:00
Lars Ingebrigtsen
68f5718c0a Fix some regressions introduced by the previous dired-aux change
* lisp/dired-aux.el (dired-compress-file): Check that the file
we're compressing exists.  Also work outside the current directory.
2021-05-18 17:49:10 +02:00
Basil L. Contovounesios
33c0994c7c Look for ElDoc buffer in all visible frames
* lisp/emacs-lisp/eldoc.el (eldoc--echo-area-prefer-doc-buffer-p):
Look for a window displaying the ElDoc documentation buffer in all
visible frames, as promised by the user option
eldoc-echo-area-prefer-doc-buffer (bug#48278).
2021-05-18 16:31:19 +01:00
Miha Rihtaršič
304a3b9ee8 Fix problem with focusing in `C-o' in ibuffer in some circumstances
* lisp/ibuffer.el (ibuffer-visit-buffer-other-window-noselect):
Use display-buffer instead of pop-to-buffer and selecting the old
window.  `pop-to-buffer' focuses the new frame, but
`select-window' usually fails to focus the original frame.  This
simple patch fixes that (bug#48218).
2021-05-18 17:08:58 +02:00
Gong Qijian
ab20f385a7 Fix `custom-delayed-init-variables' problem when re-dumping emacs
* lisp/startup.el (command-line): Don't bug out on redumping Emacs
(bug#48492).

Copyright-paperwork-exempt: yes
2021-05-18 16:38:05 +02:00
Stefan Monnier
6a7e503cca * lisp/kmacro.el: Fix test cases broken by last change
(kmacro-lambda-form): Remove unused args `counter` and `format`.
Arrange to be able to extract `mac` from the function.
(kmacro-extract-lambda): Use this new extraction instead of digging
into the guts of a function's code.
2021-05-18 10:37:57 -04:00
Alexandr Vityazev
2c90aa93a9 Fix the length= shortdoc example
* lisp/emacs-lisp/shortdoc.el (list): Fix the length= example
(bug#48495).

Copyright-paperwork-exempt: yes
2021-05-18 15:36:25 +02:00
Eli Zaretskii
cbd3a3b87d Revert "* lisp/bookmark.el: make bookmark-fontify nil default value"
This reverts commit ed8c3303f9.
2021-05-18 15:00:04 +03:00
Mattias Engdegård
be9db2b94d Fix pcase 'rx' patterns with a single named submatch (bug#48477)
pcase 'rx' patterns with a single named submatch, like

  (rx (let x "a"))

would always succeed because of an over-optimistic transformation.
Patterns with 0 or more than 1 named submatches were not affected.

Reported by Philipp Stephani.

* lisp/emacs-lisp/rx.el (rx--pcase-macroexpander):
Special case for a single named submatch.
* test/lisp/emacs-lisp/rx-tests.el (rx-pcase): Add tests.
2021-05-18 12:34:30 +02:00
Paul W. Rankin
ed8c3303f9 * lisp/bookmark.el: make bookmark-fontify nil default value 2021-05-18 18:24:25 +10:00
Philipp Stephani
9676d41b83 * lisp/emacs-lisp/subr-x.el (if-let): Swap &or branches (Bug#48489) 2021-05-18 09:26:49 +02:00