astoff/jit-spell

Adding downcased words to the dictionary and removing words

Closed this issue · 4 comments

I think it will be nice to have the ability to send the downcased word to the dictionary. Aspell can do it with &WORD so maybe & can be used in addition to @ to accept the word. This is maybe slightly inconsistent with aspell where the pairs is * and & but I don't think users need to know about aspell commands so it is fine.

It also makes sense to be able to remove a word from the personal dictionary since sometimes I do make further mistakes while correcting the previous ones. I don't see an aspell command for that in the info manual, but the format of the dictionary is really simple so this is just deleting a line and decrementing a number but I don't know if/how to reflect that deletion in the apelll process being used in jit-spell.

To make the word lowercase, singular, or whatever, you can just type arbitrary text after the @. What you are asking for specifically would mean @ TAB M-- M-l, which admittedly is a bit of a mouthful, but it's generic.

To remove words, I guess you have to edit your dictionary. There's no way ATM to make it be reflected by jit-spell, other than killing the aspell process. It should then be restarted automatically.

To make the word lowercase, singular, or whatever, you can just type arbitrary text after the @. What you are asking for specifically would mean @ TAB M-- M-l, which admittedly is a bit of a mouthful, but it's generic.

Thanks! This works but I think it makes sense to provide the option of lower case version of a word if the word is upper case, for the case when word is capitalized not because it is a proper noun but because it is the at the start of a sentence. I think changing completing-read candidates to,

(append (overlay-get ov 'jit-spell-corrections)
        (list (concat "@" word)
              (concat "@" (downcase word))))

should do it, since duplicates are removed (at least for me but I haven't check the documentation).

To remove words, I guess you have to edit your dictionary. There's no way ATM to make it be reflected by jit-spell, other than killing the aspell process. It should then be restarted automatically.

This also works so thanks! Will you accept a pull request for adding such a function? I should sign the paperwork but I am pretty sure that this will be under the 15 lines limit so that is not an urgent concern.

Will you accept a pull request for adding such a function?

PRs are welcome, but note that you need to take care of pending requests if you kill the subprocess. This might or might not fit in 15 lines :-).

PRs are welcome, but note that you need to take care of pending requests if you kill the subprocess. This might or might not fit in 15 lines :-).

They only way I can think of to handle pending requests is to call jit-lock-refontify for each of the corresponding buffers. Since removing the word might cause misspellings to appear on those buffers to, refontifcation seems like the only way of covering that possibility. That might fit in 15 lines (with a little golfing :)) but I think what will definitely take it above 15 is handling the case of session and buffer local word. I don't use those so I haven't looked at that yet.

I will fill out the paperwork and then look at that. I am not employed to code which apparently makes the paperwork easier.

It will likely still be a small number of weeks. I don't know if you want to close this issue meanwhile or keep it open. Both are fine for me.