diff --git a/lisp/org.el b/lisp/org.el index 56077d56f..a095f8d3b 100755 --- a/lisp/org.el +++ b/lisp/org.el @@ -20744,11 +20744,11 @@ This command does many different things, depending on context: (funcall org-finish-function)) ((run-hook-with-args-until-success 'org-ctrl-c-ctrl-c-hook)) (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]*$")) - (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")) + (if (save-excursion (beginning-of-line) (looking-at "[ \t]*$")) + (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")) + (let* ((context (org-element-context)) + (type (org-element-type context))) (case type ;; When at a link, act according to the parent instead. (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 italic latex-fragment line-break macro strike-through subscript superscript underline verbatim) - (while (and (setq context (org-element-property :parent context)) - (not (memq (setq type (org-element-type context)) - '(radio-target paragraph verse-block - table-cell))))))) + (setq context + (org-element-lineage + context '(radio-target paragraph verse-block table-cell))))) ;; For convenience: at the first line of a paragraph on the ;; same line as an item, apply function on that item instead. (when (eq type 'paragraph) (let ((parent (org-element-property :parent context))) (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)))) ;; Act according to type of element or object at point. (case type