Changeset 670
- Timestamp:
- Mar 18, 2004, 4:47:14 PM (21 years ago)
- File:
-
- 1 edited
-
trunk/ccl/hemlock/src/interp.lisp (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/ccl/hemlock/src/interp.lisp
r566 r670 18 18 (in-package :hemlock-internals) 19 19 20 (defstruct command-interpreter-info 21 (current-command (make-array 10 :fill-pointer 0 :adjustable t)) 22 (current-translation (make-array 10 :fill-pointer 0 :adjustable t)) 23 (last-command-type nil) 24 (command-type-set nil) 25 (prefix-argument nil) 26 (prefix-argument-supplied nil) 27 frame 28 ) 20 29 21 30 22 … … 433 425 (setf (command-interpreter-info-prefix-argument info) nil) 434 426 (let* ((*last-key-event-typed* key-event) 427 (*current-command-info* info) 435 428 (cmd (command-interpreter-info-current-command info)) 436 (trans (command-interpreter-info-current-translation info))) 429 (trans (command-interpreter-info-current-translation info)) 430 (func (command-interpreter-info-function info))) 437 431 (handler-bind 438 432 ;; Bind this outside the invocation loop to save consing. 439 ((e rror #'(lambda (condx)433 ((editor-error #'(lambda (condx) 440 434 (beep) 441 (format t "~&~a" condx) 435 (let ((string (editor-error-format-string condx))) 436 (when string 437 (apply #'message string 438 (editor-error-format-arguments condx)))) 439 442 440 (throw 'command-loop-catcher nil)))) 443 (vector-push-extend key-event cmd) 444 (setf (fill-pointer trans) 0) 445 (multiple-value-bind (trans-result prefix-p) 446 (translate-key cmd trans) 447 #+debug 448 (format t "~& trans-result = ~s, prefix-p = ~s" trans-result prefix-p) 449 (multiple-value-bind (res t-bindings) 450 (get-current-binding trans-result) 451 (etypecase res 452 (command 453 (let ((punt t)) 454 #+debug 455 (format t "~& key-event = ~s, res = ~s, t-bindings = ~s, prefix = ~s" 456 key-event 457 res t-bindings 458 (command-interpreter-info-prefix-argument info)) 459 (catch 'command-loop-catcher 460 (dolist (c t-bindings) 461 (funcall *invoke-hook* c (command-interpreter-info-prefix-argument info))) 462 (funcall *invoke-hook* res (command-interpreter-info-prefix-argument info)) 463 (setf punt nil)) 464 (when punt (invoke-hook hemlock::command-abort-hook))) 465 (if (command-interpreter-info-command-type-set info) 466 (setf (command-interpreter-info-command-type-set info) nil) 467 (setf (command-interpreter-info-last-command-type info) nil)) 468 (if (command-interpreter-info-prefix-argument-supplied info) 469 (setf (command-interpreter-info-prefix-argument-supplied info) nil) 470 (setf (command-interpreter-info-prefix-argument info) nil)) 471 (setf (fill-pointer cmd) 0)) 472 (null 473 (unless prefix-p 474 (beep) 475 (setf (command-interpreter-info-prefix-argument info) nil) 476 (setf (fill-pointer cmd) 0))) 477 (hash-table))))))) 441 (unless (eq *current-buffer* *echo-area-buffer*) 442 (when (buffer-modified *echo-area-buffer*) (clear-echo-area)) 443 (unless (or (zerop (length cmd)) 444 (not (value hemlock::key-echo-delay))) 445 (editor-sleep (value hemlock::key-echo-delay)) 446 (unless t 447 (clear-echo-area) 448 (dotimes (i (length cmd)) 449 (hemlock-ext:print-pretty-key (aref cmd i) *echo-area-stream*) 450 (write-char #\space *echo-area-stream*))))) 451 (cond (func 452 (setf (command-interpreter-info-function info) nil) 453 (funcall func key-event)) 454 (t 455 (vector-push-extend key-event cmd) 456 (setf (fill-pointer trans) 0) 457 (multiple-value-bind (trans-result prefix-p) 458 (translate-key cmd trans) 459 #+debug 460 (format t "~& trans-result = ~s, prefix-p = ~s" trans-result prefix-p) 461 (multiple-value-bind (res t-bindings) 462 (get-current-binding trans-result) 463 (etypecase res 464 (command 465 (let ((punt t)) 466 #+debug 467 (format t "~& key-event = ~s, res = ~s, t-bindings = ~s, prefix = ~s" 468 key-event 469 res t-bindings 470 (command-interpreter-info-prefix-argument info)) 471 (catch 'command-loop-catcher 472 (dolist (c t-bindings) 473 (funcall *invoke-hook* c (command-interpreter-info-prefix-argument info))) 474 (funcall *invoke-hook* res (command-interpreter-info-prefix-argument info)) 475 (setf punt nil)) 476 (when punt (invoke-hook hemlock::command-abort-hook))) 477 (if (command-interpreter-info-command-type-set info) 478 (setf (command-interpreter-info-command-type-set info) nil) 479 (setf (command-interpreter-info-last-command-type info) nil)) 480 (if (command-interpreter-info-prefix-argument-supplied info) 481 (setf (command-interpreter-info-prefix-argument-supplied info) nil) 482 (setf (command-interpreter-info-prefix-argument info) nil)) 483 (setf (fill-pointer cmd) 0)) 484 (null 485 (unless prefix-p 486 (beep) 487 (setf (command-interpreter-info-prefix-argument info) nil) 488 (setf (fill-pointer cmd) 0))) 489 (hash-table))))))))) 478 490 479 491 ;;; %COMMAND-LOOP -- Internal
Note:
See TracChangeset
for help on using the changeset viewer.
