From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Emanuel Berg Newsgroups: gmane.emacs.help Subject: Re: Is there a way to get the last message? Date: Sun, 28 May 2017 20:24:20 +0200 Message-ID: References: <87r2z92r2z.fsf@jane> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: blaine.gmane.org 1495995919 19300 195.159.176.226 (28 May 2017 18:25:19 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Sun, 28 May 2017 18:25:19 +0000 (UTC) User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.4 (gnu/linux) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Sun May 28 20:25:13 2017 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dF2sK-0004s1-S1 for geh-help-gnu-emacs@m.gmane.org; Sun, 28 May 2017 20:25:12 +0200 Original-Received: from localhost ([::1]:44872 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dF2sQ-000454-B8 for geh-help-gnu-emacs@m.gmane.org; Sun, 28 May 2017 14:25:18 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:38247) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dF2rl-00043J-3V for help-gnu-emacs@gnu.org; Sun, 28 May 2017 14:24:38 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dF2rh-0004JO-4m for help-gnu-emacs@gnu.org; Sun, 28 May 2017 14:24:37 -0400 Original-Received: from [195.159.176.226] (port=55059 helo=blaine.gmane.org) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1dF2rg-0004JF-V0 for help-gnu-emacs@gnu.org; Sun, 28 May 2017 14:24:33 -0400 Original-Received: from list by blaine.gmane.org with local (Exim 4.84_2) (envelope-from ) id 1dF2rX-0003qj-Rr for help-gnu-emacs@gnu.org; Sun, 28 May 2017 20:24:23 +0200 X-Injected-Via-Gmane: http://gmane.org/ Mail-Followup-To: help-gnu-emacs@gnu.org Original-Lines: 65 Original-X-Complaints-To: usenet@blaine.gmane.org Mail-Copies-To: never Cancel-Lock: sha1:D3yhZFvgelaZR00LP70C8QzL+iM= X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 195.159.176.226 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "help-gnu-emacs" Xref: news.gmane.org gmane.emacs.help:113229 Archived-At: 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 () (interactive) (switch-to-buffer (messages-buffer)) (goto-char (point-max)) ) then, in the message buffer, mark the message, and (defun web-search () (interactive) (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 http://user.it.uu.se/~embe8573/conf/emacs-init/w3m/w3m-unisearch.el 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 http://user.it.uu.se/~embe8573