X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=emacs_el%2Fconfiguration%2Fdon-configuration.org;h=6235cc871256b51bf0d5be3082728b4e4bd7ee6a;hb=d70a43efdc779ac98a9efbd35e3082a8673e4a79;hp=9aeb4e7d9dbeb7fb15e15f3624390dd65837d095;hpb=852dfc904566fdf573daa03218c940aead69525b;p=lib.git diff --git a/emacs_el/configuration/don-configuration.org b/emacs_el/configuration/don-configuration.org index 9aeb4e7..6235cc8 100644 --- a/emacs_el/configuration/don-configuration.org +++ b/emacs_el/configuration/don-configuration.org @@ -1,4 +1,5 @@ #+PROPERTY: header-args:emacs-lisp :tangle don-configuration.el +#+OPTIONS: auto-id:f * Load debugger # if for some reason, things get pear-shaped, we want to be able to @@ -7,6 +8,25 @@ #+BEGIN_SRC emacs-lisp (setq debug-on-event 'siguser2) #+END_SRC +* Paths +** Update PATH +#+BEGIN_SRC emacs-lisp + (add-to-list 'exec-path '"/usr/local/bin") + (add-to-list 'exec-path '"~/bin/") +#+END_SRC +** Add library paths +#+BEGIN_SRC emacs-lisp +(eval-when-compile + (let ((default-directory "~/var/emacs/elpa")) + (normal-top-level-add-subdirs-to-load-path)) + ) +(add-to-list 'load-path '"~/lib/emacs_el/") +(let ((default-directory "~/lib/emacs_el/")) + (normal-top-level-add-subdirs-to-load-path)) +(let ((default-directory "~/var/emacs/elpa")) + (normal-top-level-add-subdirs-to-load-path)) +(setq package-user-dir "~/var/emacs/elpa") +#+END_SRC * Initial startup stuff ** Disable startup screen #+BEGIN_SRC emacs-lisp @@ -25,69 +45,29 @@ #+END_SRC * Package management ** package repositories and package manager -Borrowed from https://github.com/nilcons/emacs-use-package-fast/ to -load [[https://github.com/jwiegley/use-package/][use-package]] even faster -#+BEGIN_SRC emacs-lisp - (eval-and-compile - ;; add /etc/ssl/ca-global/ca-certificates.crt so that we can - ;; download packages when we're on Debian hosts which chop down the - ;; list of available certificates - (require 'gnutls) - (add-to-list 'gnutls-trustfiles "/etc/ssl/ca-global/ca-certificates.crt") - (setq package-enable-at-startup nil) - (setq package--init-file-ensured t) - (setq package-user-dir "~/var/emacs/elpa") - (setq package-archives '(("gnu" . "https://elpa.gnu.org/packages/") - ("melpa" . "https://melpa.org/packages/") - ("org" . "http://orgmode.org/elpa/"))) - (setq use-package-verbose (not (bound-and-true-p byte-compile-current-file)))) - (mapc #'(lambda (add) (add-to-list 'load-path add)) - (eval-when-compile - (package-initialize) - (unless (package-installed-p 'use-package) - (package-refresh-contents) - (package-install 'use-package)) - (let ((package-user-dir-real (file-truename package-user-dir))) - ;; The reverse is necessary, because outside we mapc - ;; add-to-list element-by-element, which reverses. - (nreverse (apply #'nconc - ;; Only keep package.el provided loadpaths. - (mapcar #'(lambda (path) - (if (string-prefix-p package-user-dir-real path) - (list path) - nil)) - load-path)))))) - - ;;; fix up info paths for packages - (with-eval-after-load "info" - (info-initialize) - (dolist (dir (directory-files package-user-dir)) - (let ((fdir (concat (file-name-as-directory package-user-dir) dir))) - (unless (or (member dir '("." ".." "archives" "gnupg")) - (not (file-directory-p fdir)) - (not (file-exists-p (concat (file-name-as-directory fdir) "dir")))) - (add-to-list 'Info-directory-list fdir))))) - - - (eval-when-compile - (require 'use-package)) - (require 'bind-key) - (require 'diminish) +#+BEGIN_SRC emacs-lisp + (require 'use-package) +(require 'gnutls) + (add-to-list 'gnutls-trustfiles "/etc/ssl/ca-global/ca-certificates.crt") + (setq package-enable-at-startup nil) + (setq package--init-file-ensured t) + (setq package-user-dir "~/var/emacs/elpa") + (setq package-archives '(("gnu" . "https://elpa.gnu.org/packages/") + ("melpa" . "https://melpa.org/packages/") + ("org" . "http://orgmode.org/elpa/"))) + (setq use-package-verbose (not (bound-and-true-p byte-compile-current-file))) + #+END_SRC ** Paradox #+BEGIN_SRC emacs-lisp (use-package paradox :ensure paradox :commands (paradox-upgrade-packages paradox-list-packages) - :config (setq paradox-execute-asynchronously t) + :config + (setq paradox-execute-asynchronously t) + (setq paradox-github-token t) ; I don't want to be prompted about this integration ) #+END_SRC -* Add library paths - -#+BEGIN_SRC emacs-lisp - (add-to-list 'load-path '"~/lib/emacs_el/") - (add-to-list 'load-path '"~/lib/emacs_el/magit-annex") -#+END_SRC * Disable custom-vars #+BEGIN_SRC emacs-lisp ;; Set the custom file to /dev/null and don't bother to load it @@ -161,6 +141,36 @@ load [[https://github.com/jwiegley/use-package/][use-package]] even faster ) #+END_SRC + +** Flycheck +#+begin_src emacs-lisp :tangle yes +(use-package flycheck + :ensure t + :diminish 🦋 + :if (version<= "24.4" emacs-version) + :commands flycheck-mode + :hook ((prog-mode . flycheck-mode) + ) +) +;; Other pkgs +(use-package flycheck-tip + :ensure t + :commands 'flycheck-tip-cycle + :after flycheck + :bind (:map flycheck-mode-map + ("C-c C-n" . flycheck-tip-cycle))) + +(use-package flycheck-package + :ensure t) + +(use-package flycheck-checkpatch + :ensure t + :config (flycheck-checkpatch-setup) + :config (setq flycheck-checkers (delete 'checkpatch + flycheck-checkers)) + :config (add-to-list 'flycheck-checkers 'checkpatch t)) +#+end_src + ** Flymake #+begin_src emacs-lisp :tangle yes (use-package flymake @@ -673,10 +683,12 @@ value, scrolling continues until there is no more output. ** SQL mode #+BEGIN_SRC emacs-lisp ; load sql-indent when sql is loaded +(use-package sql-indent + :hook sql-mode + ) (use-package sql :mode (("\\.sql\\'" . sql-mode)) - :config - (require sql-indent)) + ) #+END_SRC ** Ediff #+BEGIN_SRC emacs-lisp @@ -1203,8 +1215,8 @@ This can be used to link things pretty quickly if necessary (defun dla/ess-region-remote-eval (start end) "Evaluate region in a remote ESS instance" (interactive "r") - (shell-command-on-region start end "eval_r" (get-buffer-create "***essregionremoteeval***")) - kill-buffer "***essregionremoteeval***") + (shell-command-on-region start end "eval_r" (get-buffer-create "***essregionremoteeval***") nil nil nil) + (kill-buffer "***essregionremoteeval***")) ;; Don't restore history or save workspace image '(inferior-R-args "--no-restore-history --no-save") ) @@ -1221,6 +1233,14 @@ From http://julien.danjou.info/projects/emacs-packages#rainbow-mode, this colori ) #+END_SRC +** YAML Mode +#+BEGIN_SRC emacs-lisp + (use-package yaml-mode + ;; add ess to the x major mode + :mode ("\\.\\(yaml|yml\\)\\'" . yaml-mode) + ) +#+END_SRC + ** Polymode #+BEGIN_SRC emacs-lisp (use-package poly-noweb @@ -1288,10 +1308,27 @@ From http://julien.danjou.info/projects/emacs-packages#rainbow-mode, this colori (setq atomic-chrome-buffer-open-style 'full) ) #+END_SRC +** Edit Server +#+BEGIN_SRC emacs-lisp + (use-package edit-server + :ensure t + :commands edit-server-start + :init (if after-init-time + (edit-server-start) + (add-hook 'after-init-hook + #'(lambda() (edit-server-start)))) + :config (setq edit-server-new-frame-alist + '((name . "Edit with Emacs FRAME") + (top . 200) + (left . 200) + (width . 80) + (height . 25) + (minibuffer . t) + (menu-bar-lines . t) + (window-system . x))) + ) +#+END_SRC ** Multiple Cursors - :PROPERTIES: - :ID: 6fcf218b-a762-4c37-9339-a8202ddeb544 - :END: [[https://github.com/magnars/multiple-cursors.el][Multiple Cursors]] #+BEGIN_SRC emacs-lisp (use-package multiple-cursors @@ -1356,6 +1393,71 @@ From http://julien.danjou.info/projects/emacs-packages#rainbow-mode, this colori (setq default-abbrev-mode t)) #+END_SRC +** Debugging (realgud) +#+BEGIN_SRC emacs-lisp +(use-package realgud + :ensure t + ) +#+END_SRC +** Python Programming +#+BEGIN_SRC emacs-lisp +(use-package python-mode + :hook + (python-mode . pyenv-mode) + (python-mode . flycheck-mode) + (python-mode . company-mode) + (python-mode . blacken-mode) + (python-mode . yas-minor-mode) + (python-mode . anaconda-mode) + ) +(use-package pyenv + :ensure t + ) +(use-package blacken + :init + (setq-default blacken-fast-unsafe t) + (setq-default blacken-line-length 80) + :ensure t) +(use-package anaconda-mode + :ensure t + ) + +(use-package elpy + :ensure t + :init + (elpy-enable) + ) +#+END_SRC +# *** Jedi +# #+BEGIN_SRC emacs-lisp +# (use-package company-jedi +# :ensure t +# :hook (python-mode . (add-to-list 'company-backends 'company-jedi)) +# :hook (python-mode . 'jedi:setup) +# :config +# (setq jedi:complete-on-dot t) +# ) +# #+END_SRC +*** Black +#+begin_src emacs-lisp :tangle yes + (use-package python-black + :demand t + :after python) +#+end_src +*** Sphinx Documentation +#+begin_src emacs-lisp :tangle yes + (use-package numpydoc + :ensure t + :after python + :bind (:map python-mode-map + ("C-c C-n" . numpydoc-generate))) + (use-package sphinx-doc + :ensure t + :config + (sphinx-doc-mode t) + (setq sphinx-doc-include-types t) + :after python) +#+end_src ** Go language #+BEGIN_SRC emacs-lisp (use-package go-mode @@ -1712,7 +1814,7 @@ From http://julien.danjou.info/projects/emacs-packages#rainbow-mode, this colori (interactive) (save-excursion (org-back-to-heading 'invisible-ok) - (hide-other) + (outline-hide-other) (org-cycle) (org-cycle) (org-cycle))) @@ -1733,22 +1835,27 @@ From http://julien.danjou.info/projects/emacs-packages#rainbow-mode, this colori (setq org-use-fast-todo-selection t) (setq org-treat-S-cursor-todo-selection-as-state-change nil) - ; create function to create headlines in file. This comes from - ; http://stackoverflow.com/questions/13340616/assign-ids-to-every-entry-in-org-mode - (defun my/org-add-ids-to-headlines-in-file () - "Add ID properties to all headlines in the current file which - do not already have one." - (interactive) - (org-map-entries 'org-id-get-create)) - (defun dla/org-update-ids-to-headlines-in-file () - "Add or replace ID properties to all headlines in the current file - (or narrowed region)." - (interactive) - (org-map-entries '(lambda () (org-id-get-create t)))) - ; if we wanted to do this to every buffer, do the following: - ; (add-hook 'org-mode-hook - ; (lambda () - ; (add-hook 'before-save-hook 'my/org-add-ids-to-headlines-in-file nil 'local))) +; create function to create headlines in file. This comes from +; http://stackoverflow.com/questions/13340616/assign-ids-to-every-entry-in-org-mode +(defun my/org-add-ids-to-headlines-in-file () + "Add ID properties to all headlines in the current file which +do not already have one." + (interactive) + (save-excursion + (widen) + (goto-char (point-min)) + (when (not (re-search-forward "^#\\+OPTIONS:.*auto-id:f" (point-max) t)) + (org-map-entries 'org-id-get-create)))) +(defun dla/org-update-ids-to-headlines-in-file () + "Add or replace ID properties to all headlines in the current file +(or narrowed region)." + (interactive) + + (org-map-entries '(lambda () (org-id-get-create t)))) +; if we wanted to do this to every buffer, do the following: +(add-hook 'org-mode-hook + (lambda () + (add-hook 'before-save-hook 'my/org-add-ids-to-headlines-in-file nil 'local))) #+END_SRC ** Org ID locations #+BEGIN_SRC emacs-lisp @@ -2000,9 +2107,6 @@ Maildir, or by Message-ID." #+END_SRC ** LaTeX configuration - :PROPERTIES: - :ID: 7135ba17-6a50-4eed-84ca-b90afa5b12f8 - :END: #+BEGIN_SRC emacs-lisp (use-package ox-extra :config @@ -2225,7 +2329,7 @@ as the default task." ;; We're in the agenda ;; (let* ((marker (org-get-at-bol 'org-hd-marker)) - (tags (org-with-point-at marker (org-get-tags-at)))) + (tags (org-with-point-at marker (org-get-tags)))) (if (and (eq arg 4) tags) (org-agenda-clock-in '(16)) (bh/clock-in-organization-task-as-default))) @@ -2461,6 +2565,11 @@ same directory as the org-buffer and insert a link to this file." ) #+END_SRC * Keybindings +** Home/End Begining/End of line +#+BEGIN_SRC emacs-lisp + (global-set-key [home] 'move-beginning-of-line) + (global-set-key [end] 'move-end-of-line) +#+END_SRC ** Goto line #+BEGIN_SRC emacs-lisp (global-unset-key "\M-g") @@ -2516,16 +2625,28 @@ same directory as the org-buffer and insert a link to this file." (show-paren-mode 1) (setq show-paren-delay 0.2) +#+END_SRC +** My Username +#+BEGIN_SRC emacs-lisp (setq user-mail-address "don@donarmstrong.com") +#+END_SRC +** Use primary selection on unix machines +#+BEGIN_SRC emacs-lisp ;; switch back to the old primary selection method - (setq x-select-enable-clipboard nil) - (setq x-select-enable-primary t) + (if (or (string-equal system-type "darwin") + (string-equal system-type "windows") + ) + (progn + (setq select-enable-clipboard t) + (setq select-enable-primary nil) + ) + (progn + (setq select-enable-clipboard nil) + (setq select-enable-primary t) + )) ; (setq mouse-drag-copy-region t) - (fset 'perl-mode 'cperl-mode) - ;;(load-file "cperl-mode.el") - ;; tramp configuration (setq tramp-use-ssh-controlmaster-options nil)