Changeset 719


Ignore:
Timestamp:
Mar 25, 2004, 1:03:48 AM (16 years ago)
Author:
gb
Message:

Eval-region via selection queue mechanism.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/ccl/hemlock/src/listener.lisp

    r697 r719  
    2525
    2626
    27 (defun pakage-name-change-hook (name kind where new-value)
     27(defun package-name-change-hook (name kind where new-value)
    2828  (declare (ignore name new-value))
    2929  (if (eq kind :buffer)
     
    450450          (t (region start end)))))
    451451
     452(defun eval-region (region
     453                    &key
     454                    (package (value current-package))
     455                    (path (buffer-pathname (current-buffer))))
     456  (evaluate-input-selection
     457   (ccl::make-input-selection
     458    :package package
     459    :source-file path
     460    :string-stream (make-string-input-stream
     461                    (region-to-string region)))))                   
     462       
     463                                       
     464
    452465(defun editor-compile-region (region &optional quiet)
    453466  (unless quiet (message "Compiling region ..."))
    454   (in-lisp
    455    (with-input-from-region (stream region)
    456      (with-pop-up-display (*error-output* :height 19)
    457        ;; JDz: We don't record source locations and what not, but this
    458        ;; is portable.  CMUCL specific implementation removed because
    459        ;; it does not work on HEMLOCK-REGION-STREAM (but it can be
    460        ;; added back later if CMUCL starts using user-extensible
    461        ;; streams internally.)
    462        (funcall (compile nil `(lambda ()
    463                                 ,@(loop for form = (read stream nil stream)
    464                                         until (eq form stream)
    465                                         collect form))))))))
     467  (eval-region region))
    466468
    467469
     
    472474  (declare (ignore p))
    473475  (if (region-active-p)
    474       (editor-evaluate-region-command nil)
    475       (with-input-from-region (stream (defun-region (current-point)))
    476         (clear-echo-area)
    477         (in-lisp
    478          (message "Editor Evaluation returned ~S"
    479                   (eval (read stream)))))))
     476    (editor-evaluate-region-command nil)
     477    (eval-region (defun-region (current-point)))))
    480478
    481479(defcommand "Editor Evaluate Region" (p)
     
    483481  "Evaluates lisp forms between the point and the mark in the editor Lisp."
    484482  (declare (ignore p))
    485   (with-input-from-region (stream (current-region))
    486     (clear-echo-area)
    487     (write-string "Evaluating region in the editor ..." *echo-area-stream*)
    488     (finish-output *echo-area-stream*)
    489     (in-lisp
    490      (do ((object (read stream nil lispbuf-eof)
    491                   (read stream nil lispbuf-eof)))
    492          ((eq object lispbuf-eof))
    493        (eval object)))
    494     (message "Evaluation complete.")))
     483  (eval-region (current-region)))
    495484           
    496485(defcommand "Editor Re-evaluate Defvar" (p)
Note: See TracChangeset for help on using the changeset viewer.