Lisp HUG Maillist Archive

multiple undo

What is the trick to get multiple-undo to work in an editor-pane? In  
my custom interface, I can only undo one command. If I execute undo a  
second time, it just toggles back to the previous state.

Undo works OK in the capi editor-pane example, so I'm wondering what  
I could have done to mess this up. Right now the only difference I  
see is that the example uses capi:call-editor and I'm using  
editor:process-character. And now I just noticed that it does seem to  
work correctly if I undo using ctrl-_ rather than the command-z menu  
item (which calls editor:undo-command using process-character).


John DeSoi, Ph.D.
http://pgedit.com/
Power Tools for PostgreSQL


Re: multiple undo

Unable to parse email body. Email id is 4221

Re: multiple undo

Hi Martin,

On Jul 25, 2005, at 12:40 PM, Martin Simmons wrote:

> Sounds like some other editor command is running in between.  You  
> could
> investiate EDITOR::LAST-COMMAND-TYPE and its setter in source to  
> possibly
> track this down.

Yes, it looks like the problem is related to using process-character  
before undo is called to determine if editing is happening in the  
echo area or not (i.e. I want to have editing commands work properly  
in the echo area and the normal editor pane). Is there a documented  
(or good) way to determine which is active so I can direct the  
editing commands correctly?

Thanks,



John DeSoi, Ph.D.
http://pgedit.com/
Power Tools for PostgreSQL


Re: multiple undo

Unable to parse email body. Email id is 4280

Re: multiple undo

Hi Martin,

On Aug 1, 2005, at 2:53 PM, Martin Simmons wrote:

> No, I don't think there is an exported API that can query the  
> redirection of
> editor input to the echo area.
>
> Possibly you could check for the buffer's major mode?  The echo  
> area already
> has special keystokes selected by this ("Echo Area" or "Pc Echo"  
> according to
> the emulation style).


I don't follow how I would check the buffer's major mode to  
accomplish this. I'm in the capi interface process and my  
understanding is that I need to use either capi:call-editor or  
editor:process-character to call my command. So for this I need to  
know the right pane. I'm using the ugly hack below to figure this  
out, but making this call before the undo command is casing the problem.



John DeSoi, Ph.D.
http://pgedit.com/
Power Tools for PostgreSQL



(defun echo-pane-active (pane)
   (let ((echo (echo-pane pane))) ;echo-pane returns the same pane
     (when echo
       (let ((echo-pane-active nil))
         (editor:process-character
          (list (lambda ()
                  (setf echo-pane-active
                        (if (and editor::*in-a-recursive-edit* (eq  
(editor:current-buffer) editor::*echo-area-buffer*)) 1 0))))
          (editor-window echo))
         (mp:process-wait-with-timeout "Waiting for ECHO-PANE-ACTIVE"  
1 (lambda () echo-pane-active))
         (if (eql echo-pane-active 1)
           echo nil)))))


Updated at: 2020-12-10 08:51 UTC