Function: defun-markdown-buffer

defun-markdown-buffer is a macro defined in markdown-mode.el.

Signature

(defun-markdown-buffer NAME DOCSTRING)

Documentation

Define a function to name and return a buffer.

By convention, NAME must be a name of a string constant with
%buffer% placeholder used to name the buffer, and will also be
used as a name of the function defined.

DOCSTRING will be used as the first part of the docstring.

Source Code

;; Defined in ~/.emacs.d/elpa/markdown-mode-20260321.143/markdown-mode.el
(defmacro defun-markdown-buffer (name docstring)
  "Define a function to name and return a buffer.

By convention, NAME must be a name of a string constant with
%buffer% placeholder used to name the buffer, and will also be
used as a name of the function defined.

DOCSTRING will be used as the first part of the docstring."
  `(defun ,name (&optional buffer-name)
     ,(concat docstring "\n\nBUFFER-NAME is the name of the main buffer being visited.")
     (or buffer-name (setq buffer-name (buffer-name)))
     (let ((refbuf (get-buffer-create (replace-regexp-in-string
                                       "%buffer%" buffer-name
                                       ,name))))
       (with-current-buffer refbuf
         (when view-mode
           (View-exit-and-edit))
         (use-local-map button-buffer-map)
         (erase-buffer))
       refbuf)))