1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2026-01-24 13:32:41 -08:00
Commit graph

177151 commits

Author SHA1 Message Date
Tassilo Horn
34362a2a1c doc-view: Fix error during revert in editing mode
When in editing mode in a doc-view buffer and then reverting (which can
happen automatically when editing OpenDocument contents), we errored in
the advide function doc-view--revert-buffer because the local
doc-view--buffer-file-name has been killed when switching to the editing
mode.

Also restore doc-view-minor-mode after reverting during being in the
editing mode.

* lisp/doc-view.el (doc-view--revert-buffer): Check that
'doc-view--buffer-file-name' is non-nil.
(doc-view-minor-mode): Add re-enabling function to
'revert-buffer-restore-functions'.
2025-03-01 13:47:19 +01:00
Trevor Murphy
b6efedd66a Ignore dedicated windows in 'display-buffer-reuse-mode-window'
Ignore the dedicated windows unless the dedicated window is
already displaying the buffer-to-be-displayed.  In that case,
the window may be reused, according to the setting of
'inhibit-same-window'.
* lisp/window.el (display-buffer-reuse-mode-window): Check
'window-dedicated-p' before pushing the candidate window onto
the stack.  (Bug#76216)
2025-03-01 13:59:13 +02:00
Eli Zaretskii
cabbb36ae1 Save IELM input history on "C-c C-c"
* lisp/ielm.el (ielm--write-history-on-interrupt): New function.
(inferior-emacs-lisp-mode): Install it as buffer-local value of
the 'interrupt-process-functions' hook.  (Bug#76585)

* etc/NEWS: Announce the behavior change.
2025-03-01 10:27:17 +02:00
Eli Zaretskii
61320784ed Add a portable test for ffap parsing path-style directory lists
* test/lisp/ffap-tests.el (ffap-test-path-unix): Renamed from
'ffap-test-path'.
(ffap-test-path-portable): New test, which should work on all
systems.
2025-03-01 10:12:21 +02:00
Łukasz Stelmach
bc33b70b28 Fix handling of delta values with negative month field
* lisp/calendar/time-date.el (decoded-time-add): If the new
variable is less then zero, the year needs to be decremented
by quotient of new and 12 increased by one.
* test/lisp/calendar/time-date-tests.el (test-decoded-add):
Add applicable test cases.  (Bug#68969)
2025-03-01 04:38:06 +01:00
Stefan Kangas
c0ca272bd7 grep: Signal error if unable to access directory
* lisp/progmodes/grep.el (lgrep, rgrep): grep: Signal error if unable to
access directory, instead of just trying to use default-directory,
because that level of DWIMishness is confusing.  (Bug#71078)
2025-03-01 03:24:48 +01:00
Stefan Kangas
22c9874760 ; Fix an interactive spec (Bug#71373) 2025-03-01 03:10:35 +01:00
Stefan Kangas
77f597ee3d Make '(setf (process-get ...) VAL)' return VAL
* lisp/emacs-lisp/gv.el (process-get): Return only the last value
when set as a generalized variable.  (Bug#76643)
2025-03-01 02:11:24 +01:00
Stefan Monnier
1cfbbcfaf6 * test/src/editfns-tests.el (editfns--replace-region): New test
This test fails, sadly, because `replace-buffer-contents` is not
careful enough to something like `replace_range`.
2025-02-28 17:10:56 -05:00
Stefan Monnier
5f165caf31 (internal--c-header-file-path): Move to ffap.el
This function is used so rarely that it's really best not to
preload it.

* lisp/ffap.el (ffap-url-regexp): Precompute.
(ffap-c-path): Use `ffap--c-path`.
(ffap--gcc-is-clang-p, ffap--c-path): Move and rename from subr.el's
* lisp/subr.el (internal--gcc-is-clang-p)
(internal--c-header-file-path): Move to ffap.el and rename.

* lisp/man.el (Man-header-file-path): Default to a new value that
delegates to ffap.
(Man-header-file-path): Obey that new value.

* lisp/emacs-lisp/ert-x.el (ert-gcc-is-clang-p): Use `ffap--gcc-is-clang-p`.

* test/lisp/ffap-tests.el (ffap-tests--c-path)
(ffap-tests--c-path/gcc-mocked, ffap-tests--c-path/clang-mocked):
Move and rename from `subr-tests.el`.
* test/lisp/subr-tests.el (subr-tests-internal--c-header-file-path)
(subr-tests-internal--c-header-file-path/gcc-mocked)
(subr-tests-internal--c-header-file-path/clang-mocked):
Move to `ffap-tests.el` and rename.
2025-02-28 17:03:21 -05:00
Stefan Kangas
678fdcc165 ; Grammar fixes for "native-compiled"
1. Prefer "native-compiled" to "native compiled".
The adjective "native-compiled" with the hyphen is generally more
consistent with the typical pattern in English, especially when the
compound modifies a noun (e.g., "native-compiled code").

2. Prefer "natively compiled" to "natively-compiled".
The adverb "natively" modifies "compiled", and it is standard not
to hyphenate an adverb + adjective combination when the adverb ends
in -ly (e.g., "code that is natively compiled").

For example, note that we say "high-speed internet" but "highly
performant code".

* Makefile.in (dest):
* configure.ac (HAVE_NATIVE_COMP):
* doc/emacs/building.texi (Lisp Libraries):
* doc/lispref/compile.texi (Native Compilation)
(Native-Compilation Functions, Native-Compilation Variables):
* doc/lispref/functions.texi (What Is a Function, Declare Form):
* doc/lispref/loading.texi (How Programs Do Loading, Library Search):
* etc/NEWS:
* etc/NEWS.28:
* etc/NEWS.29:
* etc/NEWS.30:
* lisp/emacs-lisp/comp-common.el (native-comp-never-optimize-functions)
(comp-function-type-spec):
* lisp/emacs-lisp/comp-cstr.el:
* lisp/subr.el (locate-eln-file):
* src/comp.c (SETJMP_NAME, syms_of_comp):
* src/data.c (Fsubrp, Fnative_comp_function_p, Fsubr_native_lambda_list):
* src/lread.c (Fload):
* src/pdumper.c (dump_do_dump_relocation):
* test/src/comp-tests.el (lambda-return2): Avoid grammatically incorrect
variations on "natively compiled" and "native-compiled".  (Bug#56727)
2025-02-28 20:20:55 +01:00
Eshel Yaron
0b0bf7c07f
(completion-preview-sort-function): Refine ':type'.
* lisp/completion-preview.el
(completion-preview-sort-function): Add some specific sort
functions as available choices for this user option.

Suggested by Robert Pluim <rpluim@gmail.com>.
2025-02-28 19:05:29 +01:00
Stefan Kangas
3a5cf24735 ; Silence byte-compiler during bootstrap 2025-02-28 18:57:17 +01:00
Stefan Kangas
85ef06392a ; * lisp/subr.el (apply-partially): Fix last commit.
(I accidentally pushed an old version of the patch.)
2025-02-28 18:37:27 +01:00
Stefan Kangas
2435749efa Add compiler macro to apply-partially
* lisp/subr.el (apply-partially): Add compiler macro.
2025-02-28 18:33:10 +01:00
Stefan Kangas
8b659313b8 Lift widget functions from C to Lisp
In the mid-1990s, these functions were moved from Lisp to C to
"improve performance".  However, Moore's Law, and perhaps other
improvements too, has made this rationale irrelevant.

On this machine, with --native-compilation=no, I observed only a
slight ~4% performance difference.  For example, displaying a buffer
full of widgets (e.g., 'M-x customize RET browse-url RET') takes 4ms
here, meaning the performance gap is under 0.1ms.  Even on less
powerful machines, this difference would remain imperceptible.  Given
this, let's lift these functions back to to Lisp, which offers the
usual benefits.

We already have solid test coverage, but let's add a more focused test
for 'widget-get' and 'widget-put' to be thorough.

* lisp/wid-edit.el (widget-put, widget-get, widget-apply): Move to
Lisp from...
* src/fns.c (Fwidget_put, Fwidget_get, Fwidget_apply): ...here.
(syms_of_fns): Remove defsubrs for the above functions.
* test/lisp/wid-edit-tests.el
(widget-test-editable-field-widget-get/put): New test.
2025-02-28 18:32:28 +01:00
Michael Albinus
92a8d24e49 ; Adapt last change 2025-02-28 17:47:42 +01:00
Eli Zaretskii
68a37760de Fix the values and documentation of 'printable-chars' table
* src/character.c (syms_of_character) <printable-chars>: Doc fix.

* lisp/international/characters.el (printable-chars): Fix values
for non-ASCII characters.

* doc/lispref/nonascii.texi (Character Properties): Add
cross-reference for what is a printable character.
* doc/lispref/display.texi (Usual Display):
* doc/lispref/searching.texi (Char Classes): Add indexing.
(Bug#76611)
2025-02-28 16:22:30 +02:00
Po Lu
18c8c44bef Adapt process-tests to Android
* src/android.c (android_init_thread_events)
(android_run_select_thread): Guarantee that the select thread is
initialized before returning.

* test/src/process-tests.el
(process-tests/fd-setsize-no-crash/make-process)
(process-tests/fd-setsize-no-crash/make-pipe-process)
(process-tests/fd-setsize-no-crash/make-network-process)
(process-tests/fd-setsize-no-crash/make-serial-process): Skip on
Android.
2025-02-28 21:06:48 +08:00
Eli Zaretskii
a04e8812ee Fix 'internal--c-header-file-path'
* lisp/subr.el (internal--c-header-file-path): Fix for MS-Windows:
don't prepend the (usually non-existent) "/usr/include", and run
each directory through 'expand-file-name' to remove the many ".."
elements and mirror any backslashes.  Invoke "clang" if "gcc" is
not available or is actually clang.

* test/lisp/subr-tests.el
(subr-tests-internal--c-header-file-path): Fix for MS-Windows:
test the path by looking for stdio.h, and expand all directory
names to compare to expected results.
2025-02-28 14:45:39 +02:00
Po Lu
387dcb1be8 ; * etc/NEWS: Announce previous change. 2025-02-28 19:54:46 +08:00
Po Lu
8df582a468 Fully support Lisp threads on Android
* src/android.c (struct android_thread_event_queue): New
structure.  Move global pselect arguments, mutexes, and
semaphores, and pipes here.
(struct android_event_queue) <select_mutex, select_thread>:
Remove to the above-named struct.
(android_init_thread_events, android_finalize_thread_events)
(android_get_poll_thread): New functions.
(android_run_select_thread): Accept a set of mutexes and
thread-local data as the first argument, and operate with them
rather than globals.
(android_handle_sigusr1): Rename to
`android_handle_poll_signal'.  Set thread-specific cancellation
indicator.
(android_init_events): Properly abort after a fatal condition.
Enable interruptible polling on Android 5.1 and later, not 4.2.
(android_select): Never check for queries here, but in
thread_select, if threads are enabled.  Adapt to per-thread
polling threads and only enable interruptible polling on Android
5.1 and later.
(android_before_select): New function.

* src/android.h (android_before_select): New declaration.

* src/thread.c (thread_select): Call `android_before_select'
before the global lock is released.
2025-02-28 19:54:46 +08:00
Eshel Yaron
8b9194ae03
Make 'completion-preview-sort-function' a defcustom
* lisp/completion-preview.el
(completion-preview-sort-function): Define and document it
as a user option.
* etc/NEWS: Announce.
2025-02-28 12:07:31 +01:00
Michael Albinus
5447b015a4 * lisp/net/tramp.el (tramp-mode): Set to nil on MS-DOS. 2025-02-28 10:38:04 +01:00
Eli Zaretskii
75a314dc8a ; Recommend not to use -O3 in production builds
* nt/INSTALL:
* INSTALL: Recommend not to use -O3 and -Os in ordinary production
builds.  (Bug#76559)
2025-02-28 09:35:05 +02:00
Eli Zaretskii
6ed119d305 ; Fix documentation of recent treesit changes
* src/treesit.c (Ftreesit_query_capture)
(Ftreesit_parser_embed_level, Ftreesit_parser_set_embed_level)
(Ftreesit_parser_set_parent_node):
* lisp/treesit.el (treesit-query-range)
(treesit-query-range-by-language, treesit-range-settings)
(treesit-range-rules, treesit--parser-at-level)
(treesit--update-ranges-non-local, treesit--update-ranges-local)
(treesit--update-range-1): Fix wording and typos in doc strings.

* doc/lispref/parsing.texi (Pattern Matching): Fix wording.
2025-02-28 09:12:05 +02:00
Stefan Kangas
becdfb11a5 Remove Emacs 23 compat code from ox-publish.el
* lisp/org/ox-publish.el (org-publish-timestamp-filename): Remove
Emacs 23 compat code.
2025-02-28 03:05:30 +01:00
Stefan Kangas
64edd5a5eb Don't use incf/decf in eldoc.el
* lisp/emacs-lisp/eldoc.el (eldoc--invoke-strategy): Don't use incf or
decf.  This is a :core package and supports Emacs 26.3.  (Bug#76604)
2025-02-28 02:30:27 +01:00
Stefan Kangas
4ea2197f72 Add test for apply-partially
* test/lisp/subr-tests.el (subr-test-apply-partially): New test.
2025-02-28 02:30:27 +01:00
Yuan Fu
8a3e19f4b3
Support alternative range function for tree-sitter range settings
Some embedded parser needs to exclude child nodes from the
range, like markdown-inline.  So I added this keyword that
allows users to customize the range for the embedded parser.
This can also be potentially useful for markdown comments in
rust, for example, because we want to exclude the comment
starters (//) from the embedded markdown parser.

* lisp/treesit.el (treesit-query-range):
(treesit-query-range-by-language): Add new parameter RANGE-FN.
(treesit-range-settings): Add new field RANGE-FN.
(treesit-range-rules): Add new keyword RANGE-FN.
(treesit-range-fn-exclude-children): New function.
(treesit--update-ranges-non-local):
(treesit--update-ranges-local):
(treesit--update-range-1): Support the RANGE-FN field.
2025-02-27 17:22:04 -08:00
Yuan Fu
8a45c2da22
Make treesit-node-at take advantage of the embed-level property
* lisp/treesit.el (treesit-node-at): Select the local parser
with the highest embed-level.
2025-02-27 17:22:04 -08:00
Yuan Fu
1314272bf3
Rework range facility in treesit.el to support arbitrary nesting
Make use of the newly added embed-level parser property, we now
iterativeLy create/update embedded parsers at each embed level,
allowing arbitrary levels of nesting.

At the beginning, we start with the primary parser.  We query it
with each range settings, gets some ranges and their
corresponding language. Then we create the first level of
embedded parsers using the ranges and language we got.  This is
one iteration. For the next iteration/level, we start with the
embedded parsers we create/updated in the previous
iteration/level, and query each of them with each of the range
settings, creating/updating the next level of embedded parsers.
And we keep doing this until we don't get more matches from the
queries.

We now also support the :embed keyword in 'treesit-range-rules'
to be a function that returns a language.  This allows major
modes like markdown and org mode to support code blocks of which
the language isn't known ahead of time.

* lisp/treesit.el (treesit-primary-parser): Move to front.
(treesit-query-range-by-language): New function.
(treesit-range-rules): Allow :embed to be a function, update docstring.
(treesit-local-parsers-on): Update docstring.
(treesit--parser-at-level):
(treesit--update-ranges-non-local): New functions.
(treesit--update-ranges-local): Use the new logic, support
:embed being a function.
(treesit--update-range-1): New function, has the meat of
original treesit-update-ranges.
(treesit-update-ranges): Implements the iteration logic using
treesit--update-range-1 to do the actual work.
2025-02-27 17:22:04 -08:00
Yuan Fu
625b2b02a3
Enable treesit-query-capture to return grouped captures
This is needed for creating embedded parsers for embedded code
blocks of which language cannot be known ahead of time.  E.g.,
markdown and org mode's code block.

* src/treesit.c (Ftreesit_query_capture): Add parameter GROUPED.
2025-02-27 17:22:03 -08:00
Yuan Fu
30e1508ef2
Add tree-sitter-parser-embed-level and parent-node
Add parser properties embed-level and parent-node. They'll be
help us implement arbitrarily nested embeded parser, and
navigation across embedded and host parsers, respectively.

* src/treesit.c:
(Ftreesit_parser_embed_level):
(Ftreesit_parser_set_embed_level):
(Ftreesit_parser_parent_node):
(Ftreesit_parser_set_parent_node): New functions.
2025-02-27 17:22:03 -08:00
Philipp Stephani
32da093e52 Don't overwrite non-local exit symbol and data (Bug#65796).
The previous approach would incorrectly invalidate the returned module
values if another non-local exit occurred while dealing with a non-local
exit.  See Bug#65796.  Instead, allocate the values from the usual
environment storage, and return statically-allocated objects if that
fails.

* src/emacs-module.c (struct emacs_env_private): Turn non-local exit
symbol and data into normal Lisp objects.
(initialize_environment): Initialize them.
(mark_module_environment): Prevent them from being garbage-collected.
(module_signal_or_throw, module_non_local_exit_signal_1)
(module_non_local_exit_throw_1): Adapt uses.
(value_to_lisp): No longer scan for them with module assertions enabled.
(module_out_of_memory_signal, module_out_of_memory_data): New
statically-allocated module values to return in case of allocation
failure.
(syms_of_module): Initialize them.
(module_non_local_exit_get): Allocate module values normally.  If that
fails, return statically-allocated values.

* doc/lispref/internals.texi (Module Nonlocal): Document new behavior.
2025-02-28 01:45:35 +01:00
Visuwesh
ea715b0183 Recommend 'tab-bar-history-mode' over 'winner-mode'
* lisp/winner.el (winner-mode):
* lisp/tab-bar.el (tab-bar-mode): Update the docstring to
suggest 'tab-bar-history-mode' instead of 'winner-mode' when
using 'tab-bar-mode' instead.  (Bug#76439)
2025-02-27 20:15:05 +02:00
Vincenzo Pupillo
5f1a019d26 Fix CSS indentation, added support for CSS 'color_value'.
* lisp/textmodes/mhtml-ts-mode.el
(mhtml-ts-mode--colorize-css-value): Added 'color_value' node, refactoring.
(mhtml-ts-mode--treesit-font-lock-settings): Added 'color_value' node.
(mhtml-ts-mode--treesit-indent-rules): Removed the old comment and
fixed the CSS indentation rule (bug#76597).
2025-02-27 20:06:20 +02:00
Paul Nelson
3e1d7e0334 Document :continue-only in use-package Info manual
* doc/misc/use-package.texi (Binding to repeat-maps): Document
:continue-only (bug#74140).
2025-02-27 19:29:02 +02:00
Juri Linkov
dc1637fef7 Improve 'treesit-outline-search'
* lisp/treesit.el (treesit-outline-search): Add optional arg
'recursive' to avoid infinite recursion when it gets stuck.

* lisp/textmodes/markdown-ts-mode.el (markdown-ts-mode):
Set buffer-local 'treesit-outline-predicate' to "section".
2025-02-27 19:21:45 +02:00
Stephen Berman
4cc5e4ec0b Prevent a todo-mode test from running with 'make check'
* test/lisp/calendar/todo-mode-tests.el
(todo-test-add-and-delete-file): Tag this test as unstable, since
it has been reported to fail unreproducibly (bug#58473) or
reproducibly only on the ZFS filesystem (bug#76381) and the causes
are still unknown.
2025-02-27 12:13:26 +01:00
Stephen Berman
13423cd019 Prevent a todo-mode test from running with 'make check'
* test/lisp/calendar/todo-mode-tests.el
(todo-test-add-and-delete-file): Tag this test as unstable, since
it has been reported to fail unreproducibly (bug#58473) or
reproducibly only on the ZFS filesystem (bug#76381) and the causes
are still unknown.
2025-02-27 12:03:24 +01:00
Stephen Berman
f5f0ba38e0 Prevent a todo-mode test from running with 'make check'
* test/lisp/calendar/todo-mode-tests.el
(todo-test-add-and-delete-file): Tag this test as unstable, since
it has been reported to fail unreproducibly (bug#58473) or
reproducibly only on the ZFS filesystem (bug#76381) and the causes
are still unknown.
2025-02-27 12:02:24 +01:00
Po Lu
a4a458ffa4 Fix drag-and-drop treatment of reused tooltip frames
* src/androidfns.c (Fx_show_tip): Set `tip_window' to that of
any reused tooltip frame.

* src/haikufns.c (unwind_create_frame): Return whether the frame
was destroyed, as on X.
(unwind_create_tip_frame, haiku_create_frame, Fx_show_tip):
Synchronize with X.
(do_unwind_create_frame): New function.
(tip_window): Remove unused variable.

* src/nsfns.m (tip_window, unwind_create_tip_frame): Remove
unused variable `tip_window'.

* src/pgtkfns.c (pgtk_create_tip_frame): Rename to
pgtk_create_tip_frame.
(Fx_show_tip): Adjust accordingly.  Set `tip_window' to that of
any reused tooltip frame.

* src/w32fns.c (Fx_show_tip):

* src/xfns.c (Fx_show_tip): Set `tip_window' to that of any
reused tooltip frame.
2025-02-27 18:18:58 +08:00
Paul Nelson
85a9b916db Add :continue-only directive to bind-keys and use-package
* lisp/bind-key.el (bind-keys-form): Add :continue-only binding.
Fix indentation.

* lisp/use-package/use-package-bind-key.el
(use-package-normalize-binder): Add check for :continue-only.

* test/lisp/repeat-tests.el (repeat-tests-bind-keys):
Enable (and correct) test for :continue-only (bug#74140).
2025-02-27 09:33:09 +02:00
Gerd Möllmann
3de9994b9e * src/dispnew.c (rect_intersect): Fix a typo (bug#76592) 2025-02-27 07:03:51 +01:00
Eshel Yaron
0285a403e3
; * lisp/completion-preview.el: Add some commentary.
Clarify the relation of Completion Preview mode with
'completion-at-point' and in-buffer completion interfaces.
2025-02-26 21:19:58 +01:00
Eshel Yaron
50cded9c55
Add 'help-echo' hint to completion preview
* lisp/completion-preview.el
(completion-preview--propertize-for-mouse): New function.
* lisp/completion-preview.el (completion-preview--update)
(completion-preview--show)
(completion-preview-partial-insert)
(completion-preview-complete)
(completion-preview-next-candidate): Use it to propertize
completion preview text with mouse-related properties,
including a new 'help-echo' hint.
2025-02-26 20:48:07 +01:00
Eshel Yaron
68f5518d00
Simplify 'completion-preview-active-mode' command tagging
* lisp/completion-preview.el (completion-preview-insert)
(completion-preview-insert-word)
(completion-preview-insert-sexp)
(completion-preview-complete)
(completion-preview-prev-candidate)
(completion-preview-next-candidate): Use 'interactive' to
associate command with 'completion-preview-active-mode'
instead of using a bespoke 'completion-predicate' property.
(completion-preview-active-p): Declare obsolete.
2025-02-26 20:15:30 +01:00
Stefan Kangas
8c16583491 ; Whitespace fixes to silence git hooks 2025-02-26 18:11:22 +01:00
Stefan Monnier
5815bd5227 (define-ibuffer-op): Minor tweak to Shipmints's patch
* lisp/ibuf-macs.el (define-ibuffer-op): Evaluate `(active-)opstring`
args when defining the operation rather than every time the operation
is used.  Move the `:autoload-end` marker back to the level of `progn`.
2025-02-26 09:13:04 -05:00