mirror of
https://github.com/joaotavora/yasnippet.git
synced 2025-10-13 21:13:04 +00:00
Optionally add undo list to debug info
* yasnippet-debug.el (yas-debug-undo): New variable. (yas-toggle-debug-undo): New command. (yas-debug-snippets): Print undo list if `yas-debug-undo' is non-nil.
This commit is contained in:
parent
7b03ac2030
commit
b0e729b1de
@ -192,6 +192,12 @@
|
|||||||
|
|
||||||
(defvar yas-debug-target-buffer nil)
|
(defvar yas-debug-target-buffer nil)
|
||||||
(defvar-local yas-debug-target-snippets nil)
|
(defvar-local yas-debug-target-snippets nil)
|
||||||
|
(defvar yas-debug-undo nil)
|
||||||
|
|
||||||
|
(defun yas-toggle-debug-undo (value)
|
||||||
|
(interactive (list (not yas-debug-undo)))
|
||||||
|
(setq yas-debug-undo value)
|
||||||
|
(yas--message 3 "debug undo %sabled" (if yas-debug-undo "en" "dis")))
|
||||||
|
|
||||||
(defadvice yas--snippet-parse-create (before yas-debug-target-snippet (snippet))
|
(defadvice yas--snippet-parse-create (before yas-debug-target-snippet (snippet))
|
||||||
(add-to-list 'yas-debug-target-snippets snippet))
|
(add-to-list 'yas-debug-target-snippets snippet))
|
||||||
@ -223,7 +229,11 @@
|
|||||||
(unless (memq loc yas-debug-recently-live-indicators)
|
(unless (memq loc yas-debug-recently-live-indicators)
|
||||||
(delete-overlay (cdr color-ov))
|
(delete-overlay (cdr color-ov))
|
||||||
(remhash loc yas-debug-live-indicators)))
|
(remhash loc yas-debug-live-indicators)))
|
||||||
yas-debug-live-indicators)))
|
yas-debug-live-indicators))
|
||||||
|
(when (and yas-debug-undo (listp buffer-undo-list))
|
||||||
|
(printf "Undo list has %s elements:\n" (length buffer-undo-list))
|
||||||
|
(cl-loop for undo-elem in buffer-undo-list
|
||||||
|
do (printf "%S\n" undo-elem))))
|
||||||
(when hook
|
(when hook
|
||||||
(setq yas-debug-target-buffer (current-buffer))
|
(setq yas-debug-target-buffer (current-buffer))
|
||||||
(ad-enable-advice 'yas--snippet-parse-create 'before 'yas-debug-target-snippet)
|
(ad-enable-advice 'yas--snippet-parse-create 'before 'yas-debug-target-snippet)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user