jed-users mailing list

[2003 Date Index] [2003 Thread Index] [Other years]
[Thread Prev] [Thread Next]      [Date Prev] [Date Next]

Re: pop_spot(0)


Klaus Schmid <klaus.schmid@xxxxxx> wrote:
>Reading the docs I fear I do not understand the user-mark mechanics
>completly, especially move_user_marks.
>
>define fun1( m){
>..
>move_user_mark( m) % m= create_user_mark() would not change the m in calling
>space
>..
>}
>
>m= create_user_mark();
>fun1( m);
>goto_user_mark( m); % m redefined in fun1()
>
>Is my understanding correct?

A user-mark is passed by reference.  Hence, any changes to it by a
function will manifest itself outside the function.  So

   define fun1 (m)
   {
      move_user_mark (m);
   }
   eob ();
   m = create_user_mark ();
   bob ();
   fun1 (m);

will result in the mark m associated with the beginnining of the
buffer (bob) and not the end of the buffer (eob) where it was
originally attached.

At the moment, there is no trivial way to get the line number
associated with the usermark.  Until I add such support, I suggest

    define user_mark_line (m)
    {
       push_spot ();
       goto_user_mark (m);
       variable l = what_line ();
       pop_spot ();
       return l;
    }

Note: to get the buffer name associated with the user mark m, use
m.buffer_name.  The next version of jed will support m.line and m.point.

I hope this helps clarify things.
Thanks,
--John
       

  


[2003 date index] [2003 thread index]
[Thread Prev] [Thread Next]      [Date Prev] [Date Next]