unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* Opening file with is in killring
@ 2008-10-31 10:17 Decebal
  2008-10-31 12:28 ` Paul R
       [not found] ` <mailman.2561.1225456153.25473.help-gnu-emacs@gnu.org>
  0 siblings, 2 replies; 13+ messages in thread
From: Decebal @ 2008-10-31 10:17 UTC (permalink / raw)
  To: help-gnu-emacs

Sometimes I have the name of a file I want to open in the killring. At
the moment I give c-x c-f, delete the current path and then give c-y.
Is there a more efficiënt way to do this?


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

* Re: Opening file with is in killring
  2008-10-31 10:17 Opening file with is in killring Decebal
@ 2008-10-31 12:28 ` Paul R
  2008-10-31 14:31   ` Drew Adams
       [not found]   ` <mailman.2570.1225463508.25473.help-gnu-emacs@gnu.org>
       [not found] ` <mailman.2561.1225456153.25473.help-gnu-emacs@gnu.org>
  1 sibling, 2 replies; 13+ messages in thread
From: Paul R @ 2008-10-31 12:28 UTC (permalink / raw)
  To: help-gnu-emacs

Decebal> Sometimes I have the name of a file I want to open in the
Decebal> killring. At the moment I give c-x c-f, delete the current path
Decebal> and then give c-y. Is there a more efficiënt way to do this?

yes, with a recent emacs you can only past, after prompt default path,
and that should override default path. But to visit a file which path is
written in a buffer, you may want to use ffap (find-file-at-point).


-- 
  Paul




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

* RE: Opening file with is in killring
  2008-10-31 12:28 ` Paul R
@ 2008-10-31 14:31   ` Drew Adams
  2008-10-31 14:40     ` Paul R
       [not found]   ` <mailman.2570.1225463508.25473.help-gnu-emacs@gnu.org>
  1 sibling, 1 reply; 13+ messages in thread
From: Drew Adams @ 2008-10-31 14:31 UTC (permalink / raw)
  To: 'Paul R', help-gnu-emacs

> Decebal> Sometimes I have the name of a file I want to open in the
> Decebal> killring. At the moment I give c-x c-f, delete the current path
> Decebal> and then give c-y. Is there a more efficiënt way to do this?
> 
> yes, with a recent emacs you can only past, after prompt default path,
> and that should override default path. But to visit a file 
> which path is written in a buffer, you may want to use ffap
> (find-file-at-point).

Not sure what you're saying, but I think you're referring to yanking an absolute
file name, or a file name that starts with `~', after the default directory name
in the minibuffer. If so, that is not new but has been an Emacs feature for
decades. But it only works if the file name you yank is absolute or starts with
`~'.

If a relative file name (e.g. `foo.el') is in the kill ring, then I know of
nothing quicker than clearing the minibuffer and then yanking.

But I bind a key (I use `M-k') in the minibuffer keymaps to a command that
clears the minibuffer, so only two keystrokes are needed (`M-k C-y'). Without
such a binding, you can always use `C-x DEL' (`DEL' is typically the Backspace
key), which is `backward-kill-sentence', or `ESC C-backspace' or `ESC C-delete',
which are `backward-kill-sexp'. They can generally help to clear the minibuffer.





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

* Re: Opening file with is in killring
       [not found] ` <mailman.2561.1225456153.25473.help-gnu-emacs@gnu.org>
@ 2008-10-31 14:39   ` Decebal
  2008-11-01 13:41     ` Kevin Rodgers
  0 siblings, 1 reply; 13+ messages in thread
From: Decebal @ 2008-10-31 14:39 UTC (permalink / raw)
  To: help-gnu-emacs

On 31 okt, 13:28, Paul R <paul.r...@gmail.com> wrote:
> Decebal> Sometimes I have the name of a file I want to open in the
> Decebal> killring. At the moment I give c-x c-f, delete the current path
> Decebal> and then give c-y. Is there a more efficiënt way to do this?
>
> yes, with a recent emacs you can only past, after prompt default path,
> and that should override default path.

That works, very usefull. Because the default path is not taken way, I
always tought it did not work.


> But to visit a file which path is
> written in a buffer, you may want to use ffap (find-file-at-point).

I'll look at that also.


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

* Re: Opening file with is in killring
  2008-10-31 14:31   ` Drew Adams
@ 2008-10-31 14:40     ` Paul R
  2008-10-31 15:16       ` Drew Adams
       [not found]       ` <mailman.2573.1225466182.25473.help-gnu-emacs@gnu.org>
  0 siblings, 2 replies; 13+ messages in thread
From: Paul R @ 2008-10-31 14:40 UTC (permalink / raw)
  To: Drew Adams; +Cc: help-gnu-emacs

Hello Drew,

Drew> Not sure what you're saying, but I think you're referring to
Drew> yanking an absolute file name, or a file name that starts with
Drew> `~', after the default directory name in the minibuffer. If so,
Drew> that is not new but has been an Emacs feature for decades. But it
Drew> only works if the file name you yank is absolute or starts with
Drew> `~'.

I haven't been using emacs for decades yet, so it was just in case.

Drew> If a relative file name (e.g. `foo.el') is in the kill ring, then
Drew> I know of nothing quicker than clearing the minibuffer and then
Drew> yanking.

But in such a case, it would try to expand the relative file name from
default-directory, which is precisely the one printed by default in the
prompt, isn't it ? In this case, why remove the default prompt ? Just
yanking after should yield to the same result with fewer keystrokes.

-- 
  Paul




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

* RE: Opening file with is in killring
  2008-10-31 14:40     ` Paul R
@ 2008-10-31 15:16       ` Drew Adams
       [not found]       ` <mailman.2573.1225466182.25473.help-gnu-emacs@gnu.org>
  1 sibling, 0 replies; 13+ messages in thread
From: Drew Adams @ 2008-10-31 15:16 UTC (permalink / raw)
  To: 'Paul R'; +Cc: help-gnu-emacs

> Drew> If a relative file name (e.g. `foo.el') is in the kill ring, then
> Drew> I know of nothing quicker than clearing the minibuffer and then
> Drew> yanking.
> 
> But in such a case, it would try to expand the relative file name from
> default-directory, which is precisely the one printed by 
> default in the prompt, isn't it ?  In this case, why remove the
> default prompt ? Just yanking after should yield to the same result
> with fewer keystrokes.

Yes. If you want a different directory (which is presumably why one would clear
the minibuffer), then you need to insert (type or yank) that directory, in
addition to the relative file name.

I interpreted the OP as wanting to replace the default directory, to use a
different one, since he said "delete the current path". But from his reply
that's apparently not the case. (?)






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

* Re: Opening file with is in killring
       [not found]   ` <mailman.2570.1225463508.25473.help-gnu-emacs@gnu.org>
@ 2008-11-01  8:24     ` Decebal
  2008-11-01  8:29       ` Teemu Likonen
                         ` (2 more replies)
  0 siblings, 3 replies; 13+ messages in thread
From: Decebal @ 2008-11-01  8:24 UTC (permalink / raw)
  To: help-gnu-emacs

On Oct 31, 3:31 pm, "Drew Adams" <drew.ad...@oracle.com> wrote:
> But I bind a key (I use `M-k') in the minibuffer keymaps to a command that
> clears the minibuffer, so only two keystrokes are needed (`M-k C-y'). Without

What is this command?


> such a binding, you can always use `C-x DEL' (`DEL' is typically the Backspace
> key), which is `backward-kill-sentence', or `ESC C-backspace' or `ESC C-delete',
> which are `backward-kill-sexp'. They can generally help to clear the minibuffer.

But this puts the contents of the minibuffer in the killring. :-{
I understood that with m-y I should get the previous entry, but when I
use that I get:
    Previous command was not a yank

I have kill-ring-max set on 60. So anybody an idea what is happening
here?


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

* Re: Opening file with is in killring
       [not found]       ` <mailman.2573.1225466182.25473.help-gnu-emacs@gnu.org>
@ 2008-11-01  8:27         ` Decebal
  0 siblings, 0 replies; 13+ messages in thread
From: Decebal @ 2008-11-01  8:27 UTC (permalink / raw)
  To: help-gnu-emacs

On Oct 31, 4:16 pm, "Drew Adams" <drew.ad...@oracle.com> wrote:
> I interpreted the OP as wanting to replace the default directory, to use a
> different one, since he said "delete the current path". But from his reply
> that's apparently not the case. (?)

That was not the case, no. When I have a path/filename in the killring
I want to open I supposed that I had to delete the current path.
Luckily that is not the case. ;-}


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

* Re: Opening file with is in killring
  2008-11-01  8:24     ` Decebal
@ 2008-11-01  8:29       ` Teemu Likonen
  2008-11-01 20:07         ` Decebal
  2008-11-01 16:45       ` Drew Adams
       [not found]       ` <mailman.2644.1225557931.25473.help-gnu-emacs@gnu.org>
  2 siblings, 1 reply; 13+ messages in thread
From: Teemu Likonen @ 2008-11-01  8:29 UTC (permalink / raw)
  To: help-gnu-emacs

Decebal (2008-11-01 01:24 -0700) wrote:

> But this puts the contents of the minibuffer in the killring. :-{ I
> understood that with m-y I should get the previous entry, but when I
> use that I get:
>     Previous command was not a yank

The minibuffer works like any buffer in this regard. Clear the the
minibuffer with any commands ("C-a C-k", for example) and then yank some
previous entry with "C-y M-y" (repeat "M-y" if necessary).


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

* Re: Opening file with is in killring
  2008-10-31 14:39   ` Decebal
@ 2008-11-01 13:41     ` Kevin Rodgers
  0 siblings, 0 replies; 13+ messages in thread
From: Kevin Rodgers @ 2008-11-01 13:41 UTC (permalink / raw)
  To: help-gnu-emacs

Decebal wrote:
> On 31 okt, 13:28, Paul R <paul.r...@gmail.com> wrote:
>> Decebal> Sometimes I have the name of a file I want to open in the
>> Decebal> killring. At the moment I give c-x c-f, delete the current path
>> Decebal> and then give c-y. Is there a more efficiënt way to do this?
>>
>> yes, with a recent emacs you can only past, after prompt default path,
>> and that should override default path.
> 
> That works, very usefull. Because the default path is not taken way, I
> always tought it did not work.

After you insert the new path, type TAB to confirm your intent.
Completion will cause the original path to be deleted from the
minibuffer.

-- 
Kevin Rodgers
Denver, Colorado, USA





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

* RE: Opening file with is in killring
  2008-11-01  8:24     ` Decebal
  2008-11-01  8:29       ` Teemu Likonen
@ 2008-11-01 16:45       ` Drew Adams
       [not found]       ` <mailman.2644.1225557931.25473.help-gnu-emacs@gnu.org>
  2 siblings, 0 replies; 13+ messages in thread
From: Drew Adams @ 2008-11-01 16:45 UTC (permalink / raw)
  To: 'Decebal', help-gnu-emacs

> > I bind a key (I use `M-k') in the minibuffer keymaps to 
> > a command that clears the minibuffer, so only two
> > keystrokes are needed (`M-k C-y').
> 
> What is this command?

This will do it:
(defun foo () (interactive) (delete-minibuffer-contents))
(define-key minibuffer-local-map "\C-y" 'foo)

(Likewise, for any minibuffer keymaps that don't inherit from
`minibuffer-local-map'.)

[In reality, I bind `M-k' in the minibuffer to a command that either clears the
minibuffer (as above) or, if you are cycling through a minibuffer history,
deletes the current element from that history.]

> > such a binding, you can always use `C-x DEL' (`DEL' is 
> > typically the Backspace key), which is `backward-kill-sentence',
> > or `ESC C-backspace' or `ESC C-delete', which are
> > `backward-kill-sexp'. They can generally help to 
> > clear the minibuffer.
> 
> But this puts the contents of the minibuffer in the killring. :-{

Yes, and? ;-)

> I understood that with m-y I should get the previous entry, but when I
> use that I get: Previous command was not a yank

Correct. `C-y' yanks the head of the kill-ring. `M-y' replaces that insertion
with the previous kill-ring entry. `C-y' is a one-time thing; you can repeat
`M-y' to move through the ring until you get to the kill you want.

> I have kill-ring-max set on 60. So anybody an idea what is happening
> here?

See above.


[FWIW, outside of the minibuffer, I bind an Icicles multi-command to `C-- C-y'.
It lets you yank any items from the kill-ring using completion, without needing
to cycle through them. You can also cycle if you like, but you need not go
through all of them one by one. And you can sort them in various ways, which
helps when cycling. And you can hit `S-delete' to remove selected candidates
from the kill-ring. And you can filter completion matches using multiple
patterns (progressive completion), to quickly get to what you want.]







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

* Re: Opening file with is in killring
  2008-11-01  8:29       ` Teemu Likonen
@ 2008-11-01 20:07         ` Decebal
  0 siblings, 0 replies; 13+ messages in thread
From: Decebal @ 2008-11-01 20:07 UTC (permalink / raw)
  To: help-gnu-emacs

On Nov 1, 9:29 am, Teemu Likonen <tliko...@iki.fi> wrote:
> > But this puts the contents of the minibuffer in the killring. :-{ I
> > understood that with m-y I should get the previous entry, but when I
> > use that I get:
> >     Previous command was not a yank
>
> The minibuffer works like any buffer in this regard. Clear the the
> minibuffer with any commands ("C-a C-k", for example) and then yank some
> previous entry with "C-y M-y" (repeat "M-y" if necessary).

I understood the use of the killring not correctly. I first have to do
c-y and then m-y. I did not do the c-y. Now it works.


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

* Re: Opening file with is in killring
       [not found]       ` <mailman.2644.1225557931.25473.help-gnu-emacs@gnu.org>
@ 2008-11-01 20:20         ` Decebal
  0 siblings, 0 replies; 13+ messages in thread
From: Decebal @ 2008-11-01 20:20 UTC (permalink / raw)
  To: help-gnu-emacs

On Nov 1, 5:45 pm, "Drew Adams" <drew.ad...@oracle.com> wrote:
> > But this puts the contents of the minibuffer in the killring. :-{
>
> Yes, and? ;-)

I did not understand the use of the kill-ring.


> > I understood that with m-y I should get the previous entry, but when I
> > use that I get: Previous command was not a yank
>
> Correct. `C-y' yanks the head of the kill-ring. `M-y' replaces that insertion
> with the previous kill-ring entry. `C-y' is a one-time thing; you can repeat
> `M-y' to move through the ring until you get to the kill you want.

Now I do. :-D


> [FWIW, outside of the minibuffer, I bind an Icicles multi-command to `C-- C-y'.
> It lets you yank any items from the kill-ring using completion, without needing
> to cycle through them. You can also cycle if you like, but you need not go
> through all of them one by one. And you can sort them in various ways, which
> helps when cycling. And you can hit `S-delete' to remove selected candidates
> from the kill-ring. And you can filter completion matches using multiple
> patterns (progressive completion), to quickly get to what you want.]

That looks also like something to investigate.


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

end of thread, other threads:[~2008-11-01 20:20 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-10-31 10:17 Opening file with is in killring Decebal
2008-10-31 12:28 ` Paul R
2008-10-31 14:31   ` Drew Adams
2008-10-31 14:40     ` Paul R
2008-10-31 15:16       ` Drew Adams
     [not found]       ` <mailman.2573.1225466182.25473.help-gnu-emacs@gnu.org>
2008-11-01  8:27         ` Decebal
     [not found]   ` <mailman.2570.1225463508.25473.help-gnu-emacs@gnu.org>
2008-11-01  8:24     ` Decebal
2008-11-01  8:29       ` Teemu Likonen
2008-11-01 20:07         ` Decebal
2008-11-01 16:45       ` Drew Adams
     [not found]       ` <mailman.2644.1225557931.25473.help-gnu-emacs@gnu.org>
2008-11-01 20:20         ` Decebal
     [not found] ` <mailman.2561.1225456153.25473.help-gnu-emacs@gnu.org>
2008-10-31 14:39   ` Decebal
2008-11-01 13:41     ` Kevin Rodgers

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