emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

feature/android 1c429b7fef2: Merge remote-tracking branch 'origin/master


From: Po Lu
Subject: feature/android 1c429b7fef2: Merge remote-tracking branch 'origin/master' into feature/android
Date: Thu, 3 Aug 2023 07:50:54 -0400 (EDT)

branch: feature/android
commit 1c429b7fef2e472cbd1dd8e8f237179ed6616975
Merge: 6d44d08e044 588a0363d9a
Author: Po Lu <luangruo@yahoo.com>
Commit: Po Lu <luangruo@yahoo.com>

    Merge remote-tracking branch 'origin/master' into feature/android
---
 doc/lispref/minibuf.texi                    |  10 ++-
 lisp/align.el                               |  16 ++---
 lisp/faces.el                               |  66 +++++++++++------
 lisp/image/image-dired-util.el              |  12 ++--
 lisp/image/image-dired.el                   |   8 +--
 lisp/mail/footnote.el                       |   7 +-
 lisp/menu-bar.el                            |   6 +-
 lisp/net/tramp-sh.el                        | 108 +++++++++++++++++++++++-----
 lisp/net/tramp-sudoedit.el                  |  33 +++++++--
 lisp/net/tramp.el                           |   7 ++
 lisp/progmodes/cperl-mode.el                |   3 +-
 lisp/progmodes/eglot.el                     |  12 +++-
 test/lisp/align-resources/align-regexp.erts |  13 ++++
 test/lisp/align-resources/c-mode.erts       |  12 ++++
 test/lisp/align-resources/latex-mode.erts   |  29 ++++++++
 test/lisp/align-tests.el                    |  15 ++++
 test/lisp/image/image-dired-util-tests.el   |  21 +++---
 17 files changed, 293 insertions(+), 85 deletions(-)

diff --git a/doc/lispref/minibuf.texi b/doc/lispref/minibuf.texi
index 31b020db57c..8ff5c14055e 100644
--- a/doc/lispref/minibuf.texi
+++ b/doc/lispref/minibuf.texi
@@ -1537,7 +1537,8 @@ that it uses the predicate @code{custom-variable-p} 
instead of
 @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,13 @@ non-@code{nil} and the user enters null input.
 
 Interactively, or when @var{display} is non-@code{nil}, the return
 value is also displayed in the echo area.
