emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: problem of marker as position


From: Luc Teirlinck
Subject: Re: problem of marker as position
Date: Tue, 18 Nov 2003 21:34:50 -0600 (CST)

Ken'ichi Handa wrote:

   I've just noticed that (char-after MARKER) returns a
   character in the current buffer even if the buffer of MARKER
   is the different one.  I think all such functions that
   accept a marker as a position ignores the buffer infomation
   of the marker.

To me that is exactly what is _meant_ by using a marker "as a
position".  A function could also accept a marker "as a buffer", by
ignoring the position, or "truly as a marker", by using both.  It
would seem to me that any function is free to allow both an integer
and a marker as an argument and nevertheless use the marker as a
marker, that is, buffer and all.  In that case however, it would not
be using the marker as a "substitute" for a position, but as a
genuinely different alternative to a position.  I believe that it is
up to the documentation of the individual function to make that clear.
The documentation string of `char-after' clearly says that it uses the
current buffer no matter what.

That being said, _if_ something needs to be clarified, then I believe
that the best place to do that is (elisp)Positions:

===File ~/pos-diff==========================================
cd ~/emacscvsdir/emacs/lispref/
diff -c /home/teirllm/positions.old.texi 
/home/teirllm/emacscvsdir/emacs/lispref/positions.texi
*** /home/teirllm/positions.old.texi    Sat Nov  8 22:41:19 2003
--- /home/teirllm/emacscvsdir/emacs/lispref/positions.texi      Tue Nov 18 
21:14:12 2003
***************
*** 18,24 ****
    Positions are usually represented as integers starting from 1, but can
  also be represented as @dfn{markers}---special objects that relocate
  automatically when text is inserted or deleted so they stay with the
! surrounding characters.  @xref{Markers}.
  
    See also the ``field'' feature (@pxref{Fields}), which provides
  functions that are used by many cursor-motion commands.
--- 18,28 ----
    Positions are usually represented as integers starting from 1, but can
  also be represented as @dfn{markers}---special objects that relocate
  automatically when text is inserted or deleted so they stay with the
! surrounding characters.  Functions that expect an argument to be a
! position (an integer), but accept a marker as a substitute, normally
! ignore the marker buffer.  Of course, markers used this way usually
! point to a position in the buffer that the function operates on, but
! that is entirely the programmer's responsibility.  @xref{Markers}.
  
    See also the ``field'' feature (@pxref{Fields}), which provides
  functions that are used by many cursor-motion commands.

Diff finished at Tue Nov 18 21:20:02
============================================================

Sincerely,

Luc.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]