]> git.eshelyaron.com Git - emacs.git/commitdiff
Merge from origin/emacs-29
authorEli Zaretskii <eliz@gnu.org>
Sat, 3 Jun 2023 09:50:49 +0000 (05:50 -0400)
committerEli Zaretskii <eliz@gnu.org>
Sat, 3 Jun 2023 09:50:49 +0000 (05:50 -0400)
3f441525679 Save the tree-sitter grammar recipe when installing a gra...
c0c7b947baf Add instructions and test file for VS-15/VS-16
3be33aff963 A better fix for "Fix cancellation of Wdired"
756244c6963 ; * lisp/minibuffer.el (completions-header-format): Doc fix.
5d844e129ad Fix tmm-menubar when 'tmm-completion-prompt' is nil

# Conflicts:
# lisp/treesit.el

1  2 
lisp/minibuffer.el
lisp/treesit.el

Simple merge
diff --cc lisp/treesit.el
index cc7ec97785112bf40c4fda0b1a730eb38d383aae,3ec4fbc5c91dc7d1674e3209cd89b169c967b6fd..ea701ce1ff79dde900b8e509d06c4d2b93afbc89
@@@ -3050,29 -2897,32 +3051,47 @@@ nil, the grammar is installed to the st
    (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
 +              (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))
+         (progn
+           (apply #'treesit--install-language-grammar-1
+                  ;; The nil is OUT-DIR.
+                  (cons nil recipe))
+           ;; Check that the installed language grammar is loadable.
+           (pcase-let ((`(,available . ,err)
+                        (treesit-language-available-p lang t)))
+             (if (not available)
+                 (display-warning
+                  'treesit
+                  (format "The installed language grammar for %s cannot be located or has problems (%s): %s"
+                          lang (nth 0 err)
+                          (string-join
+                           (mapcar (lambda (x) (format "%s" x))
+                                   (cdr err))
+                           " ")))
+               ;; If success, Save the recipe for the current session.
+               (setf (alist-get lang treesit-language-source-alist)
+                     recipe))))
        (error
         (display-warning
          'treesit