;;; em-dirs.el --- directory navigation commands
-;; Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004,
-;; 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
+;; Copyright (C) 1999-2011 Free Software Foundation, Inc.
;; Author: John Wiegley <johnw@gnu.org>
;; This file is part of GNU Emacs.
-;; GNU Emacs is free software; you can redistribute it and/or modify
+;; GNU Emacs is free software: you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
-;; the Free Software Foundation; either version 3, or (at your option)
-;; any later version.
+;; the Free Software Foundation, either version 3 of the License, or
+;; (at your option) any later version.
;; GNU Emacs is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; GNU General Public License for more details.
;; You should have received a copy of the GNU General Public License
-;; along with GNU Emacs; see the file COPYING. If not, write to the
-;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
-;; Boston, MA 02110-1301, USA.
+;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
;;; Commentary:
(require 'ring)
(require 'esh-opt)
-(defgroup eshell-dirs nil
+;;;###autoload
+(eshell-defgroup eshell-dirs nil
"Directory navigation involves changing directories, examining the
current directory, maintaining a directory stack, and also keeping
track of a history of the last directory locations the user was in.
;;; User Variables:
-(defcustom eshell-dirs-load-hook '(eshell-dirs-initialize)
- "*A hook that gets run when `eshell-dirs' is loaded."
+(defcustom eshell-dirs-load-hook nil
+ "A hook that gets run when `eshell-dirs' is loaded."
+ :version "24.1" ; removed eshell-dirs-initialize
:type 'hook
:group 'eshell-dirs)
(defcustom eshell-pwd-convert-function (if (eshell-under-windows-p)
'expand-file-name
'identity)
- "*The function used to normalize the value of Eshell's `pwd'.
+ "The function used to normalize the value of Eshell's `pwd'.
The value returned by `pwd' is also used when recording the
last-visited directory in the last-dir-ring, so it will affect the
form of the list used by 'cd ='."
:group 'eshell-dirs)
(defcustom eshell-ask-to-save-last-dir 'always
- "*Determine if the last-dir-ring should be automatically saved.
+ "Determine if the last-dir-ring should be automatically saved.
The last-dir-ring is always preserved when exiting an Eshell buffer.
However, when Emacs is being shut down, this variable determines
whether to prompt the user, or just save the ring.
:group 'eshell-dirs)
(defcustom eshell-cd-shows-directory nil
- "*If non-nil, using `cd' will report the directory it changes to."
+ "If non-nil, using `cd' will report the directory it changes to."
:type 'boolean
:group 'eshell-dirs)
(defcustom eshell-cd-on-directory t
- "*If non-nil, do a cd if a directory is in command position."
+ "If non-nil, do a cd if a directory is in command position."
:type 'boolean
:group 'eshell-dirs)
(defcustom eshell-directory-change-hook nil
- "*A hook to run when the current directory changes."
+ "A hook to run when the current directory changes."
:type 'hook
:group 'eshell-dirs)
(defcustom eshell-list-files-after-cd nil
- "*If non-nil, call \"ls\" with any remaining args after doing a cd.
+ "If non-nil, call \"ls\" with any remaining args after doing a cd.
This is provided for convenience, since the same effect is easily
achieved by adding a function to `eshell-directory-change-hook' that
calls \"ls\" and references `eshell-last-arguments'."
:group 'eshell-dirs)
(defcustom eshell-pushd-tohome nil
- "*If non-nil, make pushd with no arg behave as 'pushd ~' (like `cd').
+ "If non-nil, make pushd with no arg behave as 'pushd ~' (like `cd').
This mirrors the optional behavior of tcsh."
:type 'boolean
:group 'eshell-dirs)
(defcustom eshell-pushd-dextract nil
- "*If non-nil, make \"pushd +n\" pop the nth dir to the stack top.
+ "If non-nil, make \"pushd +n\" pop the nth dir to the stack top.
This mirrors the optional behavior of tcsh."
:type 'boolean
:group 'eshell-dirs)
(defcustom eshell-pushd-dunique nil
- "*If non-nil, make pushd only add unique directories to the stack.
+ "If non-nil, make pushd only add unique directories to the stack.
This mirrors the optional behavior of tcsh."
:type 'boolean
:group 'eshell-dirs)
(defcustom eshell-dirtrack-verbose t
- "*If non-nil, show the directory stack following directory change.
+ "If non-nil, show the directory stack following directory change.
This is effective only if directory tracking is enabled."
:type 'boolean
:group 'eshell-dirs)
(defcustom eshell-last-dir-ring-file-name
- (concat eshell-directory-name "lastdir")
- "*If non-nil, name of the file to read/write the last-dir-ring.
+ (expand-file-name "lastdir" eshell-directory-name)
+ "If non-nil, name of the file to read/write the last-dir-ring.
See also `eshell-read-last-dir-ring' and `eshell-write-last-dir-ring'.
If it is nil, the last-dir-ring will not be written to disk."
:type 'file
:group 'eshell-dirs)
(defcustom eshell-last-dir-ring-size 32
- "*If non-nil, the size of the directory history ring.
+ "If non-nil, the size of the directory history ring.
This ring is added to every time `cd' or `pushd' is used. It simply
stores the most recent directory locations Eshell has been in. To
return to the most recent entry, use 'cd -' (equivalent to 'cd -0').
:group 'eshell-dirs)
(defcustom eshell-last-dir-unique t
- "*If non-nil, `eshell-last-dir-ring' contains only unique entries."
+ "If non-nil, `eshell-last-dir-ring' contains only unique entries."
:type 'boolean
:group 'eshell-dirs)
Thus, this does not include the current directory.")
(defvar eshell-last-dir-ring nil
- "The last directory that eshell was in.")
+ "The last directory that Eshell was in.")
;;; Functions:
(defun eshell-save-some-last-dir ()
"Save the list-dir-ring for any open Eshell buffers."
- (eshell-for buf (buffer-list)
+ (dolist (buf (buffer-list))
(if (buffer-live-p buf)
(with-current-buffer buf
(if (and eshell-mode
(char-to-string (char-before))))
(defun eshell-parse-drive-letter ()
- "An argument beginning X:[^/] is a drive letter reference."
+ "An argument beginning with X:[^/] is a drive letter reference."
(when (and (not eshell-current-argument)
(looking-at "\\([A-Za-z]:\\)\\([^/\\\\]\\|\\'\\)"))
(goto-char (match-end 1))
(path (eshell-find-previous-directory regexp)))
(concat (or path letter) "/"))))
+(defvar pcomplete-stub)
+(defvar pcomplete-last-completion-raw)
+(declare-function pcomplete-actual-arg "pcomplete")
+(declare-function pcomplete-uniqify-list "pcomplete")
+
(defun eshell-complete-user-reference ()
"If there is a user reference, complete it."
(let ((arg (pcomplete-actual-arg)))
index (1+ index)))))
oldpath))
-(eval-when-compile
- (defvar dired-directory))
+(defvar dired-directory)
(defun eshell/cd (&rest args) ; all but first ignored
"Alias to extend the behavior of `cd'."
(eshell-printn result)))
(run-hooks 'eshell-directory-change-hook)
(if eshell-list-files-after-cd
- (throw 'eshell-replace-command
- (eshell-parse-command "ls" (cdr args))))
+ ;; Let-bind eshell-last-command around this?
+ (eshell-plain-command "ls" (cdr args)))
nil))))
(put 'eshell/cd 'eshell-no-numeric-conversions t)
msg)))
(defun eshell-read-last-dir-ring ()
- "Sets the buffer's `eshell-last-dir-ring' from a history file."
+ "Set the buffer's `eshell-last-dir-ring' from a history file."
(let ((file eshell-last-dir-ring-file-name))
(cond
((or (null file)
(setq eshell-last-dir-ring ring))))))
(defun eshell-write-last-dir-ring ()
- "Writes the buffer's `eshell-last-dir-ring' to a history file."
+ "Write the buffer's `eshell-last-dir-ring' to a history file."
(let ((file eshell-last-dir-ring-file-name))
(cond
((or (null file)
(provide 'em-dirs)
-;; arch-tag: 1e9c5a95-f1bd-45f8-ad36-55aac706e787
+;; Local Variables:
+;; generated-autoload-file: "esh-groups.el"
+;; End:
+
;;; em-dirs.el ends here