Fix typos in docstrings.
[bpt/emacs.git] / lisp / eshell / em-dirs.el
index 0000cae..43bc3ff 100644 (file)
@@ -1,16 +1,16 @@
 ;;; em-dirs.el --- directory navigation commands
 
-;; Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004,
-;;   2005, 2006, 2007 Free Software Foundation, Inc.
+;; Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007,
+;;   2008, 2009, 2010  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.
-
-(provide 'em-dirs)
-
-(eval-when-compile (require 'esh-maint))
-(require '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.
-Emacs does provide standard Lisp definitions of `pwd' and `cd', but
-they lack somewhat in feel from the typical shell equivalents."
-  :tag "Directory navigation"
-  :group 'eshell-module)
+;; along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.
 
 ;;; Commentary:
 
@@ -57,9 +41,22 @@ they lack somewhat in feel from the typical shell equivalents."
 ;; Eshell sessions.  It is a separate mechanism from `pushd' and
 ;; `popd', and the two may be used at the same time.
 
+;;; Code:
+
+(require 'eshell)
 (require 'ring)
 (require 'esh-opt)
 
+;;;###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.
+Emacs does provide standard Lisp definitions of `pwd' and `cd', but
+they lack somewhat in feel from the typical shell equivalents."
+  :tag "Directory navigation"
+  :group 'eshell-module)
+
 ;;; User Variables:
 
 (defcustom eshell-dirs-load-hook '(eshell-dirs-initialize)
@@ -141,7 +138,7 @@ This is effective only if directory tracking is enabled."
   :group 'eshell-dirs)
 
 (defcustom eshell-last-dir-ring-file-name
-  (concat eshell-directory-name "lastdir")
+  (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."
@@ -181,7 +178,7 @@ thing again."
 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:
 
@@ -270,7 +267,7 @@ Thus, this does not include the current directory.")
     (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))
@@ -279,6 +276,11 @@ Thus, this does not include the current directory.")
           (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)))
@@ -319,7 +321,7 @@ in the minibuffer:
     (before translate-multiple-dots
            (filename &optional directory) activate)
     (setq filename (eshell-expand-multiple-dots filename)))"
-  (while (string-match "\\.\\.\\(\\.+\\)" path)
+  (while (string-match "\\(?:^\\|/\\)\\.\\.\\(\\.+\\)\\(?:$\\|/\\)" path)
     (let* ((extra-dots (match-string 1 path))
           (len (length extra-dots))
           replace-text)
@@ -344,8 +346,7 @@ in the minibuffer:
                  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'."
@@ -400,8 +401,8 @@ in the minibuffer:
               (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)
@@ -516,7 +517,7 @@ in the minibuffer:
       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)
@@ -544,7 +545,7 @@ in the minibuffer:
        (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)
@@ -566,7 +567,11 @@ in the minibuffer:
           (write-region (point-min) (point-max) file nil
                         'no-message))))))))
 
-;;; Code:
+(provide 'em-dirs)
+
+;; Local Variables:
+;; generated-autoload-file: "esh-groups.el"
+;; End:
 
-;;; arch-tag: 1e9c5a95-f1bd-45f8-ad36-55aac706e787
+;; arch-tag: 1e9c5a95-f1bd-45f8-ad36-55aac706e787
 ;;; em-dirs.el ends here