From c279d65199df4749f649c29aca210419ab85af1a Mon Sep 17 00:00:00 2001 From: Robert Pluim Date: Wed, 19 Apr 2023 09:48:02 +0200 Subject: [PATCH 1/3] ; Double space at end of sentence for vc-cvs.el * lisp/vc/vc-cvs.el (vc-cvs-repository-hostname, vc-cvs-parse-root) (vc-cvs-parse-status, vc-cvs-after-dir-status): Double space at end of sentence. * test/lisp/vc/vc-cvs-tests.el: Double space at end of sentence. --- lisp/vc/vc-cvs.el | 22 +++++++++++----------- test/lisp/vc/vc-cvs-tests.el | 2 +- 2 files changed, 12 insertions(+), 12 deletions(-) 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." (defun vc-cvs-repository-hostname (dirname) "Hostname of the CVS server associated to workarea DIRNAME. -Returns nil if there is not hostname or the hostname could not be +Returns nil if there is no hostname or the hostname could not be determined because the CVS/Root specification is invalid." (let ((rootname (expand-file-name "CVS/Root" dirname))) (when (file-readable-p rootname) @@ -849,7 +849,7 @@ The default METHOD for a CVS root of the form is \"ext\". If METHOD is explicitly \"local\" or \"fork\", then the pathname -starts immediately after the method block. This must be used on +starts immediately after the method block. This must be used on Windows platforms when pathnames start with a drive letter. 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 present, or as the empty string if delimited but empty. Returns nil in case of an unparsable CVS root (including the -empty string) and issues a warning. This function doesn't check +empty string) and issues a warning. This function doesn't check that an explicit method is valid, or that some fields are empty -or nil but should not for a given method." +or nil but should not be for a given method." (let (method user password hostname port pathname ;; IDX set by `next-delim' as a side-effect idx) @@ -872,7 +872,7 @@ or nil but should not for a given method." (no-pathname () (invalid "No pathname")) (next-delim (start) - ;; Search for a :, @ or /. If none is found, there can be + ;; Search for a :, @ or /. If none is found, there can be ;; no path at the end, which is an error. (setq idx (string-match-p "[:@/]" root start)) (if idx (aref root idx) (no-pathname))) @@ -883,7 +883,7 @@ or nil but should not for a given method." (cl-ecase cand (?: ;; Could be : before PORT and PATHNAME, or before - ;; PASSWORD. We search for a @ to disambiguate. + ;; PASSWORD. We search for a @ to disambiguate. (let ((colon-idx idx) (cand (next-delim (1+ idx)))) (cl-ecase cand @@ -937,9 +937,9 @@ or nil but should not for a given method." ;; Check for a starting ":" (if (= (aref root 0) ?:) ;; 3 possible cases: - ;; - :METHOD: at start. METHOD doesn't have any @. - ;; - :PASSWORD@ at start. Must be followed by HOSTNAME. - ;; - :[PORT] at start. Must be followed immediately by a "/". + ;; - :METHOD: at start. METHOD doesn't have any @. + ;; - :PASSWORD@ at start. Must be followed by HOSTNAME. + ;; - :[PORT] at start. Must be followed immediately by a "/". ;; So, find the next character equal to ":", "@" or "/". (let ((cand (next-delim 1))) (cl-ecase cand @@ -973,7 +973,7 @@ or nil but should not for a given method." (defun vc-cvs-parse-status (&optional full) "Parse output of \"cvs status\" command in the current buffer. Set file properties accordingly. Unless FULL is t, parse only -essential information. Note that this can never set the `ignored' +essential information. Note that this can never set the `ignored' state." (let (file status missing) (goto-char (point-min)) @@ -1034,7 +1034,7 @@ state." ;; cvs update: warning: FILENAME was lost ;; U FILENAME ;; with FILENAME in the first line possibly enclosed in - ;; quotes (since CVS 1.12.3). To avoid problems, use the U + ;; quotes (since CVS 1.12.3). To avoid problems, use the U ;; line where name is never quoted. (forward-line 1) (when (looking-at "^U \\(.*\\)$") 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 @@ ":pserver:usr:passwd@host:28/home/serv/repo" '("pserver" "usr" "host" "/home/serv/repo"))) -;; Next 3 tests are just to err on the side of caution. It doesn't +;; Next 3 tests are just to err on the side of caution. It doesn't ;; seem that CVS 1.12 can ever produce such lines. (ert-deftest From a01528c950024faa5ae732c5e2a43f89718175fd Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Wed, 19 Apr 2023 19:30:55 +0300 Subject: [PATCH 2/3] ; * src/fns.c (assq_no_signal): Fix a typo in a comment. --- src/fns.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/fns.c b/src/fns.c index 75acb6f4598..02388fa60ed 100644 --- a/src/fns.c +++ b/src/fns.c @@ -1967,7 +1967,7 @@ assq_no_quit (Lisp_Object key, Lisp_Object alist) } /* Assq but doesn't signal. Unlike assq_no_quit, this function still - detect circular lists; like assq_no_quit, this function does not + detects circular lists; like assq_no_quit, this function does not allow quits and never signals. If anything goes wrong, it returns Qnil. */ Lisp_Object From cc0f9389b8ebedad6401464ee3a259dba3c7abaf Mon Sep 17 00:00:00 2001 From: Yuan Fu Date: Wed, 19 Apr 2023 16:23:25 -0700 Subject: [PATCH 3/3] Fix treesit-install-language-grammar for non-interactive call A continuation of bug#62704. * lisp/treesit.el (treesit-install-language-grammar): Differentiate between interactive and non-interactive call, and don't prompt when it's called non-interactively. --- lisp/treesit.el | 35 +++++++++++++++++++++++------------ 1 file changed, 23 insertions(+), 12 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." "History for OUT-DIR for `treesit-install-language-grammar'.") ;;;###autoload -(defun treesit-install-language-grammar (lang) +(defun treesit-install-language-grammar (lang &optional out-dir) "Build and install the tree-sitter language grammar library for LANG. Interactively, if `treesit-language-source-alist' doesn't already have data for building the grammar for LANG, prompt for its -repository URL and the C/C++ compiler to use. +repository URL and the C/C++ compiler to use. Non-interactively, +signal an error when there's no recipe for LANG. This command requires Git, a C compiler and (sometimes) a C++ compiler, and the linker to be installed and on PATH. It also requires that the recipe for LANG exists in `treesit-language-source-alist'. See `exec-path' for the current path where Emacs looks for -executable programs, such as the C/C++ compiler and linker." +executable programs, such as the C/C++ compiler and linker. + +Interactively, prompt for the directory in which to install the +compiled grammar files. Non-interactively, use OUT-DIR; if it's +nil, the grammar is installed to the standard location, the +\"tree-sitter\" directory under `user-emacs-directory'." (interactive (list (intern (completing-read "Language: " - (mapcar #'car treesit-language-source-alist))))) + (mapcar #'car treesit-language-source-alist))) + 'interactive)) (when-let ((recipe (or (assoc lang treesit-language-source-alist) - (treesit--install-language-grammar-build-recipe - lang))) + (if (eq out-dir 'interactive) + (treesit--install-language-grammar-build-recipe + lang) + (signal 'treesit-error `("Cannot find recipe for this language" ,lang))))) (default-out-dir (or (car treesit--install-language-grammar-out-dir-history) (locate-user-emacs-file "tree-sitter"))) (out-dir - (read-string - (format "Install to (default: %s): " - default-out-dir) - nil - 'treesit--install-language-grammar-out-dir-history - default-out-dir))) + (if (eq out-dir 'interactive) + (read-string + (format "Install to (default: %s): " + default-out-dir) + nil + 'treesit--install-language-grammar-out-dir-history + default-out-dir) + out-dir))) (condition-case err (apply #'treesit--install-language-grammar-1 (cons out-dir recipe))