[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] master ae95810 43/51: ; Try to get more info about 873/919
From: |
Noam Postavsky |
Subject: |
[elpa] master ae95810 43/51: ; Try to get more info about 873/919 |
Date: |
Sun, 13 May 2018 13:11:46 -0400 (EDT) |
branch: master
commit ae9581028942dd0237a007fdc0a49a76ef8c3e11
Author: Noam Postavsky <address@hidden>
Commit: Noam Postavsky <address@hidden>
; Try to get more info about 873/919
* 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.
---
yasnippet.el | 42 +++++++++++++++++++++++++++++++++++++++++-
1 file changed, 41 insertions(+), 1 deletion(-)
diff --git a/yasnippet.el b/yasnippet.el
index b36c422..bfce53c 100644
--- a/yasnippet.el
+++ b/yasnippet.el
@@ -582,6 +582,15 @@ override bindings from other packages (e.g.,
`company-mode')."
"The original value of `auto-fill-function'.")
(make-variable-buffer-local 'yas--original-auto-fill-function)
+(defun yas--watch-auto-fill (_sym newval _op _where)
+ (when (and (null newval) (eq auto-fill-function 'yas--auto-fill))
+ (debug nil "`yas--original-auto-fill-function' unexpectedly nil! Please
report this backtrace (hit `c' to continue)")) )
+
+;; Try to get more info on #873/919 (this only works for Emacs 26+).
+(when (fboundp 'add-variable-watcher)
+ (add-variable-watcher 'yas--original-auto-fill-function
+ #'yas--watch-auto-fill))
+
(defun yas--snippet-next-id ()
(let ((id yas--snippet-id-seed))
(cl-incf yas--snippet-id-seed)
@@ -3683,7 +3692,38 @@ field start. This hook does nothing if an undo is in
progress."
reoverlays))
(goto-char orig-point)
(let ((yas--inhibit-overlay-hooks t))
- (funcall yas--original-auto-fill-function))
+ (if (null yas--original-auto-fill-function)
+ ;; Try to get more info on #873/919.
+ (let ((yas--fill-fun-values `((t ,(default-value
'yas--original-auto-fill-function))))
+ (fill-fun-values `((t ,(default-value 'auto-fill-function))))
+ ;; Listing 2 buffers with the same value is enough
+ (print-length 3))
+ (save-current-buffer
+ (dolist (buf (let ((bufs (buffer-list)))
+ ;; List the current buffer first.
+ (setq bufs (cons (current-buffer)
+ (remq (current-buffer) bufs)))))
+ (set-buffer buf)
+ (let* ((yf-cell (assq yas--original-auto-fill-function
+ yas--fill-fun-values))
+ (af-cell (assq auto-fill-function fill-fun-values)))
+ (when (local-variable-p 'yas--original-auto-fill-function)
+ (if yf-cell (setcdr yf-cell (cons buf (cdr yf-cell)))
+ (push (list yas--original-auto-fill-function buf)
yas--fill-fun-values)))
+ (when (local-variable-p 'auto-fill-function)
+ (if af-cell (setcdr af-cell (cons buf (cdr af-cell)))
+ (push (list auto-fill-function buf) fill-fun-values))))))
+ (lwarn '(yasnippet auto-fill bug) :error
+ "`yas--original-auto-fill-function' unexpectedly nil
in %S! Disabling auto-fill.
+ %S
+ `auto-fill-function': %S"
+ (current-buffer) yas--fill-fun-values fill-fun-values)
+ ;; Try to avoid repeated triggering of this bug.
+ (auto-fill-mode -1)
+ ;; Don't pop up more than once in a session (still log
though).
+ (defvar warning-suppress-types) ; `warnings' is autoloaded by
`lwarn'.
+ (add-to-list 'warning-suppress-types '(yasnippet auto-fill
bug)))
+ (funcall yas--original-auto-fill-function)))
(save-excursion
(setq end (progn (forward-paragraph) (point)))
(setq beg (progn (backward-paragraph) (point))))
- [elpa] master ff26e3b 19/51: Close #824: Simple fields can be parented like other fields or mirrors, (continued)
- [elpa] master ff26e3b 19/51: Close #824: Simple fields can be parented like other fields or mirrors, Noam Postavsky, 2018/05/13
- [elpa] master ff8e833 23/51: ; yasnippet-debug.el: Fix deprecation warning., Noam Postavsky, 2018/05/13
- [elpa] master a0d2cff 44/51: ; Don't enter debugger for kill-all-local-variables case, Noam Postavsky, 2018/05/13
- [elpa] master 5170f05 42/51: Don't indent first and only line of expanded snippet, Noam Postavsky, 2018/05/13
- [elpa] master 5a29fe6 50/51: Release 0.13.0, Noam Postavsky, 2018/05/13
- [elpa] master 8b421bc 20/51: Reinstate the old debug behaviour for yas-tryout-snippet, Noam Postavsky, 2018/05/13
- [elpa] master 074d670 26/51: Add yasnippet-unload-function, Noam Postavsky, 2018/05/13
- [elpa] master d364425 38/51: * yasnippet.el (yas-field-value): Fix docstring., Noam Postavsky, 2018/05/13
- [elpa] master 05ac1da 31/51: ; yasnippet-tests.el (yas-no-memory-of-bad-snippet): Fix docstring., Noam Postavsky, 2018/05/13
- [elpa] master 3032337 37/51: Improve rendering of docstrings in manual's reference section, Noam Postavsky, 2018/05/13
- [elpa] master ae95810 43/51: ; Try to get more info about 873/919,
Noam Postavsky <=
- [elpa] master 15761e8 41/51: Adjust previous fix, Noam Postavsky, 2018/05/13
- [elpa] master 0afc638 35/51: Fix docs for new org mode, Noam Postavsky, 2018/05/13
- [elpa] master 1668607 46/51: Don't add to disabled undo list, Noam Postavsky, 2018/05/13
- [elpa] master f9231b0 47/51: Work around Emacs Bug#30931 (Misc_Free in undo list), Noam Postavsky, 2018/05/13
- [elpa] master 4755aa9 49/51: Clarify behavior of mirror transforms, Noam Postavsky, 2018/05/13
- [elpa] master e261832 36/51: Add some styling to doc, improve top menu, Noam Postavsky, 2018/05/13
- [elpa] master 58b88d8 39/51: Merge: doc style improvements, Noam Postavsky, 2018/05/13
- [elpa] master e64297e 51/51: * packages/yasnippet: Merge version 0.13.0 from upstream., Noam Postavsky, 2018/05/13