From e8267b4b165f6a6a086f4a9786e9df8ffe31d55c Mon Sep 17 00:00:00 2001 From: Yuchen Pei Date: Sat, 24 Jun 2023 13:41:13 +1000 Subject: Enhancements for org and elisp - org: adding an :after advice to org-insert-structure-template so that it goes into editing immediately - elisp: C-M-x evals a region when region is active --- emacs/.emacs.d/lisp/my/my-org.el | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'emacs/.emacs.d/lisp/my/my-org.el') diff --git a/emacs/.emacs.d/lisp/my/my-org.el b/emacs/.emacs.d/lisp/my/my-org.el index 28c5354..9411f72 100644 --- a/emacs/.emacs.d/lisp/my/my-org.el +++ b/emacs/.emacs.d/lisp/my/my-org.el @@ -1013,5 +1013,13 @@ When BLOCK-REGEXP is non-nil, use this regexp to find blocks." (interactive "p") (my-org-vote-up (- points))) +;; used to add advice to `org-insert-structure-template'. +(require 'my-buffer) +(defun my-org-edit-special (type) + (when (equal type "src") + (insert (string-remove-suffix + "-mode" (prin1-to-string (my-read-major-mode))))) + (org-edit-special)) + (provide 'my-org) ;;; my-org.el ends here -- cgit v1.2.3