Allow C-c C-c on blank lines within src blocks
* lisp/org.el (org-ctrl-c-ctrl-c): Act on blank lines if they are located within a src block. Reported-by: John Hendy <jw.hendy@gmail.com> <http://permalink.gmane.org/gmane.emacs.orgmode/111720>
This commit is contained in:
parent
d715cc42fa
commit
ebb9da0d03
24
lisp/org.el
24
lisp/org.el
|
@ -21117,11 +21117,6 @@ This command does many different things, depending on context:
|
|||
(funcall org-finish-function))
|
||||
((org-babel-hash-at-point))
|
||||
((run-hook-with-args-until-success 'org-ctrl-c-ctrl-c-hook))
|
||||
((save-excursion (beginning-of-line) (looking-at-p "[ \t]*$"))
|
||||
(or (run-hook-with-args-until-success 'org-ctrl-c-ctrl-c-final-hook)
|
||||
(user-error
|
||||
(substitute-command-keys
|
||||
"`\\[org-ctrl-c-ctrl-c]' can do nothing useful here"))))
|
||||
(t
|
||||
(let* ((context
|
||||
(org-element-lineage
|
||||
|
@ -21145,7 +21140,21 @@ This command does many different things, depending on context:
|
|||
(setq context parent)
|
||||
(setq type 'item))))
|
||||
;; Act according to type of element or object at point.
|
||||
;;
|
||||
;; Do nothing on a blank line, except if it is contained in
|
||||
;; a src block. Hence, we first check if point is in such
|
||||
;; a block and then if it is at a blank line.
|
||||
(pcase type
|
||||
((or `inline-src-block `src-block)
|
||||
(unless org-babel-no-eval-on-ctrl-c-ctrl-c
|
||||
(org-babel-eval-wipe-error-buffer)
|
||||
(org-babel-execute-src-block
|
||||
current-prefix-arg (org-babel-get-src-block-info nil context))))
|
||||
((guard (org-match-line "[ \t]*$"))
|
||||
(or (run-hook-with-args-until-success 'org-ctrl-c-ctrl-c-final-hook)
|
||||
(user-error
|
||||
(substitute-command-keys
|
||||
"`\\[org-ctrl-c-ctrl-c]' can do nothing useful here"))))
|
||||
((or `babel-call `inline-babel-call)
|
||||
(let ((info (org-babel-lob-get-info context)))
|
||||
(when info (org-babel-execute-src-block nil info))))
|
||||
|
@ -21161,11 +21170,6 @@ This command does many different things, depending on context:
|
|||
((or `headline `inlinetask)
|
||||
(save-excursion (goto-char (org-element-property :begin context))
|
||||
(call-interactively #'org-set-tags)))
|
||||
((or `inline-src-block `src-block)
|
||||
(unless org-babel-no-eval-on-ctrl-c-ctrl-c
|
||||
(org-babel-eval-wipe-error-buffer)
|
||||
(org-babel-execute-src-block
|
||||
current-prefix-arg (org-babel-get-src-block-info nil context))))
|
||||
(`item
|
||||
;; At an item: `C-u C-u' sets checkbox to "[-]"
|
||||
;; unconditionally, whereas `C-u' will toggle its presence.
|
||||
|
|
Loading…
Reference in New Issue