bastibe / annotate.el

Annotate.el
Other
388 stars 20 forks source link

Annotate Mode breaks `comment-dwim` #86

Closed gopar closed 3 years ago

gopar commented 3 years ago

When selecting a region (only works with selecting one line) in emacs and calling comment-dwim, an error happens in which the selected region is not commented out and ends up getting indented instead.

When annotate mode is off, problem doesn't happen

The following stacktrace is an example of the error I get

Debugger entered--Lisp error: (args-out-of-range 511 512)
  remove-text-properties(511 512 (display nil))
  (save-excursion (goto-char end) (end-of-line) (remove-text-properties (point) (1+ (point)) '(display nil)))
  (let ((saved-undo-list (copy-tree buffer-undo-list t))) (buffer-disable-undo) (save-excursion (goto-char end) (end-of-line) (remove-text-properties (point) (1+ (point)) '(display nil))) (setq buffer-undo-list saved-undo-list) (buffer-enable-undo))
  (progn (setq inhibit-modification-hooks t) (let ((saved-undo-list (copy-tree buffer-undo-list t))) (buffer-disable-undo) (save-excursion (goto-char end) (end-of-line) (remove-text-properties (point) (1+ (point)) '(display nil))) (setq buffer-undo-list saved-undo-list) (buffer-enable-undo)))
  (unwind-protect (progn (setq inhibit-modification-hooks t) (let ((saved-undo-list (copy-tree buffer-undo-list t))) (buffer-disable-undo) (save-excursion (goto-char end) (end-of-line) (remove-text-properties (point) (1+ (point)) '(display nil))) (setq buffer-undo-list saved-undo-list) (buffer-enable-undo))) (setq inhibit-modification-hooks g1))
  (let ((g1 inhibit-modification-hooks)) (unwind-protect (progn (setq inhibit-modification-hooks t) (let ((saved-undo-list (copy-tree buffer-undo-list t))) (buffer-disable-undo) (save-excursion (goto-char end) (end-of-line) (remove-text-properties (point) (1+ (point)) '(display nil))) (setq buffer-undo-list saved-undo-list) (buffer-enable-undo))) (setq inhibit-modification-hooks g1)))
  (progn (let ((g1 inhibit-modification-hooks)) (unwind-protect (progn (setq inhibit-modification-hooks t) (let ((saved-undo-list (copy-tree buffer-undo-list t))) (buffer-disable-undo) (save-excursion (goto-char end) (end-of-line) (remove-text-properties (point) (1+ ...) '...)) (setq buffer-undo-list saved-undo-list) (buffer-enable-undo))) (setq inhibit-modification-hooks g1))))
  (if (> (buffer-size) 0) (progn (let ((g1 inhibit-modification-hooks)) (unwind-protect (progn (setq inhibit-modification-hooks t) (let ((saved-undo-list ...)) (buffer-disable-undo) (save-excursion (goto-char end) (end-of-line) (remove-text-properties ... ... ...)) (setq buffer-undo-list saved-undo-list) (buffer-enable-undo))) (setq inhibit-modification-hooks g1)))))
  annotate--remove-annotation-property(485 487)
  comment-region-internal(477 509 "# " nil nil nil nil nil t)
  comment-region-default-1(477 509 nil)
  #f(compiled-function () #<bytecode 0x1e0c275db6f9>)()
  combine-change-calls-1(477 509 #f(compiled-function () #<bytecode 0x1e0c275db6f9>))
  comment-region-default(477 509 nil)
  comment-region(477 509 nil)
  comment-or-uncomment-region(477 509 nil)
  comment-dwim(nil)
  funcall-interactively(comment-dwim nil)
  call-interactively(comment-dwim nil nil)
  command-execute(comment-dwim)
cage2 commented 3 years ago

Hi gopar!

You are a good bug hunter! :)

When selecting a region (only works with selecting one line) in emacs and calling comment-dwim, an error happens in which the selected region is not commented out and ends up getting indented instead.

When annotate mode is off, problem doesn't happen

This an interesting problem but i can not reproduce the bug. May you share a minimal file and necessary steps to allow me to fire the debugger on my machine?

Also, because you never can tell: which version of emacs are you using?

Bye! C.

gopar commented 3 years ago

I can't seem to reproduce with minimal config. Looks like it must be something within my config that is breaking it.

I'll do more debugging to see if its b/c of my config. if it is, i'll close ticket.

cage2 commented 3 years ago

Hi gopar!

I can't seem to reproduce with minimal config. Looks like it must be something within my config that is breaking it.

I'll do more debugging to see if its b/c of my config. if it is, i'll close ticket.

Thank you very much for keep trying! If you are going to find something new feel free to drop a message, of course! :)

Bye! C.

cage2 commented 3 years ago

Hi @gopar!

I am inclined to think that the patch in #106 could fix this issue; may i ask to make a quick check?

Thanks in advance! C.

gopar commented 3 years ago

Hey @cage2 , i'm currently not using the package (can't remember why I decided on that). So I won't be able to test. Sorry :( I plan on re-adding this package at some pint but trimming down my config first.

cage2 commented 3 years ago

On Fri, Apr 30, 2021 at 09:08:41AM -0700, Daniel Gopar wrote:

Hey @cage2 ,

Hi!!

i'm currently not using the package (can't remember why I decided on that). So I won't be able to test. Sorry :(

No problem at all! :)

I plan on re-adding this package at some pint but trimming down my config first.

Very well, hopefully the issue you reported will be gone away next time you will start this package! :))

Bye! C.

bastibe commented 3 years ago

I'll close this issue for now. Please reopen if the bug persists.