[climacs-devel] keyboard macros, display protocol

Christophe Rhodes csr21 at cam.ac.uk
Thu May 4 10:55:30 UTC 2006


Hi,

The below implements keyboard macros with the numeric argument.  It
seems to work, up to a point.

The point at which it stops working is if the keyboard macro changes
the number of lines in the display, and indeed the problem can be seen
without this patch: start climacs, type (say), abcdefg, put point at
the start of line, and do
  C-x ( C-f RET C-f RET C-f RET C-x ) C-x e
(BOOM).

The reason that this is a disaster is because we have multiple
commands, multiple update-syntaxes, and multiple clear-modifies
between successive redisplays, and this plays havoc with the cache
maintained in climacs pane.lisp.

I sat down and doodled a while this morning, thinking about it, and I
think that the answer is to define a new pair of marks for climacs
buffers: just as there is a call chain
  execute-frame-command -> update-syntax
                        -> clear-modify
where update-syntax can rely on low-mark and high-mark to work out
what needs to be reparsed, I think there needs to be
  redisplay-frame-panes -> update-syntax-for-display
                        -> clear-modify-for-display
where the new pair of marks isn't so much for
update-syntax-for-display's benefit as for some of the bookkeeping
code in pane.lisp

The point here is that there should be a complete separation between
the bookkeeping done at each command, and the bookkeeping done for
each redisplay, as commands and displays are not one-to-one.

Comments?

Cheers,

Christophe

;;; works fine with gsharp.
(define-command (com-call-last-kbd-macro
                 :name t
                 :command-table keyboard-macro-table)
    ((count 'integer))
  (setf (remaining-keys *application-frame*)
  (loop repeat count append (recorded-keys *application-frame*)))
  (setf (executingp *application-frame*) t))

(set-key `(com-call-last-kbd-macro ,*numeric-argument-marker*)
         'keyboard-macro-table '((#\x :control) #\e))




More information about the climacs-devel mailing list