The docstrings of cl-nintersection and cl-nset-difference have been
inconsistent with their manual entries since the beginning of
emacs.git history (bug#76017). This patch settles on the weaker and
thus backward-compatible requirement that only their first argument
be safe to mutate.
* lisp/emacs-lisp/bytecomp.el: Include only first argument in
mutates-arguments property.
* lisp/emacs-lisp/cl-seq.el (cl-nintersection, cl-nset-difference):
Make docstring consistent with manual in that the second argument is
not modified.
* test/lisp/emacs-lisp/cl-seq-tests.el (cl-nintersection-test)
(cl-nset-difference-test): Simplify.
(cl-nset-difference): Pass fresh list as second argument, otherwise
destructive modifications to it could go undetected.
Pip Cet [Fri, 14 Feb 2025 13:49:49 +0000 (13:49 +0000)]
Avoid crashes in lread.c when invalid characters are read
* src/lread.c (readchar): Don't crash for non-fixnum return values.
(read_filtered_event): Don't crash for invalid symbol properties.
(Fread_char):
(Fread_char_exclusive):
(character_name_to_code): Check 'FIXNUMP' before using 'XFIXNUM'.
(read_char_escape): Crash on invalid Lisp-supplied data when
ENABLE_CHECKING; otherwise, signal an error.
Stefan Kangas [Thu, 13 Feb 2025 02:02:39 +0000 (03:02 +0100)]
; Change "virus" to "malicious" in lispref
* doc/lispref/functions.texi (Function Safety): Replace 'virus' with
'malicious' to ensure broader accuracy, as 'malicious' encompasses all
harmful software types.
Yuan Fu [Fri, 14 Feb 2025 05:49:55 +0000 (21:49 -0800)]
Use a heuristic to support method chaining in c-ts-common
Test for "." at the beginning of a line to detect chained method.
* lisp/progmodes/c-ts-common.el:
(c-ts-common--standalone-predicate): New function.
(c-ts-common--standalone-parent):
(c-ts-common--prev-standalone-sibling): Use the new heuristic.
Yuan Fu [Fri, 14 Feb 2025 04:47:23 +0000 (20:47 -0800)]
Allow treesit-simple-indent-standalone-predicate to return anchor
* lisp/treesit.el:
(treesit-simple-indent-standalone-predicate): Allow it to return
an anchor instead of t.
(treesit-simple-indent-presets): Supports number.
* lisp/progmodes/c-ts-common.el:
(c-ts-common--standalone-parent):
(c-ts-common--prev-standalone-sibling): Supports number.
* lisp/treesit.el:
(treesit-simple-indent-standalone-predicate): New variable.
(treesit-simple-indent-presets): Use the predicate.
(treesit-simple-indent-presets): Update docstring.
* lisp/progmodes/c-ts-common.el:
(c-ts-common--standalone-parent):
(c-ts-common--prev-standalone-sibling): Use the predicate if
non-nil. Also, handle method chaining by default.
* doc/lispref/modes.texi (Parser-based Indentation): Add
documentation.
* test/lisp/emacs-lisp/cl-extra-tests.el (cl-extra-test-isqrt):
Expect most specific error type.
(cl-extra-test-nreconc): Pass fresh list as first argument to
cl-nreconc. The usual mutates-arguments warning was not emitted,
possibly in relation to bug#74920 and cl-nreconc being proclaimed
inline.
(cl-extra-test-list-length): Simplify using nconc.
None of the tests using the macro cl-seq--with-side-effects were
being evaluated (since bug#24264), and other tests were not robust
against destructive operations or optimizations (since bug#24264 and
bug#75633). For further discussion, see:
https://lists.gnu.org/r/emacs-devel/2025-02/msg00053.html
* test/lisp/emacs-lisp/cl-seq-tests.el: Fit first line within 80
columns. Remove empty Commentary section.
(cl-union-test-00): Use bug#N reference in place of URL.
(cl-seq-test-bug24264): Ditto. Use nconc in place of append.
(cl-seq--test-list, cl-seq--test-list2, cl-seq--with-side-effects):
Remove.
(cl-seq-tests--relet*): New convenience macro replacing the need for
cl-seq--with-side-effects.
(cl-seq-fill-test, cl-seq-replace-test, cl-seq-delete-test): Use
cl-seq-tests--relet* to actually evaluate tests. Avoid mutating
quoted literals.
(cl-seq-nsubstitute-test): Ditto. Actually call cl-nsubstitute, not
cl-substitute. Avoid comparing mutated argument to itself; compare
to its original copy instead. Avoid calling cl-position on list
that is being mutated in :if predicate; use original copy instead.
(cl-seq-remove-test, cl-remove-if-not-test, cl-delete-if-not-test)
(cl-delete-duplicates-test, cl-seq-remove-duplicates-test)
(cl-seq-substitute-test, cl-seq-substitute-if-test)
(cl-seq-position-test, cl-count-if-test, cl-count-if-not-test)
(cl-member-if-test, cl-member-if-not-test, cl-assoc-if-test)
(cl-assoc-if-not-test, cl-rassoc-if-test, cl-subsetp-test):
Simplify.
(cl-remove-if-test, cl-seq-substitute-if-not-test, cl-find-if-test)
(cl-find-if-not-test, cl-position-if-test, cl-member-test)
(cl-assoc-test, cl-rassoc-test): Quote function symbols, not
lambdas.
(cl-delete-if-test): Use cl-seq-tests--relet*. Check result of
cl-delete-if to avoid relying on its side effects, and to pacify
byte-compiler warning.
(cl-seq-mismatch-test): Avoid 'easy to misread' hidden argument.
(cl-seq-search-test): Break long line.
(cl-sort-test, cl-stable-sort-test, cl-merge-test): Avoid mutating
quoted literals.
(cl-intersection-test): Avoid comparing eql-ity of string literals.
(cl-nintersection-test, cl-nset-difference-test)
(cl-nset-exclusive-or-test): Avoid mutating quoted literals. Don't
compare initial and final values of arguments, since they may have
been mutated.
(cl-set-difference-test, cl-set-exclusive-or-test): Use fresh
arguments to check for absence of mutation.
Robert Pluim [Fri, 17 Jan 2025 15:44:08 +0000 (16:44 +0100)]
Support non-ascii SMTP user and password strings
The user and more importantly the password used when
authenticating SMTP connections MUST be encoded in utf-8, and
'base64-encode-string' requires unibyte strings, so call
'encode-coding-string' on them before base64 encoding them in
case they are multibyte strings.
This applies to the CRAM-MD5, LOGIN, and PLAIN auth methods.
XOAUTH2 access tokens are specified to contain only characters
in the range #x20-#x7E (SPC through ~), so utf-8 encoding is not
necessary.
See RFC 4616 and RFC 4954 (or their later updates).
* lisp/mail/smtpmail.el (smtpmail-try-auth-method): Encode user
and password using utf-8 before base64 encoding.
Robert Pluim [Thu, 22 Aug 2024 16:49:12 +0000 (18:49 +0200)]
Teach gnus/message about international Re: variants
* lisp/mail/mail-utils.el (mail-re-regexps): New defcustom,
contains the components used to construct 'rmail-re-abbrevs' and
'message-subject-re-regexp'.
* lisp/gnus/message.el (message-subject-re-regexp): Derive from
'mail-re-regexps'.
(message-strip-subject-re): Make the match case-insensitive.
* lisp/mail/rmail.el (rmail-re-abbrevs): Derive from
'mail-re-regexps'. Update 'rmail-reply-regexp' when it changes.
(rmail-reply-regexp): Set to nil, 'rmail-re-abbrevs' will set
it.
Björn Bidar [Fri, 31 Jan 2025 01:24:44 +0000 (03:24 +0200)]
Bind sieve-refresh-scriptlist to 'g' in sieve-mode
* lisp/net/sieve.el (sieve-manage-mode-map): Bind
`sieve-refersh-scriptlist' to 'g' to refresh buffer.
(sieve-refresh-scriptlist): Highlight in docstring that the function
updates the current sieve buffer. (Bug#75956)
* doc/misc/sieve.texi (Managing Sieve): Document new keybinding and the
existing `sieve-refresh-scriptlist` function.
shipmints [Wed, 12 Feb 2025 22:29:37 +0000 (00:29 +0200)]
Change the project-switch-project prompt to include the dir name
* lisp/progmodes/project.el:
(project--switch-project-command): Add new argument DIR.
Change the prompt to "Command in `xxx': ..." (bug#76235).
(project-switch-project): Pass DIR to the above function.
Stefan Kangas [Wed, 12 Feb 2025 17:33:59 +0000 (18:33 +0100)]
Avoid cl-caaar etc. compatibility macros in Org
* lisp/org/ob-core.el (org-babel-process-params):
* lisp/org/org-agenda.el (org-agenda-span-to-ndays):
* lisp/org/org-capture.el (org-capture-set-target-location):
* lisp/org/org.el (org-set-effort): Don't use cl-caaar, cl-caadr,
etc. compatibility macros in Org. We don't need to use them, since Org
requires Emacs 26.1.
Juri Linkov [Wed, 12 Feb 2025 18:31:22 +0000 (20:31 +0200)]
Fix treesit-outline related settings
* lisp/treesit.el (treesit-outline-level): Use level 1 by default
since treesit-outline--at-point now always returns the current node.
* lisp/progmodes/ruby-ts-mode.el (ruby-ts-mode):
Use 'bos' instead of 'bol'. Add "singleton_class" to
'treesit-outline-predicate'. Use new condition 'named' in
'treesit-outline-predicate' (bug#74963).
Juri Linkov [Wed, 12 Feb 2025 17:41:12 +0000 (19:41 +0200)]
; * lisp/treesit.el: Remove TODO for integration with thing-at-point.
At this point, thing-at-point with all standard things
is already supported by treesit, for example:
"(thing-at-point 'defun)" by treesit-beginning-of-defun,
"(thing-at-point 'sexp)" by treesit-forward-sexp,
"(thing-at-point 'list)" by treesit-up-list,
"(thing-at-point 'sentence)" by treesit-forward-sentence,
"(thing-at-point 'comment)" by treesit-forward-comment.
https://lists.gnu.org/archive/html/emacs-devel/2025-02/msg00384.html
Tassilo Horn [Wed, 12 Feb 2025 09:33:08 +0000 (10:33 +0100)]
Allow URL-FORMAT as string and function in bug-reference-setup-from-vc-alist
That's a slight simplification resulting from bug#72735.
* lisp/progmodes/bug-reference.el (bug-reference-setup-from-vc-alist):
Rename URL-FORMAT-FN to URL-FORMAT and mention it may be string or
function.
* (bug-reference-maybe-setup-from-vc): Handle the new case where
bug-url-fmt is just a string rather than a function.
Siyuan Chen [Mon, 27 May 2024 16:29:50 +0000 (00:29 +0800)]
Fix 'C-x C-c' with cua-prefix-override-inhibit-delay nil
* lisp/emulation/cua-base.el (cua-cut-handler, cua-copy-handler): New
functions to fix cut and paste when 'cua-prefix-override-inhibit-delay'
is nil. (Bug#71230)
Po Lu [Wed, 12 Feb 2025 07:49:12 +0000 (15:49 +0800)]
X11 drag-and-drop corrections
* lisp/x-dnd.el (x-dnd-handle-drag-n-drop-event): Take cdddr of
client-message, skipping the selection information.
(x-dnd-do-direct-save): Do not erase the local copy of a remote
file if it was not in fact copied on behalf of the recipient.
(x-dnd-handle-xds-drop): Return proper action.
* src/xterm.c (x_term_init): Remove unused variable on non-GTK
builds.
Gabriel Santos [Thu, 21 Nov 2024 02:07:28 +0000 (23:07 -0300)]
Add go-work-ts-mode for Go workspace files
* lisp/progmodes/eglot.el (eglot-server-programs): Add go-work-ts-mode.
* lisp/progmodes/go-ts-mode.el
(Commentary): Add the repositories for the grammars.
(go-work-ts-mode--indent-rules, go-work-ts-mode--keywords)
(go-work-ts-mode--font-lock-settings): New variables.
(go-work-ts-mode--directive-matcher, go-work-ts-mode): New functions.
(go-mod-ts-mode--directive-matcher): Rename from
go-mod-ts-mode--in-directive-p. Be more specific on the directive
location (modules). Replace mention of nil with function. Use member
instead of pcase to check node types.
* test/lisp/progmodes/go-ts-mode-resources/font-lock-package.go:
* test/lisp/progmodes/go-ts-mode-resources/indent-mod.erts:
* test/lisp/progmodes/go-ts-mode-resources/indent-work.erts:
New files for testing indentation and font-locking for Go
module and workspace files.
* test/lisp/progmodes/go-ts-mode-tests.el: Add tests for Go module and
workspace files. (Bug#74461)
Lin Jian [Mon, 29 Jan 2024 22:11:26 +0000 (06:11 +0800)]
Substitute all emacsclient occurrences in emacsclient.desktop
After commit "From .desktop files, reuse a frame or start a new
Emacs as required" on 2021-06-30, there are two emacsclient
occurrences for the Exec key of etc/emacsclient.desktop.
Before this change, only the first occurrence is substituted.
* Makefile.in (install-etc): Substitute all emacsclient
occurrences in emacsclient.desktop. (Bug#68803)
Lin Jian [Mon, 29 Jan 2024 22:12:43 +0000 (06:12 +0800)]
Remove an unneeded sed command for emacs.service
After commit e5348f125ff03ac70713e5b227f9e51f759a587b on
2020-12-14, there is no ExecStop in etc/emacs.service.
* Makefile.in (install-etc): Remove an unneeded sed command for
etc/emacs.service.
Thuna [Fri, 18 Nov 2022 14:56:38 +0000 (15:56 +0100)]
Highlight multiple symbols in single quotes in CL strings
* lisp/emacs-lisp/lisp-mode.el (lisp-cl-font-lock-keywords-2): When
multiple space-delimited symbols are single quoted together (e.g "`foo
bar'"), highlight them. (Bug#59360)
Thuna [Mon, 19 Dec 2022 08:33:29 +0000 (09:33 +0100)]
Fix 'rcirc-buffer-process' not working on channel buffers
* lisp/net/rcirc.el (rcirc-buffer-process): Look at BUFFER's
'rcirc-server-buffer's 'rcirc-process' instead. Signal an error if it
has none. (Bug#60191)
Trevor Arjeski [Wed, 27 Nov 2024 07:12:07 +0000 (10:12 +0300)]
Fix Gnus logo color customization
Fix a bug where customizing `gnus-logo-color-style' from use-package's
:custom keyword did not set `gnus-logo-colors' before Gnus is launched.
This patch does the following:
- Implements a :set keyword on `gnus-logo-color-style' which will
correctly set `gnus-logo-colors'
- Exposes `gnus-logo-colors' using `defcustom' for more fine-grained
customization
- Uses :set-after on `gnus-logo-colors' so that it is set after
`gnus-logo-color-style'
Manuel Giraud [Mon, 15 Jul 2024 15:33:21 +0000 (17:33 +0200)]
Remove `smtpmail-address-buffer' temporary buffer
* lisp/mail/smtpmail.el (smtpmail-address-buffer): Remove variable.
(smtpmail-send-it):
(smtpmail-deduce-address-list): Replace `smtpmail-address-buffer' with a
temporary buffer. Set `smtpmail-recipient-address-list' only in
caller. (Bug#72128)
Juri Linkov [Tue, 11 Feb 2025 17:42:33 +0000 (19:42 +0200)]
Improve outline-predicate of ts-modes (bug#74448)
* lisp/progmodes/c-ts-mode.el (c-ts-mode--outline-predicate):
Simplify since 'treesit-outline-search' was fixed in 302274b1862.
Use 'treesit-parent-until' to handle the case with "pointer_declarator".
Stefan Kangas [Tue, 11 Feb 2025 08:12:07 +0000 (09:12 +0100)]
; Don't document a complicated default
* doc/misc/message.texi (Superseding): Don't document the default value
of 'message-ignored-supersedes-headers' here; the list was out-of-date,
and is likely to become out-of-date again in the future if updated.
It's also easy enough to look up for users outside of Info.
* lisp/progmodes/project.el:
(project-remember-projects-under): Correct grammar for the singular
case. Rather than "1 projects were found", say "1 project was found".
(project-forget-projects-under): Ditto. (Bug#76016)
Stefan Kangas [Tue, 11 Feb 2025 06:13:31 +0000 (07:13 +0100)]
Update webjump.el example links
* lisp/net/webjump.el (webjump-sample-sites): Don't recommend some
defunct or otherwise non-privacy respecting websites. Prefer HTTPS to
HTTP.
(webjump-to-iwin, webjump-state-to-postal-alist): Make obsolete, as this
functionality seems to no longer work due to broken links.
Stefan Kangas [Tue, 11 Feb 2025 05:10:39 +0000 (06:10 +0100)]
Add new function lm-package-version
* lisp/emacs-lisp/lisp-mnt.el (lm-package-version): New function.
* lisp/emacs-lisp/package.el (package-buffer-info)
(package-get-version): Use above new function.
(lm-package-version): Declare.