diff options
author | Nicolas Goaziou <n.goaziou@gmail.com> | 2013-01-20 23:44:10 +0100 |
---|---|---|
committer | Nicolas Goaziou <n.goaziou@gmail.com> | 2013-01-20 23:45:44 +0100 |
commit | e376137e7187a685d1356c218932f83ac2f412f3 (patch) | |
tree | 7f056329abd47cba8e2fccb4edf157c16382434e | |
parent | 3e699dc0327516db5447fbc49101642350e4873a (diff) | |
download | org-mode-e376137e7187a685d1356c218932f83ac2f412f3.tar.gz |
Allow C-c C-c to act on item anywhere on its first line
* lisp/org.el (org-ctrl-c-ctrl-c): Anywhere on the first line of an
item, act on that item, provided no other object is found under the
point. Fix bug when function is called on a footnote definition
attribute.
This is a convenience feature mimicing old behaviour, but it is an
aberration from the structure POV.
-rw-r--r-- | lisp/org.el | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/lisp/org.el b/lisp/org.el index 938e307..4fe3985 100644 --- a/lisp/org.el +++ b/lisp/org.el @@ -19561,14 +19561,25 @@ This command does many different things, depending on context: (>= (point) (org-element-property :end context))))) (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")) + ;; 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))) + (setq context parent type 'item)))) + ;; Act according to type of element or object at point. (case type (clock (org-clock-update-time-maybe)) (dynamic-block (save-excursion (goto-char (org-element-property :post-affiliated context)) (org-update-dblock))) - ((footnote-definition footnote-reference) - (call-interactively 'org-footnote-action)) + (footnote-definition + (save-excursion + (goto-char (org-element-property :post-affiliated context)) + (call-interactively 'org-footnote-action))) + (footnote-reference (call-interactively 'org-footnote-action)) ((headline inlinetask) (save-excursion (goto-char (org-element-property :begin context)) (call-interactively 'org-set-tags))) |