* lisp/mpc.el (mpc-format): Use truncate-string-to-width.
authorDavid Cadé <codename68@gmail.com>
Wed, 12 Dec 2012 14:42:03 +0000 (09:42 -0500)
committerStefan Monnier <monnier@iro.umontreal.ca>
Wed, 12 Dec 2012 14:42:03 +0000 (09:42 -0500)
Fixes: debbugs:13143

lisp/ChangeLog
lisp/mpc.el

index 49e129c..a5fab65 100644 (file)
@@ -1,3 +1,7 @@
+2012-12-12  David Cadé  <codename68@gmail.com>
+
+       * mpc.el (mpc-format): Use truncate-string-to-width (bug#13143).
+
 2012-12-12  Jonas Bernoulli  <jonas@bernoul.li>
 
        * lisp/emacs-lisp/eieio.el: Prettier object pretty-printing (bug#13115).
index e8b5c50..65363de 100644 (file)
@@ -1034,11 +1034,8 @@ If PLAYLIST is t or nil or missing, use the main playlist."
             (let ((display
                    (if (and size
                             (> (+ postwidth textwidth) size))
-                       ;; This doesn't even obey double-width chars :-(
                        (propertize
-                        (if (zerop (- size postwidth 1))
-                            (substring text 0 1)
-                          (concat (substring text 0 (- size postwidth textwidth 1)) "…"))
+                       (truncate-string-to-width text size nil nil "…")
                         'help-echo text)
                      text)))
               (when (memq tag '(Artist Album Composer)) ;FIXME: wrong list.