[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: insert-last-message
From: |
Marcin Borkowski |
Subject: |
Re: insert-last-message |
Date: |
Sat, 02 Mar 2019 05:33:28 +0100 |
User-agent: |
mu4e 1.1.0; emacs 27.0.50 |
Cf. http://mbork.pl/2017-05-01_show-some-last-messages
Best,
mb
On 2019-03-01, at 23:24, Emanuel Berg <address@hidden> wrote:
> I just wrote this:
>
> (defun insert-last-message ()
> (interactive)
> (insert
> (with-current-buffer (messages-buffer)
> (let ((end (goto-char (point-max)))
> (start (re-search-backward "^[[:space:]]*[[:graph:]]+")) )
> (buffer-substring start end) ))))
> (defalias 'ilm #'insert-last-message)
>
> Again, this is another example of something
> that seems to work, but it doesn't look good,
> and I'm pretty sure it won't work in all cases
> (e.g., multiline messages, possibly also
> messages with wierd chars etc).
>
> What I would like to have, and what I think
> would be the sound solution, is to have a
> data structure, a stack list, with the most
> recent messages. One could have a variable to
> specify the desired length of that list.
> Every message would then go into that list, and
> be accessed LIFO.
>
> After that, one could easily even do
> prefix args to access/output/insert not the
> last, but the second last message, or any
> message stored, if one can keep track of them
> that is :)
>
> Also, one could have a "blacklist" with
> uninteresting messages, that would never enter
> the list. Perhaps even a regexp blacklist, if
> that wouldn't be too slow (?).
>
> And when all of it still fails, one could still
> use the *Messages* buffer and get whatever
> one wants!
>
> Is this a difficult thing to do?
>
> Source:
>
> http://user.it.uu.se/~embe8573/emacs-init/my-misc.el
--
Marcin Borkowski
http://mbork.pl