Tiny refactoring
* lisp/org.el (org-ctrl-c-ctrl-c): Tiny refactoring.
This commit is contained in:
parent
e76a541865
commit
ab9e9d2857
14
lisp/org.el
14
lisp/org.el
|
@ -20744,11 +20744,11 @@ This command does many different things, depending on context:
|
||||||
(funcall org-finish-function))
|
(funcall org-finish-function))
|
||||||
((run-hook-with-args-until-success 'org-ctrl-c-ctrl-c-hook))
|
((run-hook-with-args-until-success 'org-ctrl-c-ctrl-c-hook))
|
||||||
(t
|
(t
|
||||||
(let* ((context (org-element-context)) (type (org-element-type context)))
|
|
||||||
;; Test if point is within a blank line.
|
|
||||||
(if (save-excursion (beginning-of-line) (looking-at "[ \t]*$"))
|
(if (save-excursion (beginning-of-line) (looking-at "[ \t]*$"))
|
||||||
(or (run-hook-with-args-until-success 'org-ctrl-c-ctrl-c-final-hook)
|
(or (run-hook-with-args-until-success 'org-ctrl-c-ctrl-c-final-hook)
|
||||||
(user-error "C-c C-c can do nothing useful at this location"))
|
(user-error "C-c C-c can do nothing useful at this location"))
|
||||||
|
(let* ((context (org-element-context))
|
||||||
|
(type (org-element-type context)))
|
||||||
(case type
|
(case type
|
||||||
;; When at a link, act according to the parent instead.
|
;; When at a link, act according to the parent instead.
|
||||||
(link (setq context (org-element-property :parent context))
|
(link (setq context (org-element-property :parent context))
|
||||||
|
@ -20758,16 +20758,16 @@ This command does many different things, depending on context:
|
||||||
((bold code entity export-snippet inline-babel-call inline-src-block
|
((bold code entity export-snippet inline-babel-call inline-src-block
|
||||||
italic latex-fragment line-break macro strike-through subscript
|
italic latex-fragment line-break macro strike-through subscript
|
||||||
superscript underline verbatim)
|
superscript underline verbatim)
|
||||||
(while (and (setq context (org-element-property :parent context))
|
(setq context
|
||||||
(not (memq (setq type (org-element-type context))
|
(org-element-lineage
|
||||||
'(radio-target paragraph verse-block
|
context '(radio-target paragraph verse-block table-cell)))))
|
||||||
table-cell)))))))
|
|
||||||
;; For convenience: at the first line of a paragraph on the
|
;; For convenience: at the first line of a paragraph on the
|
||||||
;; same line as an item, apply function on that item instead.
|
;; same line as an item, apply function on that item instead.
|
||||||
(when (eq type 'paragraph)
|
(when (eq type 'paragraph)
|
||||||
(let ((parent (org-element-property :parent context)))
|
(let ((parent (org-element-property :parent context)))
|
||||||
(when (and (eq (org-element-type parent) 'item)
|
(when (and (eq (org-element-type parent) 'item)
|
||||||
(= (point-at-bol) (org-element-property :begin parent)))
|
(= (line-beginning-position)
|
||||||
|
(org-element-property :begin parent)))
|
||||||
(setq context parent type 'item))))
|
(setq context parent type 'item))))
|
||||||
;; Act according to type of element or object at point.
|
;; Act according to type of element or object at point.
|
||||||
(case type
|
(case type
|
||||||
|
|
Loading…
Reference in New Issue