unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* C-x C-f RET problem...
@ 2002-05-16  7:45 Pavel Janík
  2002-05-16  8:02 ` Miles Bader
  2002-05-16 19:02 ` Colin Walters
  0 siblings, 2 replies; 12+ messages in thread
From: Pavel Janík @ 2002-05-16  7:45 UTC (permalink / raw)


Hi,

my users found the behavior of C-x C-f RET quite inconsistent with the rest
of Emacs. After typing C-x C-f you will see the current directory in the
minibuffer. Just after RET you *can* expect to see your current directory
opened in dired. Well, I'm quite used to the current behavior so
I personally do not have problem with it, but my users found it quite
irritating: "How is it possible that C-x C-f and the directory opens file
and not that directory?".

What do you think?
-- 
Pavel Janík

Let the data structure the program.
                  --  The Elements of Programming Style (Kernighan & Plaugher)

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

* Re: C-x C-f RET problem...
  2002-05-16  7:45 C-x C-f RET problem Pavel Janík
@ 2002-05-16  8:02 ` Miles Bader
  2002-05-16 19:02 ` Colin Walters
  1 sibling, 0 replies; 12+ messages in thread
From: Miles Bader @ 2002-05-16  8:02 UTC (permalink / raw)
  Cc: emacs-devel

Pavel@Janik.cz (Pavel Janík) writes:
> I personally do not have problem with it, but my users found it quite
> irritating: "How is it possible that C-x C-f and the directory opens file
> and not that directory?".
> 
> What do you think?

It's not something to be changed lightly, because many people actually
rely on that behavior (and it's very handy if you're visiting a file
that changes often).

-Miles
-- 
Come now, if we were really planning to harm you, would we be waiting here, 
 beside the path, in the very darkest part of the forest?

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

* Re: C-x C-f RET problem...
  2002-05-16  7:45 C-x C-f RET problem Pavel Janík
  2002-05-16  8:02 ` Miles Bader
@ 2002-05-16 19:02 ` Colin Walters
  2002-05-16 19:24   ` Miles Bader
  2002-05-17 19:29   ` Richard Stallman
  1 sibling, 2 replies; 12+ messages in thread
From: Colin Walters @ 2002-05-16 19:02 UTC (permalink / raw)


On Thu, 2002-05-16 at 03:45, Pavel Janík wrote:

> my users found the behavior of C-x C-f RET quite inconsistent with the rest
> of Emacs. After typing C-x C-f you will see the current directory in the
> minibuffer. Just after RET you *can* expect to see your current directory
> opened in dired. Well, I'm quite used to the current behavior so
> I personally do not have problem with it, but my users found it quite
> irritating: "How is it possible that C-x C-f and the directory opens file
> and not that directory?".
> 
> What do you think?

I agree with Miles in that it's not something we should change lightly. 
But I've been using Kevin Rodgers' defadvice for a long time, and been
very happy:

;; From Kevin Rodgers
(defadvice find-file (around find-default-filename-run-dired activate)
  "Run `\\[dired]' on the current directory (instead of reverting the
buffer) when called interactively, if `find-file-run-dired' is set, no
FILENAME is specified, and the buffer hasn't been modified."
  (if (and find-file-run-dired
	   (interactive-p)
	   (equal (ad-get-arg 0) buffer-file-name)
	   (not (buffer-modified-p)))
      (dired (file-name-directory buffer-file-name))
    ad-do-it))

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

* Re: C-x C-f RET problem...
  2002-05-16 19:02 ` Colin Walters
@ 2002-05-16 19:24   ` Miles Bader
  2002-05-16 21:51     ` Kim F. Storm
  2002-05-17 19:29   ` Richard Stallman
  1 sibling, 1 reply; 12+ messages in thread
From: Miles Bader @ 2002-05-16 19:24 UTC (permalink / raw)
  Cc: emacs-devel

Colin Walters <walters@verbum.org> writes:
> I agree with Miles in that it's not something we should change lightly. 
> But I've been using Kevin Rodgers' defadvice for a long time, and been
> very happy

I suppose I should be more explicit:  I'm against this change, because
I use the current functionality (revisit-the-current-file) functionality
extremely often.

-Miles

-- 
[|nurgle|]  ddt- demonic? so quake will have an evil kinda setting? one that 
            will  make every christian in the world foamm at the mouth? 
[iddt]      nurg, that's the goal 

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

* Re: C-x C-f RET problem...
  2002-05-16 21:51     ` Kim F. Storm
@ 2002-05-16 21:13       ` Alan Shutko
  2002-05-16 21:18       ` Miles Bader
  1 sibling, 0 replies; 12+ messages in thread
From: Alan Shutko @ 2002-05-16 21:13 UTC (permalink / raw)
  Cc: Miles Bader, Colin Walters, emacs-devel

storm@cua.dk (Kim F. Storm) writes:

> I know habits are hard to change, but C-x C-v RET does that as well

C-x C-v RET loses your place in the file.

-- 
Alan Shutko <ats@acm.org> - In a variety of flavors!
Deprive a mirror of its silver and even the Czar won't see his face.

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

* Re: C-x C-f RET problem...
  2002-05-16 21:51     ` Kim F. Storm
  2002-05-16 21:13       ` Alan Shutko
@ 2002-05-16 21:18       ` Miles Bader
  1 sibling, 0 replies; 12+ messages in thread
From: Miles Bader @ 2002-05-16 21:18 UTC (permalink / raw)
  Cc: Colin Walters, emacs-devel

storm@cua.dk (Kim F. Storm) writes:
> > I'm against this change, because
> > I use the current functionality (revisit-the-current-file) functionality
> > extremely often.
> 
> I know habits are hard to change, but C-x C-v RET does that as well

Actually they do different things -- C-x C-f RET doesn't re-read the
file [which destroys various bits of state] unless (1) it's changed, and
(2) you answer yes to the prompt.

-Miles
-- 
Occam's razor split hairs so well, I bought the whole argument!

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

* Re: C-x C-f RET problem...
  2002-05-16 19:24   ` Miles Bader
@ 2002-05-16 21:51     ` Kim F. Storm
  2002-05-16 21:13       ` Alan Shutko
  2002-05-16 21:18       ` Miles Bader
  0 siblings, 2 replies; 12+ messages in thread
From: Kim F. Storm @ 2002-05-16 21:51 UTC (permalink / raw)
  Cc: Colin Walters, emacs-devel

Miles Bader <miles@gnu.org> writes:

> Colin Walters <walters@verbum.org> writes:
> > I agree with Miles in that it's not something we should change lightly. 
> > But I've been using Kevin Rodgers' defadvice for a long time, and been
> > very happy
> 
> I suppose I should be more explicit:  I'm against this change, because
> I use the current functionality (revisit-the-current-file) functionality
> extremely often.

I know habits are hard to change, but C-x C-v RET does that as well
(but then again, C-x d runs dired...).

-- 
Kim F. Storm <storm@cua.dk> http://www.cua.dk

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

* Re: C-x C-f RET problem...
  2002-05-16 19:02 ` Colin Walters
  2002-05-16 19:24   ` Miles Bader
@ 2002-05-17 19:29   ` Richard Stallman
  2002-05-17 21:43     ` Colin Walters
  2002-05-18  2:02     ` Miles Bader
  1 sibling, 2 replies; 12+ messages in thread
From: Richard Stallman @ 2002-05-17 19:29 UTC (permalink / raw)
  Cc: emacs-devel

Here's another idea for how to implement the feature.  It only affects
interactive calls to find-file and friends.  If you just type RET, you
visit the directory, but if you want to use the visited file name
instead, you just have to type M-n to get it.

What do you think?

*** files.el.~1.573.~	Tue May 14 01:16:00 2002
--- files.el	Fri May 17 12:15:04 2002
***************
*** 768,781 ****
      (pop-to-buffer buffer t norecord)
      (raise-frame (window-frame (selected-window)))))
  
  (defun find-file (filename &optional wildcards)
    "Edit file FILENAME.
  Switch to a buffer visiting file FILENAME,
  creating one if none already exists.
  Interactively, or if WILDCARDS is non-nil in a call from Lisp,
  expand wildcards (if any) and visit multiple files.  Wildcard expansion
  can be suppressed by setting `find-file-wildcards'."
!   (interactive "FFind file: \np")
    (let ((value (find-file-noselect filename nil nil wildcards)))
      (if (listp value)
  	(mapcar 'switch-to-buffer (nreverse value))
--- 768,799 ----
      (pop-to-buffer buffer t norecord)
      (raise-frame (window-frame (selected-window)))))
  
+ (defun find-file-read-args (prompt)
+   (list (let ((find-file-default
+ 	       (and buffer-file-name
+ 		    (abbreviate-file-name buffer-file-name)))
+ 	      (minibuffer-setup-hook
+ 	       '((lambda ()
+ 		   (setq minibuffer-default find-file-default)
+ 		   ;; Clear out this hook so it does not interfere
+ 		   ;; with any recursive minibuffer usage.
+ 		   (setq minibuffer-setup-hook nil)))))
+ 	  (read-file-name prompt nil default-directory))
+ 	current-prefix-arg))
+ 
  (defun find-file (filename &optional wildcards)
    "Edit file FILENAME.
  Switch to a buffer visiting file FILENAME,
  creating one if none already exists.
+ Interactively, the default if you just type RET is the current directory,
+ but the visited file name is available through the minibuffer history:
+ type M-n to pull it into the minibuffer.
+ 
  Interactively, or if WILDCARDS is non-nil in a call from Lisp,
  expand wildcards (if any) and visit multiple files.  Wildcard expansion
  can be suppressed by setting `find-file-wildcards'."
!   (interactive
!    (find-file-read-args "Find file: "))
    (let ((value (find-file-noselect filename nil nil wildcards)))
      (if (listp value)
  	(mapcar 'switch-to-buffer (nreverse value))
***************
*** 785,793 ****
    "Edit file FILENAME, in another window.
  May create a new window, or reuse an existing one.
  See the function `display-buffer'.
  Interactively, or if WILDCARDS is non-nil in a call from Lisp,
  expand wildcards (if any) and visit multiple files."
!   (interactive "FFind file in other window: \np")
    (let ((value (find-file-noselect filename nil nil wildcards)))
      (if (listp value)
  	(progn
--- 803,816 ----
    "Edit file FILENAME, in another window.
  May create a new window, or reuse an existing one.
  See the function `display-buffer'.
+ 
+ Interactively, the default if you just type RET is the current directory,
+ but the visited file name is available through the minibuffer history:
+ type M-n to pull it into the minibuffer.
+ 
  Interactively, or if WILDCARDS is non-nil in a call from Lisp,
  expand wildcards (if any) and visit multiple files."
!   (interactive (find-file-read-args "FFind file in other window: "))
    (let ((value (find-file-noselect filename nil nil wildcards)))
      (if (listp value)
  	(progn
***************
*** 800,808 ****
    "Edit file FILENAME, in another frame.
  May create a new frame, or reuse an existing one.
  See the function `display-buffer'.
  Interactively, or if WILDCARDS is non-nil in a call from Lisp,
  expand wildcards (if any) and visit multiple files."
!   (interactive "FFind file in other frame: \np")
    (let ((value (find-file-noselect filename nil nil wildcards)))
      (if (listp value)
  	(progn
--- 823,836 ----
    "Edit file FILENAME, in another frame.
  May create a new frame, or reuse an existing one.
  See the function `display-buffer'.
+ 
+ Interactively, the default if you just type RET is the current directory,
+ but the visited file name is available through the minibuffer history:
+ type M-n to pull it into the minibuffer.
+ 
  Interactively, or if WILDCARDS is non-nil in a call from Lisp,
  expand wildcards (if any) and visit multiple files."
!   (interactive (find-file-read-args "FFind file in other frame: "))
    (let ((value (find-file-noselect filename nil nil wildcards)))
      (if (listp value)
  	(progn
***************
*** 813,821 ****
  
  (defun find-file-read-only (filename &optional wildcards)
    "Edit file FILENAME but don't allow changes.
! Like `find-file' but marks buffer as read-only.
  Use \\[toggle-read-only] to permit editing."
!   (interactive "fFind file read-only: \np")
    (find-file filename wildcards)
    (toggle-read-only 1)
    (current-buffer))
--- 841,849 ----
  
  (defun find-file-read-only (filename &optional wildcards)
    "Edit file FILENAME but don't allow changes.
! Like \\[find-file] but marks buffer as read-only.
  Use \\[toggle-read-only] to permit editing."
!   (interactive (find-file-read-args "fFind file read-only: "))
    (find-file filename wildcards)
    (toggle-read-only 1)
    (current-buffer))
***************
*** 824,830 ****
    "Edit file FILENAME in another window but don't allow changes.
  Like \\[find-file-other-window] but marks buffer as read-only.
  Use \\[toggle-read-only] to permit editing."
!   (interactive "fFind file read-only other window: \np")
    (find-file-other-window filename wildcards)
    (toggle-read-only 1)
    (current-buffer))
--- 852,858 ----
    "Edit file FILENAME in another window but don't allow changes.
  Like \\[find-file-other-window] but marks buffer as read-only.
  Use \\[toggle-read-only] to permit editing."
!   (interactive (find-file-read-args "fFind file read-only other window: "))
    (find-file-other-window filename wildcards)
    (toggle-read-only 1)
    (current-buffer))
***************
*** 833,839 ****
    "Edit file FILENAME in another frame but don't allow changes.
  Like \\[find-file-other-frame] but marks buffer as read-only.
  Use \\[toggle-read-only] to permit editing."
!   (interactive "fFind file read-only other frame: \np")
    (find-file-other-frame filename wildcards)
    (toggle-read-only 1)
    (current-buffer))
--- 861,867 ----
    "Edit file FILENAME in another frame but don't allow changes.
  Like \\[find-file-other-frame] but marks buffer as read-only.
  Use \\[toggle-read-only] to permit editing."
!   (interactive (find-file-read-args "fFind file read-only other frame: "))
    (find-file-other-frame filename wildcards)
    (toggle-read-only 1)
    (current-buffer))

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

* Re: C-x C-f RET problem...
  2002-05-17 19:29   ` Richard Stallman
@ 2002-05-17 21:43     ` Colin Walters
  2002-05-18  2:02     ` Miles Bader
  1 sibling, 0 replies; 12+ messages in thread
From: Colin Walters @ 2002-05-17 21:43 UTC (permalink / raw)


On Fri, 2002-05-17 at 15:29, Richard Stallman wrote:
> Here's another idea for how to implement the feature.  It only affects
> interactive calls to find-file and friends.  If you just type RET, you
> visit the directory, but if you want to use the visited file name
> instead, you just have to type M-n to get it.

I vote for this.

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

* Re: C-x C-f RET problem...
  2002-05-17 19:29   ` Richard Stallman
  2002-05-17 21:43     ` Colin Walters
@ 2002-05-18  2:02     ` Miles Bader
  2002-05-18  6:36       ` Eli Zaretskii
  1 sibling, 1 reply; 12+ messages in thread
From: Miles Bader @ 2002-05-18  2:02 UTC (permalink / raw)
  Cc: walters, emacs-devel

Richard Stallman <rms@gnu.org> writes:
> It only affects interactive calls to find-file and friends.  If you
> just type RET, you visit the directory, but if you want to use the
> visited file name instead, you just have to type M-n to get it.

That makes the M-n feature inconsistent with the way it works in the
rest of emacs...

-Miles

-- 
Quidquid latine dictum sit, altum viditur.

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

* Re: C-x C-f RET problem...
  2002-05-18  2:02     ` Miles Bader
@ 2002-05-18  6:36       ` Eli Zaretskii
  2002-05-18  7:12         ` Miles Bader
  0 siblings, 1 reply; 12+ messages in thread
From: Eli Zaretskii @ 2002-05-18  6:36 UTC (permalink / raw)
  Cc: emacs-devel

> From: Miles Bader <miles@gnu.org>
> Date: 18 May 2002 11:02:48 +0900
> 
> Richard Stallman <rms@gnu.org> writes:
> > It only affects interactive calls to find-file and friends.  If you
> > just type RET, you visit the directory, but if you want to use the
> > visited file name instead, you just have to type M-n to get it.
> 
> That makes the M-n feature inconsistent with the way it works in the
> rest of emacs...

How so?  When Emacs prompts for file names, M-n always brings the name
of the file being visited by the buffer.

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

* Re: C-x C-f RET problem...
  2002-05-18  6:36       ` Eli Zaretskii
@ 2002-05-18  7:12         ` Miles Bader
  0 siblings, 0 replies; 12+ messages in thread
From: Miles Bader @ 2002-05-18  7:12 UTC (permalink / raw)
  Cc: emacs-devel

"Eli Zaretskii" <eliz@is.elta.co.il> writes:
> How so?  When Emacs prompts for file names, M-n always brings the name
> of the file being visited by the buffer.

The name brought up by M-n is supposed to be the `default' name, which
you get by simply typing RET -- and that in fact is how C-x C-f
currently works.

-Miles
-- 
Somebody has to do something, and it's just incredibly pathetic that it
has to be us.  -- Jerry Garcia

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

end of thread, other threads:[~2002-05-18  7:12 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2002-05-16  7:45 C-x C-f RET problem Pavel Janík
2002-05-16  8:02 ` Miles Bader
2002-05-16 19:02 ` Colin Walters
2002-05-16 19:24   ` Miles Bader
2002-05-16 21:51     ` Kim F. Storm
2002-05-16 21:13       ` Alan Shutko
2002-05-16 21:18       ` Miles Bader
2002-05-17 19:29   ` Richard Stallman
2002-05-17 21:43     ` Colin Walters
2002-05-18  2:02     ` Miles Bader
2002-05-18  6:36       ` Eli Zaretskii
2002-05-18  7:12         ` Miles Bader

Code repositories for project(s) associated with this public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).