emacs-devel
[Top][All Lists]
Advanced

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

RE: find-file-read-args: cursor's file as default in Dired


From: Drew Adams
Subject: RE: find-file-read-args: cursor's file as default in Dired
Date: Tue, 10 Jul 2007 15:34:38 -0700

>     Here's what it should be, so that `M-n' with `C-x C-f' gives
>     you the file of the cursor in Dired mode:
>
> That is a good feature.  Would you please send a patch and change log
> entry, and text for etc/NEWS?

----------------8<----------------------------------

2007-07-10  Drew Adams  <address@hidden>

      *files.el (find-file-read-args): Default in Dired mode is cursor's
file.

----------------8<----------------------------------

diff -c "c:/drews-lisp-20/cvs-lisp/NEWS-22-2007-07-10.txt"
"c:/drews-lisp-20/cvs-lisp/NEWS-22-patched-2007-07-10.txt"
*** c:/drews-lisp-20/cvs-lisp/NEWS-22-2007-07-10.txt    Tue Jul 10 15:30:16
2007
--- c:/drews-lisp-20/cvs-lisp/NEWS-22-patched-2007-07-10.txt    Tue Jul 10
15:31:52 2007
***************
*** 4163,4168 ****
--- 4163,4171 ----
  modification times.  Magic file name handlers can handle this
  operation.

+ *** In Dired, the default file to visit with `find-file' is the file
+ on the same line as the cursor.
+
  ** Input changes:

  *** Functions `y-or-n-p', `read-char', `read-key-sequence' and the like,
that
----------------8<----------------------------------
diff -c "c:/drews-lisp-20/cvs-lisp/files-CVS-2007-07-10.el"
"c:/drews-lisp-20/cvs-lisp/files-CVS-patched-2007-07-10.el"
*** c:/drews-lisp-20/cvs-lisp/files-CVS-2007-07-10.el   Tue Jul 10 15:18:52
2007
--- c:/drews-lisp-20/cvs-lisp/files-CVS-patched-2007-07-10.el   Tue Jul 10
15:20:24 2007
***************
*** 1065,1076 ****

  (defun find-file-read-args (prompt mustmatch)
    (list (let ((find-file-default
!              (and buffer-file-name
!                   (abbreviate-file-name buffer-file-name))))
!         (minibuffer-with-setup-hook
!             (lambda () (setq minibuffer-default find-file-default))
!           (read-file-name prompt nil default-directory mustmatch)))
!       t))

  (defun find-file (filename &optional wildcards)
    "Edit file FILENAME.
--- 1065,1078 ----

  (defun find-file-read-args (prompt mustmatch)
    (list (let ((find-file-default
!                (if (eq major-mode 'dired-mode)
!                    (abbreviate-file-name (dired-get-file-for-visit))
!                  (and buffer-file-name (abbreviate-file-name
!                                         buffer-file-name)))))
!           (minibuffer-with-setup-hook
!               (lambda () (setq minibuffer-default find-file-default))
!             (read-file-name prompt nil default-directory mustmatch)))
!         t))

  (defun find-file (filename &optional wildcards)
    "Edit file FILENAME.





reply via email to

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