GNU bug report logs - #12679
24.2.50; Can't font-at for the beginning of a string

Previous Next

Package: emacs;

Reported by: Kazuhiro Ito <kzhr <at> d1.dion.ne.jp>

Date: Fri, 19 Oct 2012 09:55:02 UTC

Severity: normal

Found in version 24.2.50

Done: Chong Yidong <cyd <at> gnu.org>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 12679 in the body.
You can then email your comments to 12679 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#12679; Package emacs. (Fri, 19 Oct 2012 09:55:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Kazuhiro Ito <kzhr <at> d1.dion.ne.jp>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Fri, 19 Oct 2012 09:55:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Kazuhiro Ito <kzhr <at> d1.dion.ne.jp>
To: bug-gnu-emacs <at> gnu.org
Subject: 24.2.50; Can't font-at for the beginning of a string
Date: Fri, 19 Oct 2012 18:52:21 +0900
The below code raises an error on trunk.

(font-at 0 nil "A")

Please see the below patch.

=== modified file 'src/font.c'
--- src/font.c	2012-09-17 12:07:36 +0000
+++ src/font.c	2012-10-19 09:15:58 +0000
@@ -4775,7 +4775,7 @@
     {
       CHECK_NUMBER (position);
       CHECK_STRING (string);
-      if (! (0 < XINT (position) && XINT (position) < SCHARS (string)))
+      if (! (0 <= XINT (position) && XINT (position) < SCHARS (string)))
 	args_out_of_range (string, position);
       pos = XINT (position);
     }


-- 
Kazuhiro Ito




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#12679; Package emacs. (Fri, 19 Oct 2012 13:15:01 GMT) Full text and rfc822 format available.

Message #8 received at 12679 <at> debbugs.gnu.org (full text, mbox):

From: Kenichi Handa <handa <at> gnu.org>
To: Kazuhiro Ito <kzhr <at> d1.dion.ne.jp>
Cc: 12679 <at> debbugs.gnu.org
Subject: Re: bug#12679: 24.2.50; Can't font-at for the beginning of a string
Date: Fri, 19 Oct 2012 22:11:12 +0900
In article <87391an60a.wl%%xmue <at> d1.dion.ne.jp>, Kazuhiro Ito <kzhr <at> d1.dion.ne.jp> writes:

> The below code raises an error on trunk.
> (font-at 0 nil "A")

> Please see the below patch.

> === modified file 'src/font.c'
> --- src/font.c	2012-09-17 12:07:36 +0000
> +++ src/font.c	2012-10-19 09:15:58 +0000
> @@ -4775,7 +4775,7 @@
>      {
>        CHECK_NUMBER (position);
>        CHECK_STRING (string);
> -      if (! (0 < XINT (position) && XINT (position) < SCHARS (string)))
> +      if (! (0 <= XINT (position) && XINT (position) < SCHARS (string)))
>  	args_out_of_range (string, position);
>        pos = XINT (position);
>      }


Thank you for the patch.  I've just commited it.

---
Kenichi Handa
handa <at> gnu.org




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#12679; Package emacs. (Sat, 20 Oct 2012 12:22:01 GMT) Full text and rfc822 format available.

Message #11 received at 12679 <at> debbugs.gnu.org (full text, mbox):

From: martin rudalics <rudalics <at> gmx.at>
To: Kenichi Handa <handa <at> gnu.org>
Cc: Kazuhiro Ito <kzhr <at> d1.dion.ne.jp>, 12679 <at> debbugs.gnu.org
Subject: Re: bug#12679: 24.2.50; Can't font-at for the beginning of a string
Date: Sat, 20 Oct 2012 14:19:54 +0200
Could you please also (1) add a description of the STRING argument in
the doc-string of `font-at', and (2) explain what happens when the
selected window or the window passed as argument do not show the current
buffer.  IIUC face_at_buffer_position expects the window passed to it to
show the current buffer but this might not be true when `font-at' calls
it.  There's also this comment in face_at_buffer_position:

  /* W must display the current buffer.  We could write this function
     to use the frame and buffer of W, but right now it doesn't.  */
  /* eassert (XBUFFER (w->buffer) == current_buffer); */

Later in the code of face_at_buffer_position I see that w->buffer is
sometimes used explicitly but get the impression that most other parts
of the code use the current buffer instead.

Thanks, martin




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#12679; Package emacs. (Tue, 30 Oct 2012 11:51:02 GMT) Full text and rfc822 format available.

Message #14 received at 12679 <at> debbugs.gnu.org (full text, mbox):

From: Kenichi Handa <handa <at> gnu.org>
To: martin rudalics <rudalics <at> gmx.at>
Cc: kzhr <at> d1.dion.ne.jp, 12679 <at> debbugs.gnu.org
Subject: Re: bug#12679: 24.2.50; Can't font-at for the beginning of a string
Date: Tue, 30 Oct 2012 20:45:55 +0900
In article <508296EA.60000 <at> gmx.at>, martin rudalics <rudalics <at> gmx.at> writes:

> Could you please also (1) add a description of the STRING argument in
> the doc-string of `font-at',

I added this statement to the docstring.

  Optional third arg STRING, if non-nil, is a string containing the target
  character at index specified by POSITION.

> and (2) explain what happens when the
> selected window or the window passed as argument do not show the current
> buffer.

> IIUC face_at_buffer_position expects the window passed to it to
> show the current buffer but this might not be true when `font-at' calls
> it.  There's also this comment in face_at_buffer_position:

>    /* W must display the current buffer.  We could write this function
>       to use the frame and buffer of W, but right now it doesn't.  */
>    /* eassert (XBUFFER (w->buffer) == current_buffer); */

> Later in the code of face_at_buffer_position I see that w->buffer is
> sometimes used explicitly but get the impression that most other parts
> of the code use the current buffer instead.

I think your worrying is right.  So, I changed font-at to
signal an error when the specified window is not displaying
the current buffer.

---
Kenichi Handa
handa <at> gnu.org




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#12679; Package emacs. (Tue, 30 Oct 2012 18:53:01 GMT) Full text and rfc822 format available.

Message #17 received at 12679 <at> debbugs.gnu.org (full text, mbox):

From: martin rudalics <rudalics <at> gmx.at>
To: Kenichi Handa <handa <at> gnu.org>
Cc: kzhr <at> d1.dion.ne.jp, 12679 <at> debbugs.gnu.org
Subject: Re: bug#12679: 24.2.50; Can't font-at for the beginning of a string
Date: Tue, 30 Oct 2012 19:49:02 +0100
> I added this statement to the docstring.
>
>   Optional third arg STRING, if non-nil, is a string containing the target
>   character at index specified by POSITION.

Thanks.

> I changed font-at to
> signal an error when the specified window is not displaying
> the current buffer.

Yes, I think that's the best solution.

Thanks, martin




bug closed, send any further explanations to 12679 <at> debbugs.gnu.org and Kazuhiro Ito <kzhr <at> d1.dion.ne.jp> Request was from Chong Yidong <cyd <at> gnu.org> to control <at> debbugs.gnu.org. (Wed, 31 Oct 2012 05:09:01 GMT) Full text and rfc822 format available.

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Wed, 28 Nov 2012 12:24:04 GMT) Full text and rfc822 format available.

This bug report was last modified 12 years and 263 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.