* Tip: ide-fix: an IDE formatting fixup function
@ 2015-06-23 14:28 Steinar Bang
0 siblings, 0 replies; only message in thread
From: Steinar Bang @ 2015-06-23 14:28 UTC (permalink / raw)
To: help-gnu-emacs
IDEs are nice in that they can easily navigate code, generate code and
move, copy and reorganize code on a structural basis.
However, they typically suck at formatting. Formatting is inconsistent
across IDEs, different versions of the same IDE and different modules
inside a particular IDE.
So I've written this small function that I use before committing files
to version control systems.
My workflow, is:
- Code, refactor and test in an IDE
- Before committing go to the magit status buffer of the project (I
mostly just use git these days) and visit all files with changes,
and:
- Do `M-x ide-fix RET'
- If the files get modified, save them
Here's the definition of ide-fix:
(defun ide-fix ()
"Remove trailing spaces and fix indentation"
(interactive)
(save-excursion
(goto-char (point-min))
(replace-regexp "[ \t]+$" "")
(indent-region (point-min) (point-max))))
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2015-06-23 14:28 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-06-23 14:28 Tip: ide-fix: an IDE formatting fixup function Steinar Bang
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).