Stefan Kangas [Mon, 17 Feb 2025 00:53:55 +0000 (01:53 +0100)]
Remove some details on which files are loaded from cl.texi
* doc/misc/cl.texi (Naming Conventions): Remove section listing
functions that do not cause other files than cl-lib.el to be loaded.
It lacks practical relevance to the user, and is a hostage to changing
implementation details.
David Ponce [Sat, 8 Feb 2025 12:55:16 +0000 (13:55 +0100)]
Fix DOM printing
Fix DOM printing when an attribute value is not a string, which is
often the case in SVG DOM. Don't print attributes without a
value. Refresh the list of HTML boolean attributes.
* lisp/dom.el (dom--html-boolean-attribute-p): New function.
(dom-print): Use it. Convert attribute value to string before to
call `url-insert-entities-in-string'. Don't print attribute
without a value. Compute indentation column outside of loop and
call `indent-line-to' to indent line. (Bug#5928)
* test/lisp/dom-tests.el (dom-tests-print-svg)
(dom-tests-print-html-boolean): New tests.
kobarity [Mon, 13 Jan 2025 13:38:42 +0000 (22:38 +0900)]
Fix string end search in python-nav-end-of-statement
* lisp/progmodes/python.el (python-nav-end-of-statement):
Change to look for string delimiter characters and check
syntax, instead of looking for string-delimiter syntax.
* test/lisp/progmodes/python-tests.el
(python-nav-end-of-statement-5): New test. (Bug#75387)
Eli Zaretskii [Sat, 15 Feb 2025 11:15:36 +0000 (13:15 +0200)]
Prevent buffer overflow in line-numbering code
* src/xdisp.c (maybe_produce_line_number): Limit the value of
'display-line-numbers-width' to what can be shown in the window,
and set dimension of the lnum_buf[] accordingly. (Bug#75969)
* lisp/vc/smerge-mode.el (smerge-refine-regions): Cover each region
with an overlay.
(smerge-refine-exchange-point): Use it to detect more reliably that
we're not inside a refined region.
Stefan Monnier [Sat, 15 Feb 2025 04:28:52 +0000 (23:28 -0500)]
(smerge-refine-exchange-point): New command
* lisp/vc/smerge-mode.el (smerge--refine-highlight-change):
Allow empty region and always create an overlay. Also, remember any
adjustment we applied the overlay's boundaries.
(smerge-refine-regions): Always create two overlays per hunk and "connect"
them via `smerge--refine-other`.
(smerge-refine-exchange-point): New command.
Stefan Kangas [Fri, 14 Feb 2025 21:46:07 +0000 (22:46 +0100)]
Inline important-return-value declarations in cl-lib.el
These declarations are now properly added to 'cl-lib.el' itself, or to
'cl-loaddefs.el'. This means that they will now correctly show up
immediately when loading 'cl-lib.el', instead of only after 'cl-macs.el'
is pulled in by an autoload. C.f. Bug#76247.
I did not considered worth reproducing everywhere the list saying which
functions among the below belong to these two categories:
1. Functions that are side-effect-free except for the behavior of
functions passed as argument.
2. Functions that mutate and return a list.
AFAIU, this is not actionable with our current byte-compiler, i.e. we
can't add any extra declarations based on it. However, if the list
should be needed at some point, for example due to improvements in the
compiler, this commit will be where to find it. In the worst case, and
with more work, it's also deducible from the source code itself.
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