commit 23089f1cf2206a3e164c6091963802c156c14d66 (HEAD, refs/remotes/origin/master) Merge: 07a76a06f9a f1f571e72ae Author: Stefan Kangas Date: Fri Feb 17 06:30:17 2023 +0100 Merge from origin/emacs-29 f1f571e72ae Add electric indent for preproc directives 83af806ab7c Rename 'emacs-news-toggle-tag' to 'emacs-news-cycle-tag' 5bc88b3b175 Add menu to news-mode 40f4bc4e0aa ; Avoid installing VC package dependencies multiple times 1c9d81a2b42 Attempt to recognise if a VC package has no Elisp files commit f1f571e72ae10285762d3a941e56f7c4048272af Author: Theodor Thornhill Date: Wed Feb 15 21:05:37 2023 +0100 Add electric indent for preproc directives It looks like there are few if no other cases where we get this particular error in the AST than with insertion of '#'. Consider: ``` int main() { | } ``` If we only add '#' the AST yields (ERROR (ERROR)), which we can exploit to hook onto electric indent. The end result should be the hashtag anchored to column 0. * lisp/progmodes/c-ts-mode.el (c-ts-mode--indent-styles): New rule. (c-ts-base-mode): Add # to electric-indent-chars. diff --git a/lisp/progmodes/c-ts-mode.el b/lisp/progmodes/c-ts-mode.el index 020f2642ac2..a60c464093e 100644 --- a/lisp/progmodes/c-ts-mode.el +++ b/lisp/progmodes/c-ts-mode.el @@ -219,6 +219,7 @@ c-ts-mode--indent-styles MODE is either `c' or `cpp'." (let ((common `(((parent-is "translation_unit") point-min 0) + ((query "(ERROR (ERROR)) @indent") point-min 0) ((node-is ")") parent 1) ((node-is "]") parent-bol 0) ((node-is "else") parent-bol 0) @@ -785,7 +786,7 @@ c-ts-base-mode ;; Electric (setq-local electric-indent-chars - (append "{}():;," electric-indent-chars)) + (append "{}():;,#" electric-indent-chars)) ;; Imenu. (setq-local treesit-simple-imenu-settings commit 83af806ab7cce7f9d9e184410a9c6921aa5de936 Author: Robert Pluim Date: Thu Feb 16 13:04:53 2023 +0100 Rename 'emacs-news-toggle-tag' to 'emacs-news-cycle-tag' * lisp/textmodes/emacs-news-mode.el (emacs-news-cycle-tag): Renamed from 'emacs-news-toggle-tag'. (emacs-news-mode-map, emacs-news-mode-menu): Use new name. * test/lisp/textmodes/emacs-news-mode-resources/cycle-tag.erts: Renamed from "toggle-tag.erts". * test/lisp/textmodes/emacs-news-mode-tests.el (emacs-news-cycle-tag): Rename test from 'emacs-news-toggle-tag', and call 'emacs-news-cycle-tag' with new resource file name. diff --git a/lisp/textmodes/emacs-news-mode.el b/lisp/textmodes/emacs-news-mode.el index c6efb4fe7ca..c5e7b8f4bc6 100644 --- a/lisp/textmodes/emacs-news-mode.el +++ b/lisp/textmodes/emacs-news-mode.el @@ -53,7 +53,7 @@ emacs-news-mode-map :parent emacs-news-common-map "C-c C-s" #'emacs-news-next-untagged-entry "C-c C-r" #'emacs-news-previous-untagged-entry - "C-c C-t" #'emacs-news-toggle-tag + "C-c C-t" #'emacs-news-cycle-tag "C-c C-d" #'emacs-news-delete-temporary-markers "C-c C-g" #'emacs-news-goto-section "C-c C-j" #'emacs-news-find-heading @@ -67,7 +67,7 @@ emacs-news-mode-menu ["Next Untagged" emacs-news-next-untagged-entry :help "Go to next untagged entry"] ["Previous Untagged" emacs-news-previous-untagged-entry :help "Go to previous untagged entry"] ["Count Untagged" emacs-news-count-untagged-entries :help "Count the number of untagged entries"] - ["Toggle Tag" emacs-news-toggle-tag :help "Toggle documentation tag of current entry"] + ["Cycle Tag" emacs-news-cycle-tag :help "Cycle documentation tag of current entry"] ["Delete Tags" emacs-news-delete-temporary-markers :help "Delete all documentation tags in buffer"] "--" ["Goto Section" emacs-news-goto-section :help "Prompt for section and go to it"] @@ -188,8 +188,8 @@ emacs-news-previous-untagged-entry (interactive nil emacs-news-mode) (emacs-news-next-untagged-entry t)) -(defun emacs-news-toggle-tag () - "Toggle documentation tag of current headline in the Emacs NEWS file." +(defun emacs-news-cycle-tag () + "Cycle documentation tag of current headline in the Emacs NEWS file." (interactive nil emacs-news-mode) (save-excursion (goto-char (line-beginning-position)) @@ -206,7 +206,7 @@ emacs-news-toggle-tag (insert "+++")) ((looking-at (rx bol "+++" eol)) (delete-char 4)) - (t (user-error "Invalid headline tag; can't toggle"))))) + (t (user-error "Invalid headline tag; can't cycle"))))) (defun emacs-news-count-untagged-entries () "Say how many untagged entries there are in the current NEWS buffer." diff --git a/test/lisp/textmodes/emacs-news-mode-resources/toggle-tag.erts b/test/lisp/textmodes/emacs-news-mode-resources/cycle-tag.erts similarity index 100% rename from test/lisp/textmodes/emacs-news-mode-resources/toggle-tag.erts rename to test/lisp/textmodes/emacs-news-mode-resources/cycle-tag.erts diff --git a/test/lisp/textmodes/emacs-news-mode-tests.el b/test/lisp/textmodes/emacs-news-mode-tests.el index e1152265a45..676a3270da6 100644 --- a/test/lisp/textmodes/emacs-news-mode-tests.el +++ b/test/lisp/textmodes/emacs-news-mode-tests.el @@ -23,10 +23,10 @@ (require 'ert-x) (require 'emacs-news-mode) -(ert-deftest emacs-news-toggle-tag () - (ert-test-erts-file (ert-resource-file "toggle-tag.erts") +(ert-deftest emacs-news-cycle-tag () + (ert-test-erts-file (ert-resource-file "cycle-tag.erts") (lambda () (emacs-news-mode) - (emacs-news-toggle-tag)))) + (emacs-news-cycle-tag)))) ;;; emacs-news-mode-tests.el ends here commit 5bc88b3b175e4442f3c4160131a96e438ad2d10c Author: Robert Pluim Date: Thu Feb 16 10:40:40 2023 +0100 Add menu to news-mode * lisp/textmodes/emacs-news-mode.el (emacs-news-mode-map): Add binding for 'emacs-news-delete-temporary-markers'. (emacs-news-mode-menu): Add menu for common actions. diff --git a/lisp/textmodes/emacs-news-mode.el b/lisp/textmodes/emacs-news-mode.el index b844955e1be..c6efb4fe7ca 100644 --- a/lisp/textmodes/emacs-news-mode.el +++ b/lisp/textmodes/emacs-news-mode.el @@ -54,12 +54,27 @@ emacs-news-mode-map "C-c C-s" #'emacs-news-next-untagged-entry "C-c C-r" #'emacs-news-previous-untagged-entry "C-c C-t" #'emacs-news-toggle-tag + "C-c C-d" #'emacs-news-delete-temporary-markers "C-c C-g" #'emacs-news-goto-section "C-c C-j" #'emacs-news-find-heading "C-c C-e" #'emacs-news-count-untagged-entries "C-x C-q" #'emacs-news-view-mode " " #'emacs-news-open-line) +(easy-menu-define emacs-news-mode-menu emacs-news-mode-map + "Menu for `emacs-news-mode'." + '("News" + ["Next Untagged" emacs-news-next-untagged-entry :help "Go to next untagged entry"] + ["Previous Untagged" emacs-news-previous-untagged-entry :help "Go to previous untagged entry"] + ["Count Untagged" emacs-news-count-untagged-entries :help "Count the number of untagged entries"] + ["Toggle Tag" emacs-news-toggle-tag :help "Toggle documentation tag of current entry"] + ["Delete Tags" emacs-news-delete-temporary-markers :help "Delete all documentation tags in buffer"] + "--" + ["Goto Section" emacs-news-goto-section :help "Prompt for section and go to it"] + ["Goto Heading" emacs-news-find-heading :help "Prompt for heading and go to it"] + "--" + ["Enter View Mode" emacs-news-view-mode :help "Enter view-only mode"])) + (defvar emacs-news-view-mode-map ;; This is defined this way instead of inheriting because we're ;; deriving the mode from `special-mode' and want the keys from there. commit 40f4bc4e0aa1d215136259f6ea497147e4311aed Author: Philip Kaludercic Date: Thu Feb 16 11:38:51 2023 +0100 ; Avoid installing VC package dependencies multiple times * lisp/emacs-lisp/package-vc.el (package-vc-install-dependencies): Check if two package names are eq, instead checking the structural equality of package-desc objects. diff --git a/lisp/emacs-lisp/package-vc.el b/lisp/emacs-lisp/package-vc.el index 05df89d264e..b753adcb8a0 100644 --- a/lisp/emacs-lisp/package-vc.el +++ b/lisp/emacs-lisp/package-vc.el @@ -440,7 +440,7 @@ package-vc-install-dependencies (package-desc-version a))) (duplicate-p (a b) "Are A and B the same package?" - (equal a (car b))) + (eq (package-desc-name a) (package-desc-name b))) (depends-on-p (target package) "Does PACKAGE depend on TARGET?" (or (eq target package) @@ -457,7 +457,7 @@ package-vc-install-dependencies (depends-on-p desc-a desc-b))))) (mapc #'search requirements) (cl-callf sort to-install #'version-order) - (cl-callf seq-uniq to-install) + (cl-callf seq-uniq to-install #'duplicate-p) (cl-callf sort to-install #'dependent-order)) (mapc #'package-install-from-archive to-install) missing)) commit 1c9d81a2b4272200082fc185880856866c0588e1 Author: Philip Kaludercic Date: Thu Feb 16 11:11:23 2023 +0100 Attempt to recognise if a VC package has no Elisp files * lisp/emacs-lisp/package-vc.el (package-vc-non-code-file-names): Add new variable used to avoid false-positives. (package-vc--unpack): Recursively search for .el files excluding the ones listed in 'package-vc-non-code-file-names', offering to abort the installation if none are found. diff --git a/lisp/emacs-lisp/package-vc.el b/lisp/emacs-lisp/package-vc.el index bad59aa6c0f..05df89d264e 100644 --- a/lisp/emacs-lisp/package-vc.el +++ b/lisp/emacs-lisp/package-vc.el @@ -602,6 +602,13 @@ package-vc--clone (vc-retrieve-tag dir release-rev) (message "No release revision was found, continuing..."))))) +(defvar package-vc-non-code-file-names + '(".dir-locals.el" ".dir-locals-2.el") + "List of file names that do not contain Emacs Lisp code. +This list is used by `package-vc--unpack' to better check if the +user is fetching code from a repository that does not contain any +Emacs Lisp files.") + (defun package-vc--unpack (pkg-desc pkg-spec &optional rev) "Install the package described by PKG-DESC. PKG-SPEC is a package specification, a property list describing @@ -623,6 +630,14 @@ package-vc--unpack (when (directory-empty-p pkg-dir) (delete-directory pkg-dir) (error "Empty checkout for %s" name)) + (unless (seq-remove + (lambda (file) + (member (file-name-nondirectory file) package-vc-non-code-file-names)) + (directory-files-recursively pkg-dir "\\.el\\'" nil)) + (when (yes-or-no-p (format "No Emacs Lisp files found when fetching \"%s\", \ +abort installation?" name)) + (delete-directory pkg-dir t) + (user-error "Installation aborted"))) ;; When nothing is specified about a `lisp-dir', then should ;; heuristically check if there is a sub-directory with lisp commit 07a76a06f9a438e2a1bf1e565e3e78f7927c37f2 Author: Mattias EngdegÄrd Date: Thu Feb 16 10:03:30 2023 +0100 Fix test errors when run with fancy charset (bug#61534) * test/lisp/emacs-lisp/bytecomp-tests.el (bytecomp-tests--unescaped-char-literals, test-suppression): Bind `text-quoting-style` to `grave` around tests to force generation of ASCII quotes. * test/src/lread-tests.el (lread-tests--unescaped-char-literals): Subject the reference string to the same text styling as that under scrutiny. diff --git a/test/lisp/emacs-lisp/bytecomp-tests.el b/test/lisp/emacs-lisp/bytecomp-tests.el index 2fdf7389fc1..4b0a714e52d 100644 --- a/test/lisp/emacs-lisp/bytecomp-tests.el +++ b/test/lisp/emacs-lisp/bytecomp-tests.el @@ -1213,7 +1213,8 @@ bytecomp-tests--unescaped-char-literals literals (Bug#20852)." (should (boundp 'lread--unescaped-character-literals)) (let ((byte-compile-error-on-warn t) - (byte-compile-debug t)) + (byte-compile-debug t) + (text-quoting-style 'grave)) (bytecomp-tests--with-temp-file source (write-region "(list ?) ?( ?; ?\" ?[ ?])" nil source) (bytecomp-tests--with-temp-file destination @@ -1332,6 +1333,7 @@ bytecomp-test--switch-duplicates (defun test-suppression (form suppress match) (let ((lexical-binding t) + (text-quoting-style 'grave) (byte-compile-log-buffer (generate-new-buffer " *Compile-Log*"))) ;; Check that we get a warning without suppression. (with-current-buffer byte-compile-log-buffer diff --git a/test/src/lread-tests.el b/test/src/lread-tests.el index 459a06a39b6..c0ea37d2c55 100644 --- a/test/src/lread-tests.el +++ b/test/src/lread-tests.el @@ -137,11 +137,13 @@ lread-tests--unescaped-char-literals (write-region "?) ?( ?; ?\" ?[ ?]" nil file-name) (should (equal (load file-name nil :nomessage :nosuffix) t)) (should (equal (lread-tests--last-message) - (concat (format-message "Loading `%s': " file-name) - "unescaped character literals " - "`?\"', `?(', `?)', `?;', `?[', `?]' detected, " - "`?\\\"', `?\\(', `?\\)', `?\\;', `?\\[', `?\\]' " - "expected!"))))) + (format-message + (concat "Loading `%s': " + "unescaped character literals " + "`?\"', `?(', `?)', `?;', `?[', `?]' detected, " + "`?\\\"', `?\\(', `?\\)', `?\\;', `?\\[', `?\\]' " + "expected!") + file-name))))) (ert-deftest lread-test-bug26837 () "Test for https://debbugs.gnu.org/26837 ."