Overhaul clang-include-fixer.el
authorHaojian Wu <hokein@google.com>
Wed, 5 Oct 2016 10:04:13 +0000 (10:04 +0000)
committerHaojian Wu <hokein@google.com>
Wed, 5 Oct 2016 10:04:13 +0000 (10:04 +0000)
commit0e1a50e9c459d46995ba0cc7f5ed1da535e1b70a
tree31f165331fbf554cffc8e04a92fc82eaa473e73b
parentcf43f179b15f9db43b0ce32994cea2bd8be0f272
Overhaul clang-include-fixer.el

General overhaul to fix many coding bugs, simplify the code, and improve readability.

* Clarify documentation strings of user options.
* Say that clang-include-fixer-executable is a file to have auto completion.
* Allow user to select available options for clang-include-fixer-input-format. Turn it into a symbol as it's not a free-form string.
* Remove clang-include-fixer-query-mode. This option was apparently used to select between two different operation modes, which is not a typical use case for user options. Provide two separate commands instead.
* Add a face for the overlay highlighting so that users can customize it.
Move user commands to the front so that readers of the code aren't buried in internal functions.
* Make process calls asynchronous. This is possible here because clang-include-fixer doesn't change files in place. This means input is no longer blocked while clang-include-fixer is running.
* Factor out logic in helper functions to keep functions short.
* Add comments where appropriate.
* Provide an alternative buffer replacement strategy for the case that a single line was inserted (the normal case in the case of clang-include-fixer). This keeps point, markers, and other buffer information intact.
* Use let-alist and association lists instead of property lists to shorten the code.
* Instead of highlighting only the first occurrence of a symbol, highlight all occurrences and move point to the closest one.
* Detect qualified names at point.
* Use filepos-to-bufferpos if available.
* Formatting.

Patch by Philipp Stephani!

llvm-svn: 283306
clang-tools-extra/docs/include-fixer.rst
clang-tools-extra/include-fixer/tool/clang-include-fixer-test.el [new file with mode: 0644]
clang-tools-extra/include-fixer/tool/clang-include-fixer.el