all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Marcin Borkowski <mbork@mbork.pl>
To: Emanuel Berg <moasenwood@zoho.eu>
Cc: emacs-devel@gnu.org
Subject: Re: insert-last-message
Date: Sat, 02 Mar 2019 05:33:28 +0100	[thread overview]
Message-ID: <87wolhopyf.fsf@mbork.pl> (raw)
In-Reply-To: <86sgw6p71e.fsf@zoho.eu>

Cf. http://mbork.pl/2017-05-01_show-some-last-messages

Best,
mb


On 2019-03-01, at 23:24, Emanuel Berg <moasenwood@zoho.eu> 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



  reply	other threads:[~2019-03-02  4:33 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-03-01 22:24 insert-last-message Emanuel Berg
2019-03-02  4:33 ` Marcin Borkowski [this message]
2019-03-02 19:29   ` insert-last-message Emanuel Berg
  -- strict thread matches above, loose matches on Subject: below --
2019-03-01 22:20 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=87wolhopyf.fsf@mbork.pl \
    --to=mbork@mbork.pl \
    --cc=emacs-devel@gnu.org \
    --cc=moasenwood@zoho.eu \
    /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.