all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* find-file-read-args: cursor's file as default in Dired
@ 2007-07-10  2:32 Drew Adams
  2007-07-10 22:01 ` Richard Stallman
  0 siblings, 1 reply; 9+ messages in thread
From: Drew Adams @ 2007-07-10  2:32 UTC (permalink / raw)
  To: Emacs-Devel

Here's find-file-read-args:

(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))

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:

(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))

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2007-07-11 22:59 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-07-10  2:32 find-file-read-args: cursor's file as default in Dired Drew Adams
2007-07-10 22:01 ` Richard Stallman
2007-07-10 22:34   ` Drew Adams
2007-07-10 23:17     ` Juri Linkov
2007-07-11  0:49       ` Drew Adams
2007-07-11  2:33         ` Stefan Monnier
2007-07-11  8:04         ` Juri Linkov
2007-07-11 15:20           ` Drew Adams
2007-07-11 22:59             ` Juri Linkov

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.