Andrew G Cohen [Tue, 27 Jun 2023 13:11:35 +0000 (21:11 +0800)]
Fix parsing of mail address headers (bug#64296)
RFC5322 specifies that an address header may be a list of both
individual mailboxes and mailbox groups. This patch introduces
support for parsing headers that include groups.
* lisp/mail/ietf-drums.el (ietf-drums-parse-addresses): Allow message
address headers to include both mailboxes and groups.
Eliza Velasquez [Sat, 1 Jul 2023 00:35:44 +0000 (17:35 -0700)]
Fix `async-shell-command-display-buffer' display
* lisp/simple.el (shell-command): If `async-shell-command-display-buffer'
was nil, it did not respect `display-buffer-alist' entries with
`display-buffer-no-window'. This behavior has been fixed (bug#64394).
* lisp/progmodes/cperl-mode.el (defconst): Add a word-start
assertion to cperl--single-attribute-rx
(cperl-after-sub-regexp): Dito
(cperl-init-faces): shorten matches of incomplete sub declarations
Alan Mackenzie [Tue, 4 Jul 2023 15:29:53 +0000 (15:29 +0000)]
objc-mode: Handle (de)propertization of < and >.
* lisp/progmodes/cc-langs.el
(c-get-state-before-change-functions)
(c-before-font-lock-functions): Separate the C and objc
versions, and add (to the first) c-unmark-<>-around-region and
c-before-change-check-<>-operators, (to the second)
c-unmark-<>-around-region and c-restore-<>-properties into the
objc versions of these lang variables.
Alan Mackenzie [Tue, 4 Jul 2023 12:43:31 +0000 (12:43 +0000)]
objc-mode: Fix exceptions in fontification.
These exceptions ("Invalid search bound (wrong side of point)")
were observed in test suite file class-24.m when moving point
up and down a line at a time.
* lisp/progmodes/cc-engine.el (c-forward-declarator): In the
c-syntactic-re-search-forward ~30 lines from the end of the
function amend the regexp for objc-mode such that "@end"
terminates the search, but "<" doesn't.
* lisp/progmodes/cc-fonts.el
(c-make-font-lock-search-function): supply a non-nil
CHECK-POINT argument to c-make-font-lock-search-form.
Harald Jörg [Mon, 3 Jul 2023 20:55:19 +0000 (22:55 +0200)]
cperl-mode.el: Add support for new Perl syntax in Perl 5.36 and 5.38
Perl 5.38 was released on 2023-07-03. This patch supports the new features
for 5.36 and 5.38 for font-lock, indentation, and imenu index creation.
* lisp/progmodes/cperl-mode.el (cperl-praise): Mention classes.
(defconst): Fix typo in docstring of cperl--single-attribute-rx.
Add "class" to cperl--package-rx, and adjust its docstring.
New rx sequence cperl--class-for-imenu-rx to capture classes,
use this in cperl--imenu-entries-rx.
Add "method" to cperl--sub-name-for-imenu-rx.
Add "class" to cperl--block-declaration-rx.
(cperl-sub-keywords): Add "method".
(cperl-mode): Add "ADJUST" to defun-prompt-regexp.
(cperl-after-block-p): Add new keywords for Perl 5.36 and 5.38.
(cperl-indent-exp): Add "field" to expression starters.
(cperl-imenu--create-perl-index): Rename variables refering to
"package", because they also contain classes.
(cperl-init-faces): Add new keywords for Perl 5.36 and 5.38.
(cperl-find-tags): Add support for "class".
(cperl-short-docs): Add new keywords for Perl 5.36 and 5.38.
(cperl-indent-exp): Add new keywords for Perl 5.36 and 5.38.
* test/lisp/progmodes/cperl-mode-tests.el
(cperl-test-fontify-class): New test for fontification of class
elements.
(cperl-test-imenu-index): Add tests for (nested) class
definitions.
* test/lisp/progmodes/cperl-mode-resources/cperl-indents.erts:
Add test cases for try/catch/finally, defer, class, method
* test/lisp/progmodes/cperl-mode-resources/perl-class.pl: New
resource for fontification tests of class elements.
* test/lisp/progmodes/cperl-mode-resources/grammar.pl: Add some
classes to the test resource.
* lisp/files.el (remote-file-name-access-timeout): New defcustom.
(remote-file-name-inhibit-auto-save-visited)
(remote-file-name-inhibit-locks, remote-file-name-inhibit-cache)
(remote-file-name-inhibit-delete-by-moving-to-trash):
* lisp/simple.el (remote-file-name-inhibit-auto-save): Add group `tramp'.
* lisp/net/tramp.el (with-tramp-timeout, with-tramp-suspended-timers):
New defmacros.
(tramp-dont-suspend-timers): New defvar.
(tramp-handle-access-file): Implement handling of
`remote-file-name-access-timeout'. (Bug#64401)
(tramp-action-show-and-confirm-message, tramp-process-actions)
(with-tramp-locked-connection, tramp-wait-for-regexp)
(tramp-read-passwd, tramp-read-passwd-without-cache): Use the macros.
F. Jason Park [Mon, 3 Jul 2023 03:57:46 +0000 (20:57 -0700)]
Revert "Account for leading timestamps in erc-match"
This reverts commit 99d74dcd45938e2686d93eb5649800e14a88cd84 but keeps
the test file test/lisp/erc/erc-scenarios-match.el. It also
implements a partial alternative solution by undoing the reordering of
insert hooks owned by the `stamp' and `match' modules. The initial
reordering stems from d880a08f "Cement ordering of essential hook
members in ERC" and was intended to address the problem of timestamps
not being hidden in matched "fool" messages. However, a more
comprehensive solution is being pursued as part of bug#64301. The
following changes differ from those in a pure revert.
* erc/ERC-NEWS: Fix erroneous claim about relative hook ordering
pre-5.6.
* lisp/erc/erc-match.el (erc-match-mode, erc-match-enable): Lower hook
depth of `erc-match-message' in `erc-insert-modify-hook' from 60 to
50.
(erc-text-matched-hook): Retain cleaned-up portion of revised doc
string instead of reverting completely.
* lisp/erc/erc-stamp.el (erc-stamp-mode, erc-stamp-enable): Raise
depth of `erc-add-timestamp' in `erc-insert-modify-hook' and
`erc-send-modify-hook' from 50 to 60.
* test/lisp/erc/erc-scenarios-match.el
(erc-scenarios-match--stamp-left-current-nick
erc-scenarios-match--stamp-left-fools-invisible): Temporarily disable
the latter and fix expected hook ordering.
* test/lisp/erc/erc-tests.el (erc--essential-hook-ordering): Fix
expected order of default insert hooks. (Bug#60936)
Stephen Berman [Mon, 3 Jul 2023 12:19:41 +0000 (14:19 +0200)]
Fix and improve setting priority of todo-mode items (bug#64433)
* lisp/calendar/todo-mode.el (todo-set-item-priority): Bugfixes:
Prevent interactively setting item priority to its current
priority in the same category and prompt user for a different
priority (but allow using the same priority when item is moved to
another category). Ensure that the priority passed as a prefix
argument is suitable: if it is not an integer between 1 and the
highest item number, signal a user error. New feature: Use the
sequence of numbers of the category's items as the minibuffer
history.
* doc/misc/todo-mode.texi (Inserting New Items):
(Reprioritizing Items): Document using the minibuffer history.
* test/lisp/calendar/todo-mode-tests.el
(todo-test-item-insertion-with-priority-1)
(todo-test-item-insertion-with-priority-2)
(todo-test-item-insertion-with-priority-3): New tests.
Po Lu [Mon, 3 Jul 2023 00:42:24 +0000 (08:42 +0800)]
Always provide `move-toolbar' when its position can be changed
* src/keyboard.c (syms_of_keyboard): Make `move-toolbar' a
defsym. Provide that feature if Emacs uses its internal tool
bars or GTK+.
* src/xfns.c (syms_of_xfns): Stop provide `move-toolbar' here.
João Távora [Sun, 2 Jul 2023 10:57:15 +0000 (11:57 +0100)]
Eglot: another tweak to eglot--sig-info
Going to the start of the first param and skipping non-word syntax
backward would seem to be the right thing to do, for traditional
C-style languages and also languages like Ocaml where function
signatures don't start the param list with '('.
See also https://github.com/joaotavora/eglot/discussions/1251.
Stephen Berman [Sun, 2 Jul 2023 09:49:08 +0000 (11:49 +0200)]
Fix todo-mode commands to move items and categories (bug#64298)
* lisp/calendar/todo-mode.el (todo-move-category): Restore display
of selected category in source file, so internal file structure is
not visible if user is prompted to choose a new category name in
target file, and widen again to delete moved category from source
file.
(todo-move-item): Don't use todo-forward-item when moving done
items, to avoid mislocation if done items sections of the the
target category was empty before moving.
(todo-forward-item): Remove commented out code meant to have the
effect of the above change in todo-move-item, but it did not work.
Eli Zaretskii [Sun, 2 Jul 2023 08:10:59 +0000 (11:10 +0300)]
Fix display of wide characters on TTY frame's mode line
* src/xdisp.c (pad_mode_line): New function.
(display_string): Use it instead of 'produce_special_glyphs' to
replace a character that's too wide to fit on the mode/header/tab
line, but which occupies some columns that do fit. (Bug#64395)
Harald Jörg [Sat, 1 Jul 2023 22:35:31 +0000 (00:35 +0200)]
; cperl-mode.el: Fix two indentation bugs (Bug#11733)
* lisp/progmodes/cperl-mode.el (cperl-sniff-for-indent): Detect
whether we have a label or a regex/string.
(cperl-calculate-indent): Check for things which look like labels
but aren't.
* test/lisp/progmodes/cperl-mode-tests.el (cperl-test-bug-11733):
Test the examples provided in the bug report.
* test/lisp/progmodes/cperl-mode-resources/cperl-bug-11733.pl:
Examples from the bug report.
Harald Jörg [Sat, 1 Jul 2023 19:37:29 +0000 (21:37 +0200)]
cperl-mode.el: Support Perl 5.38 syntax for subroutine signatures
* lisp/progmodes/cperl-mode.el (defconst): New rx sequence
describing a signature with initialization.
(cperl-init-faces): integrate the new rx sequence into the
font-lock-defaults init routine (Bug#64190) (Bug#64364).
* test/lisp/progmodes/cperl-mode-resources/cperl-bug-64364.pl: Add
test data for a signature with initialization (tests indentation).
* test/lisp/progmodes/cperl-mode-resources/proto-and-attrs.pl: Add
test data for a signature with initialization (tests fontification).
This adds a section for documenting all the optional modules.
* doc/misc/eshell.texi (Extension modules): Move explanation about
writing modules to...
(Writing a module): ... here.
(Module testing): Remove. Testing an Eshell module doesn't require
any special documentation.
(Key binding, Smart scrolling, Electric forward slash): Move under...
(Optional modules): ... here.
(Directory handling, Terminal emulation): Remove. These modules are
enabled by default, and so are documented above.
(Tramp extensions, Extra built-in commands): New sections.
F. Jason Park [Fri, 9 Jun 2023 06:49:23 +0000 (23:49 -0700)]
Redo erc-nickname-in-use-functions as a local module
* etc/ERC-NEWS: Mention new module `services-regain'.
* lisp/erc/erc-backend.el: Rename option.
* lisp/erc/erc-services.el (erc-services-regain-alist): Strategies for
regaining a lost nickname on reconnect. This option, in addition to
the rest of these changes, is a redo of
`erc-nickname-in-use-functions' from commit 8c0c9826 "Add hook to
regain nickname in ERC", which originally stemmed from bug#62044.
(erc-services-retry-nick-on-connect, erc-services-issue-regain,
erc-services-issue-ghost-and-retry-nick): New function variants for
`erc-services-regain-alist.
(erc-services-regain-mode, erc-services-regain-enable,
erc-services-regain-disable): New local module to activate
nick-regaining behavior.
(erc--nickname-in-use-make-request): New method, a services-specific
implementation.
* lisp/erc/erc.el (erc--nickname-in-use-make-request): New generic
function to request alternate nick when first choice is rejected.
(erc-nickname-in-use): Call `erc--nickname-in-use-make-request' to
request alternate nick.
* test/lisp/erc/erc-scenarios-services-misc.el
(erc-scenarios-services-misc--reconnect-retry-nick): Adopt renamed
version of `erc-scenarios-base-renick-auto-regain'.
(erc-scenarios-services-misc--regain-command,
erc-scenarios-services-misc--ghost-and-retry-nick): New tests.
* test/lisp/erc/resources/services/regain/reconnect-retry-again.eld:
New test data file reusing existing blob c0529052 that once lived at
resources/base/renick/regain/normal-again.eld.
* test/lisp/erc/resources/services/regain/reconnect-retry.eld: New
test data file reusing existing blob 9f4df70e5 that once lived at
resources/base/renick/regain/normal.eld.
* test/lisp/erc/resources/services/regain/taken-ghost.eld: New test
data file.
* test/lisp/erc/resources/services/regain/taken-regain.eld New test
data file.
F. Jason Park [Wed, 28 Jun 2023 03:47:26 +0000 (20:47 -0700)]
Account for leading timestamps in erc-match
* lisp/erc/erc-match.el (erc-text-matched-hook): Mention that stamps
may be present in the narrowed buffer but absent from the message
parameter.
(erc-match--message): New function containing what was the body of
`erc-match-message' as if the latter were simply renamed.
(erc-match-message): Move body to `erc-match--message' and call it
with more aggressive narrowing. This fixes a regression stemming from d880a08f "Cement ordering of essential hook members in ERC". Special
thanks to Libera.Chat user jrm for reporting this bug. (Bug#60936)
* test/lisp/erc/erc-scenarios-match.el: New test file.
Harald Jörg [Sat, 1 Jul 2023 13:25:33 +0000 (15:25 +0200)]
cperl-mode: Fix byte-compilation warnings
* lisp/progmodes/cperl-mode.el (defconst): Reformat docstring to
fit into 80 columns.
(cperl-find-sub-attrs): Mark lexical parameters as unused.
* test/lisp/progmodes/cperl-mode-tests.el
(cperl-test-fontify-attrs-and-signatures): Fix use of
`match-beginning'
(perl-indent-parens-as-block): Define as a variable.
Eli Zaretskii [Sat, 1 Jul 2023 08:34:43 +0000 (11:34 +0300)]
Fix total count of messages in Rmail summary buffers
* lisp/mail/rmailsum.el (rmail-new-summary-1): Actually count the
messages in the summary buffer instead of relying on
'rmail-total-messages'. Reported by Andrea Monaco
<andrea.monaco@autistici.org>.
Harald Jörg [Fri, 30 Jun 2023 21:41:06 +0000 (23:41 +0200)]
cperl-mode.el: Support subroutine signatures
Since Perl 5.20, subroutine signatures were available as an
experimental feature. With Perl 5.38, they will be always enabled in
the new object system.
* test/lisp/progmodes/cperl-mode-resources/cperl-bug-64190.pl:
* test/lisp/progmodes/cperl-mode-resources/cperl-bug-64364.pl: New
test resources.
* test/lisp/progmodes/cperl-mode-tests.el
(cperl-test-fontify-attrs-and-signatures): Add tests for
signatures.
(cperl-test-attribute-rx, cperl-test-attribute-list-rx)
(cperl-test-prototype-rx, cperl-test-signature-rx): Tests for the
new rx sequences.
(cperl-test-bug-64190): New test for multiline declarations.
(cperl-test-bug-64364): New test for indentation of declarations.
* lisp/progmodes/cperl-mode.el:
(toplevel): New rx sequences to match Perl variables and attributes.
(cperl-declaration-header-p): New function to identify declarations.
(cperl-block-declaration-p): Use the new function.
(cperl-mode): Use the rx sequences.
(cperl-get-state): Use the new function.
(cperl-sniff-for-indent): Use the new function.
(cperl-find-sub-attrs): Improve fontification of subroutine
prototypes and attributes while typing when jit-lock-mode is
active. Detect signatures, and distinguish them from prototypes.
(cperl-find-pods-heres): Use the rx sequences to detect subroutines.
(cperl-init-faces): Use the rx sequences for fontification.
Eli Zaretskii [Fri, 30 Jun 2023 07:13:53 +0000 (10:13 +0300)]
Improve documentation of registers
* doc/lispref/text.texi (Registers): Document buffers in
registers. Mention "frameset" as another name for "frame
configuration".
* doc/emacs/regs.texi (Registers, Configuration Registers)
(File and Buffer Registers): Clarify and improve wording. Add
cross-references and indexing.
(Configuration Registers): Rename the section to a more accurate
name. (Bug#64354)
Andrew G Cohen [Tue, 27 Jun 2023 07:40:46 +0000 (15:40 +0800)]
Use a temporary buffer in nnagent-request-set-mark (bug#64117)
Commit cb12a84f2c519a48dd87453c925e3bc36d9944db inadvertently removed
the use of a temporary buffer in nnagent-request-set-mark. Bug and
fix reported by Jens Schmidt <jschmidt4gnu@vodafonemail.de>
* lisp/gnus/nnagent.el (nnagent-request-set-mark): Restore the use of
a temporary buffer that was inadvertently removed.
Andrew G Cohen [Tue, 27 Jun 2023 07:40:46 +0000 (15:40 +0800)]
Use a temporary buffer in nnagent-request-set-mark (bug#64117)
Commit cb12a84f2c519a48dd87453c925e3bc36d9944db inadvertently removed
the use of a temporary buffer in nnagent-request-set-mark. Bug and
fix reported by Jens Schmidt <jschmidt4gnu@vodafonemail.de>
* lisp/gnus/nnagent.el (nnagent-request-set-mark): Restore the use of
a temporary buffer that was inadvertently removed.
Daniel Martín [Sun, 25 Jun 2023 20:17:14 +0000 (22:17 +0200)]
Make js-beginning-of-defun return non-nil on success
The docstring of 'beginning-of-defun-function' says that the
function shall return non-nil when it found the beginning
of a defun. This is specially important because the calling
code decides when to move point depending on the return value.
* lisp/progmodes/js.el (js-beginning-of-defun)
(js--beginning-of-defun-flat): Return non-nil when the beginning
of a defun is found. (Bug#64283)
* test/lisp/progmodes/js-tests.el (js-mode-end-of-defun): Add a unit
test.
Alan Mackenzie [Wed, 28 Jun 2023 18:29:39 +0000 (18:29 +0000)]
Fontify C, C++, Objective C identifiers containing $
Optionally, fontify them with font-lock-warning-face.
This fixes bug#64204.
* lisp/progmodes/cc-fonts.el (c-font-lock-ids-with-dollar):
New function.
(c-simple-decl-matchers, c-complex-decl-matchers): invoke
c-font-lock-ids-with-dollar for pertinent languages.
* lisp/progmodes/cc-langs.el (c-symbol-start): Add `$' to the
character list.
(c-dollar-in-ids): New lang const.
(c-symbol-key): For the Pike value, use the AWK value rather
than the C value as the basis, as the latter is no longer
suitable.
* lisp/progmodes/cc-vars.el (c-warn-ids-with-dollar): New
customizable option.
* doc/misc/cc-mode.texi ("Miscellaneous Font Locking"): Add a
section on the new optional fontification of identifiers with
'font-lock-warning-face'.
Yuan Fu [Wed, 28 Jun 2023 03:58:34 +0000 (20:58 -0700)]
Tree-sitter use with-silent-modifications like jit-lock (bug#64321)
* lisp/treesit.el (treesit--font-lock-notifier): Use
with-silent-modifications when marking modified text to be fontified
by jit-lock. This is what jit-lock itself does.
Alan Mackenzie [Tue, 27 Jun 2023 20:11:48 +0000 (20:11 +0000)]
Amend the handling of c-laomib-cache.
There was unstable syntactic analysis of lines which were brace
lists. This fixes bug#64133.
* lisp/progmodes/cc-engine.el (c-laomib-cache): Allow several
entries with the same LIM element corresponding to distinct
scanning regions.
(c-laomib-get-cache): Add new parameter START. Adjust to be
able to have entries with the same LIM element and handle them
correctly.
(c-laomib-put-cache): Amend the handling of cache entries with
the same LIM element.
(c-looking-at-or-maybe-in-bracelist): Supply the needed new
argument to c-laomib-get-cache. Add in a new call to
c-laomib-put-cache.
Stephen Berman [Tue, 27 Jun 2023 15:50:18 +0000 (17:50 +0200)]
Fix todo-mode.el Commentary and a doc string (bug#64298)
* lisp/calendar/todo-mode.el: Explicitly note in the Commentary
that the Todo mode user manual is a separate Info manual in the
Emacs installation.
(todo-always-add-time-string): Replace doc string, which was
mistakenly retained in the initial merge of this version of
todo-mode.el, by a correct description of this user option.
Stephen Berman [Tue, 27 Jun 2023 15:38:20 +0000 (17:38 +0200)]
Prevent truncation of todo-mode categories sexp
* lisp/calendar/todo-mode.el (todo-delete-file)
(todo-move-category, todo-convert-legacy-files)
(todo-update-categories-sexp, todo-check-format):
Bind print-length and print-level to nil before using prin1
and related functions, to avoid truncating the todo categories
sexp and possibly corrupting the file format.
Stephen Berman [Tue, 27 Jun 2023 15:27:42 +0000 (17:27 +0200)]
Avoid making todo-mode buffers manually editable
* lisp/calendar/todo-mode.el (todo-add-category)
(todo-move-category, todo-edit-item--header)
(todo-set-item-priority, todo-move-item, todo-item-undone)
(todo-archive-done-item, todo-set-category-number): Restrict the
scope of nil buffer-read-only to the function calls that change
buffer text, thereby preventing todo mode buffers from becoming
manually editable and hence possibly corrupted when the minibuffer
is in use.
* lisp/misc.el (duplicate-line): Add the newline to the string to be
inserted instead of inserting it separately.
This makes duplicate-line as fast as duplicate-dwim with a contiguous
region. Both could easily be made faster yet by making the code more
complex.