1
0
mirror of https://git.savannah.gnu.org/git/emacs.git synced 2024-11-23 07:19:15 +00:00
Commit Graph

164903 Commits

Author SHA1 Message Date
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
Mattias Engdegård
0f4c7060e4 Fix misleading LAP optimiser debug log message
* lisp/emacs-lisp/byte-opt.el (byte-optimize-lapcode):
Correct message in a conditional jump threading rule.
2023-02-05 16:27:35 +01:00
Mattias Engdegård
17784bbf3f Allow unbind to commute with discardN and discardN-preserve-tos
* lisp/emacs-lisp/byte-opt.el (byte-after-unbind-ops):
Add discardN and discardN-preserve-tos, both of which
commute with unbind.  This enables subsequent optimisations.
2023-02-05 16:27:35 +01:00
Mattias Engdegård
a50d5b219f Remove compatibility hacks in LAP optimiser
* lisp/emacs-lisp/byte-opt.el (byte-optimize-lapcode):
Remove code forcing forward motion after applying certain
transformations; these were only there to keep output identical across
refactorings.
2023-02-05 16:26:45 +01:00
Mattias Engdegård
9926b44f9e LAP optimiser: bind local variables instead of mutating them
This is a refactoring step: there is no change in how the optimiser
works.

* lisp/emacs-lisp/byte-opt.el (byte-optimize-lapcode):
Instead of re-using local variables through mutation, bind them at
point of use.  This ensures that there is no value leakage by mistake
and actually reduces the static size of the bytecode of this function
somewhat.
The lousy variable names (tmp, tmp2 etc) are retained but
can at least now be changed into something more descriptive.
2023-02-05 16:25:23 +01:00
Mattias Engdegård
929099cbb4 Get rid of delq in LAP optimiser
* lisp/emacs-lisp/byte-opt.el (byte-optimize-lapcode):
Instead of using the O(n) `delq' to remove single instructions, use
the O(1) `setcdr'. To do this, anchor the instruction list in a cons
cell and use the predecessor cell in iteration.
2023-02-05 16:24:51 +01: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
Stefan Monnier
45525cafcb * lisp/emacs-lisp/cconv.el (cconv-convert): Fix thinko 2023-02-05 09:04:51 -05: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
Paul Eggert
d27d9a43d4 Update some commentary for C23 2023-02-04 15:58:42 -08: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
Paul Eggert
b429274c5b Use Gnulib module alignasof instead of stdalign
* admin/merge-gnulib (GNULIB_MODULES):
Replace obsolescent Gnulib module stdalign with alignasof.
* lib/gnulib.mk.in, m4/gnulib-comp.m4: Regenerate.
* lib/stdalign.in.h: Remove; no longer needed.
2023-02-04 15:14:16 -08:00
Paul Eggert
04d97e76a9 Update from Gnulib by running admin/merge-gnulib 2023-02-04 15:14:16 -08:00
Paul Eggert
7e1c7db1cb Prefer https: to git: URIs
Prefer https: to git: URIs on Savannah.
The idea is to avoid some adversary-in-the-middle attacks
on developers.
2023-02-04 15:14:15 -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
Stefan Monnier
c39c26e33f nadvice: Fix bug#61179
Advising interactive forms relies on the ability to distinguish
interactive forms that do nothing else than return a function.
So, be careful to preserve this info.
Furthermore, interactive forms are expected to be evaluated in
the lexical context captured by the closure to which they belong,
so be careful to preserve that context when manipulating those forms.

* lisp/emacs-lisp/cconv.el (cconv-convert, cconv-analyze-form) <lambda>:
Preserve the info that an interactive form does nothing else than
return a function.

* lisp/emacs-lisp/nadvice.el (advice--interactive-form-1): New function.
(advice--interactive-form): Use it.
(advice--make-interactive-form): Refine to also accept function values
quoted with `quote`.  Remove obsolete TODO.

* test/lisp/emacs-lisp/nadvice-tests.el: Don't disallow byte-compilation.
(advice-test-bug61179): New test.

