diff options
Diffstat (limited to 'lisp/hippie-exp.el')
-rw-r--r-- | lisp/hippie-exp.el | 54 |
1 files changed, 10 insertions, 44 deletions
diff --git a/lisp/hippie-exp.el b/lisp/hippie-exp.el index 69674f508bb..c8722df46b3 100644 --- a/lisp/hippie-exp.el +++ b/lisp/hippie-exp.el @@ -439,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) @@ -460,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))) @@ -476,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) @@ -493,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_/.,~^#$+=")) @@ -516,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)) |