1
0
mirror of https://git.savannah.gnu.org/git/emacs.git synced 2024-12-11 09:20:51 +00:00
Commit Graph

164448 Commits

Author SHA1 Message Date
Eli Zaretskii
31bf35935f ; Fix doc strings in iimage.el
* lisp/iimage.el (iimage-mode-image-regex-alist)
(iimage-modification-hook): Doc fixes.
2023-02-08 14:56:42 +02:00
Eli Zaretskii
c9ba05af8d Fix crashes inside 'xfree' called from treesit.c
* src/treesit.c (treesit_load_language): Always xstrdup 'c_name',
to avoid crashes inside xfree.  (Bug#61351)
2023-02-07 21:53:05 +02:00
Yuan Fu
746748f5c2
Make java-ts-mode use the c-ts-common-indent-type-regexp-alist
* lisp/progmodes/java-ts-mode.el:
(java-ts-mode): Setup c-ts-common-indent-type-regexp-alist.
2023-02-06 18:48:04 -08:00
Yuan Fu
87d39a30b1
Fix c-ts-mode indentation
Sign, ok, there's another edge case: else if statements.  Because
"else if" is usually implemented as just another if statement nested
in the else branch, this creates additional levels that indentation
needs to ignore.

I converted c-ts-common-indent-block-type-regexp +
c-ts-common-indent-bracketless-type-regexp into a new, more flexible
variable, c-ts-common-indent-type-regexp-alist, to avoid adding yet
more variables in order to recognize else and if statements.

* lisp/progmodes/c-ts-common.el:
(c-ts-common-indent-type-regexp-alist): New variable.
(c-ts-common-indent-block-type-regexp)
(c-ts-common-indent-bracketless-type-regexp): Remove variables.
(c-ts-common--node-is): New function.
(c-ts-common-statement-offset): Use the new variable, and add the
"else if" special case.  Also merge the code of
c-ts-mode--fix-bracketless-indent, because now the code is much more
succinct.
(c-ts-mode--fix-bracketless-indent): Merge into
c-ts-common-statement-offset.

* lisp/progmodes/c-ts-mode.el:
(c-ts-base-mode): Setup c-ts-common-indent-type-regexp-alist.

* test/lisp/progmodes/c-ts-mode-resources/indent.erts: New test.
2023-02-06 18:29:38 -08:00
Yuan Fu
7cb92b5398
Fix c-ts-mode indentation
Turns out I shouldn't have removed the explicit rules.  Anyway, now it
indents properly.

* lisp/progmodes/c-ts-mode.el (c-ts-mode--indent-styles): Add rules.
* test/lisp/progmodes/c-ts-mode-resources/indent.erts: Add tests
2023-02-06 18:28:40 -08:00
Yuan Fu
d68ff6016d
Fix c-ts-mode indentation (bug#61291)
Fix indentation for the semicolon in

while (str_a[i++] == str_b[j++])
  ;

* lisp/progmodes/c-ts-mode.el (c-ts-mode--indent-styles): New rule.
* test/lisp/progmodes/c-ts-mode-resources/indent.erts: New test.
2023-02-06 18:28:39 -08:00
Dmitry Gutov
2ac8c4bbd6 (eglot-completion-at-point): Return correct values in :company-kind
* lisp/progmodes/eglot.el (eglot-completion-at-point): Return the
correct values in :company-kind for "EnumMember" and "TypeParameter".
The convention is to use kebab case rather than plain downcasing.
Reported in https://github.com/company-mode/company-mode/issues/1370.
2023-02-07 00:28:25 +02:00
Mattias Engdegård
321cbd9a60 Tighten and simplify typescript compilation-mode regexps (bug#61104)
* lisp/progmodes/compile.el (compilation-error-regexp-alist-alist):
Tighten regexps and simplify.  Translate to rx.
* etc/compilation.txt: Add examples.

In collaboration with Jostein Kjønigsen.
2023-02-06 17:47:00 +01:00
Eli Zaretskii
97533e73ad ; * lisp/progmodes/c-ts-common.el (treesit-node-prev-sibling): Declare. 2023-02-06 18:34:39 +02:00
Tassilo Horn
9dfccb89fc Clarify bug-reference-auto-setup-functions docstring.
* lisp/progmodes/bug-reference.el (bug-reference-auto-setup-functions):
Add clarification to docstring that this variable is for packages, not
for users.
2023-02-06 17:09:40 +01:00
Aleksandr Vityazev
17ab426670 * lisp/treesit.el (treesit): Fix shortdoc example form (bug#61318). 2023-02-06 16:37:32 +02:00
Theodor Thornhill
5a6dfab1e4 Use c-ts-common-statement-offset in java-ts-mode (bug#61142)
* lisp/progmodes/java-ts-mode.el (java-ts-mode--indent-rules): Add new
matchers to enable c-ts-common machinery.
(java-ts-mode): Add regexps.
* lisp/progmodes/c-ts-common.el (c-ts-common-statement-offset): Fix
typo in documentation and use the new if statement helpers.
(c-ts-common-if-statement-regexp): New defvar.
(c-ts-common-nestable-if-statement-p): New defvar.
(c-ts-common--fix-nestable-if-statement): New helper.
* test/lisp/progmodes/c-ts-mode-resources/indent.erts: Add test for
complicated bracket matching indentation.
* lisp/progmodes/c-ts-mode.el (c-ts-mode--indent-styles): Add indent
rules for bracketless statements.
2023-02-06 07:43:37 +01:00
Theodor Thornhill
c3262216ab Add array_initializer to java-ts-mode
Indent strings inside arrray_initializer one step:

public class Java {
    void foo() {
        return new String[]{
            "foo", // These
            "bar"
        }
    }
}

* lisp/progmodes/java-ts-mode.el (java-ts-mode--indent-rules): New
matcher.
2023-02-06 07:43:37 +01:00
Dmitry Gutov
79ab62e0bb go-ts-mode: Highlight variable declarations
* lisp/progmodes/go-ts-mode.el (go-ts-mode--font-lock-settings):
Highlight variable declarations in 'definition' feature.
2023-02-06 04:42:12 +02:00
Dmitry Gutov
1fab91d852 go-ts-mode: Fix highlighting of function name in call_expression
* lisp/progmodes/go-ts-mode.el (go-ts-mode--font-lock-settings):
Remove :override from the 'property' rules and move them above
'variable' (bug#61302).  Just like in rust-ts-mode.
2023-02-06 04:12:25 +02:00
Dmitry Gutov
07ffe902c6 c-ts-mode: Highlight "property functions" as functions
* lisp/progmodes/c-ts-mode.el (c-ts-mode--font-lock-settings):
Highlight "property functions" as functions (bug#61302).
2023-02-06 04:05:19 +02:00
Dmitry Gutov
a529b0d646 rust-ts-mode: Fix highlighting of function name in call_expression
* lisp/progmodes/rust-ts-mode.el (rust-ts-mode--font-lock-settings):
Remove :override from the 'property' rules and move them above
'variable' (bug#61302).
2023-02-05 23:42:18 +02:00
Dmitry Gutov
088425538f rust-ts-mode--font-lock-settings: Improve consistency
* lisp/progmodes/rust-ts-mode.el (rust-ts-mode--font-lock-settings):
Remove the rule that highlighted scope identifier in a function call
as type.  The existing rules will handle it when it does look like a
type (capitalized).
2023-02-05 21:34:12 +02:00
Dmitry Gutov
793c24a6ac Make sure 'M-x show-paren-local-mode' turns on right away
* lisp/paren.el (show-paren--enabled-p): Extract from
'show-paren-function'.
(show-paren-local-mode): Use it in the :variable getter (bug#61098).
2023-02-05 21:08:45 +02:00
Tassilo Horn
60089dcfe0 Add to bug-reference-auto-setup-functions after its declaring defvar
If it's the init-value of the defvar, add-hook from a third-party
package will suppress the default functions if it takes place before
bug-reference is loaded.

* lisp/progmodes/bug-reference.el (bug-reference-auto-setup-functions):
Add to bug-reference-auto-setup-functions after its declaring defvar.
2023-02-05 19:54:17 +01:00
Juri Linkov
26e947ccb1 * lisp/vc/vc.el (vc-find-revision-no-save): Fix parens (bug#61256).
Move '(setq failed nil)' from UNWINDFORMS of 'unwind-protect' to BODYFORM.
2023-02-05 20:23:57 +02:00
Eli Zaretskii
948e343496 ; Fix byte-compilation warning
* lisp/progmodes/rust-ts-mode.el (treesit-query-compile): Avoid
byte-compilation warning.
2023-02-05 19:10:39 +02:00
Dmitry Gutov
6568a1aaf9 Fix inability to turn show-paren-local-mode on manually (bug#61098)
* lisp/paren.el (show-paren-local-mode): Don't kill the local
value when both local and global are t.  Because the
show-paren-predicate check in show-paren-function also checks
whether a local (non-nil) value of this variable exists.
2023-02-05 19:06:47 +02:00
Dmitry Gutov
24085ba610 ; go-ts-mode--indent-rules: Indent to 0 at top level 2023-02-05 18:53:44 +02:00
Eli Zaretskii
0862a79fef Merge branch 'emacs-29' of git.savannah.gnu.org:/srv/git/emacs into emacs-29 2023-02-05 18:53:36 +02:00
Eli Zaretskii
bb999df5d6 ; Fix whitespace of last change 2023-02-05 18:52:59 +02:00
Jonas Bernoulli
929daafa1d ; Fix trivial mistake in emoji--choose-emoji
* lisp/international/emoji.el (emoji--choose-emoji): The derived
versions are in the cdr not cadr.
2023-02-05 17:52:21 +01:00
Eli Zaretskii
d7b4a8487f ; * lisp/isearch.el (emoji--read-emoji): Avoid compilation warning. 2023-02-05 18:51:11 +02:00
Dmitry Gutov
e38ff00463 rust-ts-mode: Highlight variable declarations
(rust-ts-mode--font-lock-settings): Change scoped_type_identifier
highlight to match similar cases.  Highlight variable declarations
inside all kinds of destructuring patterns, not just function
definitions.
* lisp/progmodes/rust-ts-mode.el (rust-ts-mode--fontify-pattern):
Rename from 'rust-ts-mode--fontify-parameter'.  Check the id node's
parent to avoid touching type identifiers.
2023-02-05 18:50:23 +02:00
Dmitry Gutov
d12727057d rust-ts-mode--indent-rules: Indent to 0 at top level 2023-02-05 18:50:23 +02:00
Jonas Bernoulli
85705a7059 ; Move misplaces parenthesis in emoji--choose-emoji
* lisp/international/emoji.el (emoji--choose-emoji): Move misplaced
parenthesis.
2023-02-05 17:27:17 +01:00
Alan Mackenzie
18c43bb9d6 Ensure upper bound of font-lock region is less than point-max
This fixes bug #61298.  The new long-lines code may have narrowed a buffer
before font-lock-default-fontify-region gets called.

* lisp/font-lock.el (font-lock-default-fontify-region): Set `end' to point-max
if it is greater that it.
2023-02-05 15:59:44 +00:00
Eli Zaretskii
94f291d150 ; * lisp/paren.el (show-paren-predicate): Doc fix. (Bug#61098) 2023-02-05 17:27:43 +02:00
Dmitry Gutov
3ffd0eddce Highlight more complex function parameters
* lisp/progmodes/rust-ts-mode.el
(rust-ts-mode--fontify-parameter): New function.
(rust-ts-mode--font-lock-settings): Use it.
2023-02-05 16:44:32 +02:00
Jonas Bernoulli
58dc03ba7e
No longer use transient in isearch-emoji-by-name
* lisp/isearch.el (isearch-emoji-by-name): Use 'emoji--read-emoji'
and if that returns derivations, 'completing-read' to select one
of them.  This fixes bug#60740.
* lisp/international/emoji.el (emoji--init): Autoload.
(emoji--read-emoji): New function, which doesn't use transient
and returns a list of the glyph and all derivations, if any.
(emoji--choose-emoji): Use 'emoji--read-emoji'.
2023-02-05 14:54:27 +01:00
Dmitry Gutov
0c125fcc67 Make highlighting more regular across TS modes (bug#61205)
* doc/emacs/display.texi (Parser-based Font Lock):
Update description of treesit-font-lock-level, moving 'property' to
level 4.

* lisp/treesit.el (treesit-font-lock-level): Likewise, in docstring.

* lisp/progmodes/c-ts-mode.el (c-ts-base-mode): Do that here.

* lisp/progmodes/cmake-ts-mode.el (cmake-ts-mode): Add a comment.

* lisp/progmodes/go-ts-mode.el (go-ts-mode): Add 'definition' to
level 1.  Move 'function', 'property' and 'variable' to level 4.
(go-ts-mode--font-lock-settings): Move a bunch of existing rules
to 'definition'.  Add highlighting of function parameters.

* lisp/progmodes/rust-ts-mode.el (rust-ts-mode)
(rust-ts-mode--font-lock-settings): Same.  And also change "scoped
identifiers" highlights to only match capitalized names.
2023-02-05 15:50:16 +02:00
Eli Zaretskii
1dd751c3ac ; Improve documentation of 'proper-list-p'
* doc/lispref/lists.texi (Cons Cells): Add cross-reference
to 'proper-list-p' documentation.
2023-02-05 15:15:35 +02:00
Eli Zaretskii
96181ed3f0 Document 'plistp'
* doc/lispref/lists.texi (Property Lists): Document 'plistp'.
(Bug#61293)
2023-02-05 14:09:35 +02:00
Eli Zaretskii
03d9d18513 Fix display of raised/lowered composed text
* src/xdisp.c (fill_gstring_glyph_string): Adjust the base line of
the glyph string due to subscript/superscript.  (Bug#61290)
2023-02-05 13:57:10 +02:00
Eli Zaretskii
f13479d955 Fix installation of tree-sitter grammar on MS-Windows
* lisp/treesit.el (treesit--install-language-grammar-1): Fix a
failure on MS-Windows when the old DLL is still being used.
(Bug#61289)
2023-02-05 11:14:25 +02:00
Eli Zaretskii
0358267204 Update the Emacs FAQ for Emacs 29
* doc/misc/efaq.texi (New in Emacs 29, History of Emacs): Add new
section about Emacs 29.
2023-02-05 10:50:12 +02:00
Eli Zaretskii
2c33e2889b Fix byte-compilation of *-ts-mode.el files
* lisp/treesit.el (treesit-font-lock-settings): Move to before
use, to prevent failure in byte-compiling modes which require this
file.  (Bug#61282)
2023-02-05 08:24:32 +02:00
Dmitry Gutov
b40a929a3f ; ruby-ts--syntax-propertize: Amend commentary 2023-02-05 02:43:05 +02:00
Yuan Fu
b80f36b88c
Make c-ts-mode-set-style's effect local (bug#61245)
Now c-ts-mode-set-style's effect is local, and there is a new function
c-ts-mode-set-global-style that changes the global setting.

* lisp/progmodes/c-ts-mode.el:
(c-ts-mode--indent-style-setter): Use c-ts-mode-set-style.
(c-ts-mode-indent-style)
(c-ts-mode--prompt-for-style): Minor change in docstring.
(c-ts-mode-set-global-style): New function (from c-ts-mode-set-style).
(c-ts-mode-set-local-style): Remove function (became c-ts-mode-set-style).
(c-ts-mode-set-style): Renamed from c-ts-mode-set-local-style.
* test/lisp/progmodes/c-ts-mode-resources/indent-bsd.erts:
* test/lisp/progmodes/c-ts-mode-resources/indent.erts: Use
c-ts-mode-set-style.
2023-02-04 15:33:26 -08:00
Yuan Fu
671e5d9fad
; * lisp/treesit.el (treesit--font-lock-level-setter): Minor change. 2023-02-04 15:33:26 -08:00
Dmitry Gutov
69380a88e9 c-ts-mode: Highlight name in parameter declarations
* lisp/progmodes/c-ts-mode.el (c-ts-mode--font-lock-settings):
Uncomment parameter declaration highlighting (bug#61275).
(c-ts-mode--fontify-declarator): Check that identifier was found.
Some declarations can miss identifier name.
2023-02-04 22:47:08 +02:00
Davide Masserut
89b550eac2 Fix switch statement indentation for go-ts-mode (bug#61238)
* lisp/progmodes/go-ts-mode.el (go-ts-mode--indent-rules): Add
indentation for type switch and select case blocks
* test/lisp/progmodes/go-ts-mode-resources/indent.erts: New .erts file
to test indentation of Go constructs and prevent regression of bug
fixes.
* test/lisp/progmodes/go-ts-mode-tests.el: New file with go-ts-mode
tests.
2023-02-04 19:26:05 +01:00
Eli Zaretskii
1a123feb18 Fix bidi reordering of sequence of whitespace characters before a TAB
* src/bidi.c (bidi_level_of_next_char): Test the current level
only for characters whose original type is BN.  (Bug#61269)
2023-02-04 13:34:42 +02:00
Theodor Thornhill
8870b54db9 Add tests for compilation support for TypeScript (bug#61104)
* test/lisp/progmodes/compile-tests.el
(compile-tests--test-regexps-data): Add new test-cases.
(compile-test-error-regexps): Increase expected errors
2023-02-04 09:19:40 +01:00
Jostein Kjønigsen
873a0a1508 Add support for TypeScript compilation to compile.el (bug#61104)
* lisp/progmodes/compile.el (compilation-error-regexp-alist-alist):
Add regexps.
2023-02-04 09:19:40 +01:00