X-Git-Url: https://git.donarmstrong.com/?p=lib.git;a=blobdiff_plain;f=emacs_el%2Fconfiguration%2Fdon-configuration.org;h=407dde718bc7020cdc23072954a7099ee05c4fd6;hp=3af43ff679db09f372cb096c3cb84359193aa32b;hb=bb6f856e564fafbcb00d953c5d5ac534430e2e7a;hpb=05d492864f4cae4c27b887fb584b1b24ee4aaab0 diff --git a/emacs_el/configuration/don-configuration.org b/emacs_el/configuration/don-configuration.org index 3af43ff..407dde7 100644 --- a/emacs_el/configuration/don-configuration.org +++ b/emacs_el/configuration/don-configuration.org @@ -27,7 +27,10 @@ ** [[https://github.com/jwiegley/use-package/][use-package]] #+BEGIN_SRC emacs-lisp (package-initialize) - (require 'use-package) + (condition-case nil + (require 'use-package) + (progn (package-install 'use-package) + (require 'use-package))) #+END_SRC ** Paradox #+BEGIN_SRC emacs-lisp @@ -84,7 +87,6 @@ :ensure t :diminish flyspell-mode 🐝 :config - (add-hook 'message-mode-hook 'turn-on-flyspell) (add-hook 'text-mode-hook 'turn-on-flyspell) (add-hook 'c-mode-common-hook 'flyspell-prog-mode) (add-hook 'cperl-mode-hook 'flyspell-prog-mode) @@ -265,6 +267,7 @@ value, scrolling continues until there is no more output. :ensure t :bind (("C-c j ," . goto-last-change) ("C-c j ." . goto-last-change-reverse)) + ) #+END_SRC *** Jumping to bookmarks (visible bookmarks, bm) #+BEGIN_SRC emacs-lisp @@ -413,7 +416,7 @@ value, scrolling continues until there is no more output. #+BEGIN_SRC emacs-lisp ;;; stolen from https://github.com/malb/emacs.d/blob/master/malb.org - (defun malb/helm-swoop-pr2e-fill () + (defun malb/helm-swoop-pre-fill () (thing-at-point 'symbol)) (setq malb/helm-swoop-ignore-major-mode '(dired-mode paradox-menu-mode doc-view-mode pdf-view-mode @@ -499,7 +502,40 @@ value, scrolling continues until there is no more output. ((equal arg 16) (helm-org-rifle-occur-agenda-files)) (t (helm-org-agenda-files-headings))))))) #+END_SRC - +*** Helm Google +This can be used to link things pretty quickly if necessary +#+BEGIN_SRC emacs-lisp + (use-package helm-google + :ensure t + :bind ("C-c h g" . helm-google) + :config + (progn (add-to-list 'helm-google-actions + '("Copy URL" . (lambda (candidate) + (let ((url + (replace-regexp-in-string + "https://.*q=\\(.*\\)\&sa=.*" + "\\1" candidate))) + (kill-new url)))) + t + ) + + (add-to-list 'helm-google-actions + '("Org Store Link" . (lambda (candidate) + (let ((title (car (split-string candidate "[\n]+"))) + (url + (replace-regexp-in-string + "https://.*q=\\(.*\\)\&sa=.*" + "\\1" candidate))) + (push (list url title) org-stored-links)))) + t) + )) +#+END_SRC +** Zap to char +#+BEGIN_SRC emacs-lisp + (use-package avy-zap + :ensure t + :bind ("M-z" . avy-zap-up-to-char-dwim)) +#+END_SRC ** Hydra #+BEGIN_SRC emacs-lisp :tangle don-configuration.el (require 'don-hydra) @@ -524,6 +560,17 @@ value, scrolling continues until there is no more output. (setq-default reftex-default-bibliography '("~/projects/research/references.bib"))) #+END_SRC +** BibTex +#+BEGIN_SRC emacs-lisp + (use-package bibtex + :config (setq bibtex-user-optional-fields + (quote (("annote" "Personal annotation (ignored)") + ("abstract" "") + ("pmid" "") + ("doi" "")))) + ) + +#+END_SRC ** LaTeX #+BEGIN_SRC emacs-lisp (use-package tex @@ -625,24 +672,12 @@ value, scrolling continues until there is no more output. ("fixme" "{")) ) ) + (setq font-latex-fontify-script nil) + (setq font-latex-fontify-sectioning (quote color)) + (setq font-latex-script-display (quote (nil))) ) #+END_SRC -*** Org-Gcal -#+BEGIN_SRC emacs-lisp - (use-package calfw - :ensure f - ) - (use-package calfw-org - :ensure f - ) - (use-package org-gcal - :ensure f - :config '((if (file-readable-p "~/.hide/org_gcal.el") - (load-file "~/.hide/org_gcal.el")) - ) - ) -#+END_SRC ** ESS #+BEGIN_SRC emacs-lisp (use-package ess @@ -732,7 +767,8 @@ From http://julien.danjou.info/projects/emacs-packages#rainbow-mode, this colori ** GhostText/Atomic Chrome #+BEGIN_SRC emacs-lisp (use-package atomic-chrome - :config (atomic-chrome-start-server) + :config + (ignore-errors (atomic-chrome-start-server)) (setq atomic-chrome-buffer-open-style 'full) ) #+END_SRC @@ -749,6 +785,89 @@ From http://julien.danjou.info/projects/emacs-packages#rainbow-mode, this colori ("C-S-c C-S-c" . mc/edit-lines)) ) #+END_SRC +** Web Mode +#+BEGIN_SRC emacs-lisp + (use-package web-mode + :config + (add-to-list 'auto-mode-alist '("\\.tmpl\\'" . web-mode)) + (setq web-mode-enable-engine-detection t) + (setq web-mode-engines-alist + '(("template-toolkit" . "\\.tmpl\\'"))) + ) +#+END_SRC +* Email +** Message Mode +#+BEGIN_SRC emacs-lisp + (use-package post + :config + (setq post-email-address "don@donarmstrong.com") + (setq post-kill-quoted-sig nil) + (setq post-mail-message "mutt\\(ng\\|\\)-[a-z0-9]+-[0-9]+-.*") + (setq post-uses-fill-mode nil) + ) +#+END_SRC +** Mutt +*** Message-mode +#+BEGIN_SRC emacs-lisp + (use-package message + + :mode "muttng-[a-z0-9]+-[0-9]+-" + :mode "mutt-[a-z0-9]+-[0-9]+-" + :hook 'my/message-mode-settings + :hook 'turn-on-flyspell + :bind (:map message-mode-map + ("C-c C-a" . my/post-attach-file)) + :config + (defun my/message-mode-settings () + (font-lock-add-keywords nil + '(("^[ \t]*>[ \t]*>[ \t]*>.*$" + (0 'message-multiply-quoted-text-face)) + ("^[ \t]*>[ \t]*>.*$" + (0 'message-double-quoted-text-face)))) + ) + + (defun my/post-attach-file () + "Prompt for an attachment." + (interactive) + (let ((file (read-file-name "Attach file: " nil nil t nil)) + (description (string-read "Description: "))) + (my/header-attach-file file description))) + + (defun my/header-attach-file (file description) + "Attach a FILE to the current message (works with Mutt). + Argument DESCRIPTION MIME description." + (interactive "fAttach file: \nsDescription: ") + (when (> (length file) 0) + (save-excursion + (save-match-data + (save-restriction + (widen) + (goto-char (point-min)) + (search-forward-regexp "^$") + (insert (concat "Attach: " (replace-regexp-in-string "\\([[:space:]\\]\\)" "\\\\\\1" (file-truename file)) " " + description "\n")) + (message (concat "Attached '" file "'.")) + (setq post-has-attachment t)))))) + + (setq mail-yank-prefix "> ") + ) +#+END_SRC +*** Muttrc mode +#+BEGIN_SRC emacs-lisp + (use-package muttrc-mode + :mode "muttngrc" + :mode "muttrc" + ) + +#+END_SRC +* Base emacs +** Reverting buffers +#+BEGIN_SRC emacs-lisp + (setq global-auto-revert-non-file-buffers t + global-auto-revert-ignore-modes '(pdf-view-mode) + auto-revert-verbose nil) + (global-auto-revert-mode 1) +#+END_SRC * Org Mode ** Use-package and load things #+BEGIN_SRC emacs-lisp @@ -759,11 +878,11 @@ From http://julien.danjou.info/projects/emacs-packages#rainbow-mode, this colori #+END_SRC ** Agenda Configuration #+BEGIN_SRC emacs-lisp - ;; The following lines are always needed. Choose your own keys. - (add-to-list 'auto-mode-alist '("\\.\\(org\\|org_archive\\|txt\\)$" . org-mode)) - (global-set-key "\C-cl" 'org-store-link) - (global-set-key "\C-ca" 'org-agenda) - (global-set-key "\C-cb" 'org-iswitchb) + :mode ("\\.\\(org\\|org_archive\\|txt\\)\\'" . org-mode) + :bind (("C-c l" . org-store-link) + ("C-c a" . org-agenda) + ("C-c b" . org-iswitchb)) + :config (setq-default org-log-done 'time) (setq-default org-agenda-ndays 5) @@ -860,7 +979,6 @@ From http://julien.danjou.info/projects/emacs-packages#rainbow-mode, this colori "~/projects/org-notes/wildman.org" "~/projects/org-notes/uddin.org" "~/projects/org-notes/reviews.org" - "~/projects/org-notes/hpcbio.org" "~/org-mode/from-mobile.org" "~/projects/org-notes/fh.org"))) @@ -884,12 +1002,6 @@ From http://julien.danjou.info/projects/emacs-packages#rainbow-mode, this colori (write-file "/tmp/timeline.org") (org-agenda arg "L"))) (define-key org-mode-map (kbd "C-c t") 'org-agenda-timeline-all) - ;; add automatic reminders for appointments - (defadvice org-agenda-redo (after org-agenda-redo-add-appts) - "Pressing `r' on the agenda will also add appointments." - (progn - (setq appt-time-msg-list nil) - (org-agenda-to-appt))) #+END_SRC ** General config @@ -898,7 +1010,7 @@ From http://julien.danjou.info/projects/emacs-packages#rainbow-mode, this colori (setq org-columns-default-format "%40ITEM(Task) %6Effort{:} %CLOCKSUM %PRIORITY %TODO %13SCHEDULED %13DEADLINE %TAGS") (setq org-default-notes-file "~/projects/org-notes/notes.org") - (setq org-id-link-to-org-use-id t) + (setq org-id-link-to-org-use-id 'use-existing) #+END_SRC ** Capture Templates #+BEGIN_SRC emacs-lisp @@ -1163,11 +1275,11 @@ From http://julien.danjou.info/projects/emacs-packages#rainbow-mode, this colori (org-add-link-type "mutt" 'open-mail-in-mutt) (defun my-org-mode-setup () - (load-library "reftex") + ; (load-library "reftex") (and (buffer-file-name) (file-exists-p (buffer-file-name)) (progn - (reftex-parse-all) + ; (reftex-parse-all) (reftex-set-cite-format '((?b . "[[bib:%l][%l-bib]]") (?n . "[[notes:%l][%l-notes]]") @@ -1245,7 +1357,7 @@ From http://julien.danjou.info/projects/emacs-packages#rainbow-mode, this colori (setq org-icalendar-timezone "America/Los_Angeles") (setq org-icalendar-use-scheduled '(todo-start event-if-todo)) ;; we already add the id manually - ;; (setq org-icalendar-store-UID t) + (setq org-icalendar-store-UID t) #+END_SRC ** General Org Babel Configuration @@ -1661,6 +1773,62 @@ From http://julien.danjou.info/projects/emacs-packages#rainbow-mode, this colori (min (1+ (match-end 0)) end))) (unless (bolp) (insert "\n")))))))))))) +#+END_SRC +** Org-Gcal +#+BEGIN_SRC emacs-lisp + (use-package calfw + :ensure f + ) + (use-package calfw-org + :ensure f + ) + (use-package org-gcal + :ensure f + :config '((if (file-readable-p "~/.hide/org_gcal.el") + (load-file "~/.hide/org_gcal.el")) + ) + ) +#+END_SRC +** appt integration +#+BEGIN_SRC emacs-lisp + (use-package appt + :config + ;; Show notification 10 minutes before event + (setq appt-message-warning-time 10) + ;; Disable multiple reminders + (setq appt-display-interval appt-message-warning-time) + (setq appt-display-mode-line nil) + + ;; add automatic reminders for appointments + (defun my/org-agenda-to-appt () + (interactive) + (setq appt-time-msg-list nil) + (org-agenda-to-appt)) + ;; add reminders when starting emacs + (my/org-agenda-to-appt) + ;; when rebuilding the agenda + (defadvice org-agenda-redo (after org-agenda-redo-add-appts) + "Pressing `r' on the agenda will also add appointments." + (my/org-agenda-to-appt) + ) + ;; when saving all org buffers + (defadvice org-save-all-org-buffers (after org-save-all-org-buffers-add-appts) + "Re-add appts after saving all org buffers" + (my/org-agenda-to-appt)) + ; Display appointments as a window manager notification + (setq appt-disp-window-function 'my/appt-display) + (setq appt-delete-window-function (lambda () t)) + + (setq my/appt-notification-app (concat (getenv "HOME") "/bin/appt_notification")) + + (defun my/appt-display (min-to-app new-time msg) + (if (atom min-to-app) + (start-process "my/appt-notification-app" nil my/appt-notification-app min-to-app msg) + (dolist (i (number-sequence 0 (1- (length min-to-app)))) + (start-process "my/appt-notification-app" nil my/appt-notification-app + (nth i min-to-app) (nth i msg)))))) + + #+END_SRC ** End use-package #+BEGIN_SRC emacs-lisp @@ -1701,23 +1869,26 @@ From http://julien.danjou.info/projects/emacs-packages#rainbow-mode, this colori (global-unset-key "\M-g") (global-set-key (kbd "M-g l") 'goto-line) #+END_SRC +* Debian +** debian-changelog +#+BEGIN_SRC emacs-lisp + (use-package debian-changelog + :mode "debian/changelog" + :config + (setq debian-changelog-mailing-address "don@debian.org") + (setq debian-changelog-full-name "Don Armstrong")) +#+END_SRC * Misc (uncharacterized) #+BEGIN_SRC emacs-lisp - (setq bibtex-user-optional-fields (quote (("annote" "Personal annotation (ignored)") ("abstract" "") ("pmid" "") ("doi" "")))) - (setq calendar-latitude 40.11) - (setq calendar-longitude -88.24) + (setq calendar-latitude 38.6) + (setq calendar-longitude -121.5) (setq case-fold-search t) (setq confirm-kill-emacs (quote y-or-n-p)) (setq cperl-lazy-help-time nil) - (setq debian-changelog-mailing-address "don@debian.org") (display-time) (setq display-time-24hr-format t) (setq display-time-day-and-date t) (display-time-mode 1) - (setq font-latex-fontify-script nil) - (setq font-latex-fontify-sectioning (quote color)) - (setq font-latex-script-display (quote (nil))) - (global-auto-revert-mode 1) (global-font-lock-mode 1) (icomplete-mode 1) (setq log-edit-keep-buffer t) @@ -1725,10 +1896,6 @@ From http://julien.danjou.info/projects/emacs-packages#rainbow-mode, this colori (setq markdown-enable-math t) (setq markdown-follow-wiki-link-on-enter nil) (setq mutt-alias-file-list (quote ("~/.mutt/aliases" "~/.mail_aliases"))) - (setq post-email-address "don@donarmstrong.com") - (setq post-kill-quoted-sig nil) - (setq post-mail-message "mutt\\(ng\\|\\)-[a-z0-9]+-[0-9]+-.*") - (setq post-uses-fill-mode nil) (setq ps-footer-font-size (quote (8 . 10))) (setq ps-header-font-size (quote (8 . 10))) (setq ps-header-title-font-size (quote (10 . 10))) @@ -1760,17 +1927,6 @@ From http://julien.danjou.info/projects/emacs-packages#rainbow-mode, this colori (require 'vcl-mode) - (require 'tex-site) - ;;(require 'psvn) - ;;(require 'ecasound) - ;;(require 'emacs-wiki) - (require 'bibtex) - (require 'post) - ;;(require 'fixme) - ; (require 'google-weather) - ; (require 'org-google-weather) - ; (setq-default org-google-weather-format "%i %c, [%l,%h] %s %C") - (global-set-key "\C-xp" 'server-edit) (setq-default auto-mode-alist (cons '("\.wml$" . @@ -1786,51 +1942,6 @@ From http://julien.danjou.info/projects/emacs-packages#rainbow-mode, this colori ;; tramp configuration (setq tramp-use-ssh-controlmaster-options nil) - ; mail configuration - (add-to-list 'auto-mode-alist '("muttng-[a-z0-9]+-[0-9]+-" . message-mode)) - (add-to-list 'auto-mode-alist '("muttngrc" . muttrc-mode)) - - (add-to-list 'auto-mode-alist '("mutt-[a-z0-9]+-[0-9]+-" . message-mode)) - (add-to-list 'auto-mode-alist '("muttrc" . muttrc-mode)) - (defun my-message-mode-settings () - (font-lock-add-keywords nil - '(("^[ \t]*>[ \t]*>[ \t]*>.*$" - (0 'message-multiply-quoted-text-face)) - ("^[ \t]*>[ \t]*>.*$" - (0 'message-double-quoted-text-face)))) - (local-set-key (kbd "C-c C-a") 'my-post-attach-file) - ) - (add-hook 'message-mode-hook 'my-message-mode-settings) - - (defun my-post-attach-file () - "Prompt for an attachment." - (interactive) - (let ((file (read-file-name "Attach file: " nil nil t nil)) - (description (string-read "Description: "))) - (my-header-attach-file file description))) - - (symbol-function 'my-post-attach-file) - - (defun my-header-attach-file (file description) - "Attach a FILE to the current message (works with Mutt). - Argument DESCRIPTION MIME description." - (interactive "fAttach file: \nsDescription: ") - (when (> (length file) 0) - (save-excursion - (save-match-data - (save-restriction - (widen) - (goto-char (point-min)) - (search-forward-regexp "^$") - (insert (concat "Attach: " (replace-regexp-in-string "\\([[:space:]\\]\\)" "\\\\\\1" (file-truename file)) " " - description "\n")) - (message (concat "Attached '" file "'.")) - (setq post-has-attachment t)))))) - - - - (setq mail-yank-prefix "> ") - ;; self-insert-command hack. ;; Without this, "if" expands to ;; if ( -!-) { @@ -1876,8 +1987,6 @@ From http://julien.danjou.info/projects/emacs-packages#rainbow-mode, this colori (column-number-mode t) - (server-start) - ; (require 'mode-compile) (defadvice server-process-filter (after post-mode-message first activate) @@ -1971,11 +2080,6 @@ From http://julien.danjou.info/projects/emacs-packages#rainbow-mode, this colori (define-key cm-map "b" 'outline-backward-same-level) ; Backward - same level (global-set-key "\M-o" cm-map) - - ; debian stuff - (setq-default debian-changelog-mailing-address "don@debian.org") - (setq-default debian-changelog-full-name "Don Armstrong") - ; ediff configuration ; don't use the multi-window configuration (setq ediff-window-setup-function 'ediff-setup-windows-plain) @@ -2154,6 +2258,14 @@ From http://julien.danjou.info/projects/emacs-packages#rainbow-mode, this colori #+END_SRC +* Server +#+BEGIN_SRC emacs-lisp + (unless (server-running-p) + (server-start)) +#+END_SRC + + + * END #+BEGIN_SRC emacs-lisp (provide 'don-configuration)