lang/org: update for org 9
This commit is contained in:
parent
a9e4f7c2b4
commit
903eb92f36
1 changed files with 8 additions and 11 deletions
|
@ -62,10 +62,12 @@ I use this instead of `org-insert-item' or `org-insert-heading' which are too
|
||||||
opinionated and perform this simple task incorrectly (e.g. whitespace in the
|
opinionated and perform this simple task incorrectly (e.g. whitespace in the
|
||||||
wrong places)."
|
wrong places)."
|
||||||
(interactive)
|
(interactive)
|
||||||
(let* ((context (org-element-context))
|
(let* ((context (org-element-lineage
|
||||||
|
(org-element-context)
|
||||||
|
'(table table-row headline inlinetask item plain-list)
|
||||||
|
t))
|
||||||
(type (org-element-type context)))
|
(type (org-element-type context)))
|
||||||
(cond ((when-let (ct (+org--get-context '(item plain-list) context))
|
(cond ((eq type 'item)
|
||||||
(setq context ct))
|
|
||||||
(let ((marker (org-element-property :bullet context)))
|
(let ((marker (org-element-property :bullet context)))
|
||||||
(pcase direction
|
(pcase direction
|
||||||
('below
|
('below
|
||||||
|
@ -116,7 +118,7 @@ wrong places)."
|
||||||
;;;###autoload
|
;;;###autoload
|
||||||
(defun +org/toggle-checkbox ()
|
(defun +org/toggle-checkbox ()
|
||||||
(interactive)
|
(interactive)
|
||||||
(when-let (context (+org--get-context '(item)))
|
(when-let (context (org-element-lineage (org-element-context) '(item) t))
|
||||||
(org-end-of-line)
|
(org-end-of-line)
|
||||||
(org-beginning-of-line)
|
(org-beginning-of-line)
|
||||||
(if (org-element-property :checkbox context)
|
(if (org-element-property :checkbox context)
|
||||||
|
@ -153,12 +155,7 @@ fragments, opening links, or refreshing images."
|
||||||
(org-table-recalculate t)
|
(org-table-recalculate t)
|
||||||
(org-table-align)))
|
(org-table-align)))
|
||||||
|
|
||||||
((and (org-in-item-p)
|
((org-element-property :checkbox (org-element-lineage context '(item) t))
|
||||||
(org-element-property :checkbox
|
|
||||||
(save-excursion
|
|
||||||
(org-beginning-of-line)
|
|
||||||
(backward-char)
|
|
||||||
(org-element-context))))
|
|
||||||
(org-toggle-checkbox))
|
(org-toggle-checkbox))
|
||||||
|
|
||||||
((and (eq type 'headline)
|
((and (eq type 'headline)
|
||||||
|
@ -184,7 +181,7 @@ fragments, opening links, or refreshing images."
|
||||||
(org-preview-latex-fragment))
|
(org-preview-latex-fragment))
|
||||||
|
|
||||||
((eq type 'link)
|
((eq type 'link)
|
||||||
(let ((path (org-element-property :path (org-element-context))))
|
(let ((path (org-element-property :path (org-element-lineage context '(link) t))))
|
||||||
(if (and path (image-type-from-file-name path))
|
(if (and path (image-type-from-file-name path))
|
||||||
(+org/refresh-inline-images)
|
(+org/refresh-inline-images)
|
||||||
(org-open-at-point))))
|
(org-open-at-point))))
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue