diff options
| author | Richard M. Stallman | 1999-01-24 20:10:30 +0000 |
|---|---|---|
| committer | Richard M. Stallman | 1999-01-24 20:10:30 +0000 |
| commit | 243ce842ce02bb8a0d1449a441951e760dc269c2 (patch) | |
| tree | 96c7ced6f1ab89874374a4f0b3a316b242f322be | |
| parent | 0afc861ba9d0f4780fe4031eeecdf660fbe86cfc (diff) | |
| download | emacs-243ce842ce02bb8a0d1449a441951e760dc269c2.tar.gz emacs-243ce842ce02bb8a0d1449a441951e760dc269c2.zip | |
(find-file-noselect): Do wildcard processing only
if new arg WILDCARDS is non-nil.
(find-file, find-file-other-window): New arg WILDCARDS.
Default it to non-nil if interactive.
(find-file-other-frame): Likewise.
(find-file-read-only): Likewise.
(find-file-read-only-other-window): Likewise.
(find-file-read-only-other-frame): Likewise.
| -rw-r--r-- | lisp/files.el | 63 |
1 files changed, 37 insertions, 26 deletions
diff --git a/lisp/files.el b/lisp/files.el index 28afd60963f..c7420df9987 100644 --- a/lisp/files.el +++ b/lisp/files.el | |||
| @@ -646,51 +646,59 @@ do not put this buffer at the front of the list of recently selected ones." | |||
| 646 | (pop-to-buffer buffer t norecord) | 646 | (pop-to-buffer buffer t norecord) |
| 647 | (raise-frame (window-frame (selected-window))))) | 647 | (raise-frame (window-frame (selected-window))))) |
| 648 | 648 | ||
| 649 | (defun find-file (filename) | 649 | (defun find-file (filename &optional wildcards) |
| 650 | "Edit file FILENAME. | 650 | "Edit file FILENAME. |
| 651 | Switch to a buffer visiting file FILENAME, | 651 | Switch to a buffer visiting file FILENAME, |
| 652 | creating one if none already exists." | 652 | creating one if none already exists. |
| 653 | (interactive "FFind file: ") | 653 | Interactively, or if WILDCARDS is non-nil in a call from Lisp, |
| 654 | (switch-to-buffer (find-file-noselect filename))) | 654 | expand wildcards (if any) and visit multiple files." |
| 655 | (interactive "FFind file: \np") | ||
| 656 | (switch-to-buffer (find-file-noselect filename nil nil wildcards))) | ||
| 655 | 657 | ||
| 656 | (defun find-file-other-window (filename) | 658 | (defun find-file-other-window (filename &optional wildcards) |
| 657 | "Edit file FILENAME, in another window. | 659 | "Edit file FILENAME, in another window. |
| 658 | May create a new window, or reuse an existing one. | 660 | May create a new window, or reuse an existing one. |
| 659 | See the function `display-buffer'." | 661 | See the function `display-buffer'. |
| 660 | (interactive "FFind file in other window: ") | 662 | Interactively, or if WILDCARDS is non-nil in a call from Lisp, |
| 661 | (switch-to-buffer-other-window (find-file-noselect filename))) | 663 | expand wildcards (if any) and visit multiple files." |
| 662 | 664 | (interactive "FFind file in other window: \np") | |
| 663 | (defun find-file-other-frame (filename) | 665 | (switch-to-buffer-other-window (find-file-noselect filename |
| 666 | nil nil wildcards))) | ||
| 667 | |||
| 668 | (defun find-file-other-frame (filename &optional wildcards) | ||
| 664 | "Edit file FILENAME, in another frame. | 669 | "Edit file FILENAME, in another frame. |
| 665 | May create a new frame, or reuse an existing one. | 670 | May create a new frame, or reuse an existing one. |
| 666 | See the function `display-buffer'." | 671 | See the function `display-buffer'. |
| 667 | (interactive "FFind file in other frame: ") | 672 | Interactively, or if WILDCARDS is non-nil in a call from Lisp, |
| 668 | (switch-to-buffer-other-frame (find-file-noselect filename))) | 673 | expand wildcards (if any) and visit multiple files." |
| 669 | 674 | (interactive "FFind file in other frame: \np") | |
| 670 | (defun find-file-read-only (filename) | 675 | (switch-to-buffer-other-frame (find-file-noselect filename |
| 676 | nil nil wildcards))) | ||
| 677 | |||
| 678 | (defun find-file-read-only (filename &optional wildcards) | ||
| 671 | "Edit file FILENAME but don't allow changes. | 679 | "Edit file FILENAME but don't allow changes. |
| 672 | Like \\[find-file] but marks buffer as read-only. | 680 | Like \\[find-file] but marks buffer as read-only. |
| 673 | Use \\[toggle-read-only] to permit editing." | 681 | Use \\[toggle-read-only] to permit editing." |
| 674 | (interactive "fFind file read-only: ") | 682 | (interactive "fFind file read-only: \np") |
| 675 | (find-file filename) | 683 | (find-file filename wildcards) |
| 676 | (toggle-read-only 1) | 684 | (toggle-read-only 1) |
| 677 | (current-buffer)) | 685 | (current-buffer)) |
| 678 | 686 | ||
| 679 | (defun find-file-read-only-other-window (filename) | 687 | (defun find-file-read-only-other-window (filename &optional wildcards) |
| 680 | "Edit file FILENAME in another window but don't allow changes. | 688 | "Edit file FILENAME in another window but don't allow changes. |
| 681 | Like \\[find-file-other-window] but marks buffer as read-only. | 689 | Like \\[find-file-other-window] but marks buffer as read-only. |
| 682 | Use \\[toggle-read-only] to permit editing." | 690 | Use \\[toggle-read-only] to permit editing." |
| 683 | (interactive "fFind file read-only other window: ") | 691 | (interactive "fFind file read-only other window: \np") |
| 684 | (find-file-other-window filename) | 692 | (find-file-other-window filename wildcards) |
| 685 | (toggle-read-only 1) | 693 | (toggle-read-only 1) |
| 686 | (current-buffer)) | 694 | (current-buffer)) |
| 687 | 695 | ||
| 688 | (defun find-file-read-only-other-frame (filename) | 696 | (defun find-file-read-only-other-frame (filename &optional wildcards) |
| 689 | "Edit file FILENAME in another frame but don't allow changes. | 697 | "Edit file FILENAME in another frame but don't allow changes. |
| 690 | Like \\[find-file-other-frame] but marks buffer as read-only. | 698 | Like \\[find-file-other-frame] but marks buffer as read-only. |
| 691 | Use \\[toggle-read-only] to permit editing." | 699 | Use \\[toggle-read-only] to permit editing." |
| 692 | (interactive "fFind file read-only other frame: ") | 700 | (interactive "fFind file read-only other frame: \np") |
| 693 | (find-file-other-frame filename) | 701 | (find-file-other-frame filename wildcards) |
| 694 | (toggle-read-only 1) | 702 | (toggle-read-only 1) |
| 695 | (current-buffer)) | 703 | (current-buffer)) |
| 696 | 704 | ||
| @@ -874,13 +882,15 @@ whose names match the pattern." | |||
| 874 | :group 'files | 882 | :group 'files |
| 875 | :type 'boolean) | 883 | :type 'boolean) |
| 876 | 884 | ||
| 877 | (defun find-file-noselect (filename &optional nowarn rawfile) | 885 | (defun find-file-noselect (filename &optional nowarn rawfile wildcards) |
| 878 | "Read file FILENAME into a buffer and return the buffer. | 886 | "Read file FILENAME into a buffer and return the buffer. |
| 879 | If a buffer exists visiting FILENAME, return that one, but | 887 | If a buffer exists visiting FILENAME, return that one, but |
| 880 | verify that the file has not changed since visited or saved. | 888 | verify that the file has not changed since visited or saved. |
| 881 | The buffer is not selected, just returned to the caller. | 889 | The buffer is not selected, just returned to the caller. |
| 882 | Optional first arg NOWARN non-nil means suppress any warning messages. | 890 | Optional first arg NOWARN non-nil means suppress any warning messages. |
| 883 | Optional second arg RAWFILE non-nil means the file is read literally." | 891 | Optional second arg RAWFILE non-nil means the file is read literally. |
| 892 | Optional third arg WILDCARDS non-nil means do wildcard processing | ||
| 893 | and visit all the matching files." | ||
| 884 | (setq filename | 894 | (setq filename |
| 885 | (abbreviate-file-name | 895 | (abbreviate-file-name |
| 886 | (expand-file-name filename))) | 896 | (expand-file-name filename))) |
| @@ -890,7 +900,8 @@ Optional second arg RAWFILE non-nil means the file is read literally." | |||
| 890 | (abbreviate-file-name (file-truename filename)) | 900 | (abbreviate-file-name (file-truename filename)) |
| 891 | filename)) | 901 | filename)) |
| 892 | (error "%s is a directory" filename)) | 902 | (error "%s is a directory" filename)) |
| 893 | (if (and find-file-wildcards | 903 | (if (and wildcards |
| 904 | find-file-wildcards | ||
| 894 | (not (string-match "\\`/:" filename)) | 905 | (not (string-match "\\`/:" filename)) |
| 895 | (string-match "[[*?]" filename)) | 906 | (string-match "[[*?]" filename)) |
| 896 | (let ((files (file-expand-wildcards filename t)) | 907 | (let ((files (file-expand-wildcards filename t)) |