-
Notifications
You must be signed in to change notification settings - Fork 311
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
Check yas--original-auto-fill-function before using it #873
Conversation
Can you explain how to reproduce the problem? I think the real bug is that |
I can't. I can't reproduce it when starting with emacs -Q and my configuration is not simple. |
Even if you can't reproduce with |
I just reproduced it but I don't know how. Here is the backtrace:
|
Hmm, I don't think space is supposed to perform self-insert-command in a query replace buffer. Can you check the current buffer in those stack frames (move point to a line in the backtrace, then e (defvar query-replace-map
(let ((map (make-sparse-keymap)))
(define-key map " " 'act)
[...] |
@chep Are you using Emacs 26? Based on the properly escaped NUL bytes in your backtrace I guess you are. (when nil ; don't use this
(add-variable-watcher
'yas--original-auto-fill-function
(lambda (sym newval op where)
(when (and (null newval) (eq auto-fill-function 'yas--auto-fill))
(debug nil "yas--original-auto-fill-function unexpectedly nil!"))))
) |
I'm using emacs 27 (master branch). The watcher is now in my .emacs file... |
* yasnippet.el (yas--watch-autofill): New variable watcher to catch the problem. (yas--auto-fill): If `yas--original-auto-fill-function' is nil, print a warning with some info instead of signaling an error.
I've now (conditionally) added the watcher to yasnippet, so you can remove it from your .emacs after updating #920. |
I got following error today. Noticed yasnippet is updated, and I upgrade it. I have not changed yasnippet config recently.
|
* yasnippet.el (yas--watch-auto-fill): New variable watcher to catch the problem. (yas--auto-fill): If `yas--original-auto-fill-function' is nil, print a warning with some info instead of signaling an error.
Managed to trigger it with Magit:
|
Ah, I should have tested out my debug code more thoroughly, the |
As mentioned in #919 (comment), nobody seems to be hitting this anymore, so I'm going to close. |
Instead of using `setq` and storing the old value in `yas--original-auto-fill-function`, use `add-function`. This makes it virtually impossible for a bug like #873/#919 to appear. Remove the left-over debug code we had added to try and track down #873/#919. This requires bumping the dependency on Emacs≥24.4. (yas--original-auto-fill-function, yas--watch-auto-fill-backtrace): Delete variables. (yas--watch-auto-fill): Delete function. Don't add it to variable watchers. (yas--auto-fill-wrapper): Use `add-function`. (yas-minor-mode): Use `remove-function`. (yas--auto-fill): Adjust its calling convention for use with `:around` in `add-function`. Remove left-over debug code. (yas--post-command-handler): Remove left-over debug code.
Sometimes when using tramp, I've got an error (Symbol's function definition is
void: nil) because the variable yas--original-auto-fill-function is not
initialized.
A simple check of the value solved my problem.