From ead5edc08672fc010ae21019a692c7bdb73ac395 Mon Sep 17 00:00:00 2001 From: Glenn Morris Date: Thu, 24 May 2012 16:40:19 -0400 Subject: [PATCH] Move prune-directory-list, remote-shell-program from paths.el to files.el * lisp/paths.el (prune-directory-list, remote-shell-program): Move to ... * lisp/files.el (prune-directory-list, remote-shell-program): ...here. For the latter, delay initialization, prefer ssh, just search PATH. --- lisp/ChangeLog | 4 ++++ lisp/files.el | 41 +++++++++++++++++++++++++++++++++++++++++ lisp/paths.el | 41 ----------------------------------------- 3 files changed, 45 insertions(+), 41 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 8e9b88a6016..be684c559f9 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,5 +1,9 @@ 2012-05-24 Glenn Morris + * paths.el (prune-directory-list, remote-shell-program): Move to... + * files.el (prune-directory-list, remote-shell-program): ...here. + For the latter, delay initialization, prefer ssh, just search PATH. + * paths.el (term-file-prefix): Move to faces.el (the only user). * faces.el (term-file-prefix): Move here, make it a defcustom. diff --git a/lisp/files.el b/lisp/files.el index 6691b362292..a6961f8dd03 100644 --- a/lisp/files.el +++ b/lisp/files.el @@ -986,6 +986,29 @@ Tip: You can use this expansion of remote identifier components (funcall handler 'file-remote-p file identification connected) nil))) +;; Probably this entire variable should be obsolete now, in favor of +;; something Tramp-related (?). It is not used in many places. +;; It's not clear what the best file for this to be in is, but given +;; it uses custom-initialize-delay, it is easier if it is preloaded +;; rather than autoloaded. +(defcustom remote-shell-program + ;; This used to try various hard-coded places for remsh, rsh, and + ;; rcmd, trying to guess based on location whether "rsh" was + ;; "restricted shell" or "remote shell", but I don't see the point + ;; in this day and age. Almost everyone will use ssh, and have + ;; whatever command they want to use in PATH. + (purecopy + (let ((list '("ssh" "slogin" "rlogin" "remsh" "rcmd" "rsh"))) + (while (and list + (not (executable-find (car list))) + (setq list (cdr list)))) + (or (car list) "ssh"))) + "Program to use to execute commands on a remote host (e.g. ssh or rsh)." + :version "24.2" ; ssh rather than rsh, etc + :initialize 'custom-initialize-delay + :group 'environment + :type 'file) + (defcustom remote-file-name-inhibit-cache 10 "Whether to use the remote file-name cache for read access. When `nil', never expire cached values (caution) @@ -5125,6 +5148,24 @@ directly into NEWNAME instead." (times (and keep-time (nth 5 (file-attributes directory))))) (if modes (set-file-modes newname modes)) (if times (set-file-times newname times)))))) + + +;; At time of writing, only info uses this. +(defun prune-directory-list (dirs &optional keep reject) + "Return a copy of DIRS with all non-existent directories removed. +The optional argument KEEP is a list of directories to retain even if +they don't exist, and REJECT is a list of directories to remove from +DIRS, even if they exist; REJECT takes precedence over KEEP. + +Note that membership in REJECT and KEEP is checked using simple string +comparison." + (apply #'nconc + (mapcar (lambda (dir) + (and (not (member dir reject)) + (or (member dir keep) (file-directory-p dir)) + (list dir))) + dirs))) + (put 'revert-buffer-function 'permanent-local t) (defvar revert-buffer-function nil diff --git a/lisp/paths.el b/lisp/paths.el index f44a0e660fc..8ed05344f0a 100644 --- a/lisp/paths.el +++ b/lisp/paths.el @@ -35,22 +35,6 @@ ;; conventions described in make-docfile, so that they get put in the ;; DOC file rather than in memory. -(defun prune-directory-list (dirs &optional keep reject) - "\ -Return a copy of DIRS with all non-existent directories removed. -The optional argument KEEP is a list of directories to retain even if -they don't exist, and REJECT is a list of directories to remove from -DIRS, even if they exist; REJECT takes precedence over KEEP. - -Note that membership in REJECT and KEEP is checked using simple string -comparison." - (apply #'nconc - (mapcar (lambda (dir) - (and (not (member dir reject)) - (or (member dir keep) (file-directory-p dir)) - (list dir))) - dirs))) - (defvar Info-default-directory-list (let* ((config-dir (file-name-as-directory configure-info-directory)) @@ -101,30 +85,5 @@ This variable `Info-default-directory-list' is used as the default for initializing `Info-directory-list' when Info is started, unless the environment variable INFOPATH is set.") -(defcustom remote-shell-program - (purecopy - (cond - ;; Some systems use rsh for the remote shell; others use that name for the - ;; restricted shell and use remsh for the remote shell. Let's try to guess - ;; based on what we actually find out there. The restricted shell is - ;; almost certainly in /bin or /usr/bin, so it's probably safe to assume - ;; that an rsh found elsewhere is the remote shell program. The converse - ;; is not true: /usr/bin/rsh could be either one, so check that last. - ((file-exists-p "/usr/ucb/remsh") "/usr/ucb/remsh") - ((file-exists-p "/usr/bsd/remsh") "/usr/bsd/remsh") - ((file-exists-p "/bin/remsh") "/bin/remsh") - ((file-exists-p "/usr/bin/remsh") "/usr/bin/remsh") - ((file-exists-p "/usr/local/bin/remsh") "/usr/local/bin/remsh") - ((file-exists-p "/usr/ucb/rsh") "/usr/ucb/rsh") - ((file-exists-p "/usr/bsd/rsh") "/usr/bsd/rsh") - ((file-exists-p "/usr/local/bin/rsh") "/usr/local/bin/rsh") - ((file-exists-p "/usr/bin/rcmd") "/usr/bin/rcmd") - ((file-exists-p "/bin/rcmd") "/bin/rcmd") - ((file-exists-p "/bin/rsh") "/bin/rsh") - ((file-exists-p "/usr/bin/rsh") "/usr/bin/rsh") - (t "rsh"))) - "File name for remote-shell program (often rsh or remsh)." - :group 'environment - :type 'file) ;;; paths.el ends here -- 2.11.4.GIT