[Top][All Lists]

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

Re: Is there a way to get the last message?

From: Emanuel Berg
Subject: Re: Is there a way to get the last message?
Date: Sun, 28 May 2017 20:24:20 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.4 (gnu/linux)

Marcin Borkowski wrote:

> Is there any way to get the last thing
> displayed in the echo area (from `message' or
> possibly from `error', too)? This would be
> quite useful: one could then paste it to
> a search engine to look up the internet for
> some hints about the error/message.

In general, I've heard the message utility is
an underpowered feature in Emacs and it is not
beyond reason it could be useful to have a
data structure with messages and some variable
to set its history length. However, lacking
that (?), why not use the message
buffer itself?

Specifically for your proposed use case, this
seems to bit a bit of over-engineering. Do you
really Google error-messages in
such quantities?

What I would do is, first keybind this

    (defun switch-to-messages-buffer ()
      (switch-to-buffer (messages-buffer))
      (goto-char (point-max)) )

then, in the message buffer, mark the message,

    (defun web-search ()
      (let*((search-engine "Google")
            (search        (get-search-string search-engine)))
        (unless (empty-string-p search)
          (let ((tab-label (format "%s: %s" search-engine search)))
            (w3m-new-tab tab-label)
            (w3m-search w3m-search-default-engine search) ))))

I don't know if you use Emacs-w3m, if you do,
you can get that above code working with some
additional code found here

otherwise it should be not that difficult to do
the same with your prefered browser.

Really, to get to the message or error buffer
and mark the message is just a few keystrokes
away; and to be able to Google what is marked
in a buffer (or to use it as indata for
whatever search engine) is a good feature for
not only your proposed use-case but for many
other things as well.

So, as always, it is a good idea to optimize
the specifics and put the creativity into what
is general.

underground experts united

reply via email to

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