commit 12427976c8a8157fc2fe8ffa3a7fe157a8fe2e45 (HEAD, refs/remotes/origin/master) Author: Michael Albinus Date: Fri Aug 4 06:19:57 2023 +0200 * lisp/net/tramp.el (tramp-skeleton-write-region): Fix scoping. (Bug#65022) diff --git a/lisp/net/tramp.el b/lisp/net/tramp.el index 31b91b4e910..2fc54c5388b 100644 --- a/lisp/net/tramp.el +++ b/lisp/net/tramp.el @@ -3527,29 +3527,29 @@ tramp-skeleton-write-region ;; Set the ownership. (when need-chown - (tramp-set-file-uid-gid filename uid gid))) - - ;; Set extended attributes. We ignore possible errors, - ;; because ACL strings could be incompatible. - (when attributes - (ignore-errors - (set-file-extended-attributes filename attributes))) - - ;; Unlock file. - (when file-locked - ;; `unlock-file' exists since Emacs 28.1. - (tramp-compat-funcall 'unlock-file lockname)) - - ;; Sanity check. - (unless (equal curbuf (current-buffer)) - (tramp-error - v 'file-error - "Buffer has changed from `%s' to `%s'" curbuf (current-buffer))) - - (when (and (null noninteractive) - (or (eq ,visit t) (string-or-null-p ,visit))) - (tramp-message v 0 "Wrote %s" filename)) - (run-hooks 'tramp-handle-write-region-hook)))))) + (tramp-set-file-uid-gid filename uid gid)) + + ;; Set extended attributes. We ignore possible errors, + ;; because ACL strings could be incompatible. + (when attributes + (ignore-errors + (set-file-extended-attributes filename attributes))) + + ;; Unlock file. + (when file-locked + ;; `unlock-file' exists since Emacs 28.1. + (tramp-compat-funcall 'unlock-file lockname)) + + ;; Sanity check. + (unless (equal curbuf (current-buffer)) + (tramp-error + v 'file-error + "Buffer has changed from `%s' to `%s'" curbuf (current-buffer))) + + (when (and (null noninteractive) + (or (eq ,visit t) (string-or-null-p ,visit))) + (tramp-message v 0 "Wrote %s" filename)) + (run-hooks 'tramp-handle-write-region-hook))))))) ;;; Common file name handler functions for different backends: commit e9672b147f2e1f4879752f882fb58c7dc7ce3e9b Author: Stefan Monnier Date: Thu Aug 3 23:43:12 2023 -0400 * lisp/progmodes/cc-mode.el (c-advise-fl-for-region): Fix compiler warning Make sure we macro-expand `defadvice` only when we want to use it. diff --git a/lisp/progmodes/cc-mode.el b/lisp/progmodes/cc-mode.el index dd699b9a119..a96863cd15e 100644 --- a/lisp/progmodes/cc-mode.el +++ b/lisp/progmodes/cc-mode.el @@ -2723,18 +2723,18 @@ c-extend-after-change-region ;; Emacs < 22 and XEmacs (defmacro c-advise-fl-for-region (function) (declare (debug t)) - `(defadvice ,function (before get-awk-region activate) - ;; Make sure that any string/regexp is completely font-locked. - (when c-buffer-is-cc-mode - (save-excursion - (ad-set-arg 1 c-new-END) ; end - (ad-set-arg 0 c-new-BEG))))) ; beg - -(unless (boundp 'font-lock-extend-after-change-region-function) - (c-advise-fl-for-region font-lock-after-change-function) - (c-advise-fl-for-region jit-lock-after-change) - (c-advise-fl-for-region lazy-lock-defer-rest-after-change) - (c-advise-fl-for-region lazy-lock-defer-line-after-change)) + (unless (boundp 'font-lock-extend-after-change-region-function) + `(defadvice ,function (before get-awk-region activate) + ;; Make sure that any string/regexp is completely font-locked. + (when c-buffer-is-cc-mode + (save-excursion + (ad-set-arg 1 c-new-END) ; end + (ad-set-arg 0 c-new-BEG)))))) ; beg + +(c-advise-fl-for-region font-lock-after-change-function) +(c-advise-fl-for-region jit-lock-after-change) +(c-advise-fl-for-region lazy-lock-defer-rest-after-change) +(c-advise-fl-for-region lazy-lock-defer-line-after-change) ;; Connect up to `electric-indent-mode' (Emacs 24.4 and later). (defun c-electric-indent-mode-hook () commit 27ed565ec6163c499191b62a4cee10d99019aa38 Author: Stefan Monnier Date: Thu Aug 3 23:41:11 2023 -0400 * lisp/emacs-lisp/advice.el (defadvice): Mark as obsolete diff --git a/etc/NEWS b/etc/NEWS index 7b521f3e6fe..567f19012eb 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -685,6 +685,10 @@ provokes an error if used numerically. * Lisp Changes in Emacs 30.1 +** 'defadvice' is marked as obsolete. +See (info "(elisp)Porting Old Advice") for help converting them +to use `advice-add` or `define-advice instead. + +++ ** New user option 'safe-local-variable-directories'. This user option names directories in which Emacs will treat all diff --git a/lisp/emacs-lisp/advice.el b/lisp/emacs-lisp/advice.el index 56f0ae2212c..3265809f592 100644 --- a/lisp/emacs-lisp/advice.el +++ b/lisp/emacs-lisp/advice.el @@ -3131,6 +3131,7 @@ defadvice [DOCSTRING] [INTERACTIVE-FORM] BODY...)" (declare (doc-string 3) (indent 2) + (obsolete "use advice-add or define-advice" "30.1") (debug (&define name ;; thing being advised. (name ;; class is [&or "before" "around" "after" ;; "activation" "deactivation"] commit 0c2152222ad16ba9e68cdb27fc281755ec187620 Author: Stefan Kangas Date: Thu Aug 3 19:12:49 2023 +0200 Register more Ruby files in auto-mode-alist * lisp/progmodes/ruby-mode.el (auto-mode-alist): Add fastlane and Caxlsx files. diff --git a/lisp/progmodes/ruby-mode.el b/lisp/progmodes/ruby-mode.el index 9d8f45604f9..9d80bbd72dd 100644 --- a/lisp/progmodes/ruby-mode.el +++ b/lisp/progmodes/ruby-mode.el @@ -2697,12 +2697,12 @@ ruby-mode ;;;###autoload (add-to-list 'auto-mode-alist (cons (purecopy (concat "\\(?:\\.\\(?:" - "rbw?\\|ru\\|rake\\|thor" + "rbw?\\|ru\\|rake\\|thor\\|axlsx" "\\|jbuilder\\|rabl\\|gemspec\\|podspec" "\\)" "\\|/" "\\(?:Gem\\|Rake\\|Cap\\|Thor" - "\\|Puppet\\|Berks\\|Brew" + "\\|Puppet\\|Berks\\|Brew\\|Fast" "\\|Vagrant\\|Guard\\|Pod\\)file" "\\)\\'")) 'ruby-mode)) commit f23cfe3933abcdec44d46c86e4ac3219fa1b5631 Author: Eli Zaretskii Date: Thu Aug 3 17:04:41 2023 +0300 ; * test/lisp/uniquify-tests.el (uniquify-home): Delete (bug#62621). diff --git a/test/lisp/uniquify-tests.el b/test/lisp/uniquify-tests.el index 224991cb048..38510c3bd77 100644 --- a/test/lisp/uniquify-tests.el +++ b/test/lisp/uniquify-tests.el @@ -89,21 +89,6 @@ uniquify-dirs '("a/dir/" "b/dir/"))) (mapc #'kill-buffer bufs)))))) -(ert-deftest uniquify-home () - "uniquify works, albeit confusingly, in the presence of directories named \"~\"" - (let (bufs) - (save-excursion - (push (find-file-noselect "~") bufs) - (push (find-file-noselect "./~") bufs) - (should (equal (mapcar #'buffer-name bufs) - '("~" "~<>"))) - (push (find-file-noselect "~/foo") bufs) - (push (find-file-noselect "./~/foo") bufs) - (should (equal (mapcar #'buffer-name bufs) - '("foo<~>" "foo" "~" "~<>"))) - (while bufs - (kill-buffer (pop bufs)))))) - (ert-deftest uniquify-rename-to-dir () "Giving a buffer a name which matches a directory doesn't rename the buffer" (let ((uniquify-buffer-name-style 'forward) commit 588a0363d9a3ce6d678618ad545f7a8f9af27880 Author: Michael Albinus Date: Thu Aug 3 13:17:02 2023 +0200 Improve SELinux handling in Tramp * lisp/net/tramp-sh.el (tramp-stat-file-attributes-with-selinux) (tramp-stat-directory-files-and-attributes-with-selinux): New defconst. (tramp-do-file-attributes-with-ls) (tramp-do-file-attributes-with-stat) (tramp-do-directory-files-and-attributes-with-stat): Return also SELinux context. (tramp-remote-selinux-p, tramp-do-copy-or-rename-file): Adapt docstring. * lisp/net/tramp-sudoedit.el (tramp-sudoedit-do-copy-or-rename-file) (tramp-sudoedit-remote-selinux-p): Adapt docstring. (tramp-sudoedit-file-attributes-with-selinux): New defconst. (tramp-sudoedit-handle-file-attributes): Use it. * lisp/net/tramp.el (tramp-convert-file-attributes): Extract SELinux context. diff --git a/lisp/net/tramp-sh.el b/lisp/net/tramp-sh.el index b33e788b893..2b1d26dd232 100644 --- a/lisp/net/tramp-sh.el +++ b/lisp/net/tramp-sh.el @@ -717,6 +717,25 @@ tramp-stat-file-attributes Format specifiers are replaced by `tramp-expand-script', percent characters need to be doubled.") +(defconst tramp-stat-file-attributes-with-selinux + (format + (concat + "(%%s -c" + " '((%s%%%%N%s) %%%%h (%s%%%%U%s . %%%%u) (%s%%%%G%s . %%%%g)" + " %%%%X %%%%Y %%%%Z %%%%s %s%%%%A%s t %%%%i -1 %s%%%%C%s)'" + " \"$1\" %%n || echo nil) |" + " sed -e 's/\"/\\\\\"/g' -e 's/%s/\"/g'") + tramp-stat-marker tramp-stat-marker ; %%N + tramp-stat-marker tramp-stat-marker ; %%U + tramp-stat-marker tramp-stat-marker ; %%G + tramp-stat-marker tramp-stat-marker ; %%A + tramp-stat-marker tramp-stat-marker ; %%C + tramp-stat-quoted-marker) + "Shell function to produce output suitable for use with `file-attributes' +on the remote file system, including SELinux context. +Format specifiers are replaced by `tramp-expand-script', percent +characters need to be doubled.") + (defconst tramp-perl-directory-files-and-attributes "%p -e ' chdir($ARGV[0]) or printf(\"\\\"Cannot change to $ARGV[0]: $''!''\\\"\\n\"), exit(); @@ -795,6 +814,33 @@ tramp-stat-directory-files-and-attributes Format specifiers are replaced by `tramp-expand-script', percent characters need to be doubled.") +(defconst tramp-stat-directory-files-and-attributes-with-selinux + (format + (concat + ;; We must care about file names with spaces, or starting with + ;; "-"; this would confuse xargs. "ls -aQ" might be a solution, + ;; but it does not work on all remote systems. Therefore, we use + ;; \000 as file separator. `tramp-sh--quoting-style-options' do + ;; not work for file names with spaces piped to "xargs". + ;; Apostrophes in the stat output are masked as + ;; `tramp-stat-marker', in order to make a proper shell escape of + ;; them in file names. + "cd \"$1\" && echo \"(\"; (%%l -a | tr '\\n\\r' '\\000\\000' |" + " xargs -0 %%s -c" + " '(%s%%%%n%s (%s%%%%N%s) %%%%h (%s%%%%U%s . %%%%u) (%s%%%%G%s . %%%%g) %%%%X %%%%Y %%%%Z %%%%s %s%%%%A%s t %%%%i -1 %s%%%%C%s)'" + " -- %%n | sed -e 's/\"/\\\\\"/g' -e 's/%s/\"/g'); echo \")\"") + tramp-stat-marker tramp-stat-marker ; %n + tramp-stat-marker tramp-stat-marker ; %N + tramp-stat-marker tramp-stat-marker ; %U + tramp-stat-marker tramp-stat-marker ; %G + tramp-stat-marker tramp-stat-marker ; %A + tramp-stat-marker tramp-stat-marker ; %C + tramp-stat-quoted-marker) + "Shell function implementing `directory-files-and-attributes' as Lisp +`read'able output, including SELinux context. +Format specifiers are replaced by `tramp-expand-script', percent +characters need to be doubled.") + (defconst tramp-perl-id "%p -e ' use strict; @@ -1255,10 +1301,10 @@ tramp-do-file-attributes-with-ls (let (symlinkp dirp res-inode res-filemodes res-numlinks res-uid-string res-gid-string res-uid-integer res-gid-integer - res-size res-symlink-target) + res-size res-symlink-target res-context) (tramp-message vec 5 "file attributes with ls: %s" localname) - ;; We cannot send all three commands combined, it could exceed - ;; NAME_MAX or PATH_MAX. Happened on macOS, for example. + ;; We cannot send both commands combined, it could exceed NAME_MAX + ;; or PATH_MAX. Happened on macOS, for example. (when (tramp-send-command-and-check vec (format "cd %s && (%s %s || %s -h %s)" @@ -1277,13 +1323,14 @@ tramp-do-file-attributes-with-ls (file-name-nondirectory localname))))) (tramp-send-command vec - (format "%s -ild %s %s; %s -lnd %s %s" + (format "%s -ild %s %s; %s -lnd%s %s %s" (tramp-get-ls-command vec) ;; On systems which have no quoting style, file names ;; with special characters could fail. (tramp-sh--quoting-style-options vec) (tramp-shell-quote-argument localname) (tramp-get-ls-command vec) + (if (tramp-remote-selinux-p vec) "Z" "") ;; On systems which have no quoting style, file names ;; with special characters could fail. (tramp-sh--quoting-style-options vec) @@ -1333,6 +1380,10 @@ tramp-do-file-attributes-with-ls (setq res-uid-integer tramp-unknown-id-integer)) (unless (numberp res-gid-integer) (setq res-gid-integer tramp-unknown-id-integer)) + ;; ... SELinux context + (when (tramp-remote-selinux-p vec) + (setq res-context (read (current-buffer)) + res-context (symbol-name res-context))) ;; Return data gathered. (list @@ -1359,7 +1410,10 @@ tramp-do-file-attributes-with-ls ;; 10. Inode number. res-inode ;; 11. Device number. Will be replaced by a virtual device number. - -1)))))) + -1 + ;; 12. SELinux context. Will be extracted in + ;; `tramp-convert-file-attributes'. + res-context)))))) (defun tramp-do-file-attributes-with-perl (vec localname) "Implement `file-attributes' for Tramp files using a Perl script." @@ -1373,11 +1427,20 @@ tramp-do-file-attributes-with-perl (defun tramp-do-file-attributes-with-stat (vec localname) "Implement `file-attributes' for Tramp files using stat(1) command." (tramp-message vec 5 "file attributes with stat: %s" localname) - (tramp-maybe-send-script - vec tramp-stat-file-attributes "tramp_stat_file_attributes") - (tramp-send-command-and-read - vec (format "tramp_stat_file_attributes %s" - (tramp-shell-quote-argument localname)))) + (cond + ((tramp-remote-selinux-p vec) + (tramp-maybe-send-script + vec tramp-stat-file-attributes-with-selinux + "tramp_stat_file_attributes_with_selinux") + (tramp-send-command-and-read + vec (format "tramp_stat_file_attributes_with_selinux %s" + (tramp-shell-quote-argument localname)))) + (t + (tramp-maybe-send-script + vec tramp-stat-file-attributes "tramp_stat_file_attributes") + (tramp-send-command-and-read + vec (format "tramp_stat_file_attributes %s" + (tramp-shell-quote-argument localname)))))) (defun tramp-sh-handle-set-visited-file-modtime (&optional time-list) "Like `set-visited-file-modtime' for Tramp files." @@ -1572,7 +1635,7 @@ tramp-sh-handle-set-file-uid-gid (tramp-shell-quote-argument localname)))))))) (defun tramp-remote-selinux-p (vec) - "Check, whether SELINUX is enabled on the remote host." + "Check, whether SELinux is enabled on the remote host." (with-tramp-connection-property (tramp-get-process vec) "selinux-p" (tramp-send-command-and-check vec "selinuxenabled"))) @@ -1775,12 +1838,21 @@ tramp-do-directory-files-and-attributes-with-perl (defun tramp-do-directory-files-and-attributes-with-stat (vec localname) "Implement `directory-files-and-attributes' for Tramp files with stat(1) command." (tramp-message vec 5 "directory-files-and-attributes with stat: %s" localname) - (tramp-maybe-send-script - vec tramp-stat-directory-files-and-attributes - "tramp_stat_directory_files_and_attributes") - (tramp-send-command-and-read - vec (format "tramp_stat_directory_files_and_attributes %s" - (tramp-shell-quote-argument localname)))) + (cond + ((tramp-remote-selinux-p vec) + (tramp-maybe-send-script + vec tramp-stat-directory-files-and-attributes-with-selinux + "tramp_stat_directory_files_and_attributes_with_selinux") + (tramp-send-command-and-read + vec (format "tramp_stat_directory_files_and_attributes_with_selinux %s" + (tramp-shell-quote-argument localname)))) + (t + (tramp-maybe-send-script + vec tramp-stat-directory-files-and-attributes + "tramp_stat_directory_files_and_attributes") + (tramp-send-command-and-read + vec (format "tramp_stat_directory_files_and_attributes %s" + (tramp-shell-quote-argument localname)))))) ;; This function should return "foo/" for directories and "bar" for ;; files. @@ -1966,7 +2038,7 @@ tramp-do-copy-or-rename-file KEEP-DATE means to make sure that NEWNAME has the same timestamp as FILENAME. PRESERVE-UID-GID, when non-nil, instructs to keep the uid and gid if both files are on the same host. -PRESERVE-EXTENDED-ATTRIBUTES activates selinux and acl commands. +PRESERVE-EXTENDED-ATTRIBUTES activates SELinux and ACL commands. This function is invoked by `tramp-sh-handle-copy-file' and `tramp-sh-handle-rename-file'. It is an error if OP is neither diff --git a/lisp/net/tramp-sudoedit.el b/lisp/net/tramp-sudoedit.el index 2ce2647b5ac..3d6e1d92d0b 100644 --- a/lisp/net/tramp-sudoedit.el +++ b/lisp/net/tramp-sudoedit.el @@ -234,7 +234,7 @@ tramp-sudoedit-do-copy-or-rename-file KEEP-DATE means to make sure that NEWNAME has the same timestamp as FILENAME. PRESERVE-UID-GID, when non-nil, instructs to keep the uid and gid if both files are on the same host. -PRESERVE-EXTENDED-ATTRIBUTES activates selinux and acl commands. +PRESERVE-EXTENDED-ATTRIBUTES activates SELinux and ACL commands. This function is invoked by `tramp-sudoedit-handle-copy-file' and `tramp-sudoedit-handle-rename-file'. It is an error if OP is @@ -434,14 +434,37 @@ tramp-sudoedit-file-attributes "stat format string to produce output suitable for use with `file-attributes' on the remote file system.") +(defconst tramp-sudoedit-file-attributes-with-selinux + (format + ;; Apostrophes in the stat output are masked as + ;; `tramp-stat-marker', in order to make a proper shell escape of + ;; them in file names. They are replaced in + ;; `tramp-sudoedit-send-command-and-read'. + (concat "((%s%%N%s) %%h (%s%%U%s . %%u) (%s%%G%s . %%g)" + " %%X %%Y %%Z %%s %s%%A%s t %%i -1 %s%%C%s)") + tramp-stat-marker tramp-stat-marker ; %%N + tramp-stat-marker tramp-stat-marker ; %%U + tramp-stat-marker tramp-stat-marker ; %%G + tramp-stat-marker tramp-stat-marker ; %%A + tramp-stat-marker tramp-stat-marker) ; %%C + "stat format string to produce output suitable for use with +`file-attributes' on the remote file system, including SELinux context.") + (defun tramp-sudoedit-handle-file-attributes (filename &optional id-format) "Like `file-attributes' for Tramp files." ;; The result is cached in `tramp-convert-file-attributes'. (with-parsed-tramp-file-name (expand-file-name filename) nil (tramp-convert-file-attributes v localname id-format - (tramp-sudoedit-send-command-and-read - v "env" "QUOTING_STYLE=locale" "stat" "-c" - tramp-sudoedit-file-attributes (file-name-unquote localname))))) + (cond + ((tramp-sudoedit-remote-selinux-p v) + (tramp-sudoedit-send-command-and-read + v "env" "QUOTING_STYLE=locale" "stat" "-c" + tramp-sudoedit-file-attributes-with-selinux + (file-name-unquote localname))) + (t + (tramp-sudoedit-send-command-and-read + v "env" "QUOTING_STYLE=locale" "stat" "-c" + tramp-sudoedit-file-attributes (file-name-unquote localname))))))) (defun tramp-sudoedit-handle-file-executable-p (filename) "Like `file-executable-p' for Tramp files." @@ -507,7 +530,7 @@ tramp-sudoedit-handle-set-file-modes v 'file-error "Error while changing file's mode %s" filename))))) (defun tramp-sudoedit-remote-selinux-p (vec) - "Check, whether SELINUX is enabled on the remote host." + "Check, whether SELinux is enabled on the remote host." (with-tramp-connection-property (tramp-get-process vec) "selinux-p" (zerop (tramp-call-process vec "selinuxenabled")))) diff --git a/lisp/net/tramp.el b/lisp/net/tramp.el index 0267b69340d..31b91b4e910 100644 --- a/lisp/net/tramp.el +++ b/lisp/net/tramp.el @@ -6055,6 +6055,13 @@ tramp-convert-file-attributes ;; Set virtual device number. (setcar (nthcdr 11 attr) (tramp-get-device ,vec)) + ;; Set SELinux context. + (when (stringp (nth 12 attr)) + (tramp-set-file-property + ,vec ,localname "file-selinux-context" + (split-string (nth 12 attr) ":" 'omit))) + ;; Remove optional entries. + (setcdr (nthcdr 11 attr) nil) attr))))) ;; Return normalized result. commit 859b150f3171d4946a383e07a9333c4df8efdd98 Author: Felicián Németh Date: Sat Jul 15 12:02:49 2023 +0200 Eglot: send version in clientInfo (bug#62198) * lisp/progmodes/eglot.el (eglot--version): New defconst. (eglot--connect): Use it. diff --git a/lisp/progmodes/eglot.el b/lisp/progmodes/eglot.el index ae31985a676..37875e3d7f1 100644 --- a/lisp/progmodes/eglot.el +++ b/lisp/progmodes/eglot.el @@ -421,6 +421,14 @@ eglot-withhold-process-id ;;; Constants ;;; +(defconst eglot--version + (eval-when-compile + (when byte-compile-current-file + (require 'lisp-mnt) + (lm-version byte-compile-current-file))) + "The version as a string of this version of Eglot. +It is nil if Eglot is not byte-complied.") + (defconst eglot--symbol-kind-names `((1 . "File") (2 . "Module") (3 . "Namespace") (4 . "Package") (5 . "Class") @@ -1352,7 +1360,9 @@ eglot--connect (eq (jsonrpc-process-type server) 'network)) (emacs-pid)) - :clientInfo '(:name "Eglot") + :clientInfo + `(:name "Eglot" ,@(when eglot--version + `(:version ,eglot--version))) ;; Maybe turn trampy `/ssh:foo@bar:/path/to/baz.py' ;; into `/path/to/baz.py', so LSP groks it. :rootPath (file-local-name commit 508eaa3290963dd0ef07f99263d1171be3a6f85a Author: Stefan Kangas Date: Thu Aug 3 11:56:42 2023 +0200 Add test for align-regexp * test/lisp/align-tests.el (align-regexp): New test. * test/lisp/align-resources/align-regexp.erts: New file. * test/lisp/align-resources/c-mode.erts: Add new test case. diff --git a/test/lisp/align-resources/align-regexp.erts b/test/lisp/align-resources/align-regexp.erts new file mode 100644 index 00000000000..fbbd6d6bd33 --- /dev/null +++ b/test/lisp/align-resources/align-regexp.erts @@ -0,0 +1,13 @@ +Name: align function declaration + +=-= +Fred (123) 456-7890 +Alice (123) 456-7890 +Mary-Anne (123) 456-7890 +Joe (123) 456-7890 +=-= +Fred (123) 456-7890 +Alice (123) 456-7890 +Mary-Anne (123) 456-7890 +Joe (123) 456-7890 +=-=-= diff --git a/test/lisp/align-resources/c-mode.erts b/test/lisp/align-resources/c-mode.erts index 0a0fa046b34..ecdff507103 100644 --- a/test/lisp/align-resources/c-mode.erts +++ b/test/lisp/align-resources/c-mode.erts @@ -9,3 +9,15 @@ int main (int argc, char *argv[]); =-=-= + +Name: example from Commentary + +=-= + int a = 1; + short foo = 2; + double blah = 4; +=-= + int a = 1; + short foo = 2; + double blah = 4; +=-=-= diff --git a/test/lisp/align-tests.el b/test/lisp/align-tests.el index dac23ef96d9..a4d9303827f 100644 --- a/test/lisp/align-tests.el +++ b/test/lisp/align-tests.el @@ -25,6 +25,8 @@ (require 'ert-x) (require 'align) +;;;; align + (defun test-align-transform-fun (function) (lambda () (funcall function) @@ -56,6 +58,15 @@ align-toml (ert-test-erts-file (ert-resource-file "conf-toml-mode.erts") (test-align-transform-fun #'conf-toml-mode)))) +;;;; align-regexp + +(ert-deftest align-regexp () + (let ((indent-tabs-mode nil)) + (ert-test-erts-file (ert-resource-file "align-regexp.erts") + (lambda () + (align-regexp (point-min) (point-max) + "\\(\\s-*\\)("))))) + (provide 'align-tests) ;;; align-tests.el ends here commit 7b30e11b2ac5cd360db7ee8b6aed07bd918b93a2 Author: Manuel Giraud Date: Sat Jul 29 10:59:32 2023 +0200 Revert thumbnail naming for 'per-directory' storage method * lisp/image/image-dired-util.el (image-dired-thumb-name): Revert to "filename.thumb.jpg" for 'per-directory' storage. (Bug#61394) * lisp/image/image-dired.el (image-dired-thumbnail-storage): Fix documentation. diff --git a/lisp/image/image-dired-util.el b/lisp/image/image-dired-util.el index 3f6880fc807..70911bce45a 100644 --- a/lisp/image/image-dired-util.el +++ b/lisp/image/image-dired-util.el @@ -77,8 +77,9 @@ image-dired-thumb-name added to the file name. - Otherwise `image-dired-thumbnail-storage' is used to set the - directory where to store the thumbnail. In this latter case - the name given to the thumbnail depends on the value of + directory where to store the thumbnail. In this latter case, + if `image-dired-thumbnail-storage' is set to `image-dired' the + file name given to the thumbnail depends on the value of `image-dired-thumb-naming'. See also `image-dired-thumbnail-storage' and @@ -99,15 +100,14 @@ image-dired-thumb-name (let ((name (if (eq 'sha1-contents image-dired-thumb-naming) (image-dired-contents-sha1 file) ;; Defaults to SHA-1 of file name - (if (eq 'per-directory image-dired-thumbnail-storage) - (sha1 (file-name-nondirectory file)) - (sha1 file))))) + (sha1 file)))) (cond ((or (eq 'image-dired image-dired-thumbnail-storage) ;; Maintained for backwards compatibility: (eq 'use-image-dired-dir image-dired-thumbnail-storage)) (expand-file-name (format "%s.jpg" name) (image-dired-dir))) ((eq 'per-directory image-dired-thumbnail-storage) - (expand-file-name (format "%s.jpg" name) + (expand-file-name (format "%s.thumb.jpg" + (file-name-nondirectory file)) (expand-file-name ".image-dired" (file-name-directory file))))))))) diff --git a/lisp/image/image-dired.el b/lisp/image/image-dired.el index 96a0c2ef9bc..98596510ec1 100644 --- a/lisp/image/image-dired.el +++ b/lisp/image/image-dired.el @@ -174,8 +174,8 @@ image-dired-thumb-naming In both case, a \"jpg\" extension is appended to save as JPEG. The value of this option is ignored if Image-Dired is customized -to use the Thumbnail Managing Standard. See -`image-dired-thumbnail-storage'." +to use the Thumbnail Managing Standard or the per-directory +thumbnails setting. See `image-dired-thumbnail-storage'." :type '(choice :tag "How to name thumbnail files" (const :tag "SHA-1 of the image file name" sha1-filename) (const :tag "SHA-1 of the image contents" sha1-contents)) @@ -208,8 +208,8 @@ image-dired-thumbnail-storage Set this user option to `per-directory'. -To control the naming of thumbnails for alternatives (2) and (3) -above, customize the value of `image-dired-thumb-naming'. +To control the naming of thumbnails for alternative (2) above, +customize the value of `image-dired-thumb-naming'. To control the default size of thumbnails for alternatives (2) and (3) above, customize the value of `image-dired-thumb-size'. commit 9cd02380333aa260e0cb23c1bb06470d223bdbd5 Author: Eli Zaretskii Date: Thu Aug 3 11:40:44 2023 +0300 Revert "Fix image-dired-utils-tests after 83b6a8a5147 (bug#61394)" This reverts commit 5efc7b22cecc0cf1e7dd2bbbc26400dba35e33ea. It is no longer needed, see bug#61394. diff --git a/test/lisp/image/image-dired-util-tests.el b/test/lisp/image/image-dired-util-tests.el index 273a32d5dbb..1f3747a82b1 100644 --- a/test/lisp/image/image-dired-util-tests.el +++ b/test/lisp/image/image-dired-util-tests.el @@ -57,23 +57,20 @@ image-dired-thumb-name/image-dired "jpg"))))) (ert-deftest image-dired-thumb-name/per-directory () - (let ((image-dired-thumbnail-storage 'per-directory) - (rel-path "foo.jpg") - (abs-path "/tmp/foo.jpg") - (hash-name (concat (sha1 "foo.jpg") ".jpg"))) - (should (file-name-absolute-p (image-dired-thumb-name rel-path))) - (should (file-name-absolute-p (image-dired-thumb-name abs-path))) + (let ((image-dired-thumbnail-storage 'per-directory)) + (should (file-name-absolute-p (image-dired-thumb-name "foo.jpg"))) + (should (file-name-absolute-p (image-dired-thumb-name "/tmp/foo.jpg"))) (should (equal - (file-name-nondirectory (image-dired-thumb-name rel-path)) - (file-name-nondirectory (image-dired-thumb-name abs-path)))) + (file-name-nondirectory (image-dired-thumb-name "foo.jpg")) + (file-name-nondirectory (image-dired-thumb-name "/tmp/foo.jpg")))) ;; The cdr below avoids the system dependency in the car of the ;; list returned by 'file-name-split': it's "" on Posix systems, ;; but the drive letter on MS-Windows. (should (equal (cdr (file-name-split - (image-dired-thumb-name abs-path))) - (list "tmp" ".image-dired" hash-name))) + (image-dired-thumb-name "/tmp/foo.jpg"))) + '("tmp" ".image-dired" "foo.jpg.thumb.jpg"))) (should (equal (file-name-nondirectory - (image-dired-thumb-name rel-path)) - hash-name)))) + (image-dired-thumb-name "foo.jpg")) + "foo.jpg.thumb.jpg")))) ;;; image-dired-util-tests.el ends here commit 46983d211fe178e85244a5f6a08eb09a0bf4f8ad Author: Mattias Engdegård Date: Thu Aug 3 09:57:33 2023 +0200 ; * lisp/mail/footnote.el (footnote-hebrew-numeric-regex): dedup rx This is a cosmetic change that silences a new Relint complaint; the resulting regexp remains unchanged. diff --git a/lisp/mail/footnote.el b/lisp/mail/footnote.el index b88fd405da8..4b2770ee3a1 100644 --- a/lisp/mail/footnote.el +++ b/lisp/mail/footnote.el @@ -347,10 +347,11 @@ footnote-hebrew-numeric ("ק" "ר" "ש" "ת" "תק" "תר" "תש" "תת" "תתק"))) (defconst footnote-hebrew-numeric-regex - (let ((numchars (string-to-list - (apply #'concat (apply #'append footnote-hebrew-numeric))))) + (let ((numchars + (delete-dups + (string-to-list + (apply #'concat (apply #'append footnote-hebrew-numeric)))))) (rx-to-string `(1+ (in ?' ,@numchars))))) -;; (defconst footnote-hebrew-numeric-regex "\\([אבגדהוזחט]'\\)?\\(ת\\)?\\(ת\\)?\\([קרשת]\\)?\\([טיכלמנסעפצ]\\)?\\([אבגדהוזחט]\\)?") (defun footnote--hebrew-numeric (n) "Supports 9999 footnotes, then rolls over." commit 5f1c0d1c44c0b57d4f6aaea186553872bbcf20ec Author: Eli Zaretskii Date: Thu Aug 3 11:07:39 2023 +0300 ; Better help-echo for Customize menu items * lisp/menu-bar.el (menu-bar-custom-menu): Better help-echo for Customize menu items. (Bug#64871) diff --git a/lisp/menu-bar.el b/lisp/menu-bar.el index 030fe374598..7738206d6d3 100644 --- a/lisp/menu-bar.el +++ b/lisp/menu-bar.el @@ -686,10 +686,10 @@ menu-bar-custom-menu menu-bar-separator) (bindings--define-key menu [customize-browse] '(menu-item "Browse Customization Groups" customize-browse - :help "Browse all customization groups")) + :help "Tree-like browser of all the groups of customizable options")) (bindings--define-key menu [customize] - '(menu-item "Top-level Customization Group" customize - :help "The master group called `Emacs'")) + '(menu-item "Top-level Emacs Customization Group" customize + :help "Top-level groups of customizable options, and their descriptions")) (bindings--define-key menu [customize-themes] '(menu-item "Custom Themes" customize-themes :help "Choose a pre-defined customization theme")) commit f63c5faf072b043c80a8f3fd646cc68d12d0cb81 Author: Eli Zaretskii Date: Thu Aug 3 10:56:35 2023 +0300 ; Fix last change * lisp/faces.el (faces--string-with-color, read-color): Doc fixes. * doc/lispref/minibuf.texi (High-Level Completion): Fix markup and wording. (Bug#64725) diff --git a/doc/lispref/minibuf.texi b/doc/lispref/minibuf.texi index 4ed36edb8c1..8ff5c14055e 100644 --- a/doc/lispref/minibuf.texi +++ b/doc/lispref/minibuf.texi @@ -1559,10 +1559,12 @@ High-Level Completion Interactively, or when @var{display} is non-@code{nil}, the return value is also displayed in the echo area. -The optional arguments FOREGROUND and FACE control the appearence of -the completion candidates. The candidates are displayed like FACE but -with different colors. If FOREGROUND is non-@code{nil} the foreground -varies, otherwise the background. +The optional arguments @var{foreground} and @var{face} control the +appearence of the completion candidates in the @file{*Completions*} +buffer. The candidates are displayed in the specified @var{face} but +with different colors: if @var{foreground} is non-@code{nil}, the +foreground color is changed to be the color of the candidate, +otherwise the background is changed to the candidate's color. @end deffn See also the functions @code{read-coding-system} and diff --git a/lisp/faces.el b/lisp/faces.el index 4f51a031156..dad16966f48 100644 --- a/lisp/faces.el +++ b/lisp/faces.el @@ -1880,7 +1880,7 @@ faces--string-with-color Set the :background or :foreground attribute to COLOR, depending on the argument FOREGROUND. -The optional FACE argument controls the values for other +The optional FACE argument determines the values of other face attributes." (let* ((defaults (if face (list face) '())) (colors (cond (foreground @@ -2028,10 +2028,12 @@ read-color Interactively, or with optional arg MSG non-nil, print the resulting color name in the echo area. -Interactively, displays a list of colored completions. If -optional argument FOREGROUND is non-nil, shows them as -foregrounds, otherwise as backgrounds. The optional argument -FACE controls the default appearance." +Interactively, provides completion for selecting the color. If +the optional argument FOREGROUND is non-nil, shows the completion +candidates with their foregound color changed to be the color of +the candidate, otherwise changes the background color of the +candidates. The optional argument FACE determines the other +face attributes of the candidates on display." (interactive "i\np\ni\np") ; Always convert to RGB interactively. (let* ((completion-ignore-case t) (color-alist commit 5129ea4b0540a0df35be59cdaf2fe63260670e9f Author: Helmut Eller Date: Thu Jul 20 16:27:34 2023 +0200 Improve interactive prompting for face colors When displaying the completion candidates, show how the face would look with the new foreground/background. * lisp/faces.el (faces--string-with-color): New helper, factored out from 'defined-colors-with-face-attributes'. (defined-colors-with-face-attributes): Use it. (read-color): Add optional argument FACE and pass it to 'faces--string-with-color.' (read-face-attribute): Call 'read-color' with more appropriate foreground and face arguments. * doc/lispref/minibuf.texi (High-Level Completion): Describe the intention behind the arguments FOREGROUND and FACE of 'read-color'. (Bug#64725) diff --git a/doc/lispref/minibuf.texi b/doc/lispref/minibuf.texi index 31b020db57c..4ed36edb8c1 100644 --- a/doc/lispref/minibuf.texi +++ b/doc/lispref/minibuf.texi @@ -1537,7 +1537,8 @@ High-Level Completion @code{commandp}. @end defun -@deffn Command read-color &optional prompt convert allow-empty display +@deffn Command read-color &optional prompt convert allow-empty @ + display foreground face This function reads a string that is a color specification, either the color's name or an RGB hex value such as @code{#RRRGGGBBB}. It prompts with @var{prompt} (default: @code{"Color (name or #RGB triplet):"}) @@ -1557,6 +1558,11 @@ High-Level Completion Interactively, or when @var{display} is non-@code{nil}, the return value is also displayed in the echo area. + +The optional arguments FOREGROUND and FACE control the appearence of +the completion candidates. The candidates are displayed like FACE but +with different colors. If FOREGROUND is non-@code{nil} the foreground +varies, otherwise the background. @end deffn See also the functions @code{read-coding-system} and diff --git a/lisp/faces.el b/lisp/faces.el index 44d64c743ba..4f51a031156 100644 --- a/lisp/faces.el +++ b/lisp/faces.el @@ -1340,10 +1340,11 @@ read-face-attribute (format "%s" old-value)))) (setq new-value (if (memq attribute '(:foreground :background)) - (let ((color - (read-color - (format-prompt "%s for face `%s'" - default attribute-name face)))) + (let* ((prompt (format-prompt + "%s for face `%s'" + default attribute-name face)) + (fg (eq attribute ':foreground)) + (color (read-color prompt nil nil nil fg face))) (if (equal (string-trim color) "") default color)) @@ -1870,15 +1871,26 @@ defined-colors-with-face-attributes strings with text properties, that make the color names render with the color they represent as background color (if FOREGROUND is nil; otherwise use the foreground color)." - (mapcar - (lambda (color-name) - (let ((color (copy-sequence color-name))) - (propertize color 'face - (if foreground - (list :foreground color) - (list :foreground (readable-foreground-color color-name) - :background color))))) - (defined-colors frame))) + (mapcar (lambda (color-name) + (faces--string-with-color color-name color-name foreground)) + (defined-colors frame))) + +(defun faces--string-with-color (string color &optional foreground face) + "Return a copy of STRING with face attributes for COLOR. +Set the :background or :foreground attribute to COLOR, depending +on the argument FOREGROUND. + +The optional FACE argument controls the values for other +attributes." + (let* ((defaults (if face (list face) '())) + (colors (cond (foreground + (list :foreground color)) + (face + (list :background color)) + (t + (list :foreground (readable-foreground-color color) + :background color))))) + (propertize string 'face (cons colors defaults)))) (defun readable-foreground-color (color) "Return a readable foreground color for background COLOR. @@ -1987,7 +1999,7 @@ display-grayscale-p (> (tty-color-gray-shades display) 2))) (defun read-color (&optional prompt convert-to-RGB allow-empty-name msg - foreground) + foreground face) "Read a color name or RGB triplet. Completion is available for color names, but not for RGB triplets. @@ -2016,17 +2028,23 @@ read-color Interactively, or with optional arg MSG non-nil, print the resulting color name in the echo area. -Interactively, displays a list of colored completions. If optional -argument FOREGROUND is non-nil, shows them as foregrounds, otherwise -as backgrounds." +Interactively, displays a list of colored completions. If +optional argument FOREGROUND is non-nil, shows them as +foregrounds, otherwise as backgrounds. The optional argument +FACE controls the default appearance." (interactive "i\np\ni\np") ; Always convert to RGB interactively. (let* ((completion-ignore-case t) - (colors (append '("foreground at point" "background at point") - (if allow-empty-name '("")) - (if (display-color-p) - (defined-colors-with-face-attributes - nil foreground) - (defined-colors)))) + (color-alist + `(("foreground at point" . ,(foreground-color-at-point)) + ("background at point" . ,(background-color-at-point)) + ,@(if allow-empty-name '(("" . unspecified))) + ,@(mapcar (lambda (c) (cons c c)) (defined-colors)))) + (colors (mapcar (lambda (pair) + (let* ((name (car pair)) + (color (cdr pair))) + (faces--string-with-color name color + foreground face))) + color-alist)) (color (completing-read (or prompt "Color (name or #RGB triplet): ") ;; Completing function for reading colors, accepting commit d727e8ee7c0b6f3457080c8a94ad54d6cffda911 Author: Eli Zaretskii Date: Thu Aug 3 10:28:58 2023 +0300 ; * lisp/progmodes/cperl-mode.el (cperl-method-call): Doc fix. diff --git a/lisp/progmodes/cperl-mode.el b/lisp/progmodes/cperl-mode.el index 51bed91c8c2..6ab3b8ef07e 100644 --- a/lisp/progmodes/cperl-mode.el +++ b/lisp/progmodes/cperl-mode.el @@ -5877,7 +5877,8 @@ cperl-font-lock-syntactic-face-function (defface cperl-method-call '((t (:inherit 'default ))) - "The face for method calls. Usually, they are not fontified. + "Font Lock mode face for method calls. +Usually, method calls are not fontified. We use this face to prevent calls to methods which look like builtin functions to be fontified like, well, builtin functions (which they are not). Inherits from `default'.")