secelis/hideshow-org — Issue #3: Different way to detect if TAB changed indentation
Author: eeeickythump
Created: 2012-02-23 23:38:27+00:00
State: open

At present hideshow-org decides whether TAB changed indentation by looking at whether the point has changed. There are several situations where this does not work too well. For example, if TAB is pressed while point is in some whitespace at the beginning of the line, and point happens to be exactly where the first non-whitespace char will end up after indentation, then the point will not move. This will result in both indentation and folding occurring.

Instead of looking at whether the point changes, why not look at the value returned by (buffer-modified-tick)? This is a number that increments every time a buffer is altered. Just store the number, call the TAB command, then see if the new number has increased, indicating that indentation has occurred.