* lisp/emacs-lisp/ert-font-lock.el: Remove redundant requires.
(ert-font-lock--parse-macro-args): First return value 'doc' being
nil already indicates omission of a docstring, so remove redundant
second return value doc-p. All users updated. Fix error
messages (bug#76372).
(ert-font-lock--check-faces): Simplify with ensure-list.
Stefan Monnier [Fri, 7 Mar 2025 04:23:08 +0000 (23:23 -0500)]
(python-base-mode-map): Use it!
Rather than use `copy-keymap` between `python-mode-map` and
`python-ts-mode-map`, move the shared bindings to `python-base-mode-map`.
* lisp/progmodes/python.el (python-base-mode-map): Define it explicitly.
Move all the bindings of `python-mode-map` to it.
(python-mode-map, python-ts-mode-map): Inherit from it.
* lisp/tab-bar.el
(tab-bar-tab-highlight): New face.
(tab-bar-tab-name-format-mouse-face): New function adds the 'mouse-face'
'tab-bar-tab-highlight' to the tab name.
(tab-bar-tab-name-format-functions): Add
'tab-bar-tab-name-format-mouse-face'.
Juri Linkov [Thu, 6 Mar 2025 18:22:50 +0000 (20:22 +0200)]
Improve treesit settings for js/typescript/ruby-ts-mode (bug#73404)
* lisp/progmodes/js.el (js--treesit-list-nodes):
* lisp/progmodes/typescript-ts-mode.el (typescript-ts-mode--list-nodes):
Replace leaf "string" with "template_string" and "template_substitution"
that can contain more nodes.
* lisp/progmodes/ruby-ts-mode.el (ruby-ts-mode):
Add the 'sentence' thing to treesit-thing-settings.
Stefan Monnier [Thu, 6 Mar 2025 18:02:37 +0000 (13:02 -0500)]
(debug): Don't `kill-emacs` upon exit when in batch mode
AFAICT this is a left over code from many years ago before
the `debug` special case was added to `condition-case` and
at a time where exiting from `debug` did not proceed to handle
remaining handlers.
In the usual case where we indeed want to kill Emacs,
`signal_or_quit` does it for us.
* lisp/emacs-lisp/debug.el (debug): Don't `kill-emacs` upon exit
when in batch mode (bug#76786)
Kazuhiro Ito [Sun, 23 Feb 2025 13:47:00 +0000 (22:47 +0900)]
Avoid defining unneeded variables on Cygw32
lisp/term/w32-win.el contained definitions of variables which
were not used on Cygw32. It is now to split into two files,
common part and Windows native build specific part. The latter
is a new file, lisp/term/w32-nt.el.
* src/image.c (Qlibpng_version, Qlibgif_version)
(Qlibjpeg_version): Don't define on Cygw32 build.
* src/treesit.c (Qtree_sitter__library_abi): Ditto.
* lisp/term/w32-win.el (dynamic-library-alist, libpng-version)
(libgif-version, libjpeg-version, libgnutls-version)
(tree-sitter--library-abi, gui-backend-set-selection)
(gui-backend-get-selection, gui-backend-selection-owner-p)
(gui-selection-exists-p): Moved to lisp/term/w32-nt.el.
* lisp/term/w32-nt.el: New file, separated Windows native build
specific part from lisp/term/w32-win.el.
* lisp/loadup.el: Load term/w32-nt.el on Windows native build.
(Bug#75926)
Visuwesh [Mon, 3 Mar 2025 08:26:04 +0000 (13:56 +0530)]
Add new user option to exclude projects from being remembered
* lisp/progmodes/project.el (project-list-exclude): Add new user
option to exclude projects from being remembered.
(project-remember-project): Consider the user option above.
(project-switch-project): Use 'project-remember-project' instead.
* doc/emacs/maintaining.texi (Managing Projects): Mention the new user option.
* etc/NEWS: Announce the change. (Bug#76587)
Stefan Kangas [Wed, 5 Mar 2025 23:33:21 +0000 (00:33 +0100)]
New user option checkdoc-arguments-missing-flag
* lisp/emacs-lisp/checkdoc.el
(checkdoc-arguments-missing-flag): New user option.
(checkdoc-this-string-valid-engine): Use above new option.
(checkdoc--argument-missing-flag): Make into obsolete variable alias for
above new option.
Juri Linkov [Wed, 5 Mar 2025 17:44:44 +0000 (19:44 +0200)]
Improve treesit settings for typescript/tsx-ts-mode (bug#73404)
* lisp/progmodes/typescript-ts-mode.el
(typescript-ts-mode--font-lock-settings): Add @font-lock-type-face
for 'internal_module' with 'identifier'.
(typescript-ts-mode--defun-type-regexp): New variable with
"internal_module" and "interface_declaration".
(typescript-ts-mode--defun-name): New function that uses
'js--treesit-defun-name' and adds "internal_module" and
"interface_declaration".
(typescript-ts-mode--simple-imenu-settings): New variable
like in 'js-ts-mode' with "Namespace" and "Interface" sections.
(typescript-ts-mode--outline-predicate): New variable.
(typescript-ts-base-mode): Set treesit-defun-type-regexp to
typescript-ts-mode--defun-type-regexp, treesit-defun-name-function
to typescript-ts-mode--defun-name, treesit-simple-imenu-settings
to typescript-ts-mode--simple-imenu-settings,
treesit-outline-predicate to typescript-ts-mode--outline-predicate.
Use js--regexp-opt-symbol for treesit-thing-settings.
(tsx-ts-mode): For 'sentence' thing use the same nodes as
js--treesit-sentence-nodes. Use js--regexp-opt-symbol for
treesit-thing-settings.
* lisp/progmodes/js.el (js--treesit-sentence-nodes): Add
"jsx_opening_element" and "jsx_closing_element" like in html.
* lisp/progmodes/c-ts-mode.el (c-ts-mode--outline-predicate): Add
outline headings for C++ "namespace_definition" and "class_specifier".
Peter Oliver [Mon, 27 Jan 2025 10:59:19 +0000 (10:59 +0000)]
Provide an Android version code derived from the Emacs version
The version code is intended to be an integer that increments
for each Android package release
(https://developer.android.com/studio/publish/versioning#versioningsettings).
If we keep this updated under version control, then F-Droid (a
third-party Android package repository), can watch for that, and
use it to automatically build Emacs packages for Android each
time a new Emacs release is tagged
(https://f-droid.org/en/docs/Build_Metadata_Reference/#UpdateCheckData).
* admin/admin.el (set-version): Update version code in
java/incrementing-version-code
* java/incrementing-version-code: New file containing an Android
version code corresponding to the current Emacs version.
(bug#75809)
Stefan Kangas [Wed, 5 Mar 2025 02:36:04 +0000 (03:36 +0100)]
Make byte-compile-cond-use-jump-table obsolete
This user option was introduced in 2017, with the rationale:
"This is a workaround for when `byte-compile-cond-jump-table'
accidentally generates wrong code (hasn't happened so far in my
tests), and should be removed once we're sure there are no issues
with it." https://lists.gnu.org/r/emacs-devel/2017-02/msg00223.html
There hasn't been any bugs in this area within the last 6 years, and the
few we did see before that were quickly resolved. Let's declare this
variable obsolete now, while keeping its behavior when set to nil. We
can always revert the obsoletion if it turns out to be needed after all.
Stefan Kangas [Wed, 5 Mar 2025 01:42:10 +0000 (02:42 +0100)]
Clean up 'cl-' prefixes for local variables
The 'cl-' prefixes used for let-bound variables and argument names is a
holdover from the dynbind days. They are no longer necessary, and make
the code hard to read. This was partially cleaned up in the past; let's
finish the job now.
Stefan Kangas [Tue, 4 Mar 2025 21:47:59 +0000 (22:47 +0100)]
Avoid rare warning when byte-compiling cl-loaddefs.el
* lisp/emacs-lisp/cl-extra.el: Add autoloaded declare-function to avoid
rare byte-compilation warning.
Problem reported by Eli Zaretskii <eliz@gnu.org>.
With -std=c11, GCC doesn't recognize 'asm' as a keyword, see
https://gcc.gnu.org/onlinedocs/gcc/Extended-Asm.html and
https://gcc.gnu.org/onlinedocs/gcc/Alternate-Keywords.html. Use __asm__
instead.
* src/lisp.h (flush_stack_call_func): Use __asm__ instead of asm.
Eli Zaretskii [Tue, 4 Mar 2025 13:45:33 +0000 (15:45 +0200)]
Fix 'etc/DOC' for a few functions/variables
* src/term.c (Ftty_frame_at):
* src/menu.c (syms_of_menu) <x-popup-menu-function>:
* src/dispnew.c (Fredisplay): Fix "doc:". The extra blank was
preventing 'make-docfile' from recognizing the functions and
variables and extracting their documentation to 'etc/DOC'.
(Bug#76722)
Ben Simms [Sun, 5 Jan 2025 19:03:53 +0000 (20:03 +0100)]
Support colored stipples on Cocoa NS (Bug#73384)
On Cocoa builds of NS Emacs, stipples are now rendered
using masked CGImages instead of patterned NSColors so that
stipples now render with color.
* src/nsimage.m ([EmacsImage stippleMask:]): Use a CGImageMask to
store the stipple mask when building for Cocoa.
* src/nsterm.m (ns_maybe_dumpglyphs_background): Perform a masked
fill to draw stipples when building for Cocoa.
(ns_draw_stretch_glyph_string): Perform a masked fill to draw
stipples when building for Cocoa.
Po Lu [Tue, 4 Mar 2025 06:24:56 +0000 (14:24 +0800)]
Document requirements respecting XDG MIME databases on Android
* doc/emacs/android.texi (Android Software): State that librsvg
requires a MIME database to display embedded images, and how to
acquire such a database.
Paul Eggert [Tue, 4 Mar 2025 06:20:08 +0000 (22:20 -0800)]
Revert “Avoid some union buffered_input_event uses”
Revert my commit 29a9fd4f4ba17822eca0f00c2037da3868bd874e
and the following commit 1ec0889e7b786d79351cee3ed4964d82295f059f.
This fixes a bug where ‘emacs -nw’ would sometimes freeze when Emacs is
configured with ‘--with-pgtk --enable-link-time-optimization
--disable-gc-mark-trace’ on GNU/Linux x86-64 (Bug#76729).
As it is not yet clear whether this freeze is due to an Emacs bug that
I introduced, or due to GCC bug 117423
<https://gcc.gnu.org/bugzilla/show_bug.cgi?id=117423>,
play it safe for now and revert to the previous state.
Stefan Monnier [Tue, 4 Mar 2025 03:18:02 +0000 (22:18 -0500)]
(advice--make-nadvice-docstring): Rename
* lisp/emacs-lisp/nadvice.el (advice--make-nadvice-docstring): Rename
from `nadvice--make-docstring`, to stick to the `advice-` namespace.
Update all callers.
Stefan Kangas [Tue, 4 Mar 2025 01:59:03 +0000 (02:59 +0100)]
Update Makefile and docs for new Spanish refcards
* etc/refcards/Makefile (PDF_SPANISH, PS_SPANISH): New variables.
(PDF_TARGETS): Use above new variables.
(spanish, spanish-ps): New targets for Spanish translation. (Bug#76300)
* admin/release-process:
* etc/refcards/README: Document new Spanish translation.
Po Lu [Tue, 4 Mar 2025 01:46:48 +0000 (09:46 +0800)]
Render Android hourglass cursor mechanics more consistent with X
* src/androidterm.c (android_show_hourglass): Always define the
hourglass cursor, but...
(android_hide_hourglass): ... restore the invisible cursor
subsequently, if need be.
(android_toggle_visible_pointer): Do not hide the current cursor
if it is an hourglass.
Matthew Bauer [Tue, 4 Mar 2025 01:33:15 +0000 (02:33 +0100)]
Replace anonymous lambda timers with named functions
* lisp/emacs-lisp/eldoc.el (eldoc--update, eldoc-schedule-timer):
* lisp/jit-lock.el (jit-lock-context--update)
(jit-lock--antiblink-update): New functions broken out from...
* lisp/emacs-lisp/eldoc.el (eldoc-schedule-timer):
* lisp/jit-lock.el (jit-lock-mode, jit-lock--antiblink-post-command):
...here. Use them as values for timers, to give them readable names
in 'M-x list-timers'. (Bug#71354)
Eli Zaretskii [Mon, 3 Mar 2025 19:08:35 +0000 (21:08 +0200)]
Fix MS-Windows build broken by buffered_input_event changes
* src/keyboard.c (kbd_buffer_store_selection_event_hold):
* src/keyboard.h (kbd_buffer_store_selection_event_hold): Declare
and define only for (HAVE_X11 || HAVE_PGTK).
Juri Linkov [Mon, 3 Mar 2025 18:38:40 +0000 (20:38 +0200)]
Improve treesit settings for js-ts-mode (bug#73404)
* lisp/progmodes/js.el (js--treesit-font-lock-settings):
Add 'class' alongside 'class_declaration'.
(js--treesit-defun-name): Add "variable_declaration"
alongside "lexical_declaration".
(js--treesit-valid-imenu-entry): Add "variable_declaration"
and provide the predicate to 'treesit-node-top-level'.
(js--treesit-sentence-nodes): Add "jsx_attribute" like in html-ts-mode
instead of jsx elements matched in 'js--treesit-list-nodes'.
(js--treesit-list-nodes): Add "jsx_element" and "jsx_self_closing_element"
instead of "_jsx_string".
(js--treesit-simple-imenu-settings): Move "method_definition" to separate
section "Method" from the "Class" section. Add "variable_declaration"
to the "Variable" section.
(js-ts-mode--outline-predicate): New variable.
(js--treesit-defun-type-regexp): Add bos/eos.
(js--treesit-jsdoc-comment-regexp): Add bos/eos.
(js-ts-mode): Set treesit-outline-predicate to
'js-ts-mode--outline-predicate'.
* lisp/textmodes/mhtml-ts-mode.el (mhtml-ts-mode--html-defun-name):
Remove unused function.
(mhtml-ts-mode): Use 'js-ts-mode--outline-predicate' in
'treesit-aggregated-outline-predicate'.
* lisp/textmodes/yaml-ts-mode.el (yaml-ts-mode--outline-predicate):
Use 'treesit-node-top-level' instead of 'treesit-parent-until'.
Stefan Kangas [Mon, 3 Mar 2025 17:37:43 +0000 (18:37 +0100)]
Fix fontification outside hunks in Git patches
* lisp/vc/diff-mode.el (diff-font-lock-keywords): Don't fontify lines in
Git patches starting with + or - as added/removed, if they are either
before the first hunk, or in the email signature. (Bug#75884)
(diff-buffer-type): Move definition up.
(diff--indicator-added-re, diff--indicator-removed-re): New variables.
(diff--git-preamble-end, diff--git-footer-start)
(diff--indicator-matcher-helper, diff--indicator-added-matcher)
(diff--indicator-removed-matcher): New functions.
* test/lisp/vc/diff-mode-tests.el (diff-mode-test-git-patch)
(diff-mode-test-git-patch/before-first-hunk)
(diff-mode-test-git-patch/signature): New tests.
* test/lisp/vc/diff-mode-resources/git.patch: New file.
Paul Eggert [Mon, 3 Mar 2025 17:32:08 +0000 (09:32 -0800)]
Avoid some union buffered_input_event uses
Simplify by using separate local vars for struct input_event and
struct selection_input_event, rather than a single local var that
is the union of the two. This makes the code easier to follow by
the human reader, and should help avoid GCC bug 117423
<https://gcc.gnu.org/bugzilla/show_bug.cgi?id=117423> and
therefore work around Emacs bug 76559 <https://bugs.gnu.org/76559>.
* src/androidterm.c (handle_one_android_event):
* src/gtkutil.c (xg_widget_key_press_event_cb):
* src/pgtkterm.c (evq_flush):
* src/xterm.c (handle_one_xevent): Use struct input_event and
kbd_buffer_store_event_hold, or struct selection_input_event and
kbd_buffer_store_selection_event_hold, rather than union
buffered_input_event and union buffered_input_event.
* src/keyboard.c (beware_long_paste, maybe_quit_while_no_input):
New functions, broken out from kbd_buffer_store_buffered_event.
(kbd_buffer_store_event_hold): Define here, with a simplified
version of the body of the old kbd_buffer_store_buffered_event,
rather than defining in keyboard.h. Specialize to struct
input_event.
(kbd_buffer_store_selection_event_hold): New function; it is
a simplified version of the old kbd_buffer_store_buffered_event,
specialized to struct selection_input_event.
(is_ignored_event_kind): Accept enum event_kind instead of
union buffered_input_event. All callers changed.
* src/keyboard.h (kbd_buffer_store_event_hold):
Remove definition, as keyboard.c now defines it.
* src/pgtkterm.c (evq_grow_if_needed): New function.
(evq_enqueue, evq_selection_enqueue): Two functions now,
not one. Args are now struct input_event const * or
struct selection_input_event const *, not
union buffered_input_event *. All callers changed.
This lets us simplify the callers so that they need
not use the union.
Yuan Fu [Mon, 3 Mar 2025 04:26:28 +0000 (20:26 -0800)]
Don't process function range settings in treesit--update-range-1
This fixes a bug where we call treesit-query-language on a
function, which happens before the QUERY in a range setting can
be either a function or a query, but we call it with
treesit-query-language before knowing whether it's a query or
function.
* lisp/treesit.el:
(treesit--update-range-1): Skip function range settings.
(treesit-update-ranges): Handle function range settings here.
* lisp/progmodes/eglot.el (eglot-client-capabilities): Set
window/showMessage/messageActionItem/additionalPropertiesSupport to t.
(eglot-handle-request window/showMessageRequest): Return the whole
selected MessageActionItem, not just its title.
* test/lisp/term-tests.el (term-line-wrap-no-auto-margins): add test
* lisp/term.el (term-auto-margins): new variable
(term-mode): documentation
(term-termcap-format): mention auto-margins flag
(term-emulate-terminal): support it
(term-reset-terminal): reset it
(term-handle-ansi-escape): notice it
* etc/e/eterm-color.ti: add auto margin capability
Juri Linkov [Sun, 2 Mar 2025 18:44:40 +0000 (20:44 +0200)]
Adapt recent css-ts-mode changes to mhtml-ts-mode
* lisp/textmodes/css-mode.el (css--treesit-thing-settings):
(css-ts-mode--outline-predicate): New variables.
(css-ts-mode): Set treesit-outline-predicate.
* lisp/textmodes/mhtml-ts-mode.el (mhtml-ts-mode--treesit-thing-settings):
Use css--treesit-thing-settings and css--treesit-defun-type-regexp.
(mhtml-ts-mode): Use 'css-ts-mode--outline-predicate' for
'treesit-aggregated-outline-predicate'.