Changeset 699
- Timestamp:
- Mar 22, 2004, 9:36:27 AM (21 years ago)
- File:
-
- 1 edited
-
trunk/ccl/hemlock/src/interp.lisp (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/ccl/hemlock/src/interp.lisp
r674 r699 422 422 423 423 424 (defun interpret-key-event (key-event info) 425 (setf (command-interpreter-info-prefix-argument info) nil) 426 (let* ((*last-key-event-typed* key-event) 427 (*current-command-info* info) 428 (cmd (command-interpreter-info-current-command info)) 429 (trans (command-interpreter-info-current-translation info)) 430 (func (current-event-mode))) 431 (handler-bind 432 ;; Bind this outside the invocation loop to save consing. 433 ((editor-error #'(lambda (condx) 434 (beep) 435 (let ((string (editor-error-format-string condx))) 436 (when string 437 (apply #'message string 438 (editor-error-format-arguments condx)))) 439 440 (throw 'command-loop-catcher nil)))) 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 (funcall func key-event)) 453 (t 454 (vector-push-extend key-event cmd) 455 (setf (fill-pointer trans) 0) 456 (multiple-value-bind (trans-result prefix-p) 457 (translate-key cmd trans) 458 #+debug 459 (format t "~& trans-result = ~s, prefix-p = ~s" trans-result prefix-p) 460 (multiple-value-bind (res t-bindings) 461 (get-current-binding trans-result) 462 (etypecase res 463 (command 464 (let ((punt t)) 465 #+debug 466 (format t "~& key-event = ~s, res = ~s, t-bindings = ~s, prefix = ~s" 467 key-event 468 res t-bindings 469 (command-interpreter-info-prefix-argument info)) 470 (catch 'command-loop-catcher 471 (dolist (c t-bindings) 472 (funcall *invoke-hook* c (command-interpreter-info-prefix-argument info))) 473 (funcall *invoke-hook* res (command-interpreter-info-prefix-argument info)) 474 (setf punt nil)) 475 (when punt (invoke-hook hemlock::command-abort-hook))) 476 (if (command-interpreter-info-command-type-set info) 477 (setf (command-interpreter-info-command-type-set info) nil) 478 (setf (command-interpreter-info-last-command-type info) nil)) 479 (if (command-interpreter-info-prefix-argument-supplied info) 480 (setf (command-interpreter-info-prefix-argument-supplied info) nil) 481 (setf (command-interpreter-info-prefix-argument info) nil)) 482 (setf (fill-pointer cmd) 0)) 483 (null 484 (unless prefix-p 485 (beep) 486 (setf (command-interpreter-info-prefix-argument info) nil) 487 (setf (fill-pointer cmd) 0))) 488 (hash-table))))))))) 424 489 425 490 426 ;;; %COMMAND-LOOP -- Internal … … 492 428 ;;; Read commands from the terminal and execute them, forever. 493 429 ;;; 494 #+original495 430 (defun %command-loop () 496 431 (let ((cmd *current-command*) … … 513 448 (throw 'command-loop-catcher nil))))) 514 449 (loop 515 (unless (eq *current-buffer* *echo-area-buffer*) 516 (when (buffer-modified *echo-area-buffer*) (clear-echo-area)) 517 (unless (or (zerop (length cmd)) 518 (not (value hemlock::key-echo-delay))) 519 (editor-sleep (value hemlock::key-echo-delay)) 520 (unless (listen-editor-input *editor-input*) 521 (clear-echo-area) 522 (dotimes (i (length cmd)) 523 (hemlock-ext:print-pretty-key (aref cmd i) *echo-area-stream*) 524 (write-char #\space *echo-area-stream*))))) 525 (vector-push-extend (get-key-event *editor-input*) cmd) 526 (multiple-value-bind (trans-result prefix-p) 527 (translate-key cmd trans) 528 (multiple-value-bind (res t-bindings) 529 (get-current-binding trans-result) 530 (etypecase res 531 (command 532 (let ((punt t)) 533 (catch 'command-loop-catcher 534 (dolist (c t-bindings) 535 (funcall *invoke-hook* c *prefix-argument*)) 536 (funcall *invoke-hook* res *prefix-argument*) 537 (setf punt nil)) 538 (when punt (invoke-hook hemlock::command-abort-hook))) 539 (if *command-type-set* 540 (setq *command-type-set* nil) 541 (setq *last-command-type* nil)) 542 (if *prefix-argument-supplied* 543 (setq *prefix-argument-supplied* nil) 544 (setq *prefix-argument* nil)) 545 (setf (fill-pointer cmd) 0)) 546 (null 547 (unless prefix-p 548 (beep) 549 (setq *prefix-argument* nil) 550 (setf (fill-pointer cmd) 0))) 551 (hash-table)))))))) 552 553 (defun %command-loop () 554 (format t "~& in %command-loop: current buffer = ~s" (current-buffer))) 450 (let* ((temporary-object-pool (allocate-temporary-object-pool))) 451 (unwind-protect 452 (progn 453 (unless (eq *current-buffer* *echo-area-buffer*) 454 (when (buffer-modified *echo-area-buffer*) (clear-echo-area)) 455 (unless (or (zerop (length cmd)) 456 (not (value hemlock::key-echo-delay))) 457 (editor-sleep (value hemlock::key-echo-delay)) 458 (unless (listen-editor-input *editor-input*) 459 (clear-echo-area) 460 (dotimes (i (length cmd)) 461 (hemlock-ext:print-pretty-key (aref cmd i) *echo-area-stream*) 462 (write-char #\space *echo-area-stream*))))) 463 (vector-push-extend (get-key-event *editor-input*) cmd) 464 (multiple-value-bind (trans-result prefix-p) 465 (translate-key cmd trans) 466 (multiple-value-bind (res t-bindings) 467 (get-current-binding trans-result) 468 (etypecase res 469 (command 470 (let ((punt t)) 471 (catch 'command-loop-catcher 472 (dolist (c t-bindings) 473 (funcall *invoke-hook* c *prefix-argument*)) 474 (funcall *invoke-hook* res *prefix-argument*) 475 (setf punt nil)) 476 (when punt (invoke-hook hemlock::command-abort-hook))) 477 (if *command-type-set* 478 (setq *command-type-set* nil) 479 (setq *last-command-type* nil)) 480 (if *prefix-argument-supplied* 481 (setq *prefix-argument-supplied* nil) 482 (setq *prefix-argument* nil)) 483 (setf (fill-pointer cmd) 0)) 484 (null 485 (unless prefix-p 486 (beep) 487 (setq *prefix-argument* nil) 488 (setf (fill-pointer cmd) 0))) 489 (hash-table))))) 490 (free-temporary-objects temporary-object-pool))))))) 491 492 493 494 495 555 496 556 497
Note:
See TracChangeset
for help on using the changeset viewer.
