emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] master b303298: Remove Emacs 23 compat code from Tramp


From: Michael Albinus
Subject: [Emacs-diffs] master b303298: Remove Emacs 23 compat code from Tramp
Date: Fri, 26 May 2017 10:25:26 -0400 (EDT)

branch: master
commit b3032988400448ff0ad2f6e658a0e90fac6bd15f
Author: Michael Albinus <address@hidden>
Commit: Michael Albinus <address@hidden>

    Remove Emacs 23 compat code from Tramp
    
    * doc/misc/tramp.texi (Remote processes): Don't mention
    Emacs 24 explicitely.
    (Frequently Asked Questions): Remove Emacs 23 from
    compatibility list.
    
    * lisp/net/tramp.el:
    * lisp/net/tramp-adb.el:
    * lisp/net/tramp-cache.el:
    * lisp/net/tramp-gvfs.el:
    * lisp/net/tramp-sh.el:
    * lisp/net/tramp-smb.el: Replace compat function calls.
    
    * lisp/net/tramp-compat.el (remote-file-name-inhibit-cache)
    (tramp-compat-condition-case-unless-debug)
    (tramp-compat-copy-file, tramp-compat-copy-directory)
    (tramp-compat-delete-file, tramp-compat-delete-directory)
    (tramp-compat-process-live-p): Remove them.
    
    * lisp/net/trampver.el: Make version check fit for Emacs 24.
---
 doc/misc/tramp.texi      |   8 +--
 lisp/net/tramp-adb.el    |   6 +-
 lisp/net/tramp-cache.el  |   2 +-
 lisp/net/tramp-compat.el | 141 ++---------------------------------------------
 lisp/net/tramp-gvfs.el   |  47 +++++-----------
 lisp/net/tramp-sh.el     |  46 +++++-----------
 lisp/net/tramp-smb.el    |  26 ++++-----
 lisp/net/tramp.el        | 121 +++++++++++++++++-----------------------
 lisp/net/trampver.el     |   2 +-
 9 files changed, 106 insertions(+), 293 deletions(-)

diff --git a/doc/misc/tramp.texi b/doc/misc/tramp.texi
index 179578e..4ca3932 100644
--- a/doc/misc/tramp.texi
+++ b/doc/misc/tramp.texi
@@ -2553,9 +2553,8 @@ when using @value{tramp} between two hosts with different 
operating
 systems, such as @samp{windows-nt} and @samp{gnu/linux}.  This option
 ensures the correct name of the remote shell program.
 
-Starting with Emacs 24, when @option{explicit-shell-file-name} is
-equal to @code{nil}, calling @code{shell} interactively will prompt
-for a shell name.
+When @option{explicit-shell-file-name} is equal to @code{nil}, calling
address@hidden interactively will prompt for a shell name.
 
 Starting with Emacs 26, you could use connection-local variables for
 setting different values of @option{explicit-shell-file-name} for
@@ -2856,8 +2855,7 @@ Where is the latest @value{tramp}?
 @item
 Which systems does it work on?
 
-The package works successfully on Emacs 23, Emacs 24, Emacs 25, and
-Emacs 26.
+The package works successfully on Emacs 24, Emacs 25, and Emacs 26.
 
 While Unix and Unix-like systems are the primary remote targets,
 @value{tramp} has equal success connecting to other platforms, such as
diff --git a/lisp/net/tramp-adb.el b/lisp/net/tramp-adb.el
index 1c894c9..a6c2c14 100644
--- a/lisp/net/tramp-adb.el
+++ b/lisp/net/tramp-adb.el
@@ -206,7 +206,7 @@ pass to the OPERATION."
        (tramp-message v 6 "%s" (mapconcat 'identity (process-command p) " "))
        (process-put p 'adjust-window-size-function 'ignore)
        (set-process-query-on-exit-flag p nil)
-       (while (tramp-compat-process-live-p p)
+       (while (process-live-p p)
          (accept-process-output p 0.1))
        (accept-process-output p 0.1)
        (tramp-message v 6 "\n%s" (buffer-string))
@@ -1210,7 +1210,7 @@ connection if a previous connection has died for some 
reason."
     (when (and user (not (tramp-get-file-property vec "" "su-command-p" t)))
       (tramp-error vec 'file-error "Cannot switch to user `%s'" user))
 
-    (unless (tramp-compat-process-live-p p)
+    (unless (process-live-p p)
       (save-match-data
        (when (and p (processp p)) (delete-process p))
        (if (zerop (length device))
@@ -1229,7 +1229,7 @@ connection if a previous connection has died for some 
reason."
             vec 6 "%s" (mapconcat 'identity (process-command p) " "))
            ;; Wait for initial prompt.
            (tramp-adb-wait-for-output p 30)
-           (unless (tramp-compat-process-live-p p)
+           (unless (process-live-p p)
              (tramp-error  vec 'file-error "Terminated!"))
            (tramp-set-connection-property p "vector" vec)
            (process-put p 'adjust-window-size-function 'ignore)
diff --git a/lisp/net/tramp-cache.el b/lisp/net/tramp-cache.el
index a9a1c66..a863860 100644
--- a/lisp/net/tramp-cache.el
+++ b/lisp/net/tramp-cache.el
@@ -250,7 +250,7 @@ value is not set for the connection, returns DEFAULT."
         (value
          ;; If the key is an auxiliary process object, check whether
          ;; the process is still alive.
-         (if (and (processp key) (not (tramp-compat-process-live-p key)))
+         (if (and (processp key) (not (process-live-p key)))
              default
            (if (hash-table-p hash)
                (gethash property hash default)
diff --git a/lisp/net/tramp-compat.el b/lisp/net/tramp-compat.el
index 392a28c..c998df8 100644
--- a/lisp/net/tramp-compat.el
+++ b/lisp/net/tramp-compat.el
@@ -24,8 +24,7 @@
 ;;; Commentary:
 
 ;; Tramp's main Emacs version for development is Emacs 26.  This
-;; package provides compatibility functions for Emacs 23, Emacs 24 and
-;; Emacs 25.
+;; package provides compatibility functions for Emacs 24 and Emacs 25.
 
 ;;; Code:
 
@@ -43,12 +42,6 @@
 (require 'trampver)
 (require 'tramp-loaddefs)
 
-;; `remote-file-name-inhibit-cache' has been introduced with Emacs
-;; 24.1.  Besides t, nil, and integer, we use also timestamps (as
-;; returned by `current-time') internally.
-(unless (boundp 'remote-file-name-inhibit-cache)
-  (defvar remote-file-name-inhibit-cache nil))
-
 ;; For not existing functions, obsolete functions, or functions with a
 ;; changed argument list, there are compiler warnings.  We want to
 ;; avoid them in cases we know what we do.
@@ -84,22 +77,6 @@
       'file-expand-wildcards 'around 'tramp-advice-file-expand-wildcards)
      (ad-activate 'file-expand-wildcards))))
 
-;; `condition-case-unless-debug' is introduced with Emacs 24.
-(if (fboundp 'condition-case-unless-debug)
-    (defalias 'tramp-compat-condition-case-unless-debug
-      'condition-case-unless-debug)
-  (defmacro tramp-compat-condition-case-unless-debug
-    (var bodyform &rest handlers)
-  "Like `condition-case' except that it does not catch anything when 
debugging."
-    (declare (debug condition-case) (indent 2))
-    (let ((bodysym (make-symbol "body")))
-      `(let ((,bodysym (lambda () ,bodyform)))
-        (if debug-on-error
-            (funcall ,bodysym)
-          (condition-case ,var
-              (funcall ,bodysym)
-            ,@handlers))))))
-
 (defsubst tramp-compat-temporary-file-directory ()
   "Return name of directory for temporary files.
 It is the default value of `temporary-file-directory'."
@@ -123,103 +100,6 @@ Add the extension of F, if existing."
       'temporary-file-directory
     'tramp-handle-temporary-file-directory))
 
-;; PRESERVE-EXTENDED-ATTRIBUTES has been introduced with Emacs 24.1
-;; (as PRESERVE-SELINUX-CONTEXT), and renamed in Emacs 24.3.
-(defun tramp-compat-copy-file
-  (filename newname &optional ok-if-already-exists keep-date
-   preserve-uid-gid preserve-extended-attributes)
-  "Like `copy-file' for Tramp files (compat function)."
-  (cond
-   (preserve-extended-attributes
-    (condition-case nil
-       (tramp-compat-funcall
-        'copy-file filename newname ok-if-already-exists keep-date
-        preserve-uid-gid preserve-extended-attributes)
-      (wrong-number-of-arguments
-       (copy-file
-       filename newname ok-if-already-exists keep-date preserve-uid-gid))))
-   (t
-    (copy-file
-     filename newname ok-if-already-exists keep-date preserve-uid-gid))))
-
-;; COPY-CONTENTS has been introduced with Emacs 24.1.
-(defun tramp-compat-copy-directory
-  (directory newname &optional keep-time parents copy-contents)
-  "Make a copy of DIRECTORY (compat function)."
-  (condition-case nil
-      (tramp-compat-funcall
-       'copy-directory directory newname keep-time parents copy-contents)
-
-    ;; `copy-directory' is either not implemented, or it does not
-    ;; support the the COPY-CONTENTS flag.  For the time being, we
-    ;; ignore COPY-CONTENTS as well.
-
-    (error
-     ;; If `default-directory' is a remote directory, make sure we
-     ;; find its `copy-directory' handler.
-     (let ((handler (or (find-file-name-handler directory 'copy-directory)
-                       (find-file-name-handler newname 'copy-directory))))
-       (if handler
-          (funcall handler 'copy-directory directory newname keep-time parents)
-
-        ;; Compute target name.
-        (setq directory (directory-file-name (expand-file-name directory))
-              newname   (directory-file-name (expand-file-name newname)))
-        (if (and (file-directory-p newname)
-                 (not (string-equal (file-name-nondirectory directory)
-                                    (file-name-nondirectory newname))))
-            (setq newname
-                  (expand-file-name
-                   (file-name-nondirectory directory) newname)))
-        (if (not (file-directory-p newname)) (make-directory newname parents))
-
-        ;; Copy recursively.
-        (mapc
-         (lambda (file)
-           (if (file-directory-p file)
-               (tramp-compat-copy-directory file newname keep-time parents)
-             (copy-file file newname t keep-time)))
-         ;; We do not want to delete "." and "..".
-         (directory-files directory 'full directory-files-no-dot-files-regexp))
-
-        ;; Set directory attributes.
-        (set-file-modes newname (file-modes directory))
-        (if keep-time
-            (set-file-times newname (nth 5 (file-attributes directory)))))))))
-
-;; TRASH has been introduced with Emacs 24.1.
-(defun tramp-compat-delete-file (filename &optional trash)
-  "Like `delete-file' for Tramp files (compat function)."
-  (condition-case nil
-      (tramp-compat-funcall 'delete-file filename trash)
-    ;; This Emacs version does not support the TRASH flag.
-    (wrong-number-of-arguments
-     (let ((delete-by-moving-to-trash (and delete-by-moving-to-trash trash)))
-       (delete-file filename)))))
-
-;; RECURSIVE has been introduced with Emacs 23.2.  TRASH has been
-;; introduced with Emacs 24.1.
-(defun tramp-compat-delete-directory (directory &optional recursive trash)
-  "Like `delete-directory' for Tramp files (compat function)."
-  (condition-case nil
-      (cond
-       (trash
-       (tramp-compat-funcall 'delete-directory directory recursive trash))
-       (t
-       (delete-directory directory recursive)))
-    ;; This Emacs version does not support the TRASH flag.  We use the
-    ;; implementation from Emacs 23.2.
-    (wrong-number-of-arguments
-     (setq directory (directory-file-name (expand-file-name directory)))
-     (when (not (file-symlink-p directory))
-       (mapc (lambda (file)
-              (if (eq t (car (file-attributes file)))
-                  (tramp-compat-delete-directory file recursive trash)
-                (tramp-compat-delete-file file trash)))
-            (directory-files
-             directory 'full directory-files-no-dot-files-regexp)))
-     (delete-directory directory))))
-
 (defun tramp-compat-process-running-p (process-name)
   "Returns t if system process PROCESS-NAME is running for `user-login-name'."
   (when (stringp process-name)
@@ -244,19 +124,6 @@ Add the extension of F, if existing."
                                     process-name))))
              (setq result t)))))))))
 
-;; `process-running-live-p' is introduced in Emacs 24.
-(defalias 'tramp-compat-process-live-p
-  (if (fboundp 'process-running-live-p)
-      'process-running-live-p
-    (lambda (process)
-      "Returns non-nil if PROCESS is alive.
-A process is considered alive if its status is `run', `open',
-`listen', `connect' or `stop'.  Value is nil if PROCESS is not a
-process."
-      (and (processp process)
-          (memq (process-status process)
-                '(run open listen connect stop))))))
-
 ;; `user-error' has appeared in Emacs 24.3.
 (defsubst tramp-compat-user-error (vec-or-proc format &rest args)
   "Signal a pilot error."
@@ -323,15 +190,15 @@ This is a floating point number if the size is too large 
for an integer."
 This is a string of ten letters or dashes as in ls -l."
     (nth 8 attributes)))
 
-;; `default-toplevel-value' has been declared in Emacs 24.
+;; `default-toplevel-value' has been declared in Emacs 24.4.
 (unless (fboundp 'default-toplevel-value)
   (defalias 'default-toplevel-value 'symbol-value))
 
-;; `format-message' is new in Emacs 25.
+;; `format-message' is new in Emacs 25.1.
 (unless (fboundp 'format-message)
   (defalias 'format-message 'format))
 
-;; `file-missing' is introduced in Emacs 26.
+;; `file-missing' is introduced in Emacs 26.1.
 (defconst tramp-file-missing
   (if (get 'file-missing 'error-conditions) 'file-missing 'file-error)
   "The error symbol for the `file-missing' error.")
diff --git a/lisp/net/tramp-gvfs.el b/lisp/net/tramp-gvfs.el
index 57a1351..c016c7e 100644
--- a/lisp/net/tramp-gvfs.el
+++ b/lisp/net/tramp-gvfs.el
@@ -39,7 +39,7 @@
 ;; All actions to mount a remote location, and to retrieve mount
 ;; information, are performed by D-Bus messages.  File operations
 ;; themselves are performed via the mounted filesystem in ~/.gvfs.
-;; Consequently, GNU Emacs 23.1 with enabled D-Bus bindings is a
+;; Consequently, GNU Emacs with enabled D-Bus bindings is a
 ;; precondition.
 
 ;; The GVFS D-Bus interface is said to be unstable.  There were even
@@ -158,7 +158,6 @@
 (defconst tramp-gvfs-service-daemon "org.gtk.vfs.Daemon"
   "The well known name of the GVFS daemon.")
 
-;; D-Bus integration is available since Emacs 23 on some system types.
 ;; We don't call `dbus-ping', because this would load dbus.el.
 (defconst tramp-gvfs-enabled
   (ignore-errors
@@ -666,19 +665,10 @@ file names."
                (and t2 (not (tramp-gvfs-file-name-p newname))))
 
            ;; We cannot copy or rename directly.
-           ;; PRESERVE-EXTENDED-ATTRIBUTES has been introduced with
-           ;; Emacs 24.1 (as PRESERVE-SELINUX-CONTEXT), and renamed
-           ;; in Emacs 24.3.
            (let ((tmpfile (tramp-compat-make-temp-file filename)))
-             (cond
-              (preserve-extended-attributes
-               (funcall
-                file-operation
-                filename tmpfile t keep-date preserve-uid-gid
-                preserve-extended-attributes))
-              (t
-               (funcall
-                file-operation filename tmpfile t keep-date preserve-uid-gid)))
+             (funcall
+              file-operation filename tmpfile t keep-date preserve-uid-gid
+              preserve-extended-attributes)
              (rename-file tmpfile newname ok-if-already-exists))
 
          ;; Direct action.
@@ -729,25 +719,16 @@ file names."
   "Like `copy-file' for Tramp files."
   (setq filename (expand-file-name filename))
   (setq newname (expand-file-name newname))
-  (cond
-   ;; At least one file a Tramp file?
-   ((or (tramp-tramp-file-p filename)
-       (tramp-tramp-file-p newname))
-    (tramp-gvfs-do-copy-or-rename-file
-     'copy filename newname ok-if-already-exists keep-date
-     preserve-uid-gid preserve-extended-attributes))
-   ;; Compat section.  PRESERVE-EXTENDED-ATTRIBUTES has been
-   ;; introduced with Emacs 24.1 (as PRESERVE-SELINUX-CONTEXT), and
-   ;; renamed in Emacs 24.3.
-   (preserve-extended-attributes
+  ;; At least one file a Tramp file?
+  (if (or (tramp-tramp-file-p filename)
+         (tramp-tramp-file-p newname))
+      (tramp-gvfs-do-copy-or-rename-file
+       'copy filename newname ok-if-already-exists keep-date
+       preserve-uid-gid preserve-extended-attributes)
     (tramp-run-real-handler
      'copy-file
      (list filename newname ok-if-already-exists keep-date
-          preserve-uid-gid preserve-extended-attributes)))
-   (t
-    (tramp-run-real-handler
-     'copy-file
-     (list filename newname ok-if-already-exists keep-date 
preserve-uid-gid)))))
+          preserve-uid-gid preserve-extended-attributes))))
 
 (defun tramp-gvfs-handle-delete-directory (directory &optional recursive trash)
   "Like `delete-directory' for Tramp files."
@@ -756,8 +737,8 @@ file names."
        (mapc (lambda (file)
                (if (eq t (tramp-compat-file-attribute-type
                           (file-attributes file)))
-                   (tramp-compat-delete-directory file recursive trash)
-                 (tramp-compat-delete-file file trash)))
+                   (delete-directory file recursive trash)
+                 (delete-file file trash)))
              (directory-files
               directory 'full directory-files-no-dot-files-regexp))
       (when (directory-files directory nil directory-files-no-dot-files-regexp)
@@ -1089,7 +1070,7 @@ file names."
        ;; There might be an error if the monitor is not supported.
        ;; Give the filter a chance to read the output.
        (tramp-accept-process-output p 1)
-       (unless (tramp-compat-process-live-p p)
+       (unless (process-live-p p)
          (tramp-error
           v 'file-notify-error "Monitoring not supported for `%s'" file-name))
        p))))
diff --git a/lisp/net/tramp-sh.el b/lisp/net/tramp-sh.el
index 84782a4..2541fcf 100644
--- a/lisp/net/tramp-sh.el
+++ b/lisp/net/tramp-sh.el
@@ -1303,13 +1303,7 @@ target of the symlink differ."
         (when (> (buffer-size) 0)
           (goto-char (point-min))
           ;; ... inode
-          (setq res-inode
-                (condition-case err
-                    (read (current-buffer))
-                  ;; This error happens in Emacs 23.  Starting with
-                  ;; Emacs 24, a large integer will be converted into
-                  ;; a float automatically during `read'.
-                  (overflow-error (string-to-number (cadr err)))))
+          (setq res-inode (read (current-buffer)))
           ;; ... file mode flags
           (setq res-filemodes (symbol-name (read (current-buffer))))
           ;; ... number links
@@ -1950,27 +1944,17 @@ tramp-sh-handle-file-name-all-completions: internal 
error accessing `%s': `%s'"
   (filename newname &optional ok-if-already-exists keep-date
    preserve-uid-gid preserve-extended-attributes)
   "Like `copy-file' for Tramp files."
-  (setq filename (expand-file-name filename))
-  (setq newname (expand-file-name newname))
-  (cond
-   ;; At least one file a Tramp file?
-   ((or (tramp-tramp-file-p filename)
-       (tramp-tramp-file-p newname))
-    (tramp-do-copy-or-rename-file
-     'copy filename newname ok-if-already-exists keep-date
-     preserve-uid-gid preserve-extended-attributes))
-   ;; Compat section.  PRESERVE-EXTENDED-ATTRIBUTES has been
-   ;; introduced with Emacs 24.1 (as PRESERVE-SELINUX-CONTEXT), and
-   ;; renamed in Emacs 24.3.
-   (preserve-extended-attributes
+  (setq filename (expand-file-name filename)
+       newname (expand-file-name newname))
+  (if (or (tramp-tramp-file-p filename)
+         (tramp-tramp-file-p newname))
+      (tramp-do-copy-or-rename-file
+       'copy filename newname ok-if-already-exists keep-date
+       preserve-uid-gid preserve-extended-attributes)
     (tramp-run-real-handler
      'copy-file
      (list filename newname ok-if-already-exists keep-date
-          preserve-uid-gid preserve-extended-attributes)))
-   (t
-    (tramp-run-real-handler
-     'copy-file
-     (list filename newname ok-if-already-exists keep-date 
preserve-uid-gid)))))
+          preserve-uid-gid preserve-extended-attributes))))
 
 (defun tramp-sh-handle-copy-directory
   (dirname newname &optional keep-date parents copy-contents)
@@ -2814,7 +2798,7 @@ the result will be a local, non-Tramp, file name."
 
 (defun tramp-process-sentinel (proc event)
   "Flush file caches."
-  (unless (tramp-compat-process-live-p proc)
+  (unless (process-live-p proc)
     (let ((vec (tramp-get-connection-property proc "vector" nil)))
       (when vec
        (tramp-message vec 5 "Sentinel called: `%S' `%s'" proc event)
@@ -3628,7 +3612,7 @@ Fall back to normal file name handler if no Tramp handler 
exists."
        ;; There might be an error if the monitor is not supported.
        ;; Give the filter a chance to read the output.
        (tramp-accept-process-output p 1)
-       (unless (tramp-compat-process-live-p p)
+       (unless (process-live-p p)
          (tramp-error
           v 'file-notify-error "Monitoring not supported for `%s'" file-name))
        p))))
@@ -4620,7 +4604,7 @@ connection if a previous connection has died for some 
reason."
 
     ;; If Tramp opens the same connection within a short time frame,
     ;; there is a problem.  We shall signal this.
-    (unless (or (tramp-compat-process-live-p p)
+    (unless (or (process-live-p p)
                (not (tramp-file-name-equal-p
                      vec (car tramp-current-connection)))
                (> (tramp-time-diff
@@ -4641,9 +4625,9 @@ connection if a previous connection has died for some 
reason."
                       (tramp-get-connection-property
                        p "last-cmd-time" '(0 0 0)))
                      60)
-                  (tramp-compat-process-live-p p))
+                  (process-live-p p))
          (tramp-send-command vec "echo are you awake" t t)
-         (unless (and (tramp-compat-process-live-p p)
+         (unless (and (process-live-p p)
                       (tramp-wait-for-output p 10))
            ;; The error will be caught locally.
            (tramp-error vec 'file-error "Awake did fail")))
@@ -4653,7 +4637,7 @@ connection if a previous connection has died for some 
reason."
 
     ;; New connection must be opened.
     (condition-case err
-       (unless (tramp-compat-process-live-p p)
+       (unless (process-live-p p)
 
          ;; During completion, don't reopen a new connection.  We
          ;; check this for the process related to
diff --git a/lisp/net/tramp-smb.el b/lisp/net/tramp-smb.el
index 88db8ea..9ac2fc6 100644
--- a/lisp/net/tramp-smb.el
+++ b/lisp/net/tramp-smb.el
@@ -382,7 +382,7 @@ pass to the OPERATION."
 
 (defun tramp-smb-action-with-tar (proc vec)
   "Untar from connection buffer."
-  (if (not (tramp-compat-process-live-p proc))
+  (if (not (process-live-p proc))
       (throw 'tramp-action 'process-died)
 
     (with-current-buffer (tramp-get-connection-buffer vec)
@@ -516,7 +516,7 @@ pass to the OPERATION."
                      (set-process-query-on-exit-flag p nil)
                      (tramp-process-actions p v nil tramp-smb-actions-with-tar)
 
-                     (while (tramp-compat-process-live-p p)
+                     (while (process-live-p p)
                        (sit-for 0.1))
                      (tramp-message v 6 "\n%s" (buffer-string))))
 
@@ -561,7 +561,7 @@ PRESERVE-UID-GID and PRESERVE-EXTENDED-ATTRIBUTES are 
completely ignored."
       0 (format "Copying %s to %s" filename newname)
 
     (if (file-directory-p filename)
-       (tramp-compat-copy-directory
+       (copy-directory
         filename newname keep-date 'parents 'copy-contents)
 
       (let ((tmpfile (file-local-copy filename)))
@@ -708,7 +708,7 @@ PRESERVE-UID-GID and PRESERVE-EXTENDED-ATTRIBUTES are 
completely ignored."
 
 (defun tramp-smb-action-get-acl (proc vec)
   "Read ACL data from connection buffer."
-  (unless (tramp-compat-process-live-p proc)
+  (unless (process-live-p proc)
     ;; Accept pending output.
     (while (tramp-accept-process-output proc 0.1))
     (with-current-buffer (tramp-get-connection-buffer vec)
@@ -1224,7 +1224,7 @@ target of the symlink differ."
            (narrow-to-region (point-max) (point-max))
            (let ((p (tramp-get-connection-process v)))
              (tramp-smb-send-command v "exit $lasterrorcode")
-             (while (tramp-compat-process-live-p p)
+             (while (process-live-p p)
                (sleep-for 0.1)
                (setq ret (process-exit-status p))))
            (delete-region (point-min) (point-max))
@@ -1308,7 +1308,7 @@ target of the symlink differ."
 
 (defun tramp-smb-action-set-acl (proc vec)
   "Read ACL data from connection buffer."
-  (unless (tramp-compat-process-live-p proc)
+  (unless (process-live-p proc)
     ;; Accept pending output.
     (while (tramp-accept-process-output proc 0.1))
     (with-current-buffer (tramp-get-connection-buffer vec)
@@ -1724,7 +1724,7 @@ Result is the list (LOCALNAME MODE SIZE MTIME)."
 (defun tramp-smb-get-cifs-capabilities (vec)
   "Check, whether the SMB server supports POSIX commands."
   ;; When we are not logged in yet, we return nil.
-  (if (tramp-compat-process-live-p (tramp-get-connection-process vec))
+  (if (process-live-p (tramp-get-connection-process vec))
       (with-tramp-connection-property
          (tramp-get-connection-process vec) "cifs-capabilities"
        (save-match-data
@@ -1742,7 +1742,7 @@ Result is the list (LOCALNAME MODE SIZE MTIME)."
   "Check, whether the SMB server supports the STAT command."
   ;; When we are not logged in yet, we return nil.
   (if (and (tramp-smb-get-share vec)
-          (tramp-compat-process-live-p (tramp-get-connection-process vec)))
+          (process-live-p (tramp-get-connection-process vec)))
       (with-tramp-connection-property
          (tramp-get-connection-process vec) "stat-capability"
        (tramp-smb-send-command vec "stat \"/\""))))
@@ -1807,13 +1807,13 @@ If ARGUMENT is non-nil, use it as argument for
                     (tramp-get-connection-property
                      p "last-cmd-time" '(0 0 0)))
                    60)
-                (tramp-compat-process-live-p p)
+                (process-live-p p)
                 (re-search-forward tramp-smb-errors nil t))
        (delete-process p)
        (setq p nil)))
 
     ;; Check whether it is still the same share.
-    (unless (and (tramp-compat-process-live-p p)
+    (unless (and (process-live-p p)
                 (or argument
                     (string-equal
                      share
@@ -1949,7 +1949,7 @@ Returns nil if an error message has appeared."
       ;; Algorithm: get waiting output.  See if last line contains
       ;; `tramp-smb-prompt' sentinel or `tramp-smb-errors' strings.
       ;; If not, wait a bit and again get waiting output.
-      (while (and (not found) (not err) (tramp-compat-process-live-p p))
+      (while (and (not found) (not err) (process-live-p p))
 
        ;; Accept pending output.
        (tramp-accept-process-output p 0.1)
@@ -1963,7 +1963,7 @@ Returns nil if an error message has appeared."
        (setq err (re-search-forward tramp-smb-errors nil t)))
 
       ;; When the process is still alive, read pending output.
-      (while (and (not found) (tramp-compat-process-live-p p))
+      (while (and (not found) (process-live-p p))
 
        ;; Accept pending output.
        (tramp-accept-process-output p 0.1)
@@ -1987,7 +1987,7 @@ Returns nil if an error message has appeared."
   "Send SIGKILL to the winexe process."
   (ignore-errors
     (let ((p (get-buffer-process (current-buffer))))
-      (when (tramp-compat-process-live-p p)
+      (when (process-live-p p)
        (signal-process (process-id p) 'SIGINT)))))
 
 (defun tramp-smb-call-winexe (vec)
diff --git a/lisp/net/tramp.el b/lisp/net/tramp.el
index a1cd90b..e75305b 100644
--- a/lisp/net/tramp.el
+++ b/lisp/net/tramp.el
@@ -35,7 +35,7 @@
 ;; Notes:
 ;; -----
 ;;
-;; This package only works for Emacs 23.1 and higher.
+;; This package only works for Emacs 24.1 and higher.
 ;;
 ;; Also see the todo list at the bottom of this file.
 ;;
@@ -555,7 +555,8 @@ The `sudo' program appears to insert a `^@' character into 
the prompt."
                        "Sorry, try again."
                        "Name or service not known"
                        "Host key verification failed."
-                       "No supported authentication methods left to try!") t)
+                       "No supported authentication methods left to try!")
+                     t)
          ".*"
          "\\|"
          "^.*\\("
@@ -1502,7 +1503,6 @@ ARGUMENTS to actually emit the message (if applicable)."
                    "^"
                    (regexp-opt
                     '("tramp-backtrace"
-                      "tramp-compat-condition-case-unless-debug"
                       "tramp-compat-funcall"
                       "tramp-compat-user-error"
                       "tramp-condition-case-unless-debug"
@@ -1691,16 +1691,14 @@ without a visible progress reporter."
      (tramp-message ,vec ,level "%s..." ,message)
      (let ((cookie "failed")
            (tm
-            ;; We start a pulsing progress reporter after 3 seconds.  Feature
-            ;; introduced in Emacs 24.1.
+            ;; We start a pulsing progress reporter after 3 seconds.
             (when (and tramp-message-show-message
                        ;; Display only when there is a minimum level.
                        (<= ,level (min tramp-verbose 3)))
-              (ignore-errors
-                (let ((pr (make-progress-reporter ,message nil nil)))
-                  (when pr
-                    (run-at-time
-                    3 0.1 #'tramp-progress-reporter-update pr)))))))
+             (let ((pr (make-progress-reporter ,message nil nil)))
+               (when pr
+                 (run-at-time
+                  3 0.1 #'tramp-progress-reporter-update pr))))))
        (unwind-protect
            ;; Execute the body.
            (prog1 (progn ,@body) (setq cookie "done"))
@@ -1913,7 +1911,7 @@ value of `default-file-modes', without execute 
permissions."
  "Replace environment variables in FILENAME.
 Return the string with the replaced variables."
  (or (ignore-errors
-       ;; Optional arg has been introduced with Emacs 24 (?).
+       ;; Optional arg has been introduced with Emacs 24.4.
        (tramp-compat-funcall 'substitute-env-vars filename 'only-defined))
      ;; We need an own implementation.
      (save-match-data
@@ -1974,22 +1972,21 @@ ARGS are the arguments OPERATION has been called with."
            '(access-file byte-compiler-base-file-name delete-directory
              delete-file diff-latest-backup-file directory-file-name
              directory-files directory-files-and-attributes
-             dired-compress-file dired-uncache
+             dired-compress-file dired-uncache file-acl
              file-accessible-directory-p file-attributes
              file-directory-p file-executable-p file-exists-p
-             file-local-copy file-modes
-             file-name-as-directory file-name-directory
-             file-name-nondirectory file-name-sans-versions
+             file-local-copy file-modes file-name-as-directory
+             file-name-directory file-name-nondirectory
+             file-name-sans-versions file-notify-add-watch
              file-ownership-preserved-p file-readable-p
-             file-regular-p file-remote-p file-symlink-p file-truename
-             file-writable-p find-backup-file-name find-file-noselect
-             get-file-buffer insert-directory insert-file-contents
-             load make-directory make-directory-internal
-             set-file-modes set-file-times substitute-in-file-name
-             unhandled-file-name-directory vc-registered
-             ;; Emacs 24+ only.
-             file-acl file-notify-add-watch file-selinux-context
-             set-file-acl set-file-selinux-context
+             file-regular-p file-remote-p file-selinux-context
+             file-symlink-p file-truename file-writable-p
+             find-backup-file-name find-file-noselect get-file-buffer
+             insert-directory insert-file-contents load
+             make-directory make-directory-internal set-file-acl
+             set-file-modes set-file-selinux-context set-file-times
+             substitute-in-file-name unhandled-file-name-directory
+             vc-registered
              ;; Emacs 26+ only.
              file-name-case-insensitive-p))
     (if (file-name-absolute-p (nth 0 args))
@@ -1998,10 +1995,9 @@ ARGS are the arguments OPERATION has been called with."
    ;; FILE DIRECTORY resp FILE1 FILE2.
    ((member operation
            '(add-name-to-file copy-directory copy-file expand-file-name
+             file-equal-p file-in-directory-p
              file-name-all-completions file-name-completion
-             file-newer-than-file-p make-symbolic-link rename-file
-             ;; Emacs 24+ only.
-             file-equal-p file-in-directory-p))
+             file-newer-than-file-p make-symbolic-link rename-file))
     (save-match-data
       (cond
        ((tramp-tramp-file-p (nth 0 args)) (nth 0 args))
@@ -2026,8 +2022,7 @@ ARGS are the arguments OPERATION has been called with."
     default-directory)
    ;; PROC.
    ((member operation
-           '(;; Emacs 24+ only.
-             file-notify-rm-watch
+           '(file-notify-rm-watch
              ;; Emacs 25+ only.
              file-notify-valid-p))
     (when (processp (nth 0 args))
@@ -2056,7 +2051,7 @@ ARGS are the arguments OPERATION has been called with."
   (var bodyform &rest handlers)
   "Like `condition-case-unless-debug' but `tramp-debug-on-error'."
   `(let ((debug-on-error tramp-debug-on-error))
-     (tramp-compat-condition-case-unless-debug ,var ,bodyform ,@handlers)))
+     (condition-case-unless-debug ,var ,bodyform ,@handlers)))
 
 ;; Main function.
 (defun tramp-file-name-handler (operation &rest args)
@@ -2308,8 +2303,8 @@ Add operations defined in `HANDLER-alist' to 
`tramp-file-name-handler'."
 (defun tramp-completion-mode-p ()
   "Check, whether method / user name / host name completion is active."
   (or
-   ;; Signal from outside.  `non-essential' has been introduced in Emacs 24.
-   (bound-and-true-p non-essential)
+   ;; Signal from outside.
+   non-essential
    ;; This variable has been obsoleted in Emacs 26.
    tramp-completion-mode))
 
@@ -2320,7 +2315,7 @@ not in completion mode."
   (let (tramp-verbose)
     (and (tramp-tramp-file-p filename)
         (or (not (tramp-completion-mode-p))
-            (tramp-compat-process-live-p
+            (process-live-p
              (tramp-get-connection-process
               (tramp-dissect-file-name filename)))))))
 
@@ -2986,7 +2981,7 @@ User is always nil."
     (when (tramp-tramp-file-p filename)
       (let* ((v (tramp-dissect-file-name filename))
             (p (tramp-get-connection-process v))
-            (c (and (tramp-compat-process-live-p p)
+            (c (and (process-live-p p)
                     (tramp-get-connection-property p "connected" nil))))
        ;; We expand the file name only, if there is already a connection.
        (with-parsed-tramp-file-name
@@ -3399,7 +3394,7 @@ of."
 
 (defun tramp-handle-file-notify-valid-p (proc)
   "Like `file-notify-valid-p' for Tramp files."
-  (and (tramp-compat-process-live-p proc)
+  (and (process-live-p proc)
        ;; Sometimes, the process is still in status `run' when the
        ;; file or directory to be watched is deleted already.
        (with-current-buffer (process-buffer proc)
@@ -3494,14 +3489,14 @@ The terminal type can be configured with 
`tramp-terminal-type'."
 
 (defun tramp-action-process-alive (proc _vec)
   "Check, whether a process has finished."
-  (unless (tramp-compat-process-live-p proc)
+  (unless (process-live-p proc)
     (throw 'tramp-action 'process-died)))
 
 (defun tramp-action-out-of-band (proc vec)
   "Check, whether an out-of-band copy has finished."
   ;; There might be pending output for the exit status.
   (tramp-accept-process-output proc 0.1)
-  (cond ((and (not (tramp-compat-process-live-p proc))
+  (cond ((and (not (process-live-p proc))
              (zerop (process-exit-status proc)))
         (tramp-message vec 3 "Process has finished.")
         (throw 'tramp-action 'ok))
@@ -3614,7 +3609,7 @@ for process communication also."
                (lambda (key _value)
                  (and (processp key)
                       (not (string-prefix-p "*tramp/" (process-name key)))
-                      (tramp-compat-process-live-p key)
+                      (process-live-p key)
                       (setq result t)))
                tramp-cache-data)
               result))
@@ -3678,14 +3673,14 @@ nil."
             (with-timeout (timeout)
               (while (not found)
                 (tramp-accept-process-output proc 1)
-                (unless (tramp-compat-process-live-p proc)
+                (unless (process-live-p proc)
                   (tramp-error-with-buffer
                    nil proc 'file-error "Process has died"))
                 (setq found (tramp-check-for-regexp proc regexp)))))
            (t
             (while (not found)
               (tramp-accept-process-output proc 1)
-              (unless (tramp-compat-process-live-p proc)
+              (unless (process-live-p proc)
                 (tramp-error-with-buffer
                  nil proc 'file-error "Process has died"))
               (setq found (tramp-check-for-regexp proc regexp)))))
@@ -4221,32 +4216,25 @@ Invokes `password-read' if available, `read-passwd' 
else."
          (prog1
              (or
               ;; See if auth-sources contains something useful.
-              ;; `auth-source-user-or-password' is an obsoleted
-              ;; function since Emacs 24.1, it has been replaced by
-              ;; `auth-source-search'.
               (ignore-errors
                 (and (tramp-get-connection-property
                       v "first-password-request" nil)
                      ;; Try with Tramp's current method.
-                     (if (fboundp 'auth-source-search)
-                         (setq auth-info
-                               (auth-source-search
-                                :max 1
-                                (and tramp-current-user :user)
-                                     tramp-current-user
-                                :host tramp-current-host
-                                :port tramp-current-method
-                                :require
-                                (cons
-                                 :secret (and tramp-current-user '(:user))))
-                               auth-passwd (plist-get
-                                            (nth 0 auth-info) :secret)
-                               auth-passwd (if (functionp auth-passwd)
-                                               (funcall auth-passwd)
-                                             auth-passwd))
-                       (tramp-compat-funcall
-                        'auth-source-user-or-password
-                        "password" tramp-current-host tramp-current-method))))
+                     (setq auth-info
+                           (auth-source-search
+                            :max 1
+                            (and tramp-current-user :user)
+                            tramp-current-user
+                            :host tramp-current-host
+                            :port tramp-current-method
+                            :require
+                            (cons
+                             :secret (and tramp-current-user '(:user))))
+                           auth-passwd (plist-get
+                                        (nth 0 auth-info) :secret)
+                           auth-passwd (if (functionp auth-passwd)
+                                           (funcall auth-passwd)
+                                         auth-passwd))))
               ;; Try the password cache.
               (let ((password (password-read pw-prompt key)))
                 (password-cache-add key password)
@@ -4275,13 +4263,8 @@ Invokes `password-read' if available, `read-passwd' 
else."
         (replace-regexp-in-string
          (concat tramp-postfix-hop-regexp "$")
          (tramp-postfix-host-format) hop)))))
-    ;; `auth-source-forget-user-or-password' is an obsoleted function
-    ;; since Emacs 24.1, it has been replaced by `auth-source-forget'.
-    (if (fboundp 'auth-source-forget)
-       (auth-source-forget
-        `(:max 1 ,(and user :user) ,user :host ,host :port ,method))
-      (tramp-compat-funcall
-       'auth-source-forget-user-or-password "password" host method))
+    (auth-source-forget
+     `(:max 1 ,(and user :user) ,user :host ,host :port ,method))
     (password-cache-remove
      (tramp-make-tramp-file-name method user domain host port ""))))
 
diff --git a/lisp/net/trampver.el b/lisp/net/trampver.el
index e770ecc..387a3c8 100644
--- a/lisp/net/trampver.el
+++ b/lisp/net/trampver.el
@@ -53,7 +53,7 @@
               (replace-regexp-in-string "\n" "" (buffer-string))))))))
 
 ;; Check for Emacs version.
-(let ((x (if (>= emacs-major-version 23)
+(let ((x (if (>= emacs-major-version 24)
     "ok"
   (format "Tramp 2.3.2-pre is not fit for %s"
          (when (string-match "^.*$" (emacs-version))



reply via email to

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