Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
commit 240a8a0 Author: Daniel Hackney <[email protected]> Date: Wed Apr 25 21:13:31 2012 -0400 Untabify all elisp. Many elisp files had tabs in comments or headers which was not removed by `indent-region'. This patch runs `untabify' on all elisp files. Once again, this can be applied to all elisp files with: (require 'cl) (defun recursive-files (dir func) (loop with before-save-hook for (file is-dir) in (directory-files-and-attributes dir t "^[^.]") if is-dir do (recursive-files file func) else if (string-match ".*\.el$" file) do (with-current-buffer (find-file-noselect file) (funcall func) (basic-save-buffer) (kill-buffer)))) (recursive-files "/path/to/ess" #'(lambda () (untabify (point-min) (point-max)))) This should be applied on top of my reindentation patch. commit ad6d16e Author: Daniel Hackney <[email protected]> Date: Wed Apr 25 21:02:54 2012 -0400 Reindent all elisp files. Now that whitespace style and line-ending conventions are established, reindent all elisp files accordingly. This is accomplished by the following code (require 'cl) (defun recursive-files (dir func) (loop with before-save-hook for (file is-dir) in (directory-files-and-attributes dir t "^[^.]") if is-dir do (recursive-files file func) else if (string-match ".*\.el$" file) do (with-current-buffer (find-file-noselect file) (funcall func) (basic-save-buffer) (kill-buffer)))) (recursive-files "/path/to/ess" #'(lambda () (whitespace-cleanup) (indent-region (point-min) (point-max)))) This will walk through all elisp files under "/path/to/ess" and clean up whitespace and re-indent the file. The `whitespace-cleanup' in the `lambda' is necessary because `indent-region' will not replace tabs with spaces if a line is already indented to the correct column using tabs. Running `whitespace-cleanup' first ensures that the file is indented strictly with spaces. A stricter version of this would be: (recursive-files "~/work/ESS" #'(lambda () (while (re-search-forward "\t" nil t) (replace-match " ")) (indent-region (point-min) (point-max)))) Which would remove all tab characters from all elisp files. This patch only runs `whitespace-cleanup' to remove leading tabs. git-svn-id: https://svn.r-project.org/ESS/trunk@4813 0bbaf3bd-34e0-0310-bf65-c717079852d4
- Loading branch information