aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard M. Stallman2002-05-19 15:55:04 +0000
committerRichard M. Stallman2002-05-19 15:55:04 +0000
commite6f0ff923303e71a0db0306f403fc507a5608ef7 (patch)
tree05d22df9c59bba06513a96c60e9b0077f4aa325d
parent4e391653c0184800015f33cda477dc6156c89126 (diff)
downloademacs-e6f0ff923303e71a0db0306f403fc507a5608ef7.tar.gz
emacs-e6f0ff923303e71a0db0306f403fc507a5608ef7.zip
(locate-file): Doc fix.
-rw-r--r--lisp/files.el53
1 files changed, 41 insertions, 12 deletions
diff --git a/lisp/files.el b/lisp/files.el
index 3cde660a4b4..2feadc8c121 100644
--- a/lisp/files.el
+++ b/lisp/files.el
@@ -551,11 +551,12 @@ colon-separated list of directories when resolving a relative directory name."
551If SUFFIXES is non-nil, it should be a list of suffixes to append to 551If SUFFIXES is non-nil, it should be a list of suffixes to append to
552file name when searching. If SUFFIXES is nil, it is equivalent to '(\"\"). 552file name when searching. If SUFFIXES is nil, it is equivalent to '(\"\").
553If non-nil, PREDICATE is used instead of `file-readable-p'. 553If non-nil, PREDICATE is used instead of `file-readable-p'.
554PREDICATE can also be an integer to pass to the access(2) function, 554PREDICATE can also be an integer to pass to the `access' system call,
555in which case file-name-handlers are ignored (this use is deprecated). 555in which case file-name handlers are ignored. This usage is deprecated.
556For compatibility with XEmacs, PREDICATE can also be a symbol among 556
557`executable', `readable', `writable', or `exists' or a list of one 557For compatibility, PREDICATE can also be one of the symbols
558of those symbols." 558`executable', `readable', `writable', or `exists', or a list of
559one or more of those symbols."
559 (if (and predicate (symbolp predicate) (not (functionp predicate))) 560 (if (and predicate (symbolp predicate) (not (functionp predicate)))
560 (setq predicate (list predicate))) 561 (setq predicate (list predicate)))
561 (when (and (consp predicate) (not (functionp predicate))) 562 (when (and (consp predicate) (not (functionp predicate)))
@@ -768,14 +769,32 @@ documentation for additional customization information."
768 (pop-to-buffer buffer t norecord) 769 (pop-to-buffer buffer t norecord)
769 (raise-frame (window-frame (selected-window))))) 770 (raise-frame (window-frame (selected-window)))))
770 771
772(defun find-file-read-args (prompt)
773 (list (let ((find-file-default
774 (and buffer-file-name
775 (abbreviate-file-name buffer-file-name)))
776 (minibuffer-setup-hook
777 '((lambda ()
778 (setq minibuffer-default find-file-default)
779 ;; Clear out this hook so it does not interfere
780 ;; with any recursive minibuffer usage.
781 (setq minibuffer-setup-hook nil)))))
782 (read-file-name prompt nil default-directory))
783 current-prefix-arg))
784
771(defun find-file (filename &optional wildcards) 785(defun find-file (filename &optional wildcards)
772 "Edit file FILENAME. 786 "Edit file FILENAME.
773Switch to a buffer visiting file FILENAME, 787Switch to a buffer visiting file FILENAME,
774creating one if none already exists. 788creating one if none already exists.
789Interactively, the default if you just type RET is the current directory,
790but the visited file name is available through the minibuffer history:
791type M-n to pull it into the minibuffer.
792
775Interactively, or if WILDCARDS is non-nil in a call from Lisp, 793Interactively, or if WILDCARDS is non-nil in a call from Lisp,
776expand wildcards (if any) and visit multiple files. Wildcard expansion 794expand wildcards (if any) and visit multiple files. Wildcard expansion
777can be suppressed by setting `find-file-wildcards'." 795can be suppressed by setting `find-file-wildcards'."
778 (interactive "FFind file: \np") 796 (interactive
797 (find-file-read-args "Find file: "))
779 (let ((value (find-file-noselect filename nil nil wildcards))) 798 (let ((value (find-file-noselect filename nil nil wildcards)))
780 (if (listp value) 799 (if (listp value)
781 (mapcar 'switch-to-buffer (nreverse value)) 800 (mapcar 'switch-to-buffer (nreverse value))
@@ -785,9 +804,14 @@ can be suppressed by setting `find-file-wildcards'."
785 "Edit file FILENAME, in another window. 804 "Edit file FILENAME, in another window.
786May create a new window, or reuse an existing one. 805May create a new window, or reuse an existing one.
787See the function `display-buffer'. 806See the function `display-buffer'.
807
808Interactively, the default if you just type RET is the current directory,
809but the visited file name is available through the minibuffer history:
810type M-n to pull it into the minibuffer.
811
788Interactively, or if WILDCARDS is non-nil in a call from Lisp, 812Interactively, or if WILDCARDS is non-nil in a call from Lisp,
789expand wildcards (if any) and visit multiple files." 813expand wildcards (if any) and visit multiple files."
790 (interactive "FFind file in other window: \np") 814 (interactive (find-file-read-args "FFind file in other window: "))
791 (let ((value (find-file-noselect filename nil nil wildcards))) 815 (let ((value (find-file-noselect filename nil nil wildcards)))
792 (if (listp value) 816 (if (listp value)
793 (progn 817 (progn
@@ -800,9 +824,14 @@ expand wildcards (if any) and visit multiple files."
800 "Edit file FILENAME, in another frame. 824 "Edit file FILENAME, in another frame.
801May create a new frame, or reuse an existing one. 825May create a new frame, or reuse an existing one.
802See the function `display-buffer'. 826See the function `display-buffer'.
827
828Interactively, the default if you just type RET is the current directory,
829but the visited file name is available through the minibuffer history:
830type M-n to pull it into the minibuffer.
831
803Interactively, or if WILDCARDS is non-nil in a call from Lisp, 832Interactively, or if WILDCARDS is non-nil in a call from Lisp,
804expand wildcards (if any) and visit multiple files." 833expand wildcards (if any) and visit multiple files."
805 (interactive "FFind file in other frame: \np") 834 (interactive (find-file-read-args "FFind file in other frame: "))
806 (let ((value (find-file-noselect filename nil nil wildcards))) 835 (let ((value (find-file-noselect filename nil nil wildcards)))
807 (if (listp value) 836 (if (listp value)
808 (progn 837 (progn
@@ -813,9 +842,9 @@ expand wildcards (if any) and visit multiple files."
813 842
814(defun find-file-read-only (filename &optional wildcards) 843(defun find-file-read-only (filename &optional wildcards)
815 "Edit file FILENAME but don't allow changes. 844 "Edit file FILENAME but don't allow changes.
816Like `find-file' but marks buffer as read-only. 845Like \\[find-file] but marks buffer as read-only.
817Use \\[toggle-read-only] to permit editing." 846Use \\[toggle-read-only] to permit editing."
818 (interactive "fFind file read-only: \np") 847 (interactive (find-file-read-args "fFind file read-only: "))
819 (find-file filename wildcards) 848 (find-file filename wildcards)
820 (toggle-read-only 1) 849 (toggle-read-only 1)
821 (current-buffer)) 850 (current-buffer))
@@ -824,7 +853,7 @@ Use \\[toggle-read-only] to permit editing."
824 "Edit file FILENAME in another window but don't allow changes. 853 "Edit file FILENAME in another window but don't allow changes.
825Like \\[find-file-other-window] but marks buffer as read-only. 854Like \\[find-file-other-window] but marks buffer as read-only.
826Use \\[toggle-read-only] to permit editing." 855Use \\[toggle-read-only] to permit editing."
827 (interactive "fFind file read-only other window: \np") 856 (interactive (find-file-read-args "fFind file read-only other window: "))
828 (find-file-other-window filename wildcards) 857 (find-file-other-window filename wildcards)
829 (toggle-read-only 1) 858 (toggle-read-only 1)
830 (current-buffer)) 859 (current-buffer))
@@ -833,7 +862,7 @@ Use \\[toggle-read-only] to permit editing."
833 "Edit file FILENAME in another frame but don't allow changes. 862 "Edit file FILENAME in another frame but don't allow changes.
834Like \\[find-file-other-frame] but marks buffer as read-only. 863Like \\[find-file-other-frame] but marks buffer as read-only.
835Use \\[toggle-read-only] to permit editing." 864Use \\[toggle-read-only] to permit editing."
836 (interactive "fFind file read-only other frame: \np") 865 (interactive (find-file-read-args "fFind file read-only other frame: "))
837 (find-file-other-frame filename wildcards) 866 (find-file-other-frame filename wildcards)
838 (toggle-read-only 1) 867 (toggle-read-only 1)
839 (current-buffer)) 868 (current-buffer))