Commit graph

89895 commits

Author SHA1 Message Date
Dmitry Gutov
ba33b83ce4 (ruby-ts--statement-container-regexp): Remove "parenthesized_statements"
* lisp/progmodes/ruby-ts-mode.el
(ruby-ts--statement-container-regexp): Remove
"parenthesized_statements", it's not really a statement container,
not one we'd use for indentation alignment anyway.

* test/lisp/progmodes/ruby-mode-resources/ruby-ts.rb: Add examples.
2023-01-19 05:27:43 +02:00
Dmitry Gutov
f2bedf695c ruby-ts-mode: Handle indent in parenless calls much closer to ruby-mode
* lisp/progmodes/ruby-ts-mode.el (ruby-ts--parent-call-or-bol):
New function.
(ruby-ts--indent-rules): Use it for cases which need special
anchoring logic when inside a parenless method call.
Remove the ad-hoc handling of pair-hash-pair etc indentation,
which was there only for the parenless cases, apparently.
Have "No paren, ruby-parenless-call-arguments-indent is nil" case
align to the statement, if only because ruby-mode does that.

* test/lisp/progmodes/ruby-ts-mode-tests.el:
Run indent test for ruby-parenless-call-arguments-indent.rb.
2023-01-19 05:27:43 +02:00
Juri Linkov
758ac5eabb Fix split-window-below for the case when split-window-keep-point is nil.
* lisp/window.el (split-window-below): Don't try to move point when
split-window-keep-point is nil and window-to-split is not the selected window
or nil (that defaults to the selected window) because code makes sense
only for the selected window.
(split-window-below, split-window-right): Improve docstrings (bug#60886)
2023-01-18 20:24:26 +02:00
Juri Linkov
8e9783b4ce Rebind in read-regexp-map ‘M-c’ to ‘M-s c’ compatible with search-map
Also it's compatible with 'M-s c' (isearch-toggle-case-fold)
used during Isearch.  Also makes possible to use the global keybinding
'M-c' (capitalize-dwim) in the minibuffer.

* doc/lispref/minibuf.texi (Text from Minibuffer): Rename ‘M-c’ to ‘M-s c’.

* lisp/replace.el (read-regexp-map): Rebind ‘M-c’ to ‘M-s c’ (bug#60741).
(read-regexp-toggle-case-fold): Rename from read-regexp-toggle-case-folding
to more standard name.
2023-01-18 20:05:19 +02:00
Juri Linkov
78f93d92b2 * lisp/vc/vc-dir.el: Make keys ‘% m’ and ‘* %’ compatible with Dired
(vc-dir-mode-map): Replace ‘%’ for vc-dir-mark-by-regexp
with ‘% m’ in regexp-map and ‘* %’ in mark-map (bug#60887).

* doc/emacs/maintaining.texi (VC Directory Commands): Replace ‘%’
with ‘% m’ and ‘* %’.  Mention vc-dir-mark-registered-files.
2023-01-18 19:55:10 +02:00
Jim Porter
dc3f85fd4b Use proper types for Eshell warnings
* lisp/eshell/esh-var.el (eshell-get-variable):
* lisp/eshell/em-basic (eshell/echo): Don't use ':warning'; that's a
warning level, not a warning type.
2023-01-18 09:14:59 -08:00
Eli Zaretskii
6a8338a8bc ; Avoid byte-compiler warning in cc-fonts.el. 2023-01-18 17:22:48 +02:00
Eli Zaretskii
9186be20ae ; Clarify doc strings of some functions in files.el
* lisp/files.el (file-name-sans-extension, file-name-extension)
(file-name-sans-versions): Doc fixes.  (Bug#60929)
2023-01-18 16:19:10 +02:00
Ikumi Keita
1798ff5a66 ; Fix minor mistakes in documentation
* lisp/emacs-lisp/cl-macs.el (cl-letf): Correct Info reference.

* doc/lispref/strings.texi (String Conversion): Fix typo.

(Bug#60926)
2023-01-18 14:28:59 +02:00
Yuan Fu
faee7e1f1b
; * lisp/treesit.el (treesit-font-lock-fontify-region): Minor fix. 2023-01-17 22:52:22 -08:00
Yuan Fu
24f0dfd373
Revert "Revert "Add c-or-c++-ts-mode (bug#59613)""
This reverts commit d46f7f4edc.

Aaaactually, we need this, otherwise we can't use tree-sitter based C
mode for header files.
2023-01-17 22:32:40 -08:00
Yuan Fu
ac3bc775b6
Make it harder to misactivate tree-sitter font-lock fast mode
This has been brought up in bug#60691 and bug#60223.  I proposed a fix
by testing the size of the tree rather than measuring the query time.
But after some thought, I fear that just looking at the size will give
us false-negatives.  So I kept the time-based activation, just added a
grace count to reduce false-positives.

* lisp/treesit.el:
(treesit--font-lock-fast-mode-grace-count): New variable.
(treesit--font-lock-notifier): Only activate fast mode after 5
offenses.
2023-01-17 22:32:40 -08:00
Dmitry Gutov
343b9b3dfe ruby-ts-mode: Obey the option ruby-method-call-indent
* lisp/progmodes/ruby-ts-mode.el
(ruby-ts--method-call-indent-p): New function.
(ruby-ts--indent-rules): Use it.

* test/lisp/progmodes/ruby-ts-mode-tests.el:
Run indent test for ruby-method-call-indent.rb.

* test/lisp/progmodes/ruby-mode-resources/ruby-ts.rb:
Add explicit value for ruby-method-call-indent.
2023-01-18 03:27:37 +02:00
Dmitry Gutov
045404d1aa ruby-ts-mode: Obey the option ruby-after-operator-indent
* lisp/progmodes/ruby-ts-mode.el
(ruby-ts--after-op-indent-p): New function.
(ruby-ts--indent-rules): Use it.

* test/lisp/progmodes/ruby-ts-mode-tests.el:
Run indent test for ruby-after-operator-indent.rb.

* test/lisp/progmodes/ruby-mode-resources/ruby-ts.rb:
Make sure indentation vars are at their default values.
2023-01-18 03:27:37 +02:00
Dmitry Gutov
300ca6ac37 ruby-ts-mode: Fix indent after operator or conditional
Make it match ruby-mode's indentation behavior.

* lisp/progmodes/ruby-ts-mode.el (ruby-ts--binary-indent-anchor):
New function.
(ruby-ts--indent-rules): Use it instead of a composite matcher.
Add a rule for 'conditional'.
(ruby-ts--assignment-ancestor, ruby-ts--is-in-condition)
(ruby-ts--endless-method): Remove.

* test/lisp/progmodes/ruby-mode-resources/ruby-ts.rb:
Add examples.
2023-01-18 03:27:37 +02:00
Dmitry Gutov
ac5516bd7d ruby-ts-mode: Fix/change indentation of a continuation method call
* lisp/progmodes/ruby-ts-mode.el (ruby-ts--indent-rules):
Fix/change indentation of a continuation method call.

* test/lisp/progmodes/ruby-mode-resources/ruby-ts.rb:
New examples.
2023-01-18 03:27:37 +02:00
Dmitry Gutov
5e2e68a0c2 ruby-ts-mode: Fix indent inside parenthesized_expr and else/end after unless
* lisp/progmodes/ruby-ts-mode.el (ruby-ts--indent-rules):
Fix indentation for parenthesized_expression and else/end after
'unless'.

* test/lisp/progmodes/ruby-mode-resources/ruby-ts.rb:
New examples.
2023-01-18 03:27:37 +02:00
Dmitry Gutov
9ed9ff4690 ruby-ts-mode: Fix the rules for hanging arrays and hashes
* lisp/progmodes/ruby-ts-mode.el (ruby-ts--indent-rules):
Fix the rules for hanging arrays and hashes (to line up to
parent-bol instead of the opening brace).

* test/lisp/progmodes/ruby-mode-resources/ruby-ts.rb:
New file with examples.

* test/lisp/progmodes/ruby-ts-mode-tests.el: Use it here.
2023-01-18 03:27:37 +02:00
Alan Mackenzie
dbac923b9d CC Mode: On removal of "typedef", remove pertinent types from c-found-types
For this purpose, record the type names declared by typedef in a text
property, c-typedef, on the typedef.  On any change to that "typedef" or a
type, remove the old identifier(s) from c-found-types.

This should fix bug #59671.

* lisp/progmodes/cc-defs.el (c-search-forward-non-nil-char-property): New
macro.

* lisp/progmodes/cc-engine.el (c-forward-decl-or-cast-1): Move the scope of
identifier-start from the "inner" let form to the outer one.  Amend the
return value such that the middle element of the second element is now the
position of the "typedef", not merely non-nil.

* lisp/progmodes/cc-fonts.el (c-font-lock-declarators): Disregard the LIMIT
parameter when fontifying the declarators of a typedef construct.  Also in
this case, set the c-typedef text property on the "typedef" to the list of
declared types.  Amend this list when these declared types change.
(c-font-lock-single-decl): Massage the `types' argument given to
c-font-lock-declarators.
(c-font-lock-cut-off-declarators): Amend to work when the starting point of
the fontification is inside a brace block.

* lisp/progmodes/cc-mode.el (c-before-change-de-typedef)
(c-after-change-de-typedef): New functions.
(c-update-new-id): Replace the erroneous c-end-of-current-token with a clause
containing c-forward-token-2.
(c-before-change): Call c-before-change-de-typedef.
(c-after-change): Call c-after-change-de-typedef.
2023-01-17 18:15:45 +00:00
F. Jason Park
183e749270 Don't preserve non-module minor modes in erc-open
* lisp/erc/erc-common.el (define-erc-module): Add symbol property
`erc-module' to minor modes defined as part of a module.
* lisp/erc/erc.el (erc--merge-local-modes): Be more conservative when
persisting local minor-mode state across ERC sessions.  User and
third-party modes that were not defined via `define-erc-modules'
should be left alone.
(erc-open): Run major-mode hooks and enable minor modes after prompt
has been set up.  This ensures that module-setup code can access a
fully initialized `erc-input-marker'.
* test/lisp/erc/erc-tests.el (erc--merge-local-modes): Add mocks for
`erc-module' symbol property and a test case covering some foreign ERC
mode.
(define-erc-module--global, define-erc-module--local): Expect the
`erc-module' symbol property to be defined for mode symbols and
aliases.  (Bug#60784.)
2023-01-17 06:09:08 -08:00
F. Jason Park
7b8322f628 Use correct buffer for local-module vars in erc-open
* lisp/erc/erc.el (erc--target-priors): New internal variable to do
for target buffers what `erc--server-reconnecting' does for server
buffers.
(erc-open): Source the state of a local module's mode variable from
its actual buffer rather than its server buffer.  Additionally, make
all local variables from a prior session available to
module-activation functions and `erc-mode' hooks, even when
`erc-reuse-buffers' is nil.  This bug arrived with the introduction of
"local-modules" (bug#57955).

* test/lisp/erc/erc-scenarios-base-local-modules.el
(erc-scenarios-base-local-modules--toggle-helpers): Remove useless
`with-current-buffer'.
(erc-scenarios-base-local-modules--local-var, erc--phony-sblm--enable,
erc--phony-sblm--disable, erc--phony-sblm--mode): Add fake local
module and data var for test scenario.
(erc-scenarios-base-local-modules--var-persistence) Add slightly hacky
test case with promise to improve later when splitting the file.
2023-01-17 06:09:08 -08:00
F. Jason Park
7b13422298 ; Avoid plist-get as generalized var in erc-compat
* lisp/erc/erc-compat.el (erc-compat--29-auth-source-pass-search): The
gv expander for `plist-get' was added in Emacs 28.  But ERC still
supports 27, as of this function's introduction, in Emacs 29.
2023-01-17 06:09:08 -08:00
Eli Zaretskii
09e9d7c749 Fix display of warnings on w32 console
* lisp/emacs-lisp/warnings.el (warnings-suppress): Use alternative
symbol for TTY frames on MS-Windows.
2023-01-17 15:44:51 +02:00
Yuan Fu
9e7a5d58ee
; Fix tree-sitter indent anchor preset
* lisp/treesit.el:
(treesit-simple-indent-presets): Fix prev-adaptive-prefix.
2023-01-17 01:20:51 -08:00
Mattias Engdegård
e8c77d9abd Fix hfy-exclude-file-rules (bug#60562)
* lisp/htmlfontify.el (hfy-exclude-file-rules):
Fix broken defcustom type; no longer fails test-custom-opts.
Fix regexps not to use newline-sensitive patterns like `.` and `$`
which do not make sense when matching file names.
Better doc string.
* lisp/htmlfontify.el (hfy-list-files): Simplify regexp argument.
2023-01-16 19:31:20 +01:00
Alan Mackenzie
c1d32d9a20 CC Mode: Prevent ids in temporary "declarators" getting into c-found-types
This should fix bug #60765.  In the scenario type an identifier in front of
foo (bar, baz), as when started a new statement.  This temporarily makes the
function call a declarator, and bar and baz types.  Don't enter bar and baz
into c-found-types.

* lisp/progmodes/cc-engine.el (c-forward-decl-or-cast-1) (CASE 6): When a
'maybe type triggers this case, set `unsafe-maybe' to non-nil.
2023-01-16 17:44:44 +00:00
Eli Zaretskii
f367ba3ed0 ; Avoid byte-compiler warning in eglot.el
* lisp/progmodes/eglot.el (eglot): Rename INTERACTIVE to avoid
byte-compiler warning.  Update the doc string.  (Bug#60557)
2023-01-16 16:52:48 +02:00
Eli Zaretskii
1b458aced7 ; * lisp/progmodes/eglot.el: Remove stray space. 2023-01-16 16:08:46 +02:00
João Távora
67df34c143 Fix M-x eglot prompt when connection already exists (bug#60557)
Before this change, if a current connection existed at the time of M-x
eglot, user would be first asked to enter into M-x eglot's interactive
spec details about new command line arguments, and only afterwards be
prompted about what to do with the current connection (which could be
to reconnect to it using the same arguments, or tear it down and make
a new one).

This is very confusing, as users may not be fully aware of the
distinction between "reconnect" vs "disconnect-and-connect".  They
might not know if any new command line arguments provided are taking
effect or not.

This change simplifies this and removes the option to "reconnect
instead" from M-x eglot (users can do that at any time via M-x
eglot-reconnect).  It also ensures that users are informed about a
current connection before asking to enter new command line arguments
and not the other way round.

* lisp/progmodes/eglot.el (eglot): Rework.
2023-01-16 11:49:15 +00:00
Yuan Fu
3d1e74c82a
Fix tree-sitter indent preset function (bug#60270)
* lisp/treesit.el (treesit-simple-indent-presets): Fix
prev-adaptive-prefix so it doesn't return nil if the previous line has
no prefix.
* test/lisp/progmodes/c-ts-mode-resources/indent.erts: New test.
2023-01-16 00:32:57 -08:00
Dmitry Gutov
352e41016b ruby-ts-mode: Support the option ruby-block-indent
* lisp/progmodes/ruby-ts-mode.el (ruby-ts--block-indent-anchor):
New function.
(ruby-ts--indent-rules): Use it.

* test/lisp/progmodes/ruby-ts-mode-tests.el:
Run indent test for ruby-block-indent.rb.
2023-01-16 05:50:28 +02:00
Theodor Thornhill
44c9cb8653 Improve indentation for jsx
* lisp/progmodes/js.el (js--treesit-indent-rules): Use more parent
anchors and fix typo with wrong indent offset variable.
* lisp/progmodes/typescript-ts-mode.el
(typescript-ts-mode--indent-rules): Use more parent anchors.
2023-01-15 21:51:08 +01:00
Sean Whitton
82ae9caadd * lisp/subr.el (while-let): Fix docs if-let->if-let* (bug#60758). 2023-01-15 10:01:41 -07:00
Sean Whitton
f16bd1ead4 Revert "* lisp/subr.el (while-let): Use if-let, not if-let* (bug#60758)."
This reverts commit 083badc9c1.
2023-01-15 09:57:41 -07:00
Stefan Kangas
c8d5480972 Bump use-package version for Emacs 29.1
* lisp/use-package/use-package.el: Bump version to 2.4.5.
2023-01-15 14:33:05 +01:00
Eli Zaretskii
9f5008b9b2 Improve error message from sqlite-mode.el
* lisp/sqlite-mode.el (sqlite-mode-open-file): Add error
checking.  (Bug#60490)
2023-01-15 12:06:54 +02:00
Eli Zaretskii
72d2604d1f Merge branch 'emacs-29' of git.savannah.gnu.org:/srv/git/emacs into emacs-29 2023-01-15 11:19:20 +02:00
Eli Zaretskii
cf31182684 ; * lisp/files.el (insert-directory-wildcard-in-dir-p): Doc fix. 2023-01-15 11:18:44 +02:00
Yuan Fu
25a5575f16
Fix c-ts-mode block comment indentation (bug#60270)
* lisp/progmodes/c-ts-mode.el:
(c-ts-mode--comment-2nd-line-anchor): Handle another edge case.
2023-01-15 01:11:38 -08:00
Yuan Fu
252b2c01af
Fix c-ts-mode label indent
Fix indentation of the statement right under a label.

* lisp/progmodes/c-ts-mode.el (c-ts-mode--indent-styles): Fix.
(c-ts-mode--top-level-label-matcher): Fix.
2023-01-15 01:11:38 -08:00
Yuan Fu
189d976dba
Fix statement indent for c-ts-mode (bug#59686) (bug#60280)
Instead of trying to figure out the correct anchor, now we just count
the layers of {} blocks between the node and the root node.

* lisp/progmodes/c-ts-mode.el:
(c-ts-mode--indent-styles): Use new offset functions
c-ts-mode--close-bracket-offset and c-ts-mode--statement-offset.
(c-ts-mode--bracket-children-anchor): Remove function.
(c-ts-mode--top-level-label-matcher): New variable.
(c-ts-mode--statement-offset)
(c-ts-mode--close-bracket-offset): New offset functions.
2023-01-15 01:11:37 -08:00
Yuan Fu
c78e19d99c
Allow offset in tree-sitter indent rules to be functions
This is needed for fixing C indentation.  See next comment.

* doc/lispref/modes.texi (Parser-based Indentation): Update manual.
* lisp/treesit.el (treesit-simple-indent): Try evaluating OFFSET as a
function if it's not integer nor variable.
2023-01-15 01:11:37 -08:00
Yuan Fu
d13a329acf
; Minor change in c-ts-mode--indent-styles
; * lisp/progmodes/c-ts-mode.el:
(c-ts-mode--indent-styles): Move top-level label rule to GNU style.
2023-01-15 01:11:37 -08:00
Yuan Fu
d428d51066
Support filling line comments in c-ts-mode
Now we handle line comments separately because for line comments, each
line is an individual node, unlike block comments, where the whole
block comment is a single node.  fill-comment-paragraph turns out to
do the job perfectly fine.

* lisp/progmodes/c-ts-mode.el:
(c-ts-mode--fill-paragraph): Extract out most parts into
c-ts-mode--fill-block-comment.
(c-ts-mode--fill-block-comment): New extracted function.
2023-01-15 01:11:37 -08:00
Yuan Fu
f02998939c
; Fix c-ts-mode filling
* lisp/progmodes/c-ts-mode.el:
(c-ts-mode--comment-regexp): New variable.
(c-ts-mode--fill-paragraph): Use the new variable, and make sure
start-marker is always initialized.
2023-01-15 01:11:36 -08:00
Eli Zaretskii
b365a7cc32 Fix expansion of wildcards in ls-lisp.el
* lisp/ls-lisp.el (ls-lisp--dired): Fix error message text.
Handle the case of a wildcard specifying directories.  (Bug#60819)
2023-01-15 10:47:24 +02:00
Eli Zaretskii
b5e0260f42 Fix messages displayed when diary is shown
* lisp/calendar/diary-lib.el (diary-list-entries): Display the
"...done" message only if there's no important message in the
echo-area.  (Bug#60795)
2023-01-15 08:10:33 +02:00
Stefan Kangas
256791edd4 ; Auto-commit of loaddefs files. 2023-01-15 05:08:49 +01:00
Stefan Kangas
920a7d38e9 ; Fix typos 2023-01-15 02:14:19 +01:00
Theodor Thornhill
48a62c5546 Add constructor_declaration as java-ts-mode defun
* lisp/progmodes/java-ts-mode.el (java-ts-mode): Extend
treesit-defun-type-regexp.
2023-01-14 23:07:43 +01:00