Function: org-do-remove-indentation
org-do-remove-indentation is a byte-compiled function defined in
org-macs.el.gz.
Signature
(org-do-remove-indentation &optional N SKIP-FL)
Documentation
Remove the maximum common indentation from the buffer.
When optional argument N is a positive integer, remove exactly that much characters from indentation, if possible. When optional argument SKIP-FL is non-nil, skip the first line. Return nil if it fails.
Source Code
;; Defined in /usr/src/emacs/lisp/org/org-macs.el.gz
(defun org-do-remove-indentation (&optional n skip-fl)
"Remove the maximum common indentation from the buffer.
When optional argument N is a positive integer, remove exactly
that much characters from indentation, if possible. When
optional argument SKIP-FL is non-nil, skip the first
line. Return nil if it fails."
(catch :exit
(goto-char (point-min))
;; Find maximum common indentation, if not specified.
(let ((n (or n
(let ((min-ind (point-max)))
(save-excursion
(when skip-fl (forward-line))
(while (re-search-forward "^[ \t]*\\S-" nil t)
(let ((ind (org-current-text-indentation)))
(if (zerop ind) (throw :exit nil)
(setq min-ind (min min-ind ind))))))
min-ind))))
(if (zerop n) (throw :exit nil)
;; Remove exactly N indentation, but give up if not possible.
(when skip-fl (forward-line))
(while (not (eobp))
(let ((ind (progn (skip-chars-forward " \t") (current-column))))
(cond ((eolp) (delete-region (line-beginning-position) (point)))
((< ind n) (throw :exit nil))
(t (indent-line-to (- ind n))))
(forward-line)))
;; Signal success.
t))))