Stefan Monnier [Fri, 8 Sep 2023 23:18:28 +0000 (19:18 -0400)]
(tempo-user-elements): Make it a proper hook
* lisp/tempo.el (tempo-user-element-functions): Rename from
`tempo-user-elements`.
(tempo-user-elements): Preserve as obsolete alias.
(tempo-is-user-element): Use `run-hook-with-args-until-success`.
Stefan Kangas [Fri, 8 Sep 2023 14:47:33 +0000 (16:47 +0200)]
Mark two flyspell functions as internal
* lisp/textmodes/flyspell.el: Minor doc fix.
(flyspell--mode-on, flyspell--mode-off): Rename from
'flyspell-mode-on' and 'flyspell-mode-off'. The old names are
preserved as obsolete aliases.
Po Lu [Fri, 8 Sep 2023 08:12:12 +0000 (16:12 +0800)]
Properly detect content files in Doc View
* lisp/doc-view.el (doc-view-mode): Detect if file name starts
with /content or /assets, and don't regard it as available to
subprocesses in that case.
Po Lu [Fri, 8 Sep 2023 02:37:18 +0000 (10:37 +0800)]
Permit XLFD names to exceed 255 characters
* doc/lispref/display.texi (Low-Level Font)
<font-xlfd-name>: Document new argument `long-xlfds'.
* etc/NEWS: Mention removal of XLFD length restrictions.
* src/font.c (font_build_object): Dynamically allocate XLFD,
permitting them to surpass 255 characters in length.
(font_parse_xlfd_1): Cease rejecting XLFDs more than 255
characters in length.
(font_dynamic_unparse_xlfd): New function. Like
font_unparse_xlfd, but allocate the XLFD dynamically.
(font_delete_unmatched): Dynamically allocate XLFD if necessary.
(Ffont_xlfd_name): New arg LONG_XLFDs. If t, return a
dynamically allocated XLFD. All callers changed.
* src/font.h: Update prototypes.
* src/fontset.c (Fnew_fontset): Dynamically allocate XLFD when
establishing fontset name.
Yuan Fu [Thu, 7 Sep 2023 23:04:29 +0000 (16:04 -0700)]
Change treesit-local-parsers-in to treesit-local-parsers-on
To improve consistency. We already have treesit-node-at and
treesit-node-on.
* doc/lispref/parsing.texi (Multiple Languages): Update manual.
* lisp/treesit.el (treesit-local-parsers-on): Change to in.
(treesit-font-lock-fontify-region): Change to in.
Stefan Kangas [Wed, 6 Sep 2023 09:21:39 +0000 (11:21 +0200)]
Error when trying to make nil or t obsolete
* lisp/emacs-lisp/byte-run.el (make-obsolete, make-obsolete-variable):
Signal error if the symbol to make obsolete is nil or t. (Bug#62248)
(byte-run--constant-obsolete-warning): New function.
* test/lisp/emacs-lisp/byte-run-tests.el: New file.
* lisp/minibuffer.el (minibuffer--regexp-propertize):
The original regexp had 83 backslashes in 147 characters which may be
some kind of record. This transformation cuts it down to 6, and the
generated regexp string is about 14 % shorter.
* admin/unidata/emoji-zwj.awk: More efficient code generation
Hoist the `eval-when-compile` to encompass the entire list, since
backquote forms aren't automatically evaluated at compile time.
This results in a single constant list in the generated code, and
much less actual code.
john muhl [Mon, 4 Sep 2023 16:36:42 +0000 (11:36 -0500)]
Fix java-ts-mode tests (bug#65738)
* admin/notes/tree-sitter/build-module/batch.sh (languages):
Add Java.
* lisp/progmodes/java-ts-mode.el (java-ts-mode): Pass a list
to 'treesit-thing-settings'.
martin rudalics [Wed, 6 Sep 2023 08:09:49 +0000 (10:09 +0200)]
New minor mode 'minibuffer-regexp-mode'
This mode is for editing regexps in minibuffer, it highlights
parens via `show-paren-mode' and `blink-matching-paren' in a
user-friendly way, avoids reporting false paren mismatches,
and makes sexp navigation more intuitive.
* lisp/minibuffer.el (minibuffer-regexp-mode)
(minibuffer--regexp-primed, minibuffer--regexp-prompt-regexp):
New variables.
(minibuffer--regexp-propertize, minibuffer--regexp-primed)
(minibuffer--regexp-before-change)
(minibuffer--regexp-after-change)
(minibuffer--regexp-post-self-insert, minibuffer--regexp-setup)
(minibuffer--regexp-exit, minibuffer-regexp-mode): New functions.
(minibuffer-regexp-prompts): New option.
* doc/lispref/minibuf.texi (Minibuffer Misc): Document the new
mode and its option.
Po Lu [Thu, 7 Sep 2023 01:35:59 +0000 (09:35 +0800)]
Port Proced to Android
* configure.ac (HAVE_PROCFS): Define if opsys is `android'.
* src/android.c (android_set_task_name): New function.
(android_run_select_thread, android_run_debug_thread): Set the
name of the LWP for debugging purposes.
* src/process.c (create_process): Set F_SETPIPE_SZ on Android in
addition to GNU/Linux.
* src/sysdep.c (procfs_ttyname, system_process_attributes)
[__ANDROID__]: Enable procfs_ttyname on Android systems.
(project-try-vc): When found non-VC project root, still search for the backend
* lisp/progmodes/project.el (project-try-vc): When finding a
non-VC project root, still try to search for the containing
responsible VC backend, if any (bug#65704).
* lisp/leim/quail/indian.el
(quail-tamil-itrans-compute-syllable-table): Add missing comparison.
Patch from Visuwesh; bug found by an experimental tool.
Yuan Fu [Wed, 6 Sep 2023 02:57:34 +0000 (19:57 -0700)]
Support tree-sitter local parsers
* doc/lispref/parsing.texi (Multiple Languages): Update manual.
* lisp/treesit.el (treesit-range-settings): Add LOCAL-P to range
setting.
(treesit-range-rules): Support :local keyword.
(treesit-local-parsers-at)
(treesit-local-parsers-in)
(treesit--update-ranges-local): New functions.
(treesit-update-ranges)
(treesit-font-lock-fontify-region)
(treesit--indent-1): Support local parsers and prioritize it over
global parsers.
Yuan Fu [Tue, 5 Sep 2023 06:45:21 +0000 (23:45 -0700)]
Allow filter by tag in treesit-parser-list
* doc/lispref/parsing.texi: Update manual.
* src/treesit.c (Ftreesit_parser_create): Disallow using t for tag.
(Ftreesit_parser_list): Add LANGUAGE and TAG parameter.
Yuan Fu [Tue, 5 Sep 2023 03:05:50 +0000 (20:05 -0700)]
Use tagged parser in c-ts-mode
Now that we have tags for parsers, use that instead of the
load-name-override hack.
* lisp/progmodes/c-ts-mode.el:
(c-ts-mode--emacs-c-range-query): Change parser to C.
(c-ts-mode--emacs-set-ranges): Use the tagged parser.
(c-ts-mode): Create the tagged parser.
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.