Last active
December 23, 2022 14:50
-
-
Save mk/79192929f9b6f23da168115fedd16847 to your computer and use it in GitHub Desktop.
Revisions
-
mk revised this gist
May 28, 2022 . 1 changed file with 20 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -59,7 +59,7 @@ (setq cider-prompt-for-symbol nil) ;; Disable pretty lambda and function symbols (global-prettify-symbols-mode nil) ;; Cursor (setq-default cursor-type 'bar) @@ -108,3 +108,22 @@ (define-key clojure-mode-map (kbd "<M-return>") 'clerk-show) (define-key markdown-mode-map (kbd "<M-return>") 'clerk-show) ;; from https://github.com/corgi-emacs/corgi-packages/blob/449e5120e4743127659643e4b1e89d037c5b9bcf/corgi-clojure/corgi-clojure.el#L119-L132 (defun corgi/around-cider--choose-reusable-repl-buffer (_command _params) "Redefine cider--choose-reusable-repl-buffer to something more sensible. If any dead REPL buffers exist when creating a new one then simply delete them first. Return nil so `cider-create-repl' creates a new one. Don't unnecessarily bother the user." (seq-do #'kill-buffer (seq-filter (lambda (b) (with-current-buffer b (and (derived-mode-p 'cider-repl-mode) (not (process-live-p (get-buffer-process b)))))) (buffer-list))) nil) (advice-add #'cider--choose-reusable-repl-buffer :around #'corgi/around-cider--choose-reusable-repl-buffer) (setq exec-path (append exec-path '("/opt/homebrew/bin"))) -
mk revised this gist
Mar 24, 2022 . 1 changed file with 19 additions and 10 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,3 +1,4 @@ ;; my customizations on Jack Rusher's excellect emacs config ;; see https://github.com/jackrusher/dotemacs ;; This lives in ~/.emacs/lisp/ @@ -40,11 +41,6 @@ (projectile-mode +1) (setq projectile-indexing-method 'hybrid) ;; moving between open buffers (global-set-key (kbd "C-s-<left>") 'previous-buffer) @@ -56,12 +52,14 @@ (add-hook 'emacs-lisp-mode-hook #'aggressive-indent-mode) (add-hook 'clojure-mode-hook #'aggressive-indent-mode) (setq cider-save-file-on-load 't) ;; don't annoy me (setq magit-save-repository-buffers 'dontask) (setq cider-prompt-for-symbol nil) ;; Disable pretty lambda and function symbols (global-prettify-symbols-mode 1) ;; Cursor (setq-default cursor-type 'bar) @@ -93,9 +91,20 @@ (global-set-key (kbd "s-]") 'shift-right) (global-set-key (kbd "s-[") 'shift-left) ;; Nextjournal-specific functions (global-set-key (kbd "C-c C-g") 'magit) (setq geiser-racket-binary "/Applications/Racket v7.8/bin/racket") (defun clerk-show () (interactive) (save-buffer) (let ((filename (buffer-file-name))) (when filename (cider-interactive-eval (concat "(nextjournal.clerk/show! \"" filename "\")"))))) (define-key clojure-mode-map (kbd "<M-return>") 'clerk-show) (define-key markdown-mode-map (kbd "<M-return>") 'clerk-show) -
mk revised this gist
Aug 30, 2020 . 1 changed file with 60 additions and 106 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -2,6 +2,15 @@ ;; see https://github.com/jackrusher/dotemacs ;; This lives in ~/.emacs/lisp/ ;; set initial window size to left half of screen (custom-set-variables '(default-frame-alist (quote ((width . 158) (height . 100) (top . 0) (left . 0))))) ;; use find-file to open files (global-set-key (kbd "s-o") 'find-file) @@ -29,119 +38,64 @@ (require 'projectile) (global-set-key (kbd "s-t") 'projectile-find-file) (projectile-mode +1) (setq projectile-indexing-method 'hybrid) ;; clj-kondo (use-package flycheck :ensure t :init (global-flycheck-mode)) (use-package flycheck-clj-kondo :ensure t) (use-package clojure-mode :ensure t :config (require 'flycheck-clj-kondo)) (use-package clojurescript-mode :ensure t :config (require 'flycheck-clj-kondo)) ;; moving between open buffers (global-set-key (kbd "C-s-<left>") 'previous-buffer) (global-set-key (kbd "C-s-<right>") 'next-buffer) (global-set-key (kbd "s-d") 'mc/mark-next-like-this) ;; aggressive indent mode for LISPs (add-hook 'emacs-lisp-mode-hook #'aggressive-indent-mode) (add-hook 'clojure-mode-hook #'aggressive-indent-mode) ;; don't annoy me (setq magit-save-repository-buffers 'dontask) (setq cider-prompt-for-symbol nil) ;; Disable pretty lambda and function symbols (global-prettify-symbols-mode 0) ;; Cursor (setq-default cursor-type 'bar) ;; Web Mode (use-package web-mode :ensure t) (require 'web-mode) (add-to-list 'auto-mode-alist '("\\.php\\'" . web-mode)) (add-to-list 'auto-mode-alist '("\\.erb\\'" . web-mode)) (add-to-list 'auto-mode-alist '("\\.html?\\'" . web-mode)) (global-set-key (kbd "M-s-.") 'web-mode-element-close) (setq web-mode-markup-indent-offset 2) (setq web-mode-css-indent-offset 2) (setq web-mode-code-indent-offset 2) (defun shift-region (distance) (let ((mark (mark))) (save-excursion (indent-rigidly (region-beginning) (region-end) distance) (push-mark mark t t) ;; Tell the command loop not to deactivate the mark ;; for transient mark mode (setq deactivate-mark nil)))) (defun shift-right () (interactive) (shift-region 2)) (defun shift-left () (interactive) (shift-region -2)) (global-set-key (kbd "s-]") 'shift-right) (global-set-key (kbd "s-[") 'shift-left) ;; Nextjournal-specific functions (eval-after-load 'clojure-mode '(progn ;; shift+enter to eval form and refresh (define-key clojure-mode-map (kbd "<S-return>") 'nextjournal/eval-defun-at-point-and-refresh))) (setq geiser-racket-binary "/Applications/Racket v7.8/bin/racket") -
mk created this gist
Apr 1, 2020 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,147 @@ ;; my customizations on Jack Rusher's excellect emacs config ;; see https://github.com/jackrusher/dotemacs ;; This lives in ~/.emacs/lisp/ ;; use find-file to open files (global-set-key (kbd "s-o") 'find-file) ;; extra packages (use-package counsel-projectile :ensure t) (use-package projectile :ensure t) (require 'counsel-projectile) (global-set-key (kbd "s-F") 'counsel-projectile-ag) ;; I never want to print the current buffer. ;; I’d rather get a fuzzy-searchable list of function definitions (global-set-key (kbd "s-p") 'imenu) ;; Fuzzy-find files in project as you type (require 'projectile) (global-set-key (kbd "s-t") 'projectile-find-file) (projectile-mode +1) ;; Search in project with ag (require 'counsel-projectile) (global-set-key (kbd "s-F") 'counsel-projectile-ag) ;; Fuzzy-find files in project as you type (require 'projectile) (global-set-key (kbd "s-t") 'projectile-find-file) (projectile-mode +1) ;; clj-kondo (use-package flycheck :ensure t) (use-package flycheck-clj-kondo :ensure t) (use-package clojure-mode :ensure t :config (require 'flycheck-clj-kondo)) (defun cider-thing-at-point (thing &optional bounds) "Return the thing at point as a string, otherwise nil. THING being a valid argument for bounds-of-thing-at-point. If BOUNDS is non-nil, return a list of its starting and ending position instead." (when-let* ((b (or (and (equal (char-after) ?\() (member (char-before) '(?\' ?\, ?\@)) ;; hide stuff before ( to avoid quirks with '( etc. (save-restriction (narrow-to-region (point) (point-max)) (bounds-of-thing-at-point thing))) (and (eq thing 'sexp) (member (char-after) '(?\) ?\} ?\])) (bounds-of-thing-at-point 'list)) (bounds-of-thing-at-point thing)))) (funcall (if bounds #'list #'buffer-substring-no-properties) (car b) (cdr b)))) (defun cider-list-at-point (&optional bounds) "Return the list at point as a string, otherwise nil. If BOUNDS is non-nil, return a list of its starting and ending position instead." (cider-thing-at-point 'list bounds)) (defun cider-eval-list-at-point (&optional output-to-current-buffer) "Evaluate the expression around point. If invoked with OUTPUT-TO-CURRENT-BUFFER, output the result to current buffer." (interactive "P") (let ((b (cider-list-at-point 'bounds))) (cider-eval-region (car b) (cadr b)))) (defun nextjournal/cider-pprint-register (register) (interactive (list (register-read-with-preview "Eval register: "))) (cider--pprint-eval-form (get-register register))) (defun cider-interactive-cljs-eval (form &optional callback bounds additional-params) "copied from sider but only sending form to :cljs repl" (let ((form (or form (apply #'buffer-substring-no-properties bounds))) (start (car-safe bounds)) (end (car-safe (cdr-safe bounds)))) (when (and start end) (remove-overlays start end 'cider-temporary t)) (unless (and cider-interactive-eval-override (functionp cider-interactive-eval-override) (funcall cider-interactive-eval-override form callback bounds)) (cider-map-repls :cljs (lambda (connection) (cider--prep-interactive-eval form connection) (cider-nrepl-request:eval form (or callback (cider-interactive-eval-handler nil bounds)) ;; always eval ns forms in the user namespace ;; otherwise trying to eval ns form for the first time will produce an error (if (cider-ns-form-p form) "user" (cider-current-ns)) (when start (line-number-at-pos start)) (when start (cider-column-number-at-pos start)) additional-params connection)))))) ;;nextjournal specific functions (defun nextjournal/new-clojure-scratch-buffer (scratch-name) (interactive "sScratch file name: ") (let* ((scratch-file (expand-file-name (concat "journal/scratch/" scratch-name ".clj") (projectile-project-root))) (template-file (expand-file-name "journal/scratch/templates/clojure.clj" (projectile-project-root)))) (copy-file template-file scratch-file) (find-file scratch-file))) (defun nextjournal/new-clojurescript-scratch-buffer (scratch-name) (interactive "sScratch file name: ") (let* ((scratch-file (expand-file-name (concat "journal/scratch/" scratch-name ".cljs") (projectile-project-root))) (template-file (expand-file-name "journal/scratch/templates/clojurescript.cljs" (projectile-project-root)))) (copy-file template-file scratch-file) (find-file scratch-file))) (defun nextjournal/eval-defun-at-point-and-refresh () (interactive) (cider-eval-defun-at-point) (cider-interactive-cljs-eval "(do (require '[re-frame.core]) (re-frame.core/dispatch [:refresh]))")) (defun nextjournal/add-nextjournal-cljs-repl-type () (when (not (seq-some (lambda (entry) (eq 'nextjournal (car entry))) cider-cljs-repl-types)) (add-to-list 'cider-cljs-repl-types '(nextjournal "(do (require 'com.nextjournal.journal.repl) (com.nextjournal.journal.repl/wait-for-figwheel) (com.nextjournal.journal.repl/editor-repl))" nil)))) (eval-after-load "cider" '(progn (setq cider-auto-track-ns-form-changes nil) (setq cider-use-overlays nil) (defadvice cider--choose-reusable-repl-buffer (around auto-confirm compile activate) (cl-letf (((symbol-function 'y-or-n-p) (lambda (&rest args) t)) ((symbol-function 'completing-read) (lambda (prompt collection &rest args) (car collection)))) ad-do-it)) (nextjournal/add-nextjournal-cljs-repl-type))) ;; I like this keybinding from Lighttable (eval-after-load 'clojure-mode '(progn ;; shift+enter to eval form and refresh (define-key clojure-mode-map (kbd "<S-return>") 'nextjournal/eval-defun-at-point-and-refresh)))