Closed heikkil closed 9 years ago
Hi heikkl. Thanks for the pull request.
I can see how the addition of extra words in any of the lists does not get updated automatically in the regexps. Good catch. I'll put it in the mode toggle for now like you have.
I don't quite see why we need two different lists of words. The default list (in the defcustom) can be modified by the user to append words. This would have the same effect that you are trying to achieve.
I realized with this PR that my defcustom portions were broken and in need of fixing by changing the type from 'list to '(repeat string). Am I missing something on why the addition of another variable for the words is necessary?
I guess the writegood-mode as it is now does not really need multiple lists. I just see it cleaner to separate the official word list from additional ones that user might want to add, perhaps temporarily.
Ideally, I'd like these kind of writing help tools to have several independently controlled levels of strictness in checking. For example, separating clear errors from strong suggestions and plain English recommendations. I was exploring ways to implement highlighting different word lists, when I ran into this list update problem.
heikkil,
Thanks again for this PR. I was able to incorporate your ideas into the code today. The dynamic behavior should fix the issues you were facing.
I did decide to keep the original lists. It seems cleaner in the customize interface and not too bad from code. A user could use
(add-to-list 'writegood-weasel-words "foo")
And modify the list.
I am a little confused. Weasel words are important to me. "magnitude" and other words like it give me the creeps. But when I add them to cusomize group: writegood weasel words, they get sent to .emacs custom but they do not appear marked in the text. Why? I got my copy from Elpa. I recently updated but custom has the word mismatch beside the saved phrase. And still no joy. What am I doing wrong? Thanks. PS, also tried the above lisp, which didn't work.
Debian Wheezy
paulgigas,
When you use the add-to-list method, You may need to require writegood-mode first.
(require 'writegood-mode)
(add-to-list writegood-weasel-words "magnitude")
As for setting through custom -- that method should work well. The clue is that the custom prompt says that you have a mismatch on the type you are saving. This code section was updated in the last half year to be correct and it seems it caught you in the middle.
Try this:
Also, feel free to open an issue if this does not fix your issues. Thanks for the feedback.
This patch makes it possible to modify the weasel word list and see them recognized in the text without reloading the package.
I've taken defvars writegood-weasels-font-lock-keywords-regexp and writegood-weasels-font-lock-keywords that are there only to process writegood-weasel-words list, and turned writegood-weasels-font-lock-keywords into a function that processes writegood-weasel-words and a new list writegood-more-weasel-words. The list writegood-more-weasel-words is initially empty, so user can maintain his/her own word collection.
The advantage of this is that if you want to add new weasel words, the original weasel word list need not to touched and it is easy to add new words in runtime. The performance hit caused by turning the list of weasel words into regular expression every time the mode is toggled seems to be negligible.
With these changes, it is possible to modify the user word list, e.g.
and toggle on writegood-mode, to see them highlighted in the text. The main weasel word list can be modified similarly.