]> code.delx.au - gnu-emacs-elpa/commitdiff
Avoid trailing whitespace in snippet tables
authorUSAMI Kenta <tadsan@zonu.me>
Tue, 29 Mar 2016 15:23:36 +0000 (00:23 +0900)
committerNoam Postavsky <npostavs@users.sourceforge.net>
Sat, 2 Apr 2016 14:30:10 +0000 (10:30 -0400)
* yasnippet.el (yas-describe-tables, yas--describe-pretty-table): Remove
  redundant tail spaces from output.

Copyright-paperwork-exempt: yes

yasnippet.el

index b68389fd6c175c63b43f463a0c8002cd339f44eb..428770ceb527af8316f093dc0eac1859742c12b7 100644 (file)
@@ -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)))