Function: elisp-refs--unindent-rigidly

elisp-refs--unindent-rigidly is a byte-compiled function defined in elisp-refs.el.

Signature

(elisp-refs--unindent-rigidly STRING)

Documentation

Given an indented STRING, unindent rigidly until at least one line has no indent.

STRING should have a 'elisp-refs-start-pos property. The returned string will have this property updated to reflect the unindent.

Source Code

;; Defined in ~/.emacs.d/elpa/elisp-refs-20230920.201/elisp-refs.el
(defun elisp-refs--unindent-rigidly (string)
  "Given an indented STRING, unindent rigidly until
at least one line has no indent.

STRING should have a 'elisp-refs-start-pos property. The returned
string will have this property updated to reflect the unindent."
  (let* ((lines (s-lines string))
         ;; Get the leading whitespace for each line.
         (indents (--map (car (s-match (rx bos (+ whitespace)) it))
                         lines))
         (min-indent (-min (--map (length it) indents))))
    (propertize
     (elisp-refs--map-lines
      string
      (lambda (line) (substring line min-indent)))
     'elisp-refs-unindented min-indent)))