summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicolas Goaziou <mail@nicolasgoaziou.fr>2015-02-05 18:12:23 +0100
committerNicolas Goaziou <mail@nicolasgoaziou.fr>2015-02-05 18:12:23 +0100
commitab9e9d2857e01d832e39678dd6e7ec8cd13da3b3 (patch)
tree456c5bcf886f098e29965d9f235cf889e6de7ada
parente76a541865e47d58c411857a12c93ea4535c6d41 (diff)
downloadorg-mode-ab9e9d2857e01d832e39678dd6e7ec8cd13da3b3.tar.gz
Tiny refactoring
* lisp/org.el (org-ctrl-c-ctrl-c): Tiny refactoring.
-rwxr-xr-xlisp/org.el20
1 files changed, 10 insertions, 10 deletions
diff --git a/lisp/org.el b/lisp/org.el
index 56077d5..a095f8d 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