diff --git a/README.org b/README.org index 712afeb..3e6b882 100644 --- a/README.org +++ b/README.org @@ -2306,9 +2306,8 @@ list detailing and motivating each listing: [[info:org#Hyperlinks][hyperlinks (info)]]. 5. Listing [[lst:setup-org-mode-map]] extends the =org-mode-map= with useful key-bindings. -6. Listing [[lst:setup-org-src]] facilitates [[info:org#Editing Source Code][editing Python source code blocks]], - and it provides a function to remove the indentation of all =org-src-mode= - blocks without =-i= switch. +6. Listing [[lst:setup-org-src]] facilitates [[info:org#Editing Source Code][editing source code blocks]], and it + provides functions to change the indentation of all =org-src-mode= blocks. 7. Listing [[lst:setup-ob-python]] allows to pretty-print Python session source block values with [[https://github.com/psf/black#readme][black]] instead of [[https://docs.python.org/3/library/pprint.html][pprint]]. This snippet may break in the future, because it sets =org-babel-python--def-format-value= which is a @@ -2504,6 +2503,21 @@ When called twice, replace the previously inserted \\(\\) by one $." (org-src-preserve-indentation nil)) (org-indent-block)))) + (defun org-right-shift-block (&optional arg) + "Right-shift the block at point 4 spaces. +With prefix argument ARG, prompt for the number of spaces." + (interactive "P") + (let ((spaces 4) + (start (org-babel-where-is-src-block-head))) + (if (not start) (message "Not at block") + (when arg + (setq spaces (read-number "Number of spaces: "))) + ;; The `SUBEXP' of the block body is 5. + (goto-char (match-end 5)) + (forward-line -1) + (string-insert-rectangle + (match-beginning 5) (point) (make-string spaces ?\s))))) + (declare-function org-babel-map-src-blocks "ext:ob-core" (file &rest body)) (declare-function org-do-remove-indentation "ext:org-macs" (n skip-fl))