C-c C-c does nothing when at a blank line

* lisp/org.el (org-ctrl-c-ctrl-c): Do nothing when at a blank line,
  but still run `org-ctrl-c-ctrl-c-final-hook'.
This commit is contained in:
Nicolas Goaziou 2013-02-15 16:08:09 +01:00
parent dbadb2916b
commit 0b6a2e2416
1 changed files with 2 additions and 7 deletions

View File

@ -19651,13 +19651,8 @@ This command does many different things, depending on context:
((run-hook-with-args-until-success 'org-ctrl-c-ctrl-c-hook)) ((run-hook-with-args-until-success 'org-ctrl-c-ctrl-c-hook))
(t (t
(let* ((context (org-element-context)) (type (org-element-type context))) (let* ((context (org-element-context)) (type (org-element-type context)))
;; Test if point is within blanks at the end of an element. ;; Test if point is within a blank line.
(if (save-excursion (if (save-excursion (beginning-of-line) (looking-at "[ \t]*$"))
(or (not context)
(beginning-of-line)
(and (looking-at "[ \t]*$")
(skip-chars-forward " \r\t\n")
(>= (point) (org-element-property :end context)))))
(or (run-hook-with-args-until-success 'org-ctrl-c-ctrl-c-final-hook) (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")) (user-error "C-c C-c can do nothing useful at this location"))
;; For convenience: at the first line of a paragraph on the ;; For convenience: at the first line of a paragraph on the