Function: magit-section-mode
magit-section-mode is a byte-compiled function defined in
magit-section.el.
Signature
(magit-section-mode)
Documentation
Parent major mode from which major modes with Magit-like sections inherit.
Magit-Section is documented in info node (magit-section).
In addition to any hooks its parent mode special-mode might have
run, this mode runs the hook magit-section-mode-hook, as the final
or penultimate step during initialization.
- negative-argument
0 digit-argument
1 magit-section-show-level-1
2 magit-section-show-level-2
3 magit-section-show-level-3
4 magit-section-show-level-4
<backtab> magit-section-cycle-global
<left-fringe> <mouse-1> magit-mouse-toggle-section
<left-fringe> <mouse-2> magit-mouse-toggle-section
C-<tab> magit-section-cycle
C-c TAB magit-section-cycle
M-1 magit-section-show-level-1-all
M-2 magit-section-show-level-2-all
M-3 magit-section-show-level-3-all
M-4 magit-section-show-level-4-all
M-<tab> magit-section-cycle
M-n magit-section-forward-sibling
M-p magit-section-backward-sibling
SPC..~ undefined
TAB magit-section-toggle
^ magit-section-up
n magit-section-forward
p magit-section-backward
q..\x3FFFFF digit-argument
Source Code
;; Defined in ~/.emacs.d/elpa/magit-section-20260330.1102/magit-section.el
(define-derived-mode magit-section-mode special-mode "Magit-Sections"
"Parent major mode from which major modes with Magit-like sections inherit.
Magit-Section is documented in info node `(magit-section)'."
:interactive nil
:group 'magit-section
(buffer-disable-undo)
(setq truncate-lines t)
(setq buffer-read-only t)
(setq-local line-move-visual t) ; See #1771.
;; Turn off syntactic font locking. See #5420.
(setq-local font-lock-defaults '(nil t))
(setq show-trailing-whitespace nil)
(setq-local symbol-overlay-inhibit-map t)
(setq list-buffers-directory (abbreviate-file-name default-directory))
(make-local-variable 'text-property-default-nonsticky)
(push (cons 'keymap t) text-property-default-nonsticky)
(add-hook 'pre-command-hook #'magit-section-pre-command-hook nil t)
(add-hook 'post-command-hook #'magit-section-post-command-hook t t)
(add-hook 'deactivate-mark-hook #'magit-section-deactivate-mark t t)
(setq-local redisplay-highlight-region-function
#'magit-section--highlight-region)
(setq-local redisplay-unhighlight-region-function
#'magit-section--unhighlight-region)
(add-function :filter-return (local 'filter-buffer-substring-function)
#'magit-section--remove-text-properties)
(when (fboundp 'magit-section-context-menu)
(add-hook 'context-menu-functions #'magit-section-context-menu 10 t))
(when magit-section-disable-line-numbers
(when (and (fboundp 'linum-mode)
(bound-and-true-p global-linum-mode))
(linum-mode -1))
(when (and (fboundp 'nlinum-mode)
(bound-and-true-p global-nlinum-mode))
(nlinum-mode -1))
(when (and (fboundp 'display-line-numbers-mode)
(bound-and-true-p global-display-line-numbers-mode))
(display-line-numbers-mode -1)))
(when (fboundp 'magit-preserve-section-visibility-cache)
(add-hook 'kill-buffer-hook #'magit-preserve-section-visibility-cache)))