[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/boxy-headings 147ea800ab 18/45: Generalized REL propert
From: |
ELPA Syncer |
Subject: |
[elpa] externals/boxy-headings 147ea800ab 18/45: Generalized REL property |
Date: |
Sun, 5 May 2024 22:50:53 -0400 (EDT) |
branch: externals/boxy-headings
commit 147ea800ab5e9dbcff2243b47e5d91beba5534f6
Author: Amy Grinn <grinn.amy@gmail.com>
Commit: Amy Grinn <grinn.amy@gmail.com>
Generalized REL property
Using regex to match multiple forms of REL. For example 'in-front' 'in
front of' and 'in front' will all be standardized as 'in front of'.
---
README.org | 25 +++++++++++++++++--------
boxy-headings.el | 51 ++++++++++++++++++++++++++++++++++++++-------------
2 files changed, 55 insertions(+), 21 deletions(-)
diff --git a/README.org b/README.org
index ad9bcc5bc4..488d3282e2 100644
--- a/README.org
+++ b/README.org
@@ -5,8 +5,13 @@ View org files as a boxy diagram.
=package-install RET boxy-headings RET=
* Usage
+ :PROPERTIES:
+ :REL: right
+ :END:
** =boxy-headings=
-
+ :PROPERTIES:
+ :REL: in-front
+ :END:
To view all headings in an org-mode file as a boxy diagram, use
the interactive function =boxy-headings=
@@ -17,27 +22,31 @@ View org files as a boxy diagram.
To modify the relationship between a headline and its parent, add
the property REL to the child headline. Valid values are:
- - on top of
- - in front of
+ - on-top
+ - in-front
- behind
- above
- below
- - to the right of
- - to the left of
+ - right
+ - left
The tooltip for each headline shows the values that would be
displayed if the org file was in org columns view.
[[file:demo/headings.gif]]
* License
+ :PROPERTIES:
+ :REL: below
+ :END:
GPLv3
* Development
-
+ :PROPERTIES:
+ :REL: below
+ :END:
** Setup
-
Install [[https://github.com/doublep/eldev#installation][eldev]]
-** Commands:
+** Commands
*** =eldev lint=
Lint the =boxy-headings.el= file
*** =eldev compile=
diff --git a/boxy-headings.el b/boxy-headings.el
index cb30d1f5ce..501a7af833 100644
--- a/boxy-headings.el
+++ b/boxy-headings.el
@@ -29,13 +29,13 @@
;; a heading and its parent can be set by using a REL property on the
;; child heading. Valid values for REL are:
;;
-;; - on top of
-;; - in front of
+;; - on-top
+;; - in-front
;; - behind
;; - above
;; - below
-;; - to the right of
-;; - to the left of
+;; - right
+;; - left
;;
;; The tooltip in `boxy-headings' shows the values for each row
;; in `org-columns' and can be customized the same way as org
@@ -54,7 +54,7 @@
;;;; Options
(defgroup boxy-headings nil
- "Customization options for boxy-headings"
+ "Customization options for boxy-headings."
:group 'applications)
(defcustom boxy-headings-margin-x 2
@@ -223,13 +223,11 @@ diagram."
(with-current-buffer (marker-buffer (car markers))
(let* ((partitioned (seq-group-by
(lambda (h)
- (let ((child-rel (or (org-entry-get
- (org-element-property
:begin h)
- "REL")
- "in")))
- (if (member child-rel
boxy-children-relationships)
- 'children
- 'siblings)))
+ (if (member (boxy-headings--get-rel
+ (org-element-property :begin h))
+ boxy-children-relationships)
+ 'children
+ 'siblings))
(cddr heading)))
(children (alist-get 'children partitioned))
(siblings (alist-get 'siblings partitioned))
@@ -240,7 +238,7 @@ diagram."
(lambda (column)
(length (cadr (car column))))
columns)))
- (rel (save-excursion (goto-char pos) (or (org-entry-get nil
"REL") "in")))
+ (rel (boxy-headings--get-rel pos))
(level (if (member rel boxy-children-relationships)
(+ 1 parent-level)
parent-level))
@@ -302,6 +300,33 @@ diagram."
headings)
world))
+(defun boxy-headings--get-rel (&optional pos)
+ "Get the boxy relationship from an org heading at POS.
+
+POS can be nil to use the heading at point.
+
+The default relationship is 'in'."
+ (let ((rel (org-entry-get pos "REL")))
+ (cond
+ ((not rel)
+ "in")
+ ((string-match-p "on.+top" rel)
+ "on top of")
+ ((string-match-p "in.+front" rel)
+ "in front of")
+ ((string-match-p "behind" rel)
+ "behind")
+ ((string-match-p "above" rel)
+ "above")
+ ((string-match-p "below" rel)
+ "below")
+ ((string-match-p "left" rel)
+ "to the left of")
+ ((string-match-p "right" rel)
+ "to the right of")
+ (t
+ "in"))))
+
(provide 'boxy-headings)
;;; boxy-headings.el ends here
- [elpa] externals/boxy-headings 0a5c9c23f6 15/45: Bump version, (continued)
- [elpa] externals/boxy-headings 0a5c9c23f6 15/45: Bump version, ELPA Syncer, 2024/05/05
- [elpa] externals/boxy-headings 52ab98da33 21/45: Updated deps, ELPA Syncer, 2024/05/05
- [elpa] externals/boxy-headings b37450d475 22/45: Bump version, ELPA Syncer, 2024/05/05
- [elpa] externals/boxy-headings 8957f85ab9 23/45: Merge branch 'next' into 'main', ELPA Syncer, 2024/05/05
- [elpa] externals/boxy-headings 4d0254c9a8 17/45: Added org 9.3 dependency for emacs 26, ELPA Syncer, 2024/05/05
- [elpa] externals/boxy-headings 1c32b31f9f 32/45: Use #+TITLE property if it exists, ELPA Syncer, 2024/05/05
- [elpa] externals/boxy-headings ab63f02f18 35/45: Updated eldev install location, ELPA Syncer, 2024/05/05
- [elpa] externals/boxy-headings 1c0c464c10 38/45: Updated dependencies, ELPA Syncer, 2024/05/05
- [elpa] externals/boxy-headings b976b55524 13/45: Updated faces, ELPA Syncer, 2024/05/05
- [elpa] externals/boxy-headings 4db9b662ff 16/45: Merge branch 'next' into 'main', ELPA Syncer, 2024/05/05
- [elpa] externals/boxy-headings 147ea800ab 18/45: Generalized REL property,
ELPA Syncer <=
- [elpa] externals/boxy-headings 0ff8eb3119 25/45: Added tests, ELPA Syncer, 2024/05/05
- [elpa] externals/boxy-headings 003479ff2f 28/45: Added more tests, ELPA Syncer, 2024/05/05
- [elpa] externals/boxy-headings 09b5e6c181 34/45: Added post-jump-hook, ELPA Syncer, 2024/05/05
- [elpa] externals/boxy-headings 01968c5a07 31/45: Merge branch 'next' into 'main', ELPA Syncer, 2024/05/05
- [elpa] externals/boxy-headings 9353923bf7 39/45: Updated contact details, ELPA Syncer, 2024/05/05
- [elpa] externals/boxy-headings 0a36bd2354 43/45: Updated documentation, ELPA Syncer, 2024/05/05
- [elpa] externals/boxy-headings 7a8f3bc329 45/45: Updated copyright, ELPA Syncer, 2024/05/05
- [elpa] externals/boxy-headings 0dee4d712b 27/45: Merge branch 'next' into 'main', ELPA Syncer, 2024/05/05
- [elpa] externals/boxy-headings d92ffd14df 30/45: Bump version, ELPA Syncer, 2024/05/05
- [elpa] externals/boxy-headings 26b1a924a6 33/45: Merge branch 'next' into 'main', ELPA Syncer, 2024/05/05