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: Nicolas Richard
Subject: Re: How to put default-directory into kill-ring?
Date: Fri, 14 Feb 2014 14:40:03 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux)

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.

-- 
Nico.



reply via email to

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