From af6f14d907dc2f0116af9e513bbbd3771cc690aa Mon Sep 17 00:00:00 2001 From: Nicolas Goaziou Date: Tue, 3 Dec 2013 21:41:48 +0100 Subject: [PATCH] Fix C-c C-c behaviour on some objects * lisp/org.el (org-ctrl-c-ctrl-c): When point is on an unsupported object, look for something to do at a higher level instead of bailing out. For example, C-c C-c should toggle checkbox in the following example even though X point is technically on a subscript. - [ ] a_Xb --- lisp/org.el | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/lisp/org.el b/lisp/org.el index b84855a91..adaabebc6 100644 --- a/lisp/org.el +++ b/lisp/org.el @@ -20214,10 +20214,17 @@ This command does many different things, depending on context: (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")) - ;; When at a link, act according to the parent instead. - (when (eq type 'link) - (setq context (org-element-property :parent context)) - (setq 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)) + (setq type (org-element-type context))) + ;; Unsupported object types: check parent element instead. + ((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)) + '(paragraph verse-block))))))) ;; 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) -- 2.11.4.GIT