[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: find-alternate-file can't handle wildcards
From: |
Kevin Rodgers |
Subject: |
Re: find-alternate-file can't handle wildcards |
Date: |
Thu, 02 Dec 2004 10:51:58 -0700 |
User-agent: |
Mozilla Thunderbird 0.9 (X11/20041105) |
Dan Jacobson wrote:
> Make (find-alternate-file "/usr/share/doc/exim4-doc-*") handle wildcards
> just like dired! Currently: File not found and directory write-protected
2004-12-02 Kevin Rodgers <ihs_4664@yahoo.com>
* files.el (find-alternate-file, find-alternate-file-other-window):
Accept an optional WILDCARDS argument, describe it in the doc
string, bind it when called interactively, and pass it on to the
file-visiting functions.
*** emacs-21.3/lisp/files.el~ Thu Oct 24 07:07:56 2002
--- emacs-21.3/lisp/files.el Thu Dec 2 10:42:36 2004
***************
*** 794,802 ****
(toggle-read-only 1)
(current-buffer))
! (defun find-alternate-file-other-window (filename)
"Find file FILENAME as a replacement for the file in the next window.
! This command does not select that window."
(interactive
(save-selected-window
(other-window 1)
--- 794,804 ----
(toggle-read-only 1)
(current-buffer))
! (defun find-alternate-file-other-window (filename &optional wildcards)
"Find file FILENAME as a replacement for the file in the next window.
! This command does not select that window.
! Interactively, or if WILDCARDS is non-nil in a call from Lisp,
! expand wildcards (if any) and visit multiple files."
(interactive
(save-selected-window
(other-window 1)
***************
*** 807,823 ****
(setq file-name (file-name-nondirectory file)
file-dir (file-name-directory file)))
(list (read-file-name
! "Find alternate file: " file-dir nil nil file-name)))))
(if (one-window-p)
! (find-file-other-window filename)
(save-selected-window
(other-window 1)
! (find-alternate-file filename))))
! (defun find-alternate-file (filename)
"Find file FILENAME, select its buffer, kill previous buffer.
If the current buffer now contains an empty file that you just visited
! \(presumably by mistake), use this command to visit the file you
really want."
(interactive
(let ((file buffer-file-name)
(file-name nil)
--- 809,828 ----
(setq file-name (file-name-nondirectory file)
file-dir (file-name-directory file)))
(list (read-file-name
! "Find alternate file: " file-dir nil nil file-name)
! (prefix-numeric-value current-prefix-arg)))))
(if (one-window-p)
! (find-file-other-window filename wildcards)
(save-selected-window
(other-window 1)
! (find-alternate-file filename wildcards))))
! (defun find-alternate-file (filename &optional wildcards)
"Find file FILENAME, select its buffer, kill previous buffer.
If the current buffer now contains an empty file that you just visited
! \(presumably by mistake), use this command to visit the file you
really want.
! Interactively, or if WILDCARDS is non-nil in a call from Lisp,
! expand wildcards (if any) and visit multiple files."
(interactive
(let ((file buffer-file-name)
(file-name nil)
***************
*** 826,832 ****
(setq file-name (file-name-nondirectory file)
file-dir (file-name-directory file)))
(list (read-file-name
! "Find alternate file: " file-dir nil nil file-name))))
(and (buffer-modified-p) (buffer-file-name)
;; (not buffer-read-only)
(not (yes-or-no-p (format "Buffer %s is modified; kill anyway? "
--- 831,838 ----
(setq file-name (file-name-nondirectory file)
file-dir (file-name-directory file)))
(list (read-file-name
! "Find alternate file: " file-dir nil nil file-name)
! (prefix-numeric-value current-prefix-arg))))
(and (buffer-modified-p) (buffer-file-name)
;; (not buffer-read-only)
(not (yes-or-no-p (format "Buffer %s is modified; kill anyway? "
***************
*** 846,852 ****
(setq buffer-file-name nil)
(setq buffer-file-number nil)
(setq buffer-file-truename nil)
! (find-file filename))
(cond ((eq obuf (current-buffer))
(setq buffer-file-name ofile)
(setq buffer-file-number onum)
--- 852,858 ----
(setq buffer-file-name nil)
(setq buffer-file-number nil)
(setq buffer-file-truename nil)
! (find-file filename wildcards))
(cond ((eq obuf (current-buffer))
(setq buffer-file-name ofile)
(setq buffer-file-number onum)
--
Kevin Rodgers