bastibe/annotate.el

Annotate Mode breaks `comment-dwim`

Closed this issue · 7 comments

gopar commented

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
gopar commented

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
cage2 commented

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

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

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