João Távora [Mon, 24 May 2021 15:31:39 +0000 (16:31 +0100)]
Overhaul annotation-function to match affixation-function
* doc/lispref/minibuf.texi (Programmed Completion): Rework
annotation-function and affixation-function.
* lisp/help-fns.el (help--symbol-completion-table-annotation): Rename
from help--symbol-completion-table-affixation.
(help--symbol-completion-table): Use
help--symbol-completion-table-annotation.
* lisp/minibuffer.el (minibuffer-completion-help): Interpret
annotation-function with more sophistication.
* lisp/simple.el (read-extended-command): Use
read-extended-command--annotation
(read-extended-command--annotation): Rename from
read-extended-command--affixation
Philipp Stephani [Mon, 17 May 2021 19:59:57 +0000 (21:59 +0200)]
Fix find invocation for macOS (Bug#48471).
* lisp/progmodes/project.el (project--files-in-directory): Instead of
appending a slash (which doesn't work well with macOS find), remove
trailing slash and pass -H instead.
Tassilo Horn [Sat, 22 May 2021 17:06:57 +0000 (19:06 +0200)]
Document bug-reference setup for 3rd-party packages
* doc/emacs/maintaining.texi (Bug Reference): Add section explaining
adding support for third-party packages.
* lisp/progmodes/bug-reference.el (bug-reference-maybe-setup-from-vc)
(bug-reference-maybe-setup-from-mail)
(bug-reference-maybe-setup-from-irc): Rename from
bug-reference--maybe-setup-from-*, i.e., un-privatize them because
they are advertised in the docs now.
Philipp Stephani [Sat, 22 May 2021 11:29:50 +0000 (13:29 +0200)]
Give 'when-let' and 'when-let*' their own Edebug specification.
The Edebug specification of 'if-let' and 'if-let*' doesn't work if the
body is empty. While that's a pathological case, it's not wrong per
se, and could arguably happen due to macro expansion.
* lisp/emacs-lisp/subr-x.el (when-let*, when-let): Don't reuse Edebug
specification from 'if-let*' and 'if-let'.
Juri Linkov [Thu, 20 May 2021 17:51:32 +0000 (20:51 +0300)]
* 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
Daniel Mendler [Tue, 11 May 2021 07:08:05 +0000 (09:08 +0200)]
(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`.
Daniel Mendler [Sun, 2 May 2021 13:50:08 +0000 (15:50 +0200)]
(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`.
Daniel Mendler [Fri, 30 Apr 2021 06:40:59 +0000 (08:40 +0200)]
(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.
Daniel Mendler [Sun, 25 Apr 2021 11:07:29 +0000 (13:07 +0200)]
(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.
Eli Zaretskii [Thu, 20 May 2021 09:01:40 +0000 (12:01 +0300)]
Fix arg-out-of-range errors in 'line-number-at-pos'
* src/fns.c (Fline_number_at_pos): Pass character position to
args_out_of_range. Suggested by Andreas Schwab
<schwab@linux-m68k.org>. Call args_out_of_range_3 to show both
ends of the accessible portion.
Eli Zaretskii [Thu, 20 May 2021 08:44:54 +0000 (11:44 +0300)]
Make sure gmalloc's hybrid_free preserves errno
* src/gmalloc.c (hybrid_free_1): New function, with the body of
the previous 'hybrid_free'.
(hybrid_free): Call 'hybrid_free_1' while preserving the value of
'errno'. Suggested by Paul Eggert <eggert@cs.ucla.edu>.
Eli Zaretskii [Thu, 20 May 2021 08:26:00 +0000 (11:26 +0300)]
Clean up the fix for unexec build on GNU/Linux
* src/conf_post.h [HYBRID_MALLOC || DARWIN_OS && HAVE_UNEXEC]:
Include <stdlib.h> here, before redirecting 'malloc' and friends
to their hybrid_* and unexec_* equivalents. #undef malloc and
friends before redefining. Provide prototypes for the
replacements. Suggested by Paul Eggert <eggert@cs.ucla.edu>.
* src/gmalloc.c [HYBRID_MALLOC]: Remove declarations of 'malloc'
and friends, as they are now redundant: we include <stdlib.h> in
conf_post.h before redefining 'malloc' etc., and that provides
prototypes from system headers.
* configure.ac (HYBRID_MALLOC): Remove kludge to avoid replacement
of 'free' by Gnulib. (Bug#36649)
Tassilo Horn [Wed, 19 May 2021 19:21:03 +0000 (21:21 +0200)]
Add a section about bug-reference-mode.
* doc/emacs/maintaining.texi (Maintaining): Add a section about
bug-reference-mode.
* doc/emacs/emacs.texi (Top): Link to the new section about
bug-reference-mode.
Eli Zaretskii [Wed, 19 May 2021 16:01:07 +0000 (19:01 +0300)]
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)
Eli Zaretskii [Wed, 19 May 2021 14:42:50 +0000 (17:42 +0300)]
Fix the unexec build on GNU/Linux
The unexec build on GNU/Linux must use HYBRID_MALLOC (gmalloc.c) and
sheap.c. This was inadvertently disabled because a configure-time
test for 'sbrk' was moved as side effect of an unrelated change.
* configure.ac: Test for 'sbrk' before using the result in the
decision about SYSTEM_MALLOC and HYBRID_MALLOC.
(HYBRID_MALLOC): Prevent Gnulib from redirecting 'free' to its
replacement 'rpl_free'.
* lib/Makefile.in (not_emacs_OBJECTS): Add mallooc/%.o and free.o.
Mauro Aranda [Wed, 19 May 2021 12:57:46 +0000 (09:57 -0300)]
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.
Stefan Monnier [Tue, 18 May 2021 21:53:23 +0000 (17:53 -0400)]
* 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.
Juri Linkov [Tue, 18 May 2021 21:02:42 +0000 (00:02 +0300)]
* 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.
Philipp Stephani [Tue, 18 May 2021 16:43:11 +0000 (18:43 +0200)]
Recreate symptom of Bug#42701.
The fix to Bug#48489 (commit 9676d41b8301b84e07717e633059a3f2b5c4c9d8)
has masked the symptom of Bug#42701 for 'if-let'. Create a helper
macro that still exemplifies the bug.
* test/lisp/emacs-lisp/edebug-tests.el
(edebug-tests--duplicate-symbol-backtrack): New helper macro.
(edebug-tests-duplicate-symbol-backtrack): Use it instead of 'if-let'.
* 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).
Miha Rihtaršič [Tue, 18 May 2021 15:08:58 +0000 (17:08 +0200)]
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).
Stefan Monnier [Tue, 18 May 2021 14:37:57 +0000 (10:37 -0400)]
* 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.
Sun Lin [Mon, 17 May 2021 16:03:55 +0000 (18:03 +0200)]
Allow specifying the default archive types to compress to in Dired
* lisp/dired-aux.el (dired-compress-file-default-suffix):
(dired-compress-directory-default-suffix): New user options
(bug#47119).
(dired-compress-file-alist): New variable.
* lisp/dired-aux.el (dired-compress-file): Use them.
(dired-compress-file-suffixes): Remove the directory item.
* lib-src/etags.c (Rust_functions): New function to make tags for rust
files.
(Rust_help, Rust_suffixes): New constant.
* doc/emacs/maintaining.texi (Tag Syntax): Add Rust item.
* doc/man/etags.1: Add Rust (bug#46055).
Eli Zaretskii [Mon, 17 May 2021 12:17:57 +0000 (15:17 +0300)]
Improve documentation of new behavior of 'M-y'
* lisp/minibuffer.el (minibuffer-local-map): Switch the order of
'\r' and '\n' bindings.
* lisp/simple.el (yank-pop, read-from-kill-ring)
(yank-from-kill-ring): Doc fixes.
* doc/emacs/search.texi (Isearch Yank):
* doc/emacs/killing.texi (Yanking): Improve the description of the
new functionality of 'M-y'.
* doc/lispref/text.texi (Yank Commands): Remove inaccurate
description of 'M-y' in Isearch.
Philipp Stephani [Mon, 17 May 2021 08:43:54 +0000 (10:43 +0200)]
Add a unit test to reproduce Bug#48471.
* test/lisp/progmodes/project-tests.el (project-tests--trivial)
(project-root, project-ignores): New test project type.
(project-ignores): New unit test.