mirror of
https://github.com/doomemacs/doomemacs.git
synced 2025-12-06 02:30:33 -08:00
feat(literate): add indent babel block helper
This adds a helper function, which can be used to auto indent all emacs-lisp babel src blocks in the current file. It's intended to help users to auto format their emacs-lisp blocks in their literate config, improving the styling of each respective codeblock.
This commit is contained in:
parent
4b3ef167aa
commit
a2bcbd428f
1 changed files with 12 additions and 0 deletions
|
|
@ -166,6 +166,18 @@
|
|||
(indent-region (point-min) (point-max))
|
||||
(save-buffer)))))
|
||||
|
||||
;;;###autoload
|
||||
(defun +literate-indent-elisp-src-blocks ()
|
||||
"Indent all emacs-lisp src blocks in the current Org buffer, then save."
|
||||
(interactive)
|
||||
(save-excursion
|
||||
(org-babel-map-src-blocks nil
|
||||
(when (string= lang "emacs-lisp")
|
||||
(org-babel-do-in-edit-buffer
|
||||
(emacs-lisp-mode)
|
||||
(indent-region (point-min) (point-max)))))
|
||||
(save-buffer)))
|
||||
|
||||
;;
|
||||
;;; Hooks
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue