Function: majutsu-blob-edit-mode

majutsu-blob-edit-mode is an interactive and natively compiled function defined in majutsu-file.el.

Signature

(majutsu-blob-edit-mode &optional ARG)

Documentation

Minor mode for editable blob buffers.

Saving in this mode applies changes through jj diffedit.

This is a minor mode. If called interactively, toggle the Majutsu-Blob-Edit mode mode. If the prefix argument is positive, enable the mode, and if it is zero or negative, disable the mode.

If called from Lisp, toggle the mode if ARG is toggle. Enable the mode if ARG is nil, omitted, or is a positive number. Disable the mode if ARG is a negative number.

To check whether the minor mode is enabled in the current buffer, evaluate the variable majutsu-blob-edit-mode(var)/majutsu-blob-edit-mode(fun).

The mode's hook is called both when the mode is enabled and when it is disabled.

C-c C-c majutsu-blob-edit-finish
C-c C-k majutsu-blob-edit-abort
C-x C-q majutsu-blob-edit-exit

Key Bindings

This command is not in any keymaps.

Source Code

;; Defined in /nix/store/jagqw3nms546pad0gxi5f3wsckk6pji7-emacs-packages-deps/share/emacs/site-lisp/majutsu-file.el
(define-minor-mode majutsu-blob-edit-mode
  "Minor mode for editable blob buffers.
Saving in this mode applies changes through `jj diffedit'."
  :lighter " BlobEdit"
  :keymap majutsu-blob-edit-mode-map
  (if majutsu-blob-edit-mode
      (progn
        (setq-local majutsu-blob-edit--original-content
                    (buffer-substring-no-properties (point-min) (point-max)))
        (setq-local majutsu-blob-edit--original-point (point))
        (setq-local majutsu-blob-edit--saved-blob-mode-enabled
                    (bound-and-true-p majutsu-blob-mode))
        (when majutsu-blob-edit--saved-blob-mode-enabled
          (majutsu-blob-mode -1))
        (majutsu-blob-edit--save-cursor-state)
        (majutsu-blob-edit--set-cursor-hint majutsu-blob-edit-cursor-type)
        ;; Use `read-only-mode' so read-only hooks (e.g. annotate keymap sync)
        ;; stay in sync with editable blob mode state.
        (read-only-mode -1)
        (add-hook 'write-contents-functions #'majutsu-blob-edit--write-contents nil t)
        (message "Editable blob mode enabled. Save to apply; C-x C-q to exit; C-c C-k to abort."))
    (remove-hook 'write-contents-functions #'majutsu-blob-edit--write-contents t)
    (majutsu-blob-edit--restore-cursor-state)
    (when majutsu-blob-edit--saved-blob-mode-enabled
      (majutsu-blob-mode 1)
      (setq-local majutsu-blob-edit--saved-blob-mode-enabled nil))
    (read-only-mode 1)))