+
+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/align.el b/lisp/align.el
index b13008b1fdf..bc8ccbd599c 100644
--- a/lisp/align.el
+++ b/lisp/align.el
@@ -211,20 +211,20 @@ If nil, then no messages will ever be printed to the 
minibuffer."
 
 (defcustom align-dq-string-modes
   (append align-lisp-modes align-c++-modes align-perl-modes
-          '(python-mode vhdl-mode))
+          '(python-base-mode vhdl-mode))
   "A list of modes where double quoted strings should be excluded."
   :type '(repeat symbol)
   :group 'align)
 
 (defcustom align-sq-string-modes
-  (append align-perl-modes '(python-mode))
+  (append align-perl-modes '(python-base-mode))
   "A list of modes where single quoted strings should be excluded."
   :type '(repeat symbol)
   :group 'align)
 
 (defcustom align-open-comment-modes
   (append align-lisp-modes align-c++-modes align-perl-modes
-          '(python-mode makefile-mode vhdl-mode))
+          '(python-base-mode makefile-mode vhdl-mode))
   "A list of modes with a single-line comment syntax.
 These are comments as in Lisp, which have a beginning, but end with
 the line (i.e., `comment-end' is an empty string)."
@@ -450,7 +450,7 @@ The possible settings for `align-region-separate' are:
      (regexp   . ,(concat "[^=!<> \t\n]\\(\\s-*\\)="
                          "\\(\\s-*\\)\\([^>= \t\n]\\|$\\)"))
      (group    . (1 2))
-     (modes    . '(python-mode))
+     (modes    . '(python-base-mode))
      (tab-stop . nil))
 
     (make-assignment
@@ -478,7 +478,7 @@ The possible settings for `align-region-separate' are:
     (basic-comma-delimiter
      (regexp   . ",\\(\\s-*\\)[^# \t\n]")
      (repeat   . t)
-     (modes    . (append align-perl-modes '(python-mode)))
+     (modes    . (append align-perl-modes '(python-base-mode)))
      (run-if   . ,(lambda () current-prefix-arg)))
 
     (c++-comment
@@ -508,7 +508,7 @@ The possible settings for `align-region-separate' are:
 
     (python-chain-logic
      (regexp   . "\\(\\s-*\\)\\(\\<and\\>\\|\\<or\\>\\)")
-     (modes    . '(python-mode))
+     (modes    . '(python-base-mode))
      (valid    . ,(lambda ()
                     (save-excursion
                       (goto-char (match-end 2))
@@ -525,7 +525,7 @@ The possible settings for `align-region-separate' are:
 
     (basic-line-continuation
      (regexp   . "\\(\\s-*\\)\\\\$")
-     (modes    . '(python-mode makefile-mode)))
+     (modes    . '(python-base-mode makefile-mode)))
 
     (tex-record-separator
      (regexp . ,(lambda (end reverse)
@@ -570,7 +570,7 @@ The possible settings for `align-region-separate' are:
     (css-declaration
      (regexp . "^\\s-*\\(?:\\w-?\\)+:\\(\\s-*\\).*;")
      (group . (1))
-     (modes . '(css-mode html-mode)))
+     (modes . '(css-base-mode html-mode)))
 
     (toml-assignment
      (regexp . ,(rx (group (zero-or-more (syntax whitespace)))
diff --git a/lisp/faces.el b/lisp/faces.el
index e3f7753bb8d..3aa0ad8d0f0 100644
--- a/lisp/faces.el
+++ b/lisp/faces.el
@@ -1340,10 +1340,11 @@ of a global face.  Value is the new attribute value."
                       (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 @@ to `defined-colors' the elements of the returned list 
are color
 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 determines the values of other face
+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 @@ If omitted or nil, that stands for the selected frame's 
display."
     (> (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,25 @@ to enter an empty color name (the empty string).
 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, 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)
-        (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
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 @@ vary:
   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 @@ See also `image-dired-thumbnail-storage' and
       (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 @@ computing the SHA-1 of first 4KiB of the image contents (See
 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 @@ thumbnails:
 
     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'.
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 @@ Use Unicode characters for footnoting."
     ("ק" "ר" "ש" "ת" "תק" "תר" "תש" "תת" "תתק")))
 
 (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."
diff --git a/lisp/menu-bar.el b/lisp/menu-bar.el
index 825e9acc069..5e837485db3 100644
--- a/lisp/menu-bar.el
+++ b/lisp/menu-bar.el
@@ -699,10 +699,10 @@ Do the same for the keys of the same name."
       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"))
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 @@ on the remote file system.
 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 @@ characters need to be doubled.")
 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 @@ Operations not mentioned here will be handled by the 
normal Emacs functions.")
   (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 @@ Operations not mentioned here will be handled by the 
normal Emacs functions.")
                      (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 @@ Operations not mentioned here will be handled by the 
normal Emacs functions.")
            (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 @@ Operations not mentioned here will be handled by the 
normal Emacs functions.")
            ;; 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 @@ Operations not mentioned here will be handled by the 
normal Emacs functions.")
 (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 @@ ID-FORMAT valid values are `string' and `integer'."
              (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 @@ ID-FORMAT valid values are `string' and `integer'."
 (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 @@ OK-IF-ALREADY-EXISTS means don't barf if NEWNAME exists 
already.
 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 @@ OK-IF-ALREADY-EXISTS means don't barf if NEWNAME exists 
already.
 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 @@ the result will be a local, non-Tramp, file name."
   "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 @@ the result will be a local, non-Tramp, file name."
         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 2c1acb7f5fc..1223bdeb7ea 100644
--- a/lisp/net/tramp.el
+++ b/lisp/net/tramp.el
@@ -6060,6 +6060,13 @@ to cache the result.  Return the modified ATTR."
                 ;; 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.
diff --git a/lisp/progmodes/cperl-mode.el b/lisp/progmodes/cperl-mode.el
index ebfc081b121..75ea81d55a4 100644
--- a/lisp/progmodes/cperl-mode.el
+++ b/lisp/progmodes/cperl-mode.el
@@ -5877,7 +5877,8 @@ default 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'.")
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 @@ This can be useful when using docker to run a language 
server.")
 
 ;;; 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 @@ This docstring appeases checkdoc, that's all."
                                         (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
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-resources/latex-mode.erts 
b/test/lisp/align-resources/latex-mode.erts
new file mode 100644
index 00000000000..cdc93e4a925
--- /dev/null
+++ b/test/lisp/align-resources/latex-mode.erts
@@ -0,0 +1,29 @@
+Name: tex-record-separator and basic-line-continuation
+
+=-=
+\documentclass{}
+
+\begin{document}
+
+\begin{tabular}{l|l}
+  \textit{Player name}  &\textit{Career home runs}  \\
+  \hline
+  Hank Aaron  &755 \\
+  Babe Ruth &714
+\end{tabular}
+
+\end{document}
+=-=
+\documentclass{}
+
+\begin{document}
+
+\begin{tabular}{l|l}
+  \textit{Player name} & \textit{Career home runs} \\
+  \hline
+  Hank Aaron           & 755                       \\
+  Babe Ruth            & 714
+\end{tabular}
+
+\end{document}
+=-=-=
diff --git a/test/lisp/align-tests.el b/test/lisp/align-tests.el
index 90b6b9df9bf..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)
@@ -43,6 +45,10 @@
   (ert-test-erts-file (ert-resource-file "java-mode.erts")
                       (test-align-transform-fun #'java-mode)))
 
+(ert-deftest align-latex ()
+  (ert-test-erts-file (ert-resource-file "latex-mode.erts")
+                      (test-align-transform-fun #'latex-mode)))
+
 (ert-deftest align-python ()
   (ert-test-erts-file (ert-resource-file "python-mode.erts")
                       (test-align-transform-fun #'python-mode)))
@@ -52,6 +58,15 @@
     (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
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 @@
                      "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



reply via email to

[Prev in Thread] Current Thread [Next in Thread]