Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error running timer ‘aggressive-indent--indent-if-changed’: (error "Selecting deleted buffer") #137

Closed
tsdh opened this issue Apr 23, 2020 · 6 comments

Comments

@tsdh
Copy link
Contributor

tsdh commented Apr 23, 2020

Since the update to the latest MELPA version 20200421.1149, I frequently get the error in the subject. I think the problem is that you use with-current-buffer and inside that, you then check if the buffer is live. I guess you need to do it the other way round. The following version works for me:

(defun aggressive-indent--indent-if-changed (buffer)
  "Indent any region that changed in BUFFER in the last command loop."
  (if (not (buffer-live-p buffer))
      (and aggressive-indent--idle-timer
           (cancel-timer aggressive-indent--idle-timer))
    (with-current-buffer buffer
      (when (and aggressive-indent-mode aggressive-indent--changed-list)
        (save-excursion
          (save-selected-window
            (aggressive-indent--while-no-input
              (aggressive-indent--proccess-changed-list-and-indent))))
        (when (timerp aggressive-indent--idle-timer)
          (cancel-timer aggressive-indent--idle-timer))))))
@rprimus
Copy link

rprimus commented Apr 23, 2020

Thu Apr 23 13:39:50 BST 2020

Further to the above, this error continuously shows up in the minibuffer - making it effectively useless.

Just wondering why turning off aggressive-indent-mode has no effect on the generation of the error?

(With AIM off, both aggressive-indent-mode and aggressive-indent--changed-list are nil.)

@tsdh
Copy link
Contributor Author

tsdh commented Apr 29, 2020

@rprimus The error stays because the code trying to select a deleted buffer (which causes the error) is run from a timer and fails to cancel the timer for exactly that reason.

@Malabarba
Copy link
Owner

Odd that I didn't get that at all.
Anyway, I agree with the fix and pushed a change. Sorry for the trouble, Tassilo.

@mkaschenko
Copy link

mkaschenko commented May 12, 2020

@Malabarba This error appears to me when I close buffers within *Ibuffer* window, for example.

@chasecaleb
Copy link

I hate to be the bearer of bad news... but this is still broken as of current master (12a64b4e5c1a1e124baa74336738b6ae1972607f)

Here's a backtrace. I omitted some of it due to being extremely long plus containing some personal info, e.g. buffer names, but it should be useful still:

Debugger entered--Lisp error: (wrong-type-argument timerp nil)
  signal(wrong-type-argument (timerp nil))
  cancel-timer(nil)
  aggressive-indent--indent-if-changed(#<killed buffer>)
  apply(aggressive-indent--indent-if-changed #<killed buffer>)
  timer-event-handler([t 0 0 50000 t aggressive-indent--indent-if-changed (#<killed buffer>) idle 0])
  read-from-minibuffer(...<omitted>...)
  <...omitted...>

@tsdh
Copy link
Contributor Author

tsdh commented May 13, 2020

@chasecaleb @Malabarba
That's why I've had

(and aggressive-indent--idle-timer
     (cancel-timer aggressive-indent--idle-timer)

in my fix. :-)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants