emacs-diffs
[Top][All Lists]
Advanced

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

feature/android 19210f8b771: Merge remote-tracking branch 'origin/master


From: Po Lu
Subject: feature/android 19210f8b771: Merge remote-tracking branch 'origin/master' into feature/android
Date: Wed, 3 May 2023 20:15:24 -0400 (EDT)

branch: feature/android
commit 19210f8b771947ad10fdaaf27c4f2a177ece3631
Merge: b0d6c673726 b28d44d4226
Author: Po Lu <luangruo@yahoo.com>
Commit: Po Lu <luangruo@yahoo.com>

    Merge remote-tracking branch 'origin/master' into feature/android
---
 doc/lispref/files.texi               |  4 +--
 doc/lispref/os.texi                  | 14 ++++++--
 etc/NEWS                             |  8 ++---
 lisp/dired.el                        |  2 +-
 lisp/emacs-lisp/package.el           |  2 +-
 lisp/eshell/em-ls.el                 |  6 ++--
 lisp/eshell/em-pred.el               |  4 +--
 lisp/eshell/em-unix.el               | 70 +++++++++++++++++++++++++++---------
 lisp/eshell/esh-util.el              |  5 +++
 lisp/net/ange-ftp.el                 |  9 +++--
 lisp/net/tramp-adb.el                |  1 +
 lisp/net/tramp-archive.el            | 10 +++++-
 lisp/net/tramp-crypt.el              |  1 +
 lisp/net/tramp-gvfs.el               |  1 +
 lisp/net/tramp-rclone.el             |  1 +
 lisp/net/tramp-sh.el                 |  1 +
 lisp/net/tramp-smb.el                |  1 +
 lisp/net/tramp-sshfs.el              |  1 +
 lisp/net/tramp-sudoedit.el           |  1 +
 lisp/net/tramp.el                    | 15 ++++++--
 lisp/progmodes/cc-engine.el          |  6 +++-
 lisp/simple.el                       | 17 +++++++--
 test/lisp/net/tramp-archive-tests.el | 17 +++++----
 test/lisp/net/tramp-tests.el         | 14 +++++---
 24 files changed, 157 insertions(+), 54 deletions(-)

diff --git a/doc/lispref/files.texi b/doc/lispref/files.texi
index b15f2ab4d29..3982eb14f2b 100644
--- a/doc/lispref/files.texi
+++ b/doc/lispref/files.texi
@@ -3390,7 +3390,7 @@ first, before handlers for jobs such as remote file 
access.
 @code{file-directory-p},
 @code{file-equal-p},
 @code{file-executable-p}, @code{file-exists-p},
-@code{file-in-directory-p},
+@code{file-group-gid}, @code{file-in-directory-p},
 @code{file-local-copy}, @code{file-locked-p},
 @code{file-modes}, @code{file-name-all-completions},
 @code{file-name-as-directory},
@@ -3452,7 +3452,7 @@ first, before handlers for jobs such as remote file 
access.
 @code{file-direc@discretionary{}{}{}tory-p},
 @code{file-equal-p},
 @code{file-executable-p}, @code{file-exists-p},
-@code{file-in-directory-p},
+@code{file-group-gid}, @code{file-in-directory-p},
 @code{file-local-copy}, @code{file-locked-p},
 @code{file-modes}, @code{file-name-all-completions},
 @code{file-name-as-directory},
diff --git a/doc/lispref/os.texi b/doc/lispref/os.texi
index 22d9735f9d6..763782425c2 100644
--- a/doc/lispref/os.texi
+++ b/doc/lispref/os.texi
@@ -1293,12 +1293,22 @@ the remote connection has no associated user, it will 
instead return
 @end defun
 
 @cindex GID
+@defun group-real-gid
+This function returns the real @acronym{GID} of the Emacs process.
+@end defun
+
 @defun group-gid
 This function returns the effective @acronym{GID} of the Emacs process.
 @end defun
 
