;;; -*- lexical-binding: t -*- ;; ;; this file: ;; https://dataswamp.org/~incal/emacs-init/echo-message.el (defun get-last-message (&optional n) (interactive) (or n (setq n 1) ) (let ((msg-buffer (get-buffer "*Messages*"))) (when (bufferp msg-buffer) (with-current-buffer msg-buffer (goto-char (point-max)) (forward-line (* -1 n)) (buffer-substring-no-properties (pos-bol) (pos-eol)) )))) ;; (progn (message "1") (get-last-message)) ;; (progn (message "2") (message "1") (get-last-message 2)) (provide 'echo-message)