emacs-sentence-navigation icon indicating copy to clipboard operation
emacs-sentence-navigation copied to clipboard

status of this library, adding complex rules

Open mooseyboots opened this issue 2 years ago • 2 comments

hi noctuid, is this library still alive?

it works for me (on 28.1), despite the other issue saying its broken.

i have been starting to port some break/non-break rules from OmegaT and the Okapi Framework into elisp: https://codeberg.org/martianh/segment, for use in some basic translation functionality in Emacs. One of the benefits of using such rules is that there are sets for different languages. Another one is that each rule has two regexes, one looking backward and one looking foward, which makes it possible to break when a given abbreviation ends a sentence, and not break when it doesn't.

I'm wondering whether I should work on making them (particularly the after break regexes) work with this library or if its better to start over from scratch.

mooseyboots avatar May 20 '22 10:05 mooseyboots

It's not so much dead as on indefinite hiatus. I am not really using it. I two-space my own notes now but still plain to eventually work on this packages because I have to deal with other people's text. However, I don't plain to work on it further until I've finished my own text object/motion generation system, which lower priority for me at the moment until I finish some other packages.

IIRC, sentence-nav was broken because a dependency package (ample-regexps) had stopped working, but that may no longer be the case.

If you still find the package useful, I'm willing to review/merge PRs. I can look at yours when I get a chance.

one looking backward and one looking foward

Yes, that's definitely the way to do it.

I'm wondering whether I should work on making them (particularly the after break regexes) work with this library or if its better to start over from scratch.

I'm not sure. I will have to look at your package. I think for the eventual future, the best thing will probably to have all regexps/rules in a separate package like yours (I imagine they can be useful for more than just motions, e.g. they could be used to get a more accurate sentence count). sentence-nav would then have your package as a dependency and implement the small amount of code needed for things.el to automatically generate the following:

  • forward sentence beginning
  • forward sentence end
  • backward sentence beginning
  • backward sentence end
  • forward/backwad sentence beginning/end past any starting characters (e.g. quotes and punctuation)
  • mark/expand sentence selection
  • remotely select or act on a sentence with avy
  • etc.

Even without things.el ready, we could potentially change emacs-sentence-navigation to depend on your segment package if you think that would be a good idea. Or you could write your own version for now, if you think that would be simpler.

noctuid avatar May 20 '22 13:05 noctuid

Thanks for your detailed reply.

It turned out that cooking up forward-/backward-sentence functions with my regex set wasn't too hard.

My approach is slightly different in that I'm interested in just modifying the existing forward-/backward-sentence functions, in terms of where they leave point, so that the modified versions would be as compatible as possible with other existing uses of the vanilla versions.

I'm also interested in compatibility with various languages (I want to use the complex rules for translation -- like you say, I don't get to choose if my texts have double spaces or not, I didn't write them), whereas sentence-nav only adds English rules.

After manually writing out the English set of rules as elisp regexes, I thought to try to create conversion functions for the ICU rules. I'm a little (a lot) out of my depth there tho.

I'm actually a novice with this sort of thing, so if you ever end up taking a look and having any suggestions I'd be all ears. You would defs want to do so before relying/depending on what I have cooked up.

mooseyboots avatar May 21 '22 09:05 mooseyboots