help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

How can I get the last message outputted?


From: Emanuel Berg
Subject: How can I get the last message outputted?
Date: Wed, 28 Oct 2020 06:03:30 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux)

T2C - The Emacs Challenge Competition - round 4

How do I get the last message that was outputted?

How can I get the last message?

(defun get-last-message ()
  (interactive)
   (let ((msg-buffer (get-buffer "*Messages*")))
    (when msg-buffer
      (with-temp-buffer
        (insert-buffer-substring msg-buffer)
        (goto-char (point-max))
        (forward-line -1)
        (let ((beg (point-at-bol))
              (end (point-at-eol)) )
          (buffer-substring-no-properties beg end) )))))

;; (message "I was afraid you'd be trapped outside the city.")
;; (message "Hey, I wasn't worried for a microsecond!")
;; (message "Then you probably didn't understand the situation.")
;;
;; (get-last-message)


PS. Yes, tha were tArcee and Hot Rod. 1986 TF:TM <3

-- 
underground experts united
http://user.it.uu.se/~embe8573
https://dataswamp.org/~incal




reply via email to

[Prev in Thread] Current Thread [Next in Thread]