X-Git-Url: https://git.donarmstrong.com/?p=lib.git;a=blobdiff_plain;f=emacs_el%2Fconfiguration%2Fdon-configuration.org;h=c4bdfb9ff5af6eedb0820ca52a88b1aa6565fdf4;hp=c34b6549b555574bd949c8ab4d560acfacd72a22;hb=2831aa0332dab9a81448171e931a20aaf7015309;hpb=2b8ab15530bd216bd52e2ceb54fc46fff775227d diff --git a/emacs_el/configuration/don-configuration.org b/emacs_el/configuration/don-configuration.org index c34b654..c4bdfb9 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 @@ -35,6 +38,11 @@ :ensure paradox ) #+END_SRC +* Disable custom-vars +#+BEGIN_SRC emacs-lisp + ;; Set the custom file to /dev/null and don't bother to load it + (setq custom-file "/dev/null") +#+END_SRC * Misc functions ** with-library #+BEGIN_SRC emacs-lisp @@ -239,16 +247,39 @@ value, scrolling continues until there is no more output. ** Jumping *** Avy #+BEGIN_SRC emacs-lisp -(use-package avy - :ensure t - :bind ("C-c C-SPC" . avy-goto-word-1) - :config (progn - (setq avy-background t) - (key-chord-define-global "jj" #'avy-goto-word-1))) + (use-package avy + :ensure t + :bind (("C-c C-" . avy-goto-word-or-subword-1) + ("C-c j j" . avy-goto-word-or-subword-1) + ("M-g g" . avy-goto-line)) + :config (progn (setq avy-background t)) + ) +#+END_SRC +*** Ace-link (jumping to links) +#+BEGIN_SRC emacs-lisp + (use-package ace-link + :ensure t + ; bind o in most modes + :config (ace-link-setup-default)) +#+END_SRC +*** Jumping through edit points (goto-chg) +#+BEGIN_SRC emacs-lisp + (use-package goto-chg + :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 + (use-package bm + :ensure t + :bind (("C-c j b ." . bm-next) + ("C-c j b ," . bm-previous) + ("C-c j b SPC" . bm-toggle))) #+END_SRC ** Snippets - *** Yasnippet #+BEGIN_SRC emacs-lisp (use-package yasnippet @@ -260,33 +291,21 @@ value, scrolling continues until there is no more output. (define-key yas-minor-mode-map (kbd "") nil) (define-key yas-minor-mode-map (kbd "TAB") nil) (define-key yas-minor-mode-map (kbd "") 'yas-expand) - )) + (setq yas-snippet-dirs '("~/lib/emacs_el/snippets/" + "~/lib/emacs_el/yasnippet-snippets/snippets/")) + (add-to-list 'hippie-expand-try-functions-list + 'yas-hippie-try-expand) + ) + ) #+END_SRC - -** Helm Flx - -[[https://github.com/PythonNut/helm-flx][helm-flx]] implements intelligent helm fuzzy sorting, provided by [[https://github.com/lewang/flx][flx]]. - +*** Auto-YASnippet #+BEGIN_SRC emacs-lisp -(use-package helm-flx - :ensure t - :config (progn - ;; these are helm configs, but they kind of fit here nicely - (setq helm-M-x-fuzzy-match t - helm-bookmark-show-location t - helm-buffers-fuzzy-matching t - helm-completion-in-region-fuzzy-match t - helm-file-cache-fuzzy-match t - helm-imenu-fuzzy-match t - helm-mode-fuzzy-match t - helm-locate-fuzzy-match nil - helm-quick-update t - helm-recentf-fuzzy-match nil - helm-semantic-fuzzy-match t) - (helm-flx-mode +1))) + (use-package auto-yasnippet + :bind (("H-w" . aya-create) + ("H-y" . aya-expand) + ) + ) #+END_SRC - - ** Tinyprocmail #+BEGIN_SRC emacs-lisp @@ -329,27 +348,30 @@ value, scrolling continues until there is no more output. ** Perl #+BEGIN_SRC emacs-lisp - (require 'cperl-mode) - ;; Use c-mode for perl .xs files - (add-to-list 'auto-mode-alist '("\\.xs\\'" . c-mode)) - (add-to-list 'auto-mode-alist '("\\.\\([pP][Llm]\\|al\\)\\'" . cperl-mode)) - (add-to-list 'interpreter-mode-alist '("perl" . cperl-mode)) - (add-to-list 'interpreter-mode-alist '("perl5" . cperl-mode)) - (add-to-list 'interpreter-mode-alist '("miniperl" . cperl-mode)) - (setq cperl-hairy t - cperl-indent-level 4 - cperl-auto-newline nil - cperl-auto-newline-after-colon nil - cperl-continued-statement-offset 4 - cperl-brace-offset -1 - cperl-continued-brace-offset 0 - cperl-label-offset -4 - cperl-highlight-variables-indiscriminately t - cperl-electric-lbrace-space nil - cperl-indent-parens-as-block nil - cperl-close-paren-offset -1 - cperl-tab-always-indent t) - ;(add-hook 'cperl-mode-hook (lambda () (cperl-set-style "PerlStyle"))) + (use-package cperl-mode + :config + (progn + ;; Use c-mode for perl .xs files + (add-to-list 'auto-mode-alist '("\\.xs\\'" . c-mode)) + (add-to-list 'auto-mode-alist '("\\.\\([pP][Llm]\\|al\\)\\'" . cperl-mode)) + (add-to-list 'interpreter-mode-alist '("perl" . cperl-mode)) + (add-to-list 'interpreter-mode-alist '("perl5" . cperl-mode)) + (add-to-list 'interpreter-mode-alist '("miniperl" . cperl-mode)) + (setq cperl-hairy t + cperl-indent-level 4 + cperl-auto-newline nil + cperl-auto-newline-after-colon nil + cperl-continued-statement-offset 4 + cperl-brace-offset -1 + cperl-continued-brace-offset 0 + cperl-label-offset -4 + cperl-highlight-variables-indiscriminately t + cperl-electric-lbrace-space nil + cperl-indent-parens-as-block nil + cperl-close-paren-offset -1 + cperl-tab-always-indent t) + ;;(add-hook 'cperl-mode-hook (lambda () (cperl-set-style "PerlStyle"))) + )) #+END_SRC ** Helm @@ -369,6 +391,119 @@ value, scrolling continues until there is no more output. (add-hook 'kill-emacs-hook #'(lambda () (and (file-exists-p "$TMP") (delete-file "$TMP")))) ) #+END_SRC +*** Helm Flx + + [[https://github.com/PythonNut/helm-flx][helm-flx]] implements intelligent helm fuzzy sorting, provided by [[https://github.com/lewang/flx][flx]]. + + #+BEGIN_SRC emacs-lisp + (use-package helm-flx + :ensure t + :config (progn + ;; these are helm configs, but they kind of fit here nicely + (setq helm-M-x-fuzzy-match t + helm-bookmark-show-location t + helm-buffers-fuzzy-matching t + helm-completion-in-region-fuzzy-match t + helm-file-cache-fuzzy-match t + helm-imenu-fuzzy-match t + helm-mode-fuzzy-match t + helm-locate-fuzzy-match nil + helm-quick-update t + helm-recentf-fuzzy-match nil + helm-semantic-fuzzy-match t) + (helm-flx-mode +1))) + #+END_SRC +*** Helm Swoop +#+BEGIN_SRC emacs-lisp + + ;;; stolen from https://github.com/malb/emacs.d/blob/master/malb.org + (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 + mu4e-headers-mode org-mode markdown-mode latex-mode + ein:notebook-multilang-mode)) + + (defun malb/swoop-or-search () + (interactive) + (if (or (> (buffer-size) 1048576) ;; helm-swoop can be slow on big buffers + (memq major-mode malb/helm-swoop-ignore-major-mode)) + (isearch-forward) + (helm-swoop))) + + (use-package helm-swoop + :ensure t + :bind (("C-c o" . helm-multi-swoop-org) + ("C-s" . malb/swoop-or-search) + ("C-M-s" . helm-multi-swoop-all)) + :config (progn + + (setq helm-swoop-pre-input-function #'malb/helm-swoop-pre-fill + helm-swoop-split-with-multiple-windows nil + helm-swoop-split-direction #'split-window-horizontally + helm-swoop-split-window-function 'helm-default-display-buffer + helm-swoop-speed-or-color t) + + ;; https://emacs.stackexchange.com/questions/28790/helm-swoop-how-to-make-it-behave-more-like-isearch + (defun malb/helm-swoop-C-s () + (interactive) + (if (boundp 'helm-swoop-pattern) + (if (equal helm-swoop-pattern "") + (previous-history-element 1) + (helm-next-line)) + (helm-next-line))) + + (bind-key "C-S-s" #'helm-swoop-from-isearch isearch-mode-map) + (bind-key "C-S-s" #'helm-multi-swoop-all-from-helm-swoop helm-swoop-map) + (bind-key "C-r" #'helm-previous-line helm-swoop-map) + (bind-key "C-s" #'malb/helm-swoop-C-s helm-swoop-map) + (bind-key "C-r" #'helm-previous-line helm-multi-swoop-map) + (bind-key "C-s" #'malb/helm-swoop-C-s helm-multi-swoop-map)) + ) + +#+END_SRC +*** Helm Ag +#+BEGIN_SRC emacs-lisp +(use-package helm-ag + :ensure t + :config (setq helm-ag-base-command "ag --nocolor --nogroup" + helm-ag-command-option "--all-text" + helm-ag-insert-at-point 'symbol + helm-ag-fuzzy-match t + helm-ag-use-temp-buffer t + helm-ag-use-grep-ignore-list t + helm-ag-use-agignore t)) +#+END_SRC +*** Helm Descbinds +#+BEGIN_SRC emacs-lisp + (use-package helm-descbinds + :ensure t + :bind ("C-h b" . helm-descbinds) + :init (fset 'describe-bindings 'helm-descbinds)) +#+END_SRC + +*** Helm YaSnippet +#+BEGIN_SRC emacs-lisp + (use-package helm-c-yasnippet + :ensure t + :bind ("C-c h y" . helm-yas-complete) + :config (progn + (setq helm-yas-space-match-any-greedy t))) +#+END_SRC +*** Helm Org Rifle +#+BEGIN_SRC emacs-lisp + (use-package helm-org-rifle + :ensure t + :config (progn + (defun malb/helm-org-rifle-agenda-files (arg) + (interactive "p") + (let ((current-prefix-arg nil)) + (cond + ((equal arg 4) (call-interactively #'helm-org-rifle-agenda-files nil)) + ((equal arg 16) (helm-org-rifle-occur-agenda-files)) + (t (helm-org-agenda-files-headings))))))) +#+END_SRC + ** Hydra #+BEGIN_SRC emacs-lisp :tangle don-configuration.el (require 'don-hydra) @@ -393,6 +528,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 @@ -494,33 +640,46 @@ 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 -#+BEGIN_SRC emacs-lisp - (require 'org-mode-configuration) -#+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 :ensure t - :config (require 'ess_configuration)) + :config + (defun ess-change-directory (path) + "Set the current working directory to PATH for both *R* and Emacs." + (interactive "DDirectory to change to: ") + + (when (file-exists-p path) + (ess-command (concat "setwd(\"" path "\")\n")) + ;; use file-name-as-directory to ensure it has trailing / + (setq default-directory (file-name-as-directory path)))) + (add-hook 'ess-mode-hook 'flyspell-prog-mode) + ;; outlining support for ess modes + (add-hook + 'ess-mode-hook + '(lambda () + (outline-minor-mode) + (setq outline-regexp "\\(^#\\{4,5\\} \\)\\|\\(^[a-zA-Z0-9_\.]+ ?<- ?function\\)") + (defun outline-level () + (cond ((looking-at "^##### ") 1) + ((looking-at "^#### ") 2) + ((looking-at "^[a-zA-Z0-9_\.]+ ?<- ?function(.*{") 3) + (t 1000))) + )) + (add-hook 'ess-mode-hook + '(lambda () + (local-set-key (kbd "C-c C-R") + 'dla/ess-region-remote-eval))) + + ;; Don't restore history or save workspace image + '(inferior-R-args "--no-restore-history --no-save") + ) #+END_SRC ** Rainbowmode @@ -555,15 +714,122 @@ From http://julien.danjou.info/projects/emacs-packages#rainbow-mode, this colori ** Writeroom Mode #+BEGIN_SRC emacs-lisp (use-package writeroom-mode - :config (add-hook 'writeroom-mode-hook 'auto-fill-mode) + :config + (defun my/writing-mode () + "Start my writing mode; enable visual-line-mode and auto-fill-mode" + (interactive) + (if writeroom-mode + (progn + (writeroom-mode -1) + (visual-line-mode -1) + (auto-fill-mode -1) + (visual-fill-column-mode -1) + ) + (visual-line-mode 1) + (auto-fill-mode 1) + (visual-fill-column-mode 1) + (writeroom-mode 1)) + ) ) #+END_SRC ** 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 +** Multiple Cursors + :PROPERTIES: + :ID: 6fcf218b-a762-4c37-9339-a8202ddeb544 + :END: +[[https://github.com/magnars/multiple-cursors.el][Multiple Cursors]] +#+BEGIN_SRC emacs-lisp + (use-package multiple-cursors + :bind (("C-;" . mc/mark-all-dwim) + ("C-<" . mc/mark-previous-like-this) + ("C->" . mc/mark-next-like-this) + ("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 + + :mode "muttng-[a-z0-9]+-[0-9]+-" + :mode "mutt-[a-z0-9]+-[0-9]+-" + :hook 'my-message-mode-settings + :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)))) + (local-set-key (kbd "C-c C-a") 'my-post-attach-file) + ) + + (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 "> ") + ) +#+END_SRC +*** Muttrc mode +#+BEGIN_SRC emacs-lisp + (use-package muttrc-mode + :mode "muttngrc" + :mode "muttrc" + ) + +#+END_SRC * Org Mode ** Use-package and load things #+BEGIN_SRC emacs-lisp @@ -713,7 +979,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 @@ -978,11 +1244,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]]") @@ -1060,7 +1326,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 @@ -1262,6 +1528,21 @@ From http://julien.danjou.info/projects/emacs-packages#rainbow-mode, this colori (when (member (org-get-todo-state) org-todo-keywords-1) (setq has-subtask t)))) (and is-a-task (not has-subtask))))) + (defun bh/is-project-p () + "Any task with a todo keyword subtask" + (save-restriction + (widen) + (let ((has-subtask) + (subtree-end (save-excursion (org-end-of-subtree t))) + (is-a-task (member (nth 2 (org-heading-components)) org-todo-keywords-1))) + (save-excursion + (forward-line 1) + (while (and (not has-subtask) + (< (point) subtree-end) + (re-search-forward "^\*+ " subtree-end t)) + (when (member (org-get-todo-state) org-todo-keywords-1) + (setq has-subtask t)))) + (and is-a-task has-subtask)))) (defun bh/is-subproject-p () "Any task which is a subtask of another project" @@ -1462,6 +1743,21 @@ From http://julien.danjou.info/projects/emacs-packages#rainbow-mode, this colori (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 ** End use-package #+BEGIN_SRC emacs-lisp ) @@ -1474,8 +1770,8 @@ From http://julien.danjou.info/projects/emacs-packages#rainbow-mode, this colori (defvar my-keys-minor-mode-map (make-keymap) "my-keys-minor-mode keymap.") - ; use iedit everywhere - (define-key my-keys-minor-mode-map (kbd "C-;") 'iedit-mode) + ; use mc everywhere + (define-key my-keys-minor-mode-map (kbd "C-;") 'mc/mark-all-dwim) ;; use outline mode keybindings everywhere ;; (define-key my-keys-minor-mode-map (kbd "C-;") 'my/mydra-outline/body) @@ -1496,10 +1792,13 @@ From http://julien.danjou.info/projects/emacs-packages#rainbow-mode, this colori (add-to-list 'minor-mode-map-alist mykeys)))) (ad-activate 'load) #+END_SRC - +** Goto line +#+BEGIN_SRC emacs-lisp + (global-unset-key "\M-g") + (global-set-key (kbd "M-g l") 'goto-line) +#+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 case-fold-search t) @@ -1510,9 +1809,6 @@ From http://julien.danjou.info/projects/emacs-packages#rainbow-mode, this colori (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) @@ -1521,10 +1817,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))) @@ -1556,17 +1848,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$" . @@ -1582,54 +1863,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 "> ") - - (global-unset-key "\M-g") - (global-set-key "\M-g" 'goto-line) - ;; self-insert-command hack. ;; Without this, "if" expands to ;; if ( -!-) { @@ -1675,8 +1908,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) @@ -1779,11 +2010,6 @@ From http://julien.danjou.info/projects/emacs-packages#rainbow-mode, this colori ; don't use the multi-window configuration (setq ediff-window-setup-function 'ediff-setup-windows-plain) - ; use iedit - (require 'iedit) - (define-key global-map (kbd "C-;") 'iedit-mode) - (global-set-key (kbd "C-;") 'iedit-mode) - ; fix up css mode to not be silly ; from http://www.stokebloke.com/wordpress/2008/03/21/css-mode-indent-buffer-fix/ (setq cssm-indent-level 4) @@ -1936,7 +2162,7 @@ From http://julien.danjou.info/projects/emacs-packages#rainbow-mode, this colori (defvar my-keys-minor-mode-map (make-keymap) "my-keys-minor-mode keymap.") ; use iedit everywhere - (define-key my-keys-minor-mode-map (kbd "C-;") 'iedit-mode) + (define-key my-keys-minor-mode-map (kbd "C-;") 'mc/mark-all-dwim) (define-minor-mode my-keys-minor-mode "A minor mode so that my key settings override annoying major modes." @@ -1958,6 +2184,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)