aboutsummaryrefslogtreecommitdiff
path: root/dot_emacs
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--dot_emacs.d/elpa/private_gnupg/private_pubring.kbxbin0 -> 2413 bytes
-rw-r--r--dot_emacs.d/local/dictem/AUTHORS (renamed from AUTHORS)0
-rw-r--r--dot_emacs.d/local/dictem/COPYING (renamed from COPYING)0
-rw-r--r--dot_emacs.d/local/dictem/NEWS (renamed from NEWS)0
-rw-r--r--dot_emacs.d/local/dictem/README558
-rw-r--r--dot_emacs.d/local/dictem/TODO (renamed from TODO)0
-rw-r--r--dot_emacs.d/local/dictem/dictem-elisp.el (renamed from dictem-elisp.el)0
-rw-r--r--dot_emacs.d/local/dictem/dictem-lingvo-dsl.el (renamed from dictem-lingvo-dsl.el)0
-rw-r--r--dot_emacs.d/local/dictem/dictem.el (renamed from dictem.el)0
-rw-r--r--dot_emacs.d/themes/ryanakca-theme.el50
-rw-r--r--dot_emacs.tmpl1020
11 files changed, 1628 insertions, 0 deletions
diff --git a/dot_emacs.d/elpa/private_gnupg/private_pubring.kbx b/dot_emacs.d/elpa/private_gnupg/private_pubring.kbx
new file mode 100644
index 0000000..e5f5b58
--- /dev/null
+++ b/dot_emacs.d/elpa/private_gnupg/private_pubring.kbx
Binary files differ
diff --git a/AUTHORS b/dot_emacs.d/local/dictem/AUTHORS
index b4dd7b6..b4dd7b6 100644
--- a/AUTHORS
+++ b/dot_emacs.d/local/dictem/AUTHORS
diff --git a/COPYING b/dot_emacs.d/local/dictem/COPYING
index bacce4d..bacce4d 100644
--- a/COPYING
+++ b/dot_emacs.d/local/dictem/COPYING
diff --git a/NEWS b/dot_emacs.d/local/dictem/NEWS
index 46f946b..46f946b 100644
--- a/NEWS
+++ b/dot_emacs.d/local/dictem/NEWS
diff --git a/dot_emacs.d/local/dictem/README b/dot_emacs.d/local/dictem/README
new file mode 100644
index 0000000..c1d6e78
--- /dev/null
+++ b/dot_emacs.d/local/dictem/README
@@ -0,0 +1,558 @@
+DictEm is a Dictionary protocol client for GNU Emacs.
+
+It uses a console dict client (http://sf.net/projects/dict) and
+implements all functions of the client part of DICT protocol
+(RFC-2229, www.dict.org), i.e. looking up words and definitions,
+obtaining information about available strategies, provided databases,
+information about DICT server etc.
+
+Unlike dictionary.el
+(http://www.myrkr.in-berlin.de/dictionary/index.html) DictEm widely
+uses autocompletion that is used for selecting dictionary and search
+strategy. Moreover, DictEm provides several hooks which may be used
+for buffer postprocessing. For example, inbuilt hyperlinking and
+highlighting mechanisms are based on this possibility. Another example
+is that information obtained from DICT server that is in HTML, ROFF or
+INFO format can be easily viewed by Emacs+DictEm if the user supplies
+appropriate conversion functions. Of course DictEm can be differently
+configured for different Emacs modes (major, minor or buffer
+oriented), that allows modularized access to all data serviced by DICT
+servers. This makes it ideal tool for translating articles between a
+series of foreign languages, browsing manuals and other tasks
+depending on Emacs mode user currently works with.
+
+Additionally DictEm supports accessing so called virtual dictionaries (a set
+of dictionaries provided by DICT server that user prefers to treat as
+a single one).
+
+Yet another feature DictEm provides is a set of useful functions with
+a help of which user can extend DictEm functionality such as to define
+new search strategies or even provide new functionality such as to use
+another sources of data other than DICT servers.
+
+See below for a set of example configuration and extensions.
+
+Also DictEm uses customization mechanism provided by Emacs that helps
+Emacs users to easily configure DictEm.
+
+COPYING
+============
+
+See the file COPYING
+
+DOWNLOAD
+========
+
+Latest sources can be downloaded from
+http://sourceforge.net/projects/dictem
+or
+http://freshmeat.net/projects/dictem
+
+INSTALLATION
+============
+
+* In order to uncompress dictem tarball run the following.
+
+ tar xfv dictem-x.y.z.tar.gz
+
+ If you read this file, you probably have already done this.
+
+* Change your current directory to dictem.
+
+ cd dictem-x.y.z
+
+* Copy *.el file to the directory you want.
+
+ cp *.el /path/to/emacs/el/files
+
+* Make sure that DICT client named dict
+ (available at http://sf.net/projects/dict)
+ is installed on your system.
+ Console dict client is used by DictEm for accessing the DICT server.
+ dict-1.9.14 or later is strongly recommended.
+ If you'll set dictem-option-mime variable to t (read below),
+ dict-1.10.3 or later MUST be used.
+
+REPORTING BUGS
+==============
+
+ Please send all bug reports and suggestions directly to
+ Aleksey Cheusov <vle@gmx.net>.
+ Reporting bugs at sf.net is also good.
+
+ Also note that there exists dict-beta@dict.org mailing list (low
+ traffic) where you can ask questions about DICT protocol and
+ software.
+
+CONFIGURING
+=============
+
+Customization group
+-------------------
+
+Take note, that DictEm defines customization group "dictem".
+So, it may be easier for you to customize DictEm by running
+M-x customize-group <RET> dictem <RET>
+
+Manual Configuration
+--------------------
+
+Ex.1
+
+The easiest configuration of dictem may look like this
+
+; Add to load-path variable a new directory with files of dictem
+(add-to-list 'load-path "/path/you/installed/dictem/to")
+
+; Loading dictem functions
+(require 'dictem)
+
+; Setting the dictionary server hostname.
+; This part is optional, if dictem-server is nil (the default value)
+; "dict" command line utility will use its ows config file
+; ~/.dictrc or PREFIX/etc/dict.conf.
+; Keeping dictem-server variable unset is recomended because
+; this allows to try _list of_ servers until connection is made,
+; see dict(1) for details.
+;(setq dictem-server "localhost")
+;(setq dictem-server "dict.org")
+
+
+; Setting the dictionary server port.
+; Setting dictem-port is usually not necessary because
+; most DICT servers use the default port 2628.
+;(setq dictem-port "2628")
+
+; Code necessary to obtain database and strategy list from DICT
+; server. As of version 0.90, dictem runs this function from
+; dictem-select-database and dictem-select-strategy if an
+; initialization was not completed or failed previously, that is
+; running dictem-initialize is optional
+(dictem-initialize)
+
+; Assigning hot keys for accessing DICT server
+
+; SEARCH = MATCH + DEFINE
+; Ask for word, database and search strategy
+; and show definitions found
+(global-set-key "\C-cs" 'dictem-run-search)
+
+; MATCH
+; Ask for word, database and search strategy
+; and show matches found
+(global-set-key "\C-cm" 'dictem-run-match)
+
+; DEFINE
+; Ask for word and database name
+; and show definitions found
+(global-set-key "\C-cd" 'dictem-run-define)
+
+; SHOW SERVER
+; Show information about DICT server
+(global-set-key "\C-c\M-r" 'dictem-run-show-server)
+
+; SHOW INFO
+; Show information about the database
+(global-set-key "\C-c\M-i" 'dictem-run-show-info)
+
+; SHOW DB
+; Show a list of databases provided by DICT server
+(global-set-key "\C-c\M-b" 'dictem-run-show-databases)
+
+-------
+Ex.2
+
+There are a few functions that can make dictem look
+a bit nicer and be more functional. They should
+be added to special hooks like the following.
+
+; For creating hyperlinks on database names
+; and found matches.
+; Click on them with mouse-2
+(add-hook 'dictem-postprocess-match-hook
+ 'dictem-postprocess-match)
+
+; For highlighting the separator between the definitions found.
+; This also creates hyperlink on database names.
+(add-hook 'dictem-postprocess-definition-hook
+ 'dictem-postprocess-definition-separator)
+
+; For creating hyperlinks in dictem buffer
+; that contains definitions.
+(add-hook 'dictem-postprocess-definition-hook
+ 'dictem-postprocess-definition-hyperlinks)
+
+; For creating hyperlinks in dictem buffer
+; that contains information about a database.
+(add-hook 'dictem-postprocess-show-info-hook
+ 'dictem-postprocess-definition-hyperlinks)
+
+-------
+Ex.3
+
+If you want to combine some databases in you own "virtual" dictionary,
+create them like this
+
+(setq dictem-user-databases-alist
+ '(("_en-ru" . ("mueller7" "korolew_en-ru"))
+ ("_en-en" . ("foldoc" "gcide" "wn"))
+ ("_ru-ru" . ("beslov" "ushakov" "ozhegov" "brok_and_efr"))
+ ("_unidoc" . ("susv3" "man" "info" "howto" "rfc"))
+ ))
+
+As a result four new special database collections will be created
+and new names will appear when
+dictem-run function will ask you about database name.
+
+-------
+Ex.4
+
+You can even create virtual dictionaries which consist of
+databases from different DICT server.
+The dict url form dict:///religion means 'dict' command line tool
+will be called without -h option, i.e. a list of dictionary servers
+from .dictrc (or dict.conf) will be used.
+
+(setq dictem-user-databases-alist
+ '(("_en-ru" . ("dict://mova.org/mueller7"
+ "dict://dict.org:2628/web1913"))
+ ("_ru-ru" . ("beslov" "dict:///religion"))
+ ))
+
+another example:
+
+(setq dictem-user-databases-alist
+ `(("en-en" . ("dict://dict.org:2628/english"))
+ ("en-ru" . ("dict:///en-ru"
+ "dict://dict.org:2628/eng-rus"
+ ))
+ ))
+
+-------
+Ex.5
+
+If your DICT server provides too many databases and most of which
+are of no interest for you, you can disable them
+and use only those specified in dictem-user-databases-alist variable.
+
+(setq dictem-use-user-databases-only t)
+
+-------
+Ex.6
+
+Of course, you can assign your own key bindings in dictem buffer
+
+(define-key dictem-mode-map [tab] 'dictem-next-link)
+(define-key dictem-mode-map [(backtab)] 'dictem-previous-link)
+
+-------
+Ex.7
+
+You are not limited to the default DICT server only.
+The following code will allow you to access any server you want.
+You'll be asked for host and port.
+
+; DEFINE
+(global-set-key
+ "\C-c\M-d"
+ '(lambda ()
+ (interactive)
+ (save-dictem
+ (let* ((dictem-server (read-string "server: "
+ dictem-server nil "dict.org"))
+ (dictem-port (read-string "port: "
+ (dictem-get-port) nil "2628")))
+ (dictem-initialize)
+ (call-interactively 'dictem-run-define)))))
+
+; MATCH
+(global-set-key
+ "\C-c\M-m"
+ '(lambda ()
+ (interactive)
+ (save-dictem
+ (let* ((dictem-server (read-string "server: "
+ dictem-server nil "dict.org"))
+ (dictem-port (read-string "port: "
+ (dictem-get-port) nil "2628")))
+ (dictem-initialize)
+ (call-interactively 'dictem-run-match)))))
+
+; SEARCH = MATCH+DEFINE
+(global-set-key
+ "\C-c\M-s"
+ '(lambda ()
+ (interactive)
+ (save-dictem
+ (let* ((dictem-server (read-string "server: "
+ dictem-server nil "dict.org"))
+ (dictem-port (read-string "port: "
+ (dictem-get-port) nil "2628")))
+ (dictem-initialize)
+ (call-interactively 'dictem-run-search)))))
+
+; SHOW INFO
+(global-set-key
+ "\C-c\M-i"
+ '(lambda ()
+ (interactive)
+ (save-dictem
+ (let* ((dictem-server (read-string "server: "
+ dictem-server nil "dict.org"))
+ (dictem-port (read-string "port: "
+ (dictem-get-port) nil "2628")))
+ (dictem-initialize)
+ (call-interactively 'dictem-run-show-info)))))
+
+; SHOW SERVER
+(global-set-key
+ "\C-c\M-r"
+ '(lambda ()
+ (interactive)
+ (save-dictem
+ (let* ((dictem-server (read-string "server: "
+ dictem-server nil "dict.org"))
+ (dictem-port (read-string "port: "
+ (dictem-get-port) nil "2628")))
+ (dictem-initialize)
+ (call-interactively 'dictem-run-show-server)))))
+
+-------
+Ex.8
+
+Some databases may have specially formatted definitions,
+for example, HTML, MIME, DICF or ROFF formats.
+It is easy to postprocess them.
+
+; All functions from dictem-postprocess-each-definition-hook
+; will be run for each definition which in turn will be narrowed.
+; Current database name is kept in dictem-current-dbname variable.
+; The following code demonstrates how to highlight SUSV3 and ROFF
+; definitions.
+(add-hook 'dictem-postprocess-definition-hook
+ 'dictem-postprocess-each-definition)
+
+; Function for highlighting definition from the database "susv3".
+(defun dictem-highlight-susv3-definition ()
+ (cond ((string= "susv3" dictem-current-dbname)
+ (goto-char (point-min))
+ (while (search-forward-regexp
+ "^ *[QWERTYUIOPASDFGHJKLZXCVBNM ]+$" nil t)
+ (put-text-property
+ (match-beginning 0) (match-end 0) 'face 'bold)
+ ))))
+
+; Function to show roff-formatted text from the database "man".
+(require 'woman)
+(defun dictem-highlight-man-definition ()
+ (cond ((string= "man" dictem-current-dbname)
+ (goto-char (point-min))
+ (while (search-forward-regexp "^ " nil t)
+ (replace-match ""))
+ (goto-char (point-min))
+ (forward-line 2)
+ (woman-decode-region (point) (point-max))
+ )))
+
+(add-hook 'dictem-postprocess-each-definition-hook
+ 'dictem-highlight-susv3-definition)
+(add-hook 'dictem-postprocess-each-definition-hook
+ 'dictem-highlight-man-definition)
+
+-------
+Ex.9
+
+; The dictem's top level function is 'dictem-run'.
+; By using it more advanced ELISP programmers
+; can create their own search scenaria. Look at this code.
+
+(dictem-run
+ 'dictem-base-search
+ "gcide" "apple" "lev")
+
+(dictem-run
+ 'dictem-base-match
+ "dict://mova.org/mueller7" "apple" "exact")
+
+(dictem-run
+ 'dictem-base-define
+ '("dict://mova.org/mueller7" "dict://dict.org/gcide")
+ "apple" "exact")
+
+(dictem-run 'dictem-base-show-info "dict://dict.org/gcide")
+
+(let ((dictem-server "localhost"))
+ (dictem-run
+ '(lambda (a b c)
+ (dictem-base-show-strategies nil nil nil)
+ (dictem-base-show-databases nil nil nil)
+ (dictem-base-show-server nil nil nil)
+ )))
+
+(dictem-run
+ '(lambda (a b c)
+ (dictem-base-define
+ '("man" "susv3")
+ (dictem-read-query (thing-at-point 'word))
+ nil ))
+ nil nil)
+
+(let ((query (dictem-read-query (thing-at-point 'word))))
+ (dictem-run
+ `((lambda (a b c)
+ (dictem-base-match
+ '("gcide" "wn")
+ ,query "exact"))
+ (lambda (a b c)
+ (dictem-base-search
+ '("mueller7" "korolew_en-ru")
+ ,query "word")))))
+
+-------
+Ex.10
+
+By default dictem remembers the database name and strategy that
+was used last time.
+The dictem-select-database and dictem-select-strategy functions
+will use these values as a default in the minibuffer.
+If you dislike this behaviour, set variables
+dictem-default-database and/or dictem-default-strategy.
+
+(add-hook 'c-mode-common-hook
+ '(lambda ()
+ (interactive)
+ (make-local-variable 'dictem-default-database)
+ (setq dictem-default-database "man")
+ ))
+
+The example above sets default database to "man"
+in C buffers.
+
+-------
+Ex.11
+
+As of dictem-0.0.4 dictem-empty-initial-input customizable variable
+tells dictem-read-query whether to leave initial input empty or not.
+It is `nil' by default.
+For emulating behaviour of older releases, set it to `t'.
+
+(setq dictem-empty-initial-input t)
+
+-------
+Ex. 12
+
+By default dictem-postprocess-definition-hyperlinks function
+assumes that hyperlinks have the following form: {foo} or {foo|bar}.
+Sometimes "{" and "}" characters are general characters
+in definitions. The following code changes "{" and "}" for
+"{link-beg " and " link-end" respectively
+inside definitions obtained from the databases "^infopage-..."
+
+; new function is used for creating hyperlinks
+; which works differently depending on database name
+(defun my-dictem-postprocess-definition-hyperlinks ()
+ "Creating hyperlinks according to database name"
+ (interactive)
+ (cond (
+ ((string-match "^infopage-" dictem-current-dbname)
+ (let ((dictem-hyperlink-beginning "{link-beg ")
+ (dictem-hyperlink-end " link-end}")
+ )
+ (dictem-postprocess-definition-hyperlinks)))
+ (t (dictem-postprocess-definition-hyperlinks)))))
+
+; definitions from each database are processed separately
+(add-hook 'dictem-postprocess-definition-hook
+ 'dictem-postprocess-each-definition)
+(add-hook 'dictem-postprocess-each-definition-hook
+ 'my-dictem-postprocess-definition-hyperlinks)
+
+-------
+Ex. 13
+
+You may want to remove "XXX definition[s] found" header
+from the DEFINE buffers.
+It may be done with a help of
+dictem-postprocess-definition-remove-header function.
+
+(add-hook 'dictem-postprocess-definition-hook
+ 'dictem-postprocess-definition-remove-header)
+
+-------
+Ex. 14
+
+As of version 0.7 dictem can handle dictionaries defined by user.
+This allows to use dictem not only for accessing DICT servers,
+but also for accesing users' databases.
+
+; DEFINE function for the database "mysuperdb"
+(defun dictem-mysuperdb-DEFINE (query)
+ (cond
+ ((string= query "apple") '("Apples grow on the trees"
+ "Apple may be green, yellow or red"))
+ ((string= query "potato") '("Potato is a vegetable"
+ "Potato is a traditional Belarusian food"))
+ (t (dictem-make-error
+ 20 (format "No definitions for %s" query)))
+ ))
+
+; MATCH function for the database "mysuperdb"
+(defun dictem-mysuperdb-MATCH (query strategy)
+ ; the name of strategy is ignored
+ (let ((apple (string-match query "apple"))
+ (potato (string-match query "potato")))
+ (cond
+ ((and (string= strategy "exact") (string= query "apple"))
+ '("apple"))
+ ((and (string= strategy "exact") (string= query "potato"))
+ '("potato"))
+ ((and apple potato)
+ '("apple" "potato"))
+ (apple
+ '("apple"))
+ (potato
+ '("potato"))
+ (t (dictem-make-error
+ 20 (format "No matches for %s/%s" query strategy)))
+ )))
+
+; Initializing a list of user-defined databases
+(setq dictem-user-databases-alist
+ `(("_en-en" . ("foldoc" "gcide" "wn"))
+ ("_ru-ru" . ("beslov" "ushakov" "ozhegov" "brok_and_efr"))
+ ,(dictem-make-userdb
+ ; the name of the database
+ "mysuperdb"
+ ; short description
+ "My super database"
+ ; MATCH function
+ (symbol-function 'dictem-mysuperdb-MATCH)
+ ; DEFINE function
+ (symbol-function 'dictem-mysuperdb-DEFINE))
+ ))
+
+-------
+Ex. 15
+
+Last years many dictionary servers provide too many bilingual dictionaries,
+most of which may be not very interesting for you.
+DictEm allows to exclude such dictionaries from an autocompletion menu
+by setting a list of regular expressions in dictem-exclude-databases
+variable.
+If, for example, you don't speak french and german and use
+dict://dict.org server, your config may look like this
+
+(setq dictem-server "dict.org")
+(setq dictem-exclude-databases '("ger-" "-ger" "fra-" "-fra"))
+(dictem-initialize)
+
+Note that, (dictem-initialize) is placed after initializing
+dictem-exclude-databases variable.
+
+-------
+If you have read to this point and all the examples above seem easy,
+you are probably a ELISP Guru.
+So, I have nothing more to tell you ;-)
+Feel free to inspect the code, and I hope you'll find DictEm useful.
+
+Dict'em All! ;-)
diff --git a/TODO b/dot_emacs.d/local/dictem/TODO
index 38b7ccf..38b7ccf 100644
--- a/TODO
+++ b/dot_emacs.d/local/dictem/TODO
diff --git a/dictem-elisp.el b/dot_emacs.d/local/dictem/dictem-elisp.el
index 7ee6cbc..7ee6cbc 100644
--- a/dictem-elisp.el
+++ b/dot_emacs.d/local/dictem/dictem-elisp.el
diff --git a/dictem-lingvo-dsl.el b/dot_emacs.d/local/dictem/dictem-lingvo-dsl.el
index 35f92d5..35f92d5 100644
--- a/dictem-lingvo-dsl.el
+++ b/dot_emacs.d/local/dictem/dictem-lingvo-dsl.el
diff --git a/dictem.el b/dot_emacs.d/local/dictem/dictem.el
index 8602ca3..8602ca3 100644
--- a/dictem.el
+++ b/dot_emacs.d/local/dictem/dictem.el
diff --git a/dot_emacs.d/themes/ryanakca-theme.el b/dot_emacs.d/themes/ryanakca-theme.el
new file mode 100644
index 0000000..52f9616
--- /dev/null
+++ b/dot_emacs.d/themes/ryanakca-theme.el
@@ -0,0 +1,50 @@
+(deftheme ryanakca
+ "Created 2013-03-01.")
+
+(custom-theme-set-faces
+ 'ryanakca
+ '(default ((t (:inherit nil :stipple nil :background "#080808" :foreground "#eeeeee" :inverse-video nil :box nil :strike-through nil :overline nil :underline nil :slant normal :weight normal :height 83 :width normal :foundry "unknown" :family "Inconsolata"))))
+ '(cursor ((t (:background "green" :foreground "black"))))
+ '(fixed-pitch ((t (:family "courier"))))
+ '(variable-pitch ((t (:family "helv"))))
+ '(escape-glyph ((t (:foreground "purple2"))))
+ '(minibuffer-prompt ((t (:foreground "chartreuse" :weight bold))))
+ '(highlight ((t (:underline t :foreground "#ffffff" :background "DodgerBlue4"))))
+ '(region ((t (:foreground "#f6f3e8" :background "#103050"))))
+ '(shadow ((((class color grayscale) (min-colors 88) (background light)) (:foreground "grey50")) (((class color grayscale) (min-colors 88) (background dark)) (:foreground "grey70")) (((class color) (min-colors 8) (background light)) (:foreground "green")) (((class color) (min-colors 8) (background dark)) (:foreground "yellow"))))
+ '(secondary-selection ((t (:foreground "#f6f3e8" :background "#333366"))))
+ '(trailing-whitespace ((t (:background "#a40000"))))
+ '(font-lock-builtin-face ((t (:foreground "LightCoral"))))
+ '(font-lock-comment-delimiter-face ((t (:foreground "#DC45DC" :inherit font-lock-comment-face))))
+ '(font-lock-comment-face ((t (:foreground "#DC45DC" :slant oblique))))
+ '(font-lock-constant-face ((t (:foreground "orchid" :weight bold))))
+ '(font-lock-doc-face ((t (:slant oblique :foreground "moccasin" :inherit (font-lock-string-face)))))
+ '(font-lock-function-name-face ((t (:foreground "deep sky blue" :weight bold :height 1.1))))
+ '(font-lock-keyword-face ((t (:foreground "yellow" :weight bold))))
+ '(font-lock-negation-char-face ((t nil)))
+ '(font-lock-preprocessor-face ((t (:slant italic :foreground "gold" :inherit (font-lock-builtin-face)))))
+ '(font-lock-regexp-grouping-backslash ((t (:weight bold :inherit (bold)))))
+ '(font-lock-regexp-grouping-construct ((t (:weight bold :inherit (bold)))))
+ '(font-lock-string-face ((t (:foreground "burlywood"))))
+ '(font-lock-type-face ((t (:weight bold :foreground "CadetBlue1"))))
+ '(font-lock-variable-name-face ((t (:weight bold :foreground "SeaGreen2"))))
+ '(font-lock-warning-face ((t (:inherit error :foreground "red" :weight bold))))
+ '(button ((t (:weight bold :underline t :box (:line-width 2 :color "grey" :style released-button) :foreground "#f6f3e8" :background "#333333" :inherit (link)))))
+ '(link ((t (:foreground "#afffff" :underline t))))
+ '(link-visited ((t (:underline t :foreground "#afd7ff" :inherit link))))
+ '(fringe ((t (:foreground "Wheat" :background "black"))))
+ '(header-line ((t (:height 0.9 :box (:line-width -1 :color "grey20" :style released-button) :inverse-video t :foreground "#e7f6da" :background "#303030" :inherit (mode-line)))))
+ '(tooltip ((t (:family "helv" :foreground "black" :background "lightyellow" :inherit (variable-pitch)))))
+ '(mode-line ((t (:family "DejaVu Sans" :height 0.9 :box (:line-width 1 :color nil :style released-button) :foreground "black" :background "gray75"))))
+ '(mode-line-buffer-id ((t (:height 0.9 :weight bold :underline "red" :overline "red" :foreground "blue4"))))
+ '(mode-line-emphasis ((t (:weight bold))))
+ '(mode-line-highlight ((t (:box (:line-width 2 :color "grey40" :style released-button)))))
+ '(mode-line-inactive ((t (:height 0.9 :weight light :box (:line-width 1 :color "gray40" :style nil) :foreground "black" :background "gray40" :inherit (mode-line)))))
+ '(isearch ((t (:background "#d7afff" :foreground "#5f0000"))))
+ '(isearch-fail ((((class color) (min-colors 88) (background light)) (:background "RosyBrown1")) (((class color) (min-colors 88) (background dark)) (:background "red4")) (((class color) (min-colors 16)) (:background "red")) (((class color) (min-colors 8)) (:background "red")) (((class color grayscale)) (:foreground "grey")) (t (:inverse-video t))))
+ '(lazy-highlight ((t (:foreground "white" :background "cadetblue"))))
+ '(match ((t (:background "DeepPink4"))))
+ '(next-error ((t (:background "blue3" :inherit (region)))))
+ '(query-replace ((t (:foreground "brown4" :background "palevioletred2" :inherit (isearch))))))
+
+(provide-theme 'ryanakca)
diff --git a/dot_emacs.tmpl b/dot_emacs.tmpl
new file mode 100644
index 0000000..8fc67a1
--- /dev/null
+++ b/dot_emacs.tmpl
@@ -0,0 +1,1020 @@
+;; (setq debug-on-error t)
+
+(require 'package)
+(setq package-enable-at-startup nil)
+(add-to-list 'package-archives '("melpa" . "http://melpa.org/packages/"))
+(package-initialize)
+
+;; Bootstrap `use-package'
+(unless (package-installed-p 'use-package)
+ (package-refresh-contents)
+ (package-install 'use-package))
+
+(eval-when-compile
+ (require 'use-package))
+
+;;; General emacs configuration
+(use-package emacs
+ :init ; executed before package is loaded
+ (fset 'yes-or-no-p 'y-or-n-p)
+ (put 'narrow-to-region 'disabled nil)
+ :hook ; add functions onto hook; only basename needed
+ ((text-mode . turn-on-auto-fill)
+ (text-mode . flyspell-mode)
+ (before-save . whitespace-cleanup))
+ :bind ; key bindings
+ (("C-x a r" . align-regexp))
+ :config ; executed after package is loaded
+ (defadvice ; align-regexp should use spaces.
+ align-regexp
+ (around align-regexp-with-spaces activate)
+ (let ((indent-tabs-mode nil)) ad-do-it))
+ :custom
+ (inhibit-startup-screen t)
+ (default-input-method "TeX")
+ (user-full-name "Ryan Kavanagh")
+ (user-mail-address "rak@rak.ac")
+ (face-font-family-alternatives
+ (append '(("Spleen 16x32" "Ubuntu Mono" "FreeMono" "Liberation Mono"))
+ face-font-family-alternatives))
+ :custom-face
+ (default ((t (:family "Spleen 16x32"
+ {{ if (eq .chezmoi.os "openbsd") -}}
+ :height 80 ; unit is 1/10 pt
+ {{- else -}}
+ :height 130 ; unit is 1/10 pt
+ {{- end }}
+ )))))
+
+(if (string= (system-name) "demeter.rak.ac")
+ (use-package leuven-theme ; nice theme for lecturing / projectors
+ :ensure t
+ :config
+ (load-theme 'leuven t))
+ (use-package moe-theme
+ :ensure t
+ :after powerline ; must be loaded after for powerline-moe-theme to work
+ :config
+ (moe-dark)
+ (moe-theme-powerline)))
+
+(defun single-lines-only ()
+ "Replace multiple blank lines with a single one"
+ (interactive)
+ (goto-char (point-min))
+ (while (re-search-forward "\\(^\\s-*$\\)\n" nil t)
+ (replace-match "\n")
+ (forward-char 1)))
+
+(use-package ace-window
+ :ensure t
+ :custom
+ ;; home row keys
+ (aw-keys '(?h ?t ?n ?s ?a ?o ?e ?u ?i ?d))
+ :bind (("M-o" . ace-window))
+ :config
+ ;; need to redefine a few of these because the defaults
+ ;; overlap with customized aw-keys
+ (setq aw-dispatch-alist
+ '((?x aw-delete-window "Delete Window")
+ (?m aw-swap-window "Swap Windows")
+ (?M aw-move-window "Move Window")
+ (?c aw-copy-window "Copy Window")
+ (?j aw-switch-buffer-in-window "Select Buffer")
+ (?f aw-flip-window)
+ (?p aw-switch-buffer-other-window "Switch Buffer Other Window")
+ (?c aw-split-window-fair "Split Fair Window")
+ (?v aw-split-window-vert "Split Vert Window")
+ (?b aw-split-window-horz "Split Horz Window")
+ (?1 delete-other-windows "Delete Other Windows")
+ (?? aw-show-dispatch-help))))
+
+(use-package aggressive-indent
+ :ensure t
+ :config
+ (global-aggressive-indent-mode 1))
+
+(use-package autorevert
+ :diminish auto-revert-mode)
+
+(use-package avy
+ :ensure t
+ :config
+ (avy-setup-default)
+ :bind
+ (("C-c C-j" . avy-resume)
+ ("C-;" . avy-goto-char-2)))
+
+(use-package bibtex
+ :mode ("\\.bib\'" . bibtex-mode)
+ :custom
+ (bibtex-dialect 'biblatex)
+ (bibtex-maintain-sorted-entries 'crossref)
+ ;; Use only the first author name if there are more than 2 authors
+ (bibtex-autokey-names 1)
+ ;; Otherwise use both names
+ (bibtex-autokey-names-stretch 1)
+ (bibtex-autokey-name-separator "_")
+ (bibtex-autokey-name-year-separator "_")
+ (bibtex-autokey-year-length 4)
+ (bibtex-autokey-year-title-separator ":_")
+ (bibtex-autokey-titleword-length 5)
+ (bibtex-autokey-titlewords 3)
+ ;; Make all title words lowercase
+ (bibtex-autokey-preserve-case 1)
+ :bind (:map bibtex-mode-map
+ ("C-c C-c" . org-ref-clean-bibtex-entry)
+ ("C-c s" . bibtex-sort-buffer))
+ :config
+ (defun my/bibtex-generate-autokey (autogenerated)
+ (let ((key (bibtex-autokey-get-field "_key")))
+ (if (string= "" key) autogenerated key)))
+ (advice-add 'bibtex-generate-autokey :filter-return #'my/bibtex-generate-autokey)
+ ;; stolen from bibtex.el and modified to handle "Mac Lane"
+ (defun my/bibtex-autokey-demangle-name (fullname)
+ "Get the last part from a well-formed FULLNAME and perform abbreviations."
+ (let* (case-fold-search
+ (name (cond ((string-match "\\(\\(Ma?c\\|De\\) +[[:upper:]][^, ]*\\)[^,]*," fullname)
+ ;; Name is of the form "Mac Last, First" or
+ ;; "Mac Last, Jr, First" or "Mc Last, First" or
+ ;; "Mc Last, Jr, First"
+ ;; --> Take Mac Last or Mc Last, as appropriate
+ ;; and replace spaces by concatenation
+ (let ((mclast (match-string 1 fullname)))
+ (when (string-match split-string-default-separators mclast)
+ (replace-match "" nil nil mclast))))
+ ((string-match "\\([[:upper:]][^, ]*\\)[^,]*," fullname)
+ ;; Name is of the form "von Last, First" or
+ ;; "von Last, Jr, First"
+ ;; --> Take the first capital part before the comma
+ (match-string 1 fullname))
+ ((string-match "\\([^, ]*\\)," fullname)
+ ;; Strange name: we have a comma, but nothing capital
+ ;; So we accept even lowercase names
+ (match-string 1 fullname))
+ ((string-match "\\(\\<[[:lower:]][^ ]* +\\)+\\([[:upper:]][^ ]*\\)"
+ fullname)
+ ;; name is of the form "First von Last", "von Last",
+ ;; "First von von Last", or "d'Last"
+ ;; --> take the first capital part after the "von" parts
+ (match-string 2 fullname))
+ ((string-match "\\([^ ]+\\) *\\'" fullname)
+ ;; name is of the form "First Middle Last" or "Last"
+ ;; --> take the last token
+ (match-string 1 fullname))
+ (t (error "Name `%s' is incorrectly formed" fullname)))))
+ (funcall bibtex-autokey-name-case-convert-function
+ (bibtex-autokey-abbrev name bibtex-autokey-name-length))))
+ (advice-add 'bibtex-autokey-demangle-name :override 'my/bibtex-autokey-demangle-name)
+ ;; Until https://debbugs.gnu.org/cgi/bugreport.cgi?bug=36252 gets fixed
+ (defun bibtex-autokey-get-year ()
+ "Return year field contents as a string obeying `bibtex-autokey-year-length'.
+If the year field is absent, extract the year from a valid ISO8601-2
+Extended Format date in the date field and return it as a string obeing
+`bibtex-autokey-year-length'."
+ (let ((yearfield (bibtex-autokey-get-field "year"))
+ (datefield (bibtex-autokey-get-field "date"))
+ (shortener (lambda (year)
+ (substring year (max 0 (- (length year)
+ bibtex-autokey-year-length))))))
+ (if (string= "" yearfield)
+ (cond ((string-match "[./]*\\(-?[[:digit:]]+X*\\)\\([-/.[:digit:]:T~?%X]*\\)"
+ datefield)
+ ;; Matches ISO8601-2 Extended Format specification level 1
+ ;; examples listed in tables 3, 4, and 5 on pp. 38-40 of the
+ ;; biblatex package manual, version 3.12
+ (funcall shortener (match-string 1 datefield)))
+ (t (error "Date field `%s' is incorrectly formed" datefield)))
+ (funcall shortener yearfield))))
+ ;; Don't have accented characters in keys
+ (let ((charMap '(;; This list based on Xah Lee's http://ergoemacs.org/emacs/emacs_zap_gremlins.html
+ ;; Case-sensitivity (see bibtex-autokey-name-change-strings) requires us to
+ ;; duplicate everything
+ ("ß" . "ss")
+ ("á\\|à\\|â\\|ä\\|ā\\|ǎ\\|ã\\|å\\|ą\\|ă\\|ạ\\|ả\\|ả\\|ấ\\|ầ\\|ẩ\\|ẫ\\|ậ\\|ắ\\|ằ\\|ẳ\\|ặ" . "a")
+ ("æ" . "ae")
+ ("ç\\|č\\|ć" . "c")
+ ("é\\|è\\|ê\\|ë\\|ē\\|ě\\|ę\\|ẹ\\|ẻ\\|ẽ\\|ế\\|ề\\|ể\\|ễ\\|ệ" . "e")
+ ("í\\|ì\\|î\\|ï\\|ī\\|ǐ\\|ỉ\\|ị" . "i")
+ ("ñ\\|ň\\|ń" . "n")
+ ("ó\\|ò\\|ô\\|ö\\|õ\\|ǒ\\|ø\\|ō\\|ồ\\|ơ\\|ọ\\|ỏ\\|ố\\|ổ\\|ỗ\\|ộ\\|ớ\\|ờ\\|ở\\|ợ" . "o")
+ ("ú\\|ù\\|û\\|ü\\|ū\\|ũ\\|ư\\|ụ\\|ủ\\|ứ\\|ừ\\|ử\\|ữ\\|ự" . "u")
+ ("ý\\|ÿ\\|ỳ\\|ỷ\\|ỹ" . "y")
+ ("þ" . "th")
+ ("ď\\|ð\\|đ" . "d")
+ ("ĩ" . "i")
+ ("ľ\\|ĺ\\|ł" . "l")
+ ("ř\\|ŕ" . "r")
+ ("š\\|ś" . "s")
+ ("ť" . "t")
+ ("ž\\|ź\\|ż" . "z")
+ ("œ" . "oe")
+ (" " . " ") ; thin space etc
+ ("–" . "-")
+ ("—\\|一" . "--"))))
+ ;; For some reason, *-name-* and *-titleword-* get clobbered, even
+ ;; though the original value in decribe-variable clearly shows
+ ;; them having been based on the extended
+ ;; bibtex-autokey-transcriptions. Force them to be the right
+ ;; thing.
+ (progn (seq-do (lambda (pair) (add-to-list 'bibtex-autokey-transcriptions pair)) charMap)
+ (seq-do (lambda (pair) (add-to-list 'bibtex-autokey-name-change-strings pair)) charMap)
+ (seq-do (lambda (pair) (add-to-list 'bibtex-autokey-titleword-change-strings pair)) charMap))))
+
+(use-package bibtex-completion
+ :ensure ivy-bibtex
+ :custom
+ (bibtex-completion-bibliography "~/Documents/papers/library.bib")
+ (bibtex-completion-library-path '("~/Documents/papers/pdfs/"))
+ (bibtex-completion-notes-path "~/Documents/papers/notes/")
+ (bibtex-completion-notes-extension ".org")
+ (bibtex-completion-pdf-extension '(".pdf" ".djvu" ".txt")))
+
+(use-package cc-mode
+ :custom
+ (c-default-style "bsd"))
+
+(use-package company
+ :ensure t
+ :bind
+ ("<tab>" . company-indent-or-complete-common)
+ :hook
+ (after-init . global-company-mode))
+
+(use-package company-auctex
+ :ensure t
+ :after latex
+ :config
+ (company-auctex-init))
+
+(use-package company-bibtex
+ :ensure t
+ :hook
+ (bibtex-mode . (lambda () (add-to-list 'company-backends 'company-bibtex))))
+
+(use-package company-box
+ :ensure t
+ :diminish
+ :hook (company-mode . company-box-mode))
+
+(use-package company-coq
+ :ensure t
+ :hook (coq-mode . company-coq-mode))
+
+(use-package company-math
+ :ensure t
+ :config
+ (add-to-list 'company-backends 'company-math-symbols-unicode)
+ (add-to-list 'company-backends 'company-latex-commands))
+
+(use-package company-org-block
+ :ensure t
+ :hook ((org-mode . (lambda ()
+ (setq-local company-backends '(company-org-block))
+ (company-mode +1)))))
+
+(use-package counsel
+ :ensure t
+ :bind (("C-x C-b" . counsel-ibuffer)
+ ("C-x C-f" . counsel-find-file)
+ ("M-x" . counsel-M-x)
+ ("M-y" . counsel-yank-pop)))
+
+(use-package cus-edit
+ :custom
+ (custom-file null-device "Don't store customizations"))
+
+(use-package diary
+ :ensure diary-lib
+ :custom
+ (diary-display-function 'diary-fancy-display)
+ :hook ((diary-list-entries . diary-include-other-diary-files)
+ (diary-list-entries . diary-sort-entries)))
+
+(use-package dictem
+ :load-path "~/.emacs.d/dictem/")
+
+(use-package diminish
+ :ensure t)
+
+(use-package doi-utils
+ ;; provided by org-ref
+ :ensure org-ref)
+
+(use-package dtrt-indent
+ :ensure t)
+
+(use-package dune
+ :ensure t)
+
+(use-package dune-format
+ :ensure t)
+
+(use-package eldoc
+ :diminish)
+
+(use-package elpher
+ :ensure t)
+
+(use-package elpy
+ :ensure t
+ :after python
+ :config (elpy-enable)
+ :custom
+ (elpy-rpc-python-command "python3"))
+
+(use-package ess
+ :ensure t)
+
+(use-package fill-column-indicator
+ :ensure t)
+
+(use-package gnus
+ :ensure t
+ :defer t
+ :bind
+ ;; (:map gnus-summary-buffer-map
+ ;; ("SPC" . (gnus-summary-goto-next-page)
+ :custom
+ (gnus-select-method
+ '(nntp "news.club.cc.cmu.edu"
+ (nntp-address "news.club.cc.cmu.edu")
+ (nntp-via-address "news-cclub")
+ (nntp-via-rlogin-command "ssh")
+ (nntp-open-connection-function nntp-open-via-rlogin-and-netcat)))
+ (gnus-home-score-file "gnus.SCORE")
+ (gnus-secondary-select-methods
+ '((nntp "news.gmane.io")
+ ; (nntp "news.eternal-september.org")
+ ; (nntp "nntp.olduse.net")
+ (nnimap "imap.rak.ac")
+ (nnimap "mail.cs.mcgill.ca")
+ (nntp "tilde.team"
+ (nntp-address "localhost")
+ (nntp-via-address "tilde.team")
+ (nntp-via-rlogin-command "ssh")
+ (nntp-via-rlogin-command-switches ("-C"))
+ (nntp-open-connection-function nntp-open-via-rlogin-and-netcat))))
+ (gnus-parameters
+ '(("^nntp+.*" (address . "rak@rak.ac"))
+ ("^nnimap+imap\\.rak\\.ac:.*"
+ (posting-style
+ (address . "rak@rak.ac")
+ (gcc "nnimap+imap.rak.ac:Sent")))
+ ("^nnimap+mail\\.cs\\.mcgill\\.ca:.*"
+ (posting-style
+ (address . "rkavanagh@cs.mcgill.ca")
+ (gcc "nnimap+mail.cs.mcgill.ca:INBOX.Sent")))))
+ (gnus-cloud-method "imap.rak.ac")
+ (gnus-cloud-storage-method 'base64)
+ (gnus-update-message-archive-method t)
+ (gnus-message-archive-method
+ '(nnfolder "archive" ; this gets included in the server buffer
+ (nnfolder-inhibit-expiry t)
+ (nnfolder-get-new-mail nil)
+ (nnfolder-active-file "~/News/sent/active")
+ (nnfolder-directory "~/News/sent")))
+ (gnus-check-new-newsgroups nil)
+ (gnus-group-line-format "%M%S%p%P%5y:%B%(%G%) %z\n")
+ (gnus-topic-display-empty-topics nil)
+ :hook
+ (message-send . gnus-score-followup-article)
+ (gnus-group-mode . gnus-topic-mode))
+
+(use-package haskell-mode
+ :ensure t
+ :hook ((haskell-mode . turn-on-haskell-doc-mode)
+ (haskell-mode . turn-on-haskell-indentation)))
+
+(use-package info-look
+ :ensure t)
+
+(use-package ispell
+ :ensure t
+ :defer t
+ :custom
+ (ispell-dictionary "en_CA-w_accents"))
+
+(use-package ivy
+ :ensure t
+ :diminish
+ :custom
+ (ivy-use-virtual-buffers t)
+ (ivy-count-format "(%d/%d) ")
+ :config
+ (ivy-mode 1))
+
+(use-package ivy-bibtex
+ :ensure t
+ :bind (("C-c b" . ivy-bibtex)))
+
+(use-package latex
+ :ensure auctex
+ :after info-look
+ :mode ("\\.tex\\'" . TeX-latex-mode)
+ :init
+ ;; http://www.cs.au.dk/~abizjak/emacs/2016/03/06/latex-fill-paragraph.html
+ (defun ales/fill-paragraph (&optional P)
+ "When called with prefix argument call `fill-paragraph'.
+Otherwise split the current paragraph into one sentence per line."
+ (interactive "P")
+ (if (not P)
+ (save-excursion
+ (let ((fill-column 12345678)) ;; relies on dynamic binding
+ (fill-paragraph) ;; this will not work correctly if the paragraph is
+ ;; longer than 12345678 characters (in which case the
+ ;; file must be at least 12MB long. This is unlikely.)
+ (let ((end (save-excursion
+ (forward-paragraph 1)
+ (backward-sentence)
+ (point-marker)))) ;; remember where to stop
+ (beginning-of-line)
+ (while (progn (forward-sentence)
+ (<= (point) (marker-position end)))
+ (just-one-space) ;; leaves only one space, point is after it
+ (delete-char -1) ;; delete the space
+ (newline) ;; and insert a newline
+ (LaTeX-indent-line) ;; I only use this in combination with late, so this makes sense
+ ))))
+ ;; otherwise do ordinary fill paragraph
+ (fill-paragraph P)))
+ :hook
+ ((LaTeX-mode . turn-on-reftex)
+ (LaTeX-mode . turn-off-auto-fill)
+ (LaTeX-mode . turn-on-flyspell)
+ (LaTeX-mode . LaTeX-math-mode)
+ (LaTeX-mode . (lambda () (set (make-local-variable 'TeX-electric-math)
+ (cons "\\(" "\\)"))))
+ (LaTeX-mode . (lambda ()
+ (LaTeX-add-environments
+ '("axiom" LaTeX-env-label)
+ '("theorem" LaTeX-env-label)
+ '("proposition" LaTeX-env-label)
+ '("definition" LaTeX-env-label)
+ '("corollary" LaTeX-env-label)
+ '("lemma" LaTeX-env-label)
+ '("example" LaTeX-env-label)
+ '("conjecture" LaTeX-env-label)
+ '("figure" LaTeX-env-label))))
+ (LaTeX-mode . (lambda ()
+ ;; This must be a hook. Trying to set it in :config
+ ;; causes the variable to become buffer-local, so
+ ;; it never actually takes effect in all
+ ;; latex-moded buffers. So much time wasted debugging.
+ (add-to-list 'LaTeX-label-alist '("axiom" . "ax:"))
+ (add-to-list 'LaTeX-label-alist '("conjecture" . "conj:"))
+ (add-to-list 'LaTeX-label-alist '("corollary" . "cor:"))
+ (add-to-list 'LaTeX-label-alist '("definition" . "def:"))
+ (add-to-list 'LaTeX-label-alist '("proposition" . "prop:"))
+ (add-to-list 'LaTeX-label-alist '("theorem" . "theorem:"))
+ (add-to-list 'LaTeX-label-alist '("example" . "ex:"))
+ (add-to-list 'LaTeX-label-alist '("lemma" . "lemma:"))
+ (add-to-list 'LaTeX-label-alist '("figure" . "fig:")))))
+ :config
+ (info-lookup-add-help :mode 'LaTeX-mode
+ :regexp ".*"
+ :parse-rule "\\\\?[a-zA-Z]+\\|\\\\[^a-zA-Z]"
+ :doc-spec '(("(latex2e)Concept Index")
+ ("(latex2e)Command Index")))
+ :bind
+ (:map LaTeX-mode-map
+ ("M-q" . ales/fill-paragraph)))
+
+(use-package magit
+ :ensure t
+ :config
+ (put 'magit-clean 'disabled nil)
+ :custom
+ (magit-diff-refine-hunk 'all))
+
+(use-package markdown-mode
+ :ensure t
+ :init
+ (autoload 'markdown-mode "markdown-mode"
+ "Major mode for editing Markdown files" t)
+ :mode (("\\.markdown\\'" . markdown-mode)
+ ("\\.mdown\'" . markdown-mode)))
+
+(use-package menu-bar
+ :config
+ (menu-bar-mode -1)
+ :bind
+ ([S-f10] . menu-bar-mode))
+
+(use-package merlin
+ ;; ocaml assistant
+ :ensure t)
+
+(use-package message
+ :config
+ (defun whitespace-cleanup-mail ()
+ "Kill the whitespace in a buffer while preserving the last instance of '-- '."
+ (interactive)
+ (save-excursion
+ (save-restriction
+ (widen)
+ (let ((signature-delimiter
+ (progn
+ ;; Find the last occurence of "-- " in the buffer
+ ;; and set signature-delimiter to the position of the first -
+ ;; This means we must subtract 2, because re-search-backward
+ ;; returns the end of the occurence found
+ (goto-char (point-max))
+ (- (re-search-backward "^-- $" nil t) 2))))
+ (when signature-delimiter
+ (progn
+ ;; Run whitespace-cleanup on the region
+ ;; [start, signature-delimiter]. Include the first dash
+ ;; to avoid deleting any empty lines leading up to the
+ ;; delimiter.
+ (narrow-to-region (point-min) signature-delimiter)
+ (whitespace-cleanup)
+ (widen)
+ ;; Run it on the region [signature-delimiter, end).
+ ;; We include the signature delimiter so that we do not
+ ;; delete any empty lines immediately following it.
+ ;; A side-effect is that the first line might become "^--$".
+ ;; This means that we must re-add the space at the end of
+ ;; the first line. Easiest just replace the first line of the
+ ;; buffer by "^-- $".
+ (narrow-to-region signature-delimiter (point-max))
+ (whitespace-cleanup)
+ (goto-char (point-min))
+ (kill-whole-line 0)
+ (insert "-- ")))))))
+ :hook
+ ((message-mode . (lambda () (remove-hook 'before-save-hook 'whitespace-cleanup t)))
+ (message-mode . (lambda () (add-hook 'before-save-hook 'whitespace-cleanup-mail nil t))))
+ :custom
+ (message-citation-line-function 'message-insert-formatted-citation-line)
+ (message-send-mail-function 'message-send-mail-with-sendmail))
+
+(use-package mingus
+ ;; mpd client
+ :ensure t)
+
+(use-package minibuffer
+ :config
+ (add-to-list 'completion-styles 'substring)
+ :custom
+ ;; Cycle through tab-completions with tab if there are less than 5
+ (setq completion-cycle-threshold 5))
+
+(use-package ocp-indent
+ :ensure t)
+
+(use-package octave
+ :mode ("\\.m\'" . octave-mode))
+
+(use-package org
+ :bind (:map org-mode-map
+ ("<tab>" . org-cycle))
+ :hook
+ (org-mode . visual-line-mode)
+ :custom
+ (org-link-file-path-type 'relative))
+
+(use-package org-chef
+ :ensure t)
+
+(use-package org-noter
+ :ensure t
+ :custom
+ ;; Surely there's an easier way of setting this?
+ (org-noter-notes-search-path '("~/Documents/papers/notes/")))
+
+(use-package org-ref
+ :ensure t
+ :after ivy-bibtex)
+
+(use-package org-ref-arxiv
+ :ensure org-ref
+ :custom
+ (arxiv-entry-format-string "@Misc{%s,
+title = {%s},
+author = {%s},
+eprinttype = {arxiv},
+date = {%s},
+eprint = {%s},
+eprintclass = {%s},
+abstract = {%s},
+pagetotal = {MISSING},
+_checked = {NOT CHECKED},
+_source = {ev},
+}")
+ ;; redefine it to use a sensible date and stuff.
+ ;; my version of arxiv-get-bibtex-entry-via-arxiv-api
+ :config
+ (defun my/arxiv-get-bibtex-entry-via-arxiv-api (arxiv-number)
+ "Retrieve meta data for ARXIV-NUMBER.
+Returns a formatted BibTeX entry."
+ (with-current-buffer
+ (url-retrieve-synchronously (format "http://export.arxiv.org/api/query?id_list=%s" arxiv-number) t)
+ (let* ((parse-tree (libxml-parse-xml-region
+ (progn (goto-char 0)
+ (search-forward "<?xml ")
+ (match-beginning 0))
+ (point-max)))
+ (entry (assq 'entry parse-tree))
+ (authors (--map (nth 2 (nth 2 it))
+ (--filter (and (listp it) (eq (car it) 'author)) entry)))
+ (date (nth 2 (assq 'published entry)))
+ (title (nth 2 (assq 'title entry)))
+ (names (arxiv-bibtexify-authors authors))
+ (category (cdar (nth 1 (assq 'primary_category entry))))
+ (abstract (s-trim (nth 2 (assq 'summary entry))))
+ (url (nth 2 (assq 'id entry)))
+ (temp-bibtex (format arxiv-entry-format-string "" title names date arxiv-number category abstract url))
+ (key (with-temp-buffer
+ (insert temp-bibtex)
+ (bibtex-mode)
+ (bibtex-set-dialect (parsebib-find-bibtex-dialect) t)
+ (org-ref-replace-nonascii)
+ (bibtex-generate-autokey))))
+ (format arxiv-entry-format-string key title names date arxiv-number category abstract url))))
+ (advice-add 'arxiv-get-bibtex-entry-via-arxiv-api :override 'my/arxiv-get-bibtex-entry-via-arxiv-api))
+
+(use-package org-ref-bibtex
+ :ensure org-ref
+ :after bibtex-completion ; needs bibtex-completion-library-path
+ :custom
+ (org-ref-title-case-types '(("article" "title")
+ ("book" "booktitle" "title")
+ ("collection" "booktitle" "title")
+ ("incollection" "booktitle" "title")
+ ("inproceedings" "booktitle" "title")
+ ("misc" "title")
+ ("proceedings" "title")
+ ("report" "title")
+ ("thesis" "title")))
+ (org-ref-bibtex-journal-abbreviations
+ '(("CACM" "Communications of the ACM" "Comm. ACM")
+ ("Discourse \\& Society")
+ ("ENTCS" "Electronic Notes in Theoretical Computer Science")
+ ("Information and Computation")
+ ("International Journal of Foundations of Computer Science" "Int. J. Found. Comput. Sci.")
+ ("JSL" "The Journal of Symbolic Logic")
+ ("Journal of Computer Security")
+ ("Journal of Logic and Computation" "J. Logic Computat.")
+ ("LCNS" "Lecture Notes in Computer Science" "Lect. Notes Comput. Sc.")
+ ("LMCS" "Logical Methods in Computer Science")
+ ("Le Devoir")
+ ("MSCS" "Mathematical Structures in Computer Science" "Math. Struct. Comp. Sci.")
+ ("Nordic Journal of Philosophical Logic")
+ ("PACMPL" "Proceedings of the ACM on Programming Languages" "Proc. ACM Program. Lang.")
+ ("Philosophy Compass")
+ ("Piping Today")
+ ("Proceedings of the Aristotelian Society")
+ ("Publications of the Research Institute for Mathematical Sciences" "Publ. RIMS")
+ ("Reason Papers")
+ ("Reprints in Theory and Applications of Categories")
+ ("Rice University Studies")
+ ("Rice University Studies")
+ ("SICOMP" "SIAM Journal on Computing")
+ ("Science")
+ ("TAC" "Theory and Applications of Categories")
+ ("TCS" "Theoretical Computer Science")
+ ("TUGboat")
+ ("The American Mathematical Monthly")
+ ("The Review of Symbolic Logic")
+ ("The Voice")
+ ("Topoi")
+ ("Transactions of the American Mathematical Society")
+ ("{ACM} {SIGACT} News" "ACM SIGACT News"))))
+
+(use-package reftex-cite
+ :ensure t)
+
+(use-package org-ref-core
+ :ensure org-ref
+ :after org-ref-bibtex
+ :after reftex-cite
+ :after ivy-bibtex
+ :bind (:map bibtex-mode-map
+ ("C-c C-c" . org-ref-clean-bibtex-entry)
+ ("C-c e" . my/set-source-ev)
+ ("C-c d" . my/set-checked-date))
+ :config
+ (defun my/org-ref-title-case-english ()
+ "Call org-ref-title-case only if the language field is set
+ to `english' or is missing. This will avoid having foreign-
+ language titles re-cased."
+ (interactive)
+ (let ((langfield (bibtex-autokey-get-field "language")))
+ (if (= (length langfield) 0)
+ (org-ref-title-case))))
+ (defun my/set-checked-date ()
+ "Set the _checked field of a bibtex entry to the current date."
+ (interactive)
+ (save-excursion
+ (bibtex-beginning-of-entry)
+ (bibtex-set-field "_checked" (format-time-string "%Y-%m-%d"))))
+ (defun my/set-source-ev ()
+ "Set the _source field of a bibtex entry to ev."
+ (interactive)
+ (save-excursion
+ (bibtex-beginning-of-entry)
+ (bibtex-set-field "_source" "ev")))
+ ;; taken from org-ref-bibtex.el and extended
+ (setq org-ref-nonascii-latex-replacements
+ (append '(("fi" . "fi")
+ ("ı́" . "{\\\\'i}")
+ ("ω" . "$\\\\omega$")
+ ("‘" . "`") ; LEFT SINGLE QUOTATION MARK
+ ("’" . "'") ; RIGHT SINGLE QUOTATION MARK
+ ("“" . "``")
+ ("′" . "'") ; PRIME
+ ("∇" . "$\\\\nabla$")
+ ("ι" . "$\\\\iota$")
+ ("”" . "''"))
+ org-ref-nonascii-latex-replacements))
+ (defun my/org-ref-format-url-if-doi ()
+ "Override built-in function. Originally, this reformatted
+the url to point to DOI. I would rather kill the URL field
+entirely if it contains the DOI. bibtex-clean-entry will then
+delete the field."
+ (interactive)
+ (save-excursion
+ (bibtex-beginning-of-entry)
+ (let ((doi (bibtex-autokey-get-field "doi")))
+ (unless (string-empty-p doi)
+ (when (string-match-p (regexp-quote (org-ref-bibtex-entry-doi))
+ (bibtex-autokey-get-field "url"))
+ (bibtex-set-field "url" ""))))))
+ (defun my/org-ref-biblatex-journaltitle ()
+ "Rename journal to journaltitle"
+ (interactive)
+ (save-excursion
+ (bibtex-beginning-of-entry)
+ (let ((journal (bibtex-autokey-get-field "journal"))
+ (journaltitle (bibtex-autokey-get-field "journaltitle")))
+ (when (and (string-empty-p journaltitle)
+ (not (string-empty-p journal)))
+ (bibtex-beginning-of-entry)
+ (bibtex-set-field "journal" "")
+ (bibtex-set-field "journaltitle" journal)))))
+ (defun my/biblatex-date ()
+ "Convert 'year' + 'month' fields to 'date' field"
+ (interactive)
+ (save-excursion
+ (bibtex-beginning-of-entry)
+ (let* ((year (bibtex-autokey-get-field "year"))
+ (month (downcase (bibtex-autokey-get-field "month")))
+ (nummonth (cond ((string= month "jan") "01")
+ ((string= month "feb") "02")
+ ((string= month "mar") "03")
+ ((string= month "apr") "04")
+ ((string= month "may") "05")
+ ((string= month "jun") "06")
+ ((string= month "jul") "07")
+ ((string= month "aug") "08")
+ ((string= month "sep") "09")
+ ((string= month "oct") "10")
+ ((string= month "nov") "11")
+ ((string= month "dec") "12")
+ (t "")))
+ (olddate (bibtex-autokey-get-field "date"))
+ (newdate (cond ((string-empty-p year) nil)
+ ((string-empty-p nummonth) year)
+ (t (concat year "-" nummonth)))))
+ (when (and (string-empty-p olddate)
+ (not (string-empty-p newdate)))
+ (bibtex-beginning-of-entry)
+ (bibtex-set-field "date" newdate)
+ (bibtex-set-field "year" "")
+ (bibtex-set-field "month" "")))))
+ (defun my/orcb-check-journal ()
+ "Check entry at point to see if journal exists in `org-ref-bibtex-journal-abbreviations'.
+If not, issue a warning."
+ (interactive)
+ (when
+ (string= "article"
+ (downcase
+ (cdr (assoc "=type=" (bibtex-parse-entry)))))
+ (save-excursion
+ (bibtex-beginning-of-entry)
+ (let* ((entry (bibtex-parse-entry t))
+ (journal (replace-regexp-in-string "[[:space:]\n]+" " " (reftex-get-bib-field "journaltitle" entry))))
+ (when (null journal)
+ (error "Unable to get journal for this entry."))
+ (unless (member journal (-flatten org-ref-bibtex-journal-abbreviations))
+ (message "Journal \"%s\" not found in org-ref-bibtex-journal-abbreviations." journal))))))
+ :custom
+ (org-ref-default-bibliography '("~/Documents/papers/library.bib"))
+ (org-ref-bibliography-notes "~/Documents/papers/notes.org")
+ (org-ref-pdf-directory "~/Documents/papers/pdfs/")
+ ;; don't fudge with the output of bibtex-generate-autokey
+ (org-ref-clean-bibtex-key-function 'identity)
+ ;; let helm-bibtex find the notes file for an entry
+ (org-ref-notes-function
+ (lambda (thekey)
+ (let ((bibtex-completion-bibliography (org-ref-find-bibliography)))
+ (bibtex-completion-edit-notes
+ (list (car (org-ref-get-bibtex-key-and-file thekey)))))))
+ (org-ref-clean-bibtex-entry-hook
+ '(my/org-ref-biblatex-journaltitle
+ bibtex-clean-entry
+ my/org-ref-format-url-if-doi
+ orcb-key-comma
+ org-ref-replace-nonascii
+ orcb-&
+ orcb-%
+ my/org-ref-title-case-english ;; all entries, -article does only articles
+ my/org-ref-biblatex-journaltitle
+ my/biblatex-date
+ orcb-key
+ orcb-clean-doi
+ my/orcb-check-journal
+ org-ref-sort-bibtex-entry
+ orcb-fix-spacing
+ orcb-clean-nil-opinionated)))
+
+(use-package org-ref-isbn
+ :ensure org-ref)
+
+(use-package org-ref-pdf
+ :ensure org-ref)
+
+(use-package ox-md
+ ;; org-mode to markdown exporter
+ :ensure org
+ :after (org))
+
+(use-package outline
+ :ensure t
+ :hook (LaTeX-mode . outline-minor-mode))
+
+(use-package outline-magic
+ :ensure t
+ :after outline
+ :bind (:map outline-minor-mode-map ([f10] . outline-cycle)))
+
+(use-package paren
+ :ensure t
+ :config
+ (show-paren-mode t)
+ :custom
+ ;; highlight entire expression when on delimiters
+ (show-paren-style 'expression))
+
+(use-package pdf-tools
+ :ensure t
+ :config
+ (pdf-tools-install))
+
+(use-package powerline
+ :ensure t)
+
+(use-package proof-general
+ :ensure t
+ :custom
+ (proof-disappearing-proofs t)
+ (proof-electric-terminator-enable t)
+ (proof-three-window-enable t)
+ (proof-three-window-mode-policy 'hybrid)
+ :custom-face
+ (proof-locked-face ((t (:weight bold)))))
+
+(use-package py-autopep8
+ :ensure t
+ :hook (python-mode . py-autopep8-enable-on-save)
+ :custom
+ (py-autopep8-options '("--max-line-length=80")))
+
+(use-package python
+ :ensure t
+ :mode ("\\.py\\'" . python-mode)
+ :custom (python-python-command "/usr/bin/python3")
+ :interpreter ("python3" . python-mode)
+ :custom
+ (python-indent-guess-indent-offset nil)
+ (python-indent-offset 4)
+ (python-shell-interpreter "python3"))
+
+(use-package rainbow-delimiters
+ :ensure t
+ :hook ((LaTeX-mode prog-mode) . rainbow-delimiters-mode))
+
+(use-package rainbow-mode
+ :ensure t)
+
+(use-package reftex
+ :ensure t
+ :after latex
+ :hook (LaTeX-mode . reftex-mode)
+ :custom
+ (reftex-default-bibliography '("~/Documents/papers/library.bib"))
+ (reftex-label-alist '(("axiom" ?a "ax:%f:" "~\\ref{%s}" t ("axiom" "ax.") -3)
+ ("theorem" ?h "theorem:%F:" "~\\ref{%s}" t ("theorem" "th.") -3)
+ ("proposition" ?p "prop:%F:" "~\\ref{%s}" t ("proposition" "prop.") -3)
+ ("definition" ?d "def:%F:" "~\\ref{%s}" t ("definition" "def.") -3)
+ ("corollary" ?c "cor:%F:" "~\\ref{%s}" t ("corollary" "cor.") -3)
+ ("lemma" ?l "lemma:%F:" "~\\ref{%s}" t ("lemma" "lem.") -3)
+ ("conjecture" ?j "conj:%F:" "~\\ref{%s}" t ("conjecture" "conj.") -3)
+ ("example" ?X "ex:%F:" "~\\ref{%s}" t ("example" "ex.") -3)
+ ("figure" ?F "fig:%F:" "~\\ref{%s}" t ("figure" "fig.") -3)
+ ("ax" ?a "ax:%F:" "~\\ref{%s}" t ("axiom" "ax.") -3)
+ ("thm" ?h "theorem:%F:" "~\\ref{%s}" t ("theorem" "th.") -3)
+ ("prop" ?p "prop:%F:" "~\\ref{%s}" t ("proposition" "prop.") -3)
+ ("defi" ?d "def:%F:" "~\\ref{%s}" t ("definition" "def.") -3)
+ ("cor" ?c "cor:%F:" "~\\ref{%s}" t ("corollary" "cor.") -3)
+ ("lem" ?l "lemma:%F:" "~\\ref{%s}" t ("lemma" "lem.") -3)
+ ("conj" ?j "conj:%F:" "~\\ref{%s}" t ("conjecture" "conj.") -3)
+ ("enumerate" 105 "item:%F:" "~\\ref{%s}" item (regexp "items?" "Punkte?"))
+ ("equation" 101 "eq:%F:" "~\\eqref{%s}" t
+ (regexp "equations?" "eqs?\\." "eqn\\." "Gleichung\\(en\\)?" "Gl\\."))
+ ("eqnarray" 101 "eq:%F:" nil eqnarray-like))))
+
+(use-package sass-mode
+ :ensure t)
+
+(use-package scroll-bar
+ :custom
+ (scroll-bar-mode nil))
+
+(use-package sendmail
+ :custom
+ (mail-specify-envelope-from t)
+ (mail-envelope-from 'header))
+
+(use-package simple
+ :custom
+ (column-mode-number t))
+
+(use-package smerge-mode
+ :commands smerge-mode
+ :init ;; weirdly won't work if under custom
+ (setq smerge-command-prefix (kbd "C-c v")))
+
+(use-package sml-mode
+ :ensure t
+ :mode ("\\.sml\\'" . sml-mode))
+
+(use-package solar
+ :custom
+ ;; Use 24 hour time in diary, calendar, etc.
+ (calendar-time-display-form
+ '(24-hours ":" minutes (if time-zone " (") time-zone (if time-zone ")")))
+ (calendar-latitude 40.4)
+ (calendar-longitude -79.9)
+ (calendar-location-name "Pittsburgh, PA"))
+
+(use-package spaceline
+ :ensure t
+ :requires spaceline-config)
+
+(use-package tex
+ :ensure auctex
+ :custom
+ (reftex-plug-into-AUCTeX t)
+ (TeX-parse-self t) ; Parse documents to provide completion for packages, etc.
+ (TeX-auto-save t) ; Automatically save style information
+ (TeX-clean-confirm nil) ; Don't ask for confirmation when cleaning
+ (TeX-source-correlate-mode t) ; Provide forward and inverse search with SyncTeX
+ (TeX-source-correlate-method 'synctex)
+ (TeX-PDF-mode t) ; use pdftex by default
+ :config
+ (cond
+ ((eq system-type 'darwin)
+ (add-to-list 'TeX-view-program-list
+ '("Zathura"
+ ("zathura "
+ (mode-io-correlate " --synctex-forward %n:0:%b -x \"emacsclient +%{line} %{input}\" ")
+ " %o")
+ "zathura"))))
+ (add-to-list 'TeX-view-program-selection '(output-pdf "Zathura")))
+
+(use-package tool-bar
+ :config
+ (tool-bar-mode -1))
+
+(use-package tramp
+ :defer t
+ :custom
+ (tramp-default-method "ssh"))
+
+(use-package tuareg
+ :ensure t
+ :config
+ (add-hook 'tuareg-mode-hook 'merlin-mode t))
+
+(use-package twittering-mode
+ :ensure t
+ :custom
+ (twittering-icon-mode t)
+ (twittering-icon-storage-file "~/.emacs.d/storage/twittering-mode-icons.gz")
+ (twittering-use-icon-storage t))
+
+(use-package vc-git
+ :requires vc
+ :config
+ (add-to-list 'vc-handled-backends 'git))
+
+(use-package windmove
+ :config
+ (windmove-default-keybindings)
+ :custom
+ (windmove-wrap-around t))
+
+(use-package yaml-mode
+ :ensure t)