clojure stuff, org stuff

This commit is contained in:
Griffin Smith 2018-11-21 12:45:05 -05:00
parent 29c7632fd2
commit 0edecaf151
5 changed files with 174 additions and 16 deletions

View file

@ -1,4 +1,4 @@
;; private/grfn/+bindings.el -*- lexical-binding: t; -*-
;; /+bindings.el -*- lexical-binding: t; -*-
(load! "utils")
(require 'f)
@ -333,7 +333,8 @@ private/hlissner/snippets."
:desc "Browse mode notes" :n "m" #'+org/browse-notes-for-major-mode
:desc "Browse project notes" :n "p" #'+org/browse-notes-for-project
:desc "Create clubhouse story" :n "c" #'org-clubhouse-create-story
:desc "Archive subtree" :n "k" #'org-archive-subtree)
:desc "Archive subtree" :n "k" #'org-archive-subtree
:desc "Goto clocked-in note" :n "g" #'org-clock-goto)
(:desc "open" :prefix "o"
:desc "Default browser" :n "b" #'browse-url-of-file
@ -413,11 +414,17 @@ private/hlissner/snippets."
;; --- vim-sexp-mappings-for-regular-people
(:after paxedit
(:map paxedit-mode-map
:i ";" #'paxedit-insert-semicolon
:i "(" #'paxedit-open-round
:i "[" #'paxedit-open-bracket
:i "{" #'paxedit-open-curly
:n [remap evil-yank-line] #'paxedit-copy
:n [remap evil-delete-line] #'paxedit-delete
:n "go" #'paxedit-sexp-raise
:n [remap evil-delete-line] #'paxedit-kill
:n "g o" #'paxedit-sexp-raise
:n [remap evil-join-whitespace] #'paxedit-compress
:n "gS" #'paxedit-format-1))
:n "g S" #'paxedit-format-1
:n "g k" #'paxedit-backward-up
:n "g j" #'paxedit-backward-end))
;; --- vim-splitjoin
:n [remap evil-join-whitespace] #'+splitjoin/join
@ -981,7 +988,6 @@ private/hlissner/snippets."
;; "<e" #'paxedit-transpose-backward)
(require 'paxedit)
(require 'general)
(general-evil-setup t)
@ -1001,13 +1007,23 @@ private/hlissner/snippets."
"I" 'grfn/insert-at-sexp-start
"a" 'grfn/insert-at-form-start))
;; (require 'doom-themes)
(require 'haskell)
;; (nmap :keymaps 'cider-mode-map
;; "c" (general-key-dispatch 'evil-change
;; "p" 'cider-eval-sexp-at-point-in-context))
;; >) ; slurp forward
;; <) ; barf forward
;; <( ; slurp backward
;; >( ; slurp backward
;; (require 'doom-themes)
(defun grfn/haskell-test-file-p ()
(string-match-p (rx (and "Spec.hs" eol))
(buffer-file-name)))
(require 'haskell)
(defun grfn/intero-run-main ()
(interactive)
(intero-repl-load)
@ -1016,9 +1032,11 @@ private/hlissner/snippets."
(get-buffer-process (current-buffer))
"main")))
(defun grfn/run-sputnik-test-for-file ()
(defun grfn/run-clj-or-cljs-test ()
(interactive)
(haskell-interactive-mode-))
(cl-case (cider-repl-type-for-buffer)
("cljs" (cider-interactive-eval "(with-out-string (cljs.test/run-tests))"))
("clj" (cider-test-run-ns-tests))))
(map!
(:map haskell-mode-map
@ -1049,5 +1067,24 @@ private/hlissner/snippets."
:desc "Refine" :n "r" 'agda2-refine
:desc "Auto" :n "a" 'agda2-auto
:desc "Goal type and context" :n "t" 'agda2-goal-and-context
:desc "Goal type and context and inferred" :n ";" 'agda2-goal-and-context-and-inferred))))
:desc "Goal type and context and inferred" :n ";" 'agda2-goal-and-context-and-inferred)))
(:after cider-mode
(:map cider-mode-map
:n "g SPC" 'cider-eval-buffer
:n "g \\" 'cider-switch-to-repl-buffer
:n "K" 'cider-doc
:n "g K" 'cider-grimoire
:n "g d" 'cider-find-dwim
:n "C-w ]" 'cider-find-dwim-other-window
:n "g RET" 'cider-test-run-ns-tests
"C-c C-r r" 'cljr-add-require-to-ns
(:localleader
;; :desc "Inspect last result" :n "i" 'cider-inspect-last-result
;; :desc "Search for documentation" :n "h s" 'cider-apropos-doc
:desc "Add require to ns" :n "n r" 'cljr-add-require-to-ns))
(:map cider-repl-mode-map
:n "g \\" 'cider-switch-to-last-clojure-buffer))
)

View file

@ -110,6 +110,8 @@
(ex! "tabs" #'+workspace/display)
(ex! "tabsave" #'+workspace:save)
(ex! "scr[atch]" #'cider-scratch)
;; Org-mode
(ex! "cap" #'+org-capture/dwim)

117
config.el
View file

@ -379,11 +379,28 @@
org-capture-templates
`(("t" "Todo" entry
(file+headline +org-default-todo-file "Inbox")
"* TODO %?\n%i" :prepend t :kill-buffer t)
"* TODO %?\n%i"
:prepend t
:kill-buffer t)
("n" "Notes" entry
(file+headline +org-default-notes-file "Inbox")
"* %u %?\n%i" :prepend t :kill-buffer t))
"* %u %?\n%i"
:prepend t
:kill-buffer t)
("c" "Task note" entry
(clock)
"* %u %?\n%i[[%l][Context]]\n"
:kill-buffer t
:unnarrowed t)
("d" "Tech debt" entry
(file+headline ,(concat org-directory "/work.org")
"Inbox")
"* TODO %? :debt:\nContext: %a\nIn task: %K"
:prepend t
:kill-buffer t))
org-deadline-warning-days 1
org-agenda-skip-scheduled-if-deadline-is-shown 'todo
org-agenda-custom-commands
@ -738,3 +755,99 @@
`(agda2-highlight-termination-problem-face ((t (:background ,orange :foreground ,base03))))
`(agda2-highlight-incomplete-pattern-face ((t (:background ,orange :foreground ,base03))))
`(agda2-highlight-typechecks-face ((t (:background ,cyan :foreground ,base03))))))
(after! cider
(setq cider-prompt-for-symbol nil
cider-font-lock-dynamically 't
cider-save-file-on-load 't)
)
(defun +org-clocked-in-element ()
(when-let ((item (car org-clock-history)))
(save-mark-and-excursion
(with-current-buffer (marker-buffer item)
(goto-char (marker-position item))
(org-element-at-point)))))
(comment
(setq elt (+org-clocked-in-item))
(eq 'headline (car elt))
(plist-get (cadr elt) :raw-value)
)
(defun +org-headline-title (headline)
(when (eq 'headline (car elt))
(plist-get (cadr elt) :raw-value)))
(setq +pretty-code-symbols
(append +pretty-code-symbols
'(:equal ""
:not-equal ""
:is ""
:isnt ""
:lte ""
:gte ""
:subseteq ""
)))
(after! python
(set-pretty-symbols! 'python-mode :merge t
:equal "=="
:not-equal "!="
:lte "<="
:gte ">="
:is "is"
:isnt "is not"
:subseteq "issubset"
;; doom builtins
;; Functional
:def "def"
:lambda "lambda"
;; Types
:null "None"
:true "True" :false "False"
:int "int" :str "str"
:float "float"
:bool "bool"
:tuple "tuple"
;; Flow
:not "not"
:in "in" :not-in "not in"
:and "and" :or "or"
:for "for"
:return "return" :yield "yield"))
(after! clojure-mode
(define-clojure-indent
(PUT 2)
(POST 2)
(GET 2)
(PATCH 2)
(DELETE 2)
(context 2)
(checking 3)))
(def-package! flycheck-clojure
:disabled t
:after flycheck
:config
(flycheck-clojure-setup))
(after! clj-refactor
(setq cljr-magic-requires :prompt
cljr-clojure-test-declaration "[clojure.test :refer :all]"
cljr-cljc-clojure-test-declaration"#?(:clj [clojure.test :refer :all]
:cljs [cljs.test :refer-macros [deftest is testing])"
)
(add-to-list
'cljr-magic-require-namespaces
'("s" . "clojure.spec.alpha")))
(def-package! sqlup-mode
:hook
(sql-mode-hook . sqlup-mode)
(sql-interactive-mode-hook . sqlup-mode))

View file

@ -1,6 +1,5 @@
;;; private/grfn/init.el -*- lexical-binding: t; -*-
(doom! :feature
;debugger ; FIXME stepping through code, to help you add bugs
eval ; run code, run (also, repls)
@ -30,7 +29,7 @@
doom-modeline ; a snazzy Atom-inspired mode-line
doom-quit ; DOOM quit-message prompts when you quit Emacs
evil-goggles ; display visual hints when editing in evil
;fci ; a `fill-column' indicator
fci ; a `fill-column' indicator
hl-todo ; highlight TODO/FIXME/NOTE tags
;modeline ; snazzy, Atom-inspired modeline, plus API
nav-flash ; blink the current line after jumping
@ -63,6 +62,7 @@
vc ; version-control and Emacs, sitting in a tree
:tools
docker
editorconfig ; let someone else argue about tabs vs spaces
;ein ; tame Jupyter notebooks with emacs
gist ; interacting with github gists
@ -114,7 +114,7 @@
;php ; perl's insecure younger brother
;plantuml ; diagrams for confusing people more
;purescript ; javascript, but functional
;python ; beautiful is better than ugly
python ; beautiful is better than ugly
;qt ; the 'cutest' gui framework ever
;racket ; a DSL for DSLs
;rest ; Emacs as a REST client

View file

@ -73,3 +73,9 @@
;; (package! lsp-haskell)
;; (package! company-lsp)
;; (package! lsp-imenu)
;; Clojure
(package! flycheck-clojure)
;; SQL
(package! sqlup-mode)