mirror of
git://git.sv.gnu.org/emacs.git
synced 2025-12-15 10:30:25 -08:00
Merge from origin/emacs-29
a40f181623Fix two crashes upon startup44ebd9cbd5Eglot: explain how to update Eglot in manual (bug#62720)941ef044f2Eglot: fix edge case when deleting inlay hint overlaysa365984d9epackage-upgrade[-all]: Expand docstrings to note the curr...f965f35b33Rename all functions called package-*-update-* to package...31b58161bbFix FOR_EACH_TAIL in c-ts-mode (bug#62951)0cf6e0998b* Makefile.in (distclean): Remove the 'native-lisp' direc...933705d61eImprove greek-ibycus4 input method # Conflicts: # etc/NEWS
This commit is contained in:
commit
a97c382682
11 changed files with 220 additions and 50 deletions
|
|
@ -1030,6 +1030,9 @@ $(foreach dir,$(distclean_dirs),$(eval $(call submake_template,$(dir),distclean)
|
||||||
|
|
||||||
distclean: $(distclean_dirs:=_distclean) clean-gsettings-schemas
|
distclean: $(distclean_dirs:=_distclean) clean-gsettings-schemas
|
||||||
${top_distclean}
|
${top_distclean}
|
||||||
|
ifeq ($(HAVE_NATIVE_COMP),yes)
|
||||||
|
rm -rf native-lisp
|
||||||
|
endif
|
||||||
|
|
||||||
### 'bootstrap-clean'
|
### 'bootstrap-clean'
|
||||||
### Delete everything that can be reconstructed by 'make' and that
|
### Delete everything that can be reconstructed by 'make' and that
|
||||||
|
|
|
||||||
|
|
@ -329,15 +329,15 @@ version of the package, a newer version is also installed.
|
||||||
@section Package Installation
|
@section Package Installation
|
||||||
|
|
||||||
@findex package-install
|
@findex package-install
|
||||||
@findex package-update
|
@findex package-upgrade
|
||||||
@findex package-update-all
|
@findex package-upgrade-all
|
||||||
Packages are most conveniently installed using the package menu
|
Packages are most conveniently installed using the package menu
|
||||||
(@pxref{Package Menu}), but you can also use the command @kbd{M-x
|
(@pxref{Package Menu}), but you can also use the command @kbd{M-x
|
||||||
package-install}. This prompts for the name of a package with the
|
package-install}. This prompts for the name of a package with the
|
||||||
@samp{available} status, then downloads and installs it. Similarly,
|
@samp{available} status, then downloads and installs it. Similarly,
|
||||||
if you want to update a package, you can use the @kbd{M-x
|
if you want to upgrade a package, you can use the @kbd{M-x
|
||||||
package-update} command, and if you just want to update all the
|
package-upgrade} command, and if you want to upgrade all the packages,
|
||||||
packages, you can use the @kbd{M-x package-update-all} command.
|
you can use the @kbd{M-x package-upgrade-all} command.
|
||||||
|
|
||||||
@cindex package requirements
|
@cindex package requirements
|
||||||
A package may @dfn{require} certain other packages to be installed,
|
A package may @dfn{require} certain other packages to be installed,
|
||||||
|
|
@ -551,8 +551,8 @@ bugs.
|
||||||
source code for a package directly from source. The command will also
|
source code for a package directly from source. The command will also
|
||||||
automatically ensure that all files are byte-compiled and auto-loaded,
|
automatically ensure that all files are byte-compiled and auto-loaded,
|
||||||
just like with a regular package. Packages installed this way behave
|
just like with a regular package. Packages installed this way behave
|
||||||
just like any other package. You can update them using
|
just like any other package. You can upgrade them using
|
||||||
@code{package-update} or @code{package-update-all} and delete them
|
@code{package-upgrade} or @code{package-upgrade-all} and delete them
|
||||||
again using @code{package-delete}. They are even displayed in the
|
again using @code{package-delete}. They are even displayed in the
|
||||||
regular package listing. If you just wish to clone the source of a
|
regular package listing. If you just wish to clone the source of a
|
||||||
package, without adding it to the package list, use
|
package, without adding it to the package list, use
|
||||||
|
|
|
||||||
|
|
@ -1265,7 +1265,7 @@ is serialized by Eglot to the following JSON text:
|
||||||
@chapter Troubleshooting Eglot
|
@chapter Troubleshooting Eglot
|
||||||
@cindex troubleshooting Eglot
|
@cindex troubleshooting Eglot
|
||||||
|
|
||||||
This section documents commands and variables that can be used to
|
This chapter documents commands and variables that can be used to
|
||||||
troubleshoot Eglot problems. It also provides guidelines for
|
troubleshoot Eglot problems. It also provides guidelines for
|
||||||
reporting Eglot bugs in a way that facilitates their resolution.
|
reporting Eglot bugs in a way that facilitates their resolution.
|
||||||
|
|
||||||
|
|
@ -1275,6 +1275,8 @@ pop up special buffers that can be used to inspect the communications
|
||||||
between the Eglot and language server. In many cases, this will
|
between the Eglot and language server. In many cases, this will
|
||||||
indicate the problems or at least provide a hint.
|
indicate the problems or at least provide a hint.
|
||||||
|
|
||||||
|
@node Performance
|
||||||
|
@section Performance
|
||||||
@cindex performance
|
@cindex performance
|
||||||
A common and easy-to-fix cause of performance problems is the length
|
A common and easy-to-fix cause of performance problems is the length
|
||||||
of the Eglot events buffer because it represent additional work that
|
of the Eglot events buffer because it represent additional work that
|
||||||
|
|
@ -1289,6 +1291,30 @@ techniques to improve their performance. Often, this can be tweaked
|
||||||
by changing the server configuration (@pxref{Advanced server
|
by changing the server configuration (@pxref{Advanced server
|
||||||
configuration}).
|
configuration}).
|
||||||
|
|
||||||
|
@node Getting the latest version
|
||||||
|
@section Getting the latest version
|
||||||
|
@cindex updating Eglot
|
||||||
|
|
||||||
|
To install the latest Eglot on an Emacs version that does not bundle
|
||||||
|
Eglot, use @kbd{M-x package-install}.
|
||||||
|
|
||||||
|
Often, a newer Eglot version exists that has fixed a longstanding bug,
|
||||||
|
has more LSP features, or just better support for a particular
|
||||||
|
language server. Recent Eglot versions can self-update via the
|
||||||
|
command @kbd{M-x eglot-update}. This will replace any currently
|
||||||
|
installed version with the newest one available from the ELPA archives
|
||||||
|
configured in @code{package-archives}.
|
||||||
|
|
||||||
|
You may update though other methods, such as @code{package-install},
|
||||||
|
@code{use-package}, @code{list-packages} or the newer
|
||||||
|
@code{package-update}. However, do read the docstrings of these
|
||||||
|
commands, as some may not work in exactly the same way across Emacs
|
||||||
|
versions, meaning your configuration may be not portable.
|
||||||
|
|
||||||
|
@node Reporting bugs
|
||||||
|
@section Reporting bugs
|
||||||
|
@cindex bug reports
|
||||||
|
|
||||||
If you think you have found a bug, we want to hear about it. Before
|
If you think you have found a bug, we want to hear about it. Before
|
||||||
reporting a bug, keep in mind that interaction with language servers
|
reporting a bug, keep in mind that interaction with language servers
|
||||||
represents a large quantity of unknown variables. Therefore, it is
|
represents a large quantity of unknown variables. Therefore, it is
|
||||||
|
|
@ -1332,6 +1358,10 @@ public Git repository.
|
||||||
Include versions of the software used. The Emacs version can be
|
Include versions of the software used. The Emacs version can be
|
||||||
obtained with @kbd{M-x emacs-version}.
|
obtained with @kbd{M-x emacs-version}.
|
||||||
|
|
||||||
|
We welcome bug reports about all Eglot versions, but it is helpful to
|
||||||
|
first check if the problem isn't already fixed in the latest version
|
||||||
|
(@pxref{Getting the latest version}).
|
||||||
|
|
||||||
It's also essential to include the version of ELPA packages that are
|
It's also essential to include the version of ELPA packages that are
|
||||||
explicitly or implicitly loaded. The optional but popular Company or
|
explicitly or implicitly loaded. The optional but popular Company or
|
||||||
Markdown packages are distributed as GNU ELPA packages, not to mention
|
Markdown packages are distributed as GNU ELPA packages, not to mention
|
||||||
|
|
|
||||||
|
|
@ -1843,13 +1843,13 @@ this includes "binary" buffers like 'archive-mode' and 'image-mode'.
|
||||||
** Package
|
** Package
|
||||||
|
|
||||||
+++
|
+++
|
||||||
*** New command 'package-update'.
|
*** New command 'package-upgrade'.
|
||||||
This command allows you to upgrade packages without using 'M-x
|
This command allows you to upgrade packages without using 'M-x
|
||||||
list-packages'.
|
list-packages'.
|
||||||
|
|
||||||
+++
|
+++
|
||||||
*** New command 'package-update-all'.
|
*** New command 'package-upgrade-all'.
|
||||||
This command allows updating all packages without any queries.
|
This command allows upgrading all packages without any queries.
|
||||||
|
|
||||||
+++
|
+++
|
||||||
*** New commands 'package-recompile' and 'package-recompile-all'.
|
*** New commands 'package-recompile' and 'package-recompile-all'.
|
||||||
|
|
|
||||||
|
|
@ -24,7 +24,7 @@
|
||||||
|
|
||||||
;; While packages managed by package.el use tarballs for distributing
|
;; While packages managed by package.el use tarballs for distributing
|
||||||
;; the source code, this extension allows for packages to be fetched
|
;; the source code, this extension allows for packages to be fetched
|
||||||
;; and updated directly from a version control system.
|
;; and upgraded directly from a version control system.
|
||||||
;;
|
;;
|
||||||
;; To install a package from source use `package-vc-install'. If you
|
;; To install a package from source use `package-vc-install'. If you
|
||||||
;; aren't interested in activating a package, you can use
|
;; aren't interested in activating a package, you can use
|
||||||
|
|
@ -672,19 +672,19 @@ installed package."
|
||||||
#'string=)))
|
#'string=)))
|
||||||
|
|
||||||
;;;###autoload
|
;;;###autoload
|
||||||
(defun package-vc-update-all ()
|
(defun package-vc-upgrade-all ()
|
||||||
"Attempt to update all installed VC packages."
|
"Attempt to upgrade all installed VC packages."
|
||||||
(interactive)
|
(interactive)
|
||||||
(dolist (package package-alist)
|
(dolist (package package-alist)
|
||||||
(dolist (pkg-desc (cdr package))
|
(dolist (pkg-desc (cdr package))
|
||||||
(when (package-vc-p pkg-desc)
|
(when (package-vc-p pkg-desc)
|
||||||
(package-vc-update pkg-desc))))
|
(package-vc-upgrade pkg-desc))))
|
||||||
(message "Done updating packages."))
|
(message "Done upgrading packages."))
|
||||||
|
|
||||||
;;;###autoload
|
;;;###autoload
|
||||||
(defun package-vc-update (pkg-desc)
|
(defun package-vc-upgrade (pkg-desc)
|
||||||
"Attempt to update the package PKG-DESC."
|
"Attempt to upgrade the package PKG-DESC."
|
||||||
(interactive (list (package-vc--read-package-desc "Update VC package: " t)))
|
(interactive (list (package-vc--read-package-desc "Upgrade VC package: " t)))
|
||||||
;; HACK: To run `package-vc--unpack-1' after checking out the new
|
;; HACK: To run `package-vc--unpack-1' after checking out the new
|
||||||
;; revision, we insert a hook into `vc-post-command-functions', and
|
;; revision, we insert a hook into `vc-post-command-functions', and
|
||||||
;; remove it right after it ran. To avoid running the hook multiple
|
;; remove it right after it ran. To avoid running the hook multiple
|
||||||
|
|
@ -882,7 +882,7 @@ Rebuilding an installation means scraping for new autoload
|
||||||
cookies, re-compiling Emacs Lisp files, building and installing
|
cookies, re-compiling Emacs Lisp files, building and installing
|
||||||
any documentation, downloading any missing dependencies. This
|
any documentation, downloading any missing dependencies. This
|
||||||
command does not fetch new revisions from a remote server. That
|
command does not fetch new revisions from a remote server. That
|
||||||
is the responsibility of `package-vc-update'. Interactively,
|
is the responsibility of `package-vc-upgrade'. Interactively,
|
||||||
prompt for the name of the package to rebuild."
|
prompt for the name of the package to rebuild."
|
||||||
(interactive (list (package-vc--read-package-desc "Rebuild package: " t)))
|
(interactive (list (package-vc--read-package-desc "Rebuild package: " t)))
|
||||||
(package-vc--unpack-1 pkg-desc (package-desc-dir pkg-desc)))
|
(package-vc--unpack-1 pkg-desc (package-desc-dir pkg-desc)))
|
||||||
|
|
|
||||||
|
|
@ -2259,24 +2259,28 @@ had been enabled."
|
||||||
(message "Package `%s' installed." name))
|
(message "Package `%s' installed." name))
|
||||||
(message "`%s' is already installed" name))))
|
(message "`%s' is already installed" name))))
|
||||||
|
|
||||||
(declare-function package-vc-update "package-vc" (pkg))
|
(declare-function package-vc-upgrade "package-vc" (pkg))
|
||||||
|
|
||||||
;;;###autoload
|
;;;###autoload
|
||||||
(defun package-update (name)
|
(defun package-upgrade (name)
|
||||||
"Update package NAME if a newer version exists."
|
"Upgrade package NAME if a newer version exists.
|
||||||
|
|
||||||
|
Currently, packages which are part of the Emacs distribution
|
||||||
|
cannot be upgraded that way. Use `i' after `M-x list-packages' to
|
||||||
|
upgrade to an ELPA version first."
|
||||||
(interactive
|
(interactive
|
||||||
(list (completing-read
|
(list (completing-read
|
||||||
"Update package: " (package--updateable-packages) nil t)))
|
"Upgrade package: " (package--upgradeable-packages) nil t)))
|
||||||
(let* ((package (if (symbolp name)
|
(let* ((package (if (symbolp name)
|
||||||
name
|
name
|
||||||
(intern name)))
|
(intern name)))
|
||||||
(pkg-desc (cadr (assq package package-alist))))
|
(pkg-desc (cadr (assq package package-alist))))
|
||||||
(if (package-vc-p pkg-desc)
|
(if (package-vc-p pkg-desc)
|
||||||
(package-vc-update pkg-desc)
|
(package-vc-upgrade pkg-desc)
|
||||||
(package-delete pkg-desc 'force)
|
(package-delete pkg-desc 'force)
|
||||||
(package-install package 'dont-select))))
|
(package-install package 'dont-select))))
|
||||||
|
|
||||||
(defun package--updateable-packages ()
|
(defun package--upgradeable-packages ()
|
||||||
;; Initialize the package system to get the list of package
|
;; Initialize the package system to get the list of package
|
||||||
;; symbols for completion.
|
;; symbols for completion.
|
||||||
(package--archives-initialize)
|
(package--archives-initialize)
|
||||||
|
|
@ -2294,23 +2298,27 @@ had been enabled."
|
||||||
package-alist)))
|
package-alist)))
|
||||||
|
|
||||||
;;;###autoload
|
;;;###autoload
|
||||||
(defun package-update-all (&optional query)
|
(defun package-upgrade-all (&optional query)
|
||||||
"Refresh package list and upgrade all packages.
|
"Refresh package list and upgrade all packages.
|
||||||
If QUERY, ask the user before updating packages. When called
|
If QUERY, ask the user before upgrading packages. When called
|
||||||
interactively, QUERY is always true."
|
interactively, QUERY is always true.
|
||||||
|
|
||||||
|
Currently, packages which are part of the Emacs distribution are
|
||||||
|
not upgraded that way. Use `i' after `M-x list-packages' to
|
||||||
|
upgrade to an ELPA version first."
|
||||||
(interactive (list (not noninteractive)))
|
(interactive (list (not noninteractive)))
|
||||||
(package-refresh-contents)
|
(package-refresh-contents)
|
||||||
(let ((updateable (package--updateable-packages)))
|
(let ((upgradeable (package--upgradeable-packages)))
|
||||||
(if (not updateable)
|
(if (not upgradeable)
|
||||||
(message "No packages to update")
|
(message "No packages to upgrade")
|
||||||
(when (and query
|
(when (and query
|
||||||
(not (yes-or-no-p
|
(not (yes-or-no-p
|
||||||
(if (length= updateable 1)
|
(if (length= upgradeable 1)
|
||||||
"One package to update. Do it? "
|
"One package to upgrade. Do it? "
|
||||||
(format "%s packages to update. Do it?"
|
(format "%s packages to upgrade. Do it?"
|
||||||
(length updateable))))))
|
(length upgradeable))))))
|
||||||
(user-error "Updating aborted"))
|
(user-error "Upgrade aborted"))
|
||||||
(mapc #'package-update updateable))))
|
(mapc #'package-upgrade upgradeable))))
|
||||||
|
|
||||||
(defun package--dependencies (pkg)
|
(defun package--dependencies (pkg)
|
||||||
"Return a list of all dependencies PKG has.
|
"Return a list of all dependencies PKG has.
|
||||||
|
|
|
||||||
|
|
@ -1116,6 +1116,7 @@ nil t t nil nil nil nil nil nil nil t)
|
||||||
("'U" ?Ύ)
|
("'U" ?Ύ)
|
||||||
|
|
||||||
("`R" ?Ῥ)
|
("`R" ?Ῥ)
|
||||||
|
("(R" ?Ῥ)
|
||||||
|
|
||||||
("+`" ?῭) ; #x1fed
|
("+`" ?῭) ; #x1fed
|
||||||
("+'" ?΅) ; #x1fee
|
("+'" ?΅) ; #x1fee
|
||||||
|
|
|
||||||
|
|
@ -357,7 +357,9 @@ PARENT, BOL, ARGS are the same as other anchor functions."
|
||||||
"Indent rules supported by `c-ts-mode'.
|
"Indent rules supported by `c-ts-mode'.
|
||||||
MODE is either `c' or `cpp'."
|
MODE is either `c' or `cpp'."
|
||||||
(let ((common
|
(let ((common
|
||||||
`(((parent-is "translation_unit") column-0 0)
|
`((c-ts-mode--for-each-tail-body-matcher prev-line c-ts-mode-indent-offset)
|
||||||
|
|
||||||
|
((parent-is "translation_unit") column-0 0)
|
||||||
((query "(ERROR (ERROR)) @indent") column-0 0)
|
((query "(ERROR (ERROR)) @indent") column-0 0)
|
||||||
((node-is ")") parent 1)
|
((node-is ")") parent 1)
|
||||||
((node-is "]") parent-bol 0)
|
((node-is "]") parent-bol 0)
|
||||||
|
|
@ -969,6 +971,81 @@ if `c-ts-mode-emacs-sources-support' is non-nil."
|
||||||
(or (treesit-add-log-current-defun)
|
(or (treesit-add-log-current-defun)
|
||||||
(c-ts-mode--defun-name (c-ts-mode--emacs-defun-at-point))))
|
(c-ts-mode--defun-name (c-ts-mode--emacs-defun-at-point))))
|
||||||
|
|
||||||
|
;;; FOR_EACH_TAIL fix
|
||||||
|
;;
|
||||||
|
;; FOR_EACH_TAIL (and FOR_EACH_TAIL_SAFE) followed by a unbracketed
|
||||||
|
;; body will mess up the parser, which parses the thing as a function
|
||||||
|
;; declaration. We "fix" it by adding a shadow parser, emacs-c (which
|
||||||
|
;; is just c but under a different name). We use emacs-c to find each
|
||||||
|
;; FOR_EACH_TAIL with a unbracketed body, and set the ranges of the C
|
||||||
|
;; parser so that it skips those FOR_EACH_TAIL's. Note that we only
|
||||||
|
;; ignore FOR_EACH_TAIL's with a unbracketed body. Those with a
|
||||||
|
;; bracketed body parses more or less fine.
|
||||||
|
|
||||||
|
(defvar c-ts-mode--for-each-tail-regexp
|
||||||
|
(rx "FOR_EACH_" (or "TAIL" "TAIL_SAFE" "ALIST_VALUE"
|
||||||
|
"LIVE_BUFFER" "FRAME"))
|
||||||
|
"A regexp matching all the FOR_EACH_TAIL variants.")
|
||||||
|
|
||||||
|
(defun c-ts-mode--for-each-tail-body-matcher (_n _p bol &rest _)
|
||||||
|
"A matcher that matches the first line after a FOR_EACH_TAIL.
|
||||||
|
For BOL see `treesit-simple-indent-rules'."
|
||||||
|
(when c-ts-mode-emacs-sources-support
|
||||||
|
(save-excursion
|
||||||
|
(goto-char bol)
|
||||||
|
(forward-line -1)
|
||||||
|
(skip-chars-forward " \t")
|
||||||
|
(looking-at c-ts-mode--for-each-tail-regexp))))
|
||||||
|
|
||||||
|
(defvar c-ts-mode--emacs-c-range-query
|
||||||
|
(treesit-query-compile
|
||||||
|
'emacs-c `(((declaration
|
||||||
|
type: (macro_type_specifier
|
||||||
|
name: (identifier) @_name)
|
||||||
|
@for-each-tail)
|
||||||
|
(:match ,c-ts-mode--for-each-tail-regexp
|
||||||
|
@_name))))
|
||||||
|
"Query that finds the FOR_EACH_TAIL with a unbracketed body.")
|
||||||
|
|
||||||
|
(defvar-local c-ts-mode--for-each-tail-ranges nil
|
||||||
|
"Ranges covering all the FOR_EACH_TAIL's in the buffer.")
|
||||||
|
|
||||||
|
(defun c-ts-mode--reverse-ranges (ranges beg end)
|
||||||
|
"Reverse RANGES and return the new ranges between BEG and END.
|
||||||
|
Positions that were included RANGES are not in the returned
|
||||||
|
ranges, and vice versa.
|
||||||
|
|
||||||
|
Return nil if RANGES is nil. This way, passing the returned
|
||||||
|
ranges to `treesit-parser-set-included-ranges' will make the
|
||||||
|
parser parse the whole buffer."
|
||||||
|
(if (null ranges)
|
||||||
|
nil
|
||||||
|
(let ((new-ranges nil)
|
||||||
|
(prev-end beg))
|
||||||
|
(dolist (range ranges)
|
||||||
|
(when (< prev-end (car range))
|
||||||
|
(push (cons prev-end (car range)) new-ranges))
|
||||||
|
(setq prev-end (cdr range)))
|
||||||
|
(when (< prev-end end)
|
||||||
|
(push (cons prev-end end) new-ranges))
|
||||||
|
(nreverse new-ranges))))
|
||||||
|
|
||||||
|
(defun c-ts-mode--emacs-set-ranges (beg end)
|
||||||
|
"Set ranges for the C parser to skip some FOR_EACH_TAIL's.
|
||||||
|
BEG and END are described in `treesit-range-rules'."
|
||||||
|
(let* ((c-parser (treesit-parser-create 'c))
|
||||||
|
(old-ranges c-ts-mode--for-each-tail-ranges)
|
||||||
|
(new-ranges (treesit-query-range
|
||||||
|
'emacs-c c-ts-mode--emacs-c-range-query beg end))
|
||||||
|
(set-ranges (treesit--clip-ranges
|
||||||
|
(treesit--merge-ranges
|
||||||
|
old-ranges new-ranges beg end)
|
||||||
|
(point-min) (point-max)))
|
||||||
|
(reversed-ranges (c-ts-mode--reverse-ranges
|
||||||
|
set-ranges (point-min) (point-max))))
|
||||||
|
(setq-local c-ts-mode--for-each-tail-ranges set-ranges)
|
||||||
|
(treesit-parser-set-included-ranges c-parser reversed-ranges)))
|
||||||
|
|
||||||
;;; Modes
|
;;; Modes
|
||||||
|
|
||||||
(defvar-keymap c-ts-base-mode-map
|
(defvar-keymap c-ts-base-mode-map
|
||||||
|
|
@ -1101,6 +1178,17 @@ in your configuration."
|
||||||
:after-hook (c-ts-mode-set-modeline)
|
:after-hook (c-ts-mode-set-modeline)
|
||||||
|
|
||||||
(when (treesit-ready-p 'c)
|
(when (treesit-ready-p 'c)
|
||||||
|
;; Add a fake "emacs-c" language which is just C. Used for
|
||||||
|
;; skipping FOR_EACH_TAIL, see `c-ts-mode--emacs-set-ranges'.
|
||||||
|
(setf (alist-get 'emacs-c treesit-load-name-override-list)
|
||||||
|
'("libtree-sitter-c" "tree_sitter_c"))
|
||||||
|
;; If Emacs source support is enabled, make sure emacs-c parser is
|
||||||
|
;; after c parser in the parser list. This way various tree-sitter
|
||||||
|
;; functions will automatically use the c parser rather than the
|
||||||
|
;; emacs-c parser.
|
||||||
|
(when c-ts-mode-emacs-sources-support
|
||||||
|
(treesit-parser-create 'emacs-c))
|
||||||
|
|
||||||
(treesit-parser-create 'c)
|
(treesit-parser-create 'c)
|
||||||
;; Comments.
|
;; Comments.
|
||||||
(setq-local comment-start "/* ")
|
(setq-local comment-start "/* ")
|
||||||
|
|
@ -1114,9 +1202,16 @@ in your configuration."
|
||||||
(setq-local treesit-defun-tactic 'top-level)
|
(setq-local treesit-defun-tactic 'top-level)
|
||||||
(treesit-major-mode-setup)
|
(treesit-major-mode-setup)
|
||||||
|
|
||||||
|
;; Emacs source support: handle DEFUN and FOR_EACH_TAIL gracefully.
|
||||||
(when c-ts-mode-emacs-sources-support
|
(when c-ts-mode-emacs-sources-support
|
||||||
(setq-local add-log-current-defun-function
|
(setq-local add-log-current-defun-function
|
||||||
#'c-ts-mode--emacs-current-defun-name))))
|
#'c-ts-mode--emacs-current-defun-name)
|
||||||
|
|
||||||
|
(setq-local treesit-range-settings
|
||||||
|
(treesit-range-rules 'c-ts-mode--emacs-set-ranges))
|
||||||
|
|
||||||
|
(setq-local treesit-language-at-point-function
|
||||||
|
(lambda (_pos) 'c)))))
|
||||||
|
|
||||||
;;;###autoload
|
;;;###autoload
|
||||||
(define-derived-mode c++-ts-mode c-ts-base-mode "C++"
|
(define-derived-mode c++-ts-mode c-ts-base-mode "C++"
|
||||||
|
|
|
||||||
|
|
@ -2002,6 +2002,16 @@ If it is activated, also signal textDocument/didOpen."
|
||||||
(declare (obsolete info "1.10"))
|
(declare (obsolete info "1.10"))
|
||||||
(interactive) (info "(eglot)"))
|
(interactive) (info "(eglot)"))
|
||||||
|
|
||||||
|
;;;###autoload
|
||||||
|
(defun eglot-update (&rest _) "Update Eglot."
|
||||||
|
(interactive)
|
||||||
|
(with-no-warnings
|
||||||
|
(require 'package)
|
||||||
|
(unless package-archive-contents (package-refresh-contents))
|
||||||
|
(when-let ((existing (cadr (assoc 'eglot package-alist))))
|
||||||
|
(package-delete existing t))
|
||||||
|
(package-install (cadr (assoc 'eglot package-archive-contents)))))
|
||||||
|
|
||||||
(easy-menu-define eglot-menu nil "Eglot"
|
(easy-menu-define eglot-menu nil "Eglot"
|
||||||
`("Eglot"
|
`("Eglot"
|
||||||
;; Commands for getting information and customization.
|
;; Commands for getting information and customization.
|
||||||
|
|
@ -3129,8 +3139,7 @@ for which LSP on-type-formatting should be requested."
|
||||||
(funcall snippet-fn (or insertText label))))
|
(funcall snippet-fn (or insertText label))))
|
||||||
(when (cl-plusp (length additionalTextEdits))
|
(when (cl-plusp (length additionalTextEdits))
|
||||||
(eglot--apply-text-edits additionalTextEdits)))
|
(eglot--apply-text-edits additionalTextEdits)))
|
||||||
(eglot--signal-textDocument/didChange)
|
(eglot--signal-textDocument/didChange)))))))))
|
||||||
(eldoc)))))))))
|
|
||||||
|
|
||||||
(defun eglot--hover-info (contents &optional _range)
|
(defun eglot--hover-info (contents &optional _range)
|
||||||
(mapconcat #'eglot--format-markup
|
(mapconcat #'eglot--format-markup
|
||||||
|
|
@ -3743,7 +3752,19 @@ If NOERROR, return predicate, else erroring function."
|
||||||
:success-fn (lambda (hints)
|
:success-fn (lambda (hints)
|
||||||
(eglot--when-live-buffer buf
|
(eglot--when-live-buffer buf
|
||||||
(eglot--widening
|
(eglot--widening
|
||||||
(remove-overlays from to 'eglot--inlay-hint t)
|
;; Overlays ending right at FROM with an
|
||||||
|
;; `after-string' property logically belong to
|
||||||
|
;; the (FROM TO) region. Likewise, such
|
||||||
|
;; overlays ending at TO don't logically belong
|
||||||
|
;; to it.
|
||||||
|
(dolist (o (overlays-in (1- from) to))
|
||||||
|
(when (and (overlay-get o 'eglot--inlay-hint)
|
||||||
|
(cond ((eq (overlay-end o) from)
|
||||||
|
(overlay-get o 'after-string))
|
||||||
|
((eq (overlay-end o) to)
|
||||||
|
(overlay-get o 'before-string))
|
||||||
|
(t)))
|
||||||
|
(delete-overlay o)))
|
||||||
(mapc paint-hint hints))))
|
(mapc paint-hint hints))))
|
||||||
:deferred 'eglot--update-hints-1)))
|
:deferred 'eglot--update-hints-1)))
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -421,13 +421,16 @@ See `treesit-query-capture' for QUERY."
|
||||||
(defun treesit-query-range (node query &optional beg end)
|
(defun treesit-query-range (node query &optional beg end)
|
||||||
"Query the current buffer and return ranges of captured nodes.
|
"Query the current buffer and return ranges of captured nodes.
|
||||||
|
|
||||||
QUERY, NODE, BEG, END are the same as in
|
QUERY, NODE, BEG, END are the same as in `treesit-query-capture'.
|
||||||
`treesit-query-capture'. This function returns a list
|
This function returns a list of (START . END), where START and
|
||||||
of (START . END), where START and END specifics the range of each
|
END specifics the range of each captured node. Capture names
|
||||||
captured node. Capture names don't matter."
|
generally don't matter, but names that starts with an underscore
|
||||||
|
are ignored."
|
||||||
(cl-loop for capture
|
(cl-loop for capture
|
||||||
in (treesit-query-capture node query beg end)
|
in (treesit-query-capture node query beg end)
|
||||||
|
for name = (car capture)
|
||||||
for node = (cdr capture)
|
for node = (cdr capture)
|
||||||
|
if (not (string-prefix-p "_" (symbol-name name)))
|
||||||
collect (cons (treesit-node-start node)
|
collect (cons (treesit-node-start node)
|
||||||
(treesit-node-end node))))
|
(treesit-node-end node))))
|
||||||
|
|
||||||
|
|
@ -442,6 +445,9 @@ When updating the range of each parser in the buffer,
|
||||||
range to the range spanned by captured nodes. QUERY must be a
|
range to the range spanned by captured nodes. QUERY must be a
|
||||||
compiled query.
|
compiled query.
|
||||||
|
|
||||||
|
Capture names generally don't matter, but names that starts with
|
||||||
|
an underscore are ignored.
|
||||||
|
|
||||||
QUERY can also be a function, in which case it is called with 2
|
QUERY can also be a function, in which case it is called with 2
|
||||||
arguments, START and END. It should ensure parsers' ranges are
|
arguments, START and END. It should ensure parsers' ranges are
|
||||||
correct in the region between START and END.
|
correct in the region between START and END.
|
||||||
|
|
@ -461,6 +467,9 @@ like this:
|
||||||
Each QUERY is a tree-sitter query in either the string,
|
Each QUERY is a tree-sitter query in either the string,
|
||||||
s-expression or compiled form.
|
s-expression or compiled form.
|
||||||
|
|
||||||
|
Capture names generally don't matter, but names that starts with
|
||||||
|
an underscore are ignored.
|
||||||
|
|
||||||
For each QUERY, :KEYWORD and VALUE pairs add meta information to
|
For each QUERY, :KEYWORD and VALUE pairs add meta information to
|
||||||
it. For example,
|
it. For example,
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -479,7 +479,8 @@ image_create_bitmap_from_data (struct frame *f, char *bits,
|
||||||
|
|
||||||
#ifdef HAVE_X_WINDOWS
|
#ifdef HAVE_X_WINDOWS
|
||||||
Pixmap bitmap;
|
Pixmap bitmap;
|
||||||
bitmap = XCreateBitmapFromData (FRAME_X_DISPLAY (f), FRAME_X_DRAWABLE (f),
|
bitmap = XCreateBitmapFromData (FRAME_X_DISPLAY (f),
|
||||||
|
dpyinfo->root_window,
|
||||||
bits, width, height);
|
bits, width, height);
|
||||||
if (! bitmap)
|
if (! bitmap)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
@ -729,8 +730,10 @@ image_create_bitmap_from_file (struct frame *f, Lisp_Object file)
|
||||||
|
|
||||||
filename = SSDATA (found);
|
filename = SSDATA (found);
|
||||||
|
|
||||||
result = XReadBitmapFile (FRAME_X_DISPLAY (f), FRAME_X_DRAWABLE (f),
|
result = XReadBitmapFile (FRAME_X_DISPLAY (f),
|
||||||
filename, &width, &height, &bitmap, &xhot, &yhot);
|
dpyinfo->root_window,
|
||||||
|
filename, &width, &height, &bitmap,
|
||||||
|
&xhot, &yhot);
|
||||||
if (result != BitmapSuccess)
|
if (result != BitmapSuccess)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue