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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: using (current-message) bound to a key


From: Nicolas Richard
Subject: Re: using (current-message) bound to a key
Date: Thu, 11 Jul 2013 13:06:44 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux)

Peter Dyballa <Peter_Dyballa@Web.DE> writes:

> Am 11.07.2013 um 11:56 schrieb Nicolas Richard:
>
>> I'm trying to access what's located in the echo area.
>
> You can find it also in *Messages* buffer…

Yes, thank you, but while this is true most of the time, it is not
always true -- and sometimes the text is slightly different (usually: a
"user-error: " or "call-interactively: " can be prepended, or " [n
times]" can be appended).

I do admit that the following would be good enough in all cases I can
think of:

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

-- 
Nicolas



reply via email to

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