unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* It is prompting me for a filename. I would like to fill in the current filename.
@ 2002-04-07  9:41 Dan Jacobson
  2002-04-07 16:48 ` Andreas Schwab
  0 siblings, 1 reply; 12+ messages in thread
From: Dan Jacobson @ 2002-04-07  9:41 UTC (permalink / raw)


Let's say we are in the minibuffer answering a C-x C-w question or a
dired R or C question.  Wouldn't it be great if there were a keystroke
at this point to insert the current filename... as we probably just
want to make minor adjustments to it.

Sure we can use M-p and M-n, they will give us recent choices but not
the current filename in question.  I hit C-h m there and see I am in
Fundamental mode, thus no tips about neat keystrokes available, not
even M-n, M-p.  Wait, if I do C-x C-w C-h b I can see some stuff like
ESC v [odd, I thought we were supposed to call it M-v] Ok, but still
no current filename appender.  Currently the best we can do is hit w
in dired before we get here.

Note there are the current filename we are on (in dired), and the
actual current filename (for C-x C-w) -- two different origins of my
desired "current filename".

Oh, I just tried ESC v, and sure it helps a little with picking out
the current filename, but it also doesn't give you a chance to then
edit it.  its just wham bam thank you maam.
-- 
http://jidanni.org/ Taiwan(04)25854780

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

* Re: It is prompting me for a filename. I would like to fill in the current filename.
  2002-04-07  9:41 It is prompting me for a filename. I would like to fill in the current filename Dan Jacobson
@ 2002-04-07 16:48 ` Andreas Schwab
  2002-04-08 17:49   ` D. Goel
  0 siblings, 1 reply; 12+ messages in thread
From: Andreas Schwab @ 2002-04-07 16:48 UTC (permalink / raw)
  Cc: gnu-emacs-bug

Dan Jacobson <jidanni@deadspam.com> writes:

|> Let's say we are in the minibuffer answering a C-x C-w question or a
|> dired R or C question.  Wouldn't it be great if there were a keystroke
|> at this point to insert the current filename... as we probably just
|> want to make minor adjustments to it.
|> 
|> Sure we can use M-p and M-n

Then why don't you just use M-n?

Andreas.

-- 
Andreas Schwab, SuSE Labs, schwab@suse.de
SuSE GmbH, Deutschherrnstr. 15-19, D-90429 Nürnberg
Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."

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

* Re: It is prompting me for a filename. I would like to fill in the current filename.
  2002-04-07 16:48 ` Andreas Schwab
@ 2002-04-08 17:49   ` D. Goel
  2002-04-09 10:07     ` Andreas Schwab
  0 siblings, 1 reply; 12+ messages in thread
From: D. Goel @ 2002-04-08 17:49 UTC (permalink / raw)



> Then why don't you just use M-n?

i think Dan explained that in the post..

D				   <http://www.glue.umd.edu/~deego>
-- 
Signature?  Naah.  Just some recently visited websites:
http://www.wired.com/wired/archive/9.12/aspergers_pr.html

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

* Re: It is prompting me for a filename. I would like to fill in the current filename.
  2002-04-08 17:49   ` D. Goel
@ 2002-04-09 10:07     ` Andreas Schwab
  2002-04-09 14:11       ` D. Goel
  0 siblings, 1 reply; 12+ messages in thread
From: Andreas Schwab @ 2002-04-09 10:07 UTC (permalink / raw)
  Cc: gnu-emacs-bug

"D. Goel" <deego@glue.umd.edu> writes:

|> > Then why don't you just use M-n?
|> 
|> i think Dan explained that in the post..

I don't think so.  M-n is explicitly mentioned in NEWS, and properly
documented in the Emacs manual.  So he could just read the docs.

Andreas.

-- 
Andreas Schwab, SuSE Labs, schwab@suse.de
SuSE GmbH, Deutschherrnstr. 15-19, D-90429 Nürnberg
Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."

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

* Re: It is prompting me for a filename. I would like to fill in the current filename.
  2002-04-09 10:07     ` Andreas Schwab
