eval-for-emacs

swank.core

  • (eval-for-emacs form buffer-package id)

0 Examples top

Log in to add / edit an example.

See Also top

Log in to add a see also.

Plus_12x12 Minus_12x12 Source swank/core.clj:235 top

(defn eval-for-emacs [form buffer-package id]
  (try
   (binding [*current-package* buffer-package
             *pending-continuations* (cons id *pending-continuations*)]
     (if-let [f (slime-fn (first form))]
       (let [form (cons f (rest form))
             result (doall-seq (eval-in-emacs-package form))]
         (run-hook *pre-reply-hook*)
         (send-to-emacs `(:return ~(thread-name (current-thread))
                                  (:ok ~result) ~id)))
       ;; swank function not defined, abort
       (send-to-emacs `(:return ~(thread-name (current-thread)) (:abort) ~id))))
   (catch Throwable t
     ;; Thread/interrupted clears this thread's interrupted status; if
     ;; Thread.stop was called on us it may be set and will cause an
     ;; InterruptedException in one of the send-to-emacs calls below
     (Thread/interrupted)

     ;; (.printStackTrace t #^java.io.PrintWriter *err*)

     (cond
      (debug-quit-exception? t)
      (do
        (send-to-emacs `(:return ~(thread-name (current-thread)) (:abort) ~id))
        (if-not (zero? *sldb-level*)
          (throw t)))

      (debug-abort-exception? t)
      (do
        (send-to-emacs `(:return ~(thread-name (current-thread)) (:abort) ~id))
        (if-not (zero? *sldb-level*)
          (throw *debug-abort-exception*)))

      (debug-continue-exception? t)
      (do
        (send-to-emacs `(:return ~(thread-name (current-thread)) (:abort) ~id))
        (throw t))

      :else
      (do
        (set! *e t)
        (try
         (sldb-debug
          nil
          (if *debug-swank-clojure* t (.getCause t))
          id)
         ;; reply with abort
         (finally (send-to-emacs `(:return ~(thread-name (current-thread)) (:abort) ~id)))))))))
Vars in swank.core/eval-for-emacs: *e binding cond defn if-let if-not let zero? concat list seq
Used in 0 other vars

Comments top

No comments for eval-for-emacs. Log in to add a comment.