bastibe / annotate.el

Annotate.el
Other
388 stars 20 forks source link

Prevented asking for annotation when trying to annotate a newline character #102

Closed cage2 closed 3 years ago

cage2 commented 3 years ago

Hi!!!

When an user try to annotate an newline (something is not possible to have because of the way the library is designed) the prompt asking for annotation text is shown anyway, even no annotation appears, i found this confusing at best.

I removed the prompt from popup in this case.

Fixes #100

Bye!! C.

bastibe commented 3 years ago

Looks good. It might be useful to flash a (message though, describing that you can't annotate newlines.

cage2 commented 3 years ago

On Sat, Apr 17, 2021 at 08:29:56AM -0700, Bastian Bechtold wrote:

Hi!

Looks good. It might be useful to flash a (message though, describing that you can't annotate newlines.

I agree is useful (and not too difficult too ;-)), and i am going to add a message in the PR i am preparing!

Bye! C.

cage2 commented 3 years ago

Hi!!

I tried to implement what @indigoviolet suggested in #100 , hope it works fine! :)

Bye! C.

cage2 commented 3 years ago

Hi everyone!

@indigoviolet thank for testing this patch you too!

I have changed the behaviour of the software that automatically switch to updating an existing annotation on the line that the user is annotating using the newline as "anchor". But this happens only if the annotation on the line is the only one present, in case there was more than a annotation instead of choosing in an arbitrary way which one gets updated i preferred to owerwrite the whole line instead.

Regarding the error message annotate-use-messages i intended it as a variable to switch off and on only informative messages not errors.

Bye and thank you again!! C.

bastibe commented 3 years ago

If I had a line like this:

this is an [annotated] line

with [] being annotated, there are now three behaviors:

I feel the last one is weird, since it does not change an annotation under point, as the other ones do.

I have a feeling that annotating end-of-line should only change whole-line annotations, not any annotation on the line.

What do you think?

cage2 commented 3 years ago

If I had a line like this:

this is an [annotated] line

with [] being annotated, there are now three behaviors:

* point on `[annotated]` changes the annotation

* point on any other word adds an annotation to that word

* point at EOL changes `[annotated]`?

Yes, this is the behaviour i tried to code :-)

I feel the last one is weird, since it does not change an annotation under point, as the other ones do.

I have a feeling that annotating end-of-line should only change whole-line annotations, not any annotation on the line.

What do you think?

In principle I liked the idea to update the annotation on the line if it i was the only one on the line, then i tried to do as you suggested and i feel more intuitive this behaviour of the command! :)

So this is the way annotation newline works at the moment (pasted from new documentation ;-)):


;; if  the line  contains no  text before  the newline
;; annotate the next line with text, if any
;;
;; if the line contains a single annotation that spans
;; the whole line update the existing annotation
;;
;; if  the line  contains no  annotation [or more than one annotation, this is missing from the documentation :-(] 
;; annotate  the
;; whole line that terminate at `eol'

If

I hope i get your suggestion right :)

Bye! C.

bastibe commented 3 years ago

Looks good to me! Great work as always!

cage2 commented 3 years ago

Hi @bastibe !

Very well! I have changed the documentation and the NEWS and Changelog files, as usual. I have marked this version as 1.2.0, as there is a new feature, not mere bugfix, i hope is OK. :)

Also, given problems we had in the past i checked bytecode compilation, and gives no warning fortunately! :)

I propose waiting some more hours if @indigoviolet has considerations to write and then merging!

Bye!! C.

indigoviolet commented 3 years ago

@cage2 - just had one comment: https://github.com/bastibe/annotate.el/issues/104#issuecomment-827805461