@ 2002-04-09 14:11       ` D. Goel
  2002-04-09 14:31         ` Miles Bader
                           ` (2 more replies)
  0 siblings, 3 replies; 12+ messages in thread
From: D. Goel @ 2002-04-09 14:11 UTC (permalink / raw)


schwab@suse.de (Andreas Schwab) writes:

> "D. Goel" <deego@glue.umd.edu> writes:
> 
> |> > Then why don't you just use M-n?
> |> 
> |> i think Dan explained that in the post..
> 
> I don't think so.  M-n is explicitly mentioned in NEWS, and properly
> documented in the Emacs manual.  So he could just read the docs.

Dan said:

,----
| Sure we can use M-p and M-n, they will give us recent choices but not
| the current filename in question. 
`----

And indeed, recent choices may have nothing to do with the current
filename, AFAICT.  (only if you opened the file recently, and made a
minor change without doing too much else, will the filename will be in
recent history...  ) ...   unless i am missing your point?

i can't deduce anything more from your one-liner of:

> |> > Then why don't you just use M-n?
> 

D				   <http://www.glue.umd.edu/~deego>
-- 
Signature?  Naah.  Just some recently visited websites:
http://www.wired.com/wired/archive/9.12/aspergers_pr.html

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

* Re: It is prompting me for a filename. I would like to fill in the current filename.
  2002-04-09 14:11       ` D. Goel
@ 2002-04-09 14:31         ` Miles Bader
  2002-04-09 14:50         ` Andreas Schwab
  2002-04-09 16:03         ` Kai Großjohann
  2 siblings, 0 replies; 12+ messages in thread
From: Miles Bader @ 2002-04-09 14:31 UTC (permalink / raw)


"D. Goel" <deego@glue.umd.edu> writes:
>  unless i am missing your point?

