Function: majutsu-jjdescription-prev-message

majutsu-jjdescription-prev-message is an interactive and natively compiled function defined in majutsu-jjdescription.el.

Signature

(majutsu-jjdescription-prev-message ARG)

Documentation

Cycle backward through description history, saving current text first.

With a numeric prefix ARG, go back ARG descriptions.

Key Bindings

majutsu-jjdescription-mode-map M-p

Source Code

;; Defined in /nix/store/jagqw3nms546pad0gxi5f3wsckk6pji7-emacs-packages-deps/share/emacs/site-lisp/majutsu-jjdescription.el
(defun majutsu-jjdescription-prev-message (arg)
  "Cycle backward through description history, saving current text first.
With a numeric prefix ARG, go back ARG descriptions."
  (interactive "*p")
  (let ((len (ring-length log-edit-comment-ring)))
    (if (<= len 0)
        (progn (message "Empty description ring") (ding))
      (when-let* ((message (majutsu-jjdescription-buffer-message))
                  (_ (not (ring-member log-edit-comment-ring message))))
        (ring-insert log-edit-comment-ring message)
        (cl-incf arg)
        (setq len (ring-length log-edit-comment-ring)))
      (delete-region (point-min) (majutsu-jjdescription--message-region-end))
      (setq log-edit-comment-ring-index (log-edit-new-comment-index arg len))
      (message "Description %d" (1+ log-edit-comment-ring-index))
      (insert (ring-ref log-edit-comment-ring log-edit-comment-ring-index)))))