noctuid / emacs-sentence-navigation

(Broken) Better Sentence Movement Commands and Evil Text Objects
GNU General Public License v3.0
29 stars 3 forks source link

Doesn't quite work with comments? #5

Closed blaenk closed 6 years ago

blaenk commented 7 years ago

I'm not positive on this, but I was trying out this package and noticed that evil's sentence backward motion did work while none from this package didn't in the following situation.

emacs: try sentence-navigation package

# Please enter the commit message for your changes. |Lines starting
# with '#' will be ignored, and an empty message aborts the commit.
#
# On branch master
# Your branch is ahead of 'origin/master' by 4 commits.
#   (use "git push" to publish your local commits)
#
# Changes to be committed:
#   modified:   emacs/.emacs.d/inits/conf/evil.el
#

Where | denotes the cursor (the second sentence in the commit instructions comment), it's not posible to jump back to the beginning of the first sentence. A cursory skim of the readme leads me to believe that it's because the beginning of a sentence is detected by a capital letter at the beginning of a line:

By default, this package assumes that a capital letter at the beginning of the line starts a sentence.

I did try enabling hard wrapping but of course that requires modification of the alist as well.

I was just wondering if I'm doing it the wrong way.

noctuid commented 7 years ago

The regex includes whitespace and comment chars, so I'll have to look into why it isn't working.

noctuid commented 6 years ago

I had forgotten that some major modes don't add comment characters to their syntax table. For text mode, I guess it makes sense (since there is no "official" comment character). If you alter the syntax table (e.g. (modify-syntax-entry ?# "<" text-mode-syntax-table)), things should work as expected.