unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* insert-last-message
@ 2019-03-01 22:24 Emanuel Berg
  2019-03-02  4:33 ` insert-last-message Marcin Borkowski
  0 siblings, 1 reply; 3+ messages in thread
From: Emanuel Berg @ 2019-03-01 22:24 UTC (permalink / raw)
  To: emacs-devel

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




^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: insert-last-message
  2019-03-01 22:24 insert-last-message Emanuel Berg
@ 2019-03-02  4:33 ` Marcin Borkowski
  2019-03-02 19:29   ` insert-last-message Emanuel Berg
  0 siblings, 1 reply; 3+ messages in thread
From: Marcin Borkowski @ 2019-03-02  4:33 UTC (permalink / raw)
  To: Emanuel Berg; +Cc: emacs-devel

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



^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: insert-last-message
  2019-03-02  4:33 ` insert-last-message Marcin Borkowski
@ 2019-03-02 19:29   ` Emanuel Berg
  0 siblings, 0 replies; 3+ messages in thread
From: Emanuel Berg @ 2019-03-02 19:29 UTC (permalink / raw)
  To: emacs-devel

Marcin Borkowski wrote:

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

Hm... interesting!

-- 
underground experts united
http://user.it.uu.se/~embe8573




^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2019-03-02 19:29 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).