;;; -*- lexical-binding: t -*- ;; ;; this file: ;; https://dataswamp.org/~incal/emacs-init/edit.el (require 'dwim) (require 'tabs) (defun increase-values (&optional inc beg end) (interactive `(,current-prefix-arg ,@(use-region))) (if (listp inc) (setq inc (car inc)) (unless (numberp inc) (setq inc 1))) (or beg (setq beg (point-min))) (or end (setq end (point-max))) (save-mark-and-excursion (goto-char beg) (while (re-search-forward "[[:digit:]]+" end t) (let* ((digit (string-to-number (match-string 0))) (sum (+ digit inc))) (replace-match (format "%s" sum)))))) (defun back-to-dwim () (interactive) (scroll-right) (let ((beg (point))) (back-to-indentation) (when (= beg (point)) (beginning-of-line) ))) (defun before-save-hook-f () (untab-all) (delete-trailing-whitespace) ) (add-hook 'before-save-hook #'before-save-hook-f) (provide 'edit)