[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
master 73951234797 4/5: Merge from origin/emacs-29
From: |
Eli Zaretskii |
Subject: |
master 73951234797 4/5: Merge from origin/emacs-29 |
Date: |
Sat, 2 Sep 2023 04:39:26 -0400 (EDT) |
branch: master
commit 7395123479704ab94601cb2836388af008090185
Merge: 6028678ba82 dbbcf4a6599
Author: Eli Zaretskii <eliz@gnu.org>
Commit: Eli Zaretskii <eliz@gnu.org>
Merge from origin/emacs-29
dbbcf4a6599 Fix fontification of " in edit-kbd-macro
2137fdfd550 * lisp/emacs-lisp/gv.el (buffer-local-value): Unobsolete ...
e660ee88e3d ; Remove incorrect example from ELisp Reference manual
c32fd92d67e Add documentation to plstore.el
57760f585e2 * lisp/help.el (substitute-quotes): Improve docstring.
60dcea7658a Fix two defcustom :types
890a4c209ab Fix `image-auto-resize-on-window-resize' custom :type
369f2eea100 Add "terraform-ls" LSP server to Eglot
5cbe96d17f6 ; Improve documentation of 'char-table-range'
a219ee8c314 Fix minor bugs in vc-git and vc-hg on Windows uncovered b...
3f7598806eb Add syntax-propertize-function to js-ts-mode
18b292140ee ; * src/treesit.c: Add ts function boilerplate
ec4d29c4494 Improve performance of treesit_cursor_helper_1
# Conflicts:
# lisp/vc/vc-git.el
# src/treesit.c
---
doc/lispref/commands.texi | 10 ----------
doc/lispref/sequences.texi | 3 ++-
lisp/edmacro.el | 2 +-
lisp/emacs-lisp/gv.el | 1 -
lisp/frame.el | 2 +-
lisp/help.el | 7 ++++---
lisp/image-mode.el | 2 +-
lisp/plstore.el | 39 ++++++++++++++++++++++++++++++---------
lisp/progmodes/eglot.el | 3 ++-
lisp/progmodes/js.el | 24 ++++++++++++++++++++++++
lisp/url/url-vars.el | 2 +-
lisp/vc/vc-git.el | 3 ++-
lisp/vc/vc-hg.el | 5 ++++-
src/chartab.c | 3 ++-
src/treesit.c | 26 +++++++++++++-------------
test/lisp/vc/vc-tests.el | 5 +++--
16 files changed, 90 insertions(+), 47 deletions(-)
diff --git a/doc/lispref/commands.texi b/doc/lispref/commands.texi
index 78fc43d0daf..a69879c30a9 100644
--- a/doc/lispref/commands.texi
+++ b/doc/lispref/commands.texi
@@ -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
diff --git a/doc/lispref/sequences.texi b/doc/lispref/sequences.texi
index dd5b723b479..c9c6bb31350 100644
--- a/doc/lispref/sequences.texi
+++ b/doc/lispref/sequences.texi
@@ -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
diff --git a/lisp/edmacro.el b/lisp/edmacro.el
index 69d20d2bad3..bbf5a7f0495 100644
--- a/lisp/edmacro.el
+++ b/lisp/edmacro.el
@@ -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
diff --git a/lisp/emacs-lisp/gv.el b/lisp/emacs-lisp/gv.el
index a5e29dd5e3b..7adf92c11e0 100644
--- a/lisp/emacs-lisp/gv.el
+++ b/lisp/emacs-lisp/gv.el
@@ -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)
diff --git a/lisp/frame.el b/lisp/frame.el
index ba5d1caafa2..2452f7f8d4a 100644
--- a/lisp/frame.el
+++ b/lisp/frame.el
@@ -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
diff --git a/lisp/help.el b/lisp/help.el
index 52c987f383d..a012086a687 100644
--- a/lisp/help.el
+++ b/lisp/help.el
@@ -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)))
diff --git a/lisp/image-mode.el b/lisp/image-mode.el
index 713125d4e58..dce35ff72da 100644
--- a/lisp/image-mode.el
+++ b/lisp/image-mode.el
@@ -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)
diff --git a/lisp/plstore.el b/lisp/plstore.el
index d18d461d7d1..7dc991aeec7 100644
--- a/lisp/plstore.el
+++ b/lisp/plstore.el
@@ -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)
diff --git a/lisp/progmodes/eglot.el b/lisp/progmodes/eglot.el
index 73b8ed1b063..586d532efc3 100644
--- a/lisp/progmodes/eglot.el
+++ b/lisp/progmodes/eglot.el
@@ -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
diff --git a/lisp/progmodes/js.el b/lisp/progmodes/js.el
index 60f50f7e15e..feebeae010d 100644
--- a/lisp/progmodes/js.el
+++ b/lisp/progmodes/js.el
@@ -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)
diff --git a/lisp/url/url-vars.el b/lisp/url/url-vars.el
index 7e2290217d0..ef4b8b2841b 100644
--- a/lisp/url/url-vars.el
+++ b/lisp/url/url-vars.el
@@ -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
diff --git a/lisp/vc/vc-git.el b/lisp/vc/vc-git.el
index 9a78264d8ff..4c409465860 100644
--- a/lisp/vc/vc-git.el
+++ b/lisp/vc/vc-git.el
@@ -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
diff --git a/lisp/vc/vc-hg.el b/lisp/vc/vc-hg.el
index b62420393aa..c3e563a1f10 100644
--- a/lisp/vc/vc-hg.el
+++ b/lisp/vc/vc-hg.el
@@ -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)
diff --git a/src/chartab.c b/src/chartab.c
index 6f0bc28f31b..58bb1658504 100644
--- a/src/chartab.c
+++ b/src/chartab.c
@@ -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;
diff --git a/src/treesit.c b/src/treesit.c
index 5e00da83548..ff2c016234f 100644
--- a/src/treesit.c
+++ b/src/treesit.c
@@ -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;
diff --git a/test/lisp/vc/vc-tests.el b/test/lisp/vc/vc-tests.el
index 11c20d2783c..0a26e25e32a 100644
--- a/test/lisp/vc/vc-tests.el
+++ b/test/lisp/vc/vc-tests.el
@@ -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)