* lisp/indent.el (indent-for-tab-command): Use `syntax-class` to fix
longstanding thinko introduced back in 2020 in commit 64c851166442.
Rework the check for `syn` because TAB always completed when
`tab-first-completion` had value `word-or-paren` or `word-or-paren-or-punct`.
Eli Zaretskii [Sat, 25 Nov 2023 11:42:53 +0000 (06:42 -0500)]
Merge from origin/emacs-29
77ab00207d6 ; * admin/authors.el (authors-aliases): Add Noah Peart. 6f843f03dc2 typescript-ts-mode: Add missing 'operator' to treesit-fon... 0676a029310 Extend D-Bus doc and test df094dd4bc1 Do not unregister a D-Bus service which is a unique name e6ad97a3338 Fix byte-compilation warnings about 'sqlite-rollback'
Rahguzar [Tue, 24 Oct 2023 20:07:51 +0000 (22:07 +0200)]
Outline support for shr rendered documents
* lisp/net/shr.el
(shr-heading): Propertize heading with level.
(shr-outline-search): An 'outline-search-function' that finds
headings using text property search.
(shr-outline-level): Outline level for 'shr-outline-search'.
(Bug#66676)
Rahguzar [Tue, 24 Oct 2023 18:30:23 +0000 (20:30 +0200)]
Allow displaying images inline
* lisp/net/shr.el
(shr-max-inline-image-size): New custom variable.
(shr--inline-image-p): New helper function to decide if an
image should be inserted inline.
(shr-insert, shr-put-image, shr-tag-img): Use
'shr-max-inline-image-size' to insert some images inline.
(Bug#66676)
Rahguzar [Mon, 23 Oct 2023 19:23:53 +0000 (21:23 +0200)]
Make some aspects of shr rendering customizable
* lisp/net/shr.el (shr-fill-text, shr-sup-raise-factor)
(shr-sub-raise-factor, shr-image-ascent): New custom variables.
(shr-fill-lines): Only fill if 'shr-fill-text' is non-nil.
(shr-put-image): Use 'shr-image-ascent' as value of :ascent.
(shr-rescale-image, shr-make-placeholder-image): Use
'shr-image-ascent'.
(shr-tag-sup, shr-tag-sub): Use 'shr-sup/sub-raise-factor'.
(Bug#66676)
Ulrich Müller [Fri, 17 Nov 2023 11:16:54 +0000 (12:16 +0100)]
Don't enable pinentry loopback mode for gpgsm
* lisp/epg.el (epg--start): Passphrase entry through the
minibuffer is currently not supported with gpgsm, therefore don't
pass "--pinentry-mode loopback" as an argument when the protocol
is CMS. (Bug#67012)
* doc/misc/epa.texi (GnuPG Pinentry): Document it.
Eshel Yaron [Mon, 20 Nov 2023 11:45:11 +0000 (12:45 +0100)]
; Avoid 'completion-at-point' in 'completion-preview-insert'
Insert the completion suggestion directly in
'completion-preview-insert' instead of using 'completion-at-point' to
do that. This fixes an issue where 'completion-preview-insert' would
not work correctly when the user uses 'add-hook' with a DEPTH argument
below a certain value to add functions to
'completion-at-point-functions', and obviates the need to manipulate
'completion-at-point-functions' when showing the preview all together.
* lisp/completion-preview.el (completion-preview--make-overlay)
(completion-preview-prev-candidate)
(completion-preview-next-candidate)
(completion-preview-mode): Improve docstring.
(completion-preview--exit-function)
(completion-preview--insert)
(completion-preview-insert-on-completion): Remove, no longer used.
(completion-preview--get): Turn into a 'defsubst'.
(completion-preview-active-mode)
(completion-preview--capf-wrapper): Simplify.
(completion-preview--try-table)
(completion-preview--update): Keep the completion "base" as a property
of the preview overlay, for use in completion exit functions.
(completion-preview-insert): Insert completion and call exit function
directly instead of manipulating 'completion-at-point' to do so.
(Bug#67275)
Eshel Yaron [Sun, 19 Nov 2023 09:55:15 +0000 (10:55 +0100)]
; Improve and add tests for Completion Preview mode
Fix handling of capfs that return a function or signal an error,
respect the ':exclusive' completion property, fix lingering "exact"
face after deletion that makes the matches non-exact, and add tests.
* lisp/completion-preview.el (completion-preview--make-overlay): Only
reuse the previous 'after-string' if it has the right face.
(completion-preview--try-table)
(completion-preview--capf-wrapper): New functions.
(completion-preview--update): Use them.
* test/lisp/completion-preview-tests.el: New file. (Bug#67275)
Po Lu [Sat, 25 Nov 2023 02:40:13 +0000 (10:40 +0800)]
Dismiss Android Back key events that are canceled
* java/org/gnu/emacs/EmacsWindow.java (onKeyDown): Disregard
KEYCODE_BACK events.
(onKeyUp): If the event is KEYCODE_BACK, deliver the disregarded
key press event, unless FLAG_CANCELED is set.
Spencer Baugh [Tue, 21 Nov 2023 15:11:52 +0000 (10:11 -0500)]
Use the project--list as history when prompting for a project
The project--list is already ordered such that the most recently used
projects are at the front. Now we use it as the minibuffer history
when prompting for a project.
To avoid savehist from picking up project--list as a minibuffer
history variable and overriding our own persistence mechanism, we
don't pass project--list directly as a history variable, but instead
pass project--dir-history or project--name-history, dynamically-bound
to an appropriate value. project--dir-history and
project--name-history won't be persisted since they're always unbound
at the top level; but if they are persisted anyway somehow, it won't
affect us.
If we later find a way to rely on savehist for persistence instead of
having our own mechanism, we can change the in-memory format of
project--list to be just a list of directories, and our explicit calls
to project--add-dir can be replaced by let-binding
history-delete-duplicates=t, history-length=t.
* lisp/progmodes/project.el (project--remember-dir): Add.
(project-remember-project): Use project--remember-dir.
(project--name-history, project-prompt-project-name)
(project--dir-history, project-prompt-project-dir): Pass a
preprocessed project--list as HIST to completing-read. (bug#67310)
(project-switch-project): Call project--remember-dir.
F. Jason Park [Thu, 7 Oct 2021 12:26:36 +0000 (14:26 +0200)]
Optionally allow substitution patterns in erc-prompt
* etc/ERC-NEWS: Add entry for `erc-prompt-format'.
* lisp/erc/erc-compat.el (erc-compat--defer-format-spec-in-buffer):
New macro to wrap `format-spec' specification values in functions that
run in the current buffer and fall back to the empty string.
* lisp/erc/erc.el (erc-prompt): Add predefined Custom choice for
function type in `erc-prompt-format'.
(erc--prompt-format-face-example): New "pre-propertized" value for
option `erc-prompt-format'.
(erc-prompt-format): New companion option for `erc-prompt' choice
`erc-prompt-format'. New function of the same name to perform format
substitutions and serve as a Custom choice value for `erc-prompt'.
Based on work and ideas originally proposed by Stefan Kangas.
(erc--away-indicator, erc-away-status-indicator,
erc--format-away-indicator): New formatting function and helper
variables for displaying short away status.
(erc--user-modes-indicator): New variable.
(erc--format-user-modes): New function.
(erc--format-channel-status-prefix): New function.
(erc--format-modes): New function.
* test/lisp/erc/erc-scenarios-prompt-format.el: New file. (Bug#51082)
Co-authored-by: Stefan Kangas <stefankangas@gmail.com>
F. Jason Park [Mon, 20 Nov 2023 01:18:29 +0000 (17:18 -0800)]
Add merged-message indicator option for erc-fill-wrap
* lisp/erc/erc-fill.el (erc-fill): Use `when-let' instead of
`when-let*'.
(erc-fill-wrap-merge): Mention companion options in doc string.
(erc-fill-wrap-merge-indicator): New option to display a
distinguishing "indicator" in the form of a one-character string
between messages from the same speaker.
(erc-fill-wrap-mode, erc-fill-wrap-disable): Mention
`erc-fill-wrap-merge-indicator' in doc string and kill related local
variables.
(erc-fill--wrap-merge-indicator-pre,
erc-fill--wrap-merge-indicator-post): New internal variables for
caching merge indicator.
(erc-fill--wrap-insert-merged-post, erc-fill--wrap-insert-merged-pre):
New functions for adding merge indicators either before or after a
message.
(erc-fill-wrap): Add logic for deferring to merge-indicator helpers
when needed.
* test/lisp/erc/erc-fill-tests.el (erc-fill-wrap-tests--merge-action,
erc-fill-wrap--merge-action): Move body of latter test into former, a
new fixture function.
(erc-fill-wrap--merge-action/indicator-pre,
erc-fill-wrap--merge-action/indicator-post): New tests.
* test/lisp/erc/resources/fill/snapshots/merge-wrap-indicator-post-01.eld:
New test data file.
* test/lisp/erc/resources/fill/snapshots/merge-wrap-indicator-pre-01.eld:
New test data file. (Bug#60936)
F. Jason Park [Mon, 20 Nov 2023 01:18:29 +0000 (17:18 -0800)]
Optionally align prompt to prefix in erc-fill-wrap
* lisp/erc/erc-fill.el (erc-fill-wrap-align-prompt): New option for
aligning prompt with leading portion of messages at the common "static
center" pivot-column barrier, so it appears "dedented" along with all
speaker name tags. Tests for this functionality appear in the
subsequent patch of this same change set.
(erc-fill-wrap-use-pixels): Demote from user option to normal variable
because it has no practical use other than for testing. Don't rename
as internal variable to spare the improbable user of ERC on HEAD who's
already customized this.
(erc-fill-wrap-mode, erc-fill-wrap-enable, erc-fill-wrap-disable):
Take care to disable prompt-in-left-margin behavior when option
`erc-fill-wrap-align-prompt' is non-nil.
(erc-fill--wrap-measure): Improve doc string and always attempt to
leverage `buffer-text-pixel-size', even when the variable
`erc-fill-wrap-use-pixels' is nil.
(erc-fill--wrap-indent-prompt): New function to massage prompt
`line-prefix' after updates, such as changes to away status.
(Bug#51082)
F. Jason Park [Sun, 19 Nov 2023 07:44:20 +0000 (23:44 -0800)]
Use overlay instead of text prop to hide ERC's prompt
* lisp/erc/erc-backend.el (erc--hidden-prompt-overlay):
New variable, a buffer-local handle for the prompt overlay.
(erc--reveal-prompt): Delete overlay instead of text prop.
(erc--conceal-prompt): Add overlay instead of text prop.
(erc--unhide-prompt): Run `erc--refresh-prompt-hook' after revealing.
(erc--hide-prompt): Run `erc--refresh-prompt-hook' after hiding.
* lisp/erc/erc-stamp.el (erc-stamp--adjust-margin): Attempt a more
accurate estimate of the prompt's width in columns when initially
setting left-margin.
(erc-stamp--skip-left-margin-prompt-p): New variable to inhibit normal
behavior of displaying prompt in left margin.
(erc-stamp--display-margin-mode): Allow opting out of
prompt-in-left-margin behavior.
(erc--reveal-prompt): Delete unneeded method implementation.
(erc--conceal-prompt): Put overlay in margin.
* test/lisp/erc/erc-tests.el (erc-hide-prompt): Use
`get-char-property' instead of `get-text-property' in order to
accommodate overlay-based prompt hiding. (Bug#51082)
F. Jason Park [Sun, 19 Nov 2023 07:04:50 +0000 (23:04 -0800)]
Don't inherit properties when refreshing ERC's prompt
* lisp/erc/erc.el (erc--merge-prop-behind-p): New variable to be
dynamically bound around rare calls to `erc--merge-props' when the
latter should append to the end of existing list-valued text
properties.
(erc--inhibit-prompt-display-property-p): New variable to be non-nil
in buffers where an active module needs to reserve all uses of the
`display' text property in the prompt region for itself.
(erc--prompt-properties): Collect all common prompt properties in one
place for code reuse and maintenance purposes.
(erc--refresh-prompt-continue, erc--refresh-prompt-continue-request):
New function and state variable for custom `erc-prompt' functions to
indicate to ERC that they need the prompt to be refreshed in all
buffers and not just the current one.
(erc--refresh-prompt): Merge `erc-prompt-face' behind any applied by a
customized `erc-prompt' function value. Crucially, don't inherit
properties at the beginning of the prompt because doing so may clobber
any added by a custom `erc-prompt' function. Instead, apply known
properties from `erc-display-prompt' manually. Integrate
`erc--refresh-prompt-continue' logic.
(erc--merge-prop): Recognize flag to activate `append' behavior in
which new prop values are appended to the tail of existing ones rather
than consed in front. This functionality could be extended to
arbitrary splices as well.
(erc-display-prompt): Use common text properties defined elsewhere.
* test/lisp/erc/erc-tests.el (erc--merge-prop): Add assertion for
`erc--merge-prop-behind-p' non-nil behavior. (Bug#51082)
F. Jason Park [Thu, 23 Nov 2023 21:30:06 +0000 (13:30 -0800)]
Fix speedbar help-echo in erc-nickbar-mode
* lisp/erc/erc-speedbar.el (erc-speedbar-buttons): "Spoof"
`dframe-help-echo-function' in channel buffers to get around the fact
that we're not using the real speedbar frame.
(erc-speedbar--fmt-sentinel): New variable.
(erc-speedbar-expand-channel): Use cached channel-mode string for mode
item. Use button chars to mark mode and topic items and move verbose
labels into mouse-hover text. Also set face for mode and topic.
(erc-speedbar-item-info): Look for `speedbar-token' as a fallback even
when the primary pattern doesn't match. If the value's contents are
structured like a `format' function call, use them.
(erc-speedbar--emulate-sidebar): Add comment about speedbar setting
everything globally in older Emacsen. (Bug#63595)
F. Jason Park [Tue, 21 Nov 2023 03:45:30 +0000 (19:45 -0800)]
Cache UI string for channel modes in ERC
* etc/ERC-NEWS: Add entry for more expansive "%m" in header line.
* lisp/erc/erc-common.el (erc--channel-mode-types): New slot
`shortargs' for caching truncated mode args.
* lisp/erc/erc.el (erc--mode-line-chanmodes-arg-len): New internal
variable for adjusting the truncation length of channel-mode arguments
as they appear in the header line.
(erc--mode-line-mode-string): New variable for caching the relevant
"modestring", if any, in ERC buffers.
(erc--process-channel-modes): Don't associate args with group 4/D,
which are all nullary modes. This fixes a bug in which arguments were
associated with the wrong letters. Also, set cached mode string for
channel.
(erc--user-modes): Simplify slightly by removing likely useless
variant for overloaded arg AS-TYPE. This function is new in ERC 5.6.
(erc--channel-modes): New function. A higher-level getter for
current channel mode representation to complement `erc--user-modes'.
(erc--parse-user-modes): Set `erc--mode-line-mode-string in server
buffers.
(erc--handle-channel-mode): Change model to associate modes of type A
with a running plus/minus tally of state changes since joining the
channel.
(erc-update-mode-line-buffer): Use cached verbose representation of
channel or user modes instead of calling `erc-format-channel-modes'.
* test/lisp/erc/erc-tests.el (erc--update-channel-modes): Update to
reflect new running tally associations for type A modes.
(erc--channel-modes): New test.
(erc--user-modes): Update to reflect parameter simplification.
(Bug#67220)
Alan Mackenzie [Fri, 24 Nov 2023 12:22:08 +0000 (12:22 +0000)]
CC Mode: Fontify int unsigned Foo;
This fixes bug#59953. Foo now gets fontified when unsigned
comes after int.
* lisp/progmodes/cc-engine.el (c-forward-type): Refactor nested
`if' forms into a cond form. Loop around matches for
c-opt-type-component-key, advancing over them.
Alan Mackenzie [Fri, 24 Nov 2023 10:03:33 +0000 (10:03 +0000)]
CC Mode: Add second anchor point to class-open and class-close
This fixes the second (last) part of bug#66911. The new second
anchor points allow the indentation of braces in template
classes to be anchored on the keyword 'class' rather than the
`template' at the beginning of the statement.
* lisp/progmodes/cc-engine.el (c-add-class-syntax): Add &rest
args parameter for additional anchor points. Pass these to
c-add-syntax.
(c-guess-continued-construct): CASE B.1: Note return value from
c-looking-at-decl-block and pass this to c-add-syntax for a
class-open construct.
(c-guess-basic-syntax): CASE 4: Duplicate anchor position for
class-open.
(c-guess-basic-syntax): CASE 5A.2: Note return value of
c-looking-at-decl-block and pass it as extra argument to
c-add-syntax for a class-open construct.
(c-guess-basic-syntax): CASE 5G: Call c-looking-at-decl-block
to determine the second anchor point for a class-close, and
pass it to c-add-class-syntax.
* doc/misc/cc-mode.texi (Class Symbols): Document the anchor
points for class-open and class-close.
Po Lu [Fri, 24 Nov 2023 02:39:49 +0000 (10:39 +0800)]
Prevent touch screen translation from entering invalid state
* lisp/subr.el (touch-screen-events-received): New variable.
(read--potential-mouse-event): If a touch screen event's been
registered thus far, continue as though xterm-mouse-mode is
enabled.
* lisp/touch-screen.el (touch-screen-handle-touch): Set that
variable. If t-s-c-t already exists but the new touch point was
assigned the same number by the system, replace the current tool
with it rather than installing it as the anciliary tool.
Po Lu [Fri, 24 Nov 2023 00:44:34 +0000 (08:44 +0800)]
Merge from savannah/emacs-29
1978b603bc3 Make python-ts-mode's syntax-highlighting more standardized 99658346d1e ; Improve documentation of desktop.el in user manual f7dc0202127 Fix "Text is read-only" on backspacing initial Calc input 662d54775d5 Add a doc string to simple.el (bug#67355) 5a5e36d2aad ; Improve function documentation tips 86016d8ecdb Mention "visual line" in user manual 4bb65ed77a8 ; * doc/lispref/minibuf.texi (Programmed Completion): Imp... dfb3dcb404c Allow listing Emoji from a read-only buffer
Po Lu [Fri, 24 Nov 2023 00:38:06 +0000 (08:38 +0800)]
; Merge from savannah/emacs-29
The following commits were skipped:
8256bf4cdfb Fix CRLF handling in Tramp (don't merge) 81b63ec032f Annotate java-ts-mode-test-movement with expected result 054202d48c3 Backport: Add more java indentation tests d2776d8254f Backport: Add test for java indentation (bug#61115)
Dmitry Gutov [Thu, 23 Nov 2023 22:00:32 +0000 (00:00 +0200)]
Make python-ts-mode's syntax-highlighting more standardized
This was brought up in a Reddit discussion.
* lisp/progmodes/python.el (python--treesit-fontify-variable):
Use font-lock-variable-use-face (since it applies to references).
(python-ts-mode): Move 'property' from 3rd to 4th
treesit-font-lock-level.
Juri Linkov [Thu, 23 Nov 2023 18:12:40 +0000 (20:12 +0200)]
Support dired-movement-style in dired-next-dirline and dired-prev-dirline
* lisp/dired.el (dired-movement-style): Mention dired-next-dirline
and dired-prev-dirline in the docstring (bug#67303).
(dired-next-line): Refactor most code to dired--move-to-next-line.
(dired--move-to-next-line): New function with code from dired-next-line.
(dired--trivial-next-dirline): Rename from dired-next-dirline.
(dired-next-dirline): New function body that uses dired-movement-style,
dired--move-to-next-line and dired--trivial-next-dirline.
(dired-prev-dirline): Mention dired-movement-style in the docstring.
Stefan Monnier [Thu, 16 Nov 2023 22:21:18 +0000 (17:21 -0500)]
(derived-mode-p): Take MODES as a single argument
Looking at uses of `derived-mode-p` and `provide-mode-derived-p`,
I can't find a single use case where it wouldn't be preferable for
it to take a single argument instead of `&rest`: all the calls are
either passing a single argument anyway, or passing a fixed list of modes.
The use of `&rest` just makes the code less efficient and sometimes
more clunky (because of the need for `apply`).
So let's change that (while preserving backward compatibility, of course).
Alan Mackenzie [Thu, 23 Nov 2023 16:31:52 +0000 (16:31 +0000)]
CC Mode: Handle noise clauses, template arglists in any order
This fixes the first part of bug#66911.
* lisp/progmodes/cc-engine.el (c-looking-at-decl-block): Skip
back over template arglists and noise clauses in any order, no
longer assuming the noise clauses are before the template
arglist in the buffer. When scanning forward, take noise
clauses into account. Refactor a collection of nested `if'
forms as a cond form.
George Kuzler [Thu, 23 Nov 2023 00:45:55 +0000 (19:45 -0500)]
Fix "Text is read-only" on backspacing initial Calc input
Immediately after `calc-mode' opens the minibuffer for input
(because you typed a digit, "e", etc), pressing backspace
should clear the minibuffer and return you to the *Calculator*
buffer. Instead, it leaves the minibuffer as-is and prints the
message "Text is read-only"; this is because the function used,
`erase-buffer', tries to erase the read-only minibuffer prompt.
Using `delete-minibuffer-contents' fixes this, since it doesn't
attempt to delete the prompt.
* lisp/calc/calc.el (calcDigit-backspace): Use
`delete-minibuffer-contents' instead of `erase-buffer'. (Bug#67395)
Eli Zaretskii [Thu, 23 Nov 2023 14:07:31 +0000 (16:07 +0200)]
Allow listing Emoji from a read-only buffer
* lisp/international/emoji.el (emoji-list): Don't barf here if the
original buffer is read-inly...
(emoji-list-select): ...barf here instead. (Bug#67400)
(emoji-list): Doc fix.
Michael Albinus [Wed, 22 Nov 2023 12:48:57 +0000 (13:48 +0100)]
Fix CRLF handling in Tramp
* lisp/net/tramp-sh.el (tramp-send-command-and-read): Use 'space'
instead of 'blank' in rx expression, in order to handle also CR
and alike. Reported by Dominique Quatravaux
<dominique@quatravaux.org>.
Michael Albinus [Wed, 22 Nov 2023 12:29:19 +0000 (13:29 +0100)]
Fix CRLF handling in Tramp (don't merge)
* lisp/net/tramp-sh.el (tramp-send-command-and-read): Use 'space'
instead of 'blank' in rx expression, in order to handle also CR
and alike. Reported by Dominique Quatravaux
<dominique@quatravaux.org>.
Po Lu [Wed, 22 Nov 2023 03:10:13 +0000 (11:10 +0800)]
Update touch-screen.el
* lisp/touch-screen.el (touch-screen-handle-aux-point-update):
Wrap exceptionally wide form.
(touch-screen-handle-touch): Guarantee that only tools from the
same frame as the current tool will be considered ancillary
tools. Further guarantee that normal gesture translation can
resume even if a touchscreen-end event is omitted or overlooked.
Backport: Add some basic tests for java-ts-mode and typescript-ts-mode
* test/lisp/progmodes/java-ts-mode-resources/indent.erts: New file
with tests for indentation.
* test/lisp/progmodes/java-ts-mode-resources/movement.erts: New file
with tests for movement.
* test/lisp/progmodes/java-ts-mode-tests.el: New tests.
* test/lisp/progmodes/typescript-ts-mode-resources/indent.erts: New
file with tests for indentation.
* test/lisp/progmodes/typescript-ts-mode-tests.el: New tests.
Po Lu [Tue, 21 Nov 2023 06:18:04 +0000 (14:18 +0800)]
Save more information into Android font names
* src/sfntfont.c (sfntfont_open): Besides just the font file
name, also store the interpreter state, UPEM, charset and
instance number in FONT_FULLNAME_INDEX.
Juri Linkov [Mon, 20 Nov 2023 17:57:57 +0000 (19:57 +0200)]
Improve invisibility handling in isearch-lazy-highlight (bug#40808)
* lisp/isearch.el (isearch-lazy-highlight-invisible): New variable.
(isearch-lazy-highlight-new-loop, isearch-lazy-highlight-search)
(isearch-lazy-highlight-match, isearch-lazy-highlight-buffer-update): Use it.
* lisp/replace.el (replace-highlight): Let-bind isearch-invisible
to search-invisible.
* test/lisp/isearch-tests.el (isearch--test-invisible): New test.
Jim Porter [Sat, 11 Nov 2023 21:26:44 +0000 (13:26 -0800)]
Forward completion text properties in 'completion-table-with-quoting'
This fixes an issue with 'pcomplete-here-using-help', which passes
annotation strings along as text properties. Previously, those got
clobbered when the completions got requoted (bug#67112).
* lisp/minibuffer.el (completion--twq-all): Apply text properties from
the first character of the unquoted completion to the quoted
completion.
Kévin Le Gouguec [Sun, 12 Nov 2023 09:55:24 +0000 (10:55 +0100)]
Recognize shebang lines that pass '-S/--split-string' to 'env'
* etc/NEWS: announce the change.
* lisp/files.el (auto-mode-interpreter-regexp): Add optional '-S'
switch to the ignored group capturing the env invocation.
Allow multiple spaces between #!, interpreter and first argument:
empirically, Linux's 'execve' accepts that. (Bug#66902)
* test/lisp/files-tests.el (files-tests--check-shebang): New helper to
generate a temporary file with a given interpreter line, and assert
that the mode picked by 'set-auto-mode' is derived from an expected
mode. Write the 'should' form so that failure reports include useful
context; for example:
Po Lu [Sun, 19 Nov 2023 03:00:25 +0000 (11:00 +0800)]
Reorganize documentation relating to touch screens
Chiefly, elevate it from an appendix to a node in the User Input
chapter. I have been approached time and again with questions
from people who have not searched the appendices for such
documentation.
* doc/emacs/emacs.texi: Move Other Input below Commands in the
menu.
* doc/emacs/input.texi (Other Input Devices): Rename to Other
Input. All callers changed.
(Touchscreens, On-Screen Keyboards): Revise and reword
documentation. Homogenize nomenclature for on screen keyboards,
preferring "virtual keyboards" after it has been mentioned once
by the other name.
Stefan Monnier [Sat, 18 Nov 2023 21:34:38 +0000 (16:34 -0500)]
(update_search_regs): Install better fix for bug#67124
The recent fix for the bug in `replace-match-maybe-edit`
was basically a refinement of a previously installed workaround,
whereas the bug was really in `update_search_regs`.
* src/search.c (update_search_regs): Improve handling of `start` positions.
* lisp/replace.el (replace-match-maybe-edit): Remove workaround.
* test/src/search-tests.el (search-test--replace-match-update-data): New test.
F. Jason Park [Wed, 15 Nov 2023 05:10:39 +0000 (21:10 -0800)]
Favor ISUPPORT params for MODE processing in ERC
* etc/ERC-NEWS: Mention shift toward CHANMODES ISUPPORT parameter for
dictating MODE parsing behavior.
* lisp/erc/erc-backend.el (erc--init-channel-modes, erc--update-modes,
erc-set-modes, erc-update-modes): Forward declarations, the last two
being removals.
(erc-server-MODE, erc-server-221): Use `erc--update-modes' instead of
`erc-update-modes'.
(erc-server-324): Use `erc--init-channel-modes' instead of
`erc-set-modes'.
* lisp/erc/erc-common.el (erc--channel-mode-types): New struct for
stashing processed \"CHANMODES\" data for the current server.
* lisp/erc/erc.el (erc-channel-modes): Fix doc string.
(erc-set-initial-user-mode): Display a local notice when requesting
redundant user MODE operations.
(erc-set-modes, erc-parse-modes, erc-update-modes): Deprecate for
reasons explained in associated ERC-NEWS entry.
(erc--update-membership-prefix): New function, a helper for specifying
arguments to the rather unruly `erc-update-current-channel-member'.
(erc--channel-modes): New variable to record channel-mode state in a
hash table.
(erc--channel-mode-types): New variable and getter to stash
and retrieve server-local instance of the struct of the same name.
(erc--process-channel-modes): New function to parse channel-mode
changes, dispatch handlers for unary modes, and update the local
variables `erc-channel-modes' and `erc--channel-modes'.
(erc--user-modes): New local variable for remembering user modes per
server. New function of the same name, a "getter" for the variable.
(erc--parse-user-modes): New function to parse user modes only.
(erc--update-user-modes): New function to update and sort
`erc--user-modes'.
(erc--update-channel-modes): New function to replace much of
`erc-update-modes', currently a thin wrapper around
`erc--process-channel-modes' to ensure it updates status prefixes.
(erc--update-modes): New function to call appropriate mode-updating
function for the current buffer.
(erc--init-channel-modes): New function to update channel mode letters
without status prefixes.
(erc--handle-channel-mode): New generic function, a placeholder for an
eventual API to handle specific "unary" mode letters, meaning those
that specify a single parameter for setting or unsetting.
(erc-update-channel-limit): Update doc string and answer question
posed by ancient comment.
(erc-message-english-user-mode-redundant-add,
erc-message-english-user-mode-redundant-drop): New English catalog
messages.
* test/lisp/erc/erc-scenarios-base-chan-modes.el: New file.
* test/lisp/erc/erc-tests.el (erc-parse-modes,
erc--update-channel-modes, erc--update-user-modes, erc--user-modes,
erc--parse-user-modes): New tests.
* test/lisp/erc/resources/base/modes/chan-changed.eld: New test data
file. (Bug#67220)
F. Jason Park [Tue, 14 Nov 2023 02:24:59 +0000 (18:24 -0800)]
Use caching variant of erc-parse-prefix internally
* lisp/erc/erc-common.el (erc--parsed-prefix): New struct to help with
tasks that depends on the advertised "PREFIX" parameter.
* lisp/erc/erc.el (erc-parse-prefix): Rework slightly for readability.
(erc--parsed-prefix): New variable and function of the same name for
caching the reversed result of `erc-parse-prefix' locally per server.
(erc-channel-receive-names): Use value stored in `erc--parsed-prefix'.
* test/lisp/erc/erc-tests.el (erc-with-server-buffer): Only activate
spy around actual test case forms.
(erc--parse-prefix): New test. (Bug#67220)
F. Jason Park [Tue, 14 Nov 2023 02:24:59 +0000 (18:24 -0800)]
Simplify ISUPPORT-derived data wrangling in ERC
* lisp/erc/erc-backend.el (erc--get-isupport-entry): Check server
buffer for `erc-server-parameters' when (re)initializing value. This
function was previously unreliable from a target buffer on cache
misses.
(erc--with-isupport-data): New macro for accessing and caching data
derived from an ISUPPORT parameter. Late-arriving params break the
cache.
(erc-server-005): Rewrite pattern as `rx' form, factoring out bol/eol.
* lisp/erc/erc-common.el (erc--isupport-data): New struct to be
subclassed for storing cached ISUPPORT-derived data.
* test/lisp/erc/erc-scenarios-display-message.el: Remove stray
`require'. (Bug#67220)
F. Jason Park [Fri, 17 Nov 2023 21:26:00 +0000 (13:26 -0800)]
Add test for erc-cmd-SQUERY
* lisp/erc/erc-backend.el (erc-message): Revise doc string.
* test/lisp/erc/erc-scenarios-base-misc-regressions.el (erc-cmd-MOTD):
Move test to another file specifically for slash commands.
* test/lisp/erc/erc-scenarios-misc-commands.el: New file.
* test/lisp/erc/resources/base/commands/motd.eld: Move file elsewhere.
* test/lisp/erc/resources/commands/motd.eld: "New" file, moved here
reusing the same Git blob from now deleted subdir base/commands.
* test/lisp/erc/resources/commands/squery.eld: New file. (Bug#67209)