;;; -*- lexical-binding: t -*- ;; ;; this file: ;; https://dataswamp.org/~incal/emacs-init/align-from-left.el (require 'cl-lib) (let ((alf-regexp)) (defun align-from-left (&optional set-regexp) (interactive "p") (let ((default-regexp "^\\|[[:punct:]]\\|[[:space:]][[:alnum:]]")) (unless (stringp set-regexp) (cl-case set-regexp ( 4 (setq alf-regexp (read-regexp "regexp: "))) (16 (setq alf-regexp default-regexp)) ( t (unless alf-regexp (setq alf-regexp default-regexp) ))))) (let ((beg (point)) (re (or (and (stringp set-regexp) set-regexp) alf-regexp) )) (when (re-search-backward re (pos-bol) t) (while (looking-at "[[:space:]]") (forward-char) ) (insert (make-string (- beg (point)) ?\s)) )))) (declare-function align-from-left nil) (provide 'align-from-left)