unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: "David Cadé" <codename68@gmail.com>
To: Stefan Monnier <monnier@iro.umontreal.ca>
Cc: 13143@debbugs.gnu.org, "David Cadé" <codename68@gmail.com>
Subject: bug#13143: 24.2; mpc.el: mpc-songs-refresh: Args out of range
Date: Wed, 12 Dec 2012 13:55:50 +0100 (CET)	[thread overview]
Message-ID: <alpine.DEB.2.02.1212121310450.11192@alfheim> (raw)
In-Reply-To: <jwvy5h4599s.fsf-monnier+emacs@gnu.org>

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

Hello,

On Tue, 11 Dec 2012, Stefan Monnier wrote:

>> I first launched the mpc interface by typing M-x mpc. I did not touch
>> any configuration parameter for this mode.
>> I then chose an album in the Albums | Playlists window by typing RET on
>> it.  This triggered the following error:
>> mpc-songs-refresh: Args out of range: "..." 0, -21
>
> I can't reproduce this here; I don't have any albums with japanese
> characters, but I when I tried with albums with non-ASCII chars, it
> worked fine.
>
> Could you select "Options => Enter debugger on error" and reproduce this bug?
> Hopefully this will give us a backtrace that gives us some clue of
> what's going on.

Here you go:

Debugger entered--Lisp error: (args-out-of-range "魔法少女リリカルなのは サウンドステージ01 第2.5話「ドキ!水着でプールで大ピンチなの」" 0 -21)
   mpc-format("%2{Disc--}%3{Track} %-5{Time} %25{Title} %20{Album} %20{Artist} %10{Date}" ((file . "田村ゆかり・他 - 魔法少女リリカルなのは サウンドステージ01 第2.5話「ドキ!水着でプールで大ピンチなの」/01 - 「なのは魔法の練習中」.flac") (Last-Modified . "2010-10-26T01:22:26Z") (Time . "295") (Title . "「なのは魔法の練習中」") (Artist . "田村ゆかり・他") (Album . "魔法少女リリカルなのは サウンドステージ01 第2.5話「ドキ!水着でプールで大ピンチなの」") (Genre . "Anime") (Track . "1") (Date . "2004-01-01T00:00:00")))
   mpc-songs-refresh()
   mpc-selection-refresh()
   mpc-select(13)
   call-interactively(mpc-select nil nil)

>> Another maybe related bug: when there are japanese characters in the
>> album name and it is too long to be displayed without ellipsis (…), the
>> longer the less characters are present before the ellipsis.
>
> You mean that if the real title is longer, then it gets
> truncated earlier?  As in "toto" would be truncated to "tot…" but
> "wonderful" would be truncated to just "w…" rather than "won…"?

Exactly.

> Hmm... that might be a clue, indeed, tho it might be
> completely unrelated.

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.

Greetings,

-- 
David

  parent reply	other threads:[~2012-12-12 12:55 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é [this message]
2012-12-12 14:00     ` David Cadé
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

  List information: https://www.gnu.org/software/emacs/

* 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.1212121310450.11192@alfheim \
    --to=codename68@gmail.com \
    --cc=13143@debbugs.gnu.org \
    --cc=monnier@iro.umontreal.ca \
    /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 public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).