emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] Changes to emacs/lisp/files.el


From: Stefan Monnier
Subject: [Emacs-diffs] Changes to emacs/lisp/files.el
Date: Fri, 15 Mar 2002 21:25:56 -0500

Index: emacs/lisp/files.el
diff -c emacs/lisp/files.el:1.552 emacs/lisp/files.el:1.553
*** emacs/lisp/files.el:1.552   Wed Mar  6 13:19:43 2002
--- emacs/lisp/files.el Fri Mar 15 21:25:56 2002
***************
*** 534,543 ****
                       (read-file-name "Load file: "))))
    (load (expand-file-name file) nil nil t))
  
  (defun load-library (library)
    "Load the library named LIBRARY.
  This is an interface to the function `load'."
!   (interactive "sLoad library: ")
    (load library))
  
  (defun file-local-copy (file)
--- 534,562 ----
                       (read-file-name "Load file: "))))
    (load (expand-file-name file) nil nil t))
  
+ (defun load-completion (string predicate action)
+   (if (file-name-absolute-p string)
+       (read-file-name-internal string predicate action)
+     (let ((names nil)
+         (suffix (concat (regexp-opt load-suffixes t) "\\'"))
+         (string-dir (file-name-directory string)))
+       (dolist (dir load-path)
+       (if string-dir (setq dir (expand-file-name string-dir dir)))
+       (when (file-directory-p dir)
+         (dolist (file (file-name-all-completions
+                        (file-name-nondirectory string) dir))
+           (push (if string-dir (concat string-dir file) file) names)
+           (when (string-match suffix file)
+             (setq file (substring file 0 (match-beginning 0)))
+             (push (if string-dir (concat string-dir file) file) names)))))
+       (if action
+         (all-completions string (mapcar 'list names) predicate)
+       (try-completion string (mapcar 'list names) predicate)))))
+ 
  (defun load-library (library)
    "Load the library named LIBRARY.
  This is an interface to the function `load'."
!   (interactive (list (completing-read "Load library: " 'load-completion)))
    (load library))
  
  (defun file-local-copy (file)



reply via email to

[Prev in Thread] Current Thread [Next in Thread]