| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859 | ;;;; reindent.el;;; a reindenting script to automagically indent files.;;; Licenced under the GNU GPLv3 or later.;;; Copyright © 2014, Samuel W. Flint <swflint@flintfam.org>(require 'find-lisp)(defun indent-buffer ()  "Indent Current Buffer"  (indent-region (point-min) (point-max)))(defun indent-correctly ()  "Indent the current buffer, unless the region is active"  (if (region-active-p)      (progn        (indent-region         (region-beginning)         (region-end))        (message "Indented Region."))    (indent-buffer)    (message "Indented Buffer.")))(defun untabify-correctly ()  "Untabify current buffer, unless the region is active"  (if (region-active-p)      (progn        (untabify (region-beginning) (region-end))        (message "Untabified Region"))    (untabify (point-min) (point-max))    (message "Untabified Buffer")))(defun indent-driver ()  (indent-correctly)  (untabify-correctly)  (save-buffer))(defun indent-driver-with-file (file-path)  (let ((file-buffer (find-file file-path)))    (with-current-buffer file-buffer      (indent-driver)      (save-buffer))    (kill-buffer file-buffer)))(defun reindent-directory-contents (directory regex)  "Reindent the files in a directory.Map `indent-driver-with-file' over files in DIRECTORY whose namesmatch REGEX.  Uses `find-lisp-find-files' to locate files to mapover.Returns 't'."  (interactive (list (read-directory-name "Directory: ")                     (read-regexp "Matching Regexp: ")))  (mapc #'indent-driver-with-file (find-lisp-find-files directory regex))  t)(provide 'reindent-tools);;;; end reindent.el
 |