;;; -*- lexical-binding: t -*- ;; ;; this file: ;; https://dataswamp.org/~incal/emacs-init/align-incal.el (require 'cl-lib) (require 'string) (defun insert-at-col (str col) (interactive "s string: \nncol: ") (let*((beg (or (current-column) 0)) (pad-len (- col beg))) (when (> pad-len 0) (insert (make-string pad-len ?\s) str)))) (let ((push-col 0)) (defun push-to-col (&optional set-col) (interactive "P") (if (integerp set-col) (setq push-col set-col) (if (and set-col (listp set-col)) (progn (setq push-col (or (current-column) 0)) (message "done: %s" push-col)) (let*((beg (or (current-column) 0)) (pad-len (- push-col beg))) (when (> pad-len 0) (insert (make-string pad-len ?\s)) (forward-line) (unless (looking-at "$") (forward-char beg))))))) (declare-function push-to-col nil)) ;; (skip-chars-forward "[[:blank:]\n]*") (defun eat-space () (interactive) (let ((beg (point)) (same-line-whitespace " \t")) (beginning-of-line) (if (looking-at (format "^[%s]*$" same-line-whitespace)) (delete-blank-lines) (goto-char beg) (if (zerop (skip-chars-forward same-line-whitespace)) (progn (delete-horizontal-space) (insert "\s")) (delete-region beg (point)))))) (provide 'align-incal)