1 #+PROPERTY: header-args:emacs-lisp :tangle don-configuration.el
5 # if for some reason, things get pear-shaped, we want to be able to
6 # enter the debugger by sending -USR2 to emacs
9 (setq debug-on-event 'siguser2)
13 #+BEGIN_SRC emacs-lisp
14 (add-to-list 'exec-path '"/usr/local/bin")
15 (add-to-list 'exec-path '"~/bin/")
18 #+BEGIN_SRC emacs-lisp
20 (let ((default-directory "~/lib/emacs_el/"))
21 (normal-top-level-add-subdirs-to-load-path))
24 (let ((default-directory "~/var/emacs/elpa"))
25 (normal-top-level-add-subdirs-to-load-path))
28 (add-to-list 'load-path '"~/lib/emacs_el")
31 (setq package-user-dir "~/var/emacs/elpa")
35 * Initial startup stuff
36 ** Disable startup screen
37 #+BEGIN_SRC emacs-lisp
38 (setq inhibit-startup-screen t)
41 #+BEGIN_SRC emacs-lisp
42 ; (if (fboundp 'menu-bar-mode) (menu-bar-mode -1))
43 (if (fboundp 'tool-bar-mode) (tool-bar-mode -1))
44 (if (fboundp 'scroll-bar-mode) (scroll-bar-mode -1))
47 #+BEGIN_SRC emacs-lisp
48 (setq frame-resize-pixelwise t)
49 (add-to-list 'default-frame-alist '(fullscreen . maximixed))
52 ** package repositories and package manager
53 #+BEGIN_SRC emacs-lisp
54 (require 'use-package)
56 (add-to-list 'gnutls-trustfiles "/etc/ssl/ca-global/ca-certificates.crt")
59 (setq package-enable-at-startup nil)
60 (setq package--init-file-ensured t)
61 ; (setq package-user-dir "~/var/emacs/elpa")
62 (setq package-archives '(("gnu" . "https://elpa.gnu.org/packages/")
63 ("melpa" . "https://melpa.org/packages/")
64 ("org" . "http://orgmode.org/elpa/")))
65 (setq use-package-verbose (not (bound-and-true-p byte-compile-current-file)))
69 #+BEGIN_SRC emacs-lisp
72 :commands (paradox-upgrade-packages paradox-list-packages)
74 (setq paradox-execute-asynchronously t)
75 (setq paradox-github-token t) ; I don't want to be prompted about this integration
79 #+BEGIN_SRC emacs-lisp
80 ;; Set the custom file to /dev/null and don't bother to load it
81 (setq custom-file "/dev/null")
85 #+BEGIN_SRC emacs-lisp
86 ;; From http://www.emacswiki.org/emacs/LoadingLispFiles
87 ;; execute conditional code when loading libraries
88 ; (defmacro with-library (symbol &rest body)
89 ; `(when (require ,symbol nil t)
91 ; (put 'with-library 'lisp-indent-function 1)
95 ** Safe Local Variables
96 #+BEGIN_SRC emacs-lisp
97 (setq safe-local-variable-values
98 (quote ((auto-save-default)
100 (cperl-indent-level . 4)
102 (indent-tabs-mode . f)
103 (vcl-indent-level . 4)
107 #+BEGIN_SRC emacs-lisp
108 (setq global-mark-ring-max 128
112 (defun don/minibuffer-setup-hook ()
113 (setq gc-cons-threshold most-positive-fixnum))
115 (defun don/minibuffer-exit-hook ()
116 (setq gc-cons-threshold 1048576))
118 (add-hook 'minibuffer-setup-hook #'don/minibuffer-setup-hook)
119 (add-hook 'minibuffer-exit-hook #'don/minibuffer-exit-hook)
123 #+BEGIN_SRC emacs-lisp
124 (use-package tree-sitter
128 (global-tree-sitter-mode)
130 (use-package tree-sitter-langs
135 ; (defun dla/python-function-at-point ()
136 ; "Return a list of function arguments
138 ; Borrowed from https://xenodium.com/emacs-generate-a-swift-initializer/
141 ; (cl-assert (seq-contains-p local-minor-modes 'tree-sitter-mode) "tree-sitter-mode not enabled")
142 ; (let* ((node (tree-sitter-node-at-point 'function_definition)
148 ; (error "Not in function"))
151 ; (cond ((eq 'func_name
154 ; ; (setq args (append args (list arg)))
156 ; (setq arg (list (cons 'function (tsc-node-text
160 ; (setq arg (map-insert arg 'ident (tsc-node-text
164 ; (setq arg (map-insert arg 'ident_type (tsc-node-text
168 ; (setq arg (map-insert arg 'ret_type (tsc-node-text
171 ; (tsc-query-captures
172 ; (tsc-make-query tree-sitter-language
173 ; "(function_definition (identifier) @func_name (parameters [(identifier) @ident (typed_parameter (identifier) @ident (type) @ident_type)]) (type)? @ret_type)")
174 ; (tree-sitter-node-at-point 'function_definition) nil))
176 ; (setq args (append args (list arg))))
182 #+BEGIN_SRC emacs-lisp
183 (use-package spacemacs-theme
185 (load-theme 'spacemacs-dark t)
189 #+BEGIN_SRC emacs-lisp
190 (use-package hippie-exp
191 :bind* (("M-<SPC>" . hippie-expand))
195 #+BEGIN_SRC emacs-lisp
196 (use-package flyspell
198 :delight flyspell-mode 🐝
200 (add-hook 'text-mode-hook 'turn-on-flyspell)
201 (add-hook 'c-mode-common-hook 'flyspell-prog-mode)
202 (add-hook 'cperl-mode-hook 'flyspell-prog-mode)
203 (add-hook 'tcl-mode-hook 'flyspell-prog-mode)
205 (setq ispell-program-name "ispell")
211 #+begin_src emacs-lisp :tangle yes
212 (use-package flycheck
215 :if (version<= "24.4" emacs-version)
216 :commands flycheck-mode
217 :hook ((prog-mode . flycheck-mode)
221 (use-package flycheck-tip
223 :commands 'flycheck-tip-cycle
225 :bind (:map flycheck-mode-map
226 ("C-c C-n" . flycheck-tip-cycle)))
228 (use-package flycheck-package
231 (use-package flycheck-checkpatch
233 :config (flycheck-checkpatch-setup)
234 :config (setq flycheck-checkers (delete 'checkpatch
236 :config (add-to-list 'flycheck-checkers 'checkpatch t))
240 #+begin_src emacs-lisp :tangle yes
246 #+BEGIN_SRC emacs-lisp
251 #+BEGIN_SRC emacs-lisp
252 (use-package eyebrowse
254 :delight eyebrowse-mode
255 :init (setq eyebrowse-keymap-prefix (kbd "C-c e"))
257 (setq eyebrowse-wrap-around t)
260 (defun my/eyebrowse-new-window-config ()
264 ;; start at 1 run till 0
265 (let ((j (mod (+ i 1) 10)))
266 (when (and (not done)
267 (not (eyebrowse--window-config-present-p j)))
268 (eyebrowse-switch-to-window-config j)
269 (call-interactively 'eyebrowse-rename-window-config2 j)
274 ;; I don't use latex-preview-pane
275 ;; (require 'latex-preview-pane)
276 ;; (defun my/close-latex-preview-pane-before-eyebrowse-switch ()
277 ;; ;; latex-preview-pane uses window-parameters which are
278 ;; ;; not preserved by eyebrowse, so we close the preview
279 ;; ;; pane before switching, it will be regenerated when we
280 ;; ;; edit the TeX file.
281 ;; (when (lpp/window-containing-preview)
282 ;; (delete-window (lpp/window-containing-preview))))
284 ;; (add-to-list 'eyebrowse-pre-window-switch-hook
285 ;; #'my/close-latex-preview-pane-before-eyebrowse-switch)
287 ;; (my/set-menu-key "[" #'my/eyebrowse-new-window-config)
288 ;; (my/set-menu-key ";" #'eyebrowse-prev-window-config)
289 ;; (my/set-menu-key "'" #'eyebrowse-next-window-config)
290 ;; (my/set-menu-key "]" #'eyebrowse-close-window-config)
291 ;; (my/set-menu-key "\\" #'eyebrowse-rename-window-config)
299 #+BEGIN_SRC emacs-lisp
300 (defun my/vsplit-last-buffer ()
301 "Split the window vertically and display the previous buffer."
303 (split-window-vertically)
305 (switch-to-next-buffer))
307 (defun my/hsplit-last-buffer ()
308 "Split the window horizontally and display the previous buffer."
310 (split-window-horizontally)
312 (switch-to-next-buffer))
314 (bind-key "C-x 2" 'my/vsplit-last-buffer)
315 (bind-key "C-x 3" 'my/hsplit-last-buffer)
317 (setq split-width-threshold 100)
318 (setq split-height-threshold 60)
320 (defun my/split-window-prefer-vertically (window)
321 "If there's only one window (excluding any possibly active
322 minibuffer), then split the current window horizontally."
323 (if (and (one-window-p t)
324 (not (active-minibuffer-window))
325 ( < (frame-width) (frame-height))
327 (let ((split-width-threshold nil))
328 (split-window-sensibly window))
329 (split-window-sensibly window)))
331 (setq split-window-preferred-function #'my/split-window-prefer-vertically)
332 (setq window-combination-resize t)
335 *** Compilation window
337 If there is no compilation window, open one at the bottom, spanning
338 the complete width of the frame. Otherwise, reuse existing window. In
339 the former case, if there was no error the window closes
342 #+BEGIN_SRC emacs-lisp
343 (add-to-list 'display-buffer-alist
344 `(,(rx bos "*compilation*" eos)
345 (display-buffer-reuse-window
346 display-buffer-in-side-window)
347 (reusable-frames . visible)
349 (window-height . 0.4)))
352 #+BEGIN_SRC emacs-lisp
353 (defun my/compilation-exit-autoclose (status code msg)
354 ;; If M-x compile exists with a 0
355 (when (and (eq status 'exit) (zerop code))
356 ;; and delete the *compilation* window
357 (let ((compilation-window (get-buffer-window (get-buffer "*compilation*"))))
358 (when (and (not (window-at-side-p compilation-window 'top))
359 (window-at-side-p compilation-window 'left)
360 (window-at-side-p compilation-window 'right))
361 (delete-window compilation-window))))
362 ;; Always return the anticipated result of compilation-exit-message-function
365 ;; Specify my function (maybe I should have done a lambda function)
366 (setq compilation-exit-message-function #'my/compilation-exit-autoclose)
369 If you change the variable ~compilation-scroll-output~ to a ~non-nil~
370 value, the compilation buffer scrolls automatically to follow the
371 output. If the value is ~first-error~, scrolling stops when the first
372 error appears, leaving point at that error. For any other non-nil
373 value, scrolling continues until there is no more output.
375 #+BEGIN_SRC emacs-lisp
376 (setq compilation-scroll-output 'first-error)
379 ** Mode line cleaning
381 #+BEGIN_SRC emacs-lisp
387 #+BEGIN_SRC emacs-lisp
394 #+BEGIN_SRC emacs-lisp
396 :if (>= emacs-major-version 25)
398 :bind (("C-c C-<SPC>" . avy-goto-word-or-subword-1)
399 ("C-c j j" . avy-goto-word-or-subword-1)
400 ("M-g g" . avy-goto-line))
401 :config (progn (setq avy-background t))
404 *** Ace-link (jumping to links)
405 #+BEGIN_SRC emacs-lisp
406 (use-package ace-link
408 ; bind o in most modes
409 :config (ace-link-setup-default))
411 *** Jumping through edit points (goto-chg)
412 #+BEGIN_SRC emacs-lisp
413 (use-package goto-chg
415 :bind (("C-c j ," . goto-last-change)
416 ("C-c j ." . goto-last-change-reverse))
419 *** Jumping to bookmarks (visible bookmarks, bm)
420 #+BEGIN_SRC emacs-lisp
423 :bind (("C-c j b ." . bm-next)
424 ("C-c j b ," . bm-previous)
425 ("C-c j b SPC" . bm-toggle)))
430 #+BEGIN_SRC emacs-lisp
431 (use-package yasnippet
433 :delight yas-minor-mode
436 (setq yas-verbosity 1)
437 (define-key yas-minor-mode-map (kbd "<tab>") nil)
438 (define-key yas-minor-mode-map (kbd "TAB") nil)
439 (define-key yas-minor-mode-map (kbd "<backtab>") nil)
440 (setq yas-snippet-dirs '("~/lib/emacs_el/snippets/"
441 "~/lib/emacs_el/yasnippet-snippets/snippets/"))
442 (add-to-list 'hippie-expand-try-functions-list
443 'yas-hippie-try-expand)
449 #+BEGIN_SRC emacs-lisp
450 (use-package auto-yasnippet
452 :bind (("H-w" . aya-create)
457 ** Treemacs: Tree file viewer
458 #+BEGIN_SRC emacs-lisp
459 ;; Provides workspaces with file browsing (tree file viewer)
460 ;; and project management when coupled with `projectile`.
462 (use-package treemacs
466 (setq treemacs-no-png-images t
468 :bind ("C-c t" . treemacs))
471 #+BEGIN_SRC emacs-lisp
472 (use-package lsp-mode
475 :commands (lsp lsp-deferred)
476 :init (setq lsp-keymap-prefix "C-c l")
477 (defun my/orderless-dispatch-flex-first (_pattern index _total)
478 (and (eq index 0) 'orderless-flex))
480 (defun my/lsp-mode-setup-completion ()
481 (setf (alist-get 'styles (alist-get 'lsp-capf completion-category-defaults))
484 ;; Optionally configure the first word as flex filtered.
485 (add-hook 'orderless-style-dispatchers #'my/orderless-dispatch-flex-first nil 'local)
487 ;; Optionally configure the cape-capf-buster.
488 ; (setq-local completion-at-point-functions (list (cape-capf-buster #'lsp-completion-at-point)))
490 :hook (python-mode . lsp-deferred)
491 (lsp-completion-mode . my/lsp-mode-setup-completion)
493 (lsp-completion-provider :none) ;; we use Corfu!
495 ;; Provides visual help in the buffer
496 ;; For example definitions on hover.
497 ;; The `imenu` lets me browse definitions quickly.
502 (setq lsp-ui-sideline-enable nil
504 :hook (lsp-mode . lsp-ui-mode)
505 :bind (:map lsp-ui-mode-map
506 ("C-c i" . lsp-ui-imenu)))
507 ;; Language server for Python
508 ;; Read the docs for the different variables set in the config.
509 (use-package lsp-pyright
513 (setq lsp-clients-python-library-directories '("/usr/" "~/miniconda3/pkgs"))
514 (setq lsp-pyright-disable-language-service nil
515 lsp-pyright-disable-organize-imports nil
516 lsp-pyright-auto-import-completions t
517 lsp-pyright-use-library-code-for-types t
518 lsp-pyright-venv-path "~/miniconda3/envs")
519 :hook ((python-mode . (lambda ()
520 (require 'lsp-pyright) (lsp-deferred)))))
523 #+BEGIN_SRC emacs-lisp
526 ;; Optional customizations
528 (corfu-cycle t) ;; Enable cycling for `corfu-next/previous'
529 (corfu-auto t) ;; Enable auto completion
530 (corfu-separator ?\s) ;; Orderless field separator
531 (corfu-quit-at-boundary nil) ;; Never quit at completion boundary
532 (corfu-quit-no-match nil) ;; Never quit, even if there is no match
533 (corfu-preview-current nil) ;; Disable current candidate preview
534 (corfu-preselect 'prompt) ;; Preselect the prompt
535 (corfu-on-exact-match nil) ;; Configure handling of exact matches
536 (corfu-scroll-margin 5) ;; Use scroll margin
538 ;; Enable Corfu only for certain modes.
539 ;; :hook ((prog-mode . corfu-mode)
540 ;; (shell-mode . corfu-mode)
541 ;; (eshell-mode . corfu-mode))
543 ;; Recommended: Enable Corfu globally.
544 ;; This is recommended since Dabbrev can be used globally (M-/).
545 ;; See also `corfu-exclude-modes'.
550 #+BEGIN_SRC emacs-lisp
553 ;; Swap M-/ and C-M-/
554 :bind (("M-/" . dabbrev-completion)
555 ("C-M-/" . dabbrev-expand))
556 ;; Other useful Dabbrev configurations.
558 (dabbrev-ignored-buffer-regexps '("\\.\\(?:pdf\\|jpe?g\\|png\\)\\'")))
562 #+BEGIN_SRC emacs-lisp
564 (use-package tinyprocmail
566 :load-path "~/lib/emacs_el/tiny-tools/lisp/tiny"
567 :mode (".procmailrc" . turn-on-tinyprocmail-mode)
572 #+BEGIN_SRC emacs-lisp :tangle don-configuration.el
576 :bind (("C-x g" . magit-status)
577 ("C-x C-g" . magit-status))
579 ;; refine diffs always (hilight words)
580 (setq magit-diff-refine-hunk nil)
582 (use-package magit-annex
585 :load-path "~/lib/emacs_el/magit-annex/"
587 (use-package magit-vcsh
593 *** Forge (github/gitlab)
594 #+BEGIN_SRC emacs-lisp
602 #+BEGIN_SRC emacs-lisp
603 (use-package cperl-mode
607 ;; Use c-mode for perl .xs files
608 (add-to-list 'auto-mode-alist '("\\.xs\\'" . c-mode))
609 (add-to-list 'auto-mode-alist '("\\.\\([pP][Llm]\\|al\\)\\'" . cperl-mode))
610 (add-to-list 'interpreter-mode-alist '("perl" . cperl-mode))
611 (add-to-list 'interpreter-mode-alist '("perl5" . cperl-mode))
612 (add-to-list 'interpreter-mode-alist '("miniperl" . cperl-mode))
615 cperl-auto-newline nil
616 cperl-auto-newline-after-colon nil
617 cperl-continued-statement-offset 4
618 cperl-brace-offset -1
619 cperl-continued-brace-offset 0
620 cperl-label-offset -4
621 cperl-highlight-variables-indiscriminately t
622 cperl-electric-lbrace-space nil
623 cperl-indent-parens-as-block nil
624 cperl-close-paren-offset -1
625 cperl-tab-always-indent t)
626 ;;(add-hook 'cperl-mode-hook (lambda () (cperl-set-style "PerlStyle")))
631 #+BEGIN_SRC emacs-lisp
632 (use-package markdown-mode
634 :mode (("\\.md\\'" . markdown-mode)
635 ("\\.mdwn\\'" . markdown-mode)
636 ("README\\.md\\'" . gfm-mode)
639 (setq markdown-enable-math t)
640 (setq markdown-follow-wiki-link-on-enter nil)
641 (bind-key "M-." #'markdown-jump markdown-mode-map)
642 (add-hook 'markdown-mode-hook #'flyspell-mode)
643 (add-hook 'markdown-mode-hook #'outline-minor-mode)
644 (bind-key "C-<tab>" #'outline-cycle markdown-mode-map)
649 #+BEGIN_SRC emacs-lisp
650 ; load sql-indent when sql is loaded
651 (use-package sql-indent
657 :mode (("\\.sql\\'" . sql-mode))
661 #+BEGIN_SRC emacs-lisp
663 :commands ediff ediff3
666 ;; ediff configuration
667 ;; don't use the multi-window configuration
668 (setq ediff-window-setup-function 'ediff-setup-windows-plain)
671 ** Do the Right Thing Indenting
672 Attempts to automatically identify the right indentation for a file
673 #+BEGIN_SRC emacs-lisp
674 (use-package dtrt-indent
678 ** VCL --editing varnish configuration files
679 #+BEGIN_SRC emacs-lisp
680 (use-package vcl-mode
687 #+BEGIN_SRC emacs-lisp
693 ; (define-key vertico-map "\r" #'vertico-directory-enter)
694 ; (define-key vertico-map "\d" #'vertico-directory-delete-char)
695 ; (define-key vertico-map "\M-\d" #'vertico-directory-delete-word)
696 ; (add-hook 'rfn-eshadow-update-overlay-hook #'vertico-directory-tidy)
698 ;; Different scroll margin
699 ;; (setq vertico-scroll-margin 0)
701 ;; Show more candidates
702 ;; (setq vertico-count 20)
704 ;; Grow and shrink the Vertico minibuffer
705 ;; (setq vertico-resize t)
707 ;; Optionally enable cycling for `vertico-next' and `vertico-previous'.
708 ;; (setq vertico-cycle t)
710 (vertico-grid-separator " ")
711 (vertico-grid-lookahead 50)
713 (use-package vertico-multiform
716 ;(vertico-multiform-mode)
718 (vertico-multiform-categories
720 (consult-grep buffer)
723 (library reverse indexed)
724 (org-roam-node reverse indexed)
727 (vertico-multiform-commands
728 '(("flyspell-correct-*" grid reverse)
729 (org-refile grid reverse indexed)
730 (consult-yank-pop indexed)
732 (consult-lsp-diagnostics)
737 ;; Persist history over Emacs restarts. Vertico sorts by history position.
738 (use-package savehist
744 ** Orderless: advanced completion style
745 #+begin_src emacs-lisp
746 (use-package orderless
749 ;; Configure a custom style dispatcher (see the Consult wiki)
750 ;; (setq orderless-style-dispatchers '(+orderless-dispatch)
751 ;; orderless-component-separator #'orderless-escapable-split-on-space)
752 (setq completion-styles '(orderless basic)
753 completion-category-defaults nil
754 completion-category-overrides '((file (styles partial-completion)))))
756 ** Marginalia: Rich annotations in the minibuffer
757 #+begin_src emacs-lisp
758 (use-package marginalia
760 :bind (:map minibuffer-local-map
761 ("M-A" . marginalia-cycle))
766 ** Embark: Minibuffer actions and context menu
767 #+begin_src emacs-lisp
772 (("C-." . embark-act) ;; pick some comfortable binding
773 ("C-;" . embark-dwim) ;; good alternative: M-.
774 ("C-h B" . embark-bindings)) ;; alternative for `describe-bindings'
778 ;; Optionally replace the key help with a completing-read interface
779 (setq prefix-help-command #'embark-prefix-help-command)
783 ;; Hide the mode line of the Embark live/completions buffers
784 (add-to-list 'display-buffer-alist
785 '("\\`\\*Embark Collect \\(Live\\|Completions\\)\\*"
787 (window-parameters (mode-line-format . none)))))
789 (use-package embark-consult
792 (embark-collect-mode . consult-preview-at-point-mode))
795 #+begin_src emacs-lisp
797 ;; Replace bindings. Lazily loaded due by `use-package'.
798 :bind (;; C-c bindings in `mode-specific-map'
799 ("C-c M-x" . consult-mode-command)
800 ("C-c h" . consult-history)
801 ("C-c k" . consult-kmacro)
802 ("C-c m" . consult-man)
803 ("C-c i" . consult-info)
804 ([remap Info-search] . consult-info)
805 ;; C-x bindings in `ctl-x-map'
806 ("C-x M-:" . consult-complex-command) ;; orig. repeat-complex-command
807 ("C-x b" . consult-buffer) ;; orig. switch-to-buffer
808 ("C-x 4 b" . consult-buffer-other-window) ;; orig. switch-to-buffer-other-window
809 ("C-x 5 b" . consult-buffer-other-frame) ;; orig. switch-to-buffer-other-frame
810 ("C-x r b" . consult-bookmark) ;; orig. bookmark-jump
811 ("C-x p b" . consult-project-buffer) ;; orig. project-switch-to-buffer
812 ;; Custom M-# bindings for fast register access
813 ("M-#" . consult-register-load)
814 ("M-'" . consult-register-store) ;; orig. abbrev-prefix-mark (unrelated)
815 ("C-M-#" . consult-register)
816 ;; Other custom bindings
817 ("M-y" . consult-yank-pop) ;; orig. yank-pop
818 ;; M-g bindings in `goto-map'
819 ("M-g e" . consult-compile-error)
820 ("M-g f" . consult-flymake) ;; Alternative: consult-flycheck
821 ("M-g g" . consult-goto-line) ;; orig. goto-line
822 ("M-g M-g" . consult-goto-line) ;; orig. goto-line
823 ("M-g o" . consult-outline) ;; Alternative: consult-org-heading
824 ("M-g m" . consult-mark)
825 ("M-g k" . consult-global-mark)
826 ("M-g i" . consult-imenu)
827 ("M-g I" . consult-imenu-multi)
828 ;; M-s bindings in `search-map'
829 ("M-s d" . consult-find)
830 ("M-s D" . consult-locate)
831 ("M-s g" . consult-grep)
832 ("M-s G" . consult-git-grep)
833 ("M-s r" . consult-ripgrep)
834 ("M-s l" . consult-line)
835 ("M-s L" . consult-line-multi)
836 ("M-s k" . consult-keep-lines)
837 ("M-s u" . consult-focus-lines)
838 ;; Isearch integration
839 ("M-s e" . consult-isearch-history)
840 :map isearch-mode-map
841 ("M-e" . consult-isearch-history) ;; orig. isearch-edit-string
842 ("M-s e" . consult-isearch-history) ;; orig. isearch-edit-string
843 ("M-s l" . consult-line) ;; needed by consult-line to detect isearch
844 ("M-s L" . consult-line-multi) ;; needed by consult-line to detect isearch
845 ;; Minibuffer history
846 :map minibuffer-local-map
847 ("M-s" . consult-history) ;; orig. next-matching-history-element
848 ("M-r" . consult-history)) ;; orig. previous-matching-history-element
850 ;; Enable automatic preview at point in the *Completions* buffer. This is
851 ;; relevant when you use the default completion UI.
852 :hook (completion-list-mode . consult-preview-at-point-mode)
854 ;; The :init configuration is always executed (Not lazy)
857 ;; Optionally configure the register formatting. This improves the register
858 ;; preview for `consult-register', `consult-register-load',
859 ;; `consult-register-store' and the Emacs built-ins.
860 (setq register-preview-delay 0.5
861 register-preview-function #'consult-register-format)
863 ;; Optionally tweak the register preview window.
864 ;; This adds thin lines, sorting and hides the mode line of the window.
865 (advice-add #'register-preview :override #'consult-register-window)
867 ;; Use Consult to select xref locations with preview
868 (setq xref-show-xrefs-function #'consult-xref
869 xref-show-definitions-function #'consult-xref)
871 ;; Configure other variables and modes in the :config section,
872 ;; after lazily loading the package.
875 ;; Optionally configure preview. The default value
876 ;; is 'any, such that any key triggers the preview.
877 ;; (setq consult-preview-key 'any)
878 ;; (setq consult-preview-key "M-.")
879 ;; (setq consult-preview-key '("S-<down>" "S-<up>"))
880 ;; For some commands and buffer sources it is useful to configure the
881 ;; :preview-key on a per-command basis using the `consult-customize' macro.
883 consult-theme :preview-key '(:debounce 0.2 any)
884 consult-ripgrep consult-git-grep consult-grep
885 consult-bookmark consult-recent-file ; consult-xref
886 consult--source-bookmark consult--source-file-register
887 consult--source-recent-file consult--source-project-recent-file
888 ;; :preview-key "M-."
889 :preview-key '(:debounce 0.4 any))
891 ;; Optionally configure the narrowing key.
892 ;; Both < and C-+ work reasonably well.
893 (setq consult-narrow-key "<") ;; "C-+"
895 ;; Optionally make narrowing help available in the minibuffer.
896 ;; You may want to use `embark-prefix-help-command' or which-key instead.
897 ;; (define-key consult-narrow-map (vconcat consult-narrow-key "?") #'consult-narrow-help)
899 ;; By default `consult-project-function' uses `project-root' from project.el.
900 ;; Optionally configure a different project root function.
901 ;;;; 1. project.el (the default)
902 ;; (setq consult-project-function #'consult--default-project--function)
903 ;;;; 2. vc.el (vc-root-dir)
904 ;; (setq consult-project-function (lambda (_) (vc-root-dir)))
905 ;;;; 3. locate-dominating-file
906 ;; (setq consult-project-function (lambda (_) (locate-dominating-file "." ".git")))
907 ;;;; 4. projectile.el (projectile-project-root)
908 ;; (autoload 'projectile-project-root "projectile")
909 ;; (setq consult-project-function (lambda (_) (projectile-project-root)))
910 ;;;; 5. No project support
911 ;; (setq consult-project-function nil)
914 ** Projectile -- Project management
915 #+begin_src emacs-lisp
916 (use-package projectile
918 :bind (("<f5>" . projectile-compile-project)
919 ("<f6>" . next-error))
921 (use-package magit :ensure t)
922 (projectile-global-mode)))
926 #+BEGIN_SRC emacs-lisp
929 :bind ("M-z" . avy-zap-up-to-char-dwim))
932 #+BEGIN_SRC emacs-lisp
934 :bind (("C-c 2" . my/hydra-orgmodes/body)
935 ("C-c @" . my/hydra-orgmodes/body)
936 ("C-c #" . my/hydra-outline/body)
937 ("C-c 3" . my/hydra-outline/body)
940 (defhydra my/hydra-orgmodes (:color blue :hint nil)
942 _n_: notes _c_: chaim _w_: wildman _o_: ool
943 _u_: uddin _s_: steve _r_: refile _f_: fh
944 _p_: read papers _R_: paper notes
949 ("n" (find-file "~/projects/org-notes/notes.org"))
950 ("c" (find-file "~/projects/org-notes/chaim.org"))
951 ("w" (find-file "~/projects/org-notes/wildman.org"))
952 ("u" (find-file "~/projects/org-notes/uddin.org"))
953 ("o" (find-file "~/projects/org-notes/ool.org"))
954 ("f" (find-file "~/projects/org-notes/fh.org"))
955 ("s" (find-file "~/projects/org-notes/sndservers.org"))
956 ("r" (find-file my/org-refile-file))
957 ("p" (find-file "~/projects/research/papers_to_read.org"))
958 ("R" (find-file "~/projects/research/paper_notes.org"))
959 ("h" (find-file "~/projects/org-notes/hpcbio.org"))
964 ;; from https://github.com/abo-abo/hydra/wiki/Emacs
965 (defhydra my/hydra-outline (:color pink :hint nil)
968 ^^^^^^------------------------------------------------------
969 _q_: sublevels _a_: all _u_: up
970 _t_: body _e_: entry _n_: next visible
971 _o_: other _i_: children _p_: previous visible
972 _c_: entry _k_: branches _f_: forward same level
973 _l_: leaves _s_: subtree _b_: backward same level
978 ("q" outline-hide-sublevels) ; Hide everything but the top-level headings
979 ("t" outline-hide-body) ; Hide everything but headings (all body lines)
980 ("o" outline-hide-other) ; Hide other branches
981 ("c" outline-hide-entry) ; Hide this entry's body
982 ("l" outline-hide-leaves) ; Hide body lines in this entry and sub-entries
983 ("d" outline-hide-subtree) ; Hide everything in this entry and sub-entries
985 ("a" outline-show-all) ; Show (expand) everything
986 ("e" outline-show-entry) ; Show this heading's body
987 ("i" outline-show-children) ; Show this heading's immediate child sub-headings
988 ("k" outline-show-branches) ; Show all sub-headings under this heading
989 ("s" outline-show-subtree) ; Show (expand) everything in this heading & below
991 ("u" outline-up-heading) ; Up
992 ("n" outline-next-visible-heading) ; Next
993 ("p" outline-previous-visible-heading) ; Previous
994 ("f" outline-forward-same-level) ; Forward - same level
995 ("b" outline-backward-same-level) ; Backward - same level
1001 #+BEGIN_SRC emacs-lisp
1004 (add-to-list 'tramp-methods '("vcsh"
1005 (tramp-login-program "vcsh")
1009 (tramp-remote-shell "/bin/sh")
1010 (tramp-remote-shell-args
1014 #+BEGIN_SRC emacs-lisp
1018 (setq-default reftex-default-bibliography
1019 '("~/projects/research/references.bib")))
1022 #+BEGIN_SRC emacs-lisp
1024 :config (setq bibtex-user-optional-fields
1025 (quote (("annote" "Personal annotation (ignored)")
1033 #+BEGIN_SRC emacs-lisp
1038 ; (add-to-list 'TeX-style-path '"/home/don/lib/emacs_el/auctex/style")
1039 ;; REFTEX (much enhanced management of cross-ref, labels, etc)
1040 ;; http://www.strw.leidenuniv.nl/~dominik/Tools/reftex/
1041 ; (autoload 'reftex-mode "reftex" "RefTeX Minor Mode" t)
1042 ; (autoload 'turn-on-reftex "reftex" "RefTeX Minor Mode" nil)
1043 ; (autoload 'reftex-citation "reftex-cite" "Make citation" nil)
1044 ; (autoload 'reftex-index-phrase-mode "reftex-index" "Phrase mode" t)
1045 (add-hook 'LaTeX-mode-hook 'turn-on-reftex) ; with AUCTeX LaTeX mode
1046 (add-hook 'latex-mode-hook 'turn-on-reftex) ; with Emacs latex mode
1047 (add-hook 'LaTeX-mode-hook 'outline-minor-mode) ; with AUCTeX LaTeX mode
1048 (add-hook 'latex-mode-hook 'outline-minor-mode) ; with Emacs latex mode
1050 (setq-default reftex-plug-into-AUCTeX t)
1051 ;; support fake section headers
1052 (setq TeX-outline-extra
1056 ("%subsubsection" 4)
1058 ;; add font locking to the headers
1059 (font-lock-add-keywords
1061 '(("^%\\(chapter\\|\\(sub\\|subsub\\)?section\\|paragraph\\)"
1062 0 'font-lock-keyword-face t)
1063 ("^%chapter{\\(.*\\)}" 1 'font-latex-sectioning-1-face t)
1064 ("^%section{\\(.*\\)}" 1 'font-latex-sectioning-2-face t)
1065 ("^%subsection{\\(.*\\)}" 1 'font-latex-sectioning-3-face t)
1066 ("^%subsubsection{\\(.*\\)}" 1 'font-latex-sectioning-4-face t)
1067 ("^%paragraph{\\(.*\\)}" 1 'font-latex-sectioning-5-face t)))
1069 ;; use smart quotes by default instead of `` and ''
1070 ;; taken from http://kieranhealy.org/esk/kjhealy.html
1071 (setq TeX-open-quote "“")
1072 (setq TeX-close-quote "”")
1074 ;; (TeX-add-style-hook
1079 ;; (custom-set-variables
1080 ;; '(font-latex-user-keyword-classes
1083 ;; font-lock-function-name-face 2 (command 1 t))))
1085 (setq-default TeX-parse-self t)
1086 (setq-default TeX-auto-save t)
1087 (setq-default TeX-master nil)
1088 (add-to-list 'LaTeX-font-list
1089 '(?\C-a "\\alert{","}"))
1092 '(TeX-add-style-hook
1095 (if (boundp 'reftex-ref-style-alist)
1097 'reftex-ref-style-alist
1098 '("Cleveref" "cleveref"
1099 (("\\cref" ?c) ("\\Cref" ?C) ("\\cpageref" ?d) ("\\Cpageref" ?D)))))
1100 (reftex-ref-style-activate "Cleveref")
1102 '("cref" TeX-arg-ref)
1103 '("Cref" TeX-arg-ref)
1104 '("cpageref" TeX-arg-ref)
1105 '("Cpageref" TeX-arg-ref)))))
1108 '(add-to-list 'LaTeX-fill-excluded-macros
1111 (use-package font-latex
1113 (setq font-latex-match-reference-keywords
1135 (setq font-latex-fontify-script nil)
1136 (setq font-latex-fontify-sectioning (quote color))
1137 (setq font-latex-script-display (quote (nil)))
1142 #+BEGIN_SRC emacs-lisp
1146 :mode ("\\.R\\'" . ess-r-mode)
1147 :bind (:map ess-mode-map
1148 ("C-c C-R" . dla/ess-region-remote-eval))
1150 (autoload 'ess-r-mode "ess-site" nil t)
1151 (autoload 'R "ess-site" nil t)
1153 ; actually load the rest of ess
1155 (defun ess-change-directory (path)
1156 "Set the current working directory to PATH for both *R* and Emacs."
1157 (interactive "Directory to change to: ")
1159 (when (file-exists-p path)
1160 (ess-command (concat "setwd(\"" path "\")\n"))
1161 ;; use file-name-as-directory to ensure it has trailing /
1162 (setq default-directory (file-name-as-directory path))))
1163 (add-hook 'ess-mode-hook 'flyspell-prog-mode)
1164 ;; outlining support for ess modes
1168 (outline-minor-mode)
1169 (setq outline-regexp "\\(^#\\{4,5\\} \\)\\|\\(^[a-zA-Z0-9_\.]+ ?<- ?function\\)")
1170 (defun outline-level ()
1171 (cond ((looking-at "^##### ") 1)
1172 ((looking-at "^#### ") 2)
1173 ((looking-at "^[a-zA-Z0-9_\.]+ ?<- ?function(.*{") 3)
1176 (defun dla/ess-region-remote-eval (start end)
1177 "Evaluate region in a remote ESS instance"
1179 (shell-command-on-region start end "eval_r" (get-buffer-create "***essregionremoteeval***") nil nil nil)
1180 (kill-buffer "***essregionremoteeval***"))
1181 ;; Don't restore history or save workspace image
1182 '(inferior-R-args "--no-restore-history --no-save")
1187 From http://julien.danjou.info/projects/emacs-packages#rainbow-mode, this colorizes color strings
1189 #+BEGIN_SRC emacs-lisp
1190 (use-package rainbow-mode
1191 ;; add ess to the x major mode
1192 :config (add-to-list 'rainbow-x-colors-major-mode-list 'ESS[S])
1193 (add-to-list 'rainbow-x-colors-major-mode-list 'ESS[R])
1198 #+BEGIN_SRC emacs-lisp
1199 (use-package yaml-mode
1200 ;; add ess to the x major mode
1201 :mode ("\\.\\(yaml|yml\\)\\'" . yaml-mode)
1206 #+BEGIN_SRC emacs-lisp
1207 (use-package poly-noweb
1212 (use-package poly-markdown
1218 :after (:all polymode poly-markdown poly-noweb)
1219 ; :mode ("\\.Snw" . poly-noweb+r-mode)
1220 ; :mode ("\\.Rnw" . poly-noweb+r-mode)
1221 ; :mode ("\\.Rmd" . poly-markdown+r-mode)
1223 (use-package polymode
1231 #+BEGIN_SRC emacs-lisp
1232 ; this package doesn't really do exactly what we want it to do
1233 ; (use-package outline-magic)
1236 #+BEGIN_SRC emacs-lisp
1237 ;; change the outline mode prefix from C-c @ to C-c C-2
1238 (setq outline-minor-mode-prefix "C-c C-2")
1239 ;;(add-hook 'outline-minor-mode-hook
1240 ;; (lambda () (local-set-key (kbd "C-c C-2")
1241 ;; outline-mode-prefix-map)))
1245 #+BEGIN_SRC emacs-lisp
1246 (use-package writeroom-mode
1248 (defun my/writing-mode ()
1249 "Start my writing mode; enable visual-line-mode and auto-fill-mode"
1254 (visual-line-mode -1)
1256 (visual-fill-column-mode -1)
1258 (visual-line-mode 1)
1260 (visual-fill-column-mode 1)
1265 ** GhostText/Atomic Chrome
1266 #+BEGIN_SRC emacs-lisp
1267 (use-package atomic-chrome
1269 (ignore-errors (atomic-chrome-start-server))
1270 (setq atomic-chrome-buffer-open-style 'full)
1274 #+BEGIN_SRC emacs-lisp
1275 (use-package edit-server
1277 :commands edit-server-start
1278 :init (if after-init-time
1280 (add-hook 'after-init-hook
1281 #'(lambda() (edit-server-start))))
1282 :config (setq edit-server-new-frame-alist
1283 '((name . "Edit with Emacs FRAME")
1289 (menu-bar-lines . t)
1290 (window-system . x)))
1294 [[https://github.com/magnars/multiple-cursors.el][Multiple Cursors]]
1295 #+BEGIN_SRC emacs-lisp
1296 (use-package multiple-cursors
1297 :bind* (("C-;" . mc/mark-all-dwim)
1298 ("C-<" . mc/mark-previous-like-this)
1299 ("C->" . mc/mark-next-like-this)
1300 ("C-S-c C-S-c" . mc/edit-lines))
1304 #+BEGIN_SRC emacs-lisp
1305 (use-package web-mode
1306 :load-path "/home/don/projects/web-mode/"
1307 :mode ("\\.\\(tx|tmpl\\)\\'" . web-mode)
1309 (add-to-list 'auto-mode-alist '("\\.tmpl\\'" . web-mode))
1310 (setq web-mode-enable-engine-detection t)
1311 (setq web-mode-engines-alist
1312 '(("template-toolkit" . "\\.tmpl\\'")))
1315 ** Spamassassin Mode
1316 #+BEGIN_SRC emacs-lisp
1317 (use-package spamassassin-mode
1318 :commands spamassassin-mode
1323 #+BEGIN_SRC emacs-lisp
1324 (use-package password-store
1326 :commands password-store-edit password-store-generate
1328 (defun dla/password-store-edit (entry)
1329 "Edit password for ENTRY which doesn't require it to already exist"
1330 (interactive (list (password-store--completing-read nil)))
1331 (password-store--run-edit entry))
1332 (advice-add 'password-store-edit :override #'dla/password-store-edit)
1336 #+BEGIN_SRC emacs-lisp
1340 ;; fix up css mode to not be silly
1341 ;; from http://www.stokebloke.com/wordpress/2008/03/21/css-mode-indent-buffer-fix/
1342 (setq cssm-indent-level 4)
1343 (setq cssm-newline-before-closing-bracket t)
1344 (setq cssm-indent-function #'cssm-c-style-indenter)
1345 (setq cssm-mirror-mode nil))
1348 #+BEGIN_SRC emacs-lisp
1350 :delight abbrev-mode
1352 ;; load abbreviations from
1353 (setq abbrev-file-name
1354 "~/.emacs_abbrev_def")
1356 ;; read the abbrev file if it exists
1357 (if (file-exists-p abbrev-file-name)
1358 (quietly-read-abbrev-file))
1360 ;; for now, use abbrev mode everywhere
1361 (setq default-abbrev-mode t))
1364 ** Debugging (realgud)
1365 #+BEGIN_SRC emacs-lisp
1366 (use-package realgud
1370 ** Python Programming
1371 #+BEGIN_SRC emacs-lisp
1372 (use-package python-mode
1375 (python-mode . pyenv-mode)
1376 (python-mode . flycheck-mode)
1377 (python-mode . blacken-mode)
1378 (python-mode . yas-minor-mode)
1379 (python-mode . anaconda-mode)
1384 (use-package blacken
1387 (setq-default blacken-fast-unsafe t)
1388 ; (setq-default blacken-line-length 80)
1390 (use-package anaconda-mode
1401 #+begin_src emacs-lisp :tangle yes
1402 (use-package python-black
1406 *** Sphinx Documentation
1407 #+begin_src emacs-lisp :tangle yes
1408 (use-package numpydoc
1411 :bind (:map python-mode-map
1412 ("C-c C-n" . numpydoc-generate)))
1413 (use-package sphinx-doc
1417 (setq sphinx-doc-include-types t)
1419 (use-package python-docstring
1423 (python-mode . python-docstring-mode)
1427 #+BEGIN_SRC emacs-lisp
1428 (use-package go-mode
1435 #+BEGIN_SRC emacs-lisp
1436 (use-package expand-region
1437 :bind (("C-=" . 'er/expand-region))
1442 #+BEGIN_SRC emacs-lisp
1443 (use-package dockerfile-mode
1449 #+BEGIN_SRC emacs-lisp
1450 (use-package beancount
1451 :load-path "~/lib/emacs_el/beancount-mode/"
1453 :mode "\\.beancount\\'"
1460 #+BEGIN_SRC emacs-lisp
1461 (use-package message
1463 :delight (message "✉")
1464 :mode ("muttng-[a-z0-9]+-[0-9]+-" . message-mode)
1465 :mode ("mutt-[a-z0-9]+-[0-9]+-" . message-mode)
1466 :hook 'my/message-mode-settings
1467 :hook 'turn-on-flyspell
1468 :bind (:map message-mode-map
1469 ("C-c C-a" . my/post-attach-file))
1470 :delight (message-mode "✉")
1472 (defun my/message-mode-settings ()
1473 (font-lock-add-keywords nil
1474 '(("^[ \t]*>[ \t]*>[ \t]*>.*$"
1475 (0 'message-multiply-quoted-text-face))
1476 ("^[ \t]*>[ \t]*>.*$"
1477 (0 'message-double-quoted-text-face))))
1480 (defun my/post-attach-file ()
1481 "Prompt for an attachment."
1483 (let ((file (read-file-name "Attach file: " nil nil t nil)))
1484 (my/header-attach-file file "")))
1486 (defun my/header-attach-file (file description)
1487 "Attach a FILE to the current message (works with Mutt).
1488 Argument DESCRIPTION MIME description."
1489 (interactive "fAttach file: \nsDescription: ")
1490 (when (> (length file) 0)
1495 (goto-char (point-min))
1496 (search-forward-regexp "^$")
1497 (insert (concat "Attach: " (replace-regexp-in-string "\\([[:space:]\\]\\)" "\\\\\\1" (file-truename file)) " "
1499 (message (concat "Attached '" file "'."))
1500 (setq post-has-attachment t))))))
1502 (setq mail-yank-prefix "> ")
1503 (setq mail-header-separator "") ; fix broken header detection
1507 #+BEGIN_SRC emacs-lisp
1508 (use-package muttrc-mode
1515 ** Reverting buffers
1516 #+BEGIN_SRC emacs-lisp
1517 (use-package autorevert
1518 :delight auto-revert-mode
1520 (setq global-auto-revert-non-file-buffers t
1521 global-auto-revert-ignore-modes '(pdf-view-mode)
1522 auto-revert-verbose nil)
1523 (global-auto-revert-mode 1))
1526 ** Use-package and load things
1527 #+BEGIN_SRC emacs-lisp
1530 :delight (org-mode "ø")
1531 :mode ("\\.\\(org\\|org_archive\\|txt\\)\\'" . org-mode)
1532 :bind (("C-c l" . org-store-link)
1533 ("C-c a" . org-agenda)
1534 ("C-c b" . org-iswitchb))
1536 ** Agenda Configuration
1537 #+BEGIN_SRC emacs-lisp
1539 (setq-default org-log-done 'time)
1540 (setq-default org-agenda-ndays 5)
1542 (setq org-agenda-sticky t)
1543 (defun dla/show-org-agenda ()
1548 (and (string-match-p
1556 (buffer-name agendabuffer))
1558 (delete-other-windows))
1560 ;; agenda configuration
1561 ;; Do not dim blocked tasks
1562 (setq org-agenda-dim-blocked-tasks nil)
1563 (setq org-agenda-inhibit-startup t)
1564 (setq org-agenda-use-tag-inheritance nil)
1566 ;; Compact the block agenda view
1567 (setq org-agenda-compact-blocks t)
1569 ;; Custom agenda command definitions
1570 (setq org-agenda-custom-commands
1571 (quote (("N" "Notes" tags "NOTE"
1572 ((org-agenda-overriding-header "Notes")
1573 (org-tags-match-list-sublevels t)))
1574 ("h" "Habits" tags-todo "STYLE=\"habit\""
1575 ((org-agenda-overriding-header "Habits")
1576 (org-agenda-sorting-strategy
1577 '(todo-state-down effort-up category-keep))))
1581 ((org-agenda-overriding-header "Tasks to Refile")
1582 (org-tags-match-list-sublevels nil)))
1583 (tags-todo "-CANCELLED/!"
1584 ((org-agenda-overriding-header "Stuck Projects")
1585 (org-agenda-skip-function 'bh/skip-non-stuck-projects)
1586 (org-agenda-sorting-strategy
1588 (tags-todo "-HOLD-CANCELLED/!"
1589 ((org-agenda-overriding-header "Projects")
1590 (org-agenda-skip-function 'bh/skip-non-projects)
1591 (org-tags-match-list-sublevels 'indented)
1592 (org-agenda-sorting-strategy
1594 (tags-todo "-CANCELLED/!NEXT"
1595 ((org-agenda-overriding-header (concat "Project Next Tasks"
1596 (if bh/hide-scheduled-and-waiting-next-tasks
1598 " (including WAITING and SCHEDULED tasks)")))
1599 (org-agenda-skip-function 'bh/skip-projects-and-habits-and-single-tasks)
1600 (org-tags-match-list-sublevels t)
1601 (org-agenda-todo-ignore-scheduled bh/hide-scheduled-and-waiting-next-tasks)
1602 (org-agenda-todo-ignore-deadlines bh/hide-scheduled-and-waiting-next-tasks)
1603 (org-agenda-todo-ignore-with-date bh/hide-scheduled-and-waiting-next-tasks)
1604 (org-agenda-sorting-strategy
1605 '(todo-state-down effort-up category-keep))))
1606 (tags-todo "-REFILE-CANCELLED-WAITING-HOLD/!"
1607 ((org-agenda-overriding-header (concat "Project Subtasks"
1608 (if bh/hide-scheduled-and-waiting-next-tasks
1610 " (including WAITING and SCHEDULED tasks)")))
1611 (org-agenda-skip-function 'bh/skip-non-project-tasks)
1612 (org-agenda-todo-ignore-scheduled bh/hide-scheduled-and-waiting-next-tasks)
1613 (org-agenda-todo-ignore-deadlines bh/hide-scheduled-and-waiting-next-tasks)
1614 (org-agenda-todo-ignore-with-date bh/hide-scheduled-and-waiting-next-tasks)
1615 (org-agenda-sorting-strategy
1617 (tags-todo "-REFILE-CANCELLED-WAITING-HOLD/!"
1618 ((org-agenda-overriding-header (concat "Standalone Tasks"
1619 (if bh/hide-scheduled-and-waiting-next-tasks
1621 " (including WAITING and SCHEDULED tasks)")))
1622 (org-agenda-skip-function 'bh/skip-project-tasks)
1623 (org-agenda-todo-ignore-scheduled bh/hide-scheduled-and-waiting-next-tasks)
1624 (org-agenda-todo-ignore-deadlines bh/hide-scheduled-and-waiting-next-tasks)
1625 (org-agenda-todo-ignore-with-date bh/hide-scheduled-and-waiting-next-tasks)
1626 (org-agenda-sorting-strategy
1628 (tags-todo "-CANCELLED+WAITING|HOLD/!"
1629 ((org-agenda-overriding-header "Waiting and Postponed Tasks")
1630 (org-agenda-skip-function 'bh/skip-stuck-projects)
1631 (org-tags-match-list-sublevels nil)
1632 (org-agenda-todo-ignore-scheduled t)
1633 (org-agenda-todo-ignore-deadlines t)))
1635 ((org-agenda-overriding-header "Tasks to Archive")
1636 (org-agenda-skip-function 'bh/skip-non-archivable-tasks)
1637 (org-tags-match-list-sublevels nil))))
1640 ; org mode agenda files
1641 (setq org-agenda-files
1643 (file-expand-wildcards "~/projects/org-notes/*.org")
1644 (file-expand-wildcards "~/org-mode/from-mobile.org")
1645 (file-expand-wildcards "~/org-notes-*/*.org")
1648 (setq my/org-refile-file
1650 (lambda (file) (string-match-p (regexp-quote "/refile.org") file))
1653 (set-register ?n (cons 'file "~/projects/org-notes/notes.org"))
1654 (set-register ?r (cons 'file my/org-refile-file))
1655 (set-register ?o (cons 'file "~/projects/org-notes/ool.org"))
1656 (set-register ?s (cons 'file "~/projects/org-notes/sndservers.org"))
1657 (set-register ?c (cons 'file "~/projects/org-notes/chaim.org"))
1658 (set-register ?w (cons 'file "~/projects/org-notes/wildman.org"))
1659 (set-register ?u (cons 'file "~/projects/org-notes/uddin.org"))
1660 (set-register ?R (cons 'file "~/projects/reviews/reviews.org"))
1661 (set-register ?d (cons 'file "~/projects/org-notes/diary.org"))
1662 ; from https://emacs.stackexchange.com/questions/909/how-can-i-have-an-agenda-timeline-view-of-multiple-files
1663 ; (defun org-agenda-timeline-all (&optional arg)
1666 ; (dolist (org-agenda-file org-agenda-files)
1667 ; (insert-file-contents org-agenda-file nil)
1668 ; (goto-char (point-max))
1670 ; (write-file "/tmp/timeline.org")
1671 ; (org-agenda arg "L")))
1672 ; (define-key org-mode-map (kbd "C-c t") 'org-agenda-timeline-all)
1676 #+BEGIN_SRC emacs-lisp
1677 (setq org-global-properties '(("Effort_ALL 0 0:10 0:30 1:00 2:00 3:00 4:00 5:00 6:00 7:00")))
1678 (setq org-columns-default-format "%40ITEM(Task) %6Effort{:} %CLOCKSUM %PRIORITY %TODO %13SCHEDULED %13DEADLINE %TAGS")
1680 (setq org-default-notes-file "~/projects/org-notes/notes.org")
1681 (setq org-id-link-to-org-use-id 'use-existing)
1683 ** Capture Templates
1684 #+BEGIN_SRC emacs-lisp
1685 (setq org-capture-templates ;; mail-specific note template, identified by "m"
1686 `(("m" "Mail" entry (file my/org-refile-file)
1687 "* %?\n\n Source: %u, [[%:link][%:description]]\n %:initial")
1688 ("t" "todo" entry (file my/org-refile-file)
1689 "* TODO %?\n :PROPERTIES:\n :END:\n :LOGBOOK:\n :END:\n%U\n%a\n" :clock-in t :clock-resume t)
1690 ("r" "respond" entry (file my/org-refile-file)
1691 "* NEXT Respond to %:from on %:subject\nSCHEDULED: %t\n%U\n%a\n" :clock-in t :clock-resume t :immediate-finish t)
1692 ("n" "note" entry (file my/org-refile-file)
1693 "* %? :NOTE:\n%U\n%a\n" :clock-in t :clock-resume t)
1694 ("s" "schedule" entry (file my/org-refile-file)
1695 "* %? :cal:\n%^{scheduled:}t\n%U\n%a\n" :clock-in t :clock-resume t)
1696 ("j" "Journal" entry (file+datetree "~/projects/org-notes/diary.org")
1697 "* %?\n%U\n" :clock-in t :clock-resume t)
1698 ("w" "org-protocol" entry (file my/org-refile-file)
1699 "* TODO Review %c\n%U\n" :immediate-finish t)
1700 ("M" "Meeting" entry (file my/org-refile-file)
1701 "* MEETING with %? :MEETING:\n%U" :clock-in t :clock-resume t)
1702 ("S" "Seminar" entry (file my/org-refile-file)
1703 "* SEMINAR notes %? :SEMINAR:\n%U" :clock-in t :clock-resume t)
1704 ("P" "Paper to read" entry (file+headline "~/projects/research/papers_to_read.org" "Refile")
1705 "* TODO Get/Read %? \n%U" :clock-in t :clock-resume t)
1706 ("p" "Phone call" entry (file my/org-refile-file)
1707 "* PHONE %? :PHONE:\n%U" :clock-in t :clock-resume t)
1708 ("J" "job" entry (file+olp "~/projects/org-notes/notes.org"
1710 ,(format-time-string "Positions %Y"))
1711 "* TODO Apply for %? :job:\nSCHEDULED: <%<%Y-%m-%d>>\n%U\n%x\n" :clock-in t :clock-resume t)
1712 ("h" "Habit" entry (file my/org-refile-file)
1713 "* NEXT %?\n%U\n%a\nSCHEDULED: %(format-time-string \"<%Y-%m-%d .+1d/3d>\")\n:PROPERTIES:\n:STYLE: habit\n:REPEAT_TO_STATE: NEXT\n:END:\n%a\n")
1717 ;; Remove empty LOGBOOK drawers on clock out
1718 (defun bh/remove-empty-drawer-on-clock-out ()
1721 (beginning-of-line 0)
1722 (org-remove-empty-drawer-at (point))))
1724 (defun my/org-add-id ()
1727 (if (org-current-level)
1736 ** Org mode key bindings
1737 #+BEGIN_SRC emacs-lisp
1738 ;; org mode configuration from http://doc.norang.ca/org-mode.html
1739 ;; Custom Key Bindings
1740 :bind* (("<f9> a" . org-agenda)
1741 ("<f9> I" . bh/punch-in)
1742 ("<f9> O" . bh/punch-out)
1743 ("<f9> SPC" . bh/clock-in-last-task)
1744 ("<f12>" . dla/show-org-agenda)
1745 ;; ("<f5>" . bh/org-todo)
1746 ("<S-f5>" . bh/widen)
1747 ("<f7>" . bh/set-truncate-lines)
1748 ("<f8>" . org-cycle-agenda-files)
1749 ("<f9> <f9>" . dla/show-org-agenda)
1751 ("<f9> c" . calendar)
1752 ("<f9> f" . boxquote-insert-file)
1753 ("<f9> h" . bh/hide-other)
1754 ("<f9> n" . bh/toggle-next-task-display)
1757 ("<f9> r" . boxquote-region)
1758 ("<f9> s" . bh/switch-to-scratch)
1760 ("<f9> t" . bh/insert-inactive-timestamp)
1761 ("<f9> T" . bh/toggle-insert-inactive-timestamp)
1763 ("<f9> v" . visible-mode)
1764 ("<f9> l" . org-toggle-link-display)
1765 ("<f9> SPC" . bh/clock-in-last-task)
1766 ("C-<f9>" . previous-buffer)
1767 ("M-<f9>" . org-toggle-inline-images)
1768 ("C-x n r" . narrow-to-region)
1769 ("C-<f10>" . next-buffer)
1770 ("<f11>" . org-clock-goto)
1771 ("C-<f11>" . org-clock-in)
1772 ("C-s-<f12>" . bh/save-then-publish)
1773 ("C-c c" . org-capture))
1776 ** Utility Functions
1777 #+BEGIN_SRC emacs-lisp
1778 (defun bh/hide-other ()
1781 (org-back-to-heading 'invisible-ok)
1782 (outline-hide-other)
1787 (defun bh/set-truncate-lines ()
1788 "Toggle value of truncate-lines and refresh window display."
1790 (setq truncate-lines (not truncate-lines))
1791 ;; now refresh window display (an idiom from simple.el):
1793 (set-window-start (selected-window)
1794 (window-start (selected-window)))))
1796 (defun bh/switch-to-scratch ()
1798 (switch-to-buffer "*scratch*"))
1800 (setq org-use-fast-todo-selection t)
1801 (setq org-treat-S-cursor-todo-selection-as-state-change nil)
1803 ; create function to create headlines in file. This comes from
1804 ; http://stackoverflow.com/questions/13340616/assign-ids-to-every-entry-in-org-mode
1805 (defun my/org-add-ids-to-headlines-in-file ()
1806 "Add ID properties to all headlines in the current file which
1807 do not already have one."
1811 (goto-char (point-min))
1812 (when (not (re-search-forward "^#\\+OPTIONS:.*auto-id:f" (point-max) t))
1813 (org-map-entries 'org-id-get-create))))
1814 (defun dla/org-update-ids-to-headlines-in-file ()
1815 "Add or replace ID properties to all headlines in the current file
1816 (or narrowed region)."
1819 (org-map-entries '(lambda () (org-id-get-create t))))
1820 ; if we wanted to do this to every buffer, do the following:
1821 (add-hook 'org-mode-hook
1823 (add-hook 'before-save-hook 'my/org-add-ids-to-headlines-in-file nil 'local)))
1826 #+BEGIN_SRC emacs-lisp
1827 (use-package find-lisp
1829 (setq org-agenda-text-search-extra-files
1830 (append '(agenda-archives)
1831 (find-lisp-find-files "~/projects/org-notes" "\.org$")
1832 (find-lisp-find-files "~/projects/org-notes" "\.org_archive$")
1836 #+BEGIN_SRC emacs-lisp
1837 (setq org-todo-keywords
1838 (quote ((sequence "TODO(t)" "NEXT(n)" "|" "DONE(d)")
1839 (sequence "WAITING(w@/!)" "HOLD(h@/!)" "|" "CANCELLED(c@/!)" "PHONE" "MEETING"))))
1841 (setq org-todo-keyword-faces
1842 (quote (("TODO" :foreground "red" :weight bold)
1843 ("NEXT" :foreground "blue" :weight bold)
1844 ("DONE" :foreground "forest green" :weight bold)
1845 ("WAITING" :foreground "orange" :weight bold)
1846 ("HOLD" :foreground "magenta" :weight bold)
1847 ("CANCELLED" :foreground "forest green" :weight bold)
1848 ("MEETING" :foreground "forest green" :weight bold)
1849 ("PHONE" :foreground "forest green" :weight bold))))
1851 (setq org-todo-state-tags-triggers
1852 (quote (("CANCELLED" ("CANCELLED" . t))
1853 ("WAITING" ("WAITING" . t))
1854 ("HOLD" ("WAITING") ("HOLD" . t))
1855 (done ("WAITING") ("HOLD"))
1856 ("TODO" ("WAITING") ("CANCELLED") ("HOLD"))
1857 ("NEXT" ("WAITING") ("CANCELLED") ("HOLD"))
1858 ("DONE" ("WAITING") ("CANCELLED") ("HOLD")))))
1862 ; (add-hook 'org-clock-out-hook 'bh/remove-empty-drawer-on-clock-out 'append)
1863 ; add ids on creation of nodes
1864 (add-hook 'org-capture-prepare-finalize-hook 'my/org-add-id)
1867 ; resolve clocks after 10 minutes of idle; use xprintidle
1868 ; (setq org-clock-idle-time 10)
1869 ; (setq org-clock-x11idle-program-name "xprintidle")
1871 ; this is from http://doc.norang.ca/org-mode.html#Capture
1872 ; use C-M-r for org mode capture
1873 (global-set-key (kbd "C-M-r") 'org-capture)
1875 ; Targets include this file and any file contributing to the agenda - up to 9 levels deep
1876 (setq org-refile-targets (quote ((nil :maxlevel . 9)
1877 (org-agenda-files :maxlevel . 9))))
1879 ; Use full outline paths for refile targets - we file directly with IDO
1880 (setq org-refile-use-outline-path t)
1882 ; Targets complete directly with IDO
1883 (setq org-outline-path-complete-in-steps nil)
1885 ; Allow refile to create parent tasks with confirmation
1886 (setq org-refile-allow-creating-parent-nodes (quote confirm))
1888 ; ; Use IDO for both buffer and file completion and ido-everywhere to t
1889 ; (setq org-completion-use-ido t)
1890 ; (setq ido-everywhere t)
1891 ; (setq ido-max-directory-size 100000)
1892 ; (ido-mode (quote both))
1893 ; ; Use the current window when visiting files and buffers with ido
1894 ; (setq ido-default-file-method 'selected-window)
1895 ; (setq ido-default-buffer-method 'selected-window)
1896 ; ; Use the current window for indirect buffer display
1897 ; (setq org-indirect-buffer-display 'current-window)
1900 ;;;; Refile settings
1901 ; Exclude DONE state tasks from refile targets
1902 (defun bh/verify-refile-target ()
1903 "Exclude todo keywords with a done state from refile targets"
1904 (not (member (nth 2 (org-heading-components)) org-done-keywords)))
1906 (setq org-refile-target-verify-function 'bh/verify-refile-target)
1908 ;; ensure that emacsclient will show just the note to be edited when invoked
1909 ;; from Mutt, and that it will shut down emacsclient once finished;
1910 ;; fallback to legacy behavior when not invoked via org-protocol.
1911 (require 'org-protocol)
1912 ; (add-hook 'org-capture-mode-hook 'delete-other-windows)
1913 (setq my-org-protocol-flag nil)
1914 (defadvice org-capture-finalize (after delete-frame-at-end activate)
1915 "Delete frame at remember finalization"
1916 (progn (if my-org-protocol-flag (delete-frame))
1917 (setq my-org-protocol-flag nil)))
1918 (defadvice org-capture-refile (around delete-frame-after-refile activate)
1919 "Delete frame at remember refile"
1920 (if my-org-protocol-flag
1922 (setq my-org-protocol-flag nil)
1927 (defadvice org-capture-kill (after delete-frame-at-end activate)
1928 "Delete frame at remember abort"
1929 (progn (if my-org-protocol-flag (delete-frame))
1930 (setq my-org-protocol-flag nil)))
1931 (defadvice org-protocol-capture (before set-org-protocol-flag activate)
1932 (setq my-org-protocol-flag t))
1934 (defadvice org-insert-todo-heading (after dla/create-id activate)
1935 (unless (org-in-item-p)
1941 (add-to-list 'org-modules 'org-habit)
1943 ; this comes from http://upsilon.cc/~zack/blog/posts/2010/02/integrating_Mutt_with_Org-mode/
1944 (defun open-mail-in-mutt (message)
1945 "Open a mail message in Mutt, using an external terminal.
1947 Message can be specified either by a path pointing inside a
1948 Maildir, or by Message-ID."
1949 (interactive "MPath or Message-ID: ")
1951 (format "faf xterm -e \"%s %s\""
1952 (substitute-in-file-name "$HOME/bin/mutt_open") message)))
1954 ;; add support for "mutt:ID" links
1955 (org-add-link-type "mutt" 'open-mail-in-mutt)
1957 (defun my-org-mode-setup ()
1958 ; (load-library "reftex")
1959 (and (buffer-file-name)
1960 (file-exists-p (buffer-file-name))
1962 ; (reftex-parse-all)
1963 (reftex-set-cite-format
1964 '((?b . "[[bib:%l][%l-bib]]")
1965 (?n . "[[notes:%l][%l-notes]]")
1967 (?h . "*** %t\n:PROPERTIES:\n:Custom_ID: %l\n:END:\n[[papers:%l][%l xoj]] [[papers-pdf:%l][pdf]]")))
1969 (define-key org-mode-map (kbd "C-c )") 'reftex-citation)
1970 (define-key org-mode-map (kbd "C-c [") 'reftex-citation)
1971 (define-key org-mode-map (kbd "C-c (") 'org-mode-reftex-search)
1972 (define-key org-mode-map (kbd "C-c 0") 'reftex-view-crossref)
1974 (add-hook 'org-mode-hook 'my-org-mode-setup)
1976 (defun org-mode-reftex-search ()
1978 (org-open-link-from-string (format "[[notes:%s]]" (first (reftex-citation t)))))
1980 (defun open-research-paper (bibtexkey)
1981 "Open a paper by bibtex key"
1982 (interactive "bibtex key: ")
1985 (substitute-in-file-name "$HOME/bin/bibtex_to_paper") bibtexkey)))
1986 (org-add-link-type "papers" 'open-research-paper)
1987 (defun open-research-paper-pdf (bibtexkey)
1988 "Open a paper pdf by bibtex key"
1989 (interactive "bibtex key: ")
1991 (format "%s -p evince_annot %s"
1992 (substitute-in-file-name "$HOME/bin/bibtex_to_paper") bibtexkey)))
1993 (org-add-link-type "papers-pdf" 'open-research-paper-pdf)
1995 (add-to-list 'org-link-abbrev-alist
1997 "~/projects/research/paper_notes.org::#%s"))
1999 ; I pretty much always want hiearchical checkboxes
2000 (setq org-hierachical-checkbox-statistics nil)
2002 ;; Add \begin{equation}\end{equation} templates to the org mode easy templates
2003 (add-to-list 'org-structure-template-alist
2004 '("E" "\\begin{equation}\n?\n\\end{equation}"))
2007 ;; http://www-public.it-sudparis.eu/~berger_o/weblog/2012/03/23/how-to-manage-and-export-bibliographic-notesrefs-in-org-mode/
2008 (defun my-rtcite-export-handler (path desc format)
2009 (message "my-rtcite-export-handler is called : path = %s, desc = %s, format = %s" path desc format)
2010 (let* ((search (when (string-match "::#?\\(.+\\)\\'" path)
2011 (match-string 1 path)))
2012 (path (substring path 0 (match-beginning 0))))
2013 (cond ((eq format 'latex)
2015 (equal 0 (search "rtcite:" desc)))
2016 (format "\\cite{%s}" search)
2017 (format "\\cite[%s]{%s}" desc search))))))
2019 (org-add-link-type "rtcite"
2021 'my-rtcite-export-handler)
2025 ** Org Mobile Configuration
2026 #+BEGIN_SRC emacs-lisp
2027 (setq-default org-mobile-directory "/linnode.donarmstrong.com:/sites/dav.donarmstrong.com/root/org/")
2028 (when (string= system-name "linnode")
2029 (setq-default org-mobile-directory "/sites/dav.donarmstrong.com/root/org/"))
2030 (setq-default org-directory "/home/don/org-mode/")
2031 (setq-default org-mobile-inbox-for-pull "/home/don/org-mode/from-mobile.org")
2035 #+BEGIN_SRC emacs-lisp
2036 ;; org mode ical export
2037 (setq org-icalendar-timezone "America/Los_Angeles")
2038 (setq org-icalendar-use-scheduled '(todo-start event-if-todo))
2039 ;; we already add the id manually
2040 (setq org-icalendar-store-UID t)
2043 ** General Org Babel Configuration
2044 #+BEGIN_SRC emacs-lisp
2045 ;; org babel support
2046 (org-babel-do-load-languages
2047 'org-babel-load-languages
2054 ;; set the right path to ditaa.jar
2055 (setq org-ditaa-jar-path "/usr/share/ditaa/ditaa.jar")
2056 ;; use graphviz-dot for dot things
2057 (add-to-list 'org-src-lang-modes '("dot" . graphviz-dot))
2058 ;; do not indent begin_src blocks
2059 (setq org-edit-src-content-indentation 0)
2060 ;; org-babel-by-backend
2061 (defmacro org-babel-by-backend (&rest body)
2062 `(case (if (boundp 'backend)
2063 (org-export-backend-name backend)
2066 (defun my/fix-inline-images ()
2067 (when org-inline-image-overlays
2068 (org-redisplay-inline-images)))
2070 (add-hook 'org-babel-after-execute-hook
2071 'my/fix-inline-images)
2074 ** LaTeX configuration
2075 #+BEGIN_SRC emacs-lisp
2076 (use-package ox-extra
2078 (ox-extras-activate '(ignore-headlines)))
2080 (add-to-list 'org-latex-classes
2082 "\\documentclass[11pt,oneside,article]{memoir}\n"
2083 ("\\section{%s}" . "\\section*{%s}")
2084 ("\\subsection{%s}" . "\\subsection*{%s}")
2085 ("\\subsubsection{%s}" . "\\subsubsection*{%s}")
2086 ("\\paragraph{%s}" . "\\paragraph*{%s}")
2087 ("\\subparagraph{%s}" . "\\subparagraph*{%s}")))
2089 (setq org-beamer-outline-frame-options "")
2090 (add-to-list 'org-latex-classes
2092 "\\documentclass[ignorenonframetext]{beamer}
2093 [NO-DEFAULT-PACKAGES]
2096 ("\\section{%s}" . "\\section*{%s}")
2097 ("\\subsection{%s}" . "\\subsection*{%s}")
2098 ("\\subsubsection{%s}" . "\\subsubsection*{%s}")
2099 ("\\paragraph{%s}" . "\\paragraph*{%s}")
2100 ("\\subparagraph{%s}" . "\\subparagraph*{%s}")))
2102 (add-to-list 'org-latex-classes
2104 "\\documentclass[11pt,oneside]{memoir}\n"
2105 ("\\chapter{%s}" . "\\chapter*{%s}")
2106 ("\\section{%s}" . "\\section*{%s}")
2107 ("\\subsection{%s}" . "\\subsection*{%s}")
2108 ("\\subsubsection{%s}" . "\\subsubsection*{%s}")))
2110 (add-to-list 'org-latex-classes
2112 "\\documentclass[11pt]{letter}
2113 [NO-DEFAULT-PACKAGES]
2116 ("\\section{%s}" . "\\section*{%s}")
2117 ("\\subsection{%s}" . "\\subsection*{%s}")
2118 ("\\subsubsection{%s}" . "\\subsubsection*{%s}")
2119 ("\\paragraph{%s}" . "\\paragraph*{%s}")
2120 ("\\subparagraph{%s}" . "\\subparagraph*{%s}")))
2122 (add-to-list 'org-latex-classes
2124 "\\documentclass{dlacv}
2125 [NO-DEFAULT-PACKAGES]
2128 ("\\section{%s}" . "\\section*{%s}")
2129 ("\\subsection{%s}" . "\\subsection*{%s}")
2130 ("\\subsubsection{%s}" . "\\subsubsection*{%s}")
2131 ("\\paragraph{%s}" . "\\paragraph*{%s}")
2132 ("\\subparagraph{%s}" . "\\subparagraph*{%s}")))
2135 (add-to-list 'org-latex-classes
2137 "\\documentclass{dlaresume}
2138 [NO-DEFAULT-PACKAGES]
2141 ("\\section{%s}" . "\\section*{%s}")
2142 ("\\subsection{%s}" . "\\subsection*{%s}")
2143 ("\\subsubsection{%s}" . "\\subsubsection*{%s}")
2144 ("\\paragraph{%s}" . "\\paragraph*{%s}")
2145 ("\\subparagraph{%s}" . "\\subparagraph*{%s}")))
2148 ;; Originally taken from Bruno Tavernier: http://thread.gmane.org/gmane.emacs.orgmode/31150/focus=31432
2149 ;; but adapted to use latexmk 4.22 or higher.
2150 (setq org-latex-pdf-process '("latexmk -f -pdflatex=xelatex -bibtex -use-make -pdf %f"))
2152 ;; Default packages included in /every/ tex file, latex, pdflatex or xelatex
2153 (setq org-latex-default-packages-alist
2155 ("" "unicode-math" t)
2157 (setq org-latex-packages-alist
2164 ("" "longtable" nil)
2167 ;; make equations larger
2168 (setq org-format-latex-options (plist-put org-format-latex-options :scale 2.0))
2170 (defun org-create-formula--latex-header ()
2171 "Return LaTeX header appropriate for previewing a LaTeX snippet."
2172 (let ((info (org-combine-plists (org-export--get-global-options
2173 (org-export-get-backend 'latex))
2174 (org-export--get-inbuffer-options
2175 (org-export-get-backend 'latex)))))
2176 (org-latex-guess-babel-language
2177 (org-latex-guess-inputenc
2178 (org-splice-latex-header
2179 org-format-latex-header
2180 org-latex-default-packages-alist
2182 (plist-get info :latex-header)))
2186 ; support ignoring headers in org mode export to latex
2187 ; from http://article.gmane.org/gmane.emacs.orgmode/67692
2188 (defadvice org-latex-headline (around my-latex-skip-headlines
2189 (headline contents info) activate)
2190 (if (member "ignoreheading" (org-element-property :tags headline))
2191 (setq ad-return-value contents)
2194 ;; keep latex logfiles
2196 (setq org-latex-remove-logfiles nil)
2198 ;; Resume clocking task when emacs is restarted
2199 (org-clock-persistence-insinuate)
2201 ;; Show lot of clocking history so it's easy to pick items off the C-F11 list
2202 (setq org-clock-history-length 23)
2203 ;; Resume clocking task on clock-in if the clock is open
2204 (setq org-clock-in-resume t)
2205 ;; Change tasks to NEXT when clocking in; this avoids clocking in when
2206 ;; there are things like PHONE calls
2207 (setq org-clock-in-switch-to-state 'bh/clock-in-to-next)
2208 ;; Separate drawers for clocking and logs
2209 (setq org-drawers (quote ("PROPERTIES" "LOGBOOK")))
2210 ;; Save clock data and state changes and notes in the LOGBOOK drawer
2211 (setq org-clock-into-drawer t)
2212 (setq org-log-into-drawer t)
2213 ;; Sometimes I change tasks I'm clocking quickly - this removes clocked tasks with 0:00 duration
2214 (setq org-clock-out-remove-zero-time-clocks t)
2215 ;; Clock out when moving task to a done state
2216 (setq org-clock-out-when-done t)
2217 ;; Save the running clock and all clock history when exiting Emacs, load it on startup
2218 (setq org-clock-persist t)
2219 ;; Do not prompt to resume an active clock
2220 (setq org-clock-persist-query-resume nil)
2221 ;; Enable auto clock resolution for finding open clocks
2222 (setq org-clock-auto-clock-resolution (quote when-no-clock-is-running))
2223 ;; Include current clocking task in clock reports
2224 (setq org-clock-report-include-clocking-task t)
2226 ;; the cache seems to be broken
2227 (setq org-element-use-cache nil)
2229 (defvar bh/keep-clock-running nil)
2231 (defun bh/is-task-p ()
2232 "Any task with a todo keyword and no subtask"
2236 (subtree-end (save-excursion (org-end-of-subtree t)))
2237 (is-a-task (member (nth 2 (org-heading-components)) org-todo-keywords-1)))
2240 (while (and (not has-subtask)
2241 (< (point) subtree-end)
2242 (re-search-forward "^\*+ " subtree-end t))
2243 (when (member (org-get-todo-state) org-todo-keywords-1)
2244 (setq has-subtask t))))
2245 (and is-a-task (not has-subtask)))))
2246 (defun bh/is-project-p ()
2247 "Any task with a todo keyword subtask"
2251 (subtree-end (save-excursion (org-end-of-subtree t)))
2252 (is-a-task (member (nth 2 (org-heading-components)) org-todo-keywords-1)))
2255 (while (and (not has-subtask)
2256 (< (point) subtree-end)
2257 (re-search-forward "^\*+ " subtree-end t))
2258 (when (member (org-get-todo-state) org-todo-keywords-1)
2259 (setq has-subtask t))))
2260 (and is-a-task has-subtask))))
2262 (defun bh/is-subproject-p ()
2263 "Any task which is a subtask of another project"
2264 (let ((is-subproject)
2265 (is-a-task (member (nth 2 (org-heading-components)) org-todo-keywords-1)))
2267 (while (and (not is-subproject) (org-up-heading-safe))
2268 (when (member (nth 2 (org-heading-components)) org-todo-keywords-1)
2269 (setq is-subproject t))))
2270 (and is-a-task is-subproject)))
2273 (defun bh/clock-in-to-next (kw)
2274 "Switch a task from TODO to NEXT when clocking in.
2275 Skips capture tasks, projects, and subprojects.
2276 Switch projects and subprojects from NEXT back to TODO"
2277 (when (not (and (boundp 'org-capture-mode) org-capture-mode))
2279 ((and (member (org-get-todo-state) (list "TODO"))
2282 ((and (member (org-get-todo-state) (list "NEXT"))
2286 (defun bh/punch-in (arg)
2287 "Start continuous clocking and set the default task to the
2288 selected task. If no task is selected set the Organization task
2289 as the default task."
2291 (setq bh/keep-clock-running t)
2292 (if (equal major-mode 'org-agenda-mode)
2294 ;; We're in the agenda
2296 (let* ((marker (org-get-at-bol 'org-hd-marker))
2297 (tags (org-with-point-at marker (org-get-tags))))
2298 (if (and (eq arg 4) tags)
2299 (org-agenda-clock-in '(16))
2300 (bh/clock-in-organization-task-as-default)))
2302 ;; We are not in the agenda
2306 ; Find the tags on the current task
2307 (if (and (equal major-mode 'org-mode) (not (org-before-first-heading-p)) (eq arg 4))
2308 (org-clock-in '(16))
2309 (bh/clock-in-organization-task-as-default)))))
2311 (defun bh/punch-out ()
2313 (setq bh/keep-clock-running nil)
2314 (when (org-clock-is-active)
2316 (org-agenda-remove-restriction-lock))
2318 (defun bh/clock-in-default-task ()
2320 (org-with-point-at org-clock-default-task
2323 (defun bh/clock-in-parent-task ()
2324 "Move point to the parent (project) task if any and clock in"
2325 (let ((parent-task))
2329 (while (and (not parent-task) (org-up-heading-safe))
2330 (when (member (nth 2 (org-heading-components)) org-todo-keywords-1)
2331 (setq parent-task (point))))
2333 (org-with-point-at parent-task
2335 (when bh/keep-clock-running
2336 (bh/clock-in-default-task)))))))
2338 (defvar bh/organization-task-id "e22cb8bf-07c7-408b-8f60-ff3aadac95e4")
2340 (defun bh/clock-in-organization-task-as-default ()
2342 (org-with-point-at (org-id-find bh/organization-task-id 'marker)
2343 (org-clock-in '(16))))
2345 (defun bh/clock-out-maybe ()
2346 (when (and bh/keep-clock-running
2347 (not org-clock-clocking-in)
2348 (marker-buffer org-clock-default-task)
2349 (not org-clock-resolving-clocks-due-to-idleness))
2350 (bh/clock-in-parent-task)))
2352 ; (add-hook 'org-clock-out-hook 'bh/clock-out-maybe 'append)
2355 (defun bh/clock-in-task-by-id (id)
2356 "Clock in a task by id"
2357 (org-with-point-at (org-id-find id 'marker)
2358 (org-clock-in nil)))
2360 (defun bh/clock-in-last-task (arg)
2361 "Clock in the interrupted task if there is one
2362 Skip the default task and get the next one.
2363 A prefix arg forces clock in of the default task."
2365 (let ((clock-in-to-task
2367 ((eq arg 4) org-clock-default-task)
2368 ((and (org-clock-is-active)
2369 (equal org-clock-default-task (cadr org-clock-history)))
2370 (caddr org-clock-history))
2371 ((org-clock-is-active) (cadr org-clock-history))
2372 ((equal org-clock-default-task (car org-clock-history)) (cadr org-clock-history))
2373 (t (car org-clock-history)))))
2375 (org-with-point-at clock-in-to-task
2376 (org-clock-in nil))))
2379 (defun org-export-to-ods ()
2381 (let ((csv-file "data.csv"))
2382 (org-table-export csv-file "orgtbl-to-csv")
2383 (org-odt-convert csv-file "ods" 'open)))
2385 ; allow for zero-width-space to be a break in regexp too
2386 ; (setcar org-emphasis-regexp-components " [:space:] \t('\"{")
2387 ; (setcar (nthcdr 1 org-emphasis-regexp-components) " [:space:]- \t.,:!?;'\")}\\")
2388 ; (org-set-emph-re 'org-emphasis-regexp-components org-emphasis-regexp-components)
2390 ;; support inserting screen shots
2391 (defun my/org-insert-screenshot ()
2392 "Take a screenshot into a time stamped unique-named file in the
2393 same directory as the org-buffer and insert a link to this file."
2395 (defvar my/org-insert-screenshot/filename)
2396 (setq my/org-insert-screenshot/filename
2398 "Screenshot to insert: "
2400 (concat (buffer-file-name) "_" (format-time-string "%Y%m%d_%H%M%S") ".png")
2403 (call-process "import" nil nil nil my/org-insert-screenshot/filename)
2404 (insert (concat "[[" my/org-insert-screenshot/filename "]]"))
2405 (org-display-inline-images))
2407 (defun my/fix-inline-images ()
2408 (when org-inline-image-overlays
2409 (org-redisplay-inline-images)))
2411 (add-hook 'org-babel-after-execute-hook 'my/fix-inline-images)
2413 ;; use xelatex to preview with imagemagick
2414 (add-to-list 'org-preview-latex-process-alist
2415 '(xelateximagemagick
2416 :programs ("xelatex" "convert")
2417 :description "pdf > png"
2418 :message "you need to install xelatex and imagemagick"
2420 :image-input-type "pdf"
2421 :image-output-type "png"
2422 :image-size-adjust (1.0 . 1.0)
2423 :latex-compiler ("xelatex -interaction nonstopmode -output-directory %o %f")
2424 :image-converter ("convert -density %D -trim -antialias %f -quality 100 %O"))
2426 ;; use xelatex by default
2427 (setq org-preview-latex-default-process 'xelateximagemagick)
2429 ; from http://orgmode.org/Changes.html
2430 (defun my/org-repair-property-drawers ()
2431 "Fix properties drawers in current buffer.
2432 Ignore non Org buffers."
2434 (when (eq major-mode 'org-mode)
2435 (org-with-wide-buffer
2436 (goto-char (point-min))
2437 (let ((case-fold-search t)
2438 (inline-re (and (featurep 'org-inlinetask)
2439 (concat (org-inlinetask-outline-regexp)
2443 (unless (and inline-re (org-looking-at-p inline-re))
2445 (let ((end (save-excursion (outline-next-heading) (point))))
2447 (when (org-looking-at-p org-planning-line-re) (forward-line))
2448 (when (and (< (point) end)
2449 (not (org-looking-at-p org-property-drawer-re))
2451 (and (re-search-forward org-property-drawer-re end t)
2452 (eq (org-element-type
2453 (save-match-data (org-element-at-point)))
2455 (insert (delete-and-extract-region
2457 (min (1+ (match-end 0)) end)))
2458 (unless (bolp) (insert "\n"))))))))))))
2462 #+BEGIN_SRC emacs-lisp
2466 (use-package calfw-org
2469 (use-package org-gcal
2470 :if (file-readable-p "~/.hide/org_gcal.el")
2472 :config '((if (file-readable-p "~/.hide/org_gcal.el")
2473 (load-file "~/.hide/org_gcal.el"))
2478 #+BEGIN_SRC emacs-lisp
2482 ;; Show notification 10 minutes before event
2483 (setq appt-message-warning-time 10)
2484 ;; Disable multiple reminders
2485 (setq appt-display-interval appt-message-warning-time)
2486 (setq appt-display-mode-line nil)
2488 ;; add automatic reminders for appointments
2489 (defun my/org-agenda-to-appt ()
2491 (setq appt-time-msg-list nil)
2492 (org-agenda-to-appt))
2493 ;; add reminders when starting emacs
2494 (my/org-agenda-to-appt)
2495 ;; when rebuilding the agenda
2496 (defadvice org-agenda-redo (after org-agenda-redo-add-appts)
2497 "Pressing `r' on the agenda will also add appointments."
2498 (my/org-agenda-to-appt)
2500 ;; when saving all org buffers
2501 (defadvice org-save-all-org-buffers (after org-save-all-org-buffers-add-appts)
2502 "Re-add appts after saving all org buffers"
2503 (my/org-agenda-to-appt))
2504 ;; Display appointments as a window manager notification
2505 (setq appt-disp-window-function 'my/appt-display)
2506 (setq appt-delete-window-function (lambda () t))
2508 (setq my/appt-notification-app (concat (getenv "HOME") "/bin/appt_notification"))
2510 (defun my/appt-display (min-to-app new-time msg)
2511 (if (atom min-to-app)
2512 (start-process "my/appt-notification-app" nil my/appt-notification-app min-to-app msg)
2513 (dolist (i (number-sequence 0 (1- (length min-to-app))))
2514 (start-process "my/appt-notification-app" nil my/appt-notification-app
2515 (nth i min-to-app) (nth i msg))))
2521 ** outshine (outlining) integration
2522 #+BEGIN_SRC emacs-lisp
2523 (use-package outshine
2525 :hook (outline-minor-mode . outshine-hook-function)
2529 #+BEGIN_SRC emacs-lisp
2533 ** Home/End Begining/End of line
2534 #+BEGIN_SRC emacs-lisp
2535 (global-set-key [home] 'move-beginning-of-line)
2536 (global-set-key [end] 'move-end-of-line)
2539 #+BEGIN_SRC emacs-lisp
2540 (global-unset-key "\M-g")
2541 (global-set-key (kbd "M-g l") 'goto-line)
2545 #+BEGIN_SRC emacs-lisp
2546 (use-package debian-changelog-mode
2547 :mode "debian/changelog"
2549 (setq debian-changelog-mailing-address "don@debian.org")
2550 (setq debian-changelog-full-name "Don Armstrong"))
2552 * Misc (uncharacterized)
2553 #+BEGIN_SRC emacs-lisp
2554 (setq calendar-latitude 38.6)
2555 (setq calendar-longitude -121.5)
2556 (setq case-fold-search t)
2557 (setq confirm-kill-emacs (quote y-or-n-p))
2558 (setq cperl-lazy-help-time nil)
2560 ** Turn on fontlock and icomplete
2561 #+BEGIN_SRC emacs-lisp
2562 (global-font-lock-mode 1)
2564 (setq log-edit-keep-buffer t)
2566 ** Set mail User agent
2567 #+BEGIN_SRC emacs-lisp
2568 (setq mail-user-agent (quote sendmail-user-agent))
2569 (setq mutt-alias-file-list (quote ("~/.mutt/aliases" "~/.mail_aliases")))
2572 #+BEGIN_SRC emacs-lisp
2573 (setq ps-footer-font-size (quote (8 . 10)))
2574 (setq ps-header-font-size (quote (8 . 10)))
2575 (setq ps-header-title-font-size (quote (10 . 10)))
2576 (setq ps-line-number-color "blue")
2577 (setq ps-print-footer t)
2578 (setq ps-print-footer-frame nil)
2579 (setq ps-print-only-one-header t)
2581 ** Only single spacing on sentences
2582 #+BEGIN_SRC emacs-lisp
2583 (setq sentence-end "[.?!][]\"')]*\\($\\| \\| \\)[
2585 (setq sentence-end-double-space nil)
2586 ; enable matching parenthesis
2588 ** Display paren mode
2589 #+BEGIN_SRC emacs-lisp
2591 (setq show-paren-delay 0.2)
2595 #+BEGIN_SRC emacs-lisp
2596 (setq user-mail-address "don@donarmstrong.com")
2599 ** Use primary selection on unix machines
2600 #+BEGIN_SRC emacs-lisp
2601 ;; switch back to the old primary selection method
2602 (if (or (string-equal system-type "darwin")
2603 (string-equal system-type "windows")
2606 (setq select-enable-clipboard t)
2607 (setq select-enable-primary nil)
2610 (setq select-enable-clipboard nil)
2611 (setq select-enable-primary t)
2613 ; (setq mouse-drag-copy-region t)
2615 ;; tramp configuration
2616 (setq tramp-use-ssh-controlmaster-options nil)
2618 (setq-default c-indent-level 4)
2619 (setq-default c-brace-imaginary-offset 0)
2620 (setq-default c-brace-offset -4)
2621 (setq-default c-argdecl-indent 4)
2622 (setq-default c-label-offset -4)
2623 (setq-default c-continued-statement-offset 4)
2625 (setq-default indent-tabs-mode nil)
2626 (setq-default tab-width 4)
2629 ;; (autoload 'php-mode "php-mode" "PHP editing mode" t)
2630 ;; (add-to-list 'auto-mode-alist '("\\.php3?\\'" . php-mode))
2631 ;; (add-to-list 'auto-mode-alist '("\\.phtml?\\'" . php-mode))
2632 ;; (add-to-list 'auto-mode-alist '("\\.php?\\'" . php-mode))
2633 ;; (add-to-list 'auto-mode-alist '("\\.php4?\\'" . php-mode))
2636 (defun insert-date ()
2637 "Insert date at point."
2639 (insert (format-time-string "%A, %B %e, %Y %k:%M:%S %Z")))
2640 (global-set-key "\C-[d" 'insert-date)
2642 (defun unfill-paragraph (arg)
2643 "Pull this whole paragraph up onto one line."
2645 (let ((fill-column 10000))
2646 (fill-paragraph arg))
2649 (column-number-mode t)
2652 ** Desktop-save-mode
2653 If the envvar EMACS_SERVER_NAME is set, consider this a separate
2654 emacs, and use a different desktop file to restore history
2655 #+BEGIN_SRC emacs-lisp
2656 (use-package desktop
2659 (setq desktop-base-file-name
2660 (convert-standard-filename
2662 (or (getenv "EMACS_SERVER_NAME")
2666 (setq desktop-base-lock-name
2667 (convert-standard-filename
2668 (concat desktop-base-file-name
2670 (setq desktop-auto-save-timeout 60)
2671 (setq desktop-restore-eager 5)
2672 (setq desktop-lazy-verbose nil)
2673 (desktop-save-mode 1)
2677 ** Misc (Uncharacterized)
2678 #+BEGIN_SRC emacs-lisp
2679 '(icomplete-mode on)
2681 ;; custom-set-faces was added by Custom.
2682 ;; If you edit it by hand, you could mess it up, so be careful.
2683 ;; Your init file should contain only one such instance.
2684 ;; If there is more than one, they won't work right.
2685 '(menu ((((type x-toolkit)) (:background "black" :foreground "grey90")))))
2688 (put 'upcase-region 'disabled nil)
2689 (put 'downcase-region 'disabled nil)
2690 (put 'narrow-to-region 'disabled nil)
2692 ; (defun turn-on-flyspell ()
2693 ; "Force flyspell-mode on using a positive arg. For use in hooks."
2695 ; (flyspell-mode 1))
2698 ; Outline-minor-mode key map
2699 (define-prefix-command 'cm-map nil "Outline-")
2701 (define-key cm-map "q" 'outline-hide-sublevels) ; Hide everything but the top-level headings
2702 (define-key cm-map "t" 'outline-hide-body) ; Hide everything but headings (all body lines)
2703 (define-key cm-map "o" 'outline-hide-other) ; Hide other branches
2704 (define-key cm-map "c" 'outline-hide-entry) ; Hide this entry's body
2705 (define-key cm-map "l" 'outline-hide-leaves) ; Hide body lines in this entry and sub-entries
2706 (define-key cm-map "d" 'outline-hide-subtree) ; Hide everything in this entry and sub-entries
2708 (define-key cm-map "a" 'outline-show-all) ; Show (expand) everything
2709 (define-key cm-map "e" 'outline-show-entry) ; Show this heading's body
2710 (define-key cm-map "i" 'outline-show-children) ; Show this heading's immediate child sub-headings
2711 (define-key cm-map "k" 'outline-show-branches) ; Show all sub-headings under this heading
2712 (define-key cm-map "s" 'outline-show-subtree) ; Show (expand) everything in this heading & below
2714 (define-key cm-map "u" 'outline-up-heading) ; Up
2715 (define-key cm-map "n" 'outline-next-visible-heading) ; Next
2716 (define-key cm-map "p" 'outline-previous-visible-heading) ; Previous
2717 (define-key cm-map "f" 'outline-forward-same-level) ; Forward - same level
2718 (define-key cm-map "b" 'outline-backward-same-level) ; Backward - same level
2719 (global-set-key "\M-o" cm-map)
2720 ; fix up tmux xterm keys
2721 ; stolen from http://unix.stackexchange.com/questions/24414/shift-arrow-not-working-in-emacs-within-tmux
2722 (defun fix-up-tmux-keys ()
2723 "Fix up tmux xterm keys"
2726 (let ((x 2) (tkey ""))
2746 ;; ctrl + alt + shift
2748 (setq tkey "C-M-S-"))
2751 (define-key key-translation-map (kbd (format "M-[ 1 ; %d A" x)) (kbd (format "%s<up>" tkey)))
2752 (define-key key-translation-map (kbd (format "M-[ 1 ; %d B" x)) (kbd (format "%s<down>" tkey)))
2753 (define-key key-translation-map (kbd (format "M-[ 1 ; %d C" x)) (kbd (format "%s<right>" tkey)))
2754 (define-key key-translation-map (kbd (format "M-[ 1 ; %d D" x)) (kbd (format "%s<left>" tkey)))
2756 (define-key key-translation-map (kbd (format "M-[ 1 ; %d H" x)) (kbd (format "%s<home>" tkey)))
2758 (define-key key-translation-map (kbd (format "M-[ 1 ; %d F" x)) (kbd (format "%s<end>" tkey)))
2760 (define-key key-translation-map (kbd (format "M-[ 5 ; %d ~" x)) (kbd (format "%s<prior>" tkey)))
2762 (define-key key-translation-map (kbd (format "M-[ 6 ; %d ~" x)) (kbd (format "%s<next>" tkey)))
2764 (define-key key-translation-map (kbd (format "M-[ 2 ; %d ~" x)) (kbd (format "%s<delete>" tkey)))
2766 (define-key key-translation-map (kbd (format "M-[ 3 ; %d ~" x)) (kbd (format "%s<delete>" tkey)))
2768 (define-key key-translation-map (kbd (format "M-[ 1 ; %d P" x)) (kbd (format "%s<f1>" tkey)))
2770 (define-key key-translation-map (kbd (format "M-[ 1 ; %d Q" x)) (kbd (format "%s<f2>" tkey)))
2772 (define-key key-translation-map (kbd (format "M-[ 1 ; %d R" x)) (kbd (format "%s<f3>" tkey)))
2774 (define-key key-translation-map (kbd (format "M-[ 1 ; %d S" x)) (kbd (format "%s<f4>" tkey)))
2776 (define-key key-translation-map (kbd (format "M-[ 15 ; %d ~" x)) (kbd (format "%s<f5>" tkey)))
2778 (define-key key-translation-map (kbd (format "M-[ 17 ; %d ~" x)) (kbd (format "%s<f6>" tkey)))
2780 (define-key key-translation-map (kbd (format "M-[ 18 ; %d ~" x)) (kbd (format "%s<f7>" tkey)))
2782 (define-key key-translation-map (kbd (format "M-[ 19 ; %d ~" x)) (kbd (format "%s<f8>" tkey)))
2784 (define-key key-translation-map (kbd (format "M-[ 20 ; %d ~" x)) (kbd (format "%s<f9>" tkey)))
2786 (define-key key-translation-map (kbd (format "M-[ 21 ; %d ~" x)) (kbd (format "%s<f10>" tkey)))
2788 (define-key key-translation-map (kbd (format "M-[ 23 ; %d ~" x)) (kbd (format "%s<f11>" tkey)))
2790 (define-key key-translation-map (kbd (format "M-[ 24 ; %d ~" x)) (kbd (format "%s<f12>" tkey)))
2792 (define-key key-translation-map (kbd (format "M-[ 25 ; %d ~" x)) (kbd (format "%s<f13>" tkey)))
2794 (define-key key-translation-map (kbd (format "M-[ 26 ; %d ~" x)) (kbd (format "%s<f14>" tkey)))
2796 (define-key key-translation-map (kbd (format "M-[ 28 ; %d ~" x)) (kbd (format "%s<f15>" tkey)))
2798 (define-key key-translation-map (kbd (format "M-[ 29 ; %d ~" x)) (kbd (format "%s<f16>" tkey)))
2800 (define-key key-translation-map (kbd (format "M-[ 31 ; %d ~" x)) (kbd (format "%s<f17>" tkey)))
2802 (define-key key-translation-map (kbd (format "M-[ 32 ; %d ~" x)) (kbd (format "%s<f18>" tkey)))
2804 (define-key key-translation-map (kbd (format "M-[ 33 ; %d ~" x)) (kbd (format "%s<f19>" tkey)))
2806 (define-key key-translation-map (kbd (format "M-[ 34 ; %d ~" x)) (kbd (format "%s<f20>" tkey)))
2813 ; (add-hook 'tty-setup-hook 'fix-up-tmux-keys)
2815 (defadvice ask-user-about-supersession-threat (around ask-user-about-supersession-threat-if-necessary)
2816 "Call ask-user-about-supersession-threat only if the buffer is actually obsolete."
2817 (if (or (buffer-modified-p)
2818 (verify-visited-file-modtime)
2819 (< (* 8 1024 1024) (buffer-size))
2820 (/= 0 (call-process-region 1 (+ 1 (buffer-size)) "diff" nil nil nil "-q" (buffer-file-name) "-")))
2822 (clear-visited-file-modtime)
2824 (ad-activate 'ask-user-about-supersession-threat)
2828 #+BEGIN_SRC emacs-lisp
2832 (or (getenv "EMACS_SERVER_NAME")
2834 (unless (server-running-p)
2835 ; (global-set-key "\C-xp" 'server-edit)
2842 #+BEGIN_SRC emacs-lisp
2843 (provide 'don-configuration)