Add `defun-name-to-org-commit' helper function

This commit is contained in:
Gerard Vermeulen 2023-10-27 14:59:52 +02:00
parent a4fd8dd7a2
commit a730279f23
1 changed files with 21 additions and 0 deletions

View File

@ -6149,6 +6149,27 @@ instance [[https://github.com/Fanael/rainbow-delimiters#readme][rainbow-delimite
(show-smartparens-global-mode +1))
#+end_src
#+caption[=Org= commit message helper]:
#+caption: =Org= commit message helper.
#+name: lst:org-commit-message-helper
#+begin_src emacs-lisp -n :results silent
(with-eval-after-load 'smartparens-config
(defun defun-name-to-org-commit ()
"Copy and wrap the defun name for Org commit messages to the kill-ring.
BUG: `beginning-of-defun' may find any (`with-eval-after-load') toplevel sexp."
(interactive)
(save-excursion
(beginning-of-defun)
(sp-forward-symbol)
(sp-copy-sexp))
(with-temp-buffer
(insert "(")
(yank)
(insert "):")
(kill-region 1 (point)))))
#+end_src
** [[https://github.com/davidshepherd7/electric-operator#readme][Electric operators]]
:PROPERTIES:
:CUSTOM_ID: sec:electric-operators