Stefan Monnier [Thu, 21 Dec 2023 15:24:29 +0000 (10:24 -0500)]
doc/lispintro: Don't mention `set` (bug#67734)
* doc/lispintro/emacs-lisp-intro.texi (Using set): Delete.
(Using setq): Adjust accordingly.
(setq): Rename from "set & setq" and don't refer to `set` any more.
(Review): Don't mention `set` any more.
Denis Zubarev [Sat, 11 Nov 2023 22:42:42 +0000 (01:42 +0300)]
Fix an issue when searching subtree backward (bug#67117)
* src/treesit.c (treesit_traverse_child_helper):
Do not call treesit_traverse_sibling_helper when the named node is
required and the last child is the named node.
Otherwise treesit_traverse_sibling_helper will move cursor to the
previous sibling and last node will be skipped.
* test/src/treesit-tests.el (treesit-search-subtree-forward-1):
(treesit-search-subtree-backward-1):
Add tests.
Eli Zaretskii [Sat, 16 Dec 2023 13:33:02 +0000 (15:33 +0200)]
Fix shaping of Sinhala text
* lisp/language/sinhala.el (composition-function-table): Allow
U+200D U+0DCA as well as U+0DCA U+200D between consonants.
Suggested by Richard Wordingham <richard.wordingham@ntlworld.com>.
(Bug#67828)
Eli Zaretskii [Sat, 16 Dec 2023 11:25:58 +0000 (13:25 +0200)]
Fix opening directory trees from Filesets menu
In bug#976, the code was fixed, but the cautious condition in
the original author's code, which catered to invoking
'filelists-open' from the menu-bar menu, was omitted, which made
that invocation, which did work before, broken.
* lisp/filesets.el (filesets-get-filelist): Fix opening directory
trees from the Filesets menu-bar menu. (Bug#67658)
Niall Dooley [Fri, 24 Nov 2023 15:52:36 +0000 (16:52 +0100)]
Eglot: Add ruff-lsp as an alternative Python server
ruff-lsp [1] is an LSP server for Ruff [2], [3], a fast Python linter
and code formatter.
It supports surfacing Ruff diagnostics and providing Code Actions to
fix them, but is intended to be used alongside another Python LSP in
order to support features like navigation and autocompletion.
Dmitry Gutov [Tue, 12 Dec 2023 22:00:38 +0000 (00:00 +0200)]
js-ts-mode: Fix font-lock rules conflict
* lisp/progmodes/js.el (js--treesit-font-lock-settings): Move
'property' to after 'jsx'. Stop using predicate (bug#67684).
(js--treesit-property-not-function-p): Delete.
Noah Peart [Sun, 10 Dec 2023 22:58:31 +0000 (14:58 -0800)]
Add indentation rules for bracketless statements in js-ts-mode
* lisp/progmodes/js.el (js--treesit-indent-rules): Add indentation
rules to handle bracketless statements (bug#67758).
* test/lisp/progmodes/js-tests.el (js-ts-mode-test-indentation):
New test for js-ts-mode indentation.
* test/lisp/progmodes/js-resources/js-ts-indents.erts: New file
with indentation tests for js-ts-mode.
Yuan Fu [Mon, 11 Dec 2023 02:24:27 +0000 (18:24 -0800)]
Fix c-ts-mode bracketless indentation for BSD style (bug#66152)
* lisp/progmodes/c-ts-mode.el:
(c-ts-mode--indent-styles): Make sure the BSD rules only apply to
opening bracket (compound_statement), then bracketless statements will
fallback to common rules.
* test/lisp/progmodes/c-ts-mode-resources/indent-bsd.erts: Copy the
bracketless test from indent.erts to here.
Yuan Fu [Mon, 11 Dec 2023 00:23:44 +0000 (16:23 -0800)]
Fix treesit-node-field-name and friends (bug#66674)
So turns out ts_node_field_name_for_child takes a named node index,
but we were passing it normal index that counts both named and
anonymous nodes. That's what makes the field name all wrong in
treesit explorer.
* doc/lispref/parsing.texi:
(Accessing Node Information): Update docstring.
* lisp/treesit.el (treesit-node-index): Add some unrelated comment.
(treesit-node-field-name): Get named node index rather than all node
index.
* src/treesit.c (Ftreesit_node_field_name_for_child): Update
docstring, use ts_node_named_child_count.
Yuan Fu [Sun, 10 Dec 2023 09:24:25 +0000 (01:24 -0800)]
Fix c-ts-mode indent heuristic (bug#67417)
This is a continuation of the first two patches for bug#67417. The
c-ts-mode--prev-line-match heuristic we added is too broad, so for now
we are just adding a very specific heuristic for the else case.
* lisp/progmodes/c-ts-mode.el:
(c-ts-mode--prev-line-match): Remove function.
(c-ts-mode--else-heuristic): New function.
(c-ts-mode--indent-styles): Use c-ts-mode--else-heuristic.
nverno [Wed, 22 Nov 2023 00:33:04 +0000 (16:33 -0800)]
Fix c-ts-mode indentation (bug#67357)
1. In a compund_statement, we indent the first sibling against the
parent, and the rest siblings against their previous sibling. But
this strategy falls apart when the first sibling is not on its own
line. We should regard the first sibling that is on its own line as
the "first sibling"", and indent it against the parent.
2. In linux style, in a do-while statement, if the do-body is
bracket-less, the "while" keyword is indented to the same level as the
do-body. It should be indented to align with the "do" keyword
instead.
* lisp/progmodes/c-ts-mode.el:
(c-ts-mode--no-prev-standalone-sibling): New function.
(c-ts-mode--indent-styles): Use
c-ts-mode--no-prev-standalone-sibling. Add while keyword indent rule.
* test/lisp/progmodes/c-ts-mode-resources/indent.erts: New tests.
Dmitry Gutov [Sat, 9 Dec 2023 17:04:55 +0000 (19:04 +0200)]
ruby-mode: Better detect regexp vs division (bug#67569)
* lisp/progmodes/ruby-mode.el (ruby-syntax-before-regexp-re):
Add grouping around methods from the whitelist.
(ruby-syntax-propertize): Also look for spaces around the slash.
Jared Finder [Sat, 9 Dec 2023 08:17:05 +0000 (10:17 +0200)]
Fix dragging mode line on text terminals with a mouse (bug#67457)
* lisp/xt-mouse.el (xterm-mouse-translate-1): Fix the 'event-kind'
property of mouse-movement symbols emitted by xt-mouse.
* lisp/term/linux.el (terminal-init-linux): Call 'gpm-mouse-mode'
to set up the terminal for the mouse, if needed.
Dmitry Gutov [Fri, 8 Dec 2023 02:12:21 +0000 (04:12 +0200)]
js-ts-mode: Highlight property shorthands in assignments
* lisp/progmodes/js.el (js--treesit-lhs-identifier-query): Match
property shorthands (which turn into variable reference).
(js--treesit-fontify-assignment-lhs): Use the matches.
Dmitry Gutov [Fri, 8 Dec 2023 01:58:18 +0000 (03:58 +0200)]
(js--treesit-font-lock-settings): Highlight parameters in function expression
* lisp/progmodes/js.el (js--treesit-font-lock-settings):
Highlight parameters in a function expression (the node type
'function'). Make the matcher for 'formal_parameters' independent
of the parent, that just created duplication.
Dmitry Gutov [Fri, 8 Dec 2023 01:48:45 +0000 (03:48 +0200)]
(js--treesit-font-lock-settings): Remove some duplicates
* lisp/progmodes/js.el (js--treesit-font-lock-settings):
Remove queries from 'function' that duplicate entries in
'definition' (one of them with a typo).
rust-ts-mode--comment-docstring: Fix/improve the previous change
* lisp/progmodes/rust-ts-mode.el
(rust-ts-mode--comment-docstring): Match also "inner" line docs.
Stop rebinding 'end' and use the argument's value in the
'treesit-fontify-with-override' call.
Eli Zaretskii [Sat, 2 Dec 2023 13:25:08 +0000 (15:25 +0200)]
Fix 'Info-goto-node-web' when NODE is given in various forms
* lisp/info.el (Info-goto-node-web): Support all forms of node
input, per 'Info-read-node-name's documentation, and extract
FILENAME from NODE if given there. Default NODE to "Top" if not
provided by the user. (Bug#67531)
(Info-url-for-node): Support browsing the "Top" node.
* lisp/progmodes/rust-ts-mode.el
(rust-ts-mode--comment-docstring): New function.
(rust-ts-mode--font-lock-settings): Use it
(https://lists.gnu.org/archive/html/emacs-devel/2023-12/msg00019.html).
Eli Zaretskii [Fri, 1 Dec 2023 08:47:27 +0000 (10:47 +0200)]
Fix example in Emacs Lisp Intro manual
* doc/lispintro/emacs-lisp-intro.texi (beginning-of-buffer opt
arg): Fix indentation in example. Reported by Xiyue Deng
<manphiz@gmail.com>. (Bug#67560)
* lisp/indent.el (indent-for-tab-command): Use `syntax-class` to fix
longstanding thinko introduced back in 2020 in commit 64c851166442.
Rework the check for `syn` because TAB always completed when
`tab-first-completion` had value `word-or-paren` or `word-or-paren-or-punct`.
Eli Zaretskii [Wed, 29 Nov 2023 14:14:03 +0000 (16:14 +0200)]
Fix behavior of 'split-root-window-*' with 'C-u'
* lisp/window.el (split-root-window-below)
(split-root-window-right): Fix the 'interactive' form to work with
raw 'C-u' as well. (Bug#67459)
(split-window-below, split-window-right, split-root-window-below)
(split-root-window-right): Doc fix.
Yuan Fu [Mon, 27 Nov 2023 01:42:51 +0000 (17:42 -0800)]
Fix c-ts-mode indentation after if/else (bug#67417)
* lisp/progmodes/c-ts-mode.el:
(c-ts-mode--prev-line-match): New function.
(c-ts-mode--indent-styles): Add a rule for the empty line after
if/else/for/etc.
Yuan Fu [Mon, 27 Nov 2023 00:38:41 +0000 (16:38 -0800)]
Fix indentation for else clause in c-ts-mode (bug#67417)
* lisp/progmodes/c-ts-mode.el:
(c-ts-mode--indent-styles): Add indentation for children of
else_clause.
* test/lisp/progmodes/c-ts-mode-resources/indent.erts:
(Name): Add test for else-break. Also make the test such that it
needs to indent correctly from scratch (rather than maintaining the
already correct indentation.)
Dmitry Gutov [Thu, 23 Nov 2023 22:00:32 +0000 (00:00 +0200)]
Make python-ts-mode's syntax-highlighting more standardized
This was brought up in a Reddit discussion.
* lisp/progmodes/python.el (python--treesit-fontify-variable):
Use font-lock-variable-use-face (since it applies to references).
(python-ts-mode): Move 'property' from 3rd to 4th
treesit-font-lock-level.
George Kuzler [Thu, 23 Nov 2023 00:45:55 +0000 (19:45 -0500)]
Fix "Text is read-only" on backspacing initial Calc input
Immediately after `calc-mode' opens the minibuffer for input
(because you typed a digit, "e", etc), pressing backspace
should clear the minibuffer and return you to the *Calculator*
buffer. Instead, it leaves the minibuffer as-is and prints the
message "Text is read-only"; this is because the function used,
`erase-buffer', tries to erase the read-only minibuffer prompt.
Using `delete-minibuffer-contents' fixes this, since it doesn't
attempt to delete the prompt.
* lisp/calc/calc.el (calcDigit-backspace): Use
`delete-minibuffer-contents' instead of `erase-buffer'. (Bug#67395)
Eli Zaretskii [Thu, 23 Nov 2023 14:07:31 +0000 (16:07 +0200)]
Allow listing Emoji from a read-only buffer
* lisp/international/emoji.el (emoji-list): Don't barf here if the
original buffer is read-inly...
(emoji-list-select): ...barf here instead. (Bug#67400)
(emoji-list): Doc fix.
Michael Albinus [Wed, 22 Nov 2023 12:29:19 +0000 (13:29 +0100)]
Fix CRLF handling in Tramp (don't merge)
* lisp/net/tramp-sh.el (tramp-send-command-and-read): Use 'space'
instead of 'blank' in rx expression, in order to handle also CR
and alike. Reported by Dominique Quatravaux
<dominique@quatravaux.org>.
Backport: Add some basic tests for java-ts-mode and typescript-ts-mode
* test/lisp/progmodes/java-ts-mode-resources/indent.erts: New file
with tests for indentation.
* test/lisp/progmodes/java-ts-mode-resources/movement.erts: New file
with tests for movement.
* test/lisp/progmodes/java-ts-mode-tests.el: New tests.
* test/lisp/progmodes/typescript-ts-mode-resources/indent.erts: New
file with tests for indentation.
* test/lisp/progmodes/typescript-ts-mode-tests.el: New tests.
Dmitry Gutov [Sat, 18 Nov 2023 16:35:18 +0000 (18:35 +0200)]
Fix string-pixel-width with global setting of display-line-numbers
* lisp/emacs-lisp/subr-x.el (string-pixel-width):
Instead of checking for display-line-numbers-mode, set the
display-line-numbers variable to nil (bug#67248).
Eli Zaretskii [Sat, 18 Nov 2023 09:52:48 +0000 (11:52 +0200)]
Document changes in 'edmacro-parse-keys'
* lisp/edmacro.el (edmacro-parse-keys): Add a comment for forcing
output to be a vector.
(read-kbd-macro): Adjust the doc string to changes in
'edmacro-parse-keys'. (Bug#67182)