1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2025-12-09 15:50:40 -08:00
Commit graph

90273 commits

Author SHA1 Message Date
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
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
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
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
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
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
Kévin Le Gouguec
c498884059 Avoid spurious pause in kill-ring-save (Bug#60841)
'indicate-copied-region' checks whether the region is "highlighted"
and if not, briefly moves point to mark to give a visual cue of the
extent of text that was saved to the kill ring.

The region is considered "highlighted" if (a) it is active and (b) its
face specifies a :background.  That latter condition does not account
for the multiple ways in which the face can make the region "visually
distinct" from the default face, so switch to the more extensive
predicate face-differs-from-default-p.

The patch also fixes a couple of issues with the predicate's
implementation, and introduces a new user option in case anyone
happened to enjoy unconditional blinking.

* lisp/faces.el (face-differs-from-default-p): Filter out :extend; add
rationale for the attributes we ignore.
* lisp/simple.el (copy-region-blink-predicate): Add option to let
users explicitly opt into or out of blinking point and mark.
(region-indistinguishable-p): New function to detect
"if there is currently no active region highlighting", leveraging
face-differs-from-default-p.
(indicate-copied-region): Use it.
* src/xfaces.c (merge_face_ref): Allow :stipple to be nil, since it is
a documented valid value for that attribute.
* etc/NEWS: Announce user option.
2023-02-02 19:39:39 +01:00
Eli Zaretskii
382ab516ce Change the default of 'treesit-defun-tactic' for 'c-ts-mode'
* lisp/progmodes/c-ts-mode.el (c-ts-mode): Set
'treesit-defun-tactic' as appropriate for C.  (Bug#61208)
2023-02-02 20:21:02 +02:00
Eli Zaretskii
4d3428e95a Fix docstring fontification of CL's 'defstruct'
* lisp/emacs-lisp/lisp-mode.el (defstruct): Set 'doc-string'
property.  Patch by Nicolas Martyanoff <nicolas@n16f.net>.

Copyright-paperwork-exempt: yes
2023-02-02 20:12:02 +02:00
Eli Zaretskii
1c125baa3f Teach 'hs-minor-mode' about tree-sitter based modes
* lisp/progmodes/hideshow.el (hs-special-modes-alist): Teach
'hs-minor-mode' about tree-sitter based modes.  (Bug#61232)
2023-02-02 19:41:09 +02:00
Eli Zaretskii
2de0ab5cbd ; Doc fixes in keymap.el
* lisp/keymap.el (key-valid-p, key-translate, keymap-lookup)
(define-keymap): Doc fixes.
2023-02-02 16:14:15 +02:00
Mattias Engdegård
bfd338aad9 LAP peephole optimisation improvements
- Since discardN-preserve-tos(1) and stack-set(1) have the same
  effect, treat them as equivalent in all transformations.

- Move the rule

        discardN-preserve-tos(X) discardN-preserve-tos(Y)
    --> discardN-preserve-tos(X+Y)

  from the final pass to the main iteration since it may enable
  further optimisations.

- Don't apply the rule

    goto(X) ... X: DISCARD --> DISCARD goto(Y) ... X: DISCARD Y:

  when DISCARD could be merged or deleted instead, which is even better.

- Add the rule

    OP const return -> <deleted> const return

  where OP is effect-free.

- Generalise the push-pop annihilation rule to

    PUSH(K) discard(N) -> discard(N-K), N>K
    PUSH(K) discard(N) -> <deleted>,    N=K

  to any N, not just N=1.

- Add the rule

    OP goto(X) Y: OP X: -> <deleted> Y: OP X:

  for any operation OP.

* lisp/emacs-lisp/byte-opt.el (byte-optimize-lapcode):
Make the changes described above.
2023-02-02 14:46:53 +01:00
Mattias Engdegård
f6955482c2 Clean up LAP peephole logging
Make `byte-compile-log-lap` more robust and produce nicer output.
This is of interest for Elisp compiler maintainers only.

* lisp/emacs-lisp/byte-opt.el (bytecomp--log-lap-arg): New.
(byte-compile-log-lap-1): Extract argument conversion and rewrite
in a more modern way, fixing bugs.  In particular, tags are now
displayed as "X:" where X is the tag number, and that tag number
is shown as argument to goto-like ops.
(byte-optimize-lapcode): Clean up and simplify logging, producing
useful information when `byte-optimize-log` is `byte` as intended.
2023-02-02 14:43:10 +01:00
Eli Zaretskii
c6660a6d6d Improve documentation of 'repeat-mode' and related variables
* lisp/bindings.el (next-error-repeat-map)
(page-navigation-repeat-map, undo-repeat-map):
* lisp/tab-bar.el (tab-bar-switch-repeat-map)
(tab-bar-move-repeat-map):
* lisp/window.el (other-window-repeat-map)
(resize-window-repeat-map): Mention repeatable commands in the doc
strings.
* lisp/repeat.el (repeat-exit-timeout, repeat-check-key)
(repeat-echo-function, repeat-mode, repeat-check-key)
(repeat-check-map, repeat-echo-message-string)
(repeat-echo-message, repeat-echo-mode-line)
(describe-repeat-maps): Improve wording of doc strings.
(describe-repeat-maps): Improve wording of the heading line.
(Bug#61183)

* doc/emacs/basic.texi (Repeating): Clarify and improve wording of
'repeat-mode' documentation.
2023-02-02 15:34:58 +02:00
Stefan Kangas
0571a3cc87 Merge from origin/emacs-29
9715715ac1 (eshell--complete-commands-list): Fix regression in fix t...
ea1bb26315 * doc/emacs/basic.texi (Repeating): Mention describe-repe...
f91bf9df89 Unbreak the MS-Windows build
2023-02-02 06:30:28 +01:00
Nicolas Martyanoff
9715715ac1 (eshell--complete-commands-list): Fix regression in fix to bug#48995
Copyright-Paperwork-Exempt: Yes

* lisp/eshell/em-cmpl.el (eshell--complete-commands-list):
Fix misuse of `completion-table-dynamic` when completing a file name.
2023-02-01 22:17:57 -05:00
Juri Linkov
c831f55b23 * lisp/progmodes/ruby-ts-mode.el: Extend treesit-sexp-type-regexp.
(ruby-ts-mode): Add more node types to treesit-sexp-type-regexp.
2023-02-01 20:14:06 +02:00
Juri Linkov
ea1bb26315 * doc/emacs/basic.texi (Repeating): Mention describe-repeat-maps (bug#61183).
* lisp/repeat.el (describe-repeat-maps): Add more explanation to
the docstring.  Suggested by Robert Pluim <rpluim@gmail.com>.
2023-02-01 20:05:52 +02:00
Michael Albinus
8c6a463931 Handle large process output strings for Tramp
* lisp/net/tramp-sh.el (tramp-sh-handle-make-process):
Improve handling of connection-type `pipe'.

* test/lisp/tramp-tests.el (tramp-test29-start-file-process)
(tramp-test30-make-process): Extend tests.
2023-02-01 18:40:11 +01:00
Stefan Kangas
cfde8a1490 Merge from origin/emacs-29
66aa9cb450 ; (Ftreesit_query_capture): Fix typo
f711f4e99f (Ftreesit_query_capture): Cache list of predicates for gi...
47ab9ba55d * lisp/keymap.el (keymap-global-unset): Correct prompt
49b6140558 Fix cursor-in-echo-area on TTY frames
2023-02-01 06:30:39 +01:00
Stefan Kangas
f724fca732 ; Auto-commit of loaddefs files. 2023-02-01 05:08:57 +01:00
Stefan Kangas
f7fcc62b78 ; Auto-commit of loaddefs files. 2023-02-01 05:08:25 +01:00
Robert Pluim
47ab9ba55d * lisp/keymap.el (keymap-global-unset): Correct prompt 2023-01-31 18:18:50 +01:00
Stefan Kangas
a73b046c7d Merge from origin/emacs-29
1684e254a3 Update to Transient v0.3.7-196-gb91f509
327941b211 CC Mode: Fix a coding bug in c-make-keywords-re.  This sh...
2f3683cd4d * lisp/isearch.el (isearch-emoji-by-name): Disable derive...
86b03046c0 Merge branch 'emacs-29' of git.savannah.gnu.org:/srv/git/...
e866490a07 Fix keymap inheritance in descendants of 'c-ts-base-mode'
f67a9a12b7 Fix interactive use of `keymap-local-set' and `keymap-glo...
2023-01-31 06:30:26 +01:00
Jim Porter
e7d0aa248e During completion, convert all Eshell arguments to strings
Eshell was already converting some types (numbers, nil) to strings, as
well as fixing up multiple-dot forms like ".../", so this way is more
consistent and should produce fewer problems for Pcomplete functions.

* lisp/eshell/em-cmpl.el (eshell-complete-parse-arguments): Always
convert parsed arguments to strings.

* test/lisp/eshell/em-cmpl-tests.el (eshell-arguments-equal,
eshell-arguments-equal--equal-explainer): New functions.
(em-cmpl-test/parse-arguments/pipeline)
(em-cmpl-test/parse-arguments/multiple-dots)
(em-cmpl-test/parse-arguments/variable/numeric)
(em-cmpl-test/parse-arguments/variable/nil)
(em-cmpl-test/parse-arguments/variable/list)
(em-cmpl-test/parse-arguments/variable/splice): Use
'eshell-arguments-equal'.
2023-01-30 17:49:11 -08:00
Jim Porter
cc5a2ed457 Properly parse Eshell variable splices for interactive completion
Previously, the code simply ignored the splice operator, which usually
worked, but isn't actually correct.

* lisp/eshell/em-cmpl.el (eshell-complete-eval-argument-form): New
function.
(eshell-complete-parse-arguments): Properly parse variable splices.

* test/lisp/eshell/em-cmpl-tests.el
(em-cmpl-test/parse-arguments/variable/splice): New test.
2023-01-30 17:49:11 -08:00
Jim Porter
79154f625c Add regression tests for Eshell completions
* lisp/eshell/esh-cmd.el (eshell-complete-lisp-symbols): Fix
docstring.

* test/lisp/eshell/em-cmpl-tests.el: New file.
2023-01-30 17:49:11 -08:00
Jonas Bernoulli
1684e254a3
Update to Transient v0.3.7-196-gb91f509 2023-01-30 22:39:38 +01:00
Alan Mackenzie
327941b211 CC Mode: Fix a coding bug in c-make-keywords-re. This should fix bug #61135
* lisp/progmodes/cc-defs.el (c-make-keywords-re): Generate "\>" components in
result regexp when argument ADORN is `appendable'.  This fully fixes a bug
which was half-fixed on 2019-01-22.
2023-01-30 20:02:36 +00:00
Eli Zaretskii
e19b91f946 Revert "Fix incremental build failures with tree-sitter"
This reverts commit 176830fe2b.
That commit isn't needed, since the problem was fixed
in another way, in the defcustom's :set function.
2023-01-30 20:25:59 +02:00
Eric Abrahamsen
cdc8f7c28e Gnus nnimap date search string must use C locale
* lisp/gnus/gnus-search.el (gnus-search-imap-handle-date): The %b
needs to be the English month name for IMAP search.
2023-01-30 09:55:40 -08:00
Juri Linkov
2f3683cd4d * lisp/isearch.el (isearch-emoji-by-name): Disable derived emoji (bug#60740).
Let-bind emoji--derived to nil to avoid the subsequent selection
of derived emoji that fails in transient.el.
2023-01-30 19:39:33 +02:00
Po Lu
c53952164f Merge from origin/emacs-29
f67a9a12b7 Fix interactive use of `keymap-local-set' and `keymap-glo...
dda4baa58b ; Fix build and startup without tree-sitter
2023-01-30 21:47:39 +08:00
Eli Zaretskii
86b03046c0 Merge branch 'emacs-29' of git.savannah.gnu.org:/srv/git/emacs into emacs-29 2023-01-30 15:45:54 +02:00
Eli Zaretskii
e866490a07 Fix keymap inheritance in descendants of 'c-ts-base-mode'
* lisp/progmodes/c-ts-mode.el (c-ts-base-mode-map): Rename from
'c-ts-mode-map'.
(c-ts-base-mode): Adjust accordingly.  (Bug#60983)
2023-01-30 15:42:06 +02:00
Po Lu
176830fe2b Fix incremental build failures with tree-sitter
* lisp/treesit.el (treesit-subtree-stat): Declare missing
function.
(treesit-buffer-root-node): Return nil if tree-sitter not
present.
2023-01-30 21:33:40 +08:00
Robert Pluim
f67a9a12b7 Fix interactive use of keymap-local-set' and keymap-global-set'
* lisp/keymap.el (keymap-global-set, keymap-local-set): Convert the
read key sequence to a string when called interactively.  Based on a
patch from Stephen Berman <stephen.berman@gmx.net>.  (Bug#61149)
2023-01-30 13:44:39 +01:00
Eli Zaretskii
dda4baa58b ; Fix build and startup without tree-sitter
* lisp/treesit.el (treesit--font-lock-level-setter): Don't loop
over all the buffers if tree-sitter is not built-in, or else
initialization of defcustom will fail.  (Bug#61155)
* lisp/progmodes/rust-ts-mode.el (treesit-node-parent):
* lisp/progmodes/c-ts-common.el (treesit-node-parent): Declare, to
* avoid byte-compilation warnings.
2023-01-30 14:22:19 +02:00
Michael Albinus
3f069bd796 Fix password prompt in Tramp
* lisp/net/tramp.el (tramp-password-prompt-regexp):
Allow alternative trailing colons.  (Bug#61168)
2023-01-30 11:55:23 +01:00
Michael Albinus
99e40959f4 Fix password prompt in Tramp (do not merge)
* lisp/net/tramp.el (tramp-password-prompt-regexp):
Allow alternative trailing colons.  (Bug#61168)
2023-01-30 11:43:04 +01:00
Stefan Kangas
207a0d9408 Merge from origin/emacs-29
8360e12f0e Update to Org 9.6.1-23-gc45a05
9058601308 ; * doc/emacs/misc.texi (Document View): Remove @footnote...
197f994384 Document tree-sitter features in the user manual
b73539832d ; Remove treesit--font-lock-fast-mode-grace-count
64fee21d5f Fix dockerfile-ts-mode line continuation indentation (bug...
1970726e26 Use treesit-subtree-stat to determine treesit--font-lock-...
382e018856 Add treesit-subtree-stat
a3003492ac Move c-ts-mode--statement-offset to c-ts-common.el
4b1714571c ; Fix byte-compile warnings in c-ts-mode.el
f50cb7d7c4 ; Improve docstring of c-ts-mode--indent-style-setter
1c3ca3bb64 Fix <> syntax in rust-ts-mode
56e8607dc9 Fix spurious errors on Windows when deleting temporary *....
2bd0b94753 Fix java class member without access modifier (bug#61115)
1de6ebf287 Make treesit-font-lock-level a defcustom
6e50ee8bbb Add c-ts-mode-set-style and :set for c-ts-mode-indent-style
450db0587a Minor documentation improvements for outline-minor-mode (...
578e892671 ; * doc/lispref/variables.texi (File Local Variables): Im...
bc5ee2b7bf ; * src/comp.c: Remove Local Variables section to avoid w...
362678d90e python.el: Use correct regexp when enabling python-ts-mode
76bb46db9d ; * doc/emacs/frames.texi (Mouse References): Improve ind...

# Conflicts:
#	doc/emacs/programs.texi
#	etc/NEWS
#	lisp/progmodes/c-ts-mode.el
2023-01-30 07:19:43 +01:00
Kyle Meyer
8360e12f0e Update to Org 9.6.1-23-gc45a05 2023-01-29 21:42:17 -05:00
Eli Zaretskii
197f994384 Document tree-sitter features in the user manual
* lisp/progmodes/c-ts-mode.el (c-ts-mode-map): Bind "C-c .", for
consistency with CC mode.
* lisp/treesit.el (treesit-font-lock-level): Doc fix.

* doc/emacs/programs.texi (C Indent, Custom C Indent): Document
the indentation features of 'c-ts-mode'.
(Moving by Defuns): Document 'treesit-defun-tactic'.
* doc/emacs/files.texi (Visiting): Document
'treesit-max-buffer-size'.
* doc/emacs/display.texi (Traditional Font Lock)
(Parser-based Font Lock): New subsections.
* doc/emacs/emacs.texi (Top): Update top-level menu.
2023-01-29 15:22:20 +02:00
Mattias Engdegård
254c75fc29 Better commutative binary numerical op codegen
* lisp/emacs-lisp/bytecomp.el (byte-compile-variadic-numeric):
Put a constant argument last for better LAP code opportunities.
This applies to commutative binary operations (+ and *).
`min` and `max` are not included being not quite commutative.
2023-01-29 13:48:23 +01:00
Mattias Engdegård
e55855c5a1 Better compilation of n-ary comparisons
Transform n-ary comparisons to a chain of binary comparisons in the
Lisp optimiser instead of in codegen, to allow for subsequent
optimisations.  This generalises the transform, so that

   (< 1 X 10)  ->  (let ((x X)) (and (< 1 x) (< x 10)))

where (< 1 x) is then flipped to (> x 1) in codegen since it's
slightly more efficient to have the constant argument last.  Arguments
that are neither constants nor variables are given temporary bindings.

This results in about 2× speedup for 3-ary comparisons of fixnums with
nontrivial arguments, and also improves the code slightly for binary
comparisons with a constant first argument.

* lisp/emacs-lisp/byte-opt.el (byte-opt--nary-comparison): New,
set as the `byte-optimizer` property for =, <, <=, >, and >=.
* lisp/emacs-lisp/bytecomp.el (byte-compile-and-folded):
Rename to...
(byte-compile-cmp): ...and rewrite.
2023-01-29 12:02:57 +01:00
Michael Albinus
e2b37f901d Fix host name completion for Tramp "podman" method
* lisp/net/tramp-container.el (tramp-container--completion-function):
Rename from `tramp-docker--completion-function'.  Add argument
PROGRAM.  Use it for "docker" and "podman" host name completion.

* lisp/net/tramp.el (tramp-set-completion-function): Check, that
cdr of FUNCTION-LIST entries is a string.
2023-01-29 10:33:43 +01:00
Yuan Fu
b73539832d
; Remove treesit--font-lock-fast-mode-grace-count
* lisp/treesit.el:
(treesit--font-lock-fast-mode-grace-count): Remove. Should've been
removed in the last change.
2023-01-29 00:30:53 -08:00
Randy Taylor
64fee21d5f
Fix dockerfile-ts-mode line continuation indentation (bug#61131)
Without this rule, line continuations are only indented after entering
the contents for the line and hitting TAB or RET.

For example:
```
EXPOSE 1 \
```

After hitting RET to go to the next line, point would end up at BOL
instead of lining up with the previous entry, like so:
```
EXPOSE 1 \
2
```

The new rule will indent it as so:
```
EXPOSE 1 \
       2
```

* lisp/progmodes/dockerfile-ts-mode.el:
(dockerfile-ts-mode--indent-rules): New rule.
(dockerfile-ts-mode--line-continuation-p)
(dockerfile-ts-mode--line-continuation-anchor): New functions.
2023-01-29 00:28:48 -08:00