[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] master 8b421bc 20/51: Reinstate the old debug behaviour for yas-t
From: |
Noam Postavsky |
Subject: |
[elpa] master 8b421bc 20/51: Reinstate the old debug behaviour for yas-tryout-snippet |
Date: |
Sun, 13 May 2018 13:11:42 -0400 (EDT) |
branch: master
commit 8b421bc78d56263a2adc128337540e50a1c19c6a
Author: João Távora <address@hidden>
Commit: João Távora <address@hidden>
Reinstate the old debug behaviour for yas-tryout-snippet
During a redesign of the debug facilities, the old shortcut C-u C-t
available and useful in snippet-mode, was lost.
* yasnippet-debug.el (yas-debug-snippets): Add docstring.
Add post-command-hook locally if HOOK is snippet-navigation.
Concisely describe parent field (not just mention it).
* yasnippet.el (yas-tryout-snippet): Call yas-debug-snippets and display
buffer. Tweak docstring.
(yas-debug-snippets): Forward declare function defined in
yasnippet-debug.el
---
yasnippet-debug.el | 19 ++++++++++++++++---
yasnippet.el | 11 +++++++----
2 files changed, 23 insertions(+), 7 deletions(-)
diff --git a/yasnippet-debug.el b/yasnippet-debug.el
index c3d1c7e..97344aa 100644
--- a/yasnippet-debug.el
+++ b/yasnippet-debug.el
@@ -193,7 +193,11 @@
(yas-debug-live-range field)
(buffer-substring-no-properties (yas--field-start field)
(yas--field-end field))
(yas--debug-format-fom-concise (yas--field-next field))
- (if (yas--field-parent-field field) "(has a parent)" "")))
+ (if (yas--field-parent-field field)
+ (format " parent: %s"
+ (yas--debug-format-fom-concise
+ (yas--field-parent-field field)))
+ "")))
(dolist (mirror (yas--field-mirrors field))
(unless (consp (yas--mirror-start mirror))
(printf "\t\tmirror: %s covering \"%s\" next: %s\n"
@@ -224,6 +228,14 @@
(clrhash yas-debug-live-indicators))
(defun yas-debug-snippets (&optional outbuf hook)
+ "Print debug information on active snippets to buffer OUTBUF.
+If OUTBUF is nil, use a buffer named \"*YASsnippet trace*\".
+If HOOK is non-nil, install `yas-debug-snippets' in
+`post-command-hook' to update the information on every command
+after this one. If it is `snippet-navigation' then install hook
+buffer-locally, otherwise install it globally. If HOOK is
+`edebug-create', also instrument the function
+`yas--snippet-parse-create' with `edebug' and show its source."
(interactive (list nil t))
(condition-case err
(yas-debug-with-tracebuf outbuf
@@ -253,11 +265,12 @@
(ad-activate 'yas--snippet-parse-create)
(ad-enable-advice 'yas--commit-snippet 'after
'yas-debug-untarget-snippet)
(ad-activate 'yas--commit-snippet)
- (add-hook 'post-command-hook #'yas-debug-snippets)
+ (add-hook 'post-command-hook #'yas-debug-snippets
+ nil (eq hook 'snippet-navigation))
;; Window management is slapped together, it does what I
;; want when the caller has a single window open. Good
;; enough for now.
- (when (eq hook 'create)
+ (when (eq hook 'edebug-create)
(edebug-instrument-function 'yas--snippet-parse-create)
(let ((buf-point (find-function-noselect
'yas--snippet-parse-create)))
(with-current-buffer (car buf-point)
diff --git a/yasnippet.el b/yasnippet.el
index 43bc860..f2f7990 100644
--- a/yasnippet.el
+++ b/yasnippet.el
@@ -2705,8 +2705,11 @@ and `kill-buffer' instead."
(save-buffer)))
(quit-window kill)))
+(declare-function yas-debug-snippets "yasnippet-debug")
+
(defun yas-tryout-snippet (&optional debug)
- "Test current buffer's snippet template in other buffer."
+ "Test current buffer's snippet template in other buffer.
+DEBUG is for debugging the YASnippet engine itself."
(interactive "P")
(let* ((major-mode-and-parent (yas--compute-major-mode-and-parents
buffer-file-name))
(parsed (yas--parse-template))
@@ -2736,9 +2739,9 @@ and `kill-buffer' instead."
(point-max)
(yas--template-expand-env
yas--current-template))
(when (and debug
- (require 'yasnippet-debug nil t)
- (fboundp 'yas-debug-snippet-vars))
- (add-hook 'post-command-hook #'yas-debug-snippet-vars nil t))))
+ (require 'yasnippet-debug nil t))
+ (yas-debug-snippets "*YASnippet trace*" 'snippet-navigation)
+ (display-buffer "*YASnippet trace*"))))
(t
(yas--message 1 "Cannot test snippet for unknown major mode")))))
- [elpa] master c9277d3 32/51: Change yas-lookup-snippet to return a yas--template struct, (continued)
- [elpa] master c9277d3 32/51: Change yas-lookup-snippet to return a yas--template struct, Noam Postavsky, 2018/05/13
- [elpa] master 6066631 28/51: Fix typos in "Writing Templates" documentation, Noam Postavsky, 2018/05/13
- [elpa] master b0aa5c2 48/51: Tweak bug-reporting information slightly, Noam Postavsky, 2018/05/13
- [elpa] master fe9f8b6 21/51: ; yasnippet-debug.el: Update yas-debug-snippets arg for previous change., Noam Postavsky, 2018/05/13
- [elpa] master caf3dba 30/51: Don't use global variable for backquote expression locations, Noam Postavsky, 2018/05/13
- [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 <=
- [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, 2018/05/13
- [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