Public Vars

Back

not (clj)

(source)

function

(not x)
Returns true if x is logical false, false otherwise.

Examples

clojure
(deftest division
  (is (= clojure.core// /))
  (binding [*ns* *ns*]
    (eval '(do (ns foo
                 (:require [clojure.core :as bar])
                 (:use [clojure.test]))
               (is (= clojure.core// bar//))))))

(deftest Instants
  (testing "Instants are read as java.util.Date by default"
    (is (= java.util.Date (class #inst "2010-11-12T13:14:15.666"))))
  (let [s "#inst \"2010-11-12T13:14:15.666-06:00\""]
    (binding [*data-readers* {'inst read-instant-date}]
      (testing "read-instant-date produces java.util.Date"
        (is (= java.util.Date (class (read-string s)))))
      (testing "java.util.Date instants round-trips"
        (is (= (-> s read-string)
               (-> s read-string pr-str read-string))))
      (testing "java.util.Date instants round-trip throughout the year"
        (doseq [month (range 1 13) day (range 1 29) hour (range 1 23)]
          (let [s (format "#inst \"2010-%02d-%02dT%02d:14:15.666-06:00\"" month day hour)]
            (is (= (-> s read-string)
                   (-> s read-string pr-str read-string))))))
      (testing "java.util.Date handling DST in time zones"
        (let [dtz (TimeZone/getDefault)]
          (try
            ;; A timezone with DST in effect during 2010-11-12
            (TimeZone/setDefault (TimeZone/getTimeZone "Australia/Sydney"))
            (is (= (-> s read-string)
                   (-> s read-string pr-str read-string)))
            (finally (TimeZone/setDefault dtz)))))
      (testing "java.util.Date should always print in UTC"
        (let [d (read-string s)
              pstr (print-str d)
              len (.length pstr)]
          (is (= (subs pstr (- len 7)) "-00:00\"")))))
    (binding [*data-readers* {'inst read-instant-calendar}]
      (testing "read-instant-calendar produces java.util.Calendar"
        (is (instance? java.util.Calendar (read-string s))))
      (testing "java.util.Calendar round-trips"
        (is (= (-> s read-string)
               (-> s read-string pr-str read-string))))
      (testing "java.util.Calendar remembers timezone in literal"
        (is (= "#inst \"2010-11-12T13:14:15.666-06:00\""
               (-> s read-string pr-str)))
        (is (= (-> s read-string)
               (-> s read-string pr-str read-string))))
      (testing "java.util.Calendar preserves milliseconds"
        (is (= 666 (-> s read-string
                       (.get java.util.Calendar/MILLISECOND)))))))
  (let [s "#inst \"2010-11-12T13:14:15.123456789\""
        s2 "#inst \"2010-11-12T13:14:15.123\""
        s3 "#inst \"2010-11-12T13:14:15.123456789123\""]
    (binding [*data-readers* {'inst read-instant-timestamp}]
      (testing "read-instant-timestamp produces java.sql.Timestamp"
        (is (= java.sql.Timestamp (class (read-string s)))))
      (testing "java.sql.Timestamp preserves nanoseconds"
        (is (= 123456789 (-> s read-string .getNanos)))
        (is (= 123456789 (-> s read-string pr-str read-string .getNanos)))
        ;; truncate at nanos for s3
        (is (= 123456789 (-> s3 read-string pr-str read-string .getNanos))))
      (testing "java.sql.Timestamp should compare nanos"
        (is (= (read-string s) (read-string s3)))
        (is (not= (read-string s) (read-string s2)))))
    (binding [*data-readers* {'inst read-instant-date}]
      (testing "read-instant-date should truncate at milliseconds"
        (is (= (read-string s) (read-string s2) (read-string s3))))))
  (let [s "#inst \"2010-11-12T03:14:15.123+05:00\""
        s2 "#inst \"2010-11-11T22:14:15.123Z\""]
    (binding [*data-readers* {'inst read-instant-date}]
      (testing "read-instant-date should convert to UTC"
        (is (= (read-string s) (read-string s2)))))
    (binding [*data-readers* {'inst read-instant-timestamp}]
      (testing "read-instant-timestamp should convert to UTC"
        (is (= (read-string s) (read-string s2)))))
    (binding [*data-readers* {'inst read-instant-calendar}]
      (testing "read-instant-calendar should preserve timezone"
        (is (not= (read-string s) (read-string s2)))))))

(deftest UUID
  (is (= java.util.UUID (class #uuid "550e8400-e29b-41d4-a716-446655440000")))
  (is (.equals #uuid "550e8400-e29b-41d4-a716-446655440000"
               #uuid "550e8400-e29b-41d4-a716-446655440000"))
  (is (not (identical? #uuid "550e8400-e29b-41d4-a716-446655440000"
                       #uuid "550e8400-e29b-41d4-a716-446655440000")))
  (is (= 4 (.version #uuid "550e8400-e29b-41d4-a716-446655440000")))
  (is (= (print-str #uuid "550e8400-e29b-41d4-a716-446655440000")
         "#uuid \"550e8400-e29b-41d4-a716-446655440000\"")))

(defspec types-that-should-roundtrip
  roundtrip
  [^{:tag cgen/ednable} o]
  (when-not (= o %)
    (throw (ex-info "Value cannot roundtrip, see ex-data" {:printed o :read %}))))

(defspec types-that-need-dup-to-roundtrip
  roundtrip-dup
  [^{:tag cgen/dup-readable} o]
  (when-not (= o %)
    (throw (ex-info "Value cannot roundtrip, see ex-data" {:printed o :read %}))))

(deftest preserve-read-cond-test
  (let [x (read-string {:read-cond :preserve} "#?(:clj foo :cljs bar)" )]
       (is (reader-conditional? x))
       (is (not (:splicing? x)))
       (is (= :foo (get x :no-such-key :foo)))
       (is (= (:form x) '(:clj foo :cljs bar)))
       (is (= x (reader-conditional '(:clj foo :cljs bar) false))))
  (let [x (read-string {:read-cond :preserve} "#?@(:clj [foo])" )]
       (is (reader-conditional? x))
       (is (:splicing? x))
       (is (= :foo (get x :no-such-key :foo)))
       (is (= (:form x) '(:clj [foo])))
       (is (= x (reader-conditional '(:clj [foo]) true))))
  (is (thrown-with-msg? RuntimeException #"No reader function for tag"
                        (read-string {:read-cond :preserve} "#js {:x 1 :y 2}" )))
  (let [x (read-string {:read-cond :preserve} "#?(:cljs #js {:x 1 :y 2})")
        [platform tl] (:form x)]
       (is (reader-conditional? x))
       (is (tagged-literal? tl))
       (is (= 'js (:tag tl)))
       (is (= {:x 1 :y 2} (:form tl)))
       (is (= :foo (get tl :no-such-key :foo)))
       (is (= tl (tagged-literal 'js {:x 1 :y 2}))))
  (testing "print form roundtrips"
           (doseq [s ["#?(:clj foo :cljs bar)"
                      "#?(:cljs #js {:x 1, :y 2})"
                      "#?(:clj #clojure.test_clojure.reader.TestRecord [42 85])"]]
                  (is (= s (pr-str (read-string {:read-cond :preserve} s)))))))

(deftest reader-conditionals
  (testing "basic read-cond"
    (is (= '[foo-form]
           (read-string {:read-cond :allow :features #{:foo}} "[#?(:foo foo-form :bar bar-form)]")))
    (is (= '[bar-form]
           (read-string {:read-cond :allow :features #{:bar}} "[#?(:foo foo-form :bar bar-form)]")))
    (is (= '[foo-form]
           (read-string {:read-cond :allow :features #{:foo :bar}} "[#?(:foo foo-form :bar bar-form)]")))
    (is (= '[]
           (read-string {:read-cond :allow :features #{:baz}} "[#?( :foo foo-form :bar bar-form)]"))))
  (testing "environmental features"
    (is (= "clojure" #?(:clj "clojure" :cljs "clojurescript" :default "default"))))
  (testing "default features"
    (is (= "default" #?(:clj-clr "clr" :cljs "cljs" :default "default"))))
  (testing "splicing"
    (is (= [] [#?@(:clj [])]))
    (is (= [:a] [#?@(:clj [:a])]))
    (is (= [:a :b] [#?@(:clj [:a :b])]))
    (is (= [:a :b :c] [#?@(:clj [:a :b :c])]))
    (is (= [:a :b :c] [#?@(:clj [:a :b :c])])))
  (testing "nested splicing"
    (is (= [:a :b :c :d :e]
           [#?@(:clj [:a #?@(:clj [:b #?@(:clj [:c]) :d]):e])]))
    (is (= '(+ 1 (+ 2 3))
           '(+ #?@(:clj [1 (+ #?@(:clj [2 3]))]))))
    (is (= '(+ (+ 2 3) 1)
           '(+ #?@(:clj [(+ #?@(:clj [2 3])) 1]))))
    (is (= [:a [:b [:c] :d] :e]
           [#?@(:clj [:a [#?@(:clj [:b #?@(:clj [[:c]]) :d])] :e])])))
  (testing "bypass unknown tagged literals"
    (is (= [1 2 3] #?(:cljs #js [1 2 3] :clj [1 2 3])))
    (is (= :clojure #?(:foo #some.nonexistent.Record {:x 1} :clj :clojure))))
  (testing "error cases"
    (is (thrown-with-msg? RuntimeException #"Feature should be a keyword" (read-string {:read-cond :allow} "#?((+ 1 2) :a)")))
    (is (thrown-with-msg? RuntimeException #"even number of forms" (read-string {:read-cond :allow} "#?(:cljs :a :clj)")))
    (is (thrown-with-msg? RuntimeException #"read-cond-splicing must implement" (read-string {:read-cond :allow} "#?@(:clj :a)")))
    (is (thrown-with-msg? RuntimeException #"is reserved" (read-string {:read-cond :allow} "#?@(:foo :a :else :b)")))
    (is (thrown-with-msg? RuntimeException #"must be a list" (read-string {:read-cond :allow} "#?[:foo :a :else :b]")))
    (is (thrown-with-msg? RuntimeException #"Conditional read not allowed" (read-string {:read-cond :BOGUS} "#?[:clj :a :default nil]")))
    (is (thrown-with-msg? RuntimeException #"Conditional read not allowed" (read-string "#?[:clj :a :default nil]")))
    (is (thrown-with-msg? RuntimeException #"Reader conditional splicing not allowed at the top level" (read-string {:read-cond :allow} "#?@(:clj [1 2])")))
    (is (thrown-with-msg? RuntimeException #"Reader conditional splicing not allowed at the top level" (read-string {:read-cond :allow} "#?@(:clj [1])")))
    (is (thrown-with-msg? RuntimeException #"Reader conditional splicing not allowed at the top level" (read-string {:read-cond :allow} "#?@(:clj []) 1"))))
  (testing "clj-1698-regression"
    (let [opts {:features #{:clj} :read-cond :allow}]
      (is (= 1 (read-string opts "#?(:cljs {'a 1 'b 2} :clj 1)")))
      (is (= 1 (read-string opts "#?(:cljs (let [{{b :b} :a {d :d} :c} {}]) :clj 1)")))
      (is (= '(def m {}) (read-string opts "(def m #?(:cljs ^{:a :b} {} :clj  ^{:a :b} {}))")))
      (is (= '(def m {}) (read-string opts "(def m #?(:cljs ^{:a :b} {} :clj ^{:a :b} {}))")))
      (is (= 1 (read-string opts "#?(:cljs {:a #_:b :c} :clj 1)")))))
  (testing "nil expressions"
    (is (nil? #?(:default nil)))
    (is (nil? #?(:foo :bar :clj nil)))
    (is (nil? #?(:clj nil :foo :bar)))
    (is (nil? #?(:foo :bar :default nil)))))
clojure
(ns clojure.test-clojure.server
    (:import java.util.Random)
    (:require [clojure.test :refer :all])
    (:require [clojure.core.server :as s]))

(defn create-random-thread
  []
  (Thread.
    (fn []
      (let [random (new Random)]
      (while (not (.isInterrupted (Thread/currentThread)))
        (System/setProperty (Integer/toString (.nextInt random)) (Integer/toString (.nextInt random))))))))
dundalek/closh
(defmacro def-eval []
  (if (System/getenv "__CLOSH_USE_SCI_EVAL__")
    `(do (require 'closh.zero.utils.sci)
         (def ~'eval closh.zero.utils.sci/sci-eval))
    `(def ~'eval clojure.core/eval)))

(defmacro eval-closh-requires []
  (when-not (System/getenv "__CLOSH_USE_SCI_EVAL__")
    `(eval closh.zero.env/*closh-environment-requires*)))
hraberg/deuce
(ns deuce.emacs
  (:require [clojure.core :as c]
            [deuce.emacs-lisp :as el]
            [deuce.emacs-lisp.globals :as globals])
  (:refer-clojure :only [])
  (:use [deuce.emacs-lisp :only [and apply-partially catch cond condition-case defconst define-compiler-macro defmacro
                                 defun defvar function if interactive lambda let let* or prog1 prog2 progn quote
                                 save-current-buffer save-excursion save-restriction setq setq-default
                                 unwind-protect while throw]]
        [deuce.emacs.alloc]
        [deuce.emacs.buffer]
        [deuce.emacs.bytecode]
        [deuce.emacs.callint]
        [deuce.emacs.callproc]
        [deuce.emacs.casefiddle]
        [deuce.emacs.casetab]
        [deuce.emacs.category]
        [deuce.emacs.ccl]
        [deuce.emacs.character]
        [deuce.emacs.charset]
        [deuce.emacs.chartab]
        [deuce.emacs.cmds]
        [deuce.emacs.coding]
        [deuce.emacs.composite]
        [deuce.emacs.data]
        [deuce.emacs.dired]
        [deuce.emacs.dispnew]
        [deuce.emacs.doc]
        [deuce.emacs.editfns]
        [deuce.emacs.emacs]
        [deuce.emacs.eval]
        [deuce.emacs.fileio]
        [deuce.emacs.filelock]
        [deuce.emacs.floatfns]
        [deuce.emacs.fns]
        [deuce.emacs.font]
        [deuce.emacs.frame]
        [deuce.emacs.indent]
        [deuce.emacs.insdel]
        [deuce.emacs.keyboard]
        [deuce.emacs.keymap]
        [deuce.emacs.lread]
        [deuce.emacs.macros]
        [deuce.emacs.marker]
        [deuce.emacs.menu]
        [deuce.emacs.minibuf]
        [deuce.emacs.print]
        [deuce.emacs.process]
        [deuce.emacs.search]
        [deuce.emacs.syntax]
        [deuce.emacs.term]
        [deuce.emacs.terminal]
        [deuce.emacs.textprop]
        [deuce.emacs.undo]
        [deuce.emacs.window]
        [deuce.emacs.xdisp]
        [deuce.emacs.xfaces]
        [deuce.emacs.xml]))

;; Hack for a predicate in cl.el, this is defined in emacs-lisp/bytecomp.el, which we're not using
(defun byte-compile-file-form (form))
;; ;; AOT cl.el gets confused by this alias
(defalias 'cl-block-wrapper 'identity)
(defmacro declare (&rest _specs) nil)
;; with-no-warnings in byte-run.el needs this
(defun last (list &optional n))
;; subr defines a simpler dolist, which custom uses, which gets redefined by cl-macs.
;; During AOT custom loads the latter dolist definition, requiring 'block' - not yet defined.
;; cl cannot be loaded first, as it depends on help-fns, which depend on custom.
(defmacro block (name &rest body) (cons 'progn body))
;; Hack as delayed-eval doesn't (like some other things) work properly inside let-bindings.
;; Needs to be fixed properly, but let's see if we can get through the boot with this hack.
;; cl-setf-simple-store-p is used in  cl-macs/cl-setf-do-modify, delayed-eval call refers to earlier binding 'method'.
(defun cl-setf-simple-store-p (sym form))
;; Same issue in regexp-opt/regexp-opt. Calls this fn with earlier binding 'sorted-strings'
(defun regexp-opt-group (strings &optional paren lax))

;; Keymap setup, should in theory be in deuce.emacs.keymap, but cannot for a reason I forgot.
(setq global-map (make-keymap))
(use-global-map (symbol-value 'global-map))
hraberg/deuce
(ns deuce.emacs.eval
  (:use [deuce.emacs-lisp :only (defun defvar)])
  (:require [clojure.core :as c]
            [deuce.emacs.alloc :as alloc]
            [deuce.emacs.data :as data]
            [deuce.emacs-lisp.cons :as cons]
            [deuce.emacs-lisp :as el])
  (:import [clojure.lang Var])
  (:refer-clojure :exclude [apply eval macroexpand]))

(defvar macro-declaration-function nil
  "Function to process declarations in a macro definition.
  The function will be called with two args MACRO and DECL.
  MACRO is the name of the macro being defined.
  DECL is a list `(declare ...)' containing the declarations.
  The value the function returns is not used.")

(defvar quit-flag nil
  "Non-nil causes `eval' to abort, unless `inhibit-quit' is non-nil.
  If the value is t, that means do an ordinary quit.
  If the value equals `throw-on-input', that means quit by throwing
  to the tag specified in `throw-on-input'; it's for handling `while-no-input'.
  Typing C-g sets `quit-flag' to t, regardless of `inhibit-quit',
  but `inhibit-quit' non-nil prevents anything from taking notice of that.")

(defvar debug-ignored-errors nil
  "*List of errors for which the debugger should not be called.
  Each element may be a condition-name or a regexp that matches error messages.
  If any element applies to a given error, that error skips the debugger
  and just returns to top level.
  This overrides the variable `debug-on-error'.
  It does not apply to errors handled by `condition-case'.

(defvar debug-on-quit nil
  "*Non-nil means enter debugger if quit is signaled (C-g, for example).
  Does not apply if quit is handled by a `condition-case'.

(defvar debug-on-error nil
  "*Non-nil means enter debugger if an error is signaled.
  Does not apply to errors handled by `condition-case' or those
  matched by `debug-ignored-errors'.
  If the value is a list, an error only means to enter the debugger
  if one of its condition symbols appears in the list.
  When you evaluate an expression interactively, this variable
  is temporarily non-nil if `eval-expression-debug-on-error' is non-nil.
  The command `toggle-debug-on-error' toggles this.
  See also the variable `debug-on-quit'.

(defvar debugger-may-continue nil
  "Non-nil means debugger may continue execution.
  This is nil when the debugger is called under circumstances where it
  might not be safe to continue.")

(defun autoload (function file &optional docstring interactive type)
  "Define FUNCTION to autoload from FILE.
  FUNCTION is a symbol; FILE is a file name string to pass to `load'.
  Third arg DOCSTRING is documentation for the function.
  Fourth arg INTERACTIVE if non-nil says function can be called interactively.
  Fifth arg TYPE indicates the type of the object:
     nil or omitted says FUNCTION is a function,
     `keymap' says FUNCTION is really a keymap, and
     `macro' or t says FUNCTION is really a macro.
  Third through fifth args give info about the real definition.
  They default to nil.
  If FUNCTION is already defined other than as an autoload,
  this does nothing and returns nil."
  (when (or (not (el/fun function)) (-> (el/fun function) meta :autoload))
    (let [macro? (= 'macro type)
          autoload-symbol (fn autoload-symbol [function]
                            (let [f (el/fun function)]
                              (when (-> f meta :autoload)
                                (ns-unmap 'deuce.emacs (el/sym function))
                                ((el/fun 'load) (-> f meta :file) nil true))))
          definition  (if macro?
                        (fn autoload-macro [&form &env & args] ;; Note implicit macro args, see defalias
                          (do
                            (autoload-symbol function)
                            `(el/progn (~(el/sym function) ~@args))))
                        (fn autoload [& args]
                          (autoload-symbol function)
                          (c/apply (el/fun function) args)))] ;; el->clj?
      (ns-unmap 'deuce.emacs function)
      (el/defvar-helper* 'deuce.emacs function definition docstring)
      (alter-meta! (el/fun function) merge {:autoload true :file file} (when interactive {:interactive nil}))
      (when macro? (.setMacro ^Var (el/fun function))))
    function))

(defun signal (error-symbol data)
  "Signal an error.  Args are ERROR-SYMBOL and associated DATA.
  This function does not return.

(defun called-interactively-p (kind)
  "Return t if the containing function was called by `call-interactively'.
  If KIND is `interactive', then only return t if the call was made
  interactively by the user, i.e. not in `noninteractive' mode nor
  when `executing-kbd-macro'.
  If KIND is `any', on the other hand, it will return t for any kind of
  interactive call, including being called as the binding of a key, or
  from a keyboard macro, or in `noninteractive' mode.

  Instead of using this function, it is sometimes cleaner to give your
  function an extra optional argument whose `interactive' spec specifies
  non-nil unconditionally (\"p\" is a good way to do this), or via
  (not (or executing-kbd-macro noninteractive))."
  nil)

(defun run-hook-with-args (hook &rest args)
  "Run HOOK with the specified arguments ARGS.
  HOOK should be a symbol, a hook variable.  If HOOK has a non-nil
  value, that value may be a function or a list of functions to be
  called to run the hook.  If the value is a function, it is called with
  the given arguments and its return value is returned.  If it is a list
  of functions, those functions are called, in order,
  with the given arguments ARGS.
  It is best not to depend on the value returned by `run-hook-with-args',
  as that may change.

  Do not use `make-local-variable' to make a hook variable buffer-local.
  Instead, use `add-hook' and specify t for the LOCAL argument."
  (when-let [hook (el/global hook)]
    (let [hook @hook]
      (doall (map #(c/apply funcall % args) (if (fn? hook) [hook] hook))))))

  Return t if the containing function was run directly by user input.
  This means that the function was called with `call-interactively'
  (which includes being called as the binding of a key)
  and input is currently coming from the keyboard (not a keyboard macro),
  and Emacs is not running in batch mode (`noninteractive' is nil).

(defun defvaralias (new-alias base-variable &optional docstring)
  "Make NEW-ALIAS a variable alias for symbol BASE-VARIABLE.
  Aliased variables always have the same value; setting one sets the other.
  Third arg DOCSTRING, if non-nil, is documentation for NEW-ALIAS.  If it is
  omitted or nil, NEW-ALIAS gets the documentation string of BASE-VARIABLE,
  or of the variable at the end of the chain of aliases, if BASE-VARIABLE is
  itself an alias.  If NEW-ALIAS is bound, and BASE-VARIABLE is not,
  then the value of BASE-VARIABLE is set to that of NEW-ALIAS.
  The return value is BASE-VARIABLE."
  (if-let [base (el/global base-variable)]
    (el/defvar-helper* 'deuce.emacs-lisp.globals new-alias
      @base (or docstring (-> base meta :doc)))
    (when-let [new (el/global new-alias)]
      (el/defvar-helper* 'deuce.emacs-lisp.globals base-variable
        @new (or docstring (-> new meta :doc)))))
  base-variable)

  Do not use `make-local-variable' to make a hook variable buffer-local.
  Instead, use `add-hook' and specify t for the LOCAL argument."
  (some identity (apply run-hook-with-args hook args)))

  Do not use `make-local-variable' to make a hook variable buffer-local.
  Instead, use `add-hook' and specify t for the LOCAL argument."
  (or (some (complement identity) (apply run-hook-with-args hook args))
      true))

  Major modes should not use this function directly to run their mode
  hook; they should use `run-mode-hooks' instead.

  Do not use `make-local-variable' to make a hook variable buffer-local.
  Instead, use `add-hook' and specify t for the LOCAL argument."
  (doseq [hook hooks]
    (run-hook-with-args hook)))

(defun backtrace-frame (nframes)
  "Return the function and arguments NFRAMES up from current execution point.
  If that frame has not evaluated the arguments yet (or is a special form),
  the value is (nil FUNCTION ARG-FORMS...).
  If that frame has evaluated its arguments and called its function already,
  the value is (t FUNCTION ARG-VALUES...).
  A &rest arg is represented as the tail of the list ARG-VALUES.
  FUNCTION is whatever was supplied as car of evaluated list,
  or a lambda expression for macro calls.
  If NFRAMES is more than the number of frames, the value is nil."
  )

  If the optional argument FOR-CALL-INTERACTIVELY is non-nil,
  then strings and vectors are not accepted."
  (if (or (data/stringp function) (data/vectorp function))
    (when-not for-call-interactively true)
    (when-let [f (el/fun function)]
      (when (contains? (meta f) :interactive)
        true))))

(defun macroexpand (form &optional environment)
  "Return result of expanding macros at top level of FORM.
  If FORM is not a macro call, it is returned unchanged.
  Otherwise, the macro is expanded and the expansion is considered
  in place of FORM.  When a non-macro-call results, it is returned.

  The second optional arg ENVIRONMENT specifies an environment of macro
  definitions to shadow the loaded ones for use in file byte-compilation."
  ;; Not sure how this is supposed to work even after reading eval.c, attempts to mimic observed behavior.
  ;; It is used in conjunction with cl-macroexpand-all, and should not expand into "raw" Clojure.
  (let [shadow (into {} (map #(vector (data/car %) (data/cdr %)) environment))
        shadow #(shadow % (shadow (str %)))
        unshadowed-form ((fn shadow-walker [form]
                           (if-let [expander (shadow form)]
                             (if (= '(true) (data/cdr-safe expander))
                               (cons (first (data/car expander))
                                     (map #(list 'quote %) (rest (data/car expander))))
                               (expander form))
                             (if (and (seq? form)
                                      (not= 'quote (first form)))
                               (cons/maybe-seq (map shadow-walker form))
                               form))) form)
        expansion (if-let [m  (and (seq? form) (-> (el/fun (first form)) meta))]
                    (if (and (:macro m) (= (the-ns 'deuce.emacs-lisp) (:ns m)))
                      unshadowed-form
                      (macroexpand-1 unshadowed-form))
                    unshadowed-form)]
    ;; Protect against eq check in cl-macroexpand-all
    (if (= form expansion)
      form
      expansion)))
hraberg/deuce
(ns deuce.emacs.menu
  (:use [deuce.emacs-lisp :only (defun defvar)])
  (:require [clojure.core :as c])
  (:refer-clojure :exclude []))

  When MENU is a keymap or a list of keymaps, the return value is the
  list of events corresponding to the user's choice. Note that
  `x-popup-menu' does not actually execute the command bound to that
  sequence of events.

  If the user gets rid of the menu without making a valid choice, for
  instance by clicking the mouse away from a valid choice or by typing
  keyboard input, then this normally results in a quit and
  `x-popup-menu' does not return.  But if POSITION is a mouse button
  event (indicating that the user invoked the menu with the mouse) then
  no quit occurs and `x-popup-menu' returns nil."
  )
hraberg/deuce
(ns deuce.emacs.term
  (:use [deuce.emacs-lisp :only (defun defvar)])
  (:require [clojure.core :as c]
            [deuce.emacs.data :as data]
            [deuce.emacs.eval :as eval]
            [deuce.emacs.terminal :as terminal])
  (:import [com.googlecode.lanterna.screen Screen])
  (:refer-clojure :exclude []))

(defvar visible-cursor nil
  "Non-nil means to make the cursor very visible.
  This only has an effect when running in a text terminal.
  What means \"very visible\" is up to your terminal.  It may make the cursor
  bigger, or it may make it blink, or it may do nothing at all.

  TERMINAL can be a terminal object, a frame, or nil (meaning the
  selected frame's terminal).  This function always returns nil if
  TERMINAL is not on a tty device."
  true)

  TERMINAL can be a terminal object, a frame, or nil (meaning the
  selected frame's terminal).  This function always returns nil if
  TERMINAL does not refer to a text-only terminal."
  true)

(defun tty-no-underline (&optional terminal)
  "Declare that the tty used by TERMINAL does not handle underlining.
  This is used to override the terminfo data, for certain terminals that
  do not really do underlining, but say that they do.  This function has
  no effect if used on a non-tty terminal.

  TERMINAL can be a terminal object, a frame or nil (meaning the
  selected frame's terminal).  This function always returns nil if
  TERMINAL does not refer to a text-only terminal."
  )

(defun tty-type (&optional terminal)
  "Return the type of the tty device that TERMINAL uses.
  Returns nil if TERMINAL is not on a tty device.

  TERMINAL can be a terminal object, a frame, or nil (meaning the
  selected frame's terminal).  This function always returns 0 if
  TERMINAL does not refer to a text-only terminal."
  ({"xterm-256color" 256} (System/getenv "TERM") 16))

  It is an error to resume a terminal while another terminal is active
  on the same device.

  `resume-tty' does nothing if it is called on a device that is not
  suspended.

  The device is restored to its default state, and Emacs ceases all
  access to the tty device.  Frames that use the device are not deleted,
  but input is not read from them and if they change, their display is
  not updated.

  `suspend-tty' does nothing if it is called on a device that is already
  suspended.