From: Emanuel Berg <moasenwood@zoho.eu>
To: help-gnu-emacs@gnu.org
Subject: insert-last-message
Date: Fri, 01 Mar 2019 23:20:38 +0100 [thread overview]
Message-ID: <861s3qqls9.fsf@zoho.eu> (raw)
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
--
underground experts united
http://user.it.uu.se/~embe8573
next reply other threads:[~2019-03-01 22:20 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-03-01 22:20 Emanuel Berg [this message]
-- strict thread matches above, loose matches on Subject: below --
2019-03-01 22:24 insert-last-message Emanuel Berg
2019-03-02 4:33 ` insert-last-message Marcin Borkowski
2019-03-02 19:29 ` insert-last-message Emanuel Berg
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=861s3qqls9.fsf@zoho.eu \
--to=moasenwood@zoho.eu \
--cc=help-gnu-emacs@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.