* lisp/emacs-lisp/oclosure.el (cconv--interactive-helper): Allow
the `if` arg to be a form.
* lisp/simple.el (oclosure-interactive-form): Adjust accordingly.
2023-02-04 11:23:31 -05: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
229d0772e2 Add test for java indentation (bug#61115)
* test/lisp/progmodes/java-ts-mode-resources/indent.erts: Add new test
case.
2023-02-04 09:26:54 +01: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
Eli Zaretskii
3a64f81ebc Don't clobber match data in 'y-or-n-p'
* lisp/subr.el (y-or-n-p): Avoid clobbering caller's match data.
(Bug#61091)
2023-02-04 10:15:18 +02:00
Dmitry Gutov
4c765d93ab Refine the previous change
* lisp/progmodes/ruby-ts-mode.el (ruby-ts--s-p-query): Fix a typo.
(ruby-ts--syntax-propertize): Use pcase-exhaustive to avoid typos.
Put the last s-t property after heredoc's end (apparently
parse-partial-sexp likes that more).  Move first s-t property on
percent literals to the very beginning (to be refined later).
Differentiate the %r{} literals from /.../ ones -- tree-sitter
parses them exactly the same.
2023-02-04 04:16:55 +02:00
Dmitry Gutov
d99b5151f8 Add syntax-propertize-function to ruby-ts-mode
* lisp/progmodes/ruby-ts-mode.el (ruby-ts--s-p-query):
New variable.
(ruby-ts--syntax-propertize): New function.
(ruby-ts--parser-after-change): New function.
(ruby-ts-mode): Use both of them.
2023-02-04 03:34:40 +02:00
Alan Mackenzie
0a95a81d8d CC Mode: Fontify a certain foo * bar class by the asymmetric space heuristic
This fixes bug #61144.  If the space around the * is "symmetric" we leave foo
* bar unfontified, a multiplication operation.  If it is "asymmetric" we
fontify it as a pointer declaration.

* lisp/progmodes/cc-engine.el (c-fdoc-assymetric-space-about-asterisk): New
macro, extracted from c-forward-decl-or-cast-1.
(c-forward-decl-or-cast-1): Invoke the new macro twice, in CASE 16 (new) and
CASE 17.5 (the source of the macro).  In CASE 16, additionally set
unsafe-maybe when appropriate.
2023-02-03 20:55:59 +00:00
Stefan Kangas
f25c15ceb7 ; Fix typos 2023-02-03 18:03:18 +01:00
Eli Zaretskii
35e238cae8 Improve documentation of 'header-line-indent-mode'
* doc/lispref/modes.texi (Header Lines): Rewrite the documentation
of 'header-line-indent-mode' and its two variables.  Fix the
example.
* doc/lispref/display.texi (Pixel Specification): More accurate
description of what happens with :align-to in header-lines.
Improve indexing.  (Bug#61239)

* src/buffer.c (syms_of_buffer) <header-line-format>:
* lisp/display-line-numbers.el (header-line-indent)
(header-line-indent-width, header-line-indent-mode): Doc fixes.

* etc/NEWS: Enhance the announcement of 'header-line-indent-mode'.
2023-02-03 16:45:56 +02:00
F. Jason Park
c3f58a6651 Don't casemap erc-sasl-user when set to :nick
* lisp/erc/erc-sasl.el (erc-sasl-user): Fix doc string.
(erc-sasl--get-user): Don't apply casemapping when the option
`erc-sasl-user' is set to `:nick'.  While many servers and
auth-services providers perform case-folding when comparing SASL
usernames, only some recognize RFC1459 mappings, which ERC previously
applied blindly.  Instead, ERC now behaves like other clients in
leaving such preparation in the hands of the server.  This bug was
introduced with changes new to ERC 5.5 and Emacs 29 (bug#29108).
2023-02-03 06:02:33 -08:00
Robert Pluim
e444115d02 Improve keymap-global-set and keymap-local-set interactive use fix
* lisp/keymap.el (keymap-global-set, keymap-local-set): Add optional
`interactive' arg and use it to decide when to convert the key
specification to a string.  Add `advertised-calling-convention'
declarations.  (Bug#61149)
2023-02-03 10:14:43 +01:00
Stefan Kangas
ac7ec87a7a Merge from origin/emacs-29
96ea27278b ; Fix c-ts-mode indent test
d963a8f135 Make c-ts-mode indent tests side-effect-free
8a6bdf88b4 Call treesit_record_change in insert_from_gap_1
a2b77c79dc Use c-ts-common-statement-offset for closing brackets too
74e715cb72 ; Go back to original point when filling comments in c-ts...
b8009bbf2d ; Fix error where we pass t to treesit-node-type in c-ts-...
88ccf78b20 ; * src/treesit.c (treesit_predicate_match): Simplify las...
20454128b8 Minor improvements in sqlite.c
3b3c47d977 (treesit_predicate_match): Match node text against regexp...
e8334781c9 Improve documentation of gdb-mi's dedicated windows
c498884059 Avoid spurious pause in kill-ring-save (Bug#60841)
382ab516ce Change the default of 'treesit-defun-tactic' for 'c-ts-mode'
4d3428e95a Fix docstring fontification of CL's 'defstruct'
1c125baa3f Teach 'hs-minor-mode' about tree-sitter based modes
2de0ab5cbd ; Doc fixes in keymap.el
c6660a6d6d Improve documentation of 'repeat-mode' and related variables
be304bb328 ; * etc/NEWS: Mention the 'utf-8-auto' bugfix (bug#60750).

# Conflicts:
#	etc/NEWS
2023-02-03 06:30:24 +01:00
Yuan Fu
96ea27278b
; Fix c-ts-mode indent test
* test/lisp/progmodes/c-ts-mode-resources/indent.erts: Move the linux
style test case down.
2023-02-02 18:32:08 -08:00
Yuan Fu
d963a8f135
Make c-ts-mode indent tests side-effect-free
Running indent tests changes the global value of
c-ts-mode-indent-style.  That's not good.  This change fixes that.

I also refactored the indent style functions a bit.

* lisp/progmodes/c-ts-mode.el:
(c-ts-mode--prompt-for-style): New function.
(c-ts-mode-set-local-style): New function.
(c-ts-mode-set-style): Use c-ts-mode--prompt-for-style.  Use
derived-mode-p when testing for major mode.  Remove check of current
buffer's major mode since it doesn't matter.

* test/lisp/progmodes/c-ts-mode-resources/indent-bsd.erts:
* test/lisp/progmodes/c-ts-mode-resources/indent.erts: Use
c-ts-mode-set-local-style to set the indent style locally.
2023-02-02 18:32:08 -08:00
Yuan Fu
8a6bdf88b4
Call treesit_record_change in insert_from_gap_1
Before this change, insert_from_gap calls treesit_record_change but
insert_from_gap_1 doesn't.  However, insert_from_gap_1 is a public
function and is called in many other places outside of insdel.c.  This
could lead to tree-sitter's parse tree becoming out-of-sync with the
buffer content.

This change might fix bug#60650.

* src/insdel.c (insert_from_gap_1): Call treesit_record_change.
(insert_from_gap): Remove call to treesit_record_change.

* admin/notes/tree-sitter/treesit_record_change: New file.
2023-02-02 18:31:19 -08:00
Yuan Fu
a2b77c79dc
Use c-ts-common-statement-offset for closing brackets too
Merge c-ts-mode--close-bracket-offset into
c-ts-common-statement-offset.

* lisp/progmodes/c-ts-common.el:
(c-ts-common-statement-offset): Handle closing brackets too.
(c-ts-mode--close-bracket-offset): Remove function.
* lisp/progmodes/c-ts-mode.el (c-ts-mode--indent-styles): Use
c-ts-common-statement-offset for closing brackets.
2023-02-02 18:28:08 -08:00
Yuan Fu
74e715cb72
; Go back to original point when filling comments in c-ts-mode
* lisp/progmodes/c-ts-common.el:
(c-ts-common--fill-block-comment): Go to original point.
2023-02-02 17:39:08 -08:00
Yuan Fu
b8009bbf2d
; Fix error where we pass t to treesit-node-type in c-ts-common.el
* lisp/progmodes/c-ts-common.el:
(c-ts-common-statement-offset): Move the form that sets node to t
down, also add a check for node’s nullness.
2023-02-02 17:39:08 -08:00
Eli Zaretskii
88ccf78b20 ; * src/treesit.c (treesit_predicate_match): Simplify last change. 2023-02-02 21:54:15 +02:00
Eli Zaretskii
20454128b8 Minor improvements in sqlite.c
* src/sqlite.c (Fsqlite_next): Doc fix.  Return nil if SQLITE_DONE
was once seen for this statement.  (Bug#61151)
(row_to_value): Cons the value in reverse, to avoid the Fnreverse
call.  Patch by Helmut Eller <eller.helmut@gmail.com>.
(Bug#61165)
2023-02-02 21:45:44 +02:00
Dmitry Gutov
3b3c47d977 (treesit_predicate_match): Match node text against regexp without consing
* src/treesit.c (treesit_predicate_match): Match node text against
regexp without creating a new string object (bug#60953).

* src/search.c (search_buffer): Make not static.
Delete declaration near the beginning of the file.

* src/lisp.h: Declare it here.

* lisp/progmodes/ruby-ts-mode.el (ruby-ts--builtin-method-p):
Remove function.
(ruby-ts--font-lock-settings): Use the regexp with :match directly.
2023-02-02 21:38:59 +02:00