help-gnu-emacs
[Top][All Lists]
Advanced

[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 <address@hidden> napisaƂ(a):

> Stefan Monnier <address@hidden> 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



reply via email to

[Prev in Thread] Current Thread [Next in Thread]