[Top][All Lists]

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

Re: Errors in interactive commands

From: Andreas Röhler
Subject: Re: Errors in interactive commands
Date: Wed, 03 Aug 2011 09:46:12 +0200
User-agent: Mozilla/5.0 (X11; U; Linux i686; de; rv: Gecko/20110616 SUSE/3.1.11 Thunderbird/3.1.11

Am 03.08.2011 09:28, schrieb Stephen J. Turnbull:
Andreas Röhler writes:

  >  A move-forward at the end of the buffer isn't a wrong command as such,
  >  just will not be successful.
  >  Therefor it should not be raised an error, just nil returned.

This is problematic, IMO.  Suppose you have a buffer which is supposed
to have an even number of objects in it, and you want to delete every
second then.  Then

   (goto (point-min))
   (while (not (eobp))
     (forward-object 2)
     (delete-object -1)))

DTRTs, including detecting the "incorrect state" of an odd number of
objects, and not deleting the first object on an incomplete last line.

If you're going to change the behavior of the movement commands here,
I think it would be better to have them return the number of objects
left to move over.  Then 0 would mean (complete) success (how Un*x-y!)

But this would be a major change.

Hi Steve,

thanks verifying.

Nonetheless think arguments are wrong here, mixing up two levels of execution.

To get what you want, it's a state-of-affairs variable to introduce pointing at the action.

Ie 'Delete-every-second' is the matter at stake, whilst "forward-" below resp. inside.

With a little bit pseudo-code introduced:

    (goto (point-min))
    (while (and (QUERY Delete-every-second-state)(not (eobp)))
      (forward-object 2)
      (delete-object -1)
      (UPDATE Delete-every-second-state)))

Useful return values of "forward-" is important for a wide range of things, not just to serve several specific cases.

Sorting execution levels might be the term at stake.
Would like to read another term from experts. Pretty sure exists some in informatics.


reply via email to

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