Correctly handle common prefixes in substring completion
Substring completion would previously not complete the longest common
substring if that substring was a prefix of all the completion
alternatives. Now it does. An explanation of this bug
Substring completion is implemented by passing the `prefix' symbol as
part of the pattern passed to completion-pcm--merge-completions. This
symbol is supposed to cause completion-pcm--merge-completions to
"grow" a completion of a common substring only from the "right" of the
symbol (a common suffix), not from the "left" of the symbol (a common
prefix). Yes, this is the opposite of what the name `prefix' would
imply.
When processing a symbolic element of the pattern,
completion-pcm--merge-completions first finds the common prefix of all
the completions in that part of the pattern (using try-completion).
Then for `prefix' and other elements which want to complete a common
suffix, the common prefix is removed from each element and then the
common suffix is calculated with completion--common-suffix.
If the common prefix covers the entirety of all the alternatives
(i.e. when "unique" is true in the code), it's also a common suffix.
In that case, the common suffix calculation (if it runs) is basically
a no-op which will produce an empty string, since we removed the
common prefix before running it.
Before this change, `prefix' elements would unconditionally discard
the common prefix, which produced the wrong result in the case that
common prefix == common suffix. For example:
* lisp/minibuffer.el (completion-pcm--merge-completions): Don't ignore
a common suffix in a `prefix' pattern element when it's also a common
prefix.
* test/lisp/minibuffer-tests.el (completion-substring-test-5): Add a
test.
Daniel Martín [Mon, 12 Dec 2022 10:33:01 +0000 (11:33 +0100)]
Improve completion of treesit-check-indent command
* lisp/treesit.el (treesit--read-major-mode): Helper function to
provide completion for most major modes.
(treesit-check-indent): Use the new interactive spec and improve the
docstring. (Bug#60001)
João Távora [Tue, 5 Sep 2023 16:20:25 +0000 (17:20 +0100)]
Flymake: speed up mode-line display with simple cache
When scrolling heavily (perhaps holding down C-n), the function
'flymake-mode-line-counter' showed very prominently in the memory and
CPU profiles.
Using a cache here was trivial, if not particularly pretty. The
function all but disappears from the profiles afterwards.
* lisp/progmodes/flymake.el (flymake--mode-line-counter-cache):
New variable.
(flymake--publish-diagnostics): Flush cache aggressively.
(flymake-mode-line-error-counter): Adjust.
(flymake--mode-line-counter-1): New helper from earlier
flymake--mode-line-counter.
(flymake--mode-line-counter): Use cache.
Po Lu [Tue, 5 Sep 2023 06:38:33 +0000 (14:38 +0800)]
Minor adjustments to Android port stubs
* src/androidfns.c (Fx_display_backing_store): Return
`when-mapped' in place of `always', since the former better
reflects Android port behavior.
(syms_of_androidfns) <always>: Delete defsym.
<when-mapped>: New defsym.
* src/term.c (Fsuspend_tty, Fresume_tty): Properly signal errors
on Android rather than quietly disregarding calls.
Jim Porter [Tue, 5 Sep 2023 04:37:56 +0000 (21:37 -0700)]
Inherit 'sieve-mode' faces from 'font-lock'
These Sieve faces were already a close mapping onto the Font Lock
ones, so this should usually look the same to users with the default
theme. However, this makes it easier to theme these faces (just
define the usual 'font-lock-*-face' colors you want) and also fixes a
few edge cases (bug#62370).
* lisp/net/sieve-mode.el (sieve-control-commands)
(sieve-action-commands, sieve-test-commands, sieve-tagged-arguments):
Inherit from 'font-lock' faces.
Stefan Monnier [Mon, 4 Sep 2023 21:13:45 +0000 (17:13 -0400)]
* lisp/emacs-lisp/cl-macs.el (cl-flet): Remove `&name` for (SYM EXP) case
The new/current Edebug spec gives the name `SYM@cl-flet@NN` to the
expression building that function rather than to the body of that
function as would be expected, leading to misleading code coverage.
Stefan Kangas [Mon, 4 Sep 2023 19:28:33 +0000 (21:28 +0200)]
Revert use of seq-count in shr-count
* lisp/net/shr.el (shr-count): Prefer handwritten code to using
'seq-count', as it's more performant.
Problem reported by Mattias Engdegård <mattiase@acm.org>.
Stefan Kangas [Mon, 4 Sep 2023 16:24:31 +0000 (18:24 +0200)]
Use seq-count in three functions
* lisp/net/shr.el (shr-count):
* lisp/progmodes/idlwave.el (idlwave-count-memq): Use seq-count.
(idlwave-count-eq): Use seq-count. Make obsolete, as it is unused.
Stefan Kangas [Sun, 3 Sep 2023 16:45:16 +0000 (18:45 +0200)]
Add `skip-when` macro to `ert-deftest`
This can help avoid some awkward test skip conditions.
For example, this triple negation:
(skip-unless (not noninteractive))
Can be written as the simpler:
(skip-when noninteractive)
* lisp/emacs-lisp/ert.el (ert-deftest): Add new 'skip-when' macro.
(ert--skip-when): New internal function.
* doc/misc/ert.texi (Tests and Their Environment): Document above
new macro.
* test/lisp/emacs-lisp/ert-tests.el (ert-test-skip-when): New test.
Alan Mackenzie [Mon, 4 Sep 2023 12:51:24 +0000 (12:51 +0000)]
Correct the handling of symbols with position in equal
* src/fns.c (internal_equal): Only regard symbols with position
as their symbols when symbols-with-pos-enabled is non-nil.
* doc/lispref/symbols.texi (Symbols with Position): Expand the
description of symbols with position, in particular the way
they work with eq and equal.
* doc/lispref/objects.texi (Equality Predicates): Describe how
eq and equal handle symbols with position.
* test/src/fns-tests.el (fns-tests-equal-symbols-with-position):
New tests for symbols with position.
Jonas Bernoulli [Sun, 3 Sep 2023 15:50:16 +0000 (17:50 +0200)]
Make emoji commands compatible with repeat and repeat-complex-command
* lisp/international/emoji.el (emoji-search): Read user input
inside 'interactive'.
* (emoji-insert-glyph): Determine glyph inside 'interactive',
using 'emoji--recent' when not invoked from one of its transient
prefixes but using 'recent' or 'recent-complex-command'.
Fix Edebug specification for 'cl-define-compiler-macro'.
* lisp/emacs-lisp/cl-macs.el (cl-define-compiler-macro): Give the
instrumented name a suffix to make it unique. Otherwise it will clash
with the name of the main function.
* lisp/filesets.el (filesets-browse-dir-function)
(filesets-open-file-function filesets-save-buffer-function)
(filesets-commands filesets-external-viewers): Don't override default
value for the function widget with an invalid default value.
Remove redundant ":" in tag.
Fix default values for choice and list widgets.
Stefan Kangas [Sun, 3 Sep 2023 09:04:35 +0000 (11:04 +0200)]
Replace completion--some with seq-some
This is safe, as 'seq' is preloaded before 'minibuffer'.
* lisp/loadup.el ("minibuffer"): Document 'seq' dependency.
* lisp/minibuffer.el (completion--some): Remove. Replace all uses
with 'seq-some'.
Joseph Turner [Fri, 1 Sep 2023 23:22:45 +0000 (16:22 -0700)]
Log org export errors to package-vc doc buffer
* lisp/emacs-lisp/package-vc.el (package-vc--build-documentation):
Wrap the org-export logic in condition-case, allowing package
installation to continue while preserving error messages. (Bug#65649)
Po Lu [Sun, 3 Sep 2023 01:12:32 +0000 (09:12 +0800)]
; Reintroduce menus beneath chapters in the Transient manual
* doc/misc/transient.texi (Introduction)
(Modifying Existing Transients, Predicate Slots): Return the
menus to their proper location, so Texinfo 4.13 can infer up
pointers for nodes within. The previous merge from emacs-29
overwrote this change.
project.el: Fix bug in project-ignores method for VC-aware backend
The variable `backend' was always nil preventing the 25-line long
`when' block from doing anything. This bug was introduced in commit 785fa801596ad7bb9f838cac865f00de29e253d1 "New user option:
project-vc-extra-root-markers". (Bug#65704)
* lisp/progmodes/project.el (project-ignores): Make sure the variable
is initialized, so that backend-specific code is used if any.
Jim Porter [Sat, 2 Sep 2023 23:17:27 +0000 (16:17 -0700)]
Apply Eshell tilde expansion before glob expansion
By treating 'eshell-current-modifiers' as a hook, we can simplify much
of the code working with it and ensure that we call modifiers in a
more-correct order.
* lisp/eshell/em-dirs.el (eshell-expand-user-reference-1)
(eshell-expand-user-reference): Simplify. We now only get a single
argument.
(eshell-parse-user-reference):
* lisp/eshell/em-glob.el (eshell-add-glob-modifier):
* lisp/eshell/em-pred.el (eshell-parse-arg-modifier): Use 'add-hook'.
Davide Masserut [Tue, 29 Aug 2023 20:33:48 +0000 (22:33 +0200)]
Display the exit code if the last command failed in Eshell
* lisp/eshell/esh-io.el (eshell-last-command-status): Make
buffer-local.
* lisp/eshell/em-prompt.el (eshell-prompt-function): Insert the exit
code if last command failed.
* test/lisp/eshell/em-prompt-tests.el (em-prompt-test/after-failure):
New test.
(em-prompt-test/next-previous-prompt-1)
(em-prompt-test/forward-backward-matching-input-1): Add a failing
command to tests.
Jim Porter [Sat, 2 Sep 2023 21:44:33 +0000 (14:44 -0700)]
Be more precise about navigating forward/backward through Eshell prompts
* lisp/eshell/em-prompt.el (eshell-next-prompt): Make N optional.
When navigating, first move to the end of the prompt. This makes the
subsequent navigation more predictable.
(eshell-previous-prompt): Mane N optional.
* test/lisp/eshell/em-prompt-tests.el
(em-prompt-test--with-multiline): Move to "Code" section.
(em-prompt-test/next-previous-prompt-with): Rename to...
(em-prompt-test/next-previous-prompt-1): ... this, and add additional
test cases. Update callers.
(em-prompt-test/forward-backward-matching-input-with): Rename to...
(em-prompt-test/forward-backward-matching-input-1): ... this, and
improve existing test cases.
Stephen Berman [Sat, 2 Sep 2023 21:22:01 +0000 (23:22 +0200)]
Fix and extend applying substitution in widget-choose
* lisp/wid-edit.el (widget-choose): Iterate only over proper lists
when applying substitution (bug#64046, Message #53). With simple
item definitions, apply substitution only to the item text, not to
its value (bug#64046, Message #86). Apply substitution also to
the widget title (bug#64046, Message #92).
* lisp/progmodes/gdb-mi.el (gdb-active-process): Remove.
It went out of use in 2010 (691cf4a0a2), and was initialised to what
was clearly meant as a doc string.
Alan Mackenzie [Sat, 2 Sep 2023 13:50:03 +0000 (13:50 +0000)]
Output better error messages on certain edebug spec errors
This fixes bug#65620. The error thrown up to now was "Void
function edebug-after". This has been replaced by "Invalid
call to `edebug-before'. Is the edebug spec for `foo'
correct?".
* lisp/emacs-lisp/edebug.el (edebug-b/a-error): New function
which throws the new friendlier error message.
(edebug-before, edebug-after): Replace the defalias's to nil
with actual functions which just call edebug-b/a-error.
* doc/lispref/edebug.texi (Specification List): In the entry
for `sexp', warn against mistakenly using `form' for an
Eli Zaretskii [Sat, 2 Sep 2023 08:28:17 +0000 (04:28 -0400)]
Merge from origin/emacs-29
648a5e33e80 Update to Org 9.6.8-3-g21171d 458442fe78c Escape percent character in treesit--inspect-name (bug#65... bc0426ce8ed Don't add an extraneous slash in remote PATH list in Eshell 34f7a47c9ce Fix Tramp on MS Windows ea5fd6c96bc * Fix native disassemble on Windows platforms (bug#65455) 91d2d8439bb * Handle missing eln file when trying to disassble (bug#6... e7ac50a1539 * lisp/emacs-lisp/comp.el (comp--native-compile): Fix OUT... 45cf3a0cede Update to Transient v0.4.3 31d3808fb9d Adapt Eshell manual 0c50af054f9 Fix applying patches with Git on MS-Windows
Jens Schmidt [Wed, 16 Aug 2023 21:31:30 +0000 (23:31 +0200)]
Add documentation to plstore.el
* lisp/plstore.el: Add link to epa manual. Describe more
restrictions. Fix a typo in the examples. Fix terminology. Mark
FIXMEs as such.
* lisp/plstore.el (plstore-save): Describe edge case when no recipient
matches and mark as FIXME. (Bug#63627)
* lisp/treesit.el (treesit-sexp-type-regexp)
(treesit-sentence-type-regexp): Mark obsolete.
(treesit-block-type-regexp): Remove.
* lisp/treesit.el (treesit-forward-sexp)
(treesit-transpose-sexps)
(treesit-beginning-of-defun)
(treesit-end-of-defun)
(treesit-forward-sentence)
(treesit-defun-at-point): Make use of treesit-thing-settings.
(treesit-thing-definition)
(treesit-thing-defined-p): New functions.
(treesit-major-mode-setup): Replace
treesit-sexp/sentence-type-regexp with treesit-thing-settings.
Po Lu [Sat, 2 Sep 2023 01:28:50 +0000 (09:28 +0800)]
Update Android port
* lisp/touch-screen.el (touch-screen-handle-point-up) <held>:
Treat `held' as `drag' as well.
* src/android.c (android_is_special_directory): Return bool
rather than a pointer to the remainder of the file name, given
that said pointer is never used.
Stefan Kangas [Sat, 2 Sep 2023 00:42:07 +0000 (02:42 +0200)]
Delete references to gnuserv
* doc/misc/mh-e.texi (Incorporating Mail):
* doc/misc/octave-mode.texi (Concept Index):
* lisp/net/browse-url.el (browse-url-w3-gnudoit): Delete
references to gnuserv; these days we use emacsclient.