* lisp/bs.el (bs-delete):
* lisp/dired-aux.el (dired-show-file-type):
* lisp/emulation/viper-cmd.el (viper-insert-prev-from-insertion-ring):
* lisp/man.el (Man-fontify-manpage, Man-cleanup-manpage):
* lisp/net/mailcap.el (mailcap-parse-mailcap):
* lisp/progmodes/antlr-mode.el (antlr-insert-makefile-rules):
* lisp/textmodes/reftex-ref.el (reftex-reference):
* lisp/vc/emerge.el:
* lisp/woman.el (woman-man-buffer):
* test/src/fns-tests.el (fns-tests-hash-buffer):
Replace some calls to backward-delete-char with delete-char (negating
the argument) since the former is intended for interactive use.
This silences most of the interactive-only warnings.
* lisp/emacs-lisp/bytecomp.el (byte-compile-form):
* lisp/help-fns.el (help-fns--interactive-only): Fix obvious mistake.
Since `interactive-only` is not supposed to be anything other than
a symbol at these points it was not a very consequential bug.
Detect and prevent function alias loops in `fset` and `defalias`
Make `fset` and `defalias` signal an error on attempts to create
circular alias chains. This is more effective, efficient and
convenient than permitting alias loops to be created and trying to
detect them at run time each time a function is called, which is what
we have been doing until now, badly.
Stefan Kangas [Tue, 21 Feb 2023 09:32:42 +0000 (10:32 +0100)]
; Merge from origin/emacs-29
The following commits were skipped:
a5b5f73d886 xref--insert-xrefs: Use 'shadow' for the line number colon 6b908773599 * lisp/progmodes/xref.el (xref--insert-xrefs): Remove ext... 25c65e6b586 Backport: Fix xref-clear-marker-stack refactoring mistake
In one form or another, the reports point out that the multiple pieces
of information about the "thing at point" made available by the LSP
server are not all being considered by the ElDoc system.
The reason for this is Eglot setting/trampling the variables
'eldoc-documentation-strategy' and 'eldoc-documentation-functions' in
its minor more entry function.
The reason it did that is historical and is partially described in the
issues above. But, evidently, it never made much sense, because so
many people want to override it, which requires setting
'eldoc-documentation-strategy' to the non-default value
'eldoc-documentation-compose'.
The problem was made worse by the fact that setting it as usual in
either the Customize menu or their init file didn't work, requiring a
fairly complex Elisp snippet. That is now solved as of this commit.
If the user does not do any setting, then Eglot works basically the
same as before (i.e. shows only one piece of information).
It is arguable that the default value for
'eldoc-documentation-strategy' should change globally to
'eldoc-documentation-compose', but that has other subtle implications
and is not part of this commit.
* lisp/progmodes/eglot.el (eglot--managed-mode): Don't set Eldoc
variables greedily.
Daniel Martín [Sun, 19 Feb 2023 21:57:54 +0000 (22:57 +0100)]
Add declaration_list to c-ts-common-indent-type-regexp-alist
* lisp/progmodes/c-ts-mode.el (c-ts-base-mode): Consider a
"declaration_list" a block. (Bug#61635)
* test/lisp/progmodes/c-ts-mode-resources/indent.erts (Code): Add a
test case.
Now prev-adaptive-prefix looks at the current line and checks if it
begins with a prefix itself. If it does, prev-adaptive-prefix tries
to place the anchor before the prefix on the previous line, rather
than after it.
- prev line
- this line -> This line starts with a "-", i.e., begins with a
prefix, so we place the anchor at the beginning of the
"-" of the previous line, rather than after it
- prev line
this line -> This line doesn't start with a prefix, so the anchor
is placed after the previous line's "-".
* doc/lispref/modes.texi (Parser-based Indentation): Update manual.
* lisp/treesit.el:
(treesit-simple-indent-presets): Add local variable
this-line-has-prefix, base what anchor to return on the value of
this-line-has-prefix and whether the prev line has a prefix.
We can use the fact that 'treesit-indent-1' uses 'treesit-node-on'
when on a whitespace to set the actual current node as parent. Now we
can correctly indent the 'jsx_text' nodes. We also add some more
electric-indent-chars so that auto-indenting of jsx behaves a little
more fluently.
* lisp/progmodes/js.el (js--treesit-indent-rules): Add new rules.
(js-ts-mode): Add more indent-chars.
* lisp/progmodes/typescript-ts-mode.el
(typescript-ts-mode--indent-rules): Add new rules.
* lisp/progmodes/typescript-ts-mode.el
(typescript-ts-base-mode): Add more indent-chars and layout rules.
* lisp/progmodes/c-ts-mode.el (c-ts-mode--indent-styles): Make sure we
indent to great-grand-parent if inside an #ifdef...#endif block. If
grand-parent is root node, then don't indent one step.
(c-ts-mode--preproc-offset): New helper anchor function to calculate
indent offset.
Add comment style toggle for c-ts-mode (bug#61550)
* lisp/progmodes/c-ts-mode.el (c-ts-mode-toggle-comment-style): New
command.
(c-ts-base-mode-map): Add binding.
(c-ts-mode-set-modeline): New function.
(c-ts-mode): Set modeline.
(c++-ts-mode): Set modeline.
Dmitry Gutov [Sun, 19 Feb 2023 17:18:19 +0000 (19:18 +0200)]
rust-ts-mode--font-lock-settings: Avoid the explicit 'default' face
* lisp/progmodes/rust-ts-mode.el (rust-ts-mode--fontify-scope)
(rust-ts-mode--fontify-tail): New functions.
(rust-ts-mode--font-lock-settings): Use them instead of a lot of
more complex queries (bug#61302). Thus avoid having to create
block fontification by other features using the 'default' face.
Replace the catch-all query for 'variable' with an enumeration of
possible parent nodes.
Alan Mackenzie [Sun, 19 Feb 2023 16:09:32 +0000 (16:09 +0000)]
imenu: Make the test for a single category of map (e.g. "Class") rigorous
This fixes bug #61629.
* lisp/imenu.el (imenu--mouse-menu): Test (consp (cdadr menu)) to avoid
confusion with a single entry for a single function.
(imenu-update-menubar): Change the code to match that above.
Eglot: improve treatment of completion items without :sortText (bug#61532)
Previously, defaulting to the empty string put candidates without
:sortText to the top of the list. since string-lessp is safe with nil
arguments, this makes them sort to the end instead.
Eli Zaretskii [Sun, 19 Feb 2023 09:29:32 +0000 (11:29 +0200)]
Fix invocation of File->Close from the menu bar
* lisp/simple.el (kill-buffer--possibly-save): Don't request
LONG-FORM from 'read-multiple-choice' if GUI dialog should be
used.
* lisp/emacs-lisp/rmc.el (read-multiple-choice): Doc fix.
(read-multiple-choice--short-answers): Don't append "?" to
CHOICES and don't display the prompt in the echo area if GUI
dialog is used. Use 'use-dialog-box-p'. (Bug#61553)
Eli Zaretskii [Sun, 19 Feb 2023 09:04:57 +0000 (11:04 +0200)]
; Improve documentation of 'native-comp-enable-subr-trampolines'
* doc/lispref/compile.texi (Native-Compilation Variables):
Document the interpretation of non-absolute directory names that
are the value of 'native-comp-enable-subr-trampolines'.
Stefan Monnier [Sat, 18 Feb 2023 17:56:24 +0000 (12:56 -0500)]
Don't rely on dynamic scoping to fix bug#59213
Rather than look up a dynamically scoped var to decide whether to trim
closures, use an ad-hoc marker on those closures which should not be trimmed.
* lisp/emacs-lisp/cconv.el (cconv-dont-trim-unused-variables): Delete var.
(cconv-make-interpreted-closure): Use a `:closure-dont-trim-context`
markers instead.
* lisp/emacs-lisp/edebug.el (edebug-make-enter-wrapper): Use
`:closure-dont-trim-context` rather than `cconv-dont-trim-unused-variables`.
* lisp/emacs-lisp/testcover.el (testcover-analyze-coverage): Remove
workaround for `cconv-dont-trim-unused-variables`.
* test/lisp/emacs-lisp/cconv-tests.el (cconv-safe-for-space): New test.
Michael Albinus [Sat, 18 Feb 2023 17:27:56 +0000 (18:27 +0100)]
Improve Tramp's user and host name completion
* lisp/net/tramp.el (tramp-completion-handle-file-exists-p):
Improve user name completion.
(tramp-skeleton-file-exists-p): New defmacro, which also handles
host name completion.
(tramp-handle-file-exists-p):
* lisp/net/tramp-adb.el (tramp-adb-handle-file-exists-p):
* lisp/net/tramp-sh.el (tramp-sh-handle-file-exists-p):
* lisp/net/tramp-sudoedit.el (tramp-sudoedit-handle-file-exists-p):
Use it.
martin rudalics [Sun, 12 Feb 2023 09:33:11 +0000 (10:33 +0100)]
Fix 'display-buffer-use-least-recent-window'
* src/window.c (Fwindow_use_time): Doc fix.
(Fwindow_bump_use_time): Bump use time of the seleceted window as
well. Doc fix.
* lisp/window.el (display-buffer-avoid-small-windows): Remove.
All users changed.
(window--display-buffer): Bump window use time when requested.
(display-buffer--lru-window): New function.
(display-buffer-use-some-window): Use it.
(display-buffer-use-least-recent-window): Rewrite and enhance doc
string.
* doc/lispref/windows.texi (Selecting Windows)
(Buffer Display Action Functions, Buffer Display Action Alists)
(The Zen of Buffer Display): Improve and update documentation of
window selection and display facilities.
andrés ramírez [Mon, 13 Feb 2023 15:02:52 +0000 (15:02 +0000)]
Allow disabling viper faces in the minibuffer
* lisp/emulation/viper-cmd.el (viper-enable-minibuffer-faces): New
defcustom.
(viper-set-mode-vars-for): Use it to decide whether to use
distinct faces in the minibuffer. (Bug#61432)
kobarity [Mon, 13 Feb 2023 15:30:15 +0000 (00:30 +0900)]
Fix point moving when calling python-shell-send-region
* lisp/progmodes/python.el (python-shell-buffer-substring): Add
`save-excursion' to prevent the point from moving.
* test/lisp/progmodes/python-tests.el (python-tests-should-not-move):
New helper function to assert that point does not move while calling a
function.
(python-shell-buffer-substring-*): Use
`python-tests-should-not-move'. (Bug#61463)
Eli Zaretskii [Sat, 18 Feb 2023 11:40:56 +0000 (13:40 +0200)]
Fix cursor motion when there's line-prefix and display string at BOL
* src/xdisp.c (move_it_in_display_line_to): Handle 'line-prefix' and
'wrap-prefix' when the screen line has a display string at its
beginning. (Bug#61580)
Yuan Fu [Sat, 18 Feb 2023 10:20:12 +0000 (02:20 -0800)]
Fix comment in treesit_record_change (bug#61369)
Turns out the previous commit message and comment is not entirely
correct: the old behavior is in fact wrong, not just "correct but has
problems".
Here is why the old code is wrong:
|visible range| -> markup for visible range
updated range -> markup for updated range
-------------
First we have some text
|aaaaaa|
Now we insert something at the beginning, because we clip
new_end_offset to visible_end, out of eight b's inserted, only the
first six are known to tree-sitter.
Stefan Kangas [Sat, 18 Feb 2023 09:45:46 +0000 (10:45 +0100)]
Merge from origin/emacs-29
1769a588300 Fix some uses of 'use-dialog-box' deef41a8259 Fix hi-lock-tests when 'use-dialog-box' is non-nil 5093a534960 Fix regression due to change in face sort order by 'face-... 3e747630999 * lisp/files.el (file-equal-p): Work around Haiku stat bug. 13fd7667f9c ; * src/treesit.c: Improve sectioning. a40b1745d4a (project-vc-backend-markers-alist): Add entry for vc-got 18e96ed7c8a project.el: Extract backend->marker association for a defvar 0a5615669a4 Don't completely clip into visible range in treesit_recor... 5b34fc07085 * lisp/treesit.el (treesit-node-at): Update docstring (bu... 1c7d7623781 ; Minor copyedit of NEWS wrt *-ts-modes 09fad246de8 * lisp/calc/calc.el (calc-mode): Improve docstring. 8aad8d75aa9 ; Improve and update documentation of native compilation d6e4f243720 Merge 'emacs-29' into 'feature/inhibit-native-comp-cleanup' a555abc56d5 Fix order of faces in 'face-list' b44a7ff85dc Allow 'icon-title-format' to have the value t f1f571e72ae Add electric indent for preproc directives 83af806ab7c Rename 'emacs-news-toggle-tag' to 'emacs-news-cycle-tag' 5bc88b3b175 Add menu to news-mode 40f4bc4e0aa ; Avoid installing VC package dependencies multiple times 1c9d81a2b42 Attempt to recognise if a VC package has no Elisp files 2550e8bb0b0 Fix mule-tests under en_US.UTF-8 locale 32795309939 Move block closer above declaration_list rule (bug#61531) b18754bb179 Minor improvements in c-ts-mode and docs 3c6b726a7b4 Add super node as a keyword 1917c51fe68 ; Prevent ERC-induced false positive in JUnit report b16965ef7e6 Delete perplexing paragraph from Gnus manual 43c62a4732d ; Fix typo fdac69b45e6 ; Auto-commit of loaddefs files. 7678b7e46f2 Eglot: check server capability before sending didSave (bu... a3a1ef7bd5e Fix rust-ts-mode type and module highlighting (Bug#61302) 477aa047ee7 rust-ts-mode: Highlight variable reassignments 5206a551c16 Improve backward compatibility of save-restriction accd88d5545 Don't indent template_string contents (bug#61503) d97a3839967 csharp-ts-mode: fontify compiler directives (bug#61512) 420d2cae846 Update to Transient v0.3.7-209-gdab1dfa a3751b5d0c1 ; Raise an error if a VC package checkout is empty 6a32ba8b69c ; Fix the installation of dependencies for VC packages 4eac80fcc39 ; Prepare to update ERC version to 5.5 4f099a72173 ; Remove failing erc-reuse-buffers test ce4a066ed1e * Generate trampolines in a temporary directory if no oth... 4bb27a5ca93 ; Minor docs copyedits 13bcff3da5c Merge branch 'emacs-29' of git.savannah.gnu.org:/srv/git/... 3d572ae0d50 Rename with/without-narrowing to with/without-restriction d806b0e33cf * lisp/repeat.el: Rename internal function and variable (... 1a64f326e0a * Fix previous change 95692f6754c Rename native-comp-deferred-compilation-deny-list 8d8464bd5a9 Rename native-comp-deferred-compilation into native-comp-... 5d0912f1445 Rename comp-enable-subr-trampolines into native-comp-enab... dd8b720ee74 ; * etc/NEWS: Fix typos. 909bd04cf5f ; * lisp/calendar/lunar.el: Add comments. (bug#61460) 10f2aedea9a ; * lisp/progmodes/c-ts-mode.el (c-ts-base-mode): delete ... abfd00e5c02 * lisp/emacs-lisp/comp.el (native-comp-never-optimize-fun... 1795839babc Support `comp-enable-subr-trampolines' as string value 865758130a1 ; * admin/git-bisect-start: Update failing commits b948d0d7efe Merge branch 'scratch/fix-locked-narrowing' b6e2799aa1c * Some more `inhibit-native-compile' clean-up dcb2379a463 Minor improvements to labeled narrowing c0681cd3477 Revert "Add new variable 'inhibit-native-compilation'" 3969a34fa1b Revert "Rename to inhibit-automatic-native-compilation" 4297039bd13 Save and restore the absence of narrowing locks 2956e54b1dd Add an extensive test for labeled (locked) narrowing 79ce185ad13 Update the documentation about labeled (locked) narrowing a6cd4553d48 Rename two long line optimizations variables 0d73e4aa261 Add specific symbols for narrowings d8438e2bb44 Add 'without-narrowing' macro 97314447e60 Make 'narrowing-lock' and 'narrowing-unlock' internal a4aa32bdfff Fix 'save-restriction' for narrowing locks
Eli Zaretskii [Sat, 18 Feb 2023 08:58:00 +0000 (10:58 +0200)]
Fix some uses of 'use-dialog-box'
* lisp/frame.el (display-mouse-p): Fix return value on MS-Windows
in batch invocations.
* lisp/hi-lock.el (hi-lock-unface-buffer): Don't consider
'last-nonmenu-event' being nil as a mouse event, for the purpose
of using dialog boxes.
Eli Zaretskii [Sat, 18 Feb 2023 07:37:34 +0000 (09:37 +0200)]
Fix regression due to change in face sort order by 'face-list'
* lisp/faces.el (x-create-frame-with-faces): Undo reversing of
the face list, which is no longer necessary, since 'face-list's
sorting order has been reversed recently. (Bug#61521)
Yuan Fu [Fri, 17 Feb 2023 22:21:49 +0000 (14:21 -0800)]
Don't completely clip into visible range in treesit_record_change
(Bug#61369)
From
min (visible_end, max (visible_beg, new_end_byte)) - visible_beg
to
max (visible_beg, new_end_byte) - visible_beg
* src/treesit.c (treesit_record_change): We don't clip the new end
into the visible range anymore. If you think of it, when inserting in
a narrowed region, the visible region is always extended to
accommodate more text, rather than pushing text at the end to keep the
size of the visible region.
Stefan Kangas [Fri, 17 Feb 2023 21:50:13 +0000 (22:50 +0100)]
Use more recent public_suffix_list.dat where possible
* lisp/url/url-domsuf.el (url-domsuf--public-suffix-file): New
function to look for a more recent version of public_suffix_list.dat
on the system than the one that is shipped with Emacs.
(url-domsuf-parse-file): Use above new function.
* test/lisp/url/url-domsuf-tests.el
(url-domsuf--public-suffix-file): New test.
Ulrich Müller [Thu, 16 Feb 2023 19:09:22 +0000 (20:09 +0100)]
; Adjust limit for eclipse in calendar; rename a function
* lisp/calendar/lunar.el (lunar-check-for-eclipse): Renamed from
'eclipse-check'; thanks to Michael Heerdegen for the suggestion.
Add missing documentation string. Slightly adjust the upper limit
for the distance from the node. (bug#61460)
* test/lisp/calendar/lunar-tests.el
(lunar-test-check-for-eclipse): Update accordingly.
Alan Mackenzie [Fri, 17 Feb 2023 17:31:17 +0000 (17:31 +0000)]
Make the byte compiler give correct warning positions in eval-and-compile
This fixes bug #61579.
* lisp/emacs-lisp/bytecomp.el (byte-compile-initial-environment): Remove a
spurious `byte-run-strip-symbol-position' from the core form of the
eval-and-compile element.
Move side-effect-free and pure declarations to function definitions
Some Lisp functions still had their `side-effect-free` and `pure`
properties declared in byte-opt.el; do it at their definition instead.
The lists in byte-opt.el now only contain functions implemented in C
and function aliases.