-@defun group-real-gid
-This function returns the real @acronym{GID} of the Emacs process.
+@defun file-group-gid
+This function returns the connection-local value for the user's
+effective @acronym{GID}.  Similar to @code{file-user-uid}, if
+@code{default-directory} is local, this is equivalent to
+@code{group-gid}, but for remote files (@pxref{Remote Files, , ,
+emacs, The GNU Emacs Manual}), it will return the @acronym{GID} for
+the user associated with that remote connection; if the remote
+connection has no associated user, it will instead return -1.
 @end defun
 
 @defun system-users
diff --git a/etc/NEWS b/etc/NEWS
index 74e367cfe61..673db8c8f4f 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -566,10 +566,10 @@ The declaration '(important-return-value t)' sets the
 return value should probably not be thrown away implicitly.
 
 +++
-** New function 'file-user-uid'.
-This function is like 'user-uid', but is aware of file name handlers,
-so it will return the remote UID for remote files (or -1 if the
-connection has no associated user).
+** New functions 'file-user-uid' and 'file-group-gid'.
+These functions are like 'user-uid' and 'group-gid', respectively, but
+are aware of file name handlers, so they will return the remote UID or
+GID for remote files (or -1 if the connection has no associated user).
 
 +++
 ** 'fset', 'defalias' and 'defvaralias' now signal an error for cyclic aliases.
