[gnu.emacs.bug] char-after fails to handle marker

enami@ptgd.sony.co.jp (enami tsugutomo) (01/08/90)

In GNU Emacs 18.55.0 of Mon Dec 25 1989 on chihaya (berkeley-unix)

The function `char-after' returns non-sense value if its argument is a
marker.

Following patch will resume it, I hope.

enami.


RCS file: RCS/editfns.c,v
retrieving revision 1.1
diff -c -r1.1 editfns.c
*** /tmp/,RCSt1013312	Mon Jan  8 10:32:56 1990
--- editfns.c	Mon Jan  8 10:32:14 1990
***************
*** 389,396 ****
       Lisp_Object pos;
  {
    register Lisp_Object val;
!   register int n = XINT (pos);
    CHECK_NUMBER_COERCE_MARKER (pos, 0);
    if (n < FirstCharacter || n > NumCharacters) return Qnil;
  
    XFASTINT (val) = CharAt (n);
--- 389,399 ----
       Lisp_Object pos;
  {
    register Lisp_Object val;
!   register int n;
! 
    CHECK_NUMBER_COERCE_MARKER (pos, 0);
+ 
+   n = XINT (pos);
    if (n < FirstCharacter || n > NumCharacters) return Qnil;
  
    XFASTINT (val) = CharAt (n);

shin@sgtp.apple.juice.or.jp (Shinichirou Sugou) (01/09/90)

Enami tsugutomo writes:
In article <9001080141.AA13338@chihaya.ptgd.sony.co.jp> enami@ptgd.sony.co.jp (enami tsugutomo) writes:

   The function `char-after' returns non-sense value if its argument is a
   marker.

According to Emacs-lisp manual, the function 'char-after' takes not marker
but position type argument.

(char-after (marker-position some-marker-value)) will work fine.


CAUTION: (1) Reply-command in the mail system may NOT generate my address
             correctly.  Please use the following address instead.

               shin%sgtp.apple.juice.or.jp@uunet.uu.net

         (2) I have no relation to Apple Computer Inc. :-)

---
S.Sugou

kjones@talos.uu.net (Kyle Jones) (01/09/90)

Shinichirou Sugou writes:
 > According to Emacs-lisp manual, the function 'char-after' takes not marker
 > but position type argument.

It is clear that the char-after function was meant to (and should) accept a
marker as an argument; why else would CHECK_NUMBER_COERCE_MARKER have been
used otherwise?  The e-lisp manual needs to be corrected, along with the
definition of char-after itself.

shin@sgtp.apple.juice.or.jp (Shinichirou Sugou) (01/12/90)

Kyle Jones wirtes:

  It is clear that the char-after function was meant to (and should) accept a
  marker as an argument; why else would CHECK_NUMBER_COERCE_MARKER have been
  used otherwise?

Yes, you (and Mr.Enami) are right.  I was wrong.  I didn't check the source
program when I wrote that article, sorry.


CAUTION: (1) Reply-command in the mail system may NOT generate my address
             correctly.  Please use the following address instead.

               shin%sgtp.apple.juice.or.jp@uunet.uu.net

         (2) I have no relation to Apple Computer Inc. :-)

---
S.Sugou