Public Vars

Back

use (clj)

(source)

function

(use & args)
Like 'require, but also refers to each lib's namespace using clojure.core/refer. Use :use in the ns macro in preference to calling this directly. 'use accepts additional options in libspecs: :exclude, :only, :rename. The arguments and semantics for :exclude, :only, and :rename are the same as those documented for clojure.core/refer.

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 namespaced-map-errors
  (are [err msg form] (thrown-with-msg? err msg (read-string form))
                      Exception #"Invalid token" "#:::"
                      Exception #"Namespaced map literal must contain an even number of forms" "#:s{1}"
                      Exception #"Namespaced map must specify a valid namespace" "#:s/t{1 2}"
                      Exception #"Unknown auto-resolved namespace alias" "#::BOGUS{1 2}"
                      Exception #"Namespaced map must specify a namespace" "#: s{:a 1}"
                      Exception #"Duplicate key: :user/a" "#::{:a 1 :a 2}"
                      Exception #"Duplicate key: user/a" "#::{a 1 a 2}"))
logseq/logseq
(ns frontend.pubsub
  "All mults and pubs are collected to this ns.
  vars with suffix '-mult' is a/Mult, use a/tap and a/untap on them. used by event subscribers
  vars with suffix '-pub' is a/Pub, use a/sub and a/unsub on them. used by event subscribers
  vars with suffix '-ch' is chan used by event publishers."
  {:clj-kondo/config {:linters {:unresolved-symbol {:level :off}}}}
  #?(:cljs (:require-macros [frontend.pubsub :refer [def-mult-or-pub chan-of]]))
  (:require [clojure.core.async :as a :refer [chan mult pub]]
            [clojure.core.async.impl.protocols :as ap]
            [malli.core :as m]
            [malli.dev.pretty :as mdp]
            [clojure.pprint :as pp]))

(def-mult-or-pub sync-events
  "file-sync events"
  [:map
   [:event [:enum
            :created-local-version-file
            :finished-local->remote
            :finished-remote->local
            :start
            :pause
            :resume
            :exception-decrypt-failed
            :remote->local-full-sync-failed
            :local->remote-full-sync-failed
            :get-remote-graph-failed
            :get-deletion-logs-failed
            :get-remote-all-files-failed]]
   [:data :map]]
  :topic-fn :event
  :ch-buffer (a/sliding-buffer 10))
penpot/penpot
(ns app.main.ui.icons
  (:require
   [clojure.core :as c]
   [cuerdas.core :as str]
   [rumext.v2]))

(defmacro icon-xref
  [id]
  (let [href (str "#icon-" (name id))
        class (str "icon-" (name id))]
    `(rumext.v2/html
      [:svg {:width 500 :height 500 :class ~class}
       [:use {:href ~href}]])))
puppetlabs/trapperkeeper
(ns puppetlabs.trapperkeeper.app
  (:require [schema.core :as schema]
            [puppetlabs.trapperkeeper.services :as s]
            [clojure.core.async.impl.protocols :as async-prot])
  (:import (clojure.lang IDeref)))

(def TrapperkeeperAppContext
  "Schema for a Trapperkeeper application's internal context.  NOTE: this schema
  is intended for internal use by TK and may be subject to minor changes in future
  releases."
  {:service-contexts {schema/Keyword {schema/Any schema/Any}}
   :ordered-services TrapperkeeperAppOrderedServices
   :services-by-id {schema/Keyword (schema/protocol s/Service)}
   :lifecycle-channel (schema/protocol async-prot/Channel)
   :shutdown-channel (schema/protocol async-prot/Channel)
   :lifecycle-worker (schema/protocol async-prot/Channel)
   :shutdown-reason-promise IDeref})
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]))

;; Stubs for running without MULE:
;; These keymaps are referenced from menu-bar.
(setq mule-menu-keymap (make-sparse-keymap))
(setq describe-language-environment-map (make-sparse-keymap))
(setq buffer-file-coding-system-explicit nil)
;; Used by startup/normal-top-level to set the locale, called with nil.
(defun set-locale-environment (&optional locale-name frame))
(setq current-language-environment "English")
;; Used by startup/fancy-about-text to find localized tutorial.
(defun get-language-info (lang-env key)
  (({"English" {'tutorial "TUTORIAL"}} lang-env {}) key))
;; Used by env.
(defun find-coding-systems-string (string))
;; These are used by the mode line
(setq current-input-method)
(defun coding-system-eol-type-mnemonic (coding-system)
  (symbol-value ({0 'eol-mnemonic-unix 1 'eol-mnemonic-dos 2 'eol-mnemonic-mac}
                 (coding-system-eol-type coding-system) 'eol-mnemonic-undecided)))

;; Create *Deuce* log buffer first so it won't get selected.
(get-buffer-create "*Deuce*")
;; *Messages* is created by xdisp.c
(get-buffer-create "*Messages*")
;; *scratch* is created by buffer.c
(set-window-buffer (selected-window)
                   (get-buffer-create "*scratch*"))
;; Minibuffer 0 is the empty one, this is either created by frame.c or minibuffer.c
;; Not the leading space for buffers in the minibuffer window. *Minibuf-1* etc. gets created once it gets activated.
;; You can switch to these buffers in a normal window in Emacs and see them change as they're used.
(set-window-buffer (minibuffer-window)
                   (get-buffer-create " *Minibuf-0*"))
;; ensure_echo_area_buffers in xdisp.c creates (at least) two echo areas.
(get-buffer-create " *Echo Area 0*")
(get-buffer-create " *Echo Area 1*")

;; 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))

;; These use internal-define-key in Emacs, which doesn't define the prefix as symbol, unlike define-prefix-command.
(setq esc-map (make-keymap))
(fset 'ESC-prefix (symbol-value 'esc-map))
(setq ctl-x-map (make-keymap))
(fset 'Control-X-prefix (symbol-value 'ctl-x-map))
hraberg/deuce
(ns deuce.emacs.ccl
  (:use [deuce.emacs-lisp :only (defun defvar)])
  (:require [clojure.core :as c])
  (:refer-clojure :exclude []))

(defvar font-ccl-encoder-alist nil
  "Alist of fontname patterns vs corresponding CCL program.
  Each element looks like (REGEXP . CCL-CODE),
   where CCL-CODE is a compiled CCL program.
  When a font whose name matches REGEXP is used for displaying a character,
   CCL-CODE is executed to calculate the code point in the font
   from the charset number and position code(s) of the character which are set
   in CCL registers R0, R1, and R2 before the execution.
  The code point in the font is set in CCL registers R1 and R2
   when the execution terminated.
   If the font is single-byte font, the register R2 is not used.")

(defvar translation-hash-table-vector nil
  "Vector containing all translation hash tables ever defined.
  Comprises pairs (SYMBOL . TABLE) where SYMBOL and TABLE were set up by calls
  to `define-translation-hash-table'.  The vector is indexed by the table id
  used by CCL.")