From: Steinar Bang <sb@dod.no>
To: help-gnu-emacs@gnu.org
Subject: Tip: ide-fix: an IDE formatting fixup function
Date: Tue, 23 Jun 2015 16:28:21 +0200 [thread overview]
Message-ID: <86616e5wje.fsf@dod.no> (raw)
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))))
reply other threads:[~2015-06-23 14:28 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=86616e5wje.fsf@dod.no \
--to=sb@dod.no \
--cc=help-gnu-emacs@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.