Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for rcirc #2

Open
phikal opened this issue Mar 8, 2023 · 8 comments
Open

Support for rcirc #2

phikal opened this issue Mar 8, 2023 · 8 comments

Comments

@phikal
Copy link

phikal commented Mar 8, 2023

What do you think would be the best way to support rcirc? All we need is actually spell checking after the prompt, since I am neither interested in indications that nicks are not real words or that the messages someone else wrote (but for the sake of simplicity all messages) might have typos.

I tried something like this,

(setq-local ispell-skip-region-alist
	    (cons '("\\(?:.*$\\)*")
		  ispell-skip-region-alist))

but it appears to have had no effect.

@astoff
Copy link
Owner

astoff commented Mar 8, 2023

Right, I use ispell.el to start the ispell process and that's it.

Supporting rcirc should be doable by doing (add-function :filter-return (local 'jit-spell--filter-region) something), where something receives a list of conses (start . end) and return another such list. You just want to intersect that with the prompt region.

Now, how could we do that in a way that rcirc (which is too specific) doesn't need to know about jit-spell (even more specific) and vice-versa? Is it by any chance a comint-derived mode?

@phikal
Copy link
Author

phikal commented Mar 8, 2023

I would like to have ricrc work OOTB for all users, not just for me so the advice isn't the right approach for me.

Now, how could we do that in a way that rcirc (which is too specific) doesn't need to know about jit-spell (even more specific) and vice-versa?

Is there a reason why jit-spell doesn't use ispell-skip-region-alist or some other option like that?

Is it by any chance a comint-derived mode?

No, most rcirc buffer don't even have an associated process. Also, I don't think it would make sense for most comint derived modes to have spell checking (or at least I wouldn't know why -- you are usually writing non-prose).

@astoff
Copy link
Owner

astoff commented Mar 8, 2023

I would like to have ricrc work OOTB for all users, not just for me so the advice isn't the right approach for me.

Yes, sorry, I meant to say what has to be done, either by you or me, for everybody else's profit :-).

Also, I don't think it would make sense for most comint derived modes to have spell checking (or at least I wouldn't know why -- you are usually writing non-prose).

Might be, but I come back to my question, what could I do in this package that is reasonably generic and doesn't involve special-casing rcirc?

@phikal
Copy link
Author

phikal commented Mar 8, 2023

Might be, but I come back to my question, what could I do in this package that is reasonably generic and doesn't involve special-casing rcirc?

If rcirc and jit-spell both add support for ispell-skip-region-alist, then to that would seem to be a solution, or am I missing something obvious?

@astoff
Copy link
Owner

astoff commented Mar 8, 2023

If both add support then yes, but I can't quite see how to use ispell-skip-region-alist effectively. This API seems too focused on a command that will iteratively skip from word to word. In fact I don't quite understand the docstring. There's some procedure of how to use these regexps that is not explained there AFAICS.

If you could set a flyspell-generic-check-word-predicate, then jit-spell would work out of the box.

@minad
Copy link

minad commented Mar 10, 2023

If rcirc and jit-spell both add support for ispell-skip-region-alist, then to that would seem to be a solution, or am I missing something obvious?

FWIW, I would like to have some regexp-based mechanism to exclude certain text. For example in Elisp files I get a lot of false positives on comments like autoloads, the package header or dashed symbol names.

@astoff
Copy link
Owner

astoff commented Mar 10, 2023

I think there's no way I could reasonable handle a list of excluded regexps. It really has to be a hook called with the start and end of the word in question, and you decide which excursion you need to do in order to figure things out. (“You” here refers to the major mode author, probably).

Jit-spell has the function var jit-spell--default-ignored-p that you can add things to. It's probably over-engineered, I accept that. I will change it to a hook, I guess, but ideally this would be some API in Emacs itself. I sent you guys a sketch of how I think this could look like.

@aikrahguzar
Copy link
Contributor

I think there's no way I could reasonable handle a list of excluded regexps.

This will probably make #9 worse (although I am not affected by it myself) but I think one way to do so is to add jit-spelled-ignored to font-lock-extra-managed-props and then use font-lock-add-keywords to add it to the text matching regexps. It would be nice to be able drown out the noise of cookies and similar stuff in elisp.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants