Function: majutsu-jjdescription-buffer-message

majutsu-jjdescription-buffer-message is a natively compiled function defined in majutsu-jjdescription.el.

Signature

(majutsu-jjdescription-buffer-message)

Documentation

Return the current description without JJ comments.

Return nil when the remaining text is empty or whitespace only.

Source Code

;; Defined in /nix/store/jagqw3nms546pad0gxi5f3wsckk6pji7-emacs-packages-deps/share/emacs/site-lisp/majutsu-jjdescription.el
(defun majutsu-jjdescription-buffer-message ()
  "Return the current description without JJ comments.
Return nil when the remaining text is empty or whitespace only."
  (let ((comment-re (majutsu-jjdescription--comment-prefix-re))
        (ignore-rest-re (majutsu-jjdescription--ignore-rest-line-re))
        (str (buffer-substring-no-properties (point-min) (point-max))))
    (with-temp-buffer
      (insert str)
      (goto-char (point-min))
      (when (re-search-forward ignore-rest-re nil t)
        (delete-region (line-beginning-position) (point-max)))
      (goto-char (point-min))
      (flush-lines comment-re)
      (goto-char (point-max))
      (when (and (> (point) (point-min))
                 (not (eq (char-before) ?\n)))
        (insert ?\n))
      (setq str (buffer-string)))
    (and (not (string-match-p "\\`[ \t\n\r]*\\'" str))
         (progn
           (when (string-match "\\`\n\\{2,\\}" str)
             (setq str (replace-match "\n" t t str)))
           (when (string-match "\n\\{2,\\}\\'" str)
             (setq str (replace-match "\n" t t str)))
           str))))