aboutsummaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
* Eglot: implement inlay hints (bug#61412, bug#61066)scratch/eglot-inlay-hintsJoão Távora2023-02-222-7/+155
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Inlay hints are small text annotations to specific parts of the whole buffer, not unlike diagnostics, but designed to help readability instead of indicating problems. For example, a C++ LSP server can serve hints about positional parameter names in function calls and a variable's automatically deduced type. Emacs can display these hints in many little 0-length overlays with an 'before-string property, thus helping the user not have to remember these things by heart. Since inlay hints are potentially a large amount of data to request from the LSP server, the implementation strives to be as parsimonious as possible with these requests. So, by default, inlay hints are only requested for the visible portions of the buffer across windows showing this buffer. This is done by leveraging the 'window-scroll-functions' variable, making for a reasonably complex implementation involving per-window timers. When scrolling a window, it may take a short amount of time for inlay hints to "pop in". The new user variable 'eglot-lazy-inlay-hints' can be used to exert some control over this. Specifically, if the variable's value is set to 'nil', then inlay hints are greedily fetched for the whole buffer every time a change occurs. This is a much simpler mode of operation which may avoid problems, but is also likely much slower in large buffers. Also, by default this inlay feature is turned ON, which is the usual practice of Eglot when facilities are in place to enable a given feature. Although this can be tweaked by the user via 'eglot-ignored-server-capabilities' as usual, it's possible this feature is visually suprising enough to warrant an exception to the usual rule. I haven't tested inlay hints extensively across many LSP servers, so I would appreciate any testing, both for functional edge cases and regarding performance. There are possibly more optimization oportunities in the "lazy" mode of operation, like more aggressively deleting buffer overlays that are not in visible parts of the buffer. Though I ended up writing this one from scratch, I want to thank Dimitry Bolopopsky <dimitri@belopopsky.com> and Chinmay Dala <dalal.chinmay.0101@gmail.com> for suggestions and early patches. * lisp/progmodes/eglot.el (eglot--lsp-interface-alist): Define InlayHint. (eglot-client-capabilities): Announce 'inlayHint' capability. (eglot-ignored-server-capabilities): Add :inlayHintProvider. (eglot--document-changed-hook): New helper hook. (eglot--after-change): Use it. (eglot-inlay-hint-face, eglot-type-hint-face) (eglot-parameter-hint-face): New faces. (eglot--update-hints-1, eglot--inlay-hints-after-scroll) (eglot--inlay-hints-fully, eglot--inlay-hints-lazily): New helpers. (eglot-lazy-inlay-hints): New user variable. (eglot-inlay-hints-mode): New minor mode. (eglot--maybe-activate-editing-mode): Try to activate eglot-inlay-hints-mode. (eglot--before-change): Remove overlays immediately in the area being changed. * doc/misc/eglot.texi (Eglot Features): Mention inlay hints. (Eglot Variables): Mention eglot-lazy-inlay-hints.
* Eglot: simplify capability-checking codeJoão Távora2023-02-211-18/+19
| | | | | | | | | * lisp/progmodes/eglot.el (eglot--server-capable-or-lose): New helper. (eglot--signal-textDocument/willSave) (eglot--signal-textDocument/didSave): Tweak docstring. (eglot--workspace-symbols, xref-backend-identifier-at-point) (eglot-format, eglot-completion-at-point, eglot-rename) (eglot-code-actions): Use new eglot--server-capable-or-lose.
* Make 'emacs-news-cycle-tag' work at all levelsRobert Pluim2023-02-212-1/+92
| | | | | | | * lisp/textmodes/emacs-news-mode.el (emacs-news-cycle-tag): Search for a heading starting with 2 or more '*' rather than exactly 3. * test/lisp/textmodes/emacs-news-mode-resources/cycle-tag.erts (Point-Char): Add tests for 2 and 4 '*' levels.
* Repair mistake in a previous edmacro-sanitize-string changeMattias Engdegård2023-02-211-2/+1
| | | | | | | | | | * lisp/edmacro.el (edmacro-sanitize-for-string): This condition should not have been 'repaired' but removed altogether. Do so now, fixing bug#61647. Reported by Eduardo Ochs. (cherry picked from commit 4eefadad0670ad1c3da2505d734e528d54c76bef)
* regex-emacs.c: Reduce the use of backtracking a bit furtherStefan Monnier2023-02-202-0/+29
| | | | | | | | | | | bug#61514 exhibited some undesirable backtracking in a case where it's easy to avoid it by making `mutually_exclusive_p` just a bit more careful. * src/regex-emacs.c (mutually_exclusive_p): Handle `on_failure_jump`s. * test/src/regex-emacs-tests.el (regexp-tests-backtrack-optimization): Add a few tests.
* Eglot: respect user's Eldoc configuration by defaultJoão Távora2023-02-201-6/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This change addresses the problems reported in many Elglot reports dating back to early 2021 at least: https://github.com/joaotavora/eglot/issues/648 https://github.com/joaotavora/eglot/issues/894 https://github.com/joaotavora/eglot/issues/920 https://github.com/joaotavora/eglot/issues/1031 https://github.com/joaotavora/eglot/issues/1171 In one form or another, the reports point out that the multiple pieces of information about the "thing at point" made available by the LSP server are not all being considered by the ElDoc system. The reason for this is Eglot setting/trampling the variables 'eldoc-documentation-strategy' and 'eldoc-documentation-functions' in its minor more entry function. The reason it did that is historical and is partially described in the issues above. But, evidently, it never made much sense, because so many people want to override it, which requires setting 'eldoc-documentation-strategy' to the non-default value 'eldoc-documentation-compose'. The problem was made worse by the fact that setting it as usual in either the Customize menu or their init file didn't work, requiring a fairly complex Elisp snippet. That is now solved as of this commit. If the user does not do any setting, then Eglot works basically the same as before (i.e. shows only one piece of information). It is arguable that the default value for 'eldoc-documentation-strategy' should change globally to 'eldoc-documentation-compose', but that has other subtle implications and is not part of this commit. * lisp/progmodes/eglot.el (eglot--managed-mode): Don't set Eldoc variables greedily.
* Make the native compiler always use `make-temp-file' for temporary filesAndrea Corallo2023-02-202-3/+8
| | | | | | | * src/comp.c (CALL4I): Define macro. (Fcomp__compile_ctxt_to_file): Use `make-temp-file' instead of `make-temp-file-internal'. * lisp/emacs-lisp/comp.el (comp--trampoline-abs-filename): Likewise.
* ; * lisp/progmodes/rust-ts-mode.el (treesit-node-end): Declare.Eli Zaretskii2023-02-201-0/+1
|
* Update to Transient v0.3.7-216-gfe40342Jonas Bernoulli2023-02-202-11/+14
|
* Add declaration_list to c-ts-common-indent-type-regexp-alistDaniel Martín2023-02-202-1/+18
| | | | | | | * lisp/progmodes/c-ts-mode.el (c-ts-base-mode): Consider a "declaration_list" a block. (Bug#61635) * test/lisp/progmodes/c-ts-mode-resources/indent.erts (Code): Add a test case.
* Typescript-ts-mode: Add switch case handlingTheodor Thornhill2023-02-201-0/+2
| | | | | * lisp/progmodes/typescript-ts-mode.el (typescript-ts-mode--indent-rules): New rules.
* Fix object initializer for csharp-mode (bug#61541)Theodor Thornhill2023-02-201-12/+21
| | | | | * lisp/progmodes/csharp-mode.el (csharp-guess-basic-syntax): Make sure we check the openers as well as closers.
* Update to Org 9.6.1-34-geea8daKyle Meyer2023-02-206-13/+20
|
* Improve tree-sitter indent anchor prev-adaptive-prefix (bug#61314)Yuan Fu2023-02-193-10/+44
| | | | | | | | | | | | | | | | | | | | | | Now prev-adaptive-prefix looks at the current line and checks if it begins with a prefix itself. If it does, prev-adaptive-prefix tries to place the anchor before the prefix on the previous line, rather than after it. - prev line - this line -> This line starts with a "-", i.e., begins with a prefix, so we place the anchor at the beginning of the "-" of the previous line, rather than after it - prev line this line -> This line doesn't start with a prefix, so the anchor is placed after the previous line's "-". * doc/lispref/modes.texi (Parser-based Indentation): Update manual. * lisp/treesit.el: (treesit-simple-indent-presets): Add local variable this-line-has-prefix, base what anchor to return on the value of this-line-has-prefix and whether the prev line has a prefix.
* Adjust jsx indentationTheodor Thornhill2023-02-192-5/+10
| | | | | | | | | | | | | | | We can use the fact that 'treesit-indent-1' uses 'treesit-node-on' when on a whitespace to set the actual current node as parent. Now we can correctly indent the 'jsx_text' nodes. We also add some more electric-indent-chars so that auto-indenting of jsx behaves a little more fluently. * lisp/progmodes/js.el (js--treesit-indent-rules): Add new rules. (js-ts-mode): Add more indent-chars. * lisp/progmodes/typescript-ts-mode.el (typescript-ts-mode--indent-rules): Add new rules. * lisp/progmodes/typescript-ts-mode.el (typescript-ts-base-mode): Add more indent-chars and layout rules.
* Cleanup preproc indent for c-ts-mode (bug#61558)Theodor Thornhill2023-02-193-5/+74
| | | | | | | | * lisp/progmodes/c-ts-mode.el (c-ts-mode--indent-styles): Make sure we indent to great-grand-parent if inside an #ifdef...#endif block. If grand-parent is root node, then don't indent one step. (c-ts-mode--preproc-offset): New helper anchor function to calculate indent offset.
* Add comment style toggle for c-ts-mode (bug#61550)Theodor Thornhill2023-02-191-1/+23
| | | | | | | | | * lisp/progmodes/c-ts-mode.el (c-ts-mode-toggle-comment-style): New command. (c-ts-base-mode-map): Add binding. (c-ts-mode-set-modeline): New function. (c-ts-mode): Set modeline. (c++-ts-mode): Set modeline.
* * lisp/simple.el (choose-completion): Check for completion-in-region-mode.Juri Linkov2023-02-191-1/+6
| | | | | Don't use base-affixes when completion-use-base-affixes is non-nil in completion-in-region-mode (bug#61535).
* rust-ts-mode--font-lock-settings: Avoid the explicit 'default' faceDmitry Gutov2023-02-191-62/+47
| | | | | | | | | | * lisp/progmodes/rust-ts-mode.el (rust-ts-mode--fontify-scope) (rust-ts-mode--fontify-tail): New functions. (rust-ts-mode--font-lock-settings): Use them instead of a lot of more complex queries (bug#61302). Thus avoid having to create block fontification by other features using the 'default' face. Replace the catch-all query for 'variable' with an enumeration of possible parent nodes.
* * lisp/progmodes/xref.el: Bump the version.Dmitry Gutov2023-02-191-1/+1
|
* xref--insert-xrefs: Use 'shadow' for the line number colonDmitry Gutov2023-02-191-3/+4
| | | | | | | * lisp/progmodes/xref.el (xref--insert-xrefs): Use face 'shadow' for the line number colon instead of continuing it face (bug#61340). (cherry picked from commit d6d25a3c221e566de4df5319181e9ba9a8df285e)
* * lisp/progmodes/xref.el (xref--insert-xrefs): Remove extra space (bug#61340).Juri Linkov2023-02-191-1/+1
| | | | (cherry picked from commit 643a11c6e5defc0a34da1a53b64aa1e097298923)
* Backport: Fix xref-clear-marker-stack refactoring mistakeMattias Engdegård2023-02-191-1/+2
| | | | | | | * lisp/progmodes/xref.el (xref-clear-marker-stack): Clear the history correctly. Changing a lexical variable has no effect. (cherry picked from commit dfdc0f5fb7b10e737c3c8e2bdb1eb873a1e91bd7)
* ; Merge from origin/emacs-28Stefan Kangas2023-02-190-0/+0
|\ | | | | | | | | | | The following commit was skipped: a44d906740f ; Commit files changed by "autoreconf -i -I m4 --force"
| * ; Commit files changed by "autoreconf -i -I m4 --force"emacs-28.3-rc1Stefan Kangas2023-02-193-14/+36
| | | | | | | | | | | | * build-aux/config.guess: * build-aux/config.sub: Update files changed by running "autoreconf -i -I m4 --force". Do not merge.
* | Merge from origin/emacs-28Stefan Kangas2023-02-195-4/+36
|\ \ | |/ | | | | | | | | | | | | f5a99945b6f ; Update ChangeLog for Emacs 28.3 f7bd5ac5521 Update HISTORY for Emacs 28.3 # Conflicts: # etc/NEWS
| * ; Update ChangeLog for Emacs 28.3Stefan Kangas2023-02-192-4/+37
| | | | | | | | | | * ChangeLog.3: Refresh for Emacs 28.3. * etc/NEWS: Add more information about fixed vulnerabilities.
| * Update HISTORY for Emacs 28.3Stefan Kangas2023-02-171-0/+2
| |
* | ; Merge from origin/emacs-28Stefan Kangas2023-02-190-0/+0
|\ \ | |/ | | | | | | | | | | The following commits were skipped: ba3aba3096a Bump Emacs version to 28.3 e61d743d440 Update NEWS for Emacs 28.3
| * Bump Emacs version to 28.3Stefan Kangas2023-02-174-4/+4
| | | | | | | | | | | | | | * README: * configure.ac: * msdos/sed2v2.inp: * nt/README.W32: Bump Emacs version to 28.3.
| * Update NEWS for Emacs 28.3Stefan Kangas2023-02-171-21/+6
| | | | | | | | * etc/NEWS: Update for Emacs 28.3.
* | Merge from origin/emacs-28Stefan Kangas2023-02-192-13/+411
|\ \ | |/ | | | | 4a77fcb1478 Update ChangeLog and AUTHORS for Emacs 28.3
| * Update ChangeLog and AUTHORS for Emacs 28.3Stefan Kangas2023-02-172-13/+411
| | | | | | | | | | * ChangeLog.3: * etc/AUTHORS: Update for Emacs 28.3.
* | ; Merge from origin/emacs-28Stefan Kangas2023-02-190-0/+0
|\ \ | |/ | | | | | | | | | | | | | | | | The following commits were skipped: e339926272a Fix etags local command injection vulnerability 5d05ea803e9 Fixed ctags local command execute vulnerability 22fb5ff5126 Fix ruby-mode.el local command injection vulnerability (b... 807d2d5b3a7 Fix htmlfontify.el command injection vulnerability. ae9bfed50db Fix storing email into nnmail by Gnus
| * Fix etags local command injection vulnerabilitylu4nx2023-02-171-5/+58
| | | | | | | | | | | | | | | | * lib-src/etags.c: (escape_shell_arg_string): New function. (process_file_name): Use it to quote file names passed to the shell. (Bug#59817) (cherry picked from commit 01a4035c869b91c153af9a9132c87adb7669ea1c)
| * Fixed ctags local command execute vulnerabilitylu4nx2023-02-175-36/+9093
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * lib-src/etags.c: (clean_matched_file_tag): New function (do_move_file): New function (readline_internal): Add `leave_cr` parameter, if true, include the \r character * test/manual/etags/CTAGS.good_crlf: New file * test/manual/etags/CTAGS.good_update: New file * test/manual/etags/crlf: New file * test/manual/etags/Makefile: Add `ctags -u` test cases (cherry picked from commit d48bb4874bc6cd3e69c7a15fc3c91cc141025c51)
| * Fix ruby-mode.el local command injection vulnerability (bug#60268)Xi Lu2023-02-171-1/+1
| | | | | | | | | | | | | | * lisp/progmodes/ruby-mode.el (ruby-find-library-file): Fix local command injection vulnerability. (cherry picked from commit 9a3b08061feea14d6f37685ca1ab8801758bfd1c)
| * Fix htmlfontify.el command injection vulnerability.Xi Lu2023-02-171-1/+1
| | | | | | | | | | | | | | * lisp/htmlfontify.el (hfy-text-p): Fix command injection vulnerability. (Bug#60295) (cherry picked from commit 1b4dc4691c1f87fc970fbe568b43869a15ad0d4c)
| * Fix storing email into nnmail by GnusEli Zaretskii2022-12-191-4/+9
| | | | | | | | | | | | | | | | | | | | | | Backporting suggested by Florian Weimer, since this is a denial-of-service issue. * lisp/gnus/nnml.el (nnml--encode-headers): Wrap 'rfc2047-encode-string' calls with 'ignore-errors', to avoid disrupting email workflows due to possibly-invalid headers. Reported by Florian Weimer <fweimer@redhat.com>. (cherry picked from commit 23f7c9c2a92e4619b7c4d2286d4249f812cd695d)
* | ; Improve image-dired-thumbnail-storage docstringStefan Kangas2023-02-191-8/+7
| | | | | | | | | | * lisp/image/image-dired.el (image-dired-thumbnail-storage): Improve docstring.
* | ; * doc/emacs/dired.texi (Image-Dired): Fix last change.Eli Zaretskii2023-02-191-3/+3
| |
* | More doc on image-dired-dired-* (bug#61624)Manuel Giraud2023-02-191-11/+25
| | | | | | | | | | * doc/emacs/dired.texi (Image-Dired): Some fixes and more documentation about image-dired-dired-* commands.
* | Eglot: improve treatment of completion items without :sortText (bug#61532)Theodor Thornhill2023-02-191-4/+3
| | | | | | | | | | | | | | | | Previously, defaulting to the empty string put candidates without :sortText to the top of the list. since string-lessp is safe with nil arguments, this makes them sort to the end instead. * lisp/progmodes/eglot.el (eglot-completion-at-point): Simplify.
* | ; * admin/make-tarball.txt: Minor copyedit.Stefan Kangas2023-02-191-2/+3
| |
* | Fix invocation of File->Close from the menu barEli Zaretskii2023-02-192-14/+16
| | | | | | | | | | | | | | | | | | | | * lisp/simple.el (kill-buffer--possibly-save): Don't request LONG-FORM from 'read-multiple-choice' if GUI dialog should be used. * lisp/emacs-lisp/rmc.el (read-multiple-choice): Doc fix. (read-multiple-choice--short-answers): Don't append "?" to CHOICES and don't display the prompt in the echo area if GUI dialog is used. Use 'use-dialog-box-p'. (Bug#61553)
* | ; Improve documentation of 'native-comp-enable-subr-trampolines'Eli Zaretskii2023-02-192-8/+15
| | | | | | | | | | | | * doc/lispref/compile.texi (Native-Compilation Variables): Document the interpretation of non-absolute directory names that are the value of 'native-comp-enable-subr-trampolines'.
* | Update thumbnail buffer's header moreManuel Giraud2023-02-191-1/+2
| | | | | | | | | | * lisp/image/image-dired.el (image-dired-display-thumbs): Call image-dired--update-header-line. (Bug#61508)
* | (treesit-query-validate): Fix reusing the output bufferDmitry Gutov2023-02-181-1/+2
| | | | | | | | | | * lisp/treesit.el (treesit-query-validate): Fix the "Buffer is read-only" error when an output buffer already exists.
* | (rust-ts-mode--font-lock-settings): Highlight closure parametersDmitry Gutov2023-02-181-0/+1
| | | | | | | | | | * lisp/progmodes/rust-ts-mode.el (rust-ts-mode--font-lock-settings): Highlight closure parameters.
* | * Fix `native-comp-enable-subr-trampolines' semanticAndrea Corallo2023-02-181-1/+2
| | | | | | | | | | | | * lisp/emacs-lisp/comp.el (comp--trampoline-abs-filename): Interpret `native-comp-enable-subr-trampolines' relative to `invocation-directory'.