[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: How to put default-directory into kill-ring?
From: |
Marcin Borkowski |
Subject: |
Re: How to put default-directory into kill-ring? |
Date: |
Fri, 14 Feb 2014 19:41:30 +0100 |
Dnia 2014-02-14, o godz. 14:40:03
Nicolas Richard <theonewiththeevillook@yahoo.fr> napisaĆ(a):
> Stefan Monnier <monnier@iro.umontreal.ca> writes:
>
> >> Well, as I wrote: M-x pwd currently does *nothing* with its prefix
> >> argument, and only outputs the default directory in the minibuffer.
> >> So C-u M-x pwd is basically "wasted".
> >
> > I guess that would be OK. Please M-x report-emacs-bug requesting
> > this as a new feature, to see what other developers think about it
> > (and so it's not forgotten until the trunk is unfrozen).
> >
> > I think M-: would also benefit from changing its "C-u means to
> > insert at point" to "C-u means to stash in the kill-ring". Tho, if
> > we could find a generic way to "get the message from this command
> > and stash it in the kill-ring" it might be even better.
>
> As a related question, I wish I had something for getting what's in
> the echo area. I currently uses the following heuristic:
> (defun yf/save-current-or-last-echo-area ()
> "Save current message in echo area as kill"
> (interactive)
> (let ((candidates
> (list
> (with-current-buffer " *Echo Area 1*"
> (buffer-string))
> (with-current-buffer " *Echo Area 0*"
> (buffer-string))
> (with-current-buffer "*Messages*"
> (save-excursion
> (goto-char
> (point-max))
> (skip-chars-backward "\n")
> (buffer-substring-no-properties
> (point)
> (progn
> (skip-chars-backward "^\n")
> (point))))))))
> (kill-new (car (remove "" candidates)))))
> (bind-key "<f5>" 'yf/save-current-or-last-echo-area)
>
> I have no idea why it's sometimes Echo Area 1 and sometimes 0, nor if
> I might miss an Echo Area 2.
I like this approach a lot! BTW, is checking " *Echo Area [01]*" even
necessary? I mean, its contents should be in "*Messages*" anyway,
right?
Best,
--
Marcin Borkowski
http://octd.wmi.amu.edu.pl/en/Marcin_Borkowski
Adam Mickiewicz University
- Re: How to put default-directory into kill-ring?, (continued)
- RE: How to put default-directory into kill-ring?, Drew Adams, 2014/02/04
- Re: How to put default-directory into kill-ring?, Leo Liu, 2014/02/04
- Re: How to put default-directory into kill-ring?, Barry OReilly, 2014/02/12
- Re: How to put default-directory into kill-ring?, Stefan Monnier, 2014/02/12
- Re: How to put default-directory into kill-ring?, Marcin Borkowski, 2014/02/14
- Re: How to put default-directory into kill-ring?, Stefan Monnier, 2014/02/14
- Re: How to put default-directory into kill-ring?, Nicolas Richard, 2014/02/14
- Re: How to put default-directory into kill-ring?, Stefan Monnier, 2014/02/14
- Re: How to put default-directory into kill-ring?,
Marcin Borkowski <=
- Re: How to put default-directory into kill-ring?, Nicolas Richard, 2014/02/14
- Re: How to put default-directory into kill-ring?, Marcin Borkowski, 2014/02/14
- Re: How to put default-directory into kill-ring?, Michael Heerdegen, 2014/02/14
- Re: How to put default-directory into kill-ring?, Marcin Borkowski, 2014/02/14