1.2.0 permalink Arrow_down_16x16

dispatch-event

swank.core

  • (dispatch-event ev conn)
Dispatches/executes an event in the control thread's mailbox queue.

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:341 top

(defn dispatch-event
   "Dispatches/executes an event in the control thread's mailbox queue."
   ([ev conn]
      (let [[action & args] ev]
        (cond
         (= action :emacs-rex)
         (let [[form-string package thread id] args
               thread (thread-for-evaluation thread conn)]
           (mb/send thread `(eval-for-emacs ~form-string ~package ~id)))

         (= action :return)
         (let [[thread & ret] args]
           (binding [*print-level* nil, *print-length* nil]
             (write-to-connection conn `(:return ~@ret))))

         (one-of? action
                  :presentation-start :presentation-end
                  :new-package :new-features :ed :percent-apply
                  :indentation-update
                  :eval-no-wait :background-message :inspect)
         (binding [*print-level* nil, *print-length* nil]
           (write-to-connection conn ev))

         (= action :write-string)
         (write-to-connection conn ev)

         (one-of? action
                  :debug :debug-condition :debug-activate :debug-return)
         (let [[thread & args] args]
           (write-to-connection conn `(~action ~(thread-map-id thread) ~@args)))

         (= action :emacs-interrupt)
         (let [[thread & args] args]
           (dosync
            (cond
             (and (true? thread) (seq @*active-threads*))
             (.stop #^Thread (first @*active-threads*))
              (= thread :repl-thread) (.stop #^Thread @(conn :repl-thread)))))
         :else
         nil))))
Vars in swank.core/dispatch-event: = and binding cond defn dosync first let seq true? concat deref list
Used in 0 other vars

Comments top

No comments for dispatch-event. Log in to add a comment.