emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] master ed32ba8 04/11: New names-pprint command, to pretty-print e


From: Artur Malabarba
Subject: [elpa] master ed32ba8 04/11: New names-pprint command, to pretty-print entire namespace
Date: Thu, 18 Jun 2015 17:30:23 +0000

branch: master
commit ed32ba84ee1433c698ca9c8562b63014036df947
Author: Artur Malabarba <address@hidden>
Commit: Artur Malabarba <address@hidden>

    New names-pprint command, to pretty-print entire namespace
    
    Affects #17
---
 names-dev.el |   21 +++++++++++++++------
 1 files changed, 15 insertions(+), 6 deletions(-)

diff --git a/names-dev.el b/names-dev.el
index 4efc12e..87a6d58 100644
--- a/names-dev.el
+++ b/names-dev.el
@@ -62,11 +62,11 @@
 (defmacro names-print (name &rest forms)
   "Return the expanded results of (namespace NAME :global :verbose FORMS).
 Ideal for determining why a specific form isn't being parsed
-correctly."
+correctly. You may need to set `eval-expression-print-level' and
+`eval-expression-print-length' to nil in order to see your full
+expansion."
   (declare (indent (lambda (&rest x) 0)) (debug 0))
-  `(let ((eval-expression-print-level (max eval-expression-print-level 300))
-         (eval-expression-print-length (max eval-expression-print-length 300)))
-     (macroexpand '(define-namespace ,name :global :verbose ,@forms))))
+  `(define-namespace ,name :global :verbose ,@forms))
 
 (defvar names-font-lock
   '(("^:autoload\\_>" 0 'font-lock-warning-face prepend)
@@ -156,8 +156,8 @@ If KILL is non-nil, kill the temp buffer afterwards."
   (progn
     (beginning-of-defun)
     (ignore-errors
-      (backward-up-list)
-      (names--looking-at-namespace))))
+      (backward-up-list))
+    (names--looking-at-namespace)))
 
 (defun names-eval-defun (edebug-it)
   "Identical to `eval-defun', except it works for forms inside namespaces.
@@ -204,6 +204,15 @@ Argument EVAL-LAST-SEXP-ARG-INTERNAL is the same as 
`eval-print-last-sexp'."
 
 ;; (pp (symbol-function 'names--preceding-sexp-original) (current-buffer))
 
+(defun names-pprint ()
+  "Pretty-print an expansion of the namespace around point."
+  (interactive)
+  (let ((ns (save-excursion
+              (names--top-of-namespace)
+              (cdr-safe (read (current-buffer))))))
+    (pp-macroexpand-expression
+     (macroexpand (cons 'names-print ns)))))
+
 
 ;;; Find stuff
 (require 'find-func nil t)



reply via email to

[Prev in Thread] Current Thread [Next in Thread]