mirror of
https://git.savannah.gnu.org/git/emacs.git
synced 2025-01-11 16:08:13 +00:00
Merge from origin/emacs-29
dbbcf4a659
Fix fontification of " in edit-kbd-macro2137fdfd55
* lisp/emacs-lisp/gv.el (buffer-local-value): Unobsolete ...e660ee88e3
; Remove incorrect example from ELisp Reference manualc32fd92d67
Add documentation to plstore.el57760f585e
* lisp/help.el (substitute-quotes): Improve docstring.60dcea7658
Fix two defcustom :types890a4c209a
Fix `image-auto-resize-on-window-resize' custom :type369f2eea10
Add "terraform-ls" LSP server to Eglot5cbe96d17f
; Improve documentation of 'char-table-range'a219ee8c31
Fix minor bugs in vc-git and vc-hg on Windows uncovered b...3f7598806e
Add syntax-propertize-function to js-ts-mode18b292140e
; * src/treesit.c: Add ts function boilerplateec4d29c449
Improve performance of treesit_cursor_helper_1 # Conflicts: # lisp/vc/vc-git.el # src/treesit.c
This commit is contained in:
commit
7395123479
@ -2762,16 +2762,6 @@ the @code{track-mouse} macro, that produces an event like this:
|
||||
(mouse-movement (#<frame *ielm* 0x102849a30> nil (563 . 205) 532301936))
|
||||
@end smallexample
|
||||
|
||||
To handle a SIGUSR1 signal, define an interactive function, and
|
||||
bind it to the @code{signal usr1} event sequence:
|
||||
|
||||
@smallexample
|
||||
(defun usr1-handler ()
|
||||
(interactive)
|
||||
(message "Got USR1 signal"))
|
||||
(keymap-global-set "<signal> <usr1>" 'usr1-handler)
|
||||
@end smallexample
|
||||
|
||||
@node Classifying Events
|
||||
@subsection Classifying Events
|
||||
@cindex event type
|
||||
|
@ -1645,7 +1645,8 @@ Refers to the element for character @var{char}
|
||||
|
||||
@item @code{(@var{from} . @var{to})}
|
||||
A cons cell refers to all the characters in the inclusive range
|
||||
@samp{[@var{from}..@var{to}]}.
|
||||
@samp{[@var{from}..@var{to}]}. In this case, the function returns the
|
||||
value for the character specified by @var{from}.
|
||||
@end table
|
||||
@end defun
|
||||
|
||||
|
@ -179,7 +179,7 @@ With a prefix argument, format the macro in a more concise way."
|
||||
(setq-local edmacro-finish-hook finish-hook)
|
||||
(setq-local edmacro-store-hook store-hook)
|
||||
(setq-local font-lock-defaults
|
||||
'(edmacro-mode-font-lock-keywords nil nil nil nil))
|
||||
'(edmacro-mode-font-lock-keywords nil nil ((?\" . "w"))))
|
||||
(setq font-lock-multiline nil)
|
||||
(erase-buffer)
|
||||
(insert (substitute-command-keys
|
||||
|
@ -411,7 +411,6 @@ The return value is the last VAL in the list.
|
||||
(gv-define-setter buffer-local-value (val var buf)
|
||||
(macroexp-let2 nil v val
|
||||
`(with-current-buffer ,buf (set (make-local-variable ,var) ,v))))
|
||||
(make-obsolete-generalized-variable 'buffer-local-value nil "29.1")
|
||||
|
||||
(gv-define-expander alist-get
|
||||
(lambda (do key alist &optional default remove testfn)
|
||||
|
@ -2906,7 +2906,7 @@ Values smaller than 0.2 sec are treated as 0.2 sec."
|
||||
"How many times to blink before using a solid cursor on NS, X, and MS-Windows.
|
||||
Use 0 or negative value to blink forever."
|
||||
:version "24.4"
|
||||
:type 'natnum
|
||||
:type 'integer
|
||||
:group 'cursor)
|
||||
|
||||
(defvar blink-cursor-blinks-done 1
|
||||
|
@ -1508,10 +1508,11 @@ Otherwise, return a new string."
|
||||
(buffer-string)))))
|
||||
|
||||
(defun substitute-quotes (string)
|
||||
"Substitute quote characters for display.
|
||||
"Substitute quote characters in STRING for display.
|
||||
Each grave accent \\=` is replaced by left quote, and each
|
||||
apostrophe \\=' is replaced by right quote. Left and right quote
|
||||
characters are specified by `text-quoting-style'."
|
||||
apostrophe \\=' is replaced by right quote. Which left and right
|
||||
quote characters to use is determined by the variable
|
||||
`text-quoting-style'."
|
||||
(cond ((eq (text-quoting-style) 'curve)
|
||||
(string-replace "`" "‘"
|
||||
(string-replace "'" "’" string)))
|
||||
|
@ -89,7 +89,7 @@ This will always keep the image fit to the window.
|
||||
When non-nil, the value should be a number of seconds to wait before
|
||||
resizing according to the value specified in `image-auto-resize'."
|
||||
:type '(choice (const :tag "No auto-resize on window size change" nil)
|
||||
(integer :tag "Wait for number of seconds before resize" 1))
|
||||
(number :tag "Wait for number of seconds before resize" 1))
|
||||
:version "27.1"
|
||||
:group 'image)
|
||||
|
||||
|
@ -24,14 +24,31 @@
|
||||
|
||||
;; Plist based data store providing search and partial encryption.
|
||||
;;
|
||||
;; By default, this package uses symmetric encryption, which means
|
||||
;; By default, this library uses symmetric encryption, which means
|
||||
;; that you have to enter the password protecting your store more
|
||||
;; often than you probably expect to. To use public key encryption
|
||||
;; with this package, create a GnuPG key and customize user option
|
||||
;; with this library, create a GnuPG key and customize user option
|
||||
;; `plstore-encrypt-to' to use it. You can then configure the GnuPG
|
||||
;; agent to adjust caching and expiration of the passphrase for your
|
||||
;; store.
|
||||
;;
|
||||
;; You can read more on these topics in the EasyPG Assistant user's
|
||||
;; manual (Info node `(epa)'), of which much information also applies
|
||||
;; to this library. Most notably:
|
||||
;;
|
||||
;; - Info node `(epa)GnuPG version compatibility'
|
||||
;; - Info node `(epa)GnuPG Pinentry'
|
||||
;; - Info node `(epa)Caching Passphrases'
|
||||
;;
|
||||
;; Use only keyword symbols (starting with a colon) as property names
|
||||
;; in any plist stored with this library. While this library does not
|
||||
;; actively enforce the use of keyword symbols, it silently assumes
|
||||
;; that the first character of all property names can be discarded
|
||||
;; without sacrificing uniqueness of names (FIXME). Likewise, this
|
||||
;; library does not enforce that the plists provided as input are
|
||||
;; actually valid and can behave in undefined ways if they are not
|
||||
;; (FIXME).
|
||||
;;
|
||||
;; Creating:
|
||||
;;
|
||||
;; ;; Open a new store associated with ~/.emacs.d/auth.plist.
|
||||
@ -52,8 +69,8 @@
|
||||
;; (plstore-close store)
|
||||
;;
|
||||
;; Avoid marking one property both as public *and* secret, as the
|
||||
;; behavior of this package with respect to such duplicate properties
|
||||
;; is not (yet) defined.
|
||||
;; behavior of this library with respect to such duplicate properties
|
||||
;; is not defined (FIXME).
|
||||
;;
|
||||
;; Searching:
|
||||
;;
|
||||
@ -71,7 +88,7 @@
|
||||
;; ;; While the entry "baz" associated with "baz.example.org" has also
|
||||
;; ;; a secret property `:password', it is encrypted together with
|
||||
;; ;; `:user' of "bar", so no need to decrypt the secret.
|
||||
;; (plstore-find store '(:host ("bar.example.org")))
|
||||
;; (plstore-find store '(:host ("baz.example.org")))
|
||||
;;
|
||||
;; (plstore-close store)
|
||||
;;
|
||||
@ -87,8 +104,8 @@
|
||||
;; `:secret-' prefix) is marked as secret. Thus, when you save the
|
||||
;; buffer, the `:secret-user' property is encrypted as `:user'. Do
|
||||
;; not use a property consisting solely of the prefix, as the behavior
|
||||
;; of this package with respect to such properties is not (yet)
|
||||
;; defined.
|
||||
;; of this library with respect to such properties is not defined
|
||||
;; (FIXME).
|
||||
;;
|
||||
;; You can toggle the view between encrypted form and the decrypted
|
||||
;; form with C-c C-c.
|
||||
@ -101,7 +118,7 @@
|
||||
;; Internals:
|
||||
;;
|
||||
;; This is information on the internal data structure and functions of
|
||||
;; this package. None of it should be necessary to actually use it.
|
||||
;; this library. None of it should be necessary to actually use it.
|
||||
;; For easier reading, we usually do not distinguish in this internal
|
||||
;; documentation between a Lisp object and its printed representation.
|
||||
;;
|
||||
@ -589,7 +606,11 @@ If no one is selected, symmetric encryption will be performed. "
|
||||
(insert ";;; secret entries\n" (pp-to-string cipher)))))
|
||||
|
||||
(defun plstore-save (plstore)
|
||||
"Save PLSTORE to its associated file."
|
||||
"Save PLSTORE to its associated file.
|
||||
Save with symmetric encryption or public key encryption depending
|
||||
on `plstore-encrypt-to'. If `plstore-encrypt-to' is non-nil but
|
||||
none of the recipients from `plstore-encrypt-to' matches any
|
||||
GnuPG key, silently save with symmetric encryption." ; (FIXME)
|
||||
(with-current-buffer (plstore--get-buffer plstore)
|
||||
(erase-buffer)
|
||||
(plstore--insert-buffer plstore)
|
||||
|
@ -259,7 +259,8 @@ chosen (interactively or automatically)."
|
||||
. ,(eglot-alternatives
|
||||
'(("marksman" "server")
|
||||
("vscode-markdown-language-server" "--stdio"))))
|
||||
(graphviz-dot-mode . ("dot-language-server" "--stdio")))
|
||||
(graphviz-dot-mode . ("dot-language-server" "--stdio"))
|
||||
(terraform-mode . ("terraform-ls" "serve")))
|
||||
"How the command `eglot' guesses the server to start.
|
||||
An association list of (MAJOR-MODE . CONTACT) pairs. MAJOR-MODE
|
||||
identifies the buffers that are to be managed by a specific
|
||||
|
@ -3878,6 +3878,7 @@ See `treesit-sexp-type-regexp' for more information.")
|
||||
(append "{}():;,<>/" electric-indent-chars)) ;FIXME: js2-mode adds "[]*".
|
||||
(setq-local electric-layout-rules
|
||||
'((?\; . after) (?\{ . after) (?\} . before)))
|
||||
(setq-local syntax-propertize-function #'js-ts--syntax-propertize)
|
||||
|
||||
;; Tree-sitter setup.
|
||||
(treesit-parser-create 'javascript)
|
||||
@ -3921,6 +3922,29 @@ See `treesit-sexp-type-regexp' for more information.")
|
||||
(add-to-list 'auto-mode-alist
|
||||
'("\\(\\.js[mx]\\|\\.har\\)\\'" . js-ts-mode))))
|
||||
|
||||
(defvar js-ts--s-p-query
|
||||
(when (treesit-available-p)
|
||||
(treesit-query-compile 'javascript
|
||||
'(((regex pattern: (regex_pattern) @regexp))
|
||||
((variable_declarator value: (jsx_element) @jsx))
|
||||
((assignment_expression right: (jsx_element) @jsx))
|
||||
((return_statement (jsx_element) @jsx))))))
|
||||
|
||||
(defun js-ts--syntax-propertize (beg end)
|
||||
(let ((captures (treesit-query-capture 'javascript js-ts--s-p-query beg end)))
|
||||
(pcase-dolist (`(,name . ,node) captures)
|
||||
(let* ((ns (treesit-node-start node))
|
||||
(ne (treesit-node-end node))
|
||||
(syntax (pcase-exhaustive name
|
||||
('regexp
|
||||
(cl-decf ns)
|
||||
(cl-incf ne)
|
||||
(string-to-syntax "\"/"))
|
||||
('jsx
|
||||
(string-to-syntax "|")))))
|
||||
(put-text-property ns (1+ ns) 'syntax-table syntax)
|
||||
(put-text-property (1- ne) ne 'syntax-table syntax)))))
|
||||
|
||||
;;;###autoload
|
||||
(define-derived-mode js-json-mode js-mode "JSON"
|
||||
(setq-local js-enabled-frameworks nil)
|
||||
|
@ -331,7 +331,7 @@ undefined."
|
||||
(defcustom url-max-redirections 30
|
||||
"The maximum number of redirection requests to honor in a HTTP connection.
|
||||
A negative number means to honor an unlimited number of redirection requests."
|
||||
:type 'natnum
|
||||
:type 'integer
|
||||
:group 'url)
|
||||
|
||||
(defcustom url-confirmation-func 'y-or-n-p
|
||||
|
@ -1058,7 +1058,8 @@ It is based on `log-edit-mode', and has Git-specific extensions."
|
||||
;; might not support the non-ASCII characters in the log
|
||||
;; message. Handle also remote files.
|
||||
(if (eq system-type 'windows-nt)
|
||||
(let ((default-directory (file-name-directory file1)))
|
||||
(let ((default-directory (or (file-name-directory file1)
|
||||
default-directory)))
|
||||
(make-nearby-temp-file "git-msg"))))
|
||||
to-stash)
|
||||
(when vc-git-patch-string
|
||||
|
@ -249,7 +249,10 @@ If `ask', you will be prompted for a branch type."
|
||||
(error nil)))))))
|
||||
(when (and (eq 0 status)
|
||||
(> (length out) 0)
|
||||
(null (string-match ".*: No such file or directory$" out)))
|
||||
;; Posix
|
||||
(null (or (string-match ".*: No such file or directory$" out)
|
||||
;; MS-Windows
|
||||
(string-match ".*: The system cannot find the file specified$" out))))
|
||||
(let ((state (aref out 0)))
|
||||
(cond
|
||||
((eq state ?=) 'up-to-date)
|
||||
|
@ -580,7 +580,8 @@ DEFUN ("char-table-range", Fchar_table_range, Schar_table_range,
|
||||
2, 2, 0,
|
||||
doc: /* Return the value in CHAR-TABLE for a range of characters RANGE.
|
||||
RANGE should be nil (for the default value),
|
||||
a cons of character codes (for characters in the range), or a character code. */)
|
||||
a cons of character codes (for characters in the range), or a character code.
|
||||
If RANGE is a cons (FROM . TO), the function returns the value for FROM. */)
|
||||
(Lisp_Object char_table, Lisp_Object range)
|
||||
{
|
||||
Lisp_Object val;
|
||||
|
@ -80,6 +80,7 @@ along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>. */
|
||||
#undef ts_tree_cursor_current_node
|
||||
#undef ts_tree_cursor_delete
|
||||
#undef ts_tree_cursor_goto_first_child
|
||||
#undef ts_tree_cursor_goto_first_child_for_byte
|
||||
#undef ts_tree_cursor_goto_next_sibling
|
||||
#undef ts_tree_cursor_goto_parent
|
||||
#undef ts_tree_cursor_new
|
||||
@ -147,6 +148,7 @@ DEF_DLL_FN (TSTreeCursor, ts_tree_cursor_copy, (const TSTreeCursor *));
|
||||
DEF_DLL_FN (TSNode, ts_tree_cursor_current_node, (const TSTreeCursor *));
|
||||
DEF_DLL_FN (void, ts_tree_cursor_delete, (const TSTreeCursor *));
|
||||
DEF_DLL_FN (bool, ts_tree_cursor_goto_first_child, (TSTreeCursor *));
|
||||
DEF_DLL_FN (int64_t, ts_tree_cursor_goto_first_child_for_byte, (TSTreeCursor *, uint32_t));
|
||||
DEF_DLL_FN (bool, ts_tree_cursor_goto_next_sibling, (TSTreeCursor *));
|
||||
DEF_DLL_FN (bool, ts_tree_cursor_goto_parent, (TSTreeCursor *));
|
||||
DEF_DLL_FN (TSTreeCursor, ts_tree_cursor_new, (TSNode));
|
||||
@ -210,6 +212,7 @@ init_treesit_functions (void)
|
||||
LOAD_DLL_FN (library, ts_tree_cursor_current_node);
|
||||
LOAD_DLL_FN (library, ts_tree_cursor_delete);
|
||||
LOAD_DLL_FN (library, ts_tree_cursor_goto_first_child);
|
||||
LOAD_DLL_FN (library, ts_tree_cursor_goto_first_child_for_byte);
|
||||
LOAD_DLL_FN (library, ts_tree_cursor_goto_next_sibling);
|
||||
LOAD_DLL_FN (library, ts_tree_cursor_goto_parent);
|
||||
LOAD_DLL_FN (library, ts_tree_cursor_new);
|
||||
@ -267,6 +270,7 @@ init_treesit_functions (void)
|
||||
#define ts_tree_cursor_current_node fn_ts_tree_cursor_current_node
|
||||
#define ts_tree_cursor_delete fn_ts_tree_cursor_delete
|
||||
#define ts_tree_cursor_goto_first_child fn_ts_tree_cursor_goto_first_child
|
||||
#define ts_tree_cursor_goto_first_child_for_byte fn_ts_tree_cursor_goto_first_child_for_byte
|
||||
#define ts_tree_cursor_goto_next_sibling fn_ts_tree_cursor_goto_next_sibling
|
||||
#define ts_tree_cursor_goto_parent fn_ts_tree_cursor_goto_parent
|
||||
#define ts_tree_cursor_new fn_ts_tree_cursor_new
|
||||
@ -3027,7 +3031,8 @@ treesit_assume_true (bool val)
|
||||
limit. */
|
||||
static bool
|
||||
treesit_cursor_helper_1 (TSTreeCursor *cursor, TSNode *target,
|
||||
uint32_t end_pos, ptrdiff_t limit)
|
||||
uint32_t start_pos, uint32_t end_pos,
|
||||
ptrdiff_t limit)
|
||||
{
|
||||
if (limit <= 0)
|
||||
return false;
|
||||
@ -3036,23 +3041,17 @@ treesit_cursor_helper_1 (TSTreeCursor *cursor, TSNode *target,
|
||||
if (ts_node_eq (cursor_node, *target))
|
||||
return true;
|
||||
|
||||
if (!ts_tree_cursor_goto_first_child (cursor))
|
||||
if (ts_tree_cursor_goto_first_child_for_byte (cursor, start_pos) == -1)
|
||||
return false;
|
||||
|
||||
/* Skip nodes that definitely don't contain TARGET. */
|
||||
while (ts_node_end_byte (cursor_node) < end_pos)
|
||||
{
|
||||
if (!ts_tree_cursor_goto_next_sibling (cursor))
|
||||
break;
|
||||
cursor_node = ts_tree_cursor_current_node (cursor);
|
||||
}
|
||||
|
||||
/* Go through each sibling that could contain TARGET. Because of
|
||||
missing nodes (their width is 0), there could be multiple
|
||||
siblings that could contain TARGET. */
|
||||
while (ts_node_start_byte (cursor_node) <= end_pos)
|
||||
{
|
||||
if (treesit_cursor_helper_1 (cursor, target, end_pos, limit - 1))
|
||||
if (ts_node_end_byte (cursor_node) >= end_pos
|
||||
&& treesit_cursor_helper_1 (cursor, target, start_pos, end_pos,
|
||||
limit - 1))
|
||||
return true;
|
||||
|
||||
if (!ts_tree_cursor_goto_next_sibling (cursor))
|
||||
@ -3084,11 +3083,12 @@ treesit_cursor_helper_1 (TSTreeCursor *cursor, TSNode *target,
|
||||
static bool
|
||||
treesit_cursor_helper (TSTreeCursor *cursor, TSNode node, Lisp_Object parser)
|
||||
{
|
||||
uint32_t start_pos = ts_node_start_byte (node);
|
||||
uint32_t end_pos = ts_node_end_byte (node);
|
||||
TSNode root = ts_tree_root_node (XTS_PARSER (parser)->tree);
|
||||
*cursor = ts_tree_cursor_new (root);
|
||||
bool success = treesit_cursor_helper_1 (cursor, &node, end_pos,
|
||||
TREESIT_RECURSION_LIMIT);
|
||||
bool success = treesit_cursor_helper_1 (cursor, &node, start_pos,
|
||||
end_pos, treesit_recursion_limit);
|
||||
if (!success)
|
||||
ts_tree_cursor_delete (cursor);
|
||||
return success;
|
||||
|
@ -596,8 +596,9 @@ This checks also `vc-backend' and `vc-responsible-backend'."
|
||||
(let ((vc-handled-backends `(,backend))
|
||||
(default-directory
|
||||
(file-name-as-directory
|
||||
(expand-file-name
|
||||
(make-temp-name "vc-test") temporary-file-directory)))
|
||||
(file-truename
|
||||
(expand-file-name
|
||||
(make-temp-name "vc-test") temporary-file-directory))))
|
||||
(process-environment process-environment)
|
||||
vc-test--cleanup-hook)
|
||||
(when (eq backend 'Bzr)
|
||||
|
Loading…
Reference in New Issue
Block a user