aggressive-fill-paragraph-mode
aggressive-fill-paragraph-mode copied to clipboard
Support more word-processor-like fill behavior
I discovered aggressive-fill-mode recently and was delighted to find it existed - I've wished it was around for years.
I have some prototypical work in my .emacs.d that lets you fill even more aggressively:
- fill after all self-inserts
- fill after deletes/yanks, by advising whatever functions the user configures.
With these two changes, writing plain text files and source code comments feels a lot like working in a word processor - text almost always flows naturally.
Is this line of work something you'd be interested in merging?
If so, what changes would you want to see to it?
(also, my apologies for any bogus notifications you received - my keyboard betrayed me, and I initially opened this as a content-free issue named 'w'.)
Hi, yeah that sounds useful.
Ideally entire functionality would be able to be enabled/disabled by a single custom variable so that users can just do something like
(setq afp-super-aggressive t)
to enable it, or
(add-hook 'text-mode-hook (lambda () (setq-local afp-super-agressive t)))
to enable it for individual modes. Could probably do this by adding (when afp-super-agressive ...)
to the advising function, and maybe set up the advice when the mode is enabled. We should probably keep the variable to allow people to easily add/remove the advice on their own functions as well though.
Could you also add some tests? Are you familiar with ecukes at all? If not you can probably copy most of what you need from the text-mode.feature file.
Okay, cool, thanks for the feedback. afp-super-aggressive
sounds like a good idea and I'll try to find time to make that happen.
I have not used ecukes before, but I've done plenty of automated tests in other languages, so I should be able to figure it out just fine.
Any news on this?
Hey, sorry - this has been hanging out there for a long time. I've occasionally thought "I should update that issue", but with two small kids and a longer commute than I had at the time, my time for Emacs has really sloped off and I just didn't get around to it.
I've continued to tinker with this on and off in my emacs config, but I haven't submitted a PR because I'm not yet satisfied with the experience as it stands.
You can see some of my complaints in my todo.txt. Just search for 'aggressive'.
There are also probably some undocumented annoyances.
That said, if someone wants to pull down my changes and try to take them further, I'd be completely fine with that.
BTW this feature is likely to exacerbate some imperfections in aggressive-fill-paragraph:
- The design of the hook function means it probably isn't very efficient (I was new to elisp) so running it after every command might cause performance issues.
- Running the hook function after every command will make having really good autofill suppression checking functions essential, but at the moment they could do with some work (I often end up doing quoted inserts of spaces).
Not saying that it's a bad idea, just that it's probably work than might be expected to get it working well.
@davidshepherd7
So far, point 1 hasn't been an issue for me.
Point 2, needing really good autofill suppression checkers, is a huge part of why I haven't submitted a PR yet. My current work is pretty nice day-to-day in some languages and contexts, but I often find myself turning the mode off to work in spots where I know it's going to do things I didn't want.
That last sentence is a perfect summary of my experience.