[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/git-commit be371711f5 06/18: magit-section-at: New functio
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/git-commit be371711f5 06/18: magit-section-at: New function |
Date: |
Fri, 25 Mar 2022 13:58:19 -0400 (EDT) |
branch: elpa/git-commit
commit be371711f521b95321e34ac59c9f04e86989d069
Author: Jonas Bernoulli <jonas@bernoul.li>
Commit: Jonas Bernoulli <jonas@bernoul.li>
magit-section-at: New function
---
docs/magit-section.org | 4 ++++
docs/magit-section.texi | 5 +++++
lisp/magit-bisect.el | 2 +-
lisp/magit-section.el | 16 ++++++++++------
4 files changed, 20 insertions(+), 7 deletions(-)
diff --git a/docs/magit-section.org b/docs/magit-section.org
index deb8769f2f..292512887f 100644
--- a/docs/magit-section.org
+++ b/docs/magit-section.org
@@ -151,6 +151,10 @@ source for suitable examples before asking me for help.
Thanks!
Return the section at point.
+- Function magit-section-at &optional position ::
+
+ Return the section at POSITION, defaulting to point.
+
- Function: magit-section-ident section ::
Return an unique identifier for SECTION. The return value has the
diff --git a/docs/magit-section.texi b/docs/magit-section.texi
index ed865d841f..05d22b1f97 100644
--- a/docs/magit-section.texi
+++ b/docs/magit-section.texi
@@ -196,6 +196,11 @@ buffer is reached. FUNCTION has to move point forward or
return
Return the section at point.
@end defun
+@table @asis
+@item Function magit-section-at &optional position
+Return the section at POSITION, defaulting to point.
+@end table
+
@defun magit-section-ident section
Return an unique identifier for SECTION@. The return value has the
form @code{((TYPE . VALUE)...)}.
diff --git a/lisp/magit-bisect.el b/lisp/magit-bisect.el
index 63de453204..0ddfd39acf 100644
--- a/lisp/magit-bisect.el
+++ b/lisp/magit-bisect.el
@@ -224,7 +224,7 @@ bisect run'."
(magit-process-sentinel process event)
(when (buffer-live-p (process-buffer process))
(with-current-buffer (process-buffer process)
- (when-let ((section (get-text-property (point) 'magit-section))
+ (when-let ((section (magit-section-at))
(output (buffer-substring-no-properties
(oref section content)
(oref section end))))
diff --git a/lisp/magit-section.el b/lisp/magit-section.el
index 3b4511bcd3..89b75e4eb9 100644
--- a/lisp/magit-section.el
+++ b/lisp/magit-section.el
@@ -395,7 +395,11 @@ never modify it.")
(defun magit-current-section ()
"Return the section at point."
- (or (get-text-property (point) 'magit-section) magit-root-section))
+ (or (magit-section-at) magit-root-section))
+
+(defun magit-section-at (&optional position)
+ "Return the section at POSITION, defaulting to point."
+ (get-text-property (or position (point)) 'magit-section))
(defun magit-section-ident (section)
"Return an unique identifier for SECTION.
@@ -1118,7 +1122,7 @@ anything this time around.
(let ((next (or (next-single-property-change
(point) 'magit-section)
end)))
- (unless (get-text-property (point) 'magit-section)
+ (unless (magit-section-at)
(put-text-property (point) next 'magit-section ,s)
(when map
(put-text-property (point) next 'keymap map)))
@@ -1625,8 +1629,8 @@ forms CONDITION can take."
(when (region-active-p)
(let* ((rbeg (region-beginning))
(rend (region-end))
- (sbeg (get-text-property rbeg 'magit-section))
- (send (get-text-property rend 'magit-section)))
+ (sbeg (magit-section-at rbeg))
+ (send (magit-section-at rend)))
(when (and send
(not (eq send magit-root-section))
(not (and multiple (eq send sbeg))))
@@ -1663,8 +1667,8 @@ current section."
If optional SECTION is nil, use the current section."
(and (region-active-p)
(or section (setq section (magit-current-section)))
- (let ((beg (get-text-property (region-beginning) 'magit-section)))
- (and (eq beg (get-text-property (region-end) 'magit-section))
+ (let ((beg (magit-section-at (region-beginning))))
+ (and (eq beg (magit-section-at (region-end)))
(eq beg section)))
(not (or (magit-section-position-in-heading-p section
(region-beginning))
(magit-section-position-in-heading-p section (region-end))))
- [nongnu] elpa/git-commit updated (b32521d543 -> f3afc117c2), ELPA Syncer, 2022/03/25
- [nongnu] elpa/git-commit 94aca04dc8 02/18: magit-module-section: Use correct keymap, ELPA Syncer, 2022/03/25
- [nongnu] elpa/git-commit 70b34f08ab 03/18: Increase use of section type, keymap and binding inheritance, ELPA Syncer, 2022/03/25
- [nongnu] elpa/git-commit be371711f5 06/18: magit-section-at: New function,
ELPA Syncer <=
- [nongnu] elpa/git-commit 949b4a47a4 10/18: magit-mouse-toggle-section: New command, ELPA Syncer, 2022/03/25
- [nongnu] elpa/git-commit 5641d3749c 12/18: Completely rework magit-mode-menu, ELPA Syncer, 2022/03/25
- [nongnu] elpa/git-commit 0168be9366 14/18: Add basic context-menu, ELPA Syncer, 2022/03/25
- [nongnu] elpa/git-commit 38cb9372dc 17/18: Add section-specific context-menus, ELPA Syncer, 2022/03/25
- [nongnu] elpa/git-commit f3afc117c2 18/18: Bump dependencies on Melpa, ELPA Syncer, 2022/03/25
- [nongnu] elpa/git-commit 91ef0822d3 04/18: magit-get-section: Compare constant values, ELPA Syncer, 2022/03/25
- [nongnu] elpa/git-commit 8c53997121 05/18: magit-section-ident-value: Split up into more methods, ELPA Syncer, 2022/03/25
- [nongnu] elpa/git-commit 4de514b84c 07/18: magit-section-content-p: New function, ELPA Syncer, 2022/03/25
- [nongnu] elpa/git-commit 8eb43f8b23 13/18: Store keymap detected based on name in section object, ELPA Syncer, 2022/03/25
- [nongnu] elpa/git-commit bc065246b4 01/18: Remove duplicated command magit-help, ELPA Syncer, 2022/03/25