Fix comment typo.
[bpt/emacs.git] / lisp / hippie-exp.el
index 49d7754..c8722df 100644 (file)
@@ -1,7 +1,7 @@
 ;;; hippie-exp.el --- expand text trying various ways to find its expansion
 
 ;; Copyright (C) 1992, 2001, 2002, 2003, 2004, 2005,
-;;   2006, 2007 Free Software Foundation, Inc.
+;;   2006, 2007, 2008 Free Software Foundation, Inc.
 
 ;; Author: Anders Holst <aho@sans.kth.se>
 ;; Last change: 3 March 1998
 
 ;; 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 2, 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
@@ -21,9 +21,7 @@
 ;; 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:
 
@@ -441,13 +439,13 @@ string).  It returns t if a new completion is found, nil otherwise."
   (if (not old)
       (progn
        (he-init-string (he-file-name-beg) (point))
-       (let ((name-part (he-file-name-nondirectory he-search-string))
-             (dir-part (expand-file-name (or (he-file-name-directory
+       (let ((name-part (file-name-nondirectory he-search-string))
+             (dir-part (expand-file-name (or (file-name-directory
                                               he-search-string) ""))))
          (if (not (he-string-member name-part he-tried-table))
              (setq he-tried-table (cons name-part he-tried-table)))
          (if (and (not (equal he-search-string ""))
-                  (he-file-directory-p dir-part))
+                  (file-directory-p dir-part))
              (setq he-expand-list (sort (file-name-all-completions
                                          name-part
                                          dir-part)
@@ -462,7 +460,7 @@ string).  It returns t if a new completion is found, nil otherwise."
        (if old (he-reset-string))
        ())
       (let ((filename (he-concat-directory-file-name
-                      (he-file-name-directory he-search-string)
+                      (file-name-directory he-search-string)
                       (car he-expand-list))))
        (he-substitute-string filename)
        (setq he-tried-table (cons (car he-expand-list) (cdr he-tried-table)))
@@ -478,11 +476,11 @@ otherwise."
     (if (not old)
        (progn
          (he-init-string (he-file-name-beg) (point))
-         (let ((name-part (he-file-name-nondirectory he-search-string))
-               (dir-part (expand-file-name (or (he-file-name-directory
+         (let ((name-part (file-name-nondirectory he-search-string))
+               (dir-part (expand-file-name (or (file-name-directory
                                                 he-search-string) ""))))
            (if (and (not (equal he-search-string ""))
-                    (he-file-directory-p dir-part))
+                    (file-directory-p dir-part))
                (setq expansion (file-name-completion name-part
                                                      dir-part)))
            (if (or (eq expansion t)
@@ -495,16 +493,14 @@ otherwise."
          (if old (he-reset-string))
          ())
        (let ((filename (he-concat-directory-file-name
-                        (he-file-name-directory he-search-string)
+                        (file-name-directory he-search-string)
                         expansion)))
          (he-substitute-string filename)
          (setq he-tried-table (cons expansion (cdr he-tried-table)))
          t))))
 
 (defvar he-file-name-chars
-  (cond ((memq system-type '(vax-vms axp-vms))
-        "-a-zA-Z0-9_/.,~^#$+=:\\[\\]")
-       ((memq system-type '(ms-dos windows-nt cygwin))
+  (cond ((memq system-type '(ms-dos windows-nt cygwin))
         "-a-zA-Z0-9_/.,~^#$+=:\\\\")
        (t                          ;; More strange file formats ?
         "-a-zA-Z0-9_/.,~^#$+="))
@@ -518,43 +514,11 @@ otherwise."
          op
        (point)))))
 
-;; Thanks go to Richard Levitte <levitte@e.kth.se> who helped to make these
-;; work under VMS, and to David Hughes <ukchugd@ukpmr.cs.philips.nl> who
+;; Thanks go to David Hughes <ukchugd@ukpmr.cs.philips.nl> who
 ;; helped to make it work on PC.
-(defun he-file-name-nondirectory (file)
-  "Fix to make `file-name-nondirectory' work for hippie-expand under VMS."
-  (if (memq system-type '(axp-vms vax-vms))
-      (let ((n (file-name-nondirectory file)))
-       (if (string-match "^\\(\\[.*\\)\\.\\([^\\.]*\\)$" n)
-           (concat "[." (substring n (match-beginning 2) (match-end 2)))
-         n))
-    (file-name-nondirectory file)))
-
-(defun he-file-name-directory (file)
-  "Fix to make `file-name-directory' work for hippie-expand under VMS."
-  (if (memq system-type '(axp-vms vax-vms))
-      (let ((n (file-name-nondirectory file))
-           (d (file-name-directory file)))
-       (if (string-match "^\\(\\[.*\\)\\.\\([^\\.]*\\)$" n)
-           (concat d (substring n (match-beginning 1) (match-end 1)) "]")
-         d))
-    (file-name-directory file)))
-
-(defun he-file-directory-p (file)
-  "Fix to make `file-directory-p' work for hippie-expand under VMS."
-  (if (memq system-type '(vax-vms axp-vms))
-      (or (file-directory-p file)
-         (file-directory-p (concat file "[000000]")))
-    (file-directory-p file)))
-
 (defun he-concat-directory-file-name (dir-part name-part)
   "Try to slam together two parts of a file specification, system dependently."
   (cond ((null dir-part) name-part)
-       ((memq system-type '(axp-vms vax-vms))
-        (if (and (string= (substring dir-part -1) "]")
-                 (string= (substring name-part 0 2) "[."))
-            (concat (substring dir-part 0 -1) (substring name-part 1))
-          (concat dir-part name-part)))
        ((memq system-type '(ms-dos w32))
         (if (and (string-match "\\\\" dir-part)
                  (not (string-match "/" dir-part))
@@ -1223,5 +1187,5 @@ string).  It returns t if a new completion is found, nil otherwise."
 
 (provide 'hippie-exp)
 
-;;; arch-tag: 5e6e00bf-b061-4a7a-9b46-de0ae105ab99
+;; arch-tag: 5e6e00bf-b061-4a7a-9b46-de0ae105ab99
 ;;; hippie-exp.el ends here