mirror of
https://github.com/doomemacs/doomemacs
synced 2025-08-01 12:17:25 -05:00
lang/org: fix newline-and-indent behavior in src blocks
This commit is contained in:
@ -348,3 +348,15 @@ with `org-cycle')."
|
||||
|
||||
;;;###autoload
|
||||
(defalias #'+org/toggle-fold #'+org|toggle-only-current-fold)
|
||||
|
||||
|
||||
;;
|
||||
;; Advice
|
||||
;;
|
||||
|
||||
;;;###autoload
|
||||
(defun +org*return-indent-in-src-blocks ()
|
||||
"Try to mimic `newline-and-indent' with correct indentation in src blocks."
|
||||
(when (org-in-src-block-p t)
|
||||
(org-babel-do-in-edit-buffer
|
||||
(call-interactively #'indent-for-tab-command))))
|
||||
|
@ -258,6 +258,9 @@ between the two."
|
||||
|
||||
(add-hook 'org-tab-first-hook #'+org|toggle-only-current-fold t)
|
||||
|
||||
;; Fix newline-and-indent behavior in src blocks
|
||||
(advice-add #'org-return-indent :after #'+org*return-indent-in-src-blocks)
|
||||
|
||||
(map! :map outline-mode-map
|
||||
:n "^" nil
|
||||
:n [backtab] nil
|
||||
|
Reference in New Issue
Block a user