]> code.delx.au - gnu-emacs-elpa/blobdiff - yasnippet-debug.el
Fix broken links in README.mdown
[gnu-emacs-elpa] / yasnippet-debug.el
index f18793c0ebf0245e178945d73c2ebd29958873a7..b12bcd4ba2610db8add1a9f25cb5073a76f03874 100644 (file)
@@ -1,6 +1,6 @@
 ;;; yasnippet-debug.el --- debug functions for yasnippet
 
-;; Copyright (C) 2010  João Távora
+;; Copyright (C) 2010, 2013, 2014  Free Software Foundation, Inc.
 
 ;; Author: João Távora
 ;; Keywords: emulations, convenience
@@ -25,6 +25,7 @@
 ;;; Code:
 
 (require 'yasnippet)
+(require 'cl)
 
 (defun yas-debug-snippet-vars ()
   "Debug snippets, fields, mirrors and the `buffer-undo-list'."
@@ -45,7 +46,7 @@
                      (yas--snippet-id snippet)
                      (overlay-start (yas--snippet-control-overlay snippet))
                      (overlay-end (yas--snippet-control-overlay snippet))))
-      (princ (format "\tactive field: %d from %s to %s covering \"%s\"\n"
+      (princ (format "\tactive field: %s from %s to %s covering \"%s\"\n"
                      (yas--field-number (yas--snippet-active-field snippet))
                      (marker-position (yas--field-start (yas--snippet-active-field snippet)))
                      (marker-position (yas--field-end (yas--snippet-active-field snippet)))
@@ -55,7 +56,7 @@
                        (yas--exit-marker (yas--snippet-exit snippet))
                        (yas--exit-next (yas--snippet-exit snippet)))))
       (dolist (field (yas--snippet-fields snippet))
-        (princ (format "\tfield: %d from %s to %s covering \"%s\" next: %s%s\n"
+        (princ (format "\tfield: %s from %s to %s covering \"%s\" next: %s%s\n"
                        (yas--field-number field)
                        (marker-position (yas--field-start field))
                        (marker-position (yas--field-end field))
                    (point-max)))
     (unless (eq buffer-undo-list t)
       (princ (format "Undpolist has %s elements. First 10 elements follow:\n" (length buffer-undo-list)))
-      (let ((first-ten (subseq buffer-undo-list 0 19)))
+      (let ((first-ten (subseq buffer-undo-list 0 (min 19
+                                                       (length buffer-undo-list)))))
         (dolist (undo-elem first-ten)
           (princ (format "%2s:  %s\n" (position undo-elem first-ten) (truncate-string-to-width (format "%s" undo-elem) 70))))))))
 
 (defun yas--debug-format-fom-concise (fom)
   (when fom
     (cond ((yas--field-p fom)
-           (format "field %d from %d to %d"
+           (format "field %s from %d to %d"
                    (yas--field-number fom)
                    (marker-position (yas--field-start fom))
                    (marker-position (yas--field-end fom))))
 
 (provide 'yasnippet-debug)
 ;; Local Variables:
+;; indent-tabs-mode: nil
 ;; byte-compile-warnings: (not cl-functions)
 ;; End:
 ;;; yasnippet-debug.el ends here