commit 1ddd31bf9843c0453af92a09f98935cfcbb4e250 (HEAD, refs/remotes/origin/master) Merge: 0e1b03bbb87 0d98fac6bbc Author: Stefan Kangas Date: Wed Jan 4 06:30:13 2023 +0100 Merge from origin/emacs-29 0d98fac6bbc (ruby-ts-add-log-current-function): Fix when between two ... da69f116bfc ; * doc/lispref/positions.texi (List Motion): Minor wordi... 0b0eae0bf76 ; Improve documentation of 'treesit-language-source-alist' ae0d218d0b3 ; * etc/NEWS: Mention treesit-install-language-grammar. de3df3bc51e * lisp/vc/vc-git.el (vc-git-checkin): Pass vc-git-diff-sw... # Conflicts: # etc/NEWS commit 0d98fac6bbc19c7728d42d6196adf4d392ba3132 Author: Dmitry Gutov Date: Wed Jan 4 00:37:43 2023 +0200 (ruby-ts-add-log-current-function): Fix when between two methods * lisp/progmodes/ruby-ts-mode.el (ruby-ts-add-log-current-function): Fix the case when point is between two methods. 'treesit-node-at' returs the 'def' node of the method after point in such case, so it behaved like point was inside the method below. * test/lisp/progmodes/ruby-ts-mode-tests.el (ruby-ts-add-log-current-method-outside-of-method): Update the test case. * test/lisp/progmodes/ruby-mode-tests.el (ruby-add-log-current-method-outside-of-method): Mirror that change. diff --git a/lisp/progmodes/ruby-ts-mode.el b/lisp/progmodes/ruby-ts-mode.el index c086214a11d..5c173ad24c7 100644 --- a/lisp/progmodes/ruby-ts-mode.el +++ b/lisp/progmodes/ruby-ts-mode.el @@ -850,7 +850,12 @@ ruby-ts-add-log-current-function dot (.) is used. Double colon (::) is used between classes. The leading double colon is not added." (let* ((node (treesit-node-at (point))) - (method (treesit-parent-until node (ruby-ts--type-pred ruby-ts--method-regex))) + (method-pred + (lambda (node) + (and (<= (treesit-node-start node) (point)) + (>= (treesit-node-end node) (point)) + (string-match-p ruby-ts--method-regex (treesit-node-type node))))) + (method (treesit-parent-until node method-pred t)) (class (or method node)) (result nil) (sep "#") diff --git a/test/lisp/progmodes/ruby-mode-tests.el b/test/lisp/progmodes/ruby-mode-tests.el index 9687231dbfa..8a75c83d2c3 100644 --- a/test/lisp/progmodes/ruby-mode-tests.el +++ b/test/lisp/progmodes/ruby-mode-tests.el @@ -537,9 +537,12 @@ ruby-add-log-current-method-outside-of-method | def foo | end | _ + | def bar + | end | end |end") (search-backward "_") + (delete-char 1) (should (string= (ruby-add-log-current-method)"M::C")))) (ert-deftest ruby-add-log-current-method-in-singleton-class () diff --git a/test/lisp/progmodes/ruby-ts-mode-tests.el b/test/lisp/progmodes/ruby-ts-mode-tests.el index aa1ab1e2605..b2c990f8e56 100644 --- a/test/lisp/progmodes/ruby-ts-mode-tests.el +++ b/test/lisp/progmodes/ruby-ts-mode-tests.el @@ -141,9 +141,12 @@ ruby-ts-add-log-current-method-outside-of-method | def foo | end | _ + | def bar + | end | end |end") (search-backward "_") + (delete-char 1) (should (string= (ruby-ts-add-log-current-function) "M::C")))) (ert-deftest ruby-ts-add-log-current-method-in-singleton-class () commit 0e1b03bbb87d0b09ba841c0318fce77533914208 Author: Mattias Engdegård Date: Tue Jan 3 15:58:14 2023 +0100 Styled quotes in compiler warnings * lisp/emacs-lisp/byte-run.el (byte-run--parse-body) (byte-run--unescaped-character-literals-warning): * lisp/emacs-lisp/bytecomp.el (byte-compile-initial-macro-environment) (byte-compile-form, bytecomp--warn-dodgy-eq-arg): * lisp/emacs-lisp/cconv.el (cconv--warn-unused-msg): * lisp/emacs-lisp/cl-macs.el (cl-defstruct): * lisp/emacs-lisp/easy-mmode.el (define-minor-mode): * lisp/emacs-lisp/eieio.el (defclass): * lisp/emacs-lisp/macroexp.el (macroexp--unfold-lambda) (macroexp--expand-all): * lisp/emacs-lisp/pcase.el (pcase--u1): * lisp/subr.el (when, unless, ignore-error, lsh, sit-for) (with-demoted-errors): Use format-message to ensure properly styled quotes in compiler warning messages. diff --git a/lisp/emacs-lisp/byte-run.el b/lisp/emacs-lisp/byte-run.el index 7709c26e839..9345665eea8 100644 --- a/lisp/emacs-lisp/byte-run.el +++ b/lisp/emacs-lisp/byte-run.el @@ -262,7 +262,8 @@ 'byte-run--parse-body (interactive-form nil) (warnings nil) (warn #'(lambda (msg form) - (push (macroexp-warn-and-return msg nil nil t form) + (push (macroexp-warn-and-return + (format-message msg) nil nil t form) warnings)))) (while (and body @@ -679,11 +680,11 @@ byte-run--unescaped-character-literals-warning ;; This is called from lread.c and therefore needs to be preloaded. (if lread--unescaped-character-literals (let ((sorted (sort lread--unescaped-character-literals #'<))) - (format-message "unescaped character literals %s detected, %s expected!" - (mapconcat (lambda (char) (format "`?%c'" char)) - sorted ", ") - (mapconcat (lambda (char) (format "`?\\%c'" char)) - sorted ", "))))) + (format "unescaped character literals %s detected, %s expected!" + (mapconcat (lambda (char) (format-message "`?%c'" char)) + sorted ", ") + (mapconcat (lambda (char) (format-message "`?\\%c'" char)) + sorted ", "))))) (defun byte-compile-info (string &optional message type) "Format STRING in a way that looks pleasing in the compilation output. diff --git a/lisp/emacs-lisp/bytecomp.el b/lisp/emacs-lisp/bytecomp.el index df0229094b7..23d02ba92cf 100644 --- a/lisp/emacs-lisp/bytecomp.el +++ b/lisp/emacs-lisp/bytecomp.el @@ -554,7 +554,7 @@ byte-compile-initial-macro-environment ,(macroexpand-all `(progn ,@body) macroexpand-all-environment))) (macroexp-warn-and-return - "`with-suppressed-warnings' with empty body" + (format-message "`with-suppressed-warnings' with empty body") nil '(empty-body with-suppressed-warnings) t warnings))))) "The default macro-environment passed to macroexpand by the compiler. Placing a macro here will cause a macro to have different semantics when @@ -3445,7 +3445,7 @@ byte-compile-form (t ".")))) (if (eq (car-safe (symbol-function (car form))) 'macro) (byte-compile-report-error - (format "`%s' defined after use in %S (missing `require' of a library file?)" + (format-message "`%s' defined after use in %S (missing `require' of a library file?)" (car form) form))) (if (and handler ;; Make sure that function exists. @@ -5524,8 +5524,8 @@ bytecomp--arg-type-description (defun bytecomp--warn-dodgy-eq-arg (form type parenthesis) (macroexp-warn-and-return - (format "`%s' called with literal %s that may never match (%s)" - (car form) type parenthesis) + (format-message "`%s' called with literal %s that may never match (%s)" + (car form) type parenthesis) form (list 'suspicious (car form)) t)) (defun bytecomp--check-eq-args (form &optional a b &rest _ignore) diff --git a/lisp/emacs-lisp/cconv.el b/lisp/emacs-lisp/cconv.el index 0154716627f..e715bd90a00 100644 --- a/lisp/emacs-lisp/cconv.el +++ b/lisp/emacs-lisp/cconv.el @@ -236,9 +236,9 @@ cconv--warn-unused-msg (not (intern-soft var)) (eq ?_ (aref (symbol-name var) 0))) (let ((suggestions (help-uni-confusable-suggestions (symbol-name var)))) - (format "Unused lexical %s `%S'%s" - varkind (bare-symbol var) - (if suggestions (concat "\n " suggestions) ""))))) + (format-message "Unused lexical %s `%S'%s" + varkind (bare-symbol var) + (if suggestions (concat "\n " suggestions) ""))))) (define-inline cconv--var-classification (binder form) (inline-quote diff --git a/lisp/emacs-lisp/cl-macs.el b/lisp/emacs-lisp/cl-macs.el index 74ae3384897..36aab087d94 100644 --- a/lisp/emacs-lisp/cl-macs.el +++ b/lisp/emacs-lisp/cl-macs.el @@ -3176,8 +3176,9 @@ cl-defstruct (when (cl-oddp (length desc)) (push (macroexp-warn-and-return - (format "Missing value for option `%S' of slot `%s' in struct %s!" - (car (last desc)) slot name) + (format-message + "Missing value for option `%S' of slot `%s' in struct %s!" + (car (last desc)) slot name) nil nil nil (car (last desc))) forms) (when (and (keywordp (car defaults)) @@ -3185,8 +3186,9 @@ cl-defstruct (let ((kw (car defaults))) (push (macroexp-warn-and-return - (format " I'll take `%s' to be an option rather than a default value." - kw) + (format-message + " I'll take `%s' to be an option rather than a default value." + kw) nil nil nil kw) forms) (push kw desc) diff --git a/lisp/emacs-lisp/easy-mmode.el b/lisp/emacs-lisp/easy-mmode.el index 74768d5e767..77f4b26d9bb 100644 --- a/lisp/emacs-lisp/easy-mmode.el +++ b/lisp/emacs-lisp/easy-mmode.el @@ -250,7 +250,8 @@ define-minor-mode (warnwrap (if (or (null body) (keywordp (car body))) #'identity (lambda (exp) (macroexp-warn-and-return - "Use keywords rather than deprecated positional arguments to `define-minor-mode'" + (format-message + "Use keywords rather than deprecated positional arguments to `define-minor-mode'") exp)))) keyw keymap-sym tmp) diff --git a/lisp/emacs-lisp/eieio.el b/lisp/emacs-lisp/eieio.el index 064a55f2727..9a1f5b9db0f 100644 --- a/lisp/emacs-lisp/eieio.el +++ b/lisp/emacs-lisp/eieio.el @@ -184,8 +184,9 @@ defclass (when (and initarg (eq alloc :class)) (push (cons sname - (format "Meaningless :initarg for class allocated slot '%S'" - sname)) + (format-message + "Meaningless :initarg for class allocated slot `%S'" + sname)) warnings)) (let ((init (plist-get soptions :initform))) diff --git a/lisp/emacs-lisp/macroexp.el b/lisp/emacs-lisp/macroexp.el index 62f12a75b30..069adb3edad 100644 --- a/lisp/emacs-lisp/macroexp.el +++ b/lisp/emacs-lisp/macroexp.el @@ -291,10 +291,11 @@ macroexp--unfold-lambda (setq arglist (cdr arglist))) (if values (macroexp-warn-and-return - (format (if (eq values 'too-few) - "attempt to open-code `%s' with too few arguments" - "attempt to open-code `%s' with too many arguments") - name) + (format-message + (if (eq values 'too-few) + "attempt to open-code `%s' with too few arguments" + "attempt to open-code `%s' with too many arguments") + name) form nil nil arglist) ;; The following leads to infinite recursion when loading a @@ -367,14 +368,14 @@ macroexp--expand-all (if (null body) (macroexp-unprogn (macroexp-warn-and-return - (format "`%s' with empty body" fun) + (format-message "`%s' with empty body" fun) nil (list 'empty-body fun) 'compile-only fun)) (macroexp--all-forms body)) (cdr form)) form))) (`(while) (macroexp-warn-and-return - "missing `while' condition" + (format-message "missing `while' condition") `(signal 'wrong-number-of-arguments '(while 0)) nil 'compile-only form)) (`(setq ,(and var (pred symbolp) @@ -392,7 +393,7 @@ macroexp--expand-all (let ((nargs (length args))) (if (/= (logand nargs 1) 0) (macroexp-warn-and-return - "odd number of arguments in `setq' form" + (format-message "odd number of arguments in `setq' form") `(signal 'wrong-number-of-arguments '(setq ,nargs)) nil 'compile-only fn) (let ((assignments nil)) diff --git a/lisp/emacs-lisp/pcase.el b/lisp/emacs-lisp/pcase.el index 810b13f61d6..1c5ce5169ab 100644 --- a/lisp/emacs-lisp/pcase.el +++ b/lisp/emacs-lisp/pcase.el @@ -947,7 +947,7 @@ pcase--u1 (let ((code (pcase--u1 matches code vars rest))) (if (eq upat '_) code (macroexp-warn-and-return - "Pattern t is deprecated. Use `_' instead" + (format-message "Pattern t is deprecated. Use `_' instead") code nil nil upat)))) ((eq upat 'pcase--dontcare) :pcase--dontcare) ((memq (car-safe upat) '(guard pred)) diff --git a/lisp/subr.el b/lisp/subr.el index 5fb150994ec..2adf1033911 100644 --- a/lisp/subr.el +++ b/lisp/subr.el @@ -282,7 +282,7 @@ when (declare (indent 1) (debug t)) (if body (list 'if cond (cons 'progn body)) - (macroexp-warn-and-return "`when' with empty body" + (macroexp-warn-and-return (format-message "`when' with empty body") cond '(empty-body when) t))) (defmacro unless (cond &rest body) @@ -292,7 +292,7 @@ unless (declare (indent 1) (debug t)) (if body (cons 'if (cons cond (cons nil body))) - (macroexp-warn-and-return "`unless' with empty body" + (macroexp-warn-and-return (format-message "`unless' with empty body") cond '(empty-body unless) t))) (defsubst subr-primitive-p (object) @@ -393,14 +393,15 @@ ignore-error ((and (eq (car-safe condition) 'quote) (cdr condition) (null (cddr condition))) (macroexp-warn-and-return - (format "`ignore-error' condition argument should not be quoted: %S" - condition) + (format-message + "`ignore-error' condition argument should not be quoted: %S" + condition) `(condition-case nil (progn ,@body) (,(cadr condition) nil)) nil t condition)) (body `(condition-case nil (progn ,@body) (,condition nil))) (t - (macroexp-warn-and-return "`ignore-error' with empty body" + (macroexp-warn-and-return (format-message "`ignore-error' with empty body") nil '(empty-body ignore-error) t condition)))) @@ -530,8 +531,9 @@ lsh instead." (declare (compiler-macro (lambda (form) - (macroexp-warn-and-return "avoid `lsh'; use `ash' instead" - form '(suspicious lsh) t form)))) + (macroexp-warn-and-return + (format-message "avoid `lsh'; use `ash' instead") + form '(suspicious lsh) t form)))) (when (and (< value 0) (< count 0)) (when (< value most-negative-fixnum) (signal 'args-out-of-range (list value count))) @@ -3300,7 +3302,7 @@ sit-for (lambda (form) (if (not (or (numberp nodisp) obsolete)) form (macroexp-warn-and-return - "Obsolete calling convention for 'sit-for'" + (format-message "Obsolete calling convention for `sit-for'") `(,(car form) (+ ,seconds (/ (or ,nodisp 0) 1000.0)) ,obsolete) '(obsolete sit-for)))))) ;; This used to be implemented in C until the following discussion: @@ -4882,7 +4884,8 @@ with-demoted-errors ;; The use without `format' is obsolete, let's warn when we bump ;; into any such remaining uses. (macroexp-warn-and-return - "Missing format argument in `with-demote-errors'" exp nil nil + (format-message "Missing format argument in `with-demote-errors'") + exp nil nil orig-format)))) (defmacro combine-after-change-calls (&rest body) commit cfc0e1cc02976d82285166fa35d69c6af5a430d8 Author: Mattias Engdegård Date: Tue Jan 3 14:26:44 2023 +0100 ; * cl-lib-tests.el: Suppress for the right function. diff --git a/test/lisp/emacs-lisp/cl-lib-tests.el b/test/lisp/emacs-lisp/cl-lib-tests.el index 6668be8ee70..4e1a0fd63a2 100644 --- a/test/lisp/emacs-lisp/cl-lib-tests.el +++ b/test/lisp/emacs-lisp/cl-lib-tests.el @@ -431,7 +431,7 @@ cl-lib-adjoin-test (should (eq nums (cdr (cl-adjoin 3 nums)))) ;; add only when not already there (should (eq nums (cl-adjoin 2 nums))) - (with-suppressed-warnings ((suspicious eq)) + (with-suppressed-warnings ((suspicious memql)) (should (equal '(2 1 (2)) (cl-adjoin 2 '(1 (2)))))) ;; default test function is eql (should (equal '(1.0 1 2) (cl-adjoin 1.0 nums))) commit da69f116bfc37d28942ca6d35eaff978e6805bac Author: Eli Zaretskii Date: Tue Jan 3 15:16:42 2023 +0200 ; * doc/lispref/positions.texi (List Motion): Minor wording fix. diff --git a/doc/lispref/positions.texi b/doc/lispref/positions.texi index f47720184a3..f3824436246 100644 --- a/doc/lispref/positions.texi +++ b/doc/lispref/positions.texi @@ -852,7 +852,7 @@ List Motion @end defvar @defvar treesit-defun-tactic -This variable determines how does Emacs treat nested defuns. If the +This variable determines how Emacs treats nested defuns. If the value is @code{top-level}, navigation functions only move across top-level defuns, if the value is @code{nested}, navigation functions recognize nested defuns. commit 0b0eae0bf76c4d791cc47dad82306e33d54290c0 Author: Eli Zaretskii Date: Tue Jan 3 15:12:48 2023 +0200 ; Improve documentation of 'treesit-language-source-alist' * lisp/treesit.el (treesit--install-language-grammar-build-recipe) (treesit-install-language-grammar): Doc fixes. (treesit-install-language-grammar): Autoload it. * etc/NEWS: Improve wording of the 'treesit-install-language-grammar' documentation. diff --git a/etc/NEWS b/etc/NEWS index e679b904a65..38a8798507a 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -63,18 +63,17 @@ the other shared libraries used by Emacs, or in the "tree-sitter" subdirectory of your 'user-emacs-directory', or in a directory mentioned in the variable 'treesit-extra-load-path'. -Emacs provides a user command, 'treesit-install-language-grammar', -that automates the building process. A third-party major mode package -could instruct its users to set 'treesit-language-source-alist' -accordingly and use that command to download and compile the language -grammar. A user could also use that command directly and manually -guide it through the process. - You only need to install language grammar libraries required by the Emacs modes you will use, as Emacs loads these libraries only when the corresponding mode is turned on in some buffer for the first time in an Emacs session. +Emacs provides a user command, 'treesit-install-language-grammar', +that automates the download and build process of a grammar library. +It prompts for the language, the URL of the language grammar's VCS +repository, and then uses the installed C/C++ compiler to build the +library and install it. + +++ ** Emacs can be built with built-in support for accessing SQLite databases. This uses the popular sqlite3 library, and can be disabled by using diff --git a/lisp/treesit.el b/lisp/treesit.el index 1ca72af5c2d..933d53082f9 100644 --- a/lisp/treesit.el +++ b/lisp/treesit.el @@ -2633,7 +2633,7 @@ treesit-language-source-alist \"c++\", respectively.") (defun treesit--install-language-grammar-build-recipe (lang) - "Interactively build a recipe for LANG and return it. + "Interactively produce a download/build recipe for LANG and return it. See `treesit-language-source-alist' for details." (when (y-or-n-p (format "There is no recipe for %s, do you want to build it interactively?" lang)) (cl-labels ((empty-string-to-nil (string) @@ -2655,9 +2655,14 @@ treesit--install-language-grammar-build-recipe (read-string "Enter the C++ compiler to use (default: auto-detect): ")))))) +;;;###autoload (defun treesit-install-language-grammar (lang) "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. + 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'. commit 0bece4d33f6b1c9de573cc6457ae851bde1958a4 Author: Mattias Engdegård Date: Tue Jan 3 14:03:58 2023 +0100 Data argument to `signal` should be a list * lisp/calendar/iso8601.el (iso8601-parse, iso8601-parse-date) (iso8601-parse-time, iso8601-parse-zone, iso8601-parse-duration) (iso8601-parse-interval): * lisp/emacs-lisp/cl-lib.el (cl-values-list): * lisp/emacs-lisp/comp.el (comp-decrypt-arg-list) (comp-spill-lap-function, comp-emit-switch) (comp-compute-dominator-tree, comp-final): * lisp/image.el (image-type): * lisp/image/exif.el (exif--parse-jpeg, exif--parse-exif-chunk) (exif--parse-directory, exif--read-chunk, exif--read-number-be) (exif--read-number-le): * lisp/vc/vc.el (vc-default-last-change): Wrap obvious non-list data arguments to `signal` in a list. diff --git a/lisp/calendar/iso8601.el b/lisp/calendar/iso8601.el index cd3de62afdb..d7d064d9c2a 100644 --- a/lisp/calendar/iso8601.el +++ b/lisp/calendar/iso8601.el @@ -129,7 +129,7 @@ iso8601-parse See `decode-time' for the meaning of FORM." (if (not (iso8601-valid-p string)) - (signal 'wrong-type-argument string) + (signal 'wrong-type-argument (list string)) (let* ((date-string (match-string 1 string)) (time-string (match-string 2 string)) (zone-string (match-string 3 string)) @@ -217,7 +217,7 @@ iso8601-parse-date ((iso8601--match "---\\([0-9][0-9]\\)" string) (iso8601--decoded-time :day (string-to-number (match-string 1 string)))) (t - (signal 'wrong-type-argument string)))) + (signal 'wrong-type-argument (list string))))) (defun iso8601-parse-time (string &optional form) "Parse STRING, which should be an ISO 8601 time string. @@ -226,11 +226,11 @@ iso8601-parse-time See `decode-time' for the meaning of FORM." (if (not (iso8601--match iso8601--full-time-match string)) - (signal 'wrong-type-argument string) + (signal 'wrong-type-argument (list string)) (let ((time (match-string 1 string)) (zone (match-string 2 string))) (if (not (iso8601--match iso8601--time-match time)) - (signal 'wrong-type-argument string) + (signal 'wrong-type-argument (list string)) (let ((hour (string-to-number (match-string 1 time))) (minute (and (match-string 2 time) (string-to-number (match-string 2 time)))) @@ -274,7 +274,7 @@ iso8601-parse-zone "Parse STRING, which should be an ISO 8601 time zone. Return the number of minutes." (if (not (iso8601--match iso8601--zone-match string)) - (signal 'wrong-type-argument string) + (signal 'wrong-type-argument (list string)) (if (match-string 2 string) ;; HH:MM-ish. (let ((hour (string-to-number (match-string 3 string))) @@ -314,14 +314,14 @@ iso8601-parse-duration ((iso8601--match iso8601--duration-combined-match string) (iso8601-parse (substring string 1))) (t - (signal 'wrong-type-argument string)))) + (signal 'wrong-type-argument (list string))))) (defun iso8601-parse-interval (string) "Parse ISO 8601 intervals." (let ((bits (split-string string "/")) start end duration) (if (not (= (length bits) 2)) - (signal 'wrong-type-argument string) + (signal 'wrong-type-argument (list string)) ;; The intervals may be an explicit start/end times, or either a ;; start or an end, and an accompanying duration. (cond @@ -338,7 +338,7 @@ iso8601-parse-interval (setq start (iso8601-parse (car bits)) end (iso8601-parse (cadr bits)))) (t - (signal 'wrong-type-argument string)))) + (signal 'wrong-type-argument (list string))))) (unless end (setq end (decoded-time-add start duration))) (unless start diff --git a/lisp/emacs-lisp/cl-lib.el b/lisp/emacs-lisp/cl-lib.el index 152a1fe9434..95a51a4bdde 100644 --- a/lisp/emacs-lisp/cl-lib.el +++ b/lisp/emacs-lisp/cl-lib.el @@ -201,7 +201,7 @@ cl-values-list Note that Emacs Lisp doesn't really support multiple values, so all this function does is return LIST." (unless (listp list) - (signal 'wrong-type-argument list)) + (signal 'wrong-type-argument (list list))) list) (defsubst cl-multiple-value-list (expression) diff --git a/lisp/emacs-lisp/comp.el b/lisp/emacs-lisp/comp.el index 49e3cdb8de7..acabc31fc33 100644 --- a/lisp/emacs-lisp/comp.el +++ b/lisp/emacs-lisp/comp.el @@ -1220,7 +1220,7 @@ comp-c-func-name (defun comp-decrypt-arg-list (x function-name) "Decrypt argument list X for FUNCTION-NAME." (unless (fixnump x) - (signal 'native-compiler-error-dyn-func function-name)) + (signal 'native-compiler-error-dyn-func (list function-name))) (let ((rest (not (= (logand x 128) 0))) (mandatory (logand x 127)) (nonrest (ash x -8))) @@ -1264,7 +1264,7 @@ comp-spill-lap-function 'pure)))) (when (byte-code-function-p f) (signal 'native-compiler-error - "can't native compile an already byte-compiled function")) + '("can't native compile an already byte-compiled function"))) (setf (comp-func-byte-func func) (byte-compile (comp-func-name func))) (let ((lap (byte-to-native-lambda-lap @@ -1288,7 +1288,7 @@ comp-spill-lap-function "Byte-compile FORM, spilling data from the byte compiler." (unless (eq (car-safe form) 'lambda) (signal 'native-compiler-error - "Cannot native-compile, form is not a lambda")) + '("Cannot native-compile, form is not a lambda"))) (unless (comp-ctxt-output comp-ctxt) (setf (comp-ctxt-output comp-ctxt) (make-temp-file "comp-lambda-" nil ".eln"))) @@ -1369,7 +1369,7 @@ comp-spill-lap-function (alist-get 'no-native-compile byte-native-qualities)) (throw 'no-native-compile nil)) (unless byte-to-native-top-level-forms - (signal 'native-compiler-error-empty-byte filename)) + (signal 'native-compiler-error-empty-byte (list filename))) (unless (comp-ctxt-output comp-ctxt) (setf (comp-ctxt-output comp-ctxt) (comp-el-to-eln-filename filename @@ -1740,7 +1740,7 @@ comp-emit-switch do (puthash ff-bb-name ff-bb (comp-func-blocks comp-func)) (setf (comp-limplify-curr-block comp-pass) ff-bb)))) (_ (signal 'native-ice - "missing previous setimm while creating a switch")))) + '("missing previous setimm while creating a switch"))))) (defun comp-emit-set-call-subr (subr-name sp-delta) "Emit a call for SUBR-NAME. @@ -2823,7 +2823,7 @@ comp-compute-dominator-tree (first-processed (l) (if-let ((p (cl-find-if (lambda (p) (comp-block-idom p)) l))) p - (signal 'native-ice "can't find first preprocessed")))) + (signal 'native-ice '("can't find first preprocessed"))))) (when-let ((blocks (comp-func-blocks comp-func)) (entry (gethash 'entry blocks)) @@ -3721,7 +3721,7 @@ comp-final (progn (delete-file temp-file) output) - (signal 'native-compiler-error (buffer-string))) + (signal 'native-compiler-error (list (buffer-string)))) (comp-log-to-buffer (buffer-string)))))))) diff --git a/lisp/image.el b/lisp/image.el index 29c39c5dd55..2372fd1ce09 100644 --- a/lisp/image.el +++ b/lisp/image.el @@ -444,7 +444,7 @@ image-type (require 'image-converter) (image-convert-p source)))))) (unless type - (signal 'unknown-image-type "Cannot determine image type"))) + (signal 'unknown-image-type '("Cannot determine image type")))) (when (and (not (eq type 'image-convert)) (not (memq type (and (boundp 'image-types) image-types)))) (error "Invalid image type `%s'" type)) diff --git a/lisp/image/exif.el b/lisp/image/exif.el index c561ea729af..50428c3a31a 100644 --- a/lisp/image/exif.el +++ b/lisp/image/exif.el @@ -151,7 +151,7 @@ exif-orientation (defun exif--parse-jpeg () (unless (= (exif--read-number-be 2) #xffd8) ; SOI (start of image) - (signal 'exif-error "Not a valid JPEG file")) + (signal 'exif-error '("Not a valid JPEG file"))) (cl-loop for segment = (exif--read-number-be 2) for size = (exif--read-number-be 2) ;; Stop parsing when we get to SOS (start of stream); @@ -168,7 +168,7 @@ exif--parse-exif-chunk ;; The Exif data is in the APP1 JPEG chunk and starts with ;; "Exif\0\0". (unless (equal (exif--read-chunk 6) (string ?E ?x ?i ?f ?\0 ?\0)) - (signal 'exif-error "Not a valid Exif chunk")) + (signal 'exif-error '("Not a valid Exif chunk"))) (delete-region (point-min) (point)) (let* ((endian-marker (exif--read-chunk 2)) (le (cond @@ -180,14 +180,15 @@ exif--parse-exif-chunk t) (t (signal 'exif-error - (format "Invalid endian-ness %s" endian-marker)))))) + (list (format "Invalid endian-ness %s" + endian-marker))))))) ;; Another magical number. (unless (= (exif--read-number 2 le) #x002a) - (signal 'exif-error "Invalid TIFF header length")) + (signal 'exif-error '("Invalid TIFF header length"))) (let ((offset (exif--read-number 4 le))) ;; Jump to where the IFD (directory) starts and parse it. (when (> (1+ offset) (point-max)) - (signal 'exif-error "Invalid IFD (directory) offset")) + (signal 'exif-error '("Invalid IFD (directory) offset"))) (goto-char (1+ offset)) (exif--parse-directory le))))) @@ -230,7 +231,7 @@ exif--parse-directory (when (> (+ (1+ value) length) (point-max)) (signal 'exif-error - "Premature end of file")) + '("Premature end of file"))) (buffer-substring (1+ value) (+ (1+ value) length))) @@ -248,7 +249,7 @@ exif--parse-directory ;; keep parsing. (progn (when (> (1+ next) (point-max)) - (signal 'exif-error "Invalid IFD (directory) next-offset")) + (signal 'exif-error '("Invalid IFD (directory) next-offset"))) (goto-char (1+ next)) (nconc dir (exif--parse-directory le))) ;; We've reached the end of the directories. @@ -283,7 +284,7 @@ exif--process-value (defun exif--read-chunk (bytes) "Return BYTES octets from the buffer and advance point that much." (when (> (+ (point) bytes) (point-max)) - (signal 'exif-error "Premature end of file")) + (signal 'exif-error '("Premature end of file"))) (prog1 (buffer-substring (point) (+ (point) bytes)) (forward-char bytes))) @@ -292,7 +293,7 @@ exif--read-number-be "Read BYTES octets from the buffer as a chunk of big-endian bytes. Advance point to after the read bytes." (when (> (+ (point) bytes) (point-max)) - (signal 'exif-error "Premature end of file")) + (signal 'exif-error '("Premature end of file"))) (let ((sum 0)) (dotimes (_ bytes) (setq sum (+ (* sum 256) (following-char))) @@ -303,7 +304,7 @@ exif--read-number-le "Read BYTES octets from the buffer as a chunk of low-endian bytes. Advance point to after the read bytes." (when (> (+ (point) bytes) (point-max)) - (signal 'exif-error "Premature end of file")) + (signal 'exif-error '("Premature end of file"))) (let ((sum 0)) (dotimes (i bytes) (setq sum (+ (* (following-char) (expt 256 i)) sum)) diff --git a/lisp/vc/vc.el b/lisp/vc/vc.el index a22b9531fdb..13124509c27 100644 --- a/lisp/vc/vc.el +++ b/lisp/vc/vc.el @@ -3630,7 +3630,7 @@ vc-default-last-change "Default `last-change' implementation. It returns the last revision that changed LINE number in FILE." (unless (file-exists-p file) - (signal 'file-error "File doesn't exist")) + (signal 'file-error '("File doesn't exist"))) (with-temp-buffer (vc-call-backend (vc-backend file) 'annotate-command file (current-buffer)) commit ae0d218d0b38ae94db44006fc9930ab1d14b345d Author: Yuan Fu Date: Mon Jan 2 22:52:42 2023 -0800 ; * etc/NEWS: Mention treesit-install-language-grammar. diff --git a/etc/NEWS b/etc/NEWS index 355ba6ba8aa..e679b904a65 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -63,6 +63,13 @@ the other shared libraries used by Emacs, or in the "tree-sitter" subdirectory of your 'user-emacs-directory', or in a directory mentioned in the variable 'treesit-extra-load-path'. +Emacs provides a user command, 'treesit-install-language-grammar', +that automates the building process. A third-party major mode package +could instruct its users to set 'treesit-language-source-alist' +accordingly and use that command to download and compile the language +grammar. A user could also use that command directly and manually +guide it through the process. + You only need to install language grammar libraries required by the Emacs modes you will use, as Emacs loads these libraries only when the corresponding mode is turned on in some buffer for the first time in commit de3df3bc51e056d179e572fc0fc3bed89b372662 Author: Sean Whitton Date: Mon Jan 2 23:08:39 2023 -0700 * lisp/vc/vc-git.el (vc-git-checkin): Pass vc-git-diff-switches. diff --git a/lisp/vc/vc-git.el b/lisp/vc/vc-git.el index 7413ecb79b1..06bf927831d 100644 --- a/lisp/vc/vc-git.el +++ b/lisp/vc/vc-git.el @@ -992,6 +992,8 @@ vc-git-checkin-patch (let ((vc-git-patch-string patch-string)) (vc-git-checkin nil comment))) +(autoload 'vc-switches "vc") + (defun vc-git-checkin (files comment &optional _rev) (let* ((file1 (or (car files) default-directory)) (root (vc-git-root file1)) @@ -1021,7 +1023,14 @@ vc-git-checkin ;; currently staged to the index. So remove the whole file diff ;; from the patch because commit will take it from the index. (with-temp-buffer - (vc-git-command (current-buffer) t nil "diff" "--cached") + ;; If the user has switches like -D, -M etc. in their + ;; `vc-git-diff-switches', we must pass them here too, or + ;; our string matches will fail. + (if vc-git-diff-switches + (apply #'vc-git-command (current-buffer) t nil + "diff" "--cached" (vc-switches 'git 'diff)) + ;; Following code doesn't understand plain diff(1) output. + (user-error "Cannot commit patch with nil `vc-git-diff-switches'")) (goto-char (point-min)) (let ((pos (point)) file-diff file-beg) (while (not (eobp)) @@ -1291,8 +1300,6 @@ vc-git-print-log-follow :type 'boolean :version "26.1") -(autoload 'vc-switches "vc") - (defun vc-git-print-log (files buffer &optional shortlog start-revision limit) "Print commit log associated with FILES into specified BUFFER. If SHORTLOG is non-nil, use a short format based on `vc-git-root-log-format'.