summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicolas Goaziou <n.goaziou@gmail.com>2013-12-03 21:41:48 +0100
committerNicolas Goaziou <n.goaziou@gmail.com>2013-12-03 21:41:48 +0100
commitaf6f14d907dc2f0116af9e513bbbd3771cc690aa (patch)
tree6c3c1d7abdb2f3af3969c793686fb8bee5726722
parent8953b417f205752aa4548a74518e16b2b54330ca (diff)
downloadorg-mode-af6f14d907dc2f0116af9e513bbbd3771cc690aa.tar.gz
Fix C-c C-c behaviour on some objectsrelease_8.2.4
* 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
-rw-r--r--lisp/org.el15
1 files changed, 11 insertions, 4 deletions
diff --git a/lisp/org.el b/lisp/org.el
index b84855a..adaabeb 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)