Back
load (clj)
(source)function
(load & paths)
Loads Clojure code from resources in classpath. A path is interpreted as
classpath-relative if it begins with a slash or relative to the root
directory for the current namespace otherwise.
Examples
PrecursorApp/precursor
(ns pc.repl
"Utility functions to make repl access more convenient.
Also serves as a guide for how nses should be aliased"
(:require [cemerick.url :as url]
[cheshire.core :as json]
[clj-http.client :as http]
[clj-time.core :as time]
[clojure.core.async :as async]
[clojure.java.javadoc :refer (javadoc)]
[clojure.repl :refer :all]
[datomic.api :as d]
[pc.billing :as billing]
[pc.datomic :as pcd]
[pc.datomic.web-peer :as web-peer]
[pc.email :as email]
[pc.http.plan :as plan-http]
[pc.http.sente :as sente]
[pc.models.chat :as chat-model]
[pc.models.cust :as cust-model]
[pc.models.doc :as doc-model]
[pc.models.flag :as flag-model]
[pc.models.issue :as issue-model]
[pc.models.layer :as layer-model]
[pc.models.permission :as permission-model]
[pc.models.plan :as plan-model]
[pc.models.team :as team-model]
[pc.stripe :as stripe]
[slingshot.slingshot :refer (try+ throw+)]))
(defmacro pomegranate-load [artifact]
`(do
(require 'cemerick.pomegranate)
(cemerick.pomegranate/add-dependencies
:coordinates '[~artifact]
:repositories (merge cemerick.pomegranate.aether/maven-central {"clojars" "http://clojars.org/repo"}))))
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]))
This function returns t if (i) the first character of its
documentation is `*', or (ii) it is customizable (its property list
contains a non-nil value of `standard-value' or `custom-autoload'), or
(iii) it is an alias for a user variable.
(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 fetch-bytecode (object)
"If byte-compiled OBJECT is lazy-loaded, fetch it now."
)
Interactively callable functions include strings and vectors (treated
as keyboard macros), lambda-expressions that contain a top-level call
to `interactive', autoload definitions made by `autoload' with non-nil
fourth argument, and some of the built-in functions of Lisp.
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.emacs
(:use [deuce.emacs-lisp :only (defun defvar) :as el])
(:require [clojure.core :as c]
[deuce.emacs.alloc :as alloc]
[deuce.emacs.fns :as fns]
[deuce.emacs.terminal :as terminal]
[deuce.emacs-lisp.globals :as globals])
(:import [java.io File])
(:refer-clojure :exclude []))
Emacs tries to load the library from the files in the order they appear on
the list; if none is loaded, the running session of Emacs won't have access
to that library.
Also note that this is not a generic facility for accessing external
libraries; only those already known by Emacs will be loaded.")
(defvar after-init-time nil
"Value of `current-time' after loading the init files.
This is nil during initialization.")
(defun dump-emacs (filename symfile)
"Dump current state of Emacs into executable file FILENAME.
Take symbols from SYMFILE (presumably the file you executed to run Emacs).
This is used in the file `loadup.el' when building Emacs.
hraberg/deuce
(ns deuce.emacs.charset
(:use [deuce.emacs-lisp :only (defun defvar)])
(:require [clojure.core :as c]
[deuce.emacs.alloc :as alloc]
[deuce.emacs.fns :as fns]
[deuce.emacs-lisp.globals :as globals])
(:refer-clojure :exclude []))
(defvar inhibit-load-charset-map nil
"Inhibit loading of charset maps. Used when dumping Emacs.")
hraberg/deuce
(ns deuce.emacs.xfaces
(:use [deuce.emacs-lisp :only (defun defvar)])
(:require [clojure.core :as c])
(:refer-clojure :exclude []))
(defvar font-list-limit nil
"*Limit for font matching.
If an integer > 0, font matching functions won't load more than
that number of fonts when searching for a matching font.")
(defun x-load-color-file (filename)
"Create an alist of color entries from an external file.