Loading ...
Sorry, an error occurred while loading the content.

set-mark/$status

Expand Messages
  • un_x
    this macro doesn t work. $status is always returning 1 whether a mark has been set or not. ? !force exchange-point-and-mark !if $status ml-write $status
    Message 1 of 2 , Feb 22, 2002
    • 0 Attachment
      this macro doesn't work.
      $status is always returning "1"
      whether a mark has been set or not.
      ?

      !force exchange-point-and-mark
      !if $status
      ml-write $status
      exchange-point-and-mark
      !else
      ml-write $status
      beginning-of-buffer
      set-mark
      end-of-buffer
      !endif
    • Steven Phillips
      I think this mark set detection code does work, the problem is that the mark is being set behind your back, for instance if you create a new buffer called
      Message 2 of 2 , Feb 27, 2002
      • 0 Attachment
        I think this 'mark set detection' code does work, the problem is that the
        mark is being set behind your back, for instance if you create a new buffer
        called "*foo" and type "C-x C-x" it complains theres no mark and at that
        point so should the macro code below, and if you do basic typing still no
        mark is set. But once a mark has been set the buffer will always have a mark
        from then on as there is currently no way of deleting the mark. I've also
        found that if you create a new buffer which has a template file inserted
        (e.g. t.c inserts the c.etf file) as this feature uses the insert-file
        command the mark is set to the top of the buffer, so simply creating a new
        buffer t.c will set the mark in that buffer.

        I guess that we could change set-mark so that "-1 set-mark" removes the mark
        and this could be added to etfinsert so that creating a t.c buffer will not
        have a mark set in it by default, but I am sure there would be lots of other
        macros where a similar problem is created. For instance your usage case was
        to test for the existence of a mark and if not set then select the whole
        buffer, this will lead to setting the mark to the top of the buffer so this
        probably won't work second time round etc.

        I'm still chewing this one over, any thoughts welcome!

        Steve

        > -----Original Message-----
        > From: un_x [mailto:un_x@...]
        > Sent: 22 February 2002 13:35
        > To: jasspa@yahoogroups.com
        > Subject: [jasspa] set-mark/$status
        >
        >
        > this macro doesn't work.
        > $status is always returning "1"
        > whether a mark has been set or not.
        > ?
        >
        > !force exchange-point-and-mark
        > !if $status
        > ml-write $status
        > exchange-point-and-mark
        > !else
        > ml-write $status
        > beginning-of-buffer
        > set-mark
        > end-of-buffer
        > !endif
        >
        >
        >
        >
        > __________________________________________________________________________
        >
        > This is an unmoderated list. JASSPA is not responsible for the content of
        > any material posted to this list.
        >
        > To unsubscribe, send a mail message to
        >
        > mailto:jasspa-unsubscribe@yahoogroups.com
        >
        > or visit http://groups.yahoo.com/group/jasspa and
        > modify your account settings manually.
        >
        >
        >
        >
        > Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
        >
        >
        >
      Your message has been successfully submitted and would be delivered to recipients shortly.