diff --git a/lisp/dired.el b/lisp/dired.el
index e3a9d7bc428..1c8d011d765 100644
--- a/lisp/dired.el
+++ b/lisp/dired.el
@@ -1655,7 +1655,7 @@ see `dired-use-ls-dired' for more details.")
               dired-use-ls-dired)))
         ;; Use -N with --dired, to countermand possible non-default
         ;; quoting style, in particular via the environment variable
-        ;; QUOTINTG_STYLE.
+        ;; QUOTING_STYLE.
        (setq switches (concat "--dired -N " switches)))
     ;; Expand directory wildcards and fill file-list.
     (let ((dir-wildcard (insert-directory-wildcard-in-dir-p dir)))
diff --git a/lisp/emacs-lisp/package.el b/lisp/emacs-lisp/package.el
index 16b2218da26..0f68f0e8041 100644
--- a/lisp/emacs-lisp/package.el
+++ b/lisp/emacs-lisp/package.el
@@ -1196,7 +1196,7 @@ boundaries."
     ;; the earliest in version 31.1.  The idea is to phase out the
     ;; requirement for a "footer line" without unduly impacting users
     ;; on earlier Emacs versions.  See Bug#26490 for more details.
-    (unless (search-forward (concat ";;; " file-name ".el ends here"))
+    (unless (search-forward (concat ";;; " file-name ".el ends here") nil t)
       (lwarn '(package package-format) :warning
              "Package lacks a terminating comment"))
     ;; Try to include a trailing newline.
diff --git a/lisp/eshell/em-ls.el b/lisp/eshell/em-ls.el
index 56c5f262789..9b53bf29559 100644
--- a/lisp/eshell/em-ls.el
+++ b/lisp/eshell/em-ls.el
@@ -199,9 +199,9 @@ calling FUNC with FILE as an argument."
   `(let ((owner (file-attribute-user-id ,attrs))
         (modes (file-attribute-modes ,attrs)))
      (cond ((cond ((numberp owner)
-                  (= owner (user-uid)))
+                   (= owner (file-user-uid)))
                  ((stringp owner)
-                  (or (string-equal owner (user-login-name))
+                   (or (string-equal owner (eshell-user-login-name))
                       (member owner (eshell-current-ange-uids)))))
            ;; The user owns this file.
            (not (eq (aref modes ,index) ?-)))
@@ -919,7 +919,7 @@ to use, and each member of which is the width of that column
              ((not (eshell-ls-filetype-p (cdr file) ?-))
               'eshell-ls-special)
 
-             ((and (/= (user-uid) 0) ; root can execute anything
+              ((and (/= (file-user-uid) 0) ; root can execute anything
                    (eshell-ls-applicable (cdr file) 3
                                          'file-executable-p (car file)))
               'eshell-ls-executable)
diff --git a/lisp/eshell/em-pred.el b/lisp/eshell/em-pred.el
index 2ccca092b86..bfb0dad60ef 100644
--- a/lisp/eshell/em-pred.el
+++ b/lisp/eshell/em-pred.el
@@ -87,11 +87,11 @@ ordinary strings."
     (?U . (lambda (file)                   ; owned by effective uid
             (if (file-exists-p file)
                 (= (file-attribute-user-id (file-attributes file))
-                   (user-uid)))))
+                   (file-user-uid)))))
     (?G . (lambda (file)               ; owned by effective gid
             (if (file-exists-p file)
                 (= (file-attribute-group-id (file-attributes file))
-                   (group-gid)))))
+                   (file-group-gid)))))
     (?* . (lambda (file)
             (and (file-regular-p file)
                  (not (file-symlink-p file))
diff --git a/lisp/eshell/em-unix.el b/lisp/eshell/em-unix.el
index a792493e071..b7ef0f0c40c 100644
--- a/lisp/eshell/em-unix.el
+++ b/lisp/eshell/em-unix.el
@@ -91,14 +91,29 @@ Otherwise, `rmdir' is required."
   :type 'boolean
   :group 'eshell-unix)
 
-(defcustom eshell-rm-interactive-query (= (user-uid) 0)
-  "If non-nil, `rm' will query before removing anything."
-  :type 'boolean
+(define-widget 'eshell-interactive-query 'radio
+  "When to interatively query the user about a particular operation.
+If t, always query.  If nil, never query.  If `root', query when
+the user is logged in as root (including when `default-directory'
+is remote with a root user)."
+  :args '((const :tag "Never" nil)
+          (const :tag "Always" t)
+          (const :tag "When root" root)))
+
+(defcustom eshell-rm-interactive-query 'root
+  "When `rm' should query before removing anything.
+If t, always query.  If nil, never query.  If `root', query when
+the user is logged in as root (including when `default-directory'
+is remote with a root user)."
+  :type 'eshell-interactive-query
   :group 'eshell-unix)
 
-(defcustom eshell-mv-interactive-query (= (user-uid) 0)
-  "If non-nil, `mv' will query before overwriting anything."
-  :type 'boolean
+(defcustom eshell-mv-interactive-query 'root
+  "When `mv' should query before overwriting anything.
+If t, always query.  If nil, never query.  If `root', query when
+the user is logged in as root (including when `default-directory'
+is remote with a root user)."
+  :type 'eshell-interactive-query
   :group 'eshell-unix)
 
 (defcustom eshell-mv-overwrite-files t
@@ -106,9 +121,12 @@ Otherwise, `rmdir' is required."
   :type 'boolean
   :group 'eshell-unix)
 
-(defcustom eshell-cp-interactive-query (= (user-uid) 0)
-  "If non-nil, `cp' will query before overwriting anything."
-  :type 'boolean
+(defcustom eshell-cp-interactive-query 'root
+  "When `cp' should query before overwriting anything.
+If t, always query.  If nil, never query.  If `root', query when
+the user is logged in as root (including when `default-directory'
+is remote with a root user)."
+  :type 'eshell-interactive-query
   :group 'eshell-unix)
 
 (defcustom eshell-cp-overwrite-files t
@@ -116,9 +134,12 @@ Otherwise, `rmdir' is required."
   :type 'boolean
   :group 'eshell-unix)
 
-(defcustom eshell-ln-interactive-query (= (user-uid) 0)
-  "If non-nil, `ln' will query before overwriting anything."
-  :type 'boolean
+(defcustom eshell-ln-interactive-query 'root
+  "When `ln' should query before overwriting anything.
+If t, always query.  If nil, never query.  If `root', query when
+the user is logged in as root (including when `default-directory'
+is remote with a root user)."
+  :type 'eshell-interactive-query
   :group 'eshell-unix)
 
 (defcustom eshell-ln-overwrite-files nil
@@ -159,6 +180,17 @@ Otherwise, Emacs will attempt to use rsh to invoke du on 
the remote machine."
 (defvar em-recursive)
 (defvar em-verbose)
 
+(defun eshell-interactive-query-p (value)
+  "Return non-nil if a command should query the user according to VALUE.
+If VALUE is nil, return nil (never query).  If `root', return
+non-nil if the user is logged in as root (including when
+`default-directory' is remote with a root user; see
+`file-user-uid').  If VALUE is any other non-nil value, return
+non-nil (always query)."
+  (if (eq value 'root)
+      (= (file-user-uid) 0)
+    value))
+
 (defun eshell/man (&rest args)
   "Invoke man, flattening the arguments appropriately."
   (funcall 'man (apply 'eshell-flatten-and-stringify args)))
@@ -249,7 +281,8 @@ argument."
      :usage "[OPTION]... FILE...
 Remove (unlink) the FILE(s).")
    (unless em-interactive
-     (setq em-interactive eshell-rm-interactive-query))
+     (setq em-interactive (eshell-interactive-query-p
+                           eshell-rm-interactive-query)))
    (if (and force-removal em-interactive)
        (setq em-interactive nil))
    (while args
@@ -523,7 +556,8 @@ Rename SOURCE to DEST, or move SOURCE(s) to DIRECTORY.
 [OPTION] DIRECTORY...")
    (let ((no-dereference t))
      (eshell-mvcpln-template "mv" "moving" 'rename-file
-                            eshell-mv-interactive-query
+                             (eshell-interactive-query-p
+                              eshell-mv-interactive-query)
                             eshell-mv-overwrite-files))))
 
 (put 'eshell/mv 'eshell-no-numeric-conversions t)
@@ -561,7 +595,8 @@ Copy SOURCE to DEST, or multiple SOURCE(s) to DIRECTORY.")
    (if archive
        (setq preserve t no-dereference t em-recursive t))
    (eshell-mvcpln-template "cp" "copying" 'copy-file
-                          eshell-cp-interactive-query
+                           (eshell-interactive-query-p
+                            eshell-cp-interactive-query)
                           eshell-cp-overwrite-files preserve)))
 
 (put 'eshell/cp 'eshell-no-numeric-conversions t)
@@ -594,7 +629,8 @@ with `--symbolic'.  When creating hard links, each TARGET 
must exist.")
                             (if symbolic
                                 'make-symbolic-link
                               'add-name-to-file)
-                            eshell-ln-interactive-query
+                             (eshell-interactive-query-p
+                              eshell-ln-interactive-query)
                             eshell-ln-overwrite-files))))
 
 (put 'eshell/ln 'eshell-no-numeric-conversions t)
@@ -960,7 +996,7 @@ Show wall-clock time elapsed during execution of COMMAND.")
 
 (defun eshell/whoami (&rest _args)
   "Make \"whoami\" Tramp aware."
-  (or (file-remote-p default-directory 'user) (user-login-name)))
+  (eshell-user-login-name))
 
 (defvar eshell-diff-window-config nil)
 
diff --git a/lisp/eshell/esh-util.el b/lisp/eshell/esh-util.el
index c0685757789..3608c78ba2b 100644
--- a/lisp/eshell/esh-util.el
+++ b/lisp/eshell/esh-util.el
@@ -502,6 +502,11 @@ list."
       (sit-for 0)
     (error nil)))
 
+(defun eshell-user-login-name ()
+  "Return the connection-aware value of the user's login name.
+See also `user-login-name'."
+  (or (file-remote-p default-directory 'user) (user-login-name)))
+
 (defun eshell-read-passwd-file (file)
   "Return an alist correlating gids to group names in FILE."
   (let (names)
diff --git a/lisp/net/ange-ftp.el b/lisp/net/ange-ftp.el
index e21367135d3..1c20a27801d 100644
--- a/lisp/net/ange-ftp.el
+++ b/lisp/net/ange-ftp.el
@@ -4381,7 +4381,11 @@ NEWNAME should be the name to give the new compressed or 
uncompressed file.")
       (ange-ftp-real-find-backup-file-name fn)))
 
 (defun ange-ftp-file-user-uid ()
-  ;; Return "don't  know" value.
+  ;; Return "don't know" value.
+  -1)
+
+(defun ange-ftp-file-group-gid ()
+  ;; Return "don't know" value.
   -1)
 
 ;;; Define the handler for special file names
@@ -4524,8 +4528,9 @@ NEWNAME should be the name to give the new compressed or 
uncompressed file.")
 (put 'file-notify-rm-watch 'ange-ftp 'ignore)
 (put 'file-notify-valid-p 'ange-ftp 'ignore)
 
-;; Return the "don't know' value for remote user uid.
+;; Return the "don't know" value for remote user uid and group gid.
 (put 'file-user-uid 'ange-ftp 'ange-ftp-file-user-uid)
+(put 'file-group-gid 'ange-ftp 'ange-ftp-file-group-gid)
 
 ;;; Define ways of getting at unmodified Emacs primitives,
 ;;; turning off our handler.
diff --git a/lisp/net/tramp-adb.el b/lisp/net/tramp-adb.el
index 5a8044f8a53..2b5369ea3b5 100644
--- a/lisp/net/tramp-adb.el
+++ b/lisp/net/tramp-adb.el
@@ -130,6 +130,7 @@ It is used for TCP/IP devices."
     (file-equal-p . tramp-handle-file-equal-p)
     (file-executable-p . tramp-adb-handle-file-executable-p)
     (file-exists-p . tramp-adb-handle-file-exists-p)
+    (file-group-gid . tramp-handle-file-group-gid)
     (file-in-directory-p . tramp-handle-file-in-directory-p)
     (file-local-copy . tramp-adb-handle-file-local-copy)
     (file-locked-p . tramp-handle-file-locked-p)
diff --git a/lisp/net/tramp-archive.el b/lisp/net/tramp-archive.el
index c2175612fa8..6fcb0ae5e69 100644
--- a/lisp/net/tramp-archive.el
+++ b/lisp/net/tramp-archive.el
@@ -242,6 +242,7 @@ It must be supported by libarchive(3).")
     (file-equal-p . tramp-handle-file-equal-p)
     (file-executable-p . tramp-archive-handle-file-executable-p)
     (file-exists-p . tramp-archive-handle-file-exists-p)
+    (file-group-gid . tramp-archive-handle-file-group-gid)
     (file-in-directory-p . tramp-handle-file-in-directory-p)
     (file-local-copy . tramp-archive-handle-file-local-copy)
     (file-locked-p . ignore)
@@ -644,6 +645,13 @@ offered."
   "Like `file-exists-p' for file archives."
   (file-exists-p (tramp-archive-gvfs-file-name filename)))
 
+(defun tramp-archive-handle-file-group-gid ()
+  "Like `file-group-gid' for file archives."
+  (with-parsed-tramp-archive-file-name default-directory nil
+    (let ((default-directory (file-name-directory archive)))
+      ;; `file-group-gid' exists since Emacs 30.1.
+      (tramp-compat-funcall 'file-group-gid))))
+
 (defun tramp-archive-handle-file-local-copy (filename)
   "Like `file-local-copy' for file archives."
   (file-local-copy (tramp-archive-gvfs-file-name filename)))
@@ -672,7 +680,7 @@ offered."
       (concat (file-truename archive) local))))
 
 (defun tramp-archive-handle-file-user-uid ()
-  "Like `user-uid' for file archives."
+  "Like `file-user-uid' for file archives."
   (with-parsed-tramp-archive-file-name default-directory nil
     (let ((default-directory (file-name-directory archive)))
       ;; `file-user-uid' exists since Emacs 30.1.
diff --git a/lisp/net/tramp-crypt.el b/lisp/net/tramp-crypt.el
index ea27c704587..276b65fcfb3 100644
--- a/lisp/net/tramp-crypt.el
+++ b/lisp/net/tramp-crypt.el
@@ -181,6 +181,7 @@ If NAME doesn't belong to an encrypted remote directory, 
return nil."
     (file-equal-p . tramp-handle-file-equal-p)
     (file-executable-p . tramp-crypt-handle-file-executable-p)
     (file-exists-p . tramp-handle-file-exists-p)
+    ;; `file-group-gid' performed by default-handler.
     (file-in-directory-p . tramp-handle-file-in-directory-p)
     (file-local-copy . tramp-handle-file-local-copy)
     (file-locked-p . tramp-crypt-handle-file-locked-p)
diff --git a/lisp/net/tramp-gvfs.el b/lisp/net/tramp-gvfs.el
index 859f4870b80..e3b42acfed5 100644
--- a/lisp/net/tramp-gvfs.el
+++ b/lisp/net/tramp-gvfs.el
@@ -807,6 +807,7 @@ It has been changed in GVFS 1.14.")
     (file-equal-p . tramp-handle-file-equal-p)
     (file-executable-p . tramp-gvfs-handle-file-executable-p)
     (file-exists-p . tramp-handle-file-exists-p)
+    (file-group-gid . tramp-handle-file-group-gid)
     (file-in-directory-p . tramp-handle-file-in-directory-p)
     (file-local-copy . tramp-handle-file-local-copy)
     (file-locked-p . tramp-handle-file-locked-p)
diff --git a/lisp/net/tramp-rclone.el b/lisp/net/tramp-rclone.el
index 74295de4c29..02e96e10438 100644
--- a/lisp/net/tramp-rclone.el
+++ b/lisp/net/tramp-rclone.el
@@ -95,6 +95,7 @@
     (file-equal-p . tramp-handle-file-equal-p)
     (file-executable-p . tramp-fuse-handle-file-executable-p)
     (file-exists-p . tramp-handle-file-exists-p)
+    (file-group-gid . tramp-handle-file-group-gid)
     (file-in-directory-p . tramp-handle-file-in-directory-p)
     (file-local-copy . tramp-handle-file-local-copy)
     (file-locked-p . tramp-handle-file-locked-p)
diff --git a/lisp/net/tramp-sh.el b/lisp/net/tramp-sh.el
index 0369e19378c..94fbc588b5d 100644
--- a/lisp/net/tramp-sh.el
+++ b/lisp/net/tramp-sh.el
@@ -1073,6 +1073,7 @@ Format specifiers \"%s\" are replaced before the script 
is used.")
     (file-equal-p . tramp-handle-file-equal-p)
     (file-executable-p . tramp-sh-handle-file-executable-p)
     (file-exists-p . tramp-sh-handle-file-exists-p)
+    (file-group-gid . tramp-handle-file-group-gid)
     (file-in-directory-p . tramp-handle-file-in-directory-p)
     (file-local-copy . tramp-sh-handle-file-local-copy)
     (file-locked-p . tramp-handle-file-locked-p)
diff --git a/lisp/net/tramp-smb.el b/lisp/net/tramp-smb.el
index 9a24403bb18..1182501e820 100644
--- a/lisp/net/tramp-smb.el
+++ b/lisp/net/tramp-smb.el
@@ -246,6 +246,7 @@ See `tramp-actions-before-shell' for more info.")
     (file-file-equal-p . tramp-handle-file-equal-p)
     (file-executable-p . tramp-handle-file-exists-p)
     (file-exists-p . tramp-handle-file-exists-p)
+    (file-group-gid . tramp-handle-file-group-gid)
     (file-in-directory-p . tramp-handle-file-in-directory-p)
     (file-local-copy . tramp-smb-handle-file-local-copy)
     (file-locked-p . tramp-handle-file-locked-p)
diff --git a/lisp/net/tramp-sshfs.el b/lisp/net/tramp-sshfs.el
index fe126361ac3..9d871276f7a 100644
--- a/lisp/net/tramp-sshfs.el
+++ b/lisp/net/tramp-sshfs.el
@@ -101,6 +101,7 @@
     (file-equal-p . tramp-handle-file-equal-p)
     (file-executable-p . tramp-fuse-handle-file-executable-p)
     (file-exists-p . tramp-handle-file-exists-p)
+    (file-group-gid . tramp-handle-file-group-gid)
     (file-in-directory-p . tramp-handle-file-in-directory-p)
     (file-local-copy . tramp-handle-file-local-copy)
     (file-locked-p . tramp-handle-file-locked-p)
diff --git a/lisp/net/tramp-sudoedit.el b/lisp/net/tramp-sudoedit.el
index 941c1e8dd24..e41a4a590e2 100644
--- a/lisp/net/tramp-sudoedit.el
+++ b/lisp/net/tramp-sudoedit.el
@@ -90,6 +90,7 @@ See `tramp-actions-before-shell' for more info.")
     (file-equal-p . tramp-handle-file-equal-p)
     (file-executable-p . tramp-sudoedit-handle-file-executable-p)
     (file-exists-p . tramp-sudoedit-handle-file-exists-p)
+    (file-group-gid . tramp-handle-file-group-gid)
     (file-in-directory-p . tramp-handle-file-in-directory-p)
     (file-local-copy . tramp-handle-file-local-copy)
     (file-locked-p . tramp-handle-file-locked-p)
diff --git a/lisp/net/tramp.el b/lisp/net/tramp.el
index ca95b6b6971..7ce984d9144 100644
--- a/lisp/net/tramp.el
+++ b/lisp/net/tramp.el
@@ -2650,7 +2650,7 @@ Must be handled by the callers."
              ;; Emacs 29+ only.
               list-system-processes memory-info process-attributes
               ;; Emacs 30+ only.
-             file-user-uid))
+             file-group-gid file-user-uid))
     default-directory)
    ;; PROC.
    ((member operation '(file-notify-rm-watch file-notify-valid-p))
@@ -3931,7 +3931,7 @@ Let-bind it when necessary.")
       (tramp-make-tramp-file-name (tramp-dissect-file-name filename)))))
 
 (defun tramp-handle-file-user-uid ()
-  "Like `user-uid' for Tramp files."
+  "Like `file-user-uid' for Tramp files."
   (let ((v (tramp-dissect-file-name default-directory)))
     (or (tramp-get-remote-uid v 'integer)
         ;; Some handlers for `tramp-get-remote-uid' return nil if they
@@ -3939,6 +3939,15 @@ Let-bind it when necessary.")
         ;; consistency.
         tramp-unknown-id-integer)))
 
+(defun tramp-handle-file-group-gid ()
+  "Like `file-group-gid' for Tramp files."
+  (let ((v (tramp-dissect-file-name default-directory)))
+    (or (tramp-get-remote-gid v 'integer)
+        ;; Some handlers for `tramp-get-remote-gid' return nil if they
+        ;; can't get the GID; always return -1 in this case for
+        ;; consistency.
+        tramp-unknown-id-integer)))
+
 (defun tramp-handle-access-file (filename string)
   "Like `access-file' for Tramp files."
   (setq filename (file-truename filename))
@@ -6390,7 +6399,7 @@ ID-FORMAT valid values are `string' and `integer'."
 
 (defun tramp-read-id-output (vec)
   "Read in connection buffer the output of the `id' command.
-Set connection properties \"{uid,gid.groups}-{integer,string}\"."
+Set connection properties \"{uid,gid,groups}-{integer,string}\"."
   (with-current-buffer (tramp-get-connection-buffer vec)
     (let (uid-integer uid-string
          gid-integer gid-string
diff --git a/lisp/progmodes/cc-engine.el b/lisp/progmodes/cc-engine.el
index f7320da5629..8b34daf03c2 100644
--- a/lisp/progmodes/cc-engine.el
+++ b/lisp/progmodes/cc-engine.el
@@ -9279,7 +9279,11 @@ multi-line strings (but not C++, for example)."
             (setq pos (point))
             (c-forward-syntactic-ws)
             (and (not (looking-at c-symbol-start))
-                 (not (looking-at c-type-decl-prefix-key)))))
+                 (or
+                  (not (looking-at c-type-decl-prefix-key))
+                  (and (eq (char-after) ?\()
+                       (not (save-excursion
+                              (c-forward-declarator))))))))
       ;; A C specifier followed by an implicit int, e.g.
       ;; "register count;"
       (goto-char prefix-end-pos)
diff --git a/lisp/simple.el b/lisp/simple.el
index 90ee4cc1bf9..0cfac84c851 100644
--- a/lisp/simple.el
+++ b/lisp/simple.el
@@ -4753,6 +4753,18 @@ this function will instead return -1."
       (funcall handler 'file-user-uid)
     (user-uid)))
 
+(defun file-group-gid ()
+  "Return the connection-local effective gid.
+This is similar to `group-gid', but may invoke a file name handler
+based on `default-directory'.  See Info node `(elisp)Magic File
+Names'.
+
+If a file name handler is unable to retrieve the effective gid,
+this function will instead return -1."
+  (if-let ((handler (find-file-name-handler default-directory 
'file-group-gid)))
+      (funcall handler 'file-group-gid)
+    (group-gid)))
+
 (defun max-mini-window-lines (&optional frame)
   "Compute maximum number of lines for echo area in FRAME.
 As defined by `max-mini-window-height'.  FRAME defaults to the
@@ -9327,9 +9339,8 @@ The function should return non-nil if the two tokens do 
not match.")
                  (delete-overlay blink-matching--overlay)))))
        ((not show-paren-context-when-offscreen)
         (minibuffer-message
-         #("Matches %s"
-           ;; Make the following text (i.e., %s) prominent.
-           0 7 (face shadow))
+         "%s%s"
+         (propertize "Matches " 'face 'shadow)
          (blink-paren-open-paren-line-string blinkpos)))))))
 
 (defun blink-paren-open-paren-line-string (pos)
diff --git a/test/lisp/net/tramp-archive-tests.el 
b/test/lisp/net/tramp-archive-tests.el
index 94ef40a1116..2e2e313f35c 100644
--- a/test/lisp/net/tramp-archive-tests.el
+++ b/test/lisp/net/tramp-archive-tests.el
@@ -881,16 +881,19 @@ This tests also `file-executable-p', `file-writable-p' 
and `set-file-modes'."
                 (zerop (nth 1 fsi))
                 (zerop (nth 2 fsi))))))
 
-;; `file-user-uid' was introduced in Emacs 30.1.
-(ert-deftest tramp-archive-test44-file-user-uid ()
-  "Check that `file-user-uid' returns proper values."
+;; `file-user-uid' and `file-group-gid' were introduced in Emacs 30.1.
+(ert-deftest tramp-archive-test44-user-group-ids ()
+  "Check results of user/group functions.
+`file-user-uid' and `file-group-gid' should return proper values."
   (skip-unless tramp-archive-enabled)
-  (skip-unless (fboundp 'file-user-uid))
+  (skip-unless (and (fboundp 'file-user-uid)
+                    (fboundp 'file-group-gid)))
 
   (let ((default-directory tramp-archive-test-archive))
-    ;; `file-user-uid' exists since Emacs 30.1.  We don't want to see
-    ;; compiler warnings for older Emacsen.
-    (should (integerp (with-no-warnings (file-user-uid))))))
+    ;; `file-user-uid' and `file-group-gid' exist since Emacs 30.1.
+    ;; We don't want to see compiler warnings for older Emacsen.
+    (should (integerp (with-no-warnings (file-user-uid))))
+    (should (integerp (with-no-warnings (file-group-gid))))))
 
 (ert-deftest tramp-archive-test48-auto-load ()
   "Check that `tramp-archive' autoloads properly."
diff --git a/test/lisp/net/tramp-tests.el b/test/lisp/net/tramp-tests.el
index 5fde783087e..8e4e7122a27 100644
--- a/test/lisp/net/tramp-tests.el
+++ b/test/lisp/net/tramp-tests.el
@@ -7367,16 +7367,20 @@ This requires restrictions of file name syntax."
     (dotimes (i (length fsi))
       (should (natnump (or (nth i fsi) 0))))))
 
-;; `file-user-uid' was introduced in Emacs 30.1.
-(ert-deftest tramp-test44-file-user-uid ()
-  "Check that `file-user-uid' and `tramp-get-remote-*' return proper values."
+;; `file-user-uid' and `file-group-gid' were introduced in Emacs 30.1.
+(ert-deftest tramp-test44-file-user-group-ids ()
+  "Check results of user/group functions.
+`file-user-uid', `file-group-gid', and `tramp-get-remote-*'
+should all return proper values."
   (skip-unless (tramp--test-enabled))
 
   (let ((default-directory ert-remote-temporary-file-directory))
-    ;; `file-user-uid' exists since Emacs 30.1.  We don't want to see
-    ;; compiler warnings for older Emacsen.
+    ;; `file-user-uid' and `file-group-gid' exist since Emacs 30.1.
+    ;; We don't want to see compiler warnings for older Emacsen.
     (when (fboundp 'file-user-uid)
       (should (integerp (with-no-warnings (file-user-uid)))))
+    (when (fboundp 'file-group-gid)
+      (should (integerp (with-no-warnings (file-group-gid)))))
 
     (with-parsed-tramp-file-name default-directory nil
       (should (or (integerp (tramp-get-remote-uid v 'integer))



reply via email to

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