You are (though he could have been a bit more helpful).  The emacs
manual says of M-n (in the info node `(emacs)Minibuffer History'):

      For many minibuffer arguments there is a "default" value.  In some
   cases, the minibuffer history commands know the default value.  Then you
   can insert the default value into the minibuffer as text by using `M-n'
   to move "into the future" in the history.  Eventually we hope to make
   this feature available whenever the minibuffer has a default value.

In particular, if you use M-n to `move into the future' at many
file-operation prompts, it will use the filename of the current buffer
(or the filename under point in dired).

-Miles
-- 
I'd rather be consing.

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

* Re: It is prompting me for a filename. I would like to fill in the current filename.
  2002-04-09 14:11       ` D. Goel
  2002-04-09 14:31         ` Miles Bader
@ 2002-04-09 14:50         ` Andreas Schwab
  2002-04-09 16:58           ` D. Goel
  2002-04-10  7:28           ` Dan Jacobson
  2002-04-09 16:03         ` Kai Großjohann
  2 siblings, 2 replies; 12+ messages in thread
From: Andreas Schwab @ 2002-04-09 14:50 UTC (permalink / raw)
  Cc: gnu-emacs-bug

"D. Goel" <deego@glue.umd.edu> writes:

|> schwab@suse.de (Andreas Schwab) writes:
|> 
|> > "D. Goel" <deego@glue.umd.edu> writes:
|> > 
|> > |> > Then why don't you just use M-n?
|> > |> 
|> > |> i think Dan explained that in the post..
|> > 
|> > I don't think so.  M-n is explicitly mentioned in NEWS, and properly
|> > documented in the Emacs manual.  So he could just read the docs.
|> 
|> Dan said:
|> 
|> ,----
|> | Sure we can use M-p and M-n, they will give us recent choices but not
|> | the current filename in question. 
|> `----
|> 
|> And indeed, recent choices may have nothing to do with the current
|> filename, AFAICT.

You didn't try it yet, did you?  Unless Dan doesn't talk about Emacs 21,
this works at expected.

Andreas.

-- 
Andreas Schwab, SuSE Labs, schwab@suse.de
SuSE GmbH, Deutschherrnstr. 15-19, D-90429 Nürnberg
Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."

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

* Re: It is prompting me for a filename. I would like to fill in the current filename.
  2002-04-09 14:11       ` D. Goel
  2002-04-09 14:31         ` Miles Bader
  2002-04-09 14:50         ` Andreas Schwab
@ 2002-04-09 16:03         ` Kai Großjohann
  2 siblings, 0 replies; 12+ messages in thread
From: Kai Großjohann @ 2002-04-09 16:03 UTC (permalink / raw)


"D. Goel" <deego@glue.umd.edu> writes:

> Dan said:
>
> ,----
> | Sure we can use M-p and M-n, they will give us recent choices but not
> | the current filename in question. 
> `----
>
> And indeed, recent choices may have nothing to do with the current
> filename, AFAICT.  (only if you opened the file recently, and made a
> minor change without doing too much else, will the filename will be in
> recent history...  ) ...   unless i am missing your point?

Please note that, some time ago, some commands were changed in such a
way that there is some "default input" which is available via M-n.

In Emacs 20.6, the default input is not available for the `R' command
in dired, but it _is_ available for the C-x C-w command.

In Emacs 21.1, the `R' command also supports this default.

Does this clear up the issue?

kai
-- 
Silence is foo!

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

* Re: It is prompting me for a filename. I would like to fill in the current filename.
  2002-04-09 14:50         ` Andreas Schwab
@ 2002-04-09 16:58           ` D. Goel
  2002-04-10  7:28           ` Dan Jacobson
  1 sibling, 0 replies; 12+ messages in thread
From: D. Goel @ 2002-04-09 16:58 UTC (permalink / raw)


> You didn't try it yet, did you?  

i see now..  i did try it just now, and indeed, the default is already
what Dan was asking for.  Thanks also to Kai and Miles.

> Unless Dan doesn't talk about Emacs 21, this works at expected.
> 
> Andreas.

D				   <http://www.glue.umd.edu/~deego>
-- 
Signature?  Naah.  Just some recently visited websites:
http://www.wired.com/wired/archive/9.12/aspergers_pr.html

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

* Re: It is prompting me for a filename. I would like to fill in the current filename.
  2002-04-09 14:50         ` Andreas Schwab
  2002-04-09 16:58           ` D. Goel
@ 2002-04-10  7:28           ` Dan Jacobson
  2002-04-10 16:46             ` Kevin Rodgers
  2002-04-23 22:03             ` Jeff Dwork
  1 sibling, 2 replies; 12+ messages in thread
From: Dan Jacobson @ 2002-04-10  7:28 UTC (permalink / raw)


And there it was, on M-n.  That means I wasted all your times.
Sorry.  Maybe I did M-p M-p M-p M-n M-n so thought I checked all
around not thinking that it was hiding on the first M-n.

Wait, the M-n is far from universal.  It is not there often:
$ LC_ALL=C emacs -q --no-site-file -nw /tmp
! ESC n
sure, you might say that I could use "*" here, but then I would
respond that I wished to edit the name.  You could say why not use w !
C-y, but I would say I've already hit ! and begun to type other things
and it is inconvenient for me to go back and hit w at this time.
Sure, C-a C-k C-g w ! C-y C-y M-y or something... inconvenient.

Anyways, let's say I had hit M-! instead of ! ... anyways, in each
case the user wishes that emacs would have the most relevant file name
at the tip of its tongue, ready for use at any time... perhaps have it
ready in one of those many registers lying around or something... the
idea is a standard key sequence that will yank it, add ^U and you get
the full path... not only usable the minibuffer, but even in the file
itself.

As often even dabbrev-expand doesn't know about the name of the
current file we're editing until we've at least saved it and have its
name in a dired or something, this feature would be handy.

Anyways, M-n will blot out anything else that you have typed in
already on that line in the minibuffer.  Also it isn't a general
solution in case we aren't in the minibuffer.
-- 
http://jidanni.org/ Taiwan(04)25854780

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

* Re: It is prompting me for a filename. I would like to fill in the  current filename.
  2002-04-10  7:28           ` Dan Jacobson
@ 2002-04-10 16:46             ` Kevin Rodgers
  2002-04-23 22:03             ` Jeff Dwork
  1 sibling, 0 replies; 12+ messages in thread
From: Kevin Rodgers @ 2002-04-10 16:46 UTC (permalink / raw)


Dan Jacobson wrote:

> Wait, the M-n is far from universal.  It is not there often:
> $ LC_ALL=C emacs -q --no-site-file -nw /tmp
> ! ESC n
> sure, you might say that I could use "*" here, but then I would
> respond that I wished to edit the name.  You could say why not use w !
> C-y, but I would say I've already hit ! and begun to type other things
> and it is inconvenient for me to go back and hit w at this time.
> Sure, C-a C-k C-g w ! C-y C-y M-y or something... inconvenient.

Depress the clutch pedal before moving the gear shifter.

> Anyways, let's say I had hit M-! instead of ! ... anyways, in each
> case the user wishes that emacs would have the most relevant file name
> at the tip of its tongue, ready for use at any time... perhaps have it
> ready in one of those many registers lying around or something... the
> idea is a standard key sequence that will yank it, add ^U and you get
> the full path... not only usable the minibuffer, but even in the file
> itself.

I do NOT want Emacs manipulating the kill ring behind my back.

> As often even dabbrev-expand doesn't know about the name of the
> current file we're editing until we've at least saved it and have its
> name in a dired or something, this feature would be handy.

That's an interesting idea.  Perhaps a dabbrev user can implement it.

> Anyways, M-n will blot out anything else that you have typed in
> already on that line in the minibuffer.

Either use M-n first, or kill whatever you've already typed into the
minibuffer so you can yank it back after M-n.

> Also it isn't a general
> solution in case we aren't in the minibuffer.

But your orginal bug report begins:
>>Let's say we are in the minibuffer answering a C-x C-w question or a
>>dired R or C question.  Wouldn't it be great if there were a keystroke
>>at this point to insert the current filename... as we probably just
>>want to make minor adjustments to it.

-- 
Kevin Rodgers <kevinr@ihs.com>

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

* Re: It is prompting me for a filename. I would like to fill in the current filename.
  2002-04-10  7:28           ` Dan Jacobson
  2002-04-10 16:46             ` Kevin Rodgers
@ 2002-04-23 22:03             ` Jeff Dwork
  1 sibling, 0 replies; 12+ messages in thread
From: Jeff Dwork @ 2002-04-23 22:03 UTC (permalink / raw)


I wrote this many years ago.  It never made it into the elisp
archives, but it is in Google's gnu.emacs.sources archive as
"mini-ibfn.el".  I just tested it on emacs 21.1 and it still works.

It's short, so I'll include it here:

;;; mini-ibfn.el --- insert buffer-file-name (with or without directory) into minibuffer.

;; Copyright (C) 1994 Jeff Dwork.

;; Author: Jeff Dwork <jeff.dwork@amd.com>
;; Version: 1.00
;; Date: 06-Nov-94

;;; This file is not part of GNU Emacs.

;;; This program is free software; you can redistribute it and/or modify
;;; it under the terms of the GNU General Public License as published by
;;; the Free Software Foundation; either version 2, or (at your option)
;;; any later version.

;;; This program is distributed in the hope that it will be useful,
;;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
;;; GNU General Public License for more details.

;;; You should have received a copy of the GNU General Public License
;;; along with GNU Emacs; see the file COPYING.  If not, write to
;;; the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.

;;; Commentary:

;; Purpose:
;;
;; To provide a quick way to insert the current buffer-file-name into
;; the minibuffer.  If the current buffer is a dired buffer, inserts
;; the filename point is on.
;;
;; Very useful for finding related files, doing copies or renames, etc.
;;

;; Installation:
;; 
;; Put this file somewhere where Emacs can find it (i.e., in one of the paths
;; in your `load-path'), `byte-compile-file' it, and put something like this
;; in your ~/.emacs:
;;
;;   (load "mini-ibfn" nil t)
;;   (define-key minibuffer-local-map "\C-c\C-f" 'minibuffer-ins-buffer-file-name)
;;   (define-key minibuffer-local-ns-map "\C-c\C-f" 'minibuffer-ins-buffer-file-name)
;;   (define-key minibuffer-local-completion-map "\C-c\C-f" 'minibuffer-ins-buffer-file-name)
;;   (define-key minibuffer-local-must-match-map "\C-c\C-f" 'minibuffer-ins-buffer-file-name)
;;
;; minibuffer-ins-buffer-file-name has been tested on FSF Emacs 18.59 and 19.28.
;;

;; Feedback:
;;
;; Please send me bug reports, bug fixes, and extensions, so that I can
;; merge them into the master source.
;;     - Jeff Dwork (jeff.dwork@amd.com)

;; History:
;;
;; Based on code from Pete Halverson and Piet van Oostrum
;;

(defun minibuffer-ins-buffer-file-name (arg)
  "Insert the non-dir file name of the current buffer into the minibuffer.
Insert full file name if called with arg.  If current buffer is in dired-mode,
insert filename point is on."
  (interactive "P")
  ;; We assume that the first entry in the buffer list with a non-nil
  ;; buffer-file-name or which is in dired-mode is the "real" current buffer,
  ;; since "(current-buffer)" just returns the minibuffer we're in.
  (let ((cbf (cdr (buffer-list))) b-f-name in-dired-mode)
    (while (and cbf (not (or 
			   (setq b-f-name (buffer-file-name (car cbf)))
			   (save-excursion
			     (set-buffer (car cbf))
			     (if (eq major-mode 'dired-mode)
				 (setq in-dired-mode t))))))
      (setq cbf (cdr cbf)))
    (if (or b-f-name in-dired-mode)
	(progn
	  (if in-dired-mode
	      (save-excursion
		(set-buffer (car cbf))
		(setq b-f-name (dired-get-filename))))
	  (if arg
	      (insert b-f-name)
	      (insert (file-name-nondirectory b-f-name))))
	(beep))))

;; end of mini-ibfn.el


Dan Jacobson writes:
 > To: gnu-emacs-bug@moderators.isc.org
 > Subject: Re: It is prompting me for a filename. I would like to fill in
 >  the current filename.
 > Date: 10 Apr 2002 15:28:47 +0800
 > 
 > And there it was, on M-n.  That means I wasted all your times.
 > Sorry.  Maybe I did M-p M-p M-p M-n M-n so thought I checked all
 > around not thinking that it was hiding on the first M-n.
 > 
...
 > 
 > Anyways, M-n will blot out anything else that you have typed in
 > already on that line in the minibuffer.  Also it isn't a general
 > solution in case we aren't in the minibuffer.
 > -- 
 > http://jidanni.org/ Taiwan(04)25854780
 > 
 > _______________________________________________
 > Bug-gnu-emacs mailing list
 > Bug-gnu-emacs@gnu.org
 > http://mail.gnu.org/mailman/listinfo/bug-gnu-emacs

-- 
Jeff Dwork                      |           jeff.dwork@amd.com
Advanced Micro Devices, M/S 45  | 408-749-5216 (voice) 408-774-8448 (fax)
PO Box 3453                     |----------------------------------------
Sunnyvale, Ca 94088-3453        | 

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

end of thread, other threads:[~2002-04-23 22:03 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2002-04-07  9:41 It is prompting me for a filename. I would like to fill in the current filename Dan Jacobson
2002-04-07 16:48 ` Andreas Schwab
2002-04-08 17:49   ` D. Goel
2002-04-09 10:07     ` Andreas Schwab
2002-04-09 14:11       ` D. Goel
2002-04-09 14:31         ` Miles Bader
2002-04-09 14:50         ` Andreas Schwab
2002-04-09 16:58           ` D. Goel
2002-04-10  7:28           ` Dan Jacobson
2002-04-10 16:46             ` Kevin Rodgers
2002-04-23 22:03             ` Jeff Dwork
2002-04-09 16:03         ` Kai Großjohann

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