update packages
This commit is contained in:
@@ -1,13 +1,14 @@
|
||||
;; -*- no-byte-compile: t; lexical-binding: nil -*-
|
||||
(define-package "magit-section" "20250704.2300"
|
||||
(define-package "magit-section" "20251108.1923"
|
||||
"Sections for read-only buffers."
|
||||
'((emacs "27.1")
|
||||
(compat "30.1")
|
||||
(llama "1.0.0")
|
||||
(seq "2.24"))
|
||||
'((emacs "28.1")
|
||||
(compat "30.1")
|
||||
(cond-let "0.1")
|
||||
(llama "1.0")
|
||||
(seq "2.24"))
|
||||
:url "https://github.com/magit/magit"
|
||||
:commit "5b820a1d1e94649e0f218362286d520d9f29ac2c"
|
||||
:revdesc "5b820a1d1e94"
|
||||
:commit "2d8f43e68125d9f7cf97ba182a5d266fe1a52c67"
|
||||
:revdesc "2d8f43e68125"
|
||||
:keywords '("tools")
|
||||
:authors '(("Jonas Bernoulli" . "emacs.magit@jonas.bernoulli.dev"))
|
||||
:maintainers '(("Jonas Bernoulli" . "emacs.magit@jonas.bernoulli.dev")))
|
||||
|
||||
@@ -8,13 +8,14 @@
|
||||
;; Homepage: https://github.com/magit/magit
|
||||
;; Keywords: tools
|
||||
|
||||
;; Package-Version: 20250704.2300
|
||||
;; Package-Revision: 5b820a1d1e94
|
||||
;; Package-Version: 20251108.1923
|
||||
;; Package-Revision: 2d8f43e68125
|
||||
;; Package-Requires: (
|
||||
;; (emacs "27.1")
|
||||
;; (compat "30.1")
|
||||
;; (llama "1.0.0")
|
||||
;; (seq "2.24"))
|
||||
;; (emacs "28.1")
|
||||
;; (compat "30.1")
|
||||
;; (cond-let "0.1")
|
||||
;; (llama "1.0")
|
||||
;; (seq "2.24"))
|
||||
|
||||
;; SPDX-License-Identifier: GPL-3.0-or-later
|
||||
|
||||
@@ -45,8 +46,9 @@
|
||||
|
||||
(require 'cl-lib)
|
||||
(require 'compat)
|
||||
(require 'cond-let)
|
||||
(require 'eieio)
|
||||
(require 'llama)
|
||||
(require 'llama) ; For (##these ...) see M-x describe-function RET # # RET.
|
||||
(require 'subr-x)
|
||||
|
||||
;; For older Emacs releases we depend on an updated `seq' release from GNU
|
||||
@@ -103,6 +105,9 @@ similar defect.")
|
||||
(define-obsolete-variable-alias 'magit-keep-region-overlay
|
||||
'magit-section-keep-region-overlay "Magit-Section 4.0.0")
|
||||
|
||||
(define-obsolete-variable-alias 'magit-section-visibility-indicator
|
||||
'magit-section-visibility-indicators "Magit-Section 4.4.3")
|
||||
|
||||
;;; Hooks
|
||||
|
||||
(defvar magit-section-movement-hook nil
|
||||
@@ -192,15 +197,17 @@ entries of this alist."
|
||||
(const show)
|
||||
function)))
|
||||
|
||||
(defcustom magit-section-visibility-indicator
|
||||
(if (window-system)
|
||||
'(magit-fringe-bitmap> . magit-fringe-bitmapv)
|
||||
(cons (if (char-displayable-p ?…) "…" "...")
|
||||
t))
|
||||
(defcustom magit-section-visibility-indicators
|
||||
`((magit-fringe-bitmap> . magit-fringe-bitmapv)
|
||||
(,(if (char-displayable-p ?…) "…" "...") . t))
|
||||
"Whether and how to indicate that a section can be expanded/collapsed.
|
||||
|
||||
If nil, then don't show any indicators.
|
||||
Otherwise the value has to have one of these two forms:
|
||||
If nil, then don't show any indicators. Otherwise the value has to
|
||||
be a list with two elements. The first controls the indicators used
|
||||
in graphical frames, the second the indicators in terminal frames.
|
||||
For graphical frames all of the following forms are valid, while
|
||||
terminal frames do not have fringes and thus do not support the first
|
||||
form.
|
||||
|
||||
\(EXPANDABLE-BITMAP . COLLAPSIBLE-BITMAP)
|
||||
|
||||
@@ -211,6 +218,11 @@ Otherwise the value has to have one of these two forms:
|
||||
To provide extra padding around the indicator, set
|
||||
`left-fringe-width' in `magit-mode-hook'.
|
||||
|
||||
\(EXPANDABLE-CHAR . COLLAPSIBLE-CHAR)
|
||||
|
||||
In this case every section that can be expanded or collapsed
|
||||
gets an indicator in the left margin.
|
||||
|
||||
\(STRING . BOOLEAN)
|
||||
|
||||
In this case STRING (usually an ellipsis) is shown at the end
|
||||
@@ -221,24 +233,41 @@ Otherwise the value has to have one of these two forms:
|
||||
doing so is kinda ugly."
|
||||
:package-version '(magit-section . "3.0.0")
|
||||
:group 'magit-section
|
||||
:type '(choice (const :tag "No indicators" nil)
|
||||
:type '(choice
|
||||
(const :tag "No indicators" nil)
|
||||
(list (choice :tag "In graphical frames"
|
||||
(cons :tag "Use +- fringe indicators"
|
||||
(const magit-fringe-bitmap+)
|
||||
(const magit-fringe-bitmap-))
|
||||
:format "%{%t%}%v\n"
|
||||
(const :format " " magit-fringe-bitmap+)
|
||||
(const :format " " magit-fringe-bitmap-))
|
||||
(cons :tag "Use >v fringe indicators"
|
||||
(const magit-fringe-bitmap>)
|
||||
(const magit-fringe-bitmapv))
|
||||
(cons :tag "Use bold >v fringe indicators)"
|
||||
(const magit-fringe-bitmap-bold>)
|
||||
(const magit-fringe-bitmap-boldv))
|
||||
:format "%{%t%}%v\n"
|
||||
(const :format " " magit-fringe-bitmap>)
|
||||
(const :format " " magit-fringe-bitmapv))
|
||||
(cons :tag "Use bold >v fringe indicators"
|
||||
:format "%{%t%}%v\n"
|
||||
(const :format " " magit-fringe-bitmap-bold>)
|
||||
(const :format " " magit-fringe-bitmap-boldv))
|
||||
(cons :tag "Use custom fringe indicators"
|
||||
(variable :tag "Expandable bitmap variable")
|
||||
(variable :tag "Collapsible bitmap variable"))
|
||||
(cons :tag "Use margin indicators"
|
||||
(character :tag "Expandable char" ?+)
|
||||
(character :tag "Collapsible char" ?-))
|
||||
(cons :tag "Use ellipses at end of headings"
|
||||
(string :tag "Ellipsis" "…")
|
||||
(choice :tag "Use face kludge"
|
||||
(const :tag "Yes (potentially slow)" t)
|
||||
(const :tag "No (kinda ugly)" nil)))))
|
||||
(const :tag "No (kinda ugly)" nil))))
|
||||
(choice :tag "In terminal frames"
|
||||
(cons :tag "Use margin indicators"
|
||||
(character :tag "Expandable char" ?+)
|
||||
(character :tag "Collapsible char" ?-))
|
||||
(cons :tag "Use ellipses at end of headings"
|
||||
(string :tag "Ellipsis" "…")
|
||||
(choice :tag "Use face kludge"
|
||||
(const :tag "Yes (potentially slow)" t)
|
||||
(const :tag "No (kinda ugly)" nil)))))))
|
||||
|
||||
(defcustom magit-section-keep-region-overlay nil
|
||||
"Whether to keep the region overlay when there is a valid selection.
|
||||
@@ -291,16 +320,6 @@ but that ship has sailed, thus this option."
|
||||
:group 'magit-section
|
||||
:type 'boolean)
|
||||
|
||||
(defcustom magit-section-show-context-menu-for-emacs<28 nil
|
||||
"Whether `mouse-3' shows a context menu for Emacs < 28.
|
||||
|
||||
This has to be set before loading `magit-section' or it has
|
||||
no effect. This also has no effect for Emacs >= 28, where
|
||||
`context-menu-mode' should be enabled instead."
|
||||
:package-version '(magit-section . "4.0.0")
|
||||
:group 'magit-section
|
||||
:type 'boolean)
|
||||
|
||||
;;; Variables
|
||||
|
||||
(defvar-local magit-section-preserve-visibility t)
|
||||
@@ -369,6 +388,24 @@ no effect. This also has no effect for Emacs >= 28, where
|
||||
"Face used for child counts at the end of some section headings."
|
||||
:group 'magit-section-faces)
|
||||
|
||||
(defface magit-left-margin '((t :inherit default))
|
||||
"Face used for the left margin.
|
||||
|
||||
Currently this is only used for section visibility indicators, and only
|
||||
when `magit-section-visibility-indicator' is configured to show them in
|
||||
the margin.
|
||||
|
||||
Due to limitations of how the margin works in Emacs, this is only used
|
||||
for those parts of the margin that actually display an indicator. For
|
||||
that reason you should probably avoid setting the background color.
|
||||
|
||||
Reasonable values include ((t)), which causes the indicator to inherit
|
||||
the look of the heading (including section highlighting, if any), and
|
||||
\((t :inherit default), which prevents that and causes the margin to
|
||||
look like regular un-styled text in the buffer. Building on that, you
|
||||
can make it look different, e.g., ((t :inherit default :weight bold)."
|
||||
:group 'magit-section-faces)
|
||||
|
||||
;;; Classes
|
||||
|
||||
(defvar magit--current-section-hook nil
|
||||
@@ -400,49 +437,36 @@ no effect. This also has no effect for Emacs >= 28, where
|
||||
(defvar-keymap magit-section-heading-map
|
||||
:doc "Keymap used in the heading line of all expandable sections.
|
||||
This keymap is used in addition to the section-specific keymap, if any."
|
||||
"<double-down-mouse-1>" #'ignore
|
||||
"<double-mouse-1>" #'magit-mouse-toggle-section
|
||||
"<double-mouse-2>" #'magit-mouse-toggle-section)
|
||||
"<double-down-mouse-1>" #'ignore
|
||||
"<double-mouse-1>" #'magit-mouse-toggle-section
|
||||
"<double-mouse-2>" #'magit-mouse-toggle-section
|
||||
"<left-margin> <mouse-1>" #'magit-mouse-toggle-section)
|
||||
|
||||
(defvar magit-section-mode-map
|
||||
(let ((map (make-keymap)))
|
||||
(suppress-keymap map t)
|
||||
(when (and magit-section-show-context-menu-for-emacs<28
|
||||
(< emacs-major-version 28))
|
||||
(keymap-set map "<mouse-3>" nil)
|
||||
(keymap-set
|
||||
map "<down-mouse-3>"
|
||||
`( menu-item "" ,(make-sparse-keymap)
|
||||
:filter ,(lambda (_)
|
||||
(let ((menu (make-sparse-keymap)))
|
||||
(if (fboundp 'context-menu-local)
|
||||
(context-menu-local menu last-input-event)
|
||||
(magit--context-menu-local menu last-input-event))
|
||||
(magit-section-context-menu menu last-input-event)
|
||||
menu)))))
|
||||
(keymap-set map "<left-fringe> <mouse-1>" #'magit-mouse-toggle-section)
|
||||
(keymap-set map "<left-fringe> <mouse-2>" #'magit-mouse-toggle-section)
|
||||
(keymap-set map "TAB" #'magit-section-toggle)
|
||||
(keymap-set map "C-c TAB" #'magit-section-cycle)
|
||||
(keymap-set map "C-<tab>" #'magit-section-cycle)
|
||||
(keymap-set map "M-<tab>" #'magit-section-cycle)
|
||||
;; <backtab> is the most portable binding for Shift+Tab.
|
||||
(keymap-set map "<backtab>" #'magit-section-cycle-global)
|
||||
(keymap-set map "^" #'magit-section-up)
|
||||
(keymap-set map "p" #'magit-section-backward)
|
||||
(keymap-set map "n" #'magit-section-forward)
|
||||
(keymap-set map "M-p" #'magit-section-backward-sibling)
|
||||
(keymap-set map "M-n" #'magit-section-forward-sibling)
|
||||
(keymap-set map "1" #'magit-section-show-level-1)
|
||||
(keymap-set map "2" #'magit-section-show-level-2)
|
||||
(keymap-set map "3" #'magit-section-show-level-3)
|
||||
(keymap-set map "4" #'magit-section-show-level-4)
|
||||
(keymap-set map "M-1" #'magit-section-show-level-1-all)
|
||||
(keymap-set map "M-2" #'magit-section-show-level-2-all)
|
||||
(keymap-set map "M-3" #'magit-section-show-level-3-all)
|
||||
(keymap-set map "M-4" #'magit-section-show-level-4-all)
|
||||
map)
|
||||
"Parent keymap for all keymaps of modes derived from `magit-section-mode'.")
|
||||
(defvar-keymap magit-section-mode-map
|
||||
:doc "Parent keymap for keymaps of modes derived from `magit-section-mode'."
|
||||
:full t
|
||||
:suppress t
|
||||
"<left-fringe> <mouse-1>" #'magit-mouse-toggle-section
|
||||
"<left-fringe> <mouse-2>" #'magit-mouse-toggle-section
|
||||
"TAB" #'magit-section-toggle
|
||||
"C-c TAB" #'magit-section-cycle
|
||||
"C-<tab>" #'magit-section-cycle
|
||||
"M-<tab>" #'magit-section-cycle
|
||||
;; <backtab> is the most portable binding for Shift+Tab.
|
||||
"<backtab>" #'magit-section-cycle-global
|
||||
"^" #'magit-section-up
|
||||
"p" #'magit-section-backward
|
||||
"n" #'magit-section-forward
|
||||
"M-p" #'magit-section-backward-sibling
|
||||
"M-n" #'magit-section-forward-sibling
|
||||
"1" #'magit-section-show-level-1
|
||||
"2" #'magit-section-show-level-2
|
||||
"3" #'magit-section-show-level-3
|
||||
"4" #'magit-section-show-level-4
|
||||
"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)
|
||||
|
||||
(define-derived-mode magit-section-mode special-mode "Magit-Sections"
|
||||
"Parent major mode from which major modes with Magit-like sections inherit.
|
||||
@@ -453,11 +477,9 @@ Magit-Section is documented in info node `(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, but not by setting
|
||||
;; `font-lock-defaults' because that would enable font locking, and
|
||||
;; not all magit plugins may be ready for that (see #3950).
|
||||
(setq-local font-lock-syntactic-face-function #'ignore)
|
||||
(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))
|
||||
@@ -545,8 +567,8 @@ the click occurred. Otherwise return the section at point."
|
||||
The return value has the form ((TYPE . VALUE)...)."
|
||||
(cons (cons (oref section type)
|
||||
(magit-section-ident-value section))
|
||||
(and-let* ((parent (oref section parent)))
|
||||
(magit-section-ident parent))))
|
||||
(and$ (oref section parent)
|
||||
(magit-section-ident $))))
|
||||
|
||||
(defun magit-section-equal (a b)
|
||||
"Return t if A an B are the same section."
|
||||
@@ -606,8 +628,8 @@ instead of in the one whose root `magit-root-section' is."
|
||||
If optional RAW is non-nil, return a list of section objects, beginning
|
||||
with SECTION, otherwise return a list of section types."
|
||||
(cons (if raw section (oref section type))
|
||||
(and-let* ((parent (oref section parent)))
|
||||
(magit-section-lineage parent raw))))
|
||||
(and$ (oref section parent)
|
||||
(magit-section-lineage $ raw))))
|
||||
|
||||
(defvar-local magit-insert-section--current nil "For internal use only.")
|
||||
(defvar-local magit-insert-section--parent nil "For internal use only.")
|
||||
@@ -638,17 +660,17 @@ with SECTION, otherwise return a list of section types."
|
||||
`(menu-item
|
||||
,(if (oref section hidden) "Expand section" "Collapse section")
|
||||
magit-section-toggle))
|
||||
(when-let (((not (oref section hidden)))
|
||||
(children (oref section children)))
|
||||
(when (seq-some #'magit-section-content-p children)
|
||||
(when (seq-some (##oref % hidden) children)
|
||||
(keymap-set-after menu "<magit-section-show-children>"
|
||||
`(menu-item "Expand children"
|
||||
magit-section-show-children)))
|
||||
(when (seq-some (##not (oref % hidden)) children)
|
||||
(keymap-set-after menu "<magit-section-hide-children>"
|
||||
`(menu-item "Collapse children"
|
||||
magit-section-hide-children)))))
|
||||
(when-let* ((_(not (oref section hidden)))
|
||||
(children (oref section children))
|
||||
(_(seq-some #'magit-section-content-p children)))
|
||||
(when (seq-some (##oref % hidden) children)
|
||||
(keymap-set-after menu "<magit-section-show-children>"
|
||||
`(menu-item "Expand children"
|
||||
magit-section-show-children)))
|
||||
(when (seq-some (##not (oref % hidden)) children)
|
||||
(keymap-set-after menu "<magit-section-hide-children>"
|
||||
`(menu-item "Collapse children"
|
||||
magit-section-hide-children))))
|
||||
(keymap-set-after menu "<separator-magit-1>" menu-bar-separator))
|
||||
(keymap-set-after menu "<magit-describe-section>"
|
||||
`(menu-item "Describe section" magit-describe-section))
|
||||
@@ -662,9 +684,7 @@ with SECTION, otherwise return a list of section types."
|
||||
(when (consp binding)
|
||||
(define-key-after menu (vector key)
|
||||
(copy-sequence binding))))
|
||||
(if (fboundp 'menu-bar-keymap)
|
||||
(menu-bar-keymap map)
|
||||
(magit--menu-bar-keymap map)))))
|
||||
(menu-bar-keymap map))))
|
||||
menu)
|
||||
|
||||
(defun magit-menu-item (desc def &optional props)
|
||||
@@ -687,11 +707,11 @@ See `magit-menu-format-desc'."
|
||||
(or (ignore-errors
|
||||
(save-excursion
|
||||
(goto-char (magit-menu-position))
|
||||
(and-let* ((key (cl-find-if-not
|
||||
(lambda (key)
|
||||
(string-match-p "\\`<[0-9]+>\\'"
|
||||
(key-description key)))
|
||||
(where-is-internal def))))
|
||||
(and-let ((key (cl-find-if-not
|
||||
(lambda (key)
|
||||
(string-match-p "\\`<[0-9]+>\\'"
|
||||
(key-description key)))
|
||||
(where-is-internal def))))
|
||||
(key-description key))))
|
||||
""))
|
||||
|
||||
@@ -705,14 +725,15 @@ then return nil."
|
||||
|
||||
(defun magit-menu-highlight-point-section ()
|
||||
(setq magit-section-highlight-force-update t)
|
||||
(if (eq (current-buffer) magit--context-menu-buffer)
|
||||
(setq magit--context-menu-section nil)
|
||||
(if-let ((window (get-buffer-window magit--context-menu-buffer)))
|
||||
(with-selected-window window
|
||||
(setq magit--context-menu-section nil)
|
||||
(magit-section-update-highlight))
|
||||
(with-current-buffer magit--context-menu-buffer
|
||||
(setq magit--context-menu-section nil))))
|
||||
(cond-let
|
||||
((eq (current-buffer) magit--context-menu-buffer)
|
||||
(setq magit--context-menu-section nil))
|
||||
([window (get-buffer-window magit--context-menu-buffer)]
|
||||
(with-selected-window window
|
||||
(setq magit--context-menu-section nil)
|
||||
(magit-section-update-highlight)))
|
||||
((with-current-buffer magit--context-menu-buffer
|
||||
(setq magit--context-menu-section nil))))
|
||||
(setq magit--context-menu-buffer nil))
|
||||
|
||||
(defvar magit--plural-append-es '(branch))
|
||||
@@ -758,28 +779,6 @@ The following %-specs are allowed:
|
||||
(?M . ,(or multiple value))
|
||||
(?x . ,(format "%s" magit-menu-common-value))))))
|
||||
|
||||
(defun magit--menu-bar-keymap (keymap)
|
||||
"Backport of `menu-bar-keymap' for Emacs < 28.
|
||||
Slight trimmed down."
|
||||
(let ((menu-bar nil))
|
||||
(map-keymap (lambda (key binding)
|
||||
(push (cons key binding) menu-bar))
|
||||
keymap)
|
||||
(cons 'keymap (nreverse menu-bar))))
|
||||
|
||||
(defun magit--context-menu-local (menu _click)
|
||||
"Backport of `context-menu-local' for Emacs < 28."
|
||||
(run-hooks 'activate-menubar-hook 'menu-bar-update-hook)
|
||||
(keymap-set-after menu "<separator-local>" menu-bar-separator)
|
||||
(let ((keymap (local-key-binding [menu-bar])))
|
||||
(when keymap
|
||||
(map-keymap (lambda (key binding)
|
||||
(when (consp binding)
|
||||
(define-key-after menu (vector key)
|
||||
(copy-sequence binding))))
|
||||
(magit--menu-bar-keymap keymap))))
|
||||
menu)
|
||||
|
||||
(define-advice context-menu-region (:around (fn menu click) magit-section-mode)
|
||||
"Disable in `magit-section-mode' buffers."
|
||||
(if (derived-mode-p 'magit-section-mode)
|
||||
@@ -857,23 +856,25 @@ the beginning of the current section."
|
||||
"Move to the beginning of the next sibling section.
|
||||
If there is no next sibling section, then move to the parent."
|
||||
(interactive)
|
||||
(let ((current (magit-current-section)))
|
||||
(if (oref current parent)
|
||||
(if-let ((next (car (magit-section-siblings current 'next))))
|
||||
(magit-section-goto next)
|
||||
(magit-section-forward))
|
||||
(magit-section-goto 1))))
|
||||
(cond-let
|
||||
[[current (magit-current-section)]]
|
||||
((not (oref current parent))
|
||||
(magit-section-goto 1))
|
||||
([next (car (magit-section-siblings current 'next))]
|
||||
(magit-section-goto next))
|
||||
((magit-section-forward))))
|
||||
|
||||
(defun magit-section-backward-sibling ()
|
||||
"Move to the beginning of the previous sibling section.
|
||||
If there is no previous sibling section, then move to the parent."
|
||||
(interactive)
|
||||
(let ((current (magit-current-section)))
|
||||
(if (oref current parent)
|
||||
(if-let ((previous (car (magit-section-siblings current 'prev))))
|
||||
(magit-section-goto previous)
|
||||
(magit-section-backward))
|
||||
(magit-section-goto -1))))
|
||||
(cond-let
|
||||
[[current (magit-current-section)]]
|
||||
((not (oref current parent))
|
||||
(magit-section-goto -1))
|
||||
([previous (car (magit-section-siblings current 'prev))]
|
||||
(magit-section-goto previous))
|
||||
((magit-section-backward))))
|
||||
|
||||
(defun magit-mouse-set-point (event &optional promote-to-region)
|
||||
"Like `mouse-set-point' but also call `magit-section-movement-hook'."
|
||||
@@ -897,7 +898,7 @@ See info node `(magit)Section Movement'."
|
||||
|
||||
(defmacro magit-define-section-jumper
|
||||
(name heading type &optional value inserter &rest properties)
|
||||
"Define an interactive function to go some section.
|
||||
"Define an interactive function to go to some section.
|
||||
Together TYPE and VALUE identify the section.
|
||||
HEADING is the displayed heading of the section."
|
||||
(declare (indent defun))
|
||||
@@ -909,19 +910,23 @@ With a prefix argument also expand it." heading)
|
||||
(list :description heading))
|
||||
,@(and inserter
|
||||
`(:if (##memq ',inserter
|
||||
(bound-and-true-p magit-status-sections-hook))))
|
||||
(symbol-value
|
||||
(intern (format "%s-sections-hook"
|
||||
(substring (symbol-name major-mode)
|
||||
0 -5)))))))
|
||||
:inapt-if-not (##magit-get-section
|
||||
(cons (cons ',type ,value)
|
||||
(magit-section-ident magit-root-section)))
|
||||
(interactive "P")
|
||||
(if-let ((section (magit-get-section
|
||||
(cons (cons ',type ,value)
|
||||
(magit-section-ident magit-root-section)))))
|
||||
(progn (goto-char (oref section start))
|
||||
(when expand
|
||||
(with-local-quit (magit-section-show section))
|
||||
(recenter 0)))
|
||||
(message ,(format "Section \"%s\" wasn't found" heading)))))
|
||||
(cond-let
|
||||
([section (magit-get-section
|
||||
(cons (cons ',type ,value)
|
||||
(magit-section-ident magit-root-section)))]
|
||||
(goto-char (oref section start))
|
||||
(when expand
|
||||
(with-local-quit (magit-section-show section))
|
||||
(recenter 0)))
|
||||
((message ,(format "Section \"%s\" wasn't found" heading))))))
|
||||
|
||||
;;;; Visibility
|
||||
|
||||
@@ -1026,62 +1031,61 @@ from using this key and instead bind another key to `tab-next'. Because
|
||||
`tab-bar-mode' does not use a mode map but instead manipulates the
|
||||
global map, this involves advising `tab-bar--define-keys'."
|
||||
(interactive (list (magit-current-section)))
|
||||
(cond
|
||||
((and (equal (this-command-keys) [C-tab])
|
||||
(eq (global-key-binding [C-tab]) 'tab-next)
|
||||
(fboundp 'tab-bar-switch-to-next-tab))
|
||||
(tab-bar-switch-to-next-tab current-prefix-arg))
|
||||
((eq section magit-root-section)
|
||||
(magit-section-cycle-global))
|
||||
((oref section hidden)
|
||||
(magit-section-show section)
|
||||
(magit-section-hide-children section))
|
||||
((let ((children (oref section children)))
|
||||
(cond ((and (seq-some (##oref % hidden) children)
|
||||
(seq-some (##oref % children) children))
|
||||
(magit-section-show-headings section))
|
||||
((seq-some #'magit-section-hidden-body children)
|
||||
(magit-section-show-children section))
|
||||
((magit-section-hide section)))))))
|
||||
(cond-let
|
||||
((and (equal (this-command-keys) [C-tab])
|
||||
(eq (global-key-binding [C-tab]) 'tab-next)
|
||||
(fboundp 'tab-bar-switch-to-next-tab))
|
||||
(tab-bar-switch-to-next-tab current-prefix-arg))
|
||||
((eq section magit-root-section)
|
||||
(magit-section-cycle-global))
|
||||
((oref section hidden)
|
||||
(magit-section-show section)
|
||||
(magit-section-hide-children section))
|
||||
[[children (oref section children)]]
|
||||
((and (seq-some (##oref % hidden) children)
|
||||
(seq-some (##oref % children) children))
|
||||
(magit-section-show-headings section))
|
||||
((seq-some #'magit-section-hidden-body children)
|
||||
(magit-section-show-children section))
|
||||
((magit-section-hide section))))
|
||||
|
||||
(defun magit-section-cycle-global ()
|
||||
"Cycle visibility of all sections in the current buffer."
|
||||
(interactive)
|
||||
(let ((children (oref magit-root-section children)))
|
||||
(cond ((and (seq-some (##oref % hidden) children)
|
||||
(seq-some (##oref % children) children))
|
||||
(magit-section-show-headings magit-root-section))
|
||||
((seq-some #'magit-section-hidden-body children)
|
||||
(magit-section-show-children magit-root-section))
|
||||
(t
|
||||
(mapc #'magit-section-hide children)))))
|
||||
(cond-let
|
||||
[[children (oref magit-root-section children)]]
|
||||
((and (seq-some (##oref % hidden) children)
|
||||
(seq-some (##oref % children) children))
|
||||
(magit-section-show-headings magit-root-section))
|
||||
((seq-some #'magit-section-hidden-body children)
|
||||
(magit-section-show-children magit-root-section))
|
||||
((mapc #'magit-section-hide children))))
|
||||
|
||||
(defun magit-section-hidden (section)
|
||||
"Return t if SECTION and/or an ancestor is hidden."
|
||||
"Return t if the content of SECTION or of any ancestor is hidden.
|
||||
Ignore whether the body of any of SECTION's descendants is hidden.
|
||||
When the status of descendants is irrelevant but that of ancestors
|
||||
matters, instead use `magit-section-hidden-body'."
|
||||
(or (oref section hidden)
|
||||
(and-let* ((parent (oref section parent)))
|
||||
(magit-section-hidden parent))))
|
||||
(and$ (oref section parent)
|
||||
(magit-section-hidden $))))
|
||||
|
||||
(defun magit-section-hidden-body (section &optional pred)
|
||||
"Return t if the content of SECTION or of any children is hidden."
|
||||
"Return t if the content of SECTION or of any descendant is hidden.
|
||||
Ignore whether the body of any of SECTION's ancestors is hidden;
|
||||
if you need that use `magit-section-hidden'."
|
||||
(if-let ((children (oref section children)))
|
||||
(funcall (or pred #'seq-some) #'magit-section-hidden-body children)
|
||||
(and (oref section content)
|
||||
(oref section hidden))))
|
||||
|
||||
(defalias 'magit-section-invisible-p #'magit-section-hidden)
|
||||
|
||||
(defun magit-section-content-p (section)
|
||||
"Return non-nil if SECTION has content or an unused washer function."
|
||||
(with-slots (content end washer) section
|
||||
(and content (or (not (= content end)) washer))))
|
||||
|
||||
(defun magit-section-invisible-p (section)
|
||||
"Return t if the SECTION's body is invisible.
|
||||
When the body of an ancestor of SECTION is collapsed then
|
||||
SECTION's body (and heading) obviously cannot be visible."
|
||||
(or (oref section hidden)
|
||||
(and-let* ((parent (oref section parent)))
|
||||
(magit-section-invisible-p parent))))
|
||||
|
||||
(defun magit-section-show-level (level)
|
||||
"Show surrounding sections up to LEVEL.
|
||||
Likewise hide sections at higher levels. If the region selects multiple
|
||||
@@ -1163,12 +1167,15 @@ silently ignored."
|
||||
|
||||
;;;; Auxiliary
|
||||
|
||||
(defun magit-describe-section-briefly (section &optional ident interactive)
|
||||
"Show information about the section at point.
|
||||
(defun magit-describe-section-briefly (&optional section ident interactive)
|
||||
"Show information about SECTION or the section at point.
|
||||
With a prefix argument show the section identity instead of the
|
||||
section lineage. This command is intended for debugging purposes.
|
||||
\n(fn SECTION &optional IDENT)"
|
||||
Non-interactively, just return the information. Interactively,
|
||||
or when INTERACTIVE is non-nil, show the section in the echo area."
|
||||
(interactive (list (magit-current-section) current-prefix-arg t))
|
||||
(unless section
|
||||
(setq section (magit-current-section)))
|
||||
(let ((str (format "#<%s %S %S %s-%s%s>"
|
||||
(eieio-object-class section)
|
||||
(let ((val (oref section value)))
|
||||
@@ -1177,19 +1184,18 @@ section lineage. This command is intended for debugging purposes.
|
||||
((and (eieio-object-p val)
|
||||
(fboundp 'cl-prin1-to-string))
|
||||
(cl-prin1-to-string val))
|
||||
(t
|
||||
val)))
|
||||
(val)))
|
||||
(if ident
|
||||
(magit-section-ident section)
|
||||
(apply #'vector (magit-section-lineage section)))
|
||||
(and-let* ((m (oref section start)))
|
||||
(if (markerp m) (marker-position m) m))
|
||||
(and$ (oref section start)
|
||||
(if (markerp $) (marker-position $) $))
|
||||
(if-let ((m (oref section content)))
|
||||
(format "[%s-]"
|
||||
(if (markerp m) (marker-position m) m))
|
||||
"")
|
||||
(and-let* ((m (oref section end)))
|
||||
(if (markerp m) (marker-position m) m)))))
|
||||
(and$ (oref section end)
|
||||
(if (markerp $) (marker-position $) $)))))
|
||||
(when interactive
|
||||
(message "%s" str))
|
||||
str))
|
||||
@@ -1287,17 +1293,18 @@ of course you want to be that precise."
|
||||
(defun magit-section-match-2 (condition section)
|
||||
(if (eq (car condition) '*)
|
||||
(or (magit-section-match-2 (cdr condition) section)
|
||||
(and-let* ((parent (oref section parent)))
|
||||
(magit-section-match-2 condition parent)))
|
||||
(and (let ((c (car condition)))
|
||||
(if (class-p c)
|
||||
(cl-typep section c)
|
||||
(if-let ((class (cdr (assq c magit--section-type-alist))))
|
||||
(cl-typep section class)
|
||||
(eq (oref section type) c))))
|
||||
(and$ (oref section parent)
|
||||
(magit-section-match-2 condition $)))
|
||||
(and (cond-let
|
||||
[[c (car condition)]]
|
||||
((class-p c)
|
||||
(cl-typep section c))
|
||||
([class (cdr (assq c magit--section-type-alist))]
|
||||
(cl-typep section class))
|
||||
((eq (oref section type) c)))
|
||||
(or (not (setq condition (cdr condition)))
|
||||
(and-let* ((parent (oref section parent)))
|
||||
(magit-section-match-2 condition parent))))))
|
||||
(and$ (oref section parent)
|
||||
(magit-section-match-2 condition $))))))
|
||||
|
||||
(defun magit-section-value-if (condition &optional section)
|
||||
"If the section at point matches CONDITION, then return its value.
|
||||
@@ -1308,9 +1315,9 @@ then return nil. If the section does not match, then return
|
||||
nil.
|
||||
|
||||
See `magit-section-match' for the forms CONDITION can take."
|
||||
(and-let* ((section (or section (magit-current-section))))
|
||||
(and (magit-section-match condition section)
|
||||
(oref section value))))
|
||||
(and$ (or section (magit-current-section))
|
||||
(and (magit-section-match condition $)
|
||||
(oref $ value))))
|
||||
|
||||
(defmacro magit-section-case (&rest clauses)
|
||||
"Choose among clauses on the type of the section at point.
|
||||
@@ -1328,7 +1335,7 @@ matches if no other CONDITION match, even if there is no section
|
||||
at point."
|
||||
(declare (indent 0)
|
||||
(debug (&rest (sexp body))))
|
||||
`(let* ((it (magit-current-section)))
|
||||
`(let ((it (magit-current-section)))
|
||||
(cond ,@(mapcar (lambda (clause)
|
||||
`(,(or (eq (car clause) t)
|
||||
`(and it
|
||||
@@ -1614,8 +1621,8 @@ is explicitly expanded."
|
||||
(defun magit-section--set-section-properties (section)
|
||||
(pcase-let* (((eieio start end children keymap) section)
|
||||
(props `( magit-section ,section
|
||||
,@(and-let* ((map (symbol-value keymap)))
|
||||
(list 'keymap map)))))
|
||||
,@(and$ (symbol-value keymap)
|
||||
(list 'keymap $)))))
|
||||
(if children
|
||||
(save-excursion
|
||||
(goto-char start)
|
||||
@@ -1814,8 +1821,8 @@ evaluated its BODY. Admittedly that's a bit of a hack."
|
||||
(and as-child
|
||||
(oref section heading-highlight-face))
|
||||
(slot-boundp section 'painted)
|
||||
(and-let* ((children (oref section children)))
|
||||
(magit-section-selective-highlight-p (car children) t))))
|
||||
(and$ (oref section children)
|
||||
(magit-section-selective-highlight-p (car $) t))))
|
||||
|
||||
;;; Paint
|
||||
|
||||
@@ -1910,7 +1917,7 @@ to nil." (bound-and-true-p long-line-threshold)) :warning)))))
|
||||
|
||||
(defun magit-section-goto-successor--same (section line char)
|
||||
(let ((ident (magit-section-ident section)))
|
||||
(and-let* ((found (magit-get-section ident)))
|
||||
(and-let ((found (magit-get-section ident)))
|
||||
(let ((start (oref found start)))
|
||||
(goto-char start)
|
||||
(unless (eq found magit-root-section)
|
||||
@@ -1922,25 +1929,25 @@ to nil." (bound-and-true-p long-line-threshold)) :warning)))))
|
||||
t))))
|
||||
|
||||
(defun magit-section-goto-successor--related (section)
|
||||
(and-let* ((found (magit-section-goto-successor--related-1 section)))
|
||||
(and-let ((found (magit-section-goto-successor--related-1 section)))
|
||||
(goto-char (if (eq (oref found type) 'button)
|
||||
(point-min)
|
||||
(oref found start)))))
|
||||
|
||||
(defun magit-section-goto-successor--related-1 (section)
|
||||
(or (and-let* ((alt (pcase (oref section type)
|
||||
('staged 'unstaged)
|
||||
('unstaged 'staged)
|
||||
('unpushed 'unpulled)
|
||||
('unpulled 'unpushed))))
|
||||
(magit-get-section `((,alt) (status))))
|
||||
(and-let* ((next (car (magit-section-siblings section 'next))))
|
||||
(magit-get-section (magit-section-ident next)))
|
||||
(and-let* ((prev (car (magit-section-siblings section 'prev))))
|
||||
(magit-get-section (magit-section-ident prev)))
|
||||
(and-let* ((parent (oref section parent)))
|
||||
(or (magit-get-section (magit-section-ident parent))
|
||||
(magit-section-goto-successor--related-1 parent)))))
|
||||
(or (and$ (pcase (oref section type)
|
||||
('staged 'unstaged)
|
||||
('unstaged 'staged)
|
||||
('unpushed 'unpulled)
|
||||
('unpulled 'unpushed))
|
||||
(magit-get-section `((,$) (status))))
|
||||
(and$ (magit-section-siblings section 'next)
|
||||
(magit-get-section (magit-section-ident (car $))))
|
||||
(and$ (magit-section-siblings section 'prev)
|
||||
(magit-get-section (magit-section-ident (car $))))
|
||||
(and$ (oref section parent)
|
||||
(or (magit-get-section (magit-section-ident $))
|
||||
(magit-section-goto-successor--related-1 $)))))
|
||||
|
||||
;;; Region
|
||||
|
||||
@@ -1997,37 +2004,52 @@ When `magit-section-preserve-visibility' is nil, return nil."
|
||||
magit-section-cache-visibility))
|
||||
(magit-section-cache-visibility section)))
|
||||
|
||||
(defun magit-section-visibility-indicator ()
|
||||
(if (window-system)
|
||||
(car magit-section-visibility-indicators)
|
||||
(cadr magit-section-visibility-indicators)))
|
||||
|
||||
(defun magit-section-maybe-update-visibility-indicator (section)
|
||||
(when (and magit-section-visibility-indicator
|
||||
(magit-section-content-p section))
|
||||
(when-let* ((indicator (magit-section-visibility-indicator))
|
||||
(_(magit-section-content-p section)))
|
||||
(let* ((beg (oref section start))
|
||||
(eoh (magit--eol-position beg)))
|
||||
(cond
|
||||
((symbolp (car-safe magit-section-visibility-indicator))
|
||||
(let ((ov (magit--overlay-at beg 'magit-vis-indicator 'fringe)))
|
||||
(unless ov
|
||||
(setq ov (make-overlay beg eoh nil t))
|
||||
(overlay-put ov 'evaporate t)
|
||||
(overlay-put ov 'magit-vis-indicator 'fringe))
|
||||
(overlay-put
|
||||
ov 'before-string
|
||||
(propertize "fringe" 'display
|
||||
(list 'left-fringe
|
||||
(if (oref section hidden)
|
||||
(car magit-section-visibility-indicator)
|
||||
(cdr magit-section-visibility-indicator))
|
||||
'fringe)))))
|
||||
((stringp (car-safe magit-section-visibility-indicator))
|
||||
(let ((ov (magit--overlay-at (1- eoh) 'magit-vis-indicator 'eoh)))
|
||||
(cond ((oref section hidden)
|
||||
(unless ov
|
||||
(setq ov (make-overlay (1- eoh) eoh))
|
||||
(overlay-put ov 'evaporate t)
|
||||
(overlay-put ov 'magit-vis-indicator 'eoh))
|
||||
(overlay-put ov 'after-string
|
||||
(car magit-section-visibility-indicator)))
|
||||
(ov
|
||||
(delete-overlay ov)))))))))
|
||||
(eoh (magit--eol-position beg))
|
||||
(kind (cl-typecase (car indicator)
|
||||
(symbol 'fringe)
|
||||
(character 'margin)
|
||||
(string 'ellipsis)))
|
||||
(indicator (if (or (oref section hidden)
|
||||
(eq kind 'ellipsis))
|
||||
(car indicator)
|
||||
(cdr indicator))))
|
||||
(pcase kind
|
||||
((or 'fringe 'margin)
|
||||
(let ((ov (magit--overlay-at beg 'magit-vis-indicator kind)))
|
||||
(unless ov
|
||||
(setq ov (make-overlay beg eoh nil t))
|
||||
(overlay-put ov 'evaporate t)
|
||||
(overlay-put ov 'magit-vis-indicator kind))
|
||||
(overlay-put
|
||||
ov 'before-string
|
||||
(pcase kind
|
||||
('fringe
|
||||
(propertize "fringe" 'display
|
||||
`(left-fringe ,indicator fringe)))
|
||||
('margin
|
||||
(propertize "margin" 'display
|
||||
`((margin left-margin)
|
||||
,(propertize (string indicator)
|
||||
'face 'magit-left-margin))))))))
|
||||
('ellipsis
|
||||
(let ((ov (magit--overlay-at (1- eoh) 'magit-vis-indicator 'eoh)))
|
||||
(cond ((oref section hidden)
|
||||
(unless ov
|
||||
(setq ov (make-overlay (1- eoh) eoh))
|
||||
(overlay-put ov 'evaporate t)
|
||||
(overlay-put ov 'magit-vis-indicator 'eoh))
|
||||
(overlay-put ov 'after-string indicator))
|
||||
(ov
|
||||
(delete-overlay ov)))))))))
|
||||
|
||||
(defvar-local magit--ellipses-sections nil)
|
||||
|
||||
@@ -2035,7 +2057,8 @@ When `magit-section-preserve-visibility' is nil, return nil."
|
||||
;; This is needed because we hide the body instead of "the body
|
||||
;; except the final newline and additionally the newline before
|
||||
;; the body"; otherwise we could use `buffer-invisibility-spec'.
|
||||
(when (stringp (car-safe magit-section-visibility-indicator))
|
||||
(when-let* ((indicator (car (magit-section-visibility-indicator)))
|
||||
(_(stringp indicator)))
|
||||
(let* ((sections (append magit--ellipses-sections
|
||||
(setq magit--ellipses-sections
|
||||
(or (magit-region-sections)
|
||||
@@ -2057,7 +2080,7 @@ When `magit-section-preserve-visibility' is nil, return nil."
|
||||
(overlay-put
|
||||
ov 'after-string
|
||||
(propertize
|
||||
(car magit-section-visibility-indicator) 'font-lock-face
|
||||
indicator 'font-lock-face
|
||||
(let ((pos (overlay-start ov)))
|
||||
(delq nil (nconc (mapcar (##overlay-get % 'font-lock-face)
|
||||
(overlays-at pos))
|
||||
@@ -2065,7 +2088,7 @@ When `magit-section-preserve-visibility' is nil, return nil."
|
||||
pos 'font-lock-face))))))))))))
|
||||
|
||||
(defun magit-section-maybe-remove-visibility-indicator (section)
|
||||
(when (and magit-section-visibility-indicator
|
||||
(when (and (magit-section-visibility-indicator)
|
||||
(= (oref section content)
|
||||
(oref section end)))
|
||||
(dolist (o (overlays-in (oref section start)
|
||||
@@ -2081,16 +2104,15 @@ When `magit-section-preserve-visibility' is nil, return nil."
|
||||
(let ((section (magit-current-section)))
|
||||
(while section
|
||||
(let ((content (oref section content)))
|
||||
(if (and (magit-section-invisible-p section)
|
||||
(<= (or content (oref section start))
|
||||
beg
|
||||
(oref section end)))
|
||||
(progn
|
||||
(when content
|
||||
(magit-section-show section)
|
||||
(push section magit-section--opened-sections))
|
||||
(setq section (oref section parent)))
|
||||
(setq section nil))))))
|
||||
(cond ((and (magit-section-hidden section)
|
||||
(<= (or content (oref section start))
|
||||
beg
|
||||
(oref section end)))
|
||||
(when content
|
||||
(magit-section-show section)
|
||||
(push section magit-section--opened-sections))
|
||||
(setq section (oref section parent)))
|
||||
((setq section nil)))))))
|
||||
(or (eq search-invisible t)
|
||||
(not (isearch-range-invisible beg end))))
|
||||
|
||||
@@ -2103,6 +2125,12 @@ When `magit-section-preserve-visibility' is nil, return nil."
|
||||
(setq magit-section--opened-sections nil))
|
||||
(funcall fn)))
|
||||
|
||||
(defun magit-section-reveal (section)
|
||||
(while section
|
||||
(when (oref section hidden)
|
||||
(magit-section-show section))
|
||||
(setq section (oref section parent))))
|
||||
|
||||
;;; Utilities
|
||||
|
||||
(cl-defun magit-section-selected-p (section &optional (selection nil sselection))
|
||||
@@ -2111,12 +2139,12 @@ When `magit-section-preserve-visibility' is nil, return nil."
|
||||
(memq section (if sselection
|
||||
selection
|
||||
(setq selection (magit-region-sections))))
|
||||
(and-let* ((parent (oref section parent)))
|
||||
(magit-section-selected-p parent selection)))))
|
||||
(and$ (oref section parent)
|
||||
(magit-section-selected-p $ selection)))))
|
||||
|
||||
(defun magit-section-parent-value (section)
|
||||
(and-let* ((parent (oref section parent)))
|
||||
(oref parent value)))
|
||||
(and$ (oref section parent)
|
||||
(oref $ value)))
|
||||
|
||||
(defun magit-section-siblings (section &optional direction)
|
||||
"Return a list of the sibling sections of SECTION.
|
||||
@@ -2348,7 +2376,7 @@ Configuration'."
|
||||
(message " %-50s %f %s" entry time
|
||||
(cond ((> time 0.03) "!!")
|
||||
((> time 0.01) "!")
|
||||
(t ""))))
|
||||
(""))))
|
||||
(apply entry args)))))))
|
||||
|
||||
(cl-defun magit--overlay-at (pos prop &optional (val nil sval) testfn)
|
||||
@@ -2376,8 +2404,8 @@ Configuration'."
|
||||
(defun magit--add-face-text-property ( beg end face
|
||||
&optional append object adopt-face)
|
||||
"Like `add-face-text-property' but for `font-lock-face'.
|
||||
If optional ADOPT-FACE, the replace `face' with `font-lock-face'
|
||||
first. This is a hack, which is likely to be remove again."
|
||||
If optional ADOPT-FACE, then replace `face' with `font-lock-face'
|
||||
first. The latter is a hack, which is likely to be removed again."
|
||||
(when (stringp object)
|
||||
(unless beg (setq beg 0))
|
||||
(unless end (setq end (length object))))
|
||||
@@ -2453,7 +2481,7 @@ This is like moving to POS and then calling `pos-eol'."
|
||||
(cdr magit--imenu-group-types)
|
||||
section))
|
||||
(magit-section-match magit--imenu-group-types section))
|
||||
(and-let* ((children (oref section children)))
|
||||
(and-let ((children (oref section children)))
|
||||
`((,(magit--imenu-index-name section)
|
||||
,@(mapcar (##cons (magit--imenu-index-name %)
|
||||
(oref % start))
|
||||
@@ -2485,7 +2513,7 @@ This is like moving to POS and then calling `pos-eol'."
|
||||
(oref section value)))
|
||||
((string-match " ([0-9]+)\\'" heading)
|
||||
(substring heading 0 (match-beginning 0)))
|
||||
(t heading)))))
|
||||
(heading)))))
|
||||
|
||||
(defun magit--imenu-goto-function (_name position &rest _rest)
|
||||
"Go to the section at POSITION.
|
||||
@@ -2644,4 +2672,15 @@ with the variables' values as arguments, which were recorded by
|
||||
|
||||
;;; _
|
||||
(provide 'magit-section)
|
||||
;; Local Variables:
|
||||
;; read-symbol-shorthands: (
|
||||
;; ("and$" . "cond-let--and$")
|
||||
;; ("and>" . "cond-let--and>")
|
||||
;; ("and-let" . "cond-let--and-let")
|
||||
;; ("if-let" . "cond-let--if-let")
|
||||
;; ("when-let" . "cond-let--when-let")
|
||||
;; ("while-let" . "cond-let--while-let")
|
||||
;; ("match-string" . "match-string")
|
||||
;; ("match-str" . "match-string-no-properties"))
|
||||
;; End:
|
||||
;;; magit-section.el ends here
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
This is magit-section.info, produced by makeinfo version 7.1.1 from
|
||||
This is magit-section.info, produced by makeinfo version 7.2 from
|
||||
magit-section.texi.
|
||||
|
||||
Copyright (C) 2015-2025 Jonas Bernoulli
|
||||
@@ -34,7 +34,7 @@ packages that have nothing to do with Magit or Git.
|
||||
and user options see *note (magit)Sections::. This manual documents how
|
||||
you can use sections in your own packages.
|
||||
|
||||
This manual is for Magit-Section version 4.3.8.
|
||||
This manual is for Magit-Section version 4.4.2.
|
||||
|
||||
Copyright (C) 2015-2025 Jonas Bernoulli
|
||||
<emacs.magit@jonas.bernoulli.dev>
|
||||
@@ -99,12 +99,13 @@ File: magit-section.info, Node: Creating Sections, Next: Core Functions, Prev
|
||||
appropriate package prefix. This works due to some undocumented
|
||||
kludges, which are not available to other packages.
|
||||
|
||||
When optional HIDE is non-nil collapse the section body by default,
|
||||
i.e., when first creating the section, but not when refreshing the
|
||||
buffer. Else expand it by default. This can be overwritten using
|
||||
‘magit-section-set-visibility-hook’. When a section is recreated
|
||||
during a refresh, then the visibility of predecessor is inherited
|
||||
and HIDE is ignored (but the hook is still honored).
|
||||
When optional HIDE is non-‘nil’ collapse the section body by
|
||||
default, i.e., when first creating the section, but not when
|
||||
refreshing the buffer. Else expand it by default. This can be
|
||||
overwritten using ‘magit-section-set-visibility-hook’. When a
|
||||
section is recreated during a refresh, then the visibility of
|
||||
predecessor is inherited and HIDE is ignored (but the hook is still
|
||||
honored).
|
||||
|
||||
BODY is any number of forms that actually insert the section's
|
||||
heading and body. Optional NAME, if specified, has to be a symbol,
|
||||
@@ -131,10 +132,10 @@ File: magit-section.info, Node: Creating Sections, Next: Core Functions, Prev
|
||||
at ‘point’. The section should only contain a single line when
|
||||
this function is used like this.
|
||||
|
||||
When called with arguments ARGS, which have to be strings, or nil,
|
||||
then insert those strings at point. The section should not contain
|
||||
any text before this happens and afterwards it should again only
|
||||
contain a single line. If the ‘face’ property is set anywhere
|
||||
When called with arguments ARGS, which have to be strings, or
|
||||
‘nil’, then insert those strings at point. The section should not
|
||||
contain any text before this happens and afterwards it should again
|
||||
only contain a single line. If the ‘face’ property is set anywhere
|
||||
inside any of these strings, then insert all of them unchanged.
|
||||
Otherwise use the 'magit-section-heading' face for all inserted
|
||||
text.
|
||||
@@ -142,19 +143,19 @@ File: magit-section.info, Node: Creating Sections, Next: Core Functions, Prev
|
||||
The ‘content’ property of the section object is the end of the
|
||||
heading (which lasts from ‘start’ to ‘content’) and the beginning
|
||||
of the the body (which lasts from ‘content’ to ‘end’). If the
|
||||
value of ‘content’ is nil, then the section has no heading and its
|
||||
body cannot be collapsed. If a section does have a heading, then
|
||||
its height must be exactly one line, including a trailing newline
|
||||
character. This isn't enforced, you are responsible for getting it
|
||||
right. The only exception is that this function does insert a
|
||||
newline character if necessary.
|
||||
value of ‘content’ is ‘nil’, then the section has no heading and
|
||||
its body cannot be collapsed. If a section does have a heading,
|
||||
then its height must be exactly one line, including a trailing
|
||||
newline character. This isn't enforced, you are responsible for
|
||||
getting it right. The only exception is that this function does
|
||||
insert a newline character if necessary.
|
||||
|
||||
If provided, optional CHILD-COUNT must evaluate to an integer or
|
||||
boolean. If t, then the count is determined once the children have
|
||||
been inserted, using ‘magit-insert-child-count’ (which see). For
|
||||
historic reasons, if the heading ends with ":", the count is
|
||||
boolean. If ‘t’, then the count is determined once the children
|
||||
have been inserted, using ‘magit-insert-child-count’ (which see).
|
||||
For historic reasons, if the heading ends with ":", the count is
|
||||
substituted for that, at this time as well. If
|
||||
‘magit-section-show-child-count’ is nil, no counts are inserted
|
||||
‘magit-section-show-child-count’ is ‘nil’, no counts are inserted
|
||||
|
||||
-- Macro: magit-insert-section-body &rest body
|
||||
Use BODY to insert the section body, once the section is expanded.
|
||||
@@ -203,17 +204,18 @@ Function magit-section-at &optional position
|
||||
|
||||
-- Function: magit-get-section ident &optional root
|
||||
Return the section identified by IDENT. IDENT has to be a list as
|
||||
returned by ‘magit-section-ident’. If optional ROOT is non-nil,
|
||||
returned by ‘magit-section-ident’. If optional ROOT is non-‘nil’,
|
||||
then search in that section tree instead of in the one whose root
|
||||
‘magit-root-section’ is.
|
||||
|
||||
-- Function: magit-section-lineage section &optional raw
|
||||
Return the lineage of SECTION. If optional RAW is non-nil, return
|
||||
a list of section objects, beginning with SECTION, otherwise return
|
||||
a list of section types.
|
||||
Return the lineage of SECTION. If optional RAW is non-‘nil’,
|
||||
return a list of section objects, beginning with SECTION, otherwise
|
||||
return a list of section types.
|
||||
|
||||
-- Function: magit-section-content-p section
|
||||
Return non-nil if SECTION has content or an unused washer function.
|
||||
Return non-‘nil’ if SECTION has content or an unused washer
|
||||
function.
|
||||
|
||||
The next two functions are replacements for the Emacs functions that
|
||||
have the same name except for the ‘magit-’ prefix. Like
|
||||
@@ -246,10 +248,10 @@ File: magit-section.info, Node: Matching Functions, Prev: Core Functions, Up:
|
||||
|
||||
-- Function: magit-section-match condition &optional (section
|
||||
(magit-current-section))
|
||||
Return t if SECTION matches CONDITION.
|
||||
Return ‘t’ if SECTION matches CONDITION.
|
||||
|
||||
SECTION defaults to the section at point. If SECTION is not
|
||||
specified and there also is no section at point, then return nil.
|
||||
specified and there also is no section at point, then return ‘nil’.
|
||||
|
||||
CONDITION can take the following forms:
|
||||
|
||||
@@ -279,9 +281,10 @@ File: magit-section.info, Node: Matching Functions, Prev: Core Functions, Up:
|
||||
-- Function: magit-section-value-if condition &optional section
|
||||
If the section at point matches CONDITION, then return its value.
|
||||
|
||||
If optional SECTION is non-nil then test whether that matches
|
||||
instead. If there is no section at point and SECTION is nil, then
|
||||
return nil. If the section does not match, then return nil.
|
||||
If optional SECTION is non-‘nil’ then test whether that matches
|
||||
instead. If there is no section at point and SECTION is ‘nil’,
|
||||
then return ‘nil’. If the section does not match, then return
|
||||
‘nil’.
|
||||
|
||||
See ‘magit-section-match’ for the forms CONDITION can take.
|
||||
|
||||
@@ -293,25 +296,25 @@ File: magit-section.info, Node: Matching Functions, Prev: Core Functions, Up:
|
||||
first match are evaluated sequentially and the value of the last
|
||||
form is returned. Inside BODY the symbol ‘it’ is bound to the
|
||||
section at point. If no clause succeeds or if there is no section
|
||||
at point, return nil.
|
||||
at point, return ‘nil’.
|
||||
|
||||
See ‘magit-section-match’ for the forms CONDITION can take.
|
||||
Additionally a CONDITION of t is allowed in the final clause, and
|
||||
Additionally a CONDITION of ‘t’ is allowed in the final clause, and
|
||||
matches if no other CONDITION match, even if there is no section at
|
||||
point.
|
||||
|
||||
|
||||
|
||||
Tag Table:
|
||||
Node: Top810
|
||||
Node: Introduction2111
|
||||
Node: Creating Sections2881
|
||||
Node: Core Functions7786
|
||||
Node: Matching Functions10938
|
||||
Node: Top808
|
||||
Node: Introduction2109
|
||||
Node: Creating Sections2879
|
||||
Node: Core Functions7818
|
||||
Node: Matching Functions10993
|
||||
|
||||
End Tag Table
|
||||
|
||||
|
||||
Local Variables:
|
||||
coding: utf-8
|
||||
Info-documentlanguage: en
|
||||
End:
|
||||
|
||||
Reference in New Issue
Block a user