all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: "David Cadé" <codename68@gmail.com>
To: "David Cadé" <codename68@gmail.com>
Cc: 13143@debbugs.gnu.org
Subject: bug#13143: 24.2; mpc.el: mpc-songs-refresh: Args out of range
Date: Wed, 12 Dec 2012 15:00:54 +0100 (CET)	[thread overview]
Message-ID: <alpine.DEB.2.02.1212121451380.19843@alfheim> (raw)
In-Reply-To: <alpine.DEB.2.02.1212121310450.11192@alfheim>

[-- Attachment #1: Type: TEXT/PLAIN, Size: 742 bytes --]

On Wed, 12 Dec 2012, David Cadé wrote:

> My take on the bug:
> I looked at the code of this function, and from what I can gather, the bug 
> seems to be in:
> (substring text 0 (- size postwidth textwidth 1))
> postwidth and textwidth are widths obtained with string-width, that is to say 
> in number of columns, and may not have any relation with the number of 
> characters present in the string text.
> This seems wrong to me. It seems to me that truncate-string-to-width seems to 
> be the function one would want to use in this case.

This patch in attachment makes things work for me.

Stefan, I don't know if you are registered to this bug number, and I 
apologize if you received multiple copies of this mail.

Greetings,

-- 
David

[-- Attachment #2: Type: TEXT/PLAIN, Size: 731 bytes --]

=== modified file 'lisp/mpc.el'
--- lisp/mpc.el	2012-08-15 16:29:11 +0000
+++ lisp/mpc.el	2012-12-12 13:53:32 +0000
@@ -1036,9 +1036,7 @@
                             (> (+ 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.


  reply	other threads:[~2012-12-12 14:00 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-12-11 15:03 bug#13143: 24.2; mpc.el: mpc-songs-refresh: Args out of range David Cadé
2012-12-12  1:56 ` Stefan Monnier
2012-12-12  6:24   ` Thierry Volpiatto
2012-12-12 12:55   ` David Cadé
2012-12-12 14:00     ` David Cadé [this message]
2012-12-12 16:04     ` Stefan Monnier
2012-12-12 16:10       ` Bastien
2012-12-12 16:40         ` David Cadé
2012-12-12 16:51           ` Bastien

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=alpine.DEB.2.02.1212121451380.19843@alfheim \
    --to=codename68@gmail.com \
    --cc=13143@debbugs.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.