Function: majutsu-jjdescription-setup

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

Signature

(majutsu-jjdescription-setup)

Documentation

Set up the current buffer for editing a JJ description.

Source Code

;; Defined in /nix/store/jagqw3nms546pad0gxi5f3wsckk6pji7-emacs-packages-deps/share/emacs/site-lisp/majutsu-jjdescription.el
(defun majutsu-jjdescription-setup ()
  "Set up the current buffer for editing a JJ description."
  (majutsu-jjdescription--bind-repository-root)

  ;; Apply major-mode with pre-enabled modes (like git-commit does)
  (when majutsu-jjdescription-major-mode
    (let ((auto-mode-alist
           (list (cons (concat "\\`"
                               (regexp-quote
                                (majutsu-convert-filename-for-jj buffer-file-name))
                               "\\'")
                       majutsu-jjdescription-major-mode)))
          ;; `normal-mode' runs this global hook while selecting the requested
          ;; mode.  Defer Majutsu's refresh until below so Auto Fill setup and
          ;; user hooks run exactly once for this complete setup operation.
          (after-change-major-mode-hook
           (remove #'majutsu-jjdescription-setup-font-lock-in-buffer
                   after-change-major-mode-hook))
          ;; Pre-enable modes so hooks can see them
          (majutsu-jjdescription-mode t)
          (with-editor-mode t))
      (normal-mode t)))

  ;; Setup comments and line length.
  (majutsu-jjdescription-setup-comments)
  (majutsu-jjdescription-setup-line-length)

  ;; Ensure with-editor-mode is enabled
  (unless with-editor-mode
    (with-editor-mode 1))

  ;; History support
  (add-hook 'with-editor-pre-finish-hook
            #'majutsu-jjdescription-save-message nil t)
  (add-hook 'with-editor-pre-cancel-hook
            #'majutsu-jjdescription-save-message nil t)
  (majutsu-jjdescription-prepare-message-ring)
  (majutsu-jjdescription--save-message t)

  ;; Font-lock and finalization
  (majutsu-jjdescription-setup-font-lock)
  (goto-char (point-min))
  (run-hooks 'majutsu-jjdescription-setup-hook)
  (set-buffer-modified-p nil))