diff options
author | Yuchen Pei <id@ypei.org> | 2023-08-19 22:17:33 +1000 |
---|---|---|
committer | Yuchen Pei <id@ypei.org> | 2023-08-19 22:17:33 +1000 |
commit | eb496dbcd9e1074dbbbca004f9aa2754bb18b2ec (patch) | |
tree | 0434bfec761816e5617d418d889eff9d09267d70 /emacs | |
parent | ad4f5144f884f1f10d95dcb9e8ee6962c704341e (diff) |
A hook after org-src-edit-exit
Diffstat (limited to 'emacs')
-rw-r--r-- | emacs/.emacs.d/init/ycp-org.el | 3 | ||||
-rw-r--r-- | emacs/.emacs.d/lisp/my/my-org.el | 8 |
2 files changed, 10 insertions, 1 deletions
diff --git a/emacs/.emacs.d/init/ycp-org.el b/emacs/.emacs.d/init/ycp-org.el index 71ed6bc..9c9191a 100644 --- a/emacs/.emacs.d/init/ycp-org.el +++ b/emacs/.emacs.d/init/ycp-org.el @@ -461,7 +461,8 @@ 'org-capture-place-template :around 'my-org-capture-place-template-dont-delete-windows)) (advice-add 'org-insert-structure-template :after 'my-org-edit-special) - (advice-add 'org-edit-src-exit :before 'my-org-edit-src-before-exit)) + (advice-add 'org-edit-src-exit :before 'my-org-edit-src-before-exit) + (advice-add 'org-edit-src-exit :after 'my-org-edit-src-after-exit)) (my-package my-org (:delay 30) diff --git a/emacs/.emacs.d/lisp/my/my-org.el b/emacs/.emacs.d/lisp/my/my-org.el index 1b99dc5..f02784d 100644 --- a/emacs/.emacs.d/lisp/my/my-org.el +++ b/emacs/.emacs.d/lisp/my/my-org.el @@ -79,6 +79,14 @@ With a prefix, insert inactive dates. "A :before advice for org-edit-src-exit." (delete-trailing-whitespace)) +(defun my-org-edit-src-after-exit () + "An :after advice for org-edit-src-exit. + +Deactivate mark and move point to after the block." + (deactivate-mark) + (re-search-forward "^[ \t]*#\\+end_") + (beginning-of-line 2)) + ;; navigation (defun my-org-jump-to-last-visible-child () "Goto the last visible child." |