diff options
| author | Po Lu | 2023-04-20 08:47:14 +0800 |
|---|---|---|
| committer | Po Lu | 2023-04-20 08:47:14 +0800 |
| commit | a94e9f96448bfa82fa0aaef9c2f3a40eaf7d6516 (patch) | |
| tree | 5983835c84f1e1a82790447313e89736a7e03069 | |
| parent | 5b314731894f09bb71fd02c76add45263e2d4f77 (diff) | |
| parent | cc0f9389b8ebedad6401464ee3a259dba3c7abaf (diff) | |
| download | emacs-a94e9f96448bfa82fa0aaef9c2f3a40eaf7d6516.tar.gz emacs-a94e9f96448bfa82fa0aaef9c2f3a40eaf7d6516.zip | |
Merge remote-tracking branch 'origin/master' into feature/android
| -rw-r--r-- | lisp/treesit.el | 35 | ||||
| -rw-r--r-- | lisp/vc/vc-cvs.el | 22 | ||||
| -rw-r--r-- | src/fns.c | 2 | ||||
| -rw-r--r-- | test/lisp/vc/vc-cvs-tests.el | 2 |
4 files changed, 36 insertions, 25 deletions
diff --git a/lisp/treesit.el b/lisp/treesit.el index ed7ad280684..b7af64ee8b5 100644 --- a/lisp/treesit.el +++ b/lisp/treesit.el | |||
| @@ -2994,37 +2994,48 @@ See `treesit-language-source-alist' for details." | |||
| 2994 | "History for OUT-DIR for `treesit-install-language-grammar'.") | 2994 | "History for OUT-DIR for `treesit-install-language-grammar'.") |
| 2995 | 2995 | ||
| 2996 | ;;;###autoload | 2996 | ;;;###autoload |
| 2997 | (defun treesit-install-language-grammar (lang) | 2997 | (defun treesit-install-language-grammar (lang &optional out-dir) |
| 2998 | "Build and install the tree-sitter language grammar library for LANG. | 2998 | "Build and install the tree-sitter language grammar library for LANG. |
| 2999 | 2999 | ||
| 3000 | Interactively, if `treesit-language-source-alist' doesn't already | 3000 | Interactively, if `treesit-language-source-alist' doesn't already |
| 3001 | have data for building the grammar for LANG, prompt for its | 3001 | have data for building the grammar for LANG, prompt for its |
| 3002 | repository URL and the C/C++ compiler to use. | 3002 | repository URL and the C/C++ compiler to use. Non-interactively, |
| 3003 | signal an error when there's no recipe for LANG. | ||
| 3003 | 3004 | ||
| 3004 | This command requires Git, a C compiler and (sometimes) a C++ compiler, | 3005 | This command requires Git, a C compiler and (sometimes) a C++ compiler, |
| 3005 | and the linker to be installed and on PATH. It also requires that the | 3006 | and the linker to be installed and on PATH. It also requires that the |
| 3006 | recipe for LANG exists in `treesit-language-source-alist'. | 3007 | recipe for LANG exists in `treesit-language-source-alist'. |
| 3007 | 3008 | ||
| 3008 | See `exec-path' for the current path where Emacs looks for | 3009 | See `exec-path' for the current path where Emacs looks for |
| 3009 | executable programs, such as the C/C++ compiler and linker." | 3010 | executable programs, such as the C/C++ compiler and linker. |
| 3011 | |||
| 3012 | Interactively, prompt for the directory in which to install the | ||
| 3013 | compiled grammar files. Non-interactively, use OUT-DIR; if it's | ||
| 3014 | nil, the grammar is installed to the standard location, the | ||
| 3015 | \"tree-sitter\" directory under `user-emacs-directory'." | ||
| 3010 | (interactive (list (intern | 3016 | (interactive (list (intern |
| 3011 | (completing-read | 3017 | (completing-read |
| 3012 | "Language: " | 3018 | "Language: " |
| 3013 | (mapcar #'car treesit-language-source-alist))))) | 3019 | (mapcar #'car treesit-language-source-alist))) |
| 3020 | 'interactive)) | ||
| 3014 | (when-let ((recipe | 3021 | (when-let ((recipe |
| 3015 | (or (assoc lang treesit-language-source-alist) | 3022 | (or (assoc lang treesit-language-source-alist) |
| 3016 | (treesit--install-language-grammar-build-recipe | 3023 | (if (eq out-dir 'interactive) |
| 3017 | lang))) | 3024 | (treesit--install-language-grammar-build-recipe |
| 3025 | lang) | ||
| 3026 | (signal 'treesit-error `("Cannot find recipe for this language" ,lang))))) | ||
| 3018 | (default-out-dir | 3027 | (default-out-dir |
| 3019 | (or (car treesit--install-language-grammar-out-dir-history) | 3028 | (or (car treesit--install-language-grammar-out-dir-history) |
| 3020 | (locate-user-emacs-file "tree-sitter"))) | 3029 | (locate-user-emacs-file "tree-sitter"))) |
| 3021 | (out-dir | 3030 | (out-dir |
| 3022 | (read-string | 3031 | (if (eq out-dir 'interactive) |
| 3023 | (format "Install to (default: %s): " | 3032 | (read-string |
| 3024 | default-out-dir) | 3033 | (format "Install to (default: %s): " |
| 3025 | nil | 3034 | default-out-dir) |
| 3026 | 'treesit--install-language-grammar-out-dir-history | 3035 | nil |
| 3027 | default-out-dir))) | 3036 | 'treesit--install-language-grammar-out-dir-history |
| 3037 | default-out-dir) | ||
| 3038 | out-dir))) | ||
| 3028 | (condition-case err | 3039 | (condition-case err |
| 3029 | (apply #'treesit--install-language-grammar-1 | 3040 | (apply #'treesit--install-language-grammar-1 |
| 3030 | (cons out-dir recipe)) | 3041 | (cons out-dir recipe)) |
diff --git a/lisp/vc/vc-cvs.el b/lisp/vc/vc-cvs.el index c6056c1e5bd..b855591e655 100644 --- a/lisp/vc/vc-cvs.el +++ b/lisp/vc/vc-cvs.el | |||
| @@ -816,7 +816,7 @@ individually should stay local." | |||
| 816 | (defun vc-cvs-repository-hostname (dirname) | 816 | (defun vc-cvs-repository-hostname (dirname) |
| 817 | "Hostname of the CVS server associated to workarea DIRNAME. | 817 | "Hostname of the CVS server associated to workarea DIRNAME. |
| 818 | 818 | ||
| 819 | Returns nil if there is not hostname or the hostname could not be | 819 | Returns nil if there is no hostname or the hostname could not be |
| 820 | determined because the CVS/Root specification is invalid." | 820 | determined because the CVS/Root specification is invalid." |
| 821 | (let ((rootname (expand-file-name "CVS/Root" dirname))) | 821 | (let ((rootname (expand-file-name "CVS/Root" dirname))) |
| 822 | (when (file-readable-p rootname) | 822 | (when (file-readable-p rootname) |
| @@ -849,7 +849,7 @@ The default METHOD for a CVS root of the form | |||
| 849 | is \"ext\". | 849 | is \"ext\". |
| 850 | 850 | ||
| 851 | If METHOD is explicitly \"local\" or \"fork\", then the pathname | 851 | If METHOD is explicitly \"local\" or \"fork\", then the pathname |
| 852 | starts immediately after the method block. This must be used on | 852 | starts immediately after the method block. This must be used on |
| 853 | Windows platforms when pathnames start with a drive letter. | 853 | Windows platforms when pathnames start with a drive letter. |
| 854 | 854 | ||
| 855 | Note that, except for METHOD, which is defaulted if not present, | 855 | Note that, except for METHOD, which is defaulted if not present, |
| @@ -857,9 +857,9 @@ other optional fields are returned as nil if not syntactically | |||
| 857 | present, or as the empty string if delimited but empty. | 857 | present, or as the empty string if delimited but empty. |
| 858 | 858 | ||
| 859 | Returns nil in case of an unparsable CVS root (including the | 859 | Returns nil in case of an unparsable CVS root (including the |
| 860 | empty string) and issues a warning. This function doesn't check | 860 | empty string) and issues a warning. This function doesn't check |
| 861 | that an explicit method is valid, or that some fields are empty | 861 | that an explicit method is valid, or that some fields are empty |
| 862 | or nil but should not for a given method." | 862 | or nil but should not be for a given method." |
| 863 | (let (method user password hostname port pathname | 863 | (let (method user password hostname port pathname |
| 864 | ;; IDX set by `next-delim' as a side-effect | 864 | ;; IDX set by `next-delim' as a side-effect |
| 865 | idx) | 865 | idx) |
| @@ -872,7 +872,7 @@ or nil but should not for a given method." | |||
| 872 | (no-pathname () | 872 | (no-pathname () |
| 873 | (invalid "No pathname")) | 873 | (invalid "No pathname")) |
| 874 | (next-delim (start) | 874 | (next-delim (start) |
| 875 | ;; Search for a :, @ or /. If none is found, there can be | 875 | ;; Search for a :, @ or /. If none is found, there can be |
| 876 | ;; no path at the end, which is an error. | 876 | ;; no path at the end, which is an error. |
| 877 | (setq idx (string-match-p "[:@/]" root start)) | 877 | (setq idx (string-match-p "[:@/]" root start)) |
| 878 | (if idx (aref root idx) (no-pathname))) | 878 | (if idx (aref root idx) (no-pathname))) |
| @@ -883,7 +883,7 @@ or nil but should not for a given method." | |||
| 883 | (cl-ecase cand | 883 | (cl-ecase cand |
| 884 | (?: | 884 | (?: |
| 885 | ;; Could be : before PORT and PATHNAME, or before | 885 | ;; Could be : before PORT and PATHNAME, or before |
| 886 | ;; PASSWORD. We search for a @ to disambiguate. | 886 | ;; PASSWORD. We search for a @ to disambiguate. |
| 887 | (let ((colon-idx idx) | 887 | (let ((colon-idx idx) |
| 888 | (cand (next-delim (1+ idx)))) | 888 | (cand (next-delim (1+ idx)))) |
| 889 | (cl-ecase cand | 889 | (cl-ecase cand |
| @@ -937,9 +937,9 @@ or nil but should not for a given method." | |||
| 937 | ;; Check for a starting ":" | 937 | ;; Check for a starting ":" |
| 938 | (if (= (aref root 0) ?:) | 938 | (if (= (aref root 0) ?:) |
| 939 | ;; 3 possible cases: | 939 | ;; 3 possible cases: |
| 940 | ;; - :METHOD: at start. METHOD doesn't have any @. | 940 | ;; - :METHOD: at start. METHOD doesn't have any @. |
| 941 | ;; - :PASSWORD@ at start. Must be followed by HOSTNAME. | 941 | ;; - :PASSWORD@ at start. Must be followed by HOSTNAME. |
| 942 | ;; - :[PORT] at start. Must be followed immediately by a "/". | 942 | ;; - :[PORT] at start. Must be followed immediately by a "/". |
| 943 | ;; So, find the next character equal to ":", "@" or "/". | 943 | ;; So, find the next character equal to ":", "@" or "/". |
| 944 | (let ((cand (next-delim 1))) | 944 | (let ((cand (next-delim 1))) |
| 945 | (cl-ecase cand | 945 | (cl-ecase cand |
| @@ -973,7 +973,7 @@ or nil but should not for a given method." | |||
| 973 | (defun vc-cvs-parse-status (&optional full) | 973 | (defun vc-cvs-parse-status (&optional full) |
| 974 | "Parse output of \"cvs status\" command in the current buffer. | 974 | "Parse output of \"cvs status\" command in the current buffer. |
| 975 | Set file properties accordingly. Unless FULL is t, parse only | 975 | Set file properties accordingly. Unless FULL is t, parse only |
| 976 | essential information. Note that this can never set the `ignored' | 976 | essential information. Note that this can never set the `ignored' |
| 977 | state." | 977 | state." |
| 978 | (let (file status missing) | 978 | (let (file status missing) |
| 979 | (goto-char (point-min)) | 979 | (goto-char (point-min)) |
| @@ -1034,7 +1034,7 @@ state." | |||
| 1034 | ;; cvs update: warning: FILENAME was lost | 1034 | ;; cvs update: warning: FILENAME was lost |
| 1035 | ;; U FILENAME | 1035 | ;; U FILENAME |
| 1036 | ;; with FILENAME in the first line possibly enclosed in | 1036 | ;; with FILENAME in the first line possibly enclosed in |
| 1037 | ;; quotes (since CVS 1.12.3). To avoid problems, use the U | 1037 | ;; quotes (since CVS 1.12.3). To avoid problems, use the U |
| 1038 | ;; line where name is never quoted. | 1038 | ;; line where name is never quoted. |
| 1039 | (forward-line 1) | 1039 | (forward-line 1) |
| 1040 | (when (looking-at "^U \\(.*\\)$") | 1040 | (when (looking-at "^U \\(.*\\)$") |
| @@ -1967,7 +1967,7 @@ assq_no_quit (Lisp_Object key, Lisp_Object alist) | |||
| 1967 | } | 1967 | } |
| 1968 | 1968 | ||
| 1969 | /* Assq but doesn't signal. Unlike assq_no_quit, this function still | 1969 | /* Assq but doesn't signal. Unlike assq_no_quit, this function still |
| 1970 | detect circular lists; like assq_no_quit, this function does not | 1970 | detects circular lists; like assq_no_quit, this function does not |
| 1971 | allow quits and never signals. If anything goes wrong, it returns | 1971 | allow quits and never signals. If anything goes wrong, it returns |
| 1972 | Qnil. */ | 1972 | Qnil. */ |
| 1973 | Lisp_Object | 1973 | Lisp_Object |
diff --git a/test/lisp/vc/vc-cvs-tests.el b/test/lisp/vc/vc-cvs-tests.el index 99ac9c8eb96..473ac69e24c 100644 --- a/test/lisp/vc/vc-cvs-tests.el +++ b/test/lisp/vc/vc-cvs-tests.el | |||
| @@ -76,7 +76,7 @@ | |||
| 76 | ":pserver:usr:passwd@host:28/home/serv/repo" | 76 | ":pserver:usr:passwd@host:28/home/serv/repo" |
| 77 | '("pserver" "usr" "host" "/home/serv/repo"))) | 77 | '("pserver" "usr" "host" "/home/serv/repo"))) |
| 78 | 78 | ||
| 79 | ;; Next 3 tests are just to err on the side of caution. It doesn't | 79 | ;; Next 3 tests are just to err on the side of caution. It doesn't |
| 80 | ;; seem that CVS 1.12 can ever produce such lines. | 80 | ;; seem that CVS 1.12 can ever produce such lines. |
| 81 | 81 | ||
| 82 | (ert-deftest | 82 | (ert-deftest |