aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPo Lu2023-05-10 08:51:27 +0800
committerPo Lu2023-05-10 08:51:27 +0800
commit4fbaf6d9fe1923d03c971a970ad4d2eef075aef3 (patch)
tree40fc3779e0de2c16d6ed0377bfc935ba48119881
parent1230521f7130a3ad8fe4033817f6d936675742c1 (diff)
parent7791907c3852e6ec197352e1c3d3dd8487cc04f5 (diff)
downloademacs-4fbaf6d9fe1923d03c971a970ad4d2eef075aef3.tar.gz
emacs-4fbaf6d9fe1923d03c971a970ad4d2eef075aef3.zip
Merge remote-tracking branch 'origin/master' into feature/android
-rw-r--r--lisp/net/tramp-sh.el38
-rw-r--r--lisp/progmodes/eglot.el35
-rw-r--r--lisp/treesit.el3
-rw-r--r--src/regex-emacs.h3
-rw-r--r--src/syntax.c87
-rw-r--r--test/src/treesit-tests.el3
6 files changed, 81 insertions, 88 deletions
diff --git a/lisp/net/tramp-sh.el b/lisp/net/tramp-sh.el
index d020615af07..49e6d2d7aa9 100644
--- a/lisp/net/tramp-sh.el
+++ b/lisp/net/tramp-sh.el
@@ -4856,26 +4856,30 @@ Goes through the list `tramp-inline-compress-commands'."
4856 (stringp tramp-ssh-controlmaster-options)) 4856 (stringp tramp-ssh-controlmaster-options))
4857 tramp-ssh-controlmaster-options) 4857 tramp-ssh-controlmaster-options)
4858 4858
4859 ;; We can't auto-compute the options.
4860 ((ignore-errors
4861 (not (tramp-ssh-option-exists-p vec "ControlMaster=auto")))
4862 "")
4863
4859 ;; Determine the options. 4864 ;; Determine the options.
4860 (t (ignore-errors 4865 (t (ignore-errors
4861 ;; ControlMaster and ControlPath options are introduced in OpenSSH 3.9. 4866 ;; ControlMaster and ControlPath options are introduced in OpenSSH 3.9.
4862 (when (tramp-ssh-option-exists-p vec "ControlMaster=auto") 4867 (concat
4863 (concat 4868 "-o ControlMaster="
4864 "-o ControlMaster=" 4869 (if (eq tramp-use-connection-share 'suppress)
4865 (if (eq tramp-use-connection-share 'suppress) 4870 "no" "auto")
4866 "no" "auto") 4871
4867 4872 " -o ControlPath="
4868 " -o ControlPath=" 4873 (if (eq tramp-use-connection-share 'suppress)
4869 (if (eq tramp-use-connection-share 'suppress) 4874 "none"
4870 "none" 4875 ;; Hashed tokens are introduced in OpenSSH 6.7.
4871 ;; Hashed tokens are introduced in OpenSSH 6.7. 4876 (if (tramp-ssh-option-exists-p vec "ControlPath=tramp.%C")
4872 (if (tramp-ssh-option-exists-p vec "ControlPath=tramp.%C") 4877 "tramp.%%C" "tramp.%%r@%%h:%%p"))
4873 "tramp.%%C" "tramp.%%r@%%h:%%p")) 4878
4874 4879 ;; ControlPersist option is introduced in OpenSSH 5.6.
4875 ;; ControlPersist option is introduced in OpenSSH 5.6. 4880 (when (and (not (eq tramp-use-connection-share 'suppress))
4876 (when (and (not (eq tramp-use-connection-share 'suppress)) 4881 (tramp-ssh-option-exists-p vec "ControlPersist=no"))
4877 (tramp-ssh-option-exists-p vec "ControlPersist=no")) 4882 " -o ControlPersist=no"))))))
4878 " -o ControlPersist=no")))))))
4879 4883
4880(defun tramp-scp-strict-file-name-checking (vec) 4884(defun tramp-scp-strict-file-name-checking (vec)
4881 "Return the strict file name checking argument of the local scp." 4885 "Return the strict file name checking argument of the local scp."
diff --git a/lisp/progmodes/eglot.el b/lisp/progmodes/eglot.el
index dc8d4674425..66d893a14b5 100644
--- a/lisp/progmodes/eglot.el
+++ b/lisp/progmodes/eglot.el
@@ -724,8 +724,23 @@ treated as in `eglot--dbind'."
724(cl-defgeneric eglot-handle-notification (server method &rest params) 724(cl-defgeneric eglot-handle-notification (server method &rest params)
725 "Handle SERVER's METHOD notification with PARAMS.") 725 "Handle SERVER's METHOD notification with PARAMS.")
726 726
727(cl-defgeneric eglot-execute-command (server command arguments) 727(cl-defgeneric eglot-execute-command (_ _ _)
728 "Ask SERVER to execute COMMAND with ARGUMENTS.") 728 (declare (obsolete eglot-execute "30.1"))
729 (:method
730 (server command arguments)
731 (eglot--request server :workspace/executeCommand
732 `(:command ,(format "%s" command) :arguments ,arguments))))
733
734(cl-defgeneric eglot-execute (server action)
735 "Ask SERVER to execute ACTION.
736ACTION is an LSP object of either `CodeAction' or `Command' type."
737 (:method
738 (server action) "Default implementation."
739 (eglot--dcase action
740 (((Command)) (eglot--request server :workspace/executeCommand action))
741 (((CodeAction) edit command)
742 (when edit (eglot--apply-workspace-edit edit))
743 (when command (eglot--request server :workspace/executeCommand action))))))
729 744
730(cl-defgeneric eglot-initialization-options (server) 745(cl-defgeneric eglot-initialization-options (server)
731 "JSON object to send under `initializationOptions'." 746 "JSON object to send under `initializationOptions'."
@@ -2181,13 +2196,6 @@ still unanswered LSP requests to the server\n")))
2181 (when (memq 'disallow-unknown-methods eglot-strict-mode) 2196 (when (memq 'disallow-unknown-methods eglot-strict-mode)
2182 (jsonrpc-error "Unknown request method `%s'" method))) 2197 (jsonrpc-error "Unknown request method `%s'" method)))
2183 2198
2184(cl-defmethod eglot-execute-command
2185 (server command arguments)
2186 "Execute COMMAND on SERVER with `:workspace/executeCommand'.
2187COMMAND is a symbol naming the command."
2188 (eglot--request server :workspace/executeCommand
2189 `(:command ,(format "%s" command) :arguments ,arguments)))
2190
2191(cl-defmethod eglot-handle-notification 2199(cl-defmethod eglot-handle-notification
2192 (_server (_method (eql window/showMessage)) &key type message) 2200 (_server (_method (eql window/showMessage)) &key type message)
2193 "Handle notification window/showMessage." 2201 "Handle notification window/showMessage."
@@ -3465,14 +3473,7 @@ at point. With prefix argument, prompt for ACTION-KIND."
3465 default-action) 3473 default-action)
3466 menu-items nil t nil nil default-action) 3474 menu-items nil t nil nil default-action)
3467 menu-items)))))) 3475 menu-items))))))
3468 (eglot--dcase chosen 3476 (eglot-execute server chosen)))
3469 (((Command) command arguments)
3470 (eglot-execute-command server (intern command) arguments))
3471 (((CodeAction) edit command)
3472 (when edit (eglot--apply-workspace-edit edit))
3473 (when command
3474 (eglot--dbind ((Command) command arguments) command
3475 (eglot-execute-command server (intern command) arguments)))))))
3476 3477
3477(defmacro eglot--code-action (name kind) 3478(defmacro eglot--code-action (name kind)
3478 "Define NAME to execute KIND code action." 3479 "Define NAME to execute KIND code action."
diff --git a/lisp/treesit.el b/lisp/treesit.el
index 54f223dc40b..e9ca45c0d6c 100644
--- a/lisp/treesit.el
+++ b/lisp/treesit.el
@@ -251,8 +251,7 @@ than using NODE's type. PRED can also be a predicate function,
251and more. See `treesit-thing-settings' for details. 251and more. See `treesit-thing-settings' for details.
252 252
253If INCLUDE-NODE is non-nil, return NODE if it satisfies PRED." 253If INCLUDE-NODE is non-nil, return NODE if it satisfies PRED."
254 (let ((pred (or pred (rx-to-string 254 (let ((pred (or pred (rx bos (literal (treesit-node-type node)) eos)))
255 `(seq bos ,(treesit-node-type node) eos))))
256 (result nil)) 255 (result nil))
257 (cl-loop for cursor = (if include-node node 256 (cl-loop for cursor = (if include-node node
258 (treesit-node-parent node)) 257 (treesit-node-parent node))
diff --git a/src/regex-emacs.h b/src/regex-emacs.h
index 1bc973363e9..bc357633135 100644
--- a/src/regex-emacs.h
+++ b/src/regex-emacs.h
@@ -187,7 +187,8 @@ typedef enum { RECC_ERROR = 0,
187 RECC_DIGIT, RECC_XDIGIT, 187 RECC_DIGIT, RECC_XDIGIT,
188 RECC_BLANK, RECC_SPACE, 188 RECC_BLANK, RECC_SPACE,
189 RECC_MULTIBYTE, RECC_NONASCII, 189 RECC_MULTIBYTE, RECC_NONASCII,
190 RECC_ASCII, RECC_UNIBYTE 190 RECC_ASCII, RECC_UNIBYTE,
191 RECC_NUM_CLASSES = RECC_UNIBYTE
191} re_wctype_t; 192} re_wctype_t;
192 193
193extern bool re_iswctype (int ch, re_wctype_t cc); 194extern bool re_iswctype (int ch, re_wctype_t cc);
diff --git a/src/syntax.c b/src/syntax.c
index e9e04e2d638..839ab36bb2f 100644
--- a/src/syntax.c
+++ b/src/syntax.c
@@ -178,14 +178,14 @@ static ptrdiff_t find_start_begv;
178static modiff_count find_start_modiff; 178static modiff_count find_start_modiff;
179 179
180 180
181static Lisp_Object skip_chars (bool, Lisp_Object, Lisp_Object, bool); 181static Lisp_Object skip_chars (bool, Lisp_Object, Lisp_Object);
182static Lisp_Object skip_syntaxes (bool, Lisp_Object, Lisp_Object); 182static Lisp_Object skip_syntaxes (bool, Lisp_Object, Lisp_Object);
183static Lisp_Object scan_lists (EMACS_INT, EMACS_INT, EMACS_INT, bool); 183static Lisp_Object scan_lists (EMACS_INT, EMACS_INT, EMACS_INT, bool);
184static void scan_sexps_forward (struct lisp_parse_state *, 184static void scan_sexps_forward (struct lisp_parse_state *,
185 ptrdiff_t, ptrdiff_t, ptrdiff_t, EMACS_INT, 185 ptrdiff_t, ptrdiff_t, ptrdiff_t, EMACS_INT,
186 bool, int); 186 bool, int);
187static void internalize_parse_state (Lisp_Object, struct lisp_parse_state *); 187static void internalize_parse_state (Lisp_Object, struct lisp_parse_state *);
188static bool in_classes (int, Lisp_Object); 188static bool in_classes (int c, int num_classes, const unsigned char *classes);
189static void parse_sexp_propertize (ptrdiff_t charpos); 189static void parse_sexp_propertize (ptrdiff_t charpos);
190 190
191/* This setter is used only in this file, so it can be private. */ 191/* This setter is used only in this file, so it can be private. */
@@ -1607,7 +1607,7 @@ Char classes, e.g. `[:alpha:]', are supported.
1607Returns the distance traveled, either zero or positive. */) 1607Returns the distance traveled, either zero or positive. */)
1608 (Lisp_Object string, Lisp_Object lim) 1608 (Lisp_Object string, Lisp_Object lim)
1609{ 1609{
1610 return skip_chars (1, string, lim, 1); 1610 return skip_chars (1, string, lim);
1611} 1611}
1612 1612
1613DEFUN ("skip-chars-backward", Fskip_chars_backward, Sskip_chars_backward, 1, 2, 0, 1613DEFUN ("skip-chars-backward", Fskip_chars_backward, Sskip_chars_backward, 1, 2, 0,
@@ -1616,7 +1616,7 @@ See `skip-chars-forward' for details.
1616Returns the distance traveled, either zero or negative. */) 1616Returns the distance traveled, either zero or negative. */)
1617 (Lisp_Object string, Lisp_Object lim) 1617 (Lisp_Object string, Lisp_Object lim)
1618{ 1618{
1619 return skip_chars (0, string, lim, 1); 1619 return skip_chars (0, string, lim);
1620} 1620}
1621 1621
1622DEFUN ("skip-syntax-forward", Fskip_syntax_forward, Sskip_syntax_forward, 1, 2, 0, 1622DEFUN ("skip-syntax-forward", Fskip_syntax_forward, Sskip_syntax_forward, 1, 2, 0,
@@ -1643,8 +1643,7 @@ of this is the distance traveled. */)
1643} 1643}
1644 1644
1645static Lisp_Object 1645static Lisp_Object
1646skip_chars (bool forwardp, Lisp_Object string, Lisp_Object lim, 1646skip_chars (bool forwardp, Lisp_Object string, Lisp_Object lim)
1647 bool handle_iso_classes)
1648{ 1647{
1649 int c; 1648 int c;
1650 char fastmap[0400]; 1649 char fastmap[0400];
@@ -1661,11 +1660,9 @@ skip_chars (bool forwardp, Lisp_Object string, Lisp_Object lim,
1661 ptrdiff_t size_byte; 1660 ptrdiff_t size_byte;
1662 const unsigned char *str; 1661 const unsigned char *str;
1663 int len; 1662 int len;
1664 Lisp_Object iso_classes;
1665 USE_SAFE_ALLOCA; 1663 USE_SAFE_ALLOCA;
1666 1664
1667 CHECK_STRING (string); 1665 CHECK_STRING (string);
1668 iso_classes = Qnil;
1669 1666
1670 if (NILP (lim)) 1667 if (NILP (lim))
1671 XSETINT (lim, forwardp ? ZV : BEGV); 1668 XSETINT (lim, forwardp ? ZV : BEGV);
@@ -1700,6 +1697,8 @@ skip_chars (bool forwardp, Lisp_Object string, Lisp_Object lim,
1700 If STRING contains non-ASCII characters, setup char_ranges for 1697 If STRING contains non-ASCII characters, setup char_ranges for
1701 them and use fastmap only for their leading codes. */ 1698 them and use fastmap only for their leading codes. */
1702 1699
1700 int nclasses = 0;
1701 unsigned char classes[RECC_NUM_CLASSES];
1703 if (! string_multibyte) 1702 if (! string_multibyte)
1704 { 1703 {
1705 bool string_has_eight_bit = 0; 1704 bool string_has_eight_bit = 0;
@@ -1707,18 +1706,16 @@ skip_chars (bool forwardp, Lisp_Object string, Lisp_Object lim,
1707 /* At first setup fastmap. */ 1706 /* At first setup fastmap. */
1708 while (i_byte < size_byte) 1707 while (i_byte < size_byte)
1709 { 1708 {
1710 if (handle_iso_classes) 1709 const unsigned char *ch = str + i_byte;
1710 re_wctype_t cc = re_wctype_parse (&ch, size_byte - i_byte);
1711 if (cc == 0)
1712 error ("Invalid ISO C character class");
1713 if (cc != -1)
1711 { 1714 {
1712 const unsigned char *ch = str + i_byte; 1715 if (!(nclasses && memchr (classes, cc, nclasses)))
1713 re_wctype_t cc = re_wctype_parse (&ch, size_byte - i_byte); 1716 classes[nclasses++] = cc;
1714 if (cc == 0) 1717 i_byte = ch - str;
1715 error ("Invalid ISO C character class"); 1718 continue;
1716 if (cc != -1)
1717 {
1718 iso_classes = Fcons (make_fixnum (cc), iso_classes);
1719 i_byte = ch - str;
1720 continue;
1721 }
1722 } 1719 }
1723 1720
1724 c = str[i_byte++]; 1721 c = str[i_byte++];
@@ -1803,18 +1800,16 @@ skip_chars (bool forwardp, Lisp_Object string, Lisp_Object lim,
1803 { 1800 {
1804 int leading_code = str[i_byte]; 1801 int leading_code = str[i_byte];
1805 1802
1806 if (handle_iso_classes) 1803 const unsigned char *ch = str + i_byte;
1804 re_wctype_t cc = re_wctype_parse (&ch, size_byte - i_byte);
1805 if (cc == 0)
1806 error ("Invalid ISO C character class");
1807 if (cc != -1)
1807 { 1808 {
1808 const unsigned char *ch = str + i_byte; 1809 if (!(nclasses && memchr (classes, cc, nclasses)))
1809 re_wctype_t cc = re_wctype_parse (&ch, size_byte - i_byte); 1810 classes[nclasses++] = cc;
1810 if (cc == 0) 1811 i_byte = ch - str;
1811 error ("Invalid ISO C character class"); 1812 continue;
1812 if (cc != -1)
1813 {
1814 iso_classes = Fcons (make_fixnum (cc), iso_classes);
1815 i_byte = ch - str;
1816 continue;
1817 }
1818 } 1813 }
1819 1814
1820 if (leading_code== '\\') 1815 if (leading_code== '\\')
@@ -1960,7 +1955,7 @@ skip_chars (bool forwardp, Lisp_Object string, Lisp_Object lim,
1960 stop = endp; 1955 stop = endp;
1961 } 1956 }
1962 c = string_char_and_length (p, &nbytes); 1957 c = string_char_and_length (p, &nbytes);
1963 if (! NILP (iso_classes) && in_classes (c, iso_classes)) 1958 if (nclasses && in_classes (c, nclasses, classes))
1964 { 1959 {
1965 if (negate) 1960 if (negate)
1966 break; 1961 break;
@@ -2001,7 +1996,7 @@ skip_chars (bool forwardp, Lisp_Object string, Lisp_Object lim,
2001 stop = endp; 1996 stop = endp;
2002 } 1997 }
2003 1998
2004 if (!NILP (iso_classes) && in_classes (*p, iso_classes)) 1999 if (nclasses && in_classes (*p, nclasses, classes))
2005 { 2000 {
2006 if (negate) 2001 if (negate)
2007 break; 2002 break;
@@ -2035,7 +2030,7 @@ skip_chars (bool forwardp, Lisp_Object string, Lisp_Object lim,
2035 2030
2036 c = STRING_CHAR (p); 2031 c = STRING_CHAR (p);
2037 2032
2038 if (! NILP (iso_classes) && in_classes (c, iso_classes)) 2033 if (nclasses && in_classes (c, nclasses, classes))
2039 { 2034 {
2040 if (negate) 2035 if (negate)
2041 break; 2036 break;
@@ -2069,7 +2064,7 @@ skip_chars (bool forwardp, Lisp_Object string, Lisp_Object lim,
2069 stop = endp; 2064 stop = endp;
2070 } 2065 }
2071 2066
2072 if (! NILP (iso_classes) && in_classes (p[-1], iso_classes)) 2067 if (nclasses && in_classes (p[-1], nclasses, classes))
2073 { 2068 {
2074 if (negate) 2069 if (negate)
2075 break; 2070 break;
@@ -2253,26 +2248,16 @@ skip_syntaxes (bool forwardp, Lisp_Object string, Lisp_Object lim)
2253 } 2248 }
2254} 2249}
2255 2250
2256/* Return true if character C belongs to one of the ISO classes 2251/* Return true if character C belongs to one of the ISO classes in the
2257 in the list ISO_CLASSES. Each class is represented by an 2252 array. */
2258 integer which is its type according to re_wctype. */
2259 2253
2260static bool 2254static bool
2261in_classes (int c, Lisp_Object iso_classes) 2255in_classes (int c, int nclasses, const unsigned char *classes)
2262{ 2256{
2263 bool fits_class = 0; 2257 for (int i = 0; i < nclasses; i++)
2264 2258 if (re_iswctype (c, classes[i]))
2265 while (CONSP (iso_classes)) 2259 return true;
2266 { 2260 return false;
2267 Lisp_Object elt;
2268 elt = XCAR (iso_classes);
2269 iso_classes = XCDR (iso_classes);
2270
2271 if (re_iswctype (c, XFIXNAT (elt)))
2272 fits_class = 1;
2273 }
2274
2275 return fits_class;
2276} 2261}
2277 2262
2278/* Jump over a comment, assuming we are at the beginning of one. 2263/* Jump over a comment, assuming we are at the beginning of one.
diff --git a/test/src/treesit-tests.el b/test/src/treesit-tests.el
index 5b2955c34e3..4aa81a9ce0b 100644
--- a/test/src/treesit-tests.el
+++ b/test/src/treesit-tests.el
@@ -54,6 +54,9 @@
54(declare-function treesit-node-descendant-for-range "treesit.c") 54(declare-function treesit-node-descendant-for-range "treesit.c")
55(declare-function treesit-node-eq "treesit.c") 55(declare-function treesit-node-eq "treesit.c")
56 56
57(declare-function treesit-search-forward "treesit.c")
58(declare-function treesit-search-subtree "treesit.c")
59
57;;; Basic API 60;;; Basic API
58 61
59(ert-deftest treesit-basic-parsing () 62(ert-deftest treesit-basic-parsing ()