From 450f4b01a859c5ddaf9553200657f68f460e03b9 Mon Sep 17 00:00:00 2001 From: Adam Goldsmith Date: Wed, 10 Jan 2018 12:26:56 -0500 Subject: [PATCH] Temporary, moving from adam-sp --- .emacs.d/.mc-lists.el | 122 +++++++++++++++++++------------- .emacs.d/init.el | 55 ++++++++++++-- .emacs.d/snippets/c-mode/guards | 11 +++ 3 files changed, 130 insertions(+), 58 deletions(-) create mode 100644 .emacs.d/snippets/c-mode/guards diff --git a/.emacs.d/.mc-lists.el b/.emacs.d/.mc-lists.el index bb43012..fcd5f95 100644 --- a/.emacs.d/.mc-lists.el +++ b/.emacs.d/.mc-lists.el @@ -3,57 +3,77 @@ (setq mc/cmds-to-run-for-all '( - LaTeX-babel-insert-hyphen - LaTeX-environment - LaTeX-insert-left-brace - TeX-insert-backslash - TeX-insert-dollar - TeX-insert-sub-or-superscript - c-electric-brace - c-electric-colon - c-electric-lt-gt - c-electric-paren - c-electric-semi&comma - c-electric-slash - c-indent-line-or-region - comment-dwim - electric-newline-and-maybe-indent - electric-verilog-colon - electric-verilog-semi - electric-verilog-tab - hydra-mc/mc/edit-lines - indent-for-tab-command - kill-region - markdown-exdent-or-delete - reindent-then-newline-and-indent - yas-expand - )) + LaTeX-babel-insert-hyphen + LaTeX-environment + LaTeX-insert-left-brace + TeX-insert-backslash + TeX-insert-dollar + TeX-insert-sub-or-superscript + c-electric-brace + c-electric-colon + c-electric-lt-gt + c-electric-paren + c-electric-semi&comma + c-electric-slash + c-electric-star + c-indent-line-or-region + comment-dwim + counsel-yank-pop + delete-indentation + downcase-region + electric-newline-and-maybe-indent + electric-verilog-colon + electric-verilog-semi + electric-verilog-tab + ess-smart-comma + forward-sexp + hydra--universal-argument + hydra-mc/mc/edit-lines + indent-for-tab-command + kill-region + markdown-exdent-or-delete + markdown-outdent-or-delete + org-beginning-of-line + org-end-of-line + org-force-self-insert + org-return-indent + org-self-insert-command + org-yank + reindent-then-newline-and-indent + sgml-slash + sh-assignment + yas-expand + )) (setq mc/cmds-to-run-once '( - TeX-view - hydra--digit-argument - hydra-mc-manual/body - hydra-mc-manual/lambda- - hydra-mc-manual/lambda--and-exit - hydra-mc-manual/lambda-SPC - hydra-mc/body - hydra-mc/mc/edit-ends-of-lines - hydra-mc/mc/edit-lines - hydra-mc/mc/edit-lines-and-exit - hydra-mc/mc/insert-numbers - hydra-mc/mc/mark-all-dwim - hydra-mc/mc/mark-all-symbols-like-this - hydra-mc/mc/mark-next-like-this - hydra-mc/mc/mark-previous-like-this - hydra-mc/mc/skip-to-next-like-this - hydra-mc/mc/skip-to-previous-like-this - hydra-mc/mc/sort-regions - hydra-mc/mc/unmark-next-like-this - hydra-mc/mc/unmark-previous-like-this - hydra-mc/nil - mouse-set-region - recompile - smex - switch-to-buffer - )) + TeX-view + avy-goto-char + counsel-M-x + count-lines-page + handle-switch-frame + hydra--digit-argument + hydra-mc-manual/body + hydra-mc-manual/lambda- + hydra-mc-manual/lambda--and-exit + hydra-mc-manual/lambda-SPC + hydra-mc/body + hydra-mc/mc/edit-ends-of-lines + hydra-mc/mc/edit-lines + hydra-mc/mc/edit-lines-and-exit + hydra-mc/mc/insert-numbers + hydra-mc/mc/mark-all-dwim + hydra-mc/mc/mark-all-symbols-like-this + hydra-mc/mc/mark-next-like-this + hydra-mc/mc/mark-previous-like-this + hydra-mc/mc/skip-to-next-like-this + hydra-mc/mc/skip-to-previous-like-this + hydra-mc/mc/sort-regions + hydra-mc/mc/unmark-next-like-this + hydra-mc/mc/unmark-previous-like-this + hydra-mc/nil + mouse-set-region + recompile + smex + switch-to-buffer + )) diff --git a/.emacs.d/init.el b/.emacs.d/init.el index 831d5c7..a8f1898 100644 --- a/.emacs.d/init.el +++ b/.emacs.d/init.el @@ -77,7 +77,12 @@ (toggle-read-only 1))) (add-hook 'compilation-start-hook - (lambda (x) (setq-local scroll-up-aggressively 0.0)))) + (lambda (x) (setq-local scroll-up-aggressively 0.0))) + (defun compile-chooser (command-alist) + (let ((command (ivy-completing-read + "Command: " (mapcar 'car command-alist) + :require-match t))) + (compile (assoc-default command command-alist))))) (use-package verilog-mode :defer @@ -90,6 +95,7 @@ verilog-linter "verilator --lint-only") (add-hook 'verilog-mode-hook (lambda () (setq indent-tabs-mode nil))) (add-to-list 'company-keywords-alist (cons 'verilog-mode verilog-keywords))) +; (font-lock-add-keywords 'verilog-mode '("[0-9]+'[bBdDhH][0-9]+" . '(:foreground "teal")))) (use-package python :defer @@ -175,6 +181,7 @@ (setq org-confirm-babel-evaluate nil) (add-to-list 'org-babel-load-languages '(dot . t)) + (add-to-list 'org-babel-load-languages '(R . t)) (add-to-list 'org-src-lang-modes '("dot" . graphviz-dot))) (use-package windmove @@ -331,6 +338,7 @@ (use-package cat-mode :quelpa (cat-mode :fetcher github :repo "ad1217/emacs-cat-mode") :config + (load-file "~/.emacs.d/cat-mode/cat-mode.el") (cat-mode 1) (bind-key "C-x C-M-C" 'kill-this-cat-kill-terminal) (eval-after-load "ibuffer" @@ -356,6 +364,14 @@ :bind ("C-S-" . forward-mark) :bind ("C-S-" . show-marks)) +;; (use-package evil :ensure +;; :config +;; (evil-mode 1)) + +(use-package evil-exchange :ensure + :config + (evil-exchange-install)) + ;;;; optional external packages (use-package arduino-mode :mode "\\.pde\\'" @@ -406,7 +422,7 @@ (use-package markdown-mode :config - (setq markdown-command "markdown_py -x markdown.extensions.wikilinks -x markdown.extensions.smarty -x markdown.extensions.extra -x latex -x markdown.extensions.sane_lists -x markdown.extensions.toc -x markdown_checklist.extension -c ~/.emacs.d/markdownConfig.yml" + (setq markdown-command "markdown_py -x markdown.extensions.wikilinks -x markdown.extensions.smarty -x markdown.extensions.extra -x markdown.extensions.sane_lists -x markdown.extensions.toc" markdown-enable-math t) :bind (:map markdown-mode-map ("" . markdown-demote) @@ -453,13 +469,14 @@ ("^(D) " 0 '(:foreground "light green")) ("^(Y) " 0 '(:foreground "light grey")) ("([A-Z]+)" . font-lock-builtin-face) - ("\\([a-zA-Z0-9_-]+\\):\\([a-zA-Z0-9._-]+\\)" . font-lock-variable-name-face) - ("+\\w+" . font-lock-function-name-face) - ("@\\w+" . font-lock-type-face) + ("\\([a-zA-Z0-9_-]+\\):\\([+a-zA-Z0-9._-]+\\)" . font-lock-variable-name-face) + (" \\+\\w+" . font-lock-function-name-face) + (" @\\w+" . font-lock-type-face) + ("\\([/a-zA-Z0-9_-]+\\):\\([+a-zA-Z0-9._-]+\\)" 0 '(:foreground "red")) ("#important" 0 '(:foreground "orange red")) ; special tag ("#waiting" 0 '(:foreground "dark orange")) ; special tag ("#\\w+" . font-lock-comment-face) - ("-\\([a-zA-Z_-]+\\)" . font-lock-variable-name-face) + (" -\\([a-zA-Z_-]+\\)" . font-lock-variable-name-face) ("^[0-9]+-[0-9]+-[0-9]+" 0 '(:foreground "gray90")))) (defun todotxt-open-sub () "Opens the todotxt sub on current line" @@ -469,6 +486,7 @@ (find-file (concat (match-string 1 line) "/" (match-string 2 line)))))) (use-package latex + :defer :bind (:map LaTeX-mode-map ("C-z" . latex-save-and-compile) ("C-c e" . tex-close-latex-block)) @@ -527,7 +545,12 @@ :config (setq pkgbuild-user-full-name "Adam Goldsmith" pkgbuild-user-mail-address "contact@adamgoldsmith.name" - pkgbuild-makepkg-command "PKGEXT='.pkg.tar' makepkg -mf")) + pkgbuild-makepkg-command "PKGEXT='.pkg.tar' makepkg -mf" + pkgbuild-commands `(("namcap package" . "NAME=$(ls *.pkg.tar* | sort | tail -n1); echo \"Running namcap on $NAME\"; namcap $NAME") + ("namcap pkgbuild" . "namcap PKGBUILD") + ("makepkg" . ,pkgbuild-makepkg-command))) + (defun pkgbuild-compile () (interactive) (compile-chooser pkgbuild-commands)) + (define-key pkgbuild-mode-map (kbd "C-c z") 'pkgbuild-compile)) (use-package mmm-mode :config @@ -573,6 +596,24 @@ (setq company-tern-property-marker "⚫") (add-hook 'js2-mode-hook (lambda () (tern-mode t)))) +(use-package nm + :config + (defun nm-read () + "Mark message as read." + (interactive) + (nm-apply-to-result (lambda (q) + (notmuch-tag q '("-unread")))) + (nm-update-tags) + (forward-line)) + (define-key nm-mode-map "N" 'nm-read)) + +;; (use-package company-emacs-eclim +;; :config +;; (require 'eclimd) +;; (setq eclim-executable "/usr/lib/eclipse/eclim") +;; (company-emacs-eclim-setup) +;; (global-eclim-mode 1)) + ;;; Local Variables (add-to-list 'safe-local-eval-forms '(outline-hide-body)) ;; Local Variables: diff --git a/.emacs.d/snippets/c-mode/guards b/.emacs.d/snippets/c-mode/guards new file mode 100644 index 0000000..aa2b4e5 --- /dev/null +++ b/.emacs.d/snippets/c-mode/guards @@ -0,0 +1,11 @@ +# -*- mode: snippet; require-final-newline: nil -*- +# name: guards +# key: gaurds +# expand-env: (gaurd-name (upcase (replace-regexp-in-string "\\." "_" (file-name-nondirectory (buffer-file-name))))) +# -- +#ifndef ${1:`(upcase (file-name-nondirectory (file-name-sans-extension (buffer-file-name))))`_H} +#define $1 + +$0 + +#endif /* $1 */