Skip to content

Commit 5330b5d

Browse files
committed
Add support for org-data elements
1 parent 6706a76 commit 5330b5d

File tree

1 file changed

+18
-17
lines changed

1 file changed

+18
-17
lines changed

org-cmenu.el

Lines changed: 18 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ If nil you should use `org-cmenu-update-transient-prefixes' function."
8686

8787
(defun org-cmenu-define-standard-type-aliases ()
8888
;; Buffer pseudo element (see: org-cmenu-element-lineage)
89-
(org-cmenu-define-type-alias 'buffer '(buffer))
89+
(org-cmenu-define-type-alias 'buffer '(buffer org-data))
9090
;; Each elements (see: org-element-all-elements)
9191
(dolist (type org-element-all-elements)
9292
(org-cmenu-define-type-alias type (list type)))
@@ -491,25 +491,26 @@ If nil you should use `org-cmenu-update-transient-prefixes' function."
491491
(car path) pos)))))
492492
(setq path (cdr path)))
493493

494-
(let ((on-headline-p (eq (org-element-type (car path)) 'headline)))
495-
;; Add a section element
496-
(unless on-headline-p
494+
(unless (eq (org-element-type (car (last path))) 'org-data)
495+
(let ((on-headline-p (eq (org-element-type (car path)) 'headline)))
496+
;; Add a section element
497+
(unless on-headline-p
498+
(setq path
499+
(append
500+
path
501+
(list (org-cmenu-element-current-section)))))
502+
503+
;; Add headline elements
504+
(setq path
505+
(append
506+
path
507+
(org-cmenu-element-headlines-path (not on-headline-p))))
508+
509+
;; Add buffer elements
497510
(setq path
498511
(append
499512
path
500-
(list (org-cmenu-element-current-section)))))
501-
502-
;; Add headline elements
503-
(setq path
504-
(append
505-
path
506-
(org-cmenu-element-headlines-path (not on-headline-p))))
507-
508-
;; Add buffer elements
509-
(setq path
510-
(append
511-
path
512-
(list (org-cmenu-element-buffer)))))
513+
(list (org-cmenu-element-buffer))))))
513514
path))
514515

515516
;;;; Menu

0 commit comments

Comments
 (0)