Repository: zamansky/dot-emacs Branch: main Commit: 5eb4bacc1b22 Files: 9 Total size: 67.3 KB Directory structure: gitextract_67abikbj/ ├── Readme.org ├── config.el ├── config.org ├── early-init.el ├── init.el ├── readme.org-from-up-to-77.org └── snippets/ └── org-mode/ ├── hl ├── img └── post ================================================ FILE CONTENTS ================================================ ================================================ FILE: Readme.org ================================================ * My dot emacs I recently declared .emacs.d bankruptcy. I had a few completion issues that were getting annoying and wanted to check out some new packages like selectrum so I thought I'd start from semi-scratch - new config and copy over old pieces a bit at a time. I also thought it would be a good time to start checking out the straight package manager and selectrum. I also decided that instead of converting my org file config each time I loaded Emacs I'd add a hook to tangle it each time I save a change for faster loading. Maybe I'll get back to making videos to show all of this. If you're looking for the older config that matches my earlier videos (up to 77) look here [[https://github.com/zamansky/dot-emacs-videos-to-77][https://github.com/zamansky/dot-emacs-videos-to-77]] ================================================ FILE: config.el ================================================ ;; [[file:config.org::*Path][Path:1]] (use-package exec-path-from-shell :ensure t :config (exec-path-from-shell-initialize)) ;; Path:1 ends here ;; [[file:config.org::*Custom Functions][Custom Functions:1]] (defun load-if-exists (f) "load the elisp file only if it exists and is readable" (if (file-readable-p f) (load-file f))) ;; Custom Functions:1 ends here ;; [[file:config.org::*Keybindings][Keybindings:1]] (use-package general) (defun z/load-iorg () (interactive ) (find-file "~/Sync/orgfiles/i.org")) (general-define-key :prefix-command 'z-map :prefix "C-z" "i" 'z/load-iorg "m" 'mu4e "s" 'flyspell-correct-word-before-point "2" 'make-frame-command "0" 'delete-frame "o" 'other-frame ) ;; Keybindings:1 ends here ;; [[file:config.org::*Themes and interface tweaks][Themes and interface tweaks:1]] ;; (use-package modus-operandi-theme) (use-package modus-themes) (load-theme 'modus-operandi t) ;;(set-frame-font "Inconsolata-18") (set-frame-font "Firacode-18") (setq inhibit-startup-message t) (tool-bar-mode -1) (fset 'yes-or-no-p 'y-or-n-p) (global-auto-revert-mode 1) ;; you might not want this (setq auto-revert-verbose nil) ;; or this (global-set-key (kbd "") 'revert-buffer) (use-package default-text-scale) (use-package expand-region :general ("C-=" 'er/expand-region)) (use-package hungry-delete :config (global-hungry-delete-mode)) ;; (use-package aggressive-indent ;; :config ;; (global-aggressive-indent-mode 1) ;; (add-to-list 'aggressive-indent-excluded-modes 'html-mode) ;; ) ;; (use-package ace-window ;; :general ;; ("C-x O" 'other-frame) ;; ([remap other-window] 'ace-window) ;; :config ;; (setq aw-scope 'frame)) ;; was global (use-package winum :config (winum-mode)) (use-package which-key :config (which-key-mode)) (use-package pcre2el :config (pcre-mode)) (setenv "BROWSER" "firefox") ;; Themes and interface tweaks:1 ends here ;; [[file:config.org::*exec-path-from-shell][exec-path-from-shell:1]] (use-package exec-path-from-shell :config (exec-path-from-shell-initialize)) ;; exec-path-from-shell:1 ends here ;; [[file:config.org::*Completion frameworks][Completion frameworks:1]] ;; (use-package selectrum ;; :init ;; (selectrum-mode +1)) (use-package vertico :init (vertico-mode +1)) (use-package orderless :init (setq completion-styles '(orderless) completion-category-defaults nil completion-category-overrides '((file (styles partial-completion))))) ;; Persist history over Emacs restarts. Vertico sorts by history position. (use-package savehist :init (savehist-mode)) (use-package marginalia :config (marginalia-mode)) (use-package consult :general ("M-y" 'consult-yank-from-kill-ring "C-x b" 'consult-buffer)) (recentf-mode) (setq completion-ignore-case t) (setq read-file-name-completion-ignore-case t) (use-package orderless :init (setq completion-styles '(orderless))) ;; (use-package company ;; :config ;; (setq company-idle-delay 0) ;; (setq company-minimum-prefix-length 3) ;; (global-company-mode t)) (use-package corfu ;; Optional customizations :custom (corfu-cycle t) ; Allows cycling through candidates (corfu-auto t) ; Enable auto completion (corfu-auto-prefix 2) (corfu-auto-delay 0.0) (corfu-echo-documentation 0.25) ; Enable documentation for completions (corfu-preview-current 'insert) ; Do not preview current candidate (corfu-preselect-first nil) (corfu-on-exact-match nil) ; Don't auto expand tempel snippets ;; Optionally use TAB for cycling, default is `corfu-complete'. :bind (:map corfu-map ("M-SPC" . corfu-insert-separator) ("TAB" . corfu-next) ([tab] . corfu-next) ("S-TAB" . corfu-previous) ([backtab] . corfu-previous) ("S-" . corfu-insert) ("RET" . nil) ;; leave my enter alone! ) :init (global-corfu-mode) ;;(corfu-history-mode) :config (setq tab-always-indent 'complete) (add-hook 'eshell-mode-hook (lambda () (setq-local corfu-quit-at-boundary t corfu-quit-no-match t corfu-auto nil) (corfu-mode)))) (use-package embark :ensure t :bind (("C-." . embark-act) ;; pick some comfortable binding ("C-;" . embark-dwim) ;; good alternative: M-. ("C-h B" . embark-bindings)) ;; alternative for `describe-bindings' :init ;; Optionally replace the key help with a completing-read interface (setq prefix-help-command #'embark-prefix-help-command) :config ;; Hide the mode line of the Embark live/completions buffers (add-to-list 'display-buffer-alist '("\\`\\*Embark Collect \\(Live\\|Completions\\)\\*" nil (window-parameters (mode-line-format . none)))) ) ;; Consult users will also want the embark-consult package. (use-package embark-consult :ensure t :after (embark consult) :demand t ; only necessary if you have the hook below ;; if you want to have consult previews as you move around an ;; auto-updating embark collect buffer :hook (embark-collect-mode . consult-preview-at-point-mode)) ;; Completion frameworks:1 ends here ;; [[file:config.org::*org][org:1]] (use-package ox-reveal) (require 'org-protocol) (custom-set-variables '(org-directory "~/Sync/orgfiles") '(org-default-notes-file (concat org-directory "/notes.org")) '(org-export-html-postamble nil) '(org-hide-leading-stars t) '(org-startup-folded (quote overview)) '(org-startup-indented t) '(org-confirm-babel-evaluate nil) '(org-src-fontify-natively t) '(org-export-with-toc nil) ) (use-package org-bullets :config (add-hook 'org-mode-hook (lambda () (org-bullets-mode 1)))) (global-set-key "\C-ca" 'org-agenda) (setq org-agenda-start-on-weekday nil) (setq org-agenda-custom-commands '(("c" "Simple agenda view" ((agenda "") (alltodo ""))))) (global-set-key (kbd "C-c c") 'org-capture) (setq org-agenda-files (list "~/opt/gcal.org" "~/opt/soe-cal.org" "~/Sync/orgfiles/i.org")) (setq org-capture-templates '(("l" "Link" entry (file+headline "~/Sync/orgfiles/links.org" "Links") "* %a %^g\n %?\n %T\n %i") ("b" "Blog idea" entry (file+headline "~/Sync/orgfiles/i.org" "POSTS:") "* %?\n%T" :prepend t) ("t" "To Do Item" entry (file+headline "~/Sync/orgfiles/i.org" "To Do and Notes") "* TODO %?\n%u" :prepend t) ("m" "Mail To Do" entry (file+headline "~/Sync/orgfiles/i.org" "To Do and Notes") "* TODO %a\n %?" :prepend t) ("n" "Note" entry (file+olp "~/Sync/orgfiles/i.org" "Notes") "* %u %? " :prepend t) ("r" "RSS" entry (file+headline "~/Sync/shared/elfeed.org" "Feeds misc") "** %A %^g\n"))) (use-package htmlize) (setq org-ditaa-jar-path "/usr/share/ditaa/ditaa.jar") (setq org-file-apps (append '( ("\\.pdf\\'" . "evince %s") ("\\.x?html?\\'" . "/usr/bin/firefox %s") ) org-file-apps )) ;; babel stuff (require 'ob-clojure) (require 'ob-gnuplot) (use-package ob-restclient :ensure t) (require 'ob-restclient) (setq org-babel-clojure-backend 'cider) (org-babel-do-load-languages 'org-babel-load-languages '((python . t) (restclient . t) (emacs-lisp . t) (gnuplot . t) (shell . t) (java . t) (C . t) (clojure . t) (js . t) (ditaa . t) (dot . t) (org . t) (latex . t ) )) (setq mail-user-agent 'mu4e-user-agent) (use-package org-msg :config (setq org-msg-options "html-postamble:nil H:5 num:nil ^:{} toc:nil tex:dvipng") (setq org-msg-startup "hidestars indent inlineimages") (setq org-msg-greeting-fmt "\n%s,\n\n") (setq org-msg-greeting-fmt-mailto t) (setq org-msg-signature " #+begin_signature -- *Mike* \\\\ #+end_signature") (org-msg-mode)) (require 'org-tempo) ;; to bring back easy templates using ") 'revert-buffer) (use-package default-text-scale) (use-package expand-region :general ("C-=" 'er/expand-region)) (use-package hungry-delete :config (global-hungry-delete-mode)) ;; (use-package aggressive-indent ;; :config ;; (global-aggressive-indent-mode 1) ;; (add-to-list 'aggressive-indent-excluded-modes 'html-mode) ;; ) ;; (use-package ace-window ;; :general ;; ("C-x O" 'other-frame) ;; ([remap other-window] 'ace-window) ;; :config ;; (setq aw-scope 'frame)) ;; was global (use-package winum :config (winum-mode)) (use-package which-key :config (which-key-mode)) (use-package pcre2el :config (pcre-mode)) (setenv "BROWSER" "firefox") #+end_src * exec-path-from-shell #+begin_src emacs-lisp (use-package exec-path-from-shell :config (exec-path-from-shell-initialize)) #+end_src * Completion frameworks #+begin_src emacs-lisp ;; (use-package selectrum ;; :init ;; (selectrum-mode +1)) (use-package vertico :init (vertico-mode +1)) (use-package orderless :init (setq completion-styles '(orderless) completion-category-defaults nil completion-category-overrides '((file (styles partial-completion))))) ;; Persist history over Emacs restarts. Vertico sorts by history position. (use-package savehist :init (savehist-mode)) (use-package marginalia :config (marginalia-mode)) (use-package consult :general ("M-y" 'consult-yank-from-kill-ring "C-x b" 'consult-buffer)) (recentf-mode) (setq completion-ignore-case t) (setq read-file-name-completion-ignore-case t) (use-package orderless :init (setq completion-styles '(orderless))) ;; (use-package company ;; :config ;; (setq company-idle-delay 0) ;; (setq company-minimum-prefix-length 3) ;; (global-company-mode t)) (use-package corfu ;; Optional customizations :custom (corfu-cycle t) ; Allows cycling through candidates (corfu-auto t) ; Enable auto completion (corfu-auto-prefix 2) (corfu-auto-delay 0.0) (corfu-echo-documentation 0.25) ; Enable documentation for completions (corfu-preview-current 'insert) ; Do not preview current candidate (corfu-preselect-first nil) (corfu-on-exact-match nil) ; Don't auto expand tempel snippets ;; Optionally use TAB for cycling, default is `corfu-complete'. :bind (:map corfu-map ("M-SPC" . corfu-insert-separator) ("TAB" . corfu-next) ([tab] . corfu-next) ("S-TAB" . corfu-previous) ([backtab] . corfu-previous) ("S-" . corfu-insert) ("RET" . nil) ;; leave my enter alone! ) :init (global-corfu-mode) ;;(corfu-history-mode) :config (setq tab-always-indent 'complete) (add-hook 'eshell-mode-hook (lambda () (setq-local corfu-quit-at-boundary t corfu-quit-no-match t corfu-auto nil) (corfu-mode)))) (use-package embark :ensure t :bind (("C-." . embark-act) ;; pick some comfortable binding ("C-;" . embark-dwim) ;; good alternative: M-. ("C-h B" . embark-bindings)) ;; alternative for `describe-bindings' :init ;; Optionally replace the key help with a completing-read interface (setq prefix-help-command #'embark-prefix-help-command) :config ;; Hide the mode line of the Embark live/completions buffers (add-to-list 'display-buffer-alist '("\\`\\*Embark Collect \\(Live\\|Completions\\)\\*" nil (window-parameters (mode-line-format . none)))) ) ;; Consult users will also want the embark-consult package. (use-package embark-consult :ensure t :after (embark consult) :demand t ; only necessary if you have the hook below ;; if you want to have consult previews as you move around an ;; auto-updating embark collect buffer :hook (embark-collect-mode . consult-preview-at-point-mode)) #+end_src * gnuplot (use-package gnuplot) * org #+begin_src emacs-lisp (use-package ox-reveal) (require 'org-protocol) (custom-set-variables '(org-directory "~/Sync/orgfiles") '(org-default-notes-file (concat org-directory "/notes.org")) '(org-export-html-postamble nil) '(org-hide-leading-stars t) '(org-startup-folded (quote overview)) '(org-startup-indented t) '(org-confirm-babel-evaluate nil) '(org-src-fontify-natively t) '(org-export-with-toc nil) ) (use-package org-bullets :config (add-hook 'org-mode-hook (lambda () (org-bullets-mode 1)))) (global-set-key "\C-ca" 'org-agenda) (setq org-agenda-start-on-weekday nil) (setq org-agenda-custom-commands '(("c" "Simple agenda view" ((agenda "") (alltodo ""))))) (global-set-key (kbd "C-c c") 'org-capture) (setq org-agenda-files (list "~/opt/gcal.org" "~/opt/soe-cal.org" "~/Sync/orgfiles/i.org")) (setq org-capture-templates '(("l" "Link" entry (file+headline "~/Sync/orgfiles/links.org" "Links") "* %a %^g\n %?\n %T\n %i") ("b" "Blog idea" entry (file+headline "~/Sync/orgfiles/i.org" "POSTS:") "* %?\n%T" :prepend t) ("t" "To Do Item" entry (file+headline "~/Sync/orgfiles/i.org" "To Do and Notes") "* TODO %?\n%u" :prepend t) ("m" "Mail To Do" entry (file+headline "~/Sync/orgfiles/i.org" "To Do and Notes") "* TODO %a\n %?" :prepend t) ("n" "Note" entry (file+olp "~/Sync/orgfiles/i.org" "Notes") "* %u %? " :prepend t) ("r" "RSS" entry (file+headline "~/Sync/shared/elfeed.org" "Feeds misc") "** %A %^g\n"))) (use-package htmlize) (setq org-ditaa-jar-path "/usr/share/ditaa/ditaa.jar") (setq org-file-apps (append '( ("\\.pdf\\'" . "evince %s") ("\\.x?html?\\'" . "/usr/bin/firefox %s") ) org-file-apps )) ;; babel stuff (require 'ob-clojure) (require 'ob-gnuplot) (use-package ob-restclient :ensure t) (require 'ob-restclient) (setq org-babel-clojure-backend 'cider) (org-babel-do-load-languages 'org-babel-load-languages '((python . t) (restclient . t) (emacs-lisp . t) (gnuplot . t) (shell . t) (java . t) (C . t) (clojure . t) (js . t) (ditaa . t) (dot . t) (org . t) (latex . t ) )) (setq mail-user-agent 'mu4e-user-agent) (use-package org-msg :config (setq org-msg-options "html-postamble:nil H:5 num:nil ^:{} toc:nil tex:dvipng") (setq org-msg-startup "hidestars indent inlineimages") (setq org-msg-greeting-fmt "\n%s,\n\n") (setq org-msg-greeting-fmt-mailto t) (setq org-msg-signature " ,#+begin_signature -- *Mike* \\\\ ,#+end_signature") (org-msg-mode)) (require 'org-tempo) ;; to bring back easy templates using ") 'sp-unwrap-sexp) (define-key smartparens-mode-map (kbd "M-") 'sp-backward-unwrap-sexp) (define-key smartparens-mode-map (kbd "C-") 'sp-forward-slurp-sexp) (define-key smartparens-mode-map (kbd "C-") 'sp-forward-barf-sexp) (define-key smartparens-mode-map (kbd "C-M-") 'sp-backward-slurp-sexp) (define-key smartparens-mode-map (kbd "C-M-") 'sp-backward-barf-sexp) (define-key smartparens-mode-map (kbd "M-D") 'sp-splice-sexp) (define-key smartparens-mode-map (kbd "C-M-") 'sp-splice-sexp-killing-forward) (define-key smartparens-mode-map (kbd "C-M-") 'sp-splice-sexp-killing-backward) (define-key smartparens-mode-map (kbd "C-S-") 'sp-splice-sexp-killing-around) (define-key smartparens-mode-map (kbd "C-]") 'sp-select-next-thing-exchange) (define-key smartparens-mode-map (kbd "C-") 'sp-select-previous-thing) (define-key smartparens-mode-map (kbd "C-M-]") 'sp-select-next-thing) (define-key smartparens-mode-map (kbd "M-F") 'sp-forward-symbol) (define-key smartparens-mode-map (kbd "M-B") 'sp-backward-symbol) (define-key smartparens-mode-map (kbd "C-\"") 'sp-change-inner) (define-key smartparens-mode-map (kbd "M-i") 'sp-change-enclosing) (bind-key "C-c f" (lambda () (interactive) (sp-beginning-of-sexp 2)) smartparens-mode-map) (bind-key "C-c b" (lambda () (interactive) (sp-beginning-of-sexp -2)) smartparens-mode-map) (bind-key "C-M-s" (defhydra smartparens-hydra () "Smartparens" ("d" sp-down-sexp "Down") ("e" sp-up-sexp "Up") ("u" sp-backward-up-sexp "Up") ("a" sp-backward-down-sexp "Down") ("f" sp-forward-sexp "Forward") ("b" sp-backward-sexp "Backward") ("k" sp-kill-sexp "Kill" :color blue) ("q" nil "Quit" :color blue)) smartparens-mode-map) (bind-key "H-t" 'sp-prefix-tag-object smartparens-mode-map) (bind-key "H-p" 'sp-prefix-pair-object smartparens-mode-map) (bind-key "H-y" 'sp-prefix-symbol-object smartparens-mode-map) (bind-key "H-h" 'sp-highlight-current-sexp smartparens-mode-map) (bind-key "H-e" 'sp-prefix-save-excursion smartparens-mode-map) (bind-key "H-s c" 'sp-convolute-sexp smartparens-mode-map) (bind-key "H-s a" 'sp-absorb-sexp smartparens-mode-map) (bind-key "H-s e" 'sp-emit-sexp smartparens-mode-map) (bind-key "H-s p" 'sp-add-to-previous-sexp smartparens-mode-map) (bind-key "H-s n" 'sp-add-to-next-sexp smartparens-mode-map) (bind-key "H-s j" 'sp-join-sexp smartparens-mode-map) (bind-key "H-s s" 'sp-split-sexp smartparens-mode-map) (bind-key "H-s r" 'sp-rewrap-sexp smartparens-mode-map) (defvar hyp-s-x-map) (define-prefix-command 'hyp-s-x-map) (bind-key "H-s x" hyp-s-x-map smartparens-mode-map) (bind-key "H-s x x" 'sp-extract-before-sexp smartparens-mode-map) (bind-key "H-s x a" 'sp-extract-after-sexp smartparens-mode-map) (bind-key "H-s x s" 'sp-swap-enclosing-sexp smartparens-mode-map) (bind-key "C-x C-t" 'sp-transpose-hybrid-sexp smartparens-mode-map) (bind-key ";" 'sp-comment emacs-lisp-mode-map) (bind-key [remap c-electric-backspace] 'sp-backward-delete-char smartparens-strict-mode-map) ;;;;;;;;;;;;;;;;;; ;; pair management (sp-local-pair 'minibuffer-inactive-mode "'" nil :actions nil) (bind-key "C-(" 'sp---wrap-with-40 minibuffer-local-map) (sp-with-modes 'org-mode (sp-local-pair "=" "=" :wrap "C-=")) (sp-with-modes 'textile-mode (sp-local-pair "*" "*") (sp-local-pair "_" "_") (sp-local-pair "@" "@")) (sp-with-modes 'web-mode (sp-local-pair "{{#if" "{{/if") (sp-local-pair "{{#unless" "{{/unless")) ;;; tex-mode latex-mode (sp-with-modes '(tex-mode plain-tex-mode latex-mode) (sp-local-tag "i" "\"<" "\">")) ;;; lisp modes (sp-with-modes sp--lisp-modes (sp-local-pair "(" nil :wrap "C-(" :pre-handlers '(my-add-space-before-sexp-insertion) :post-handlers '(my-add-space-after-sexp-insertion))) (defun my-add-space-after-sexp-insertion (id action _context) (when (eq action 'insert) (save-excursion (forward-char (sp-get-pair id :cl-l)) (when (or (eq (char-syntax (following-char)) ?w) (looking-at (sp--get-opening-regexp))) (insert " "))))) (defun my-add-space-before-sexp-insertion (id action _context) (when (eq action 'insert) (save-excursion (backward-char (length id)) (when (or (eq (char-syntax (preceding-char)) ?w) (and (looking-back (sp--get-closing-regexp)) (not (eq (char-syntax (preceding-char)) ?')))) (insert " "))))) ;;; C++ (sp-with-modes '(malabar-mode c++-mode) (sp-local-pair "{" nil :post-handlers '(("||\n[i]" "RET")))) (sp-local-pair 'c++-mode "/*" "*/" :post-handlers '((" | " "SPC") ("* ||\n[i]" "RET"))) (sp-local-pair 'js2-mode "/**" "*/" :post-handlers '(("| " "SPC") ("* ||\n[i]" "RET"))) ;;; PHP (sp-with-modes '(php-mode) (sp-local-pair "/**" "*/" :post-handlers '(("| " "SPC") (my-php-handle-docstring "RET"))) (sp-local-pair "/*." ".*/" :post-handlers '(("| " "SPC"))) (sp-local-pair "{" nil :post-handlers '(("||\n[i]" "RET") my-php-wrap-handler)) (sp-local-pair "(" nil :prefix "\\(\\sw\\|\\s_\\)*")) (defun my-php-wrap-handler (&rest _ignored) (save-excursion (sp-get sp-last-wrapped-region (goto-char :beg-in) (unless (looking-at "[ \t]*$") (newline-and-indent)) (goto-char :end-in) (beginning-of-line) (unless (looking-at "[ \t]*}[ \t]*$") (goto-char :end-in) (newline-and-indent)) (indent-region :beg-prf :end-suf)))) (defun my-php-handle-docstring (&rest _ignored) (-when-let (line (save-excursion (forward-line) (thing-at-point 'line))) (cond ;; variable ((string-match (rx (or "private" "protected" "public" "var") (1+ " ") (group "$" (1+ alnum))) line) (let ((var-name (match-string 1 line)) (type "")) ;; try to guess the type from the constructor (-when-let (constructor-args (my-php-get-function-args "__construct" t)) (setq type (or (cdr (assoc var-name constructor-args)) ""))) (insert "* @var " type) (save-excursion (insert "\n")))) ((string-match-p "function" line) (save-excursion (let ((args (save-excursion (forward-line) (my-php-get-function-args nil t)))) (--each args (when (my-php-should-insert-type-annotation (cdr it)) (insert (format "* @param %s%s\n" (my-php-translate-type-annotation (cdr it)) (car it)))))) (let ((return-type (save-excursion (forward-line) (my-php-get-function-return-type)))) (when (my-php-should-insert-type-annotation return-type) (insert (format "* @return %s\n" (my-php-translate-type-annotation return-type)))))) (re-search-forward (rx "@" (or "param" "return") " ") nil t)) ((string-match-p ".*class\\|interface" line) (save-excursion (insert "\n")) (insert "* "))) (let ((o (sp--get-active-overlay))) (indent-region (overlay-start o) (overlay-end o))))) #+end_src #+begin_src emacs-lisp ;; (add-hook 'clojure-mode-hook #'smartparens-mode) #+end_src * Web stuff #+begin_src emacs-lisp (use-package web-mode) (add-hook 'html-mode-hook 'web-mode) ;; Auto-start on any markup modes (use-package emmet-mode) (add-hook 'web-mode-hook 'emmet-mode) #+end_src * mu4e #+begin_src emacs-lisp (use-package mu4e) #+end_src * dirvish #+begin_src emacs-lisp ;; (use-package dirvish ;; :ensure t ;; :init ;; ;; Let Dirvish take over Dired globally ;; (dirvish-override-dired-mode)) #+end_src * refile this #+begin_src emacs-lisp (setq user-full-name "Mike Zamansky" user-mail-address "mz631@hunter.cuny.edu") ;; (global-set-key [mouse-3] 'flyspell-correct-word-before-point) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; generic interface tweaks and variable setting (add-hook 'org-mode-hook 'turn-on-flyspell) (add-hook 'org-mode-hook 'turn-on-auto-fill) (add-hook 'mu4e-compose-mode-hook 'turn-on-flyspell) (add-hook 'mu4e-compose-mode-hook 'turn-on-auto-fill) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; load other files (load-if-exists "~/Sync/shared/mu4econfig.el") (load-if-exists "~/Sync/shared/not-for-github.el") (setq dired-guess-shell-alist-user '(("" "xdg-open"))) #+end_src ;; Local Variables: ;; eval: (add-hook 'after-save-hook (lambda ()(if (y-or-n-p "Tangle?")(org-babel-tangle))) nil t) ;; End: ================================================ FILE: early-init.el ================================================ (setq package-enable-at-startup nil) ================================================ FILE: init.el ================================================ ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; set up straight package manager (defvar bootstrap-version) (let ((bootstrap-file (expand-file-name "straight/repos/straight.el/bootstrap.el" user-emacs-directory)) (bootstrap-version 5)) (unless (file-exists-p bootstrap-file) (with-current-buffer (url-retrieve-synchronously "https://raw.githubusercontent.com/raxod502/straight.el/develop/install.el" 'silent 'inhibit-cookies) (goto-char (point-max)) (eval-print-last-sexp))) (load bootstrap-file nil 'nomessage)) (straight-use-package 'use-package) (setq straight-use-package-by-default t) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; package to control garbage collection (for faster startup) ;; (use-package gcmh) ;; (gcmh-mode 1) ;; Minimize garbage collection during startup (setq gc-cons-threshold most-positive-fixnum) ;; Lower threshold back to 8 MiB (default is 800kB) (add-hook 'emacs-startup-hook (lambda () (setq gc-cons-threshold (expt 2 23)))) (load-file "~/.emacs.d/config.el") (custom-set-variables ;; custom-set-variables was added by Custom. ;; If you edit it by hand, you could mess it up, so be careful. ;; Your init file should contain only one such instance. ;; If there is more than one, they won't work right. '(ansi-color-faces-vector [default default default italic underline success warning error]) '(ansi-color-names-vector ["#5f5f5f" "#ff4b4b" "#a1db00" "#fce94f" "#5fafd7" "#d18aff" "#afd7ff" "#ffffff"]) '(awesome-tray-mode-line-active-color "#0031a9") '(awesome-tray-mode-line-inactive-color "#d7d7d7") '(codeium/metadata/api_key "1d48df4f-af97-4042-b5ab-cc8c4fac6d3c") '(custom-safe-themes '("583148e87f779040b5349db48b6fcad6fe9a873c6ada20487e9a1ec40d845505" "0feb7052df6cfc1733c1087d3876c26c66410e5f1337b039be44cb406b6187c6" "27a1dd6378f3782a593cc83e108a35c2b93e5ecc3bd9057313e1d88462701fcd" "f703efe04a108fcd4ad104e045b391c706035bce0314a30d72fbf0840b355c2c" default)) '(exwm-floating-border-color "#888888") '(flymake-error-bitmap '(flymake-double-exclamation-mark modus-themes-fringe-red)) '(flymake-note-bitmap '(exclamation-mark modus-themes-fringe-cyan)) '(flymake-warning-bitmap '(exclamation-mark modus-themes-fringe-yellow)) '(highlight-tail-colors '(("#aecf90" . 0) ("#c0efff" . 20))) '(hl-sexp-background-color "#efebe9") '(hl-todo-keyword-faces '(("HOLD" . "#70480f") ("TODO" . "#721045") ("NEXT" . "#5317ac") ("THEM" . "#8f0075") ("PROG" . "#00538b") ("OKAY" . "#30517f") ("DONT" . "#315b00") ("FAIL" . "#a60000") ("BUG" . "#a60000") ("DONE" . "#005e00") ("NOTE" . "#863927") ("KLUDGE" . "#813e00") ("HACK" . "#813e00") ("TEMP" . "#5f0000") ("FIXME" . "#a0132f") ("XXX+" . "#972500") ("REVIEW" . "#005a5f") ("DEPRECATED" . "#201f55"))) '(ibuffer-deletion-face 'modus-themes-mark-del) '(ibuffer-filter-group-name-face 'modus-themes-pseudo-header) '(ibuffer-marked-face 'modus-themes-mark-sel) '(ibuffer-title-face 'default) '(org-confirm-babel-evaluate nil) '(org-default-notes-file (concat org-directory "/notes.org")) '(org-directory "~/Sync/orgfiles") '(org-export-html-postamble nil) '(org-export-with-toc nil) '(org-hide-leading-stars t) '(org-src-block-faces 'nil) '(org-src-fontify-natively t) '(org-startup-folded 'overview) '(org-startup-indented t) '(pdf-view-midnight-colors '("#000000" . "#f8f8f8")) '(safe-local-variable-values '((eval add-hook 'after-save-hook (lambda nil (if (y-or-n-p "Tangle?") (org-babel-tangle))) nil t))) '(vc-annotate-background nil) '(vc-annotate-background-mode nil) '(vc-annotate-color-map '((20 . "#a60000") (40 . "#721045") (60 . "#8f0075") (80 . "#972500") (100 . "#813e00") (120 . "#70480f") (140 . "#5d3026") (160 . "#184034") (180 . "#005e00") (200 . "#315b00") (220 . "#005a5f") (240 . "#30517f") (260 . "#00538b") (280 . "#093060") (300 . "#0031a9") (320 . "#2544bb") (340 . "#0000c0") (360 . "#5317ac"))) '(vc-annotate-very-old-color nil) '(xterm-color-names ["black" "#a60000" "#005e00" "#813e00" "#0031a9" "#721045" "#00538b" "gray65"]) '(xterm-color-names-bright ["gray35" "#972500" "#315b00" "#70480f" "#2544bb" "#8f0075" "#30517f" "white"])) (custom-set-faces ;; custom-set-faces was added by Custom. ;; If you edit it by hand, you could mess it up, so be careful. ;; Your init file should contain only one such instance. ;; If there is more than one, they won't work right. ) (put 'narrow-to-region 'disabled nil) (put 'downcase-region 'disabled nil) ================================================ FILE: readme.org-from-up-to-77.org ================================================ #+STARTUP: overview #+PROPERTY: header-args :comments yes :results silent :tangle yes * Custom Functions #+begin_src emacs-lisp (defun load-if-exists (f) "load the elisp file only if it exists and is readable" (if (file-readable-p f) (load-file f))) #+end_src * Themes and interface tweaks #+begin_src emacs-lisp (use-package modus-operandi-theme) (use-package modus-themes) (load-theme 'modus-operandi t) ;;(set-frame-font "Inconsolata-18") (set-frame-font "Firacode-18") (setq inhibit-startup-message t) (tool-bar-mode -1) (fset 'yes-or-no-p 'y-or-n-p) (global-auto-revert-mode 1) ;; you might not want this (setq auto-revert-verbose nil) ;; or this (global-set-key (kbd "") 'revert-buffer) (use-package default-text-scale) (use-package expand-region :general ("C-=" 'er/expand-region)) (use-package hungry-delete :config (global-hungry-delete-mode)) (use-package aggressive-indent :config (global-aggressive-indent-mode 1) (add-to-list 'aggressive-indent-excluded-modes 'html-mode) ) (use-package ace-window :general ("C-x O" 'other-frame) ([remap other-window] 'ace-window) :config (setq aw-scope 'frame)) ;; was global (use-package which-key :config (which-key-mode)) (use-package pcre2el :config (pcre-mode)) (setenv "BROWSER" "firefox") #+end_src * Keybindings #+begin_src emacs-lisp (use-package general) (defun z/load-iorg () (interactive ) (find-file "~/Sync/orgfiles/i.org")) (general-define-key :prefix-command 'z-map :prefix "C-z" "i" 'z/load-iorg "m" 'mu4e "s" 'flyspell-correct-word-before-point "2" 'make-frame-command "0" 'delete-frame "o" 'other-frame ) #+end_src * Completion frameworks #+begin_src emacs-lisp (use-package selectrum :init (selectrum-mode +1)) (use-package consult :general ("M-y" 'consult-yank)) (setq completion-ignore-case t) (setq read-file-name-completion-ignore-case t) (use-package marginalia) (use-package orderless :init (setq completion-styles '(orderless))) (use-package company :config (setq company-idle-delay 0) (setq company-minimum-prefix-length 3) (global-company-mode t)) #+end_src * org #+begin_src emacs-lisp (use-package ox-reveal) (require 'org-protocol) (custom-set-variables '(org-directory "~/Sync/orgfiles") '(org-default-notes-file (concat org-directory "/notes.org")) '(org-export-html-postamble nil) '(org-hide-leading-stars t) '(org-startup-folded (quote overview)) '(org-startup-indented t) '(org-confirm-babel-evaluate nil) '(org-src-fontify-natively t) '(org-export-with-toc nil) ) (use-package org-bullets :config (add-hook 'org-mode-hook (lambda () (org-bullets-mode 1)))) (global-set-key "\C-ca" 'org-agenda) (setq org-agenda-start-on-weekday nil) (setq org-agenda-custom-commands '(("c" "Simple agenda view" ((agenda "") (alltodo ""))))) (global-set-key (kbd "C-c c") 'org-capture) (setq org-agenda-files (list "~/opt/gcal.org" "~/opt/soe-cal.org" "~/Sync/orgfiles/i.org")) (setq org-capture-templates '(("l" "Link" entry (file+headline "~/Sync/orgfiles/links.org" "Links") "* %a %^g\n %?\n %T\n %i") ("b" "Blog idea" entry (file+headline "~/Sync/orgfiles/i.org" "POSTS:") "* %?\n%T" :prepend t) ("t" "To Do Item" entry (file+headline "~/Sync/orgfiles/i.org" "To Do and Notes") "* TODO %?\n%u" :prepend t) ("m" "Mail To Do" entry (file+headline "~/Sync/orgfiles/i.org" "To Do and Notes") "* TODO %a\n %?" :prepend t) ("n" "Note" entry (file+olp "~/Sync/orgfiles/i.org" "Notes") "* %u %? " :prepend t) ("r" "RSS" entry (file+headline "~/Sync/shared/elfeed.org" "Feeds misc") "** %A %^g\n"))) (use-package htmlize) (setq org-ditaa-jar-path "/usr/share/ditaa/ditaa.jar") (setq org-file-apps (append '( ("\\.pdf\\'" . "evince %s") ("\\.x?html?\\'" . "/usr/bin/firefox %s") ) org-file-apps )) ;; babel stuff (require 'ob-clojure) (require 'ob-gnuplot) (use-package ob-restclient :ensure t) (require 'ob-restclient) (setq org-babel-clojure-backend 'cider) (org-babel-do-load-languages 'org-babel-load-languages '((python . t) (restclient . t) (emacs-lisp . t) (gnuplot . t) (shell . t) (java . t) (C . t) (clojure . t) (js . t) (ditaa . t) (dot . t) (org . t) (latex . t ) )) (setq mail-user-agent 'mu4e-user-agent) (use-package org-msg :config (setq org-msg-options "html-postamble:nil H:5 num:nil ^:{} toc:nil tex:dvipng") (setq org-msg-startup "hidestars indent inlineimages") (setq org-msg-greeting-fmt "\n%s,\n\n") (setq org-msg-greeting-fmt-mailto t) (setq org-msg-signature " ,#+begin_signature -- *Mike* \\\\ ,#+end_signature") (org-msg-mode)) (require 'org-tempo) ;; to bring back easy templates using }} $0 {{< /highlight >}} ================================================ FILE: snippets/org-mode/img ================================================ # -*- mode: snippet -*- # name: img # key: img # expand-env: ((yas-indent-line 'fixed) (yas-wrap-around-region 'nil)) # -- #+begin_export html #+end_export ================================================ FILE: snippets/org-mode/post ================================================ # -*- mode: snippet -*- # name: post # key: post # expand-env: ((yas-indent-line 'fixed) (yas-wrap-around-region 'nil)) # -- --- title: ${1:`(capitalize (replace-regexp-in-string "-\\|_" " " (file-name-base))))`} date: `(format-time-string "%Y-%m-%dT%H:%M:%S-04:00" (current-time))` tags: categories: draft: true --- $0