From ea5ed74fb2844a71f15885db415a6205572f0c07 Mon Sep 17 00:00:00 2001 From: USAMI Kenta Date: Wed, 30 Mar 2016 00:23:36 +0900 Subject: [PATCH] Avoid trailing whitespace in snippet tables * yasnippet.el (yas-describe-tables, yas--describe-pretty-table): Remove redundant tail spaces from output. Copyright-paperwork-exempt: yes --- yasnippet.el | 37 ++++++++++++++++++++----------------- 1 file changed, 20 insertions(+), 17 deletions(-) diff --git a/yasnippet.el b/yasnippet.el index b68389fd6..428770ceb 100644 --- a/yasnippet.el +++ b/yasnippet.el @@ -2660,7 +2660,7 @@ and `kill-buffer' instead." (setq buffer-read-only nil) (erase-buffer) (cond ((not by-name-hash) - (insert "YASnippet tables: \n") + (insert "YASnippet tables:\n") (while (and table-lists continue) (dolist (table (car table-lists)) @@ -2716,19 +2716,21 @@ and `kill-buffer' instead." (setq group (truncate-string-to-width group 25 0 ? "...")) (insert (make-string 100 ?-) "\n") (dolist (p templates) - (let ((name (truncate-string-to-width (propertize (format "\\\\snippet `%s'" (yas--template-name p)) - 'yasnippet p) - 50 0 ? "...")) - (group (prog1 group - (setq group (make-string (length group) ? )))) - (condition-string (let ((condition (yas--template-condition p))) - (if (and condition - original-buffer) - (with-current-buffer original-buffer - (if (yas--eval-condition condition) - "(y)" - "(s)")) - "(a)")))) + (let* ((name (truncate-string-to-width (propertize (format "\\\\snippet `%s'" (yas--template-name p)) + 'yasnippet p) + 50 0 ? "...")) + (group (prog1 group + (setq group (make-string (length group) ? )))) + (condition-string (let ((condition (yas--template-condition p))) + (if (and condition + original-buffer) + (with-current-buffer original-buffer + (if (yas--eval-condition condition) + "(y)" + "(s)")) + "(a)"))) + (key-description-string (key-description (yas--template-keybinding p))) + (template-key-padding (if (string= key-description-string "") nil ? ))) (insert group " ") (insert condition-string " ") (insert name @@ -2737,9 +2739,10 @@ and `kill-buffer' instead." " ") " ") (insert (truncate-string-to-width (or (yas--template-key p) "") - 15 0 ? "...") " ") - (insert (truncate-string-to-width (key-description (yas--template-keybinding p)) - 15 0 ? "...") " ") + 15 0 template-key-padding "...") + (if template-key-padding (byte-to-string template-key-padding) "")) + (insert (truncate-string-to-width key-description-string + 15 0 nil "...")) (insert "\n")))) groups-hash))) -- 2.39.2