[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] master c744148 03/40: Make yas-describe-tables easier to use from
From: |
Noam Postavsky |
Subject: |
[elpa] master c744148 03/40: Make yas-describe-tables easier to use from lisp |
Date: |
Wed, 26 Oct 2016 23:06:31 +0000 (UTC) |
branch: master
commit c7441486db858d1c35187c3ffa6096fff064d421
Author: Noam Postavsky <address@hidden>
Commit: Noam Postavsky <address@hidden>
Make yas-describe-tables easier to use from lisp
* yasnippet.el (yas-describe-table-by-namehash): new function.
(yas-describe-tables): remove query for by-namehash variant, replace
query for non-active tables with prefix arg.
---
yasnippet.el | 91 ++++++++++++++++++++++++++--------------------------------
1 file changed, 41 insertions(+), 50 deletions(-)
diff --git a/yasnippet.el b/yasnippet.el
index 161c996..8a6258c 100644
--- a/yasnippet.el
+++ b/yasnippet.el
@@ -2664,58 +2664,49 @@ and `kill-buffer' instead."
(car (last (or (yas--template-group template)
(yas--template-perm-group template)))))
-(defun yas-describe-tables (&optional choose)
+(defun yas-describe-table-by-namehash ()
+ "Display snippet tables by NAMEHASH."
+ (interactive)
+ (with-current-buffer (get-buffer-create "*YASnippet Tables by NAMEHASH*")
+ (let ((inhibit-read-only t))
+ (erase-buffer)
+ (insert "YASnippet tables by NAMEHASH: \n")
+ (maphash
+ (lambda (_mode table)
+ (insert (format "\nSnippet table `%s':\n\n" (yas--table-name table)))
+ (maphash
+ (lambda (key _v)
+ (insert (format " key %s maps snippets: %s\n" key
+ (let ((names))
+ (maphash #'(lambda (k _v)
+ (push k names))
+ (gethash key (yas--table-hash table)))
+ names))))
+ (yas--table-hash table)))
+ yas--tables))
+ (view-mode +1)
+ (goto-char 1)
+ (display-buffer (current-buffer))))
+
+(defun yas-describe-tables (&optional with-nonactive)
"Display snippets for each table."
(interactive "P")
- (let* ((by-name-hash (and choose
- (y-or-n-p "Show by namehash? ")))
- (buffer (get-buffer-create "*YASnippet tables*"))
- (active-tables (yas--get-snippet-tables))
- (remain-tables (let ((all))
- (maphash #'(lambda (_k v)
- (unless (find v active-tables)
- (push v all)))
- yas--tables)
- all))
- (table-lists (list active-tables remain-tables))
- (original-buffer (current-buffer))
- (continue t)
- (yas--condition-cache-timestamp (current-time)))
- (with-current-buffer buffer
- (setq buffer-read-only nil)
- (erase-buffer)
- (cond ((not by-name-hash)
- (insert "YASnippet tables:\n")
- (while (and table-lists
- continue)
- (dolist (table (car table-lists))
- (yas--describe-pretty-table table original-buffer))
- (setq table-lists (cdr table-lists))
- (when table-lists
- (yas--create-snippet-xrefs)
- (display-buffer buffer)
- (setq continue (and choose (y-or-n-p "Show also non-active
tables? ")))))
- (yas--create-snippet-xrefs)
- (help-mode)
- (goto-char 1))
- (t
- (insert "\n\nYASnippet tables by NAMEHASH: \n")
- (dolist (table (append active-tables remain-tables))
- (insert (format "\nSnippet table `%s':\n\n" (yas--table-name
table)))
- (let ((keys))
- (maphash #'(lambda (k _v)
- (push k keys))
- (yas--table-hash table))
- (dolist (key keys)
- (insert (format " key %s maps snippets: %s\n" key
- (let ((names))
- (maphash #'(lambda (k _v)
- (push k names))
- (gethash key (yas--table-hash
table)))
- names))))))))
- (goto-char 1)
- (setq buffer-read-only t))
- (display-buffer buffer)))
+ (let ((original-buffer (current-buffer))
+ (tables (yas--get-snippet-tables)))
+ (with-current-buffer (get-buffer-create "*YASnippet Tables*")
+ (let ((inhibit-read-only t))
+ (when with-nonactive
+ (maphash #'(lambda (_k v)
+ (cl-pushnew v tables))
+ yas--tables))
+ (erase-buffer)
+ (insert "YASnippet tables:\n")
+ (dolist (table tables)
+ (yas--describe-pretty-table table original-buffer))
+ (yas--create-snippet-xrefs))
+ (help-mode)
+ (goto-char 1)
+ (display-buffer (current-buffer)))))
(defun yas--describe-pretty-table (table &optional original-buffer)
(insert (format "\nSnippet table `%s'"
- [elpa] master updated (f06d730 -> 299efcb), Noam Postavsky, 2016/10/26
- [elpa] master bc80f67 01/40: .travis.yml: Don't notify on success, Noam Postavsky, 2016/10/26
- [elpa] master 6b785e1 08/40: Say how to hide the backquote side-effect warning, Noam Postavsky, 2016/10/26
- [elpa] master 1735a28 02/40: Add region contents to new snippet, Noam Postavsky, 2016/10/26
- [elpa] master ee4efdb 05/40: Revert "Separate parsing from evaluation of backquote lisp", Noam Postavsky, 2016/10/26
- [elpa] master 85f39ce 06/40: Warn about backquote exprs modifying the buffer, Noam Postavsky, 2016/10/26
- [elpa] master e21420a 04/40: Separate parsing from evaluation of backquote lisp, Noam Postavsky, 2016/10/26
- [elpa] master c744148 03/40: Make yas-describe-tables easier to use from lisp,
Noam Postavsky <=
- [elpa] master d218ed8 11/40: Do indent the first line of mirrors, but in correct order, Noam Postavsky, 2016/10/26
- [elpa] master 0db65ee 20/40: Don't clobber match data in modification hooks, Noam Postavsky, 2016/10/26
- [elpa] master dc098cf 25/40: Fix yas--message verbosity levels, Noam Postavsky, 2016/10/26
- [elpa] master 5af9276 27/40: Support yas/ symbols in yas-define-menu, Noam Postavsky, 2016/10/26
- [elpa] master ea9581f 22/40: Fix some quoting problems in doc strings, Noam Postavsky, 2016/10/26
- [elpa] master ee6e7a9 09/40: Fix some compilation warnings, Noam Postavsky, 2016/10/26
- [elpa] master 7661dc1 19/40: yasnippet.el (yas-escape-text): No error on nil text, Noam Postavsky, 2016/10/26
- [elpa] master 351c1e3 10/40: Don't indent first line of mirrors, Noam Postavsky, 2016/10/26
- [elpa] master 655bda8 07/40: Merge: restore backquote evaluation behaviour, Noam Postavsky, 2016/10/26
- [elpa] master 8907fd1 14/40: Escape yas-selected-text for new snippet., Noam Postavsky, 2016/10/26