Richard Lawrence [Sun, 11 May 2025 05:47:42 +0000 (07:47 +0200)]
Fix DTSTART date when exporting `diary-float'
Instead of using current date as DTSTART and then excluding it
when it doesn't match the `diary-float' rule, just use the first
date which matches the rule in `icalendar-recurring-start-year'.
* lisp/calendar/icalendar.el (icalendar--convert-float-to-ical):
Compute the correct date.
* test/lisp/calendar/icalendar-tests.el: Add a test for the
reported test case. (Bug#78085)
New pulse functions for pulse faces and new file for ring bell fns
These new pulse functions allow pulse any defined face briefly.
The new file contains functions intended to be used in
`ring-bell-function' as alternatives to `visible-bell'.
* lisp/pulse.el (pulse-face-duration): New user option.
(pulse-flash-face): New function.
* lisp/ring-bell-fns.el (flash-face-attributes)
(flash-face-faces): New user options.
(flash-face-bell-function, flash-echo-area-bell-function):
New functions. (bug#77715)
* lisp/progmodes/typescript-ts-mode.el:
(typescript-ts-mode--indent-rules): Make sure each new ternary
branch is aligned with the previous one.
* test/lisp/progmodes/typescript-ts-mode-resources/indent.erts:
(Chained ternary expressions): New test.
* src/eval.c (default_toplevel_binding, local_toplevel_binding):
Loop upwards, not downwards, given that we want the earliest
relevant binding present in the stack.
Stephen Berman [Sat, 10 May 2025 14:25:05 +0000 (16:25 +0200)]
Improve Electric Pair mode documentation (bug#78021)
* doc/emacs/programs.texi (Matching): Clarify and improve
documentation of Electric Pair mode.
* lisp/elec-pair.el: Improve description in header line. Add text
and a reference to the Emacs user manual in the Commentary section.
(electric-pair-skip-self, electric-pair-inhibit-predicate)
(electric-pair-preserve-balance)
(electric-pair-delete-adjacent-pairs)
(electric-pair-open-newline-between-pairs)
(electric-pair-skip-whitespace)
(electric-pair-skip-whitespace-function)
(electric-pair-analyze-conversion)
(electric-pair--skip-whitespace)
(electric-pair-text-syntax-table, electric-pair--with-syntax)
(electric-pair-syntax-info, electric-pair--insert)
(electric-pair--syntax-ppss, electric-pair--balance-info)
(electric-pair-inhibit-if-helps-balance)
(electric-pair-skip-if-helps-balance)
(electric-pair-open-newline-between-pairs-psif)
(electric-pair-mode): Clarify and improve doc strings and some comments.
(electric-pair-post-self-insert-function): Restructure doc string
to shorten overlong first line, and reformat overlong lines of code.
Juri Linkov [Wed, 14 May 2025 06:57:40 +0000 (09:57 +0300)]
Use JSX comments on jsx treesit nodes in js-ts-mode and tsx-ts-mode
* lisp/progmodes/js.el (js--treesit-comment-jsx): New internal variable.
(js--treesit-comment-setup): New function.
(js-ts-mode): Set buffer-local 'comment-setup-function' to
'js--treesit-comment-setup'.
* lisp/progmodes/typescript-ts-mode.el (typescript-ts-base-mode):
Set buffer-local 'comment-setup-function' to 'js--treesit-comment-setup'.
Eli Zaretskii [Tue, 13 May 2025 11:45:04 +0000 (14:45 +0300)]
Eglot: Fix parsing file:// URIs on MS-Windows
* lisp/progmodes/eglot.el (eglot-uri-to-path): Remove the leading
slash in MS-Windows file names only if they begin with a slash.
This adjusts the function to the recent fix for bug#76982 in
'url-generic-parse-url', which previously would produce file names
that begin with an extra slash. (Bug#78392)
Stefan Monnier [Mon, 12 May 2025 21:49:02 +0000 (17:49 -0400)]
help.el: Don't abuse `inhibit-modification-hooks`
* lisp/help.el (substitute-command-keys):
Set `inhibit-modification-hooks` locally so it doesn't affect
downstream function.
(help--window-setup): Don't let-bind `inhibit-modification-hooks`.
It was introduced accidentally in commit cd87a5c7a18e.
Stefan Monnier [Mon, 12 May 2025 19:25:05 +0000 (15:25 -0400)]
comint.el: Cosmetic changes
* lisp/comint.el: Prefer #' to quote function names.
(comint-mode): Turn some of the `make-local-variable`s to `setq-local`
or `defval-local`.
(comint-osc-hyperlink): Delete bogus alias.
(comint-replace-by-expanded-history-before-point): Use `looking-at-p`.
(comint-history-isearch-wrap): Share a bit more code.
Juri Linkov [Mon, 12 May 2025 18:23:03 +0000 (21:23 +0300)]
* lisp/treesit.el (treesit--parser-overlay-offset): New variable.
(treesit-parsers-at): Use it (bug#77906).
(treesit-forward-sexp, treesit--forward-list-with-default)
(treesit-up-list): Let-bind 'treesit--parser-overlay-offset'.
Eli Zaretskii [Mon, 12 May 2025 12:08:20 +0000 (15:08 +0300)]
Fix filelock-tests on MS-Windows
* test/src/filelock-tests.el (filelock-tests-file-locked-p-spoiled)
(filelock-tests-unlock-spoiled)
(filelock-tests-kill-buffer-spoiled): Don't special-case
MS-Windows, as it was evidently fixed to signal the same error as
Posix systems.
Sean Whitton [Mon, 12 May 2025 09:11:18 +0000 (10:11 +0100)]
diff-mode-shared-map: Don't inherit from special-mode-map
* lisp/vc/diff-mode.el (diff-mode-shared-map): No longer inherit
from special-mode-map.
(diff-mode-map): Tidy up list of unbindings now that we no
longer need to override any bindings from special-mode-map.
(minor-mode-map-alist): <diff-mode-read-only>: Ensure that the
minor mode keymap continues to inherit from special-mode-map by
calling make-composed-keymap here.
Eli Zaretskii [Sun, 11 May 2025 16:27:13 +0000 (19:27 +0300)]
Avoid unnecessary calls to GetFileAttributes on MS-Windows
* src/w32.c (access_attrs): New function, refactored from
'faccessat'.
(faccessat): Call 'access_attrs' early to determine whether the
file doesn't exist, and if so, avoid calling 'chase_symlinks'.
Also avoid calling 'chase_symlinks' if it is known that the file
cannot be a symlink, given its attributes. (Bug#78341)
Eli Zaretskii [Sun, 11 May 2025 10:33:24 +0000 (13:33 +0300)]
Support sub-second file time-stamps on MS-Windows
* nt/inc/sys/stat.h (struct stat): New members for nsec part of
file times.
* lib-src/ntlib.c (convert_time):
* src/w32.c (convert_time): Accept an additional argument
TIME_NSEC and set it to the sub-second part of time. All callers
changed.
João Távora [Sun, 11 May 2025 10:14:02 +0000 (11:14 +0100)]
Tweak .clangd to work with gcc-compiled Emacs (bug#78367)
A Gcc configuration of Emacs emits -fstrict-flex-arrays but
clangd doesn't understand that. This causes spurious errors of
"unknown flag" that prevent analysis. So tweak .clangd to the
nearest clang equivalent (which is very similar).
Eli Zaretskii [Sat, 10 May 2025 10:11:22 +0000 (13:11 +0300)]
Fix indentation of XML comments
* lisp/nxml/nxml-mode.el (nxml-compute-indent-in-delimited-token):
Fix indentation in XML comments with empty lines. Patch by John
Ciolfi <ciolfi@mathworks.com>. (Bug#73206)
Michael Albinus [Sat, 10 May 2025 08:05:51 +0000 (10:05 +0200)]
Improve Tramp's make-process handling for Solaris
* lisp/net/tramp-sh.el (tramp-sh-handle-make-process):
Disable buffering also for remote Solaris hosts.
Reported by Stacey Marshall <stacey.marshall@gmail.com>.
Yuan Fu [Wed, 7 May 2025 03:57:06 +0000 (20:57 -0700)]
Make treesit--simple-indent-eval more permissive (bug#78065)
* lisp/treesit.el (treesit--simple-indent-eval): Allow EXP to be
anything, so higher-order indent presets can take anything as an
argument: t, nil, symbols, keywords, etc.
ix bugs when a SES buffer has named cells, and another don't.
* lisp/ses.el (ses-list-named-cells): Give a message when the list is empty.
(ses--unbind-cell-name): Do not throw error in a SES buffer w/o
any named cell for gethash from 'ses--named-cell-hashmap' being
'nil'.
Eli Zaretskii [Fri, 9 May 2025 11:43:03 +0000 (14:43 +0300)]
; Fix VC tests
* test/lisp/vc/vc-tests/vc-tests.el (vc-test-hg06-version-diff):
Skip on MS-Windows in batch mode.
* test/lisp/vc/vc-git-tests.el (vc-git-test--start-branch): More
portable command for showing the current branch ("--show-current"
is only available since Git 2.22).
Sean Whitton [Sat, 5 Apr 2025 02:58:35 +0000 (10:58 +0800)]
New vc-async-checkin user option
* lisp/vc/vc.el (vc-async-checkin): New option.
(vc-checkin): Don't use with-vc-properties on or display
messages around asynchronous checkins.
* lisp/vc/vc-git.el (vc-git-checkin):
* lisp/vc/vc-hg.el (vc-hg-checkin, vc-hg-checkin-patch): Perform
an async checkin operation when vc-async-checkin is non-nil.
* doc/emacs/vc1-xtra.texi (General VC Options):
* etc/NEWS: Document the new option.
* lisp/vc/vc-dispatcher.el (vc-wait-for-process-before-save):
New function.
(vc-set-async-update): If the current buffer visits a file, call
vc-refresh-state.
* lisp/vc/vc-hg.el (vc-wait-for-process-before-save): Autoload.
(vc-hg--async-command, vc-hg--async-buffer, vc-hg--command-1):
New utilities, partially factored out of vc-hg-command.
(vc-hg-merge-branch): Use vc-hg--async-command, thereby newly
respecting vc-hg-global-switches.
Martin Rudalics [Fri, 9 May 2025 07:36:00 +0000 (09:36 +0200)]
Fix infinite looping in 'next-frame' and associates (Bug#77985)
* src/frame.c (next_frame): Rewrite to avoid infinite looping if
FRAME itself does not qualify as candidate frame (Bug#77985).
(Fnext_frame, Fprevious_frame): Adjust do-strings.
* lisp/frame.el (other-frame): Adjust doc-string.
(frame-list-1): New function.
(make-frame-names-alist): Rewrite using 'frame-list-1' instead
of 'next-frame' (Bug#77985).
(delete-other-frames): Rewrite using 'frame-list' instead of
'next-frame'.
* doc/lispref/frames.texi (Finding All Frames): Minor
clarifications for 'frame-list' and 'next-frame'.
João Távora [Thu, 8 May 2025 11:15:24 +0000 (12:15 +0100)]
Flymake: tweak 'fancy' eol diagnostic display
When calculating the face for boxdraw chars, protect against
diagnostics with an empty first line. Also don't inherit from
:default, which seems to mess up the background color when using
hl-line-mode.
Manuel Giraud [Thu, 1 May 2025 15:06:07 +0000 (17:06 +0200)]
Recenter for the calendar (bug#78205)
* lisp/calendar/cal-move.el (calendar-recenter-last-op): New
variable to track last recenter operation.
(calendar-recenter): New command to recenter the calendar.
* lisp/calendar/calendar.el (calendar-mode-map): Keybinding for
this command.
* doc/emacs/calendar.texi (Scroll Calendar): Document this
command.
* etc/NEWS: Announce this command.
Paul Eggert [Thu, 8 May 2025 06:57:18 +0000 (23:57 -0700)]
Update from Gnulib by running admin/merge-gnulib
The following changes were made by hand,
so that admin/merge-gnulib could succeed
instead of failing because the diff didn’t match.
* admin/gnulib-patches/lib/getloadavg.c.diff:
Remove, as it is no longer needed now that recent
Gnulib has been merged.
* admin/merge-gnulib (GNULIB_TOOL_FLAGS):
Remove the --local-dir="$src"admin/gnulib-patches option,
as it is no longer needed either.
* lisp/emacs-lisp/cl-lib.el (cl-generic-generalizers): Tweak the
bootstrap hack to avoid a problem when dumping `bootstrap-emacs` when
`cl-lib.el` has already been compiled.
* lisp/emacs-lisp/cl-macs.el (list): Move out of `static-if` test.
Stefan Monnier [Thu, 8 May 2025 03:17:41 +0000 (23:17 -0400)]
(cl-deftype): Precompute the predicate function
Always define a `cl-deftype-satisfies` predicate (if possible), so
we only need `cl-typep` to "interpret" a type specifier when we use
a compound type but never for the atomic types (e.g. never
in `cl-types-of`).
* lisp/emacs-lisp/cl-macs.el (cl-typep): Test `cl-deftype-satisfies` first.
Don't handle `real` here any more.
(base-char, character, command, keyword, natnum, real): Define with
`c-deftype`.
(cl-deftype): Precompute the predicate for the atomic derived type,
if applicable.
* lisp/emacs-lisp/cl-preloaded.el (cl--define-derived-type):
Add argument for the precomputed predicate function.
* lisp/emacs-lisp/cl-extra.el (cl-types-of): Use `cl-deftype-satisfies`
instead of `cl-type-p`.
James Cherti [Fri, 11 Apr 2025 14:18:19 +0000 (10:18 -0400)]
Mark !%:.^~, as punctuation rather than symbol constituents
In Bash, the characters !%:.^~, are not valid in variable names. In sh,
they are not permitted in either function or variable names. Treating
them as punctuation is convenient, as they are rarely used in function
names and never in variable names. Even among commands, their usage is
uncommon. The only character among these that is commonly seen in
command names is '.', although it is rarely used in function names.
Marking these characters as punctuation, rather than symbol
constituents, enhances the accuracy of symbol detection.
* lisp/progmodes/sh-script.el: Mark !%:.^~, as punctuation in the
sh-mode-syntax-table syntax table.
Stefan Monnier [Wed, 7 May 2025 17:54:47 +0000 (13:54 -0400)]
(cl-deftype): Don't set `cl-deftype-handler` directly
In order to make it easier to change that in the future, let
`cl--define-derived-type` take care of storing the derived
type's function into `cl-deftype-handler`.
* lisp/emacs-lisp/cl-preloaded.el (cl--define-derived-type):
Change calling convention. Set `cl-deftype-handler`.
* lisp/emacs-lisp/cl-macs.el (cl-deftype): Don't set `cl-deftype-handler`,
instead pass the function to `cl--define-derived-type`.
Stefan Monnier [Wed, 7 May 2025 17:24:07 +0000 (13:24 -0400)]
cl-types: The big renaming to "derived types"
`cl-defstruct` also defines a type and is also in CL, so
"cl-type" is not precise enough to talk about those types
defined with `cl-deftype`. Use the term "derived type" to be
more clear, as is done in the HyperSpec.
* doc/misc/cl.texi (Derived types): Move `cl-deftype` to this
new subsection. Document the use of derived types as method specializers.
* lisp/emacs-lisp/cl-extra.el (cl--types-of-memo): Rename from
`cl--type-unique`.
(cl--derived-type-dispatch-list): Rename from `cl--type-dispatch-list`.
(cl--derived-type-generalizer): Rename from `cl--type-generalizer`.
(cl--derived-type-generalizers): Rename from `cl--type-generalizers`.
* lisp/emacs-lisp/cl-lib.el (cl-generic-generalizers) <derived-types>:
Rename from <cl-types-of>. Catch but don't hide errors when a derived
type cannot be used as an atomic type specifier.
* lisp/emacs-lisp/cl-preloaded.el (cl--derived-type-list): Rename from
`cl--type-list`.
(cl-derived-type-class): Rename from `cl-type-class`.
(cl--derived-type-class-make): Rename from `cl--type-class-make`.
(cl--define-derived-type): Rename from `cl--type-deftype`.
Juri Linkov [Wed, 7 May 2025 06:31:01 +0000 (09:31 +0300)]
Update the default value of 'diff-outline-regexp'.
* lisp/vc/diff-mode.el (diff-outline-regexp): Change the default value
to match the diff command name in recursive diff. Move after
'diff-hunk-header-re' variable definition used in the new value.
(diff-setup-buffer-type): Change setq of 'diff-outline-regexp'
to buffer-local (bug#78269).
Po Lu [Tue, 6 May 2025 14:29:46 +0000 (22:29 +0800)]
Fix compilation on Android 35 and on Termux
* configure.ac (gl_cv_onwards_func_tzalloc): Define to "future
OS version" on Android API 35 and later.
Detect posix_spawn* by means of gl_CHECK_FUNCS_ANDROID.
* src/conf_post.h (tzalloc, tzfree): Define to non-conflicting
names on Android 35 and later.
Stefan Monnier [Tue, 6 May 2025 03:18:56 +0000 (23:18 -0400)]
cl-types: Integrate into CL-Lib
* lisp/emacs-lisp/cl-extra.el (cl--type-unique, cl-types-of)
(cl--type-dispatch-list, cl--type-generalizer): Move to `cl-extra.el`.
(cl--type-generalizers): New function extracted from "cl-types-of"
method of `cl-generic-generalizers`.
* lisp/emacs-lisp/cl-lib.el (cl-generic-generalizers): New method to
dispatch on derived types. Use `cl--type-generalizers`.
* lisp/emacs-lisp/cl-macs.el (cl-deftype): Move from `cl-types.el`
and rename from `cl-deftype2`.
(extended-char): Tweak definition to fix bootstrapping issues.
* lisp/emacs-lisp/cl-preloaded.el (cl--type-list, cl-type-class)
(cl--type-deftype): Move from `cl-types.el`.
* lisp/emacs-lisp/oclosure.el (oclosure): Don't abuse `cl-deftype` to
register the predicate function.
* test/lisp/emacs-lisp/cl-extra-tests.el: Move tests from
`cl-type-tests.el`.
Stefan Monnier [Mon, 5 May 2025 18:57:05 +0000 (14:57 -0400)]
cl-types: Simplify a bit further
Mostly, get rid of `cl--type-flag` and rely only on the presence/absence
of the type on `cl--types-list` to "flag" erroring-types.
Also, don't try and catch errors during dispatch.
* lisp/emacs-lisp/cl-types.el (cl--type-dispatch-list): Move to the
relevant section.
(cl--type-parents): Inline into sole caller.
(cl--type-deftype): Add `arglist` argument.
Don't signal an error if the type already existed but wasn't in
`cl--type-list` since that's normal and we can fix it.
Don't touch `cl--type-flag` any more.
Don't add to `cl--type-list` if it can't be used without arguments.
(cl-deftype2): Adjust call accordingly.
(cl--type-error): Inline into sole caller.
(cl-types-of): Be more careful to preserve ordering of types
before passing them to `merge-ordered-lists`.
Add `types` argument for use by dispatch.
Don't bother skipping the `root-type` since that's a built-in type,
so it should never happen anyway.
Don't catch errors if called from dispatch.
Don't bother with `cl--type-flag`.
(cl--type-generalizer): Use new arg of `cl-types-of` instead of
let-binding `cl--type-list`, in case `cl-types-of` ends up (auto)loading
a file or some such thing which needs to use/modify `cl--type-list`.
(cl--type-undefine): Move to end of file.
* test/lisp/emacs-lisp/cl-types-tests.el (cl-types-test): Remove DAG
test since we don't detect such errors any more.
Relax ordering test when the order is not guaranteed
by parent-relationships.