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: Mon, 29 Apr 2002 21:56:23 -0400

Index: emacs/lisp/files.el
diff -c emacs/lisp/files.el:1.570 emacs/lisp/files.el:1.571
*** emacs/lisp/files.el:1.570   Sun Apr 28 23:55:57 2002
--- emacs/lisp/files.el Mon Apr 29 21:56:23 2002
***************
*** 546,558 ****
                       (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
--- 546,579 ----
                       (read-file-name "Load file: "))))
    (load (expand-file-name file) nil nil t))
  
! (defun locate-file (filename path &optional suffixes predicate)
!   "Search for FILENAME through PATH.
! If SUFFIXES is non-nil, it should be a list of suffixes to append to
! file name when searching.  If SUFFIXES is nil, it is equivalent to '(\"\").
! If non-nil, PREDICATE is used instead of `file-readable-p'.
! PREDICATE can also be an integer to pass to the access(2) function,
! in which case file-name-handlers are ignored.
! For compatibility with XEmacs, PREDICATE can also be a symbol among
! `executable', `readable', `writable', or `exists' or a list of one
! of those symbols."
!   (if (and predicate (symbolp predicate) (not (functionp predicate)))
!       (setq predicate (list predicate)))
!   (when (and (consp predicate) (not (functionp predicate)))
!     (setq predicate
!         (logior (if (memq 'executable predicate) 1 0)
!                 (if (memq 'writable predicate) 2 0)
!                 (if (memq 'readable predicate) 4 0))))
!   (locate-file-internal filename path suffixes predicate))
! 
! (defun locate-file-completion (string path-and-suffixes action)
!   "Do completion for file names passed to `locate-file'.
! PATH-AND-SUFFIXES is a pair of lists (DIRECTORIES . SUFFIXES)."
    (if (file-name-absolute-p string)
!       (read-file-name-internal string nil action)
      (let ((names nil)
!         (suffix (concat (regexp-opt (cdr path-and-suffixes) t) "\\'"))
          (string-dir (file-name-directory string)))
!       (dolist (dir (car path-and-suffixes))
        (if string-dir (setq dir (expand-file-name string-dir dir)))
        (when (file-directory-p dir)
          (dolist (file (file-name-all-completions
***************
*** 562,574 ****
              (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)
--- 583,598 ----
              (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))
!       (try-completion string (mapcar 'list names))))))
  
  (defun load-library (library)
    "Load the library named LIBRARY.
  This is an interface to the function `load'."
!   (interactive
!    (list (completing-read "Load library: "
!                         'locate-file-completion
!                         (cons load-path load-suffixes))))
    (load library))
  
  (defun file-local-copy (file)
***************
*** 3372,3378 ****
          (if (string-match (car (car list)) filename)
              (setq result (replace-match (cadr (car list)) t nil
                                          filename)
!                   uniq (caddr (car list))))
          (setq list (cdr list)))
        (if result
            (if uniq
--- 3396,3402 ----
          (if (string-match (car (car list)) filename)
              (setq result (replace-match (cadr (car list)) t nil
                                          filename)
!                   uniq (car (cddr (car list)))))
          (setq list (cdr list)))
        (if result
            (if uniq



reply via email to

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