| @@ -0,0 +1,369 @@ | ||
| ;;; key-chord.el --- map pairs of simultaneously pressed keys to commands | ||
| ;;------------------------------------------------------------------- | ||
| ;; | ||
| ;; Copyright (C) 2003,2005,2008,2012 David Andersson | ||
| ;; | ||
| ;; This file is NOT part of Emacs. | ||
| ;; | ||
| ;; This program is free software; you can redistribute it and/or | ||
| ;; modify it under the terms of the GNU General Public License as | ||
| ;; published by the Free Software Foundation; either version 2 of | ||
| ;; the License, or (at your option) any later version. | ||
| ;; | ||
| ;; This program is distributed in the hope that it will be | ||
| ;; useful, but WITHOUT ANY WARRANTY; without even the implied | ||
| ;; warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR | ||
| ;; PURPOSE. See the GNU General Public License for more details. | ||
| ;; | ||
| ;; You should have received a copy of the GNU General Public | ||
| ;; License along with this program; if not, write to the Free | ||
| ;; Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, | ||
| ;; MA 02111-1307 USA | ||
| ;; | ||
| ;;------------------------------------------------------------------- | ||
|
|
||
| ;; Author: David Andersson <l.david.andersson(at)sverige.nu> | ||
| ;; Created: 27 April 2003 | ||
| ;; Version: 0.6 (2012-10-23) | ||
| ;; Keywords: keyboard chord input | ||
|
|
||
| ;;; Commentary: | ||
|
|
||
| ;; ######## Compatibility ######################################## | ||
| ;; | ||
| ;; Works with Emacs-20.3, 20.6, 20.7, 21.2, 21.4, 22.1 and 23.1 | ||
| ;; Does not work with Emacs-19.31 nor XEmacs-20.4 and 21.4. | ||
|
|
||
| ;; ######## Quick start ######################################## | ||
| ;; | ||
| ;; Add to your ~/.emacs | ||
| ;; | ||
| ;; (require 'key-chord) | ||
| ;; (key-chord-mode 1) | ||
| ;; | ||
| ;; and some chords, for example | ||
| ;; | ||
| ;; (key-chord-define-global "hj" 'undo) | ||
| ;; (key-chord-define-global ",." "<>\C-b") | ||
|
|
||
| ;; ######## Terminology ######################################## | ||
| ;; | ||
| ;; In this package, a "key chord" is two keys pressed simultaneously, | ||
| ;; or a single key quickly pressed twice. | ||
| ;; | ||
| ;; (Sometimes pressing SHIFT and/or META plus another key is call a chord, | ||
| ;; but not here. However SHIFT plus two normal keys can be a "key chord".) | ||
|
|
||
| ;; ######## Description ######################################## | ||
| ;; | ||
| ;; Key chord mode acts like a global minor mode controlled by the function | ||
| ;; `key-chord-mode'. | ||
| ;; | ||
| ;; Key chord definitions are stored in ordinary key-maps. | ||
| ;; The function `key-chord-define-global' defines a chord in the global | ||
| ;; key-map and `key-chord-define' defines a chord in a specified key-map, | ||
| ;; for example for a specific mode. | ||
| ;; | ||
| ;; A TWO-key chord is two distinct keys pressed simultaneously (within | ||
| ;; one tenth of a second, or so). | ||
| ;; | ||
| ;; Examples: | ||
| ;; | ||
| ;; (key-chord-define-global ",." "<>\C-b") | ||
| ;; (key-chord-define-global "hj" 'undo) | ||
| ;; (key-chord-define-global [?h ?j] 'undo) ; the same | ||
| ;; (key-chord-define-global "jk" 'dabbrev-expand) | ||
| ;; (key-chord-define-global "cv" 'reindent-then-newline-and-indent) | ||
| ;; (key-chord-define-global "4r" "$") | ||
| ;; | ||
| ;; Comma and dot pressed together insert a pair of angle brackets. | ||
| ;; `h' and `j' pressed together invoke the undo command. | ||
| ;; `j' and `k' pressed together invoke the dabbrev-expand command. | ||
| ;; 'c' and 'v' pressed together insert a newline. | ||
| ;; `4' and `r' pressed together insert a dollar sign. | ||
| ;; | ||
| ;; A ONE-key chord is a single key quickly pressed twice (within one third | ||
| ;; of a second or so). | ||
| ;; | ||
| ;; Examples: | ||
| ;; | ||
| ;; (key-chord-define-global "''" "`'\C-b") | ||
| ;; (key-chord-define-global ",," 'indent-for-comment) | ||
| ;; (key-chord-define-global "qq" "the ") | ||
| ;; (key-chord-define-global "QQ" "The ") | ||
| ;; | ||
| ;; Tick (') pressed twice inserts a back-tick and a tick (`'). | ||
| ;; Comma (,) pressed twice indents for and/or inserts a comment. | ||
| ;; `q' pressed twice inserts the word "the ". | ||
| ;; | ||
| ;; Examples: Mode specific chords | ||
| ;; | ||
| ;; (key-chord-define c++-mode-map ";;" "\C-e;") | ||
| ;; (key-chord-define c++-mode-map "{}" "{\n\n}\C-p\t") | ||
| ;; | ||
| ;; The command `key-chord-describe' lists currently defined key chords. | ||
| ;; The standard command `describe-bindings' (C-h b) will also show key chords. | ||
| ;; | ||
| ;; The standard command `describe-key' (C-h k) will accept a key chord and | ||
| ;; show its definition. (Isn't that amazing. There is no explicit code to | ||
| ;; carry out this functionality.) | ||
|
|
||
| ;; ######## Tips ######################################## | ||
| ;; | ||
| ;; Don't chord key combinations that exists in the languages you typically | ||
| ;; write. Otherwise, if you are typing fast, two key intended to be separate | ||
| ;; letters might instead trig a chord. | ||
| ;; E.g. "uu" would be a good chord in spanish but not in finnish, and | ||
| ;; "hj" would be a good chord in english but not in swedish. | ||
| ;; | ||
| ;; Don't rely solely on /usr/dict/words to find unusual combination. | ||
| ;; For example "cv" or "fg" can be quite common in certain kinds of | ||
| ;; programming. Grep your own texts to verify that a combination is unusual. | ||
| ;; And don't forget to check both permutations: "fg" and "gf". | ||
| ;; | ||
| ;; Choose two keys that are close to each other on the keyboard, so they | ||
| ;; can be quickly typed without effort. Chords involving two hands (as | ||
| ;; opposed to two fingers on one hand) are harder to type (quickly). | ||
| ;; The idea is that key chords are to replace function keys for functions | ||
| ;; that are frequently performed while the hands are in writing position. | ||
| ;; | ||
| ;; Key chords might not work well over a slow network. | ||
|
|
||
| ;; ######## Limitations ######################################## | ||
| ;; | ||
| ;; When recording keyboard macros, the time between keyboard inputs are not | ||
| ;; recorded. Thus, the key-chord-input-method cannot know for sure if two keys | ||
| ;; in a macro was a chord or not. The current solution remembers the first key | ||
| ;; of the chords typed during macro recording, and keys that match those (and | ||
| ;; are defined as chords) are considered key-chords during macro execution. | ||
| ;; This knowledge is not saved with `name-last-kbd-macro', so they may | ||
| ;; execute wrong if they contain pair of keys that match defined chords. | ||
| ;; | ||
| ;; Emacs will not call input-method-function for keys that have non numeric | ||
| ;; codes or whos code is outside the range 32..126. Thus you cannot define | ||
| ;; key chords involving function keys, control keys, or even your non-english | ||
| ;; letters (on national keyboards) that otherwise are well positioned for | ||
| ;; chording on your keyboard. | ||
| ;; (I think chording left and right arrow keys would be useful, but cannot do. | ||
| ;; I consider this a bug in Emacs. Input methods could happily return | ||
| ;; unmodified *any* key they don't know about.) | ||
| ;; | ||
| ;; Key chords longer that 2 keys are not supported. It could be done, but I | ||
| ;; don't think it is worth the trubbel since most keyboards will not reliably | ||
| ;; send all key codes when 3 or more keys are pressed simultaneously. | ||
| ;; It might also be a bit trickier to maintain performance. | ||
| ;; | ||
| ;; Key chord mode uses input-method-function. And so do internationalisation | ||
| ;; packages (mule, quail, etc). Do not expect them to work well together. | ||
| ;; The last one that gets the input-method-function rules. | ||
|
|
||
| ;; ######## Implementation ######################################## | ||
| ;; | ||
| ;; Key chords piggy back in ordinary key maps, so they can be defined | ||
| ;; per mode without having to add hooks to all modes. | ||
| ;; | ||
| ;; Key chord key codes are vectors beginning with the atom `key-chord'. | ||
| ;; A two key chord, e.g. "hj", will add two entries in the key-map. | ||
| ;; E.g. [key-chord ?h ?j] and [key-chord ?j ?h]. | ||
| ;; | ||
| ;; When key-chord-mode is enabled input-method-function is set to | ||
| ;; key-chord-input-method. | ||
|
|
||
| ;; ######## To do ######################################## | ||
| ;; | ||
| ;; * Find a way to save key-chord info in keyboard macros. | ||
| ;; | ||
| ;; * Save previous value of input-method-function? And call it? | ||
| ;; | ||
| ;; * input-method-function is reset in *info* buffers! What to do? | ||
| ;; | ||
| ;; * How to enter interactively command OR string in key-chord-define-global? | ||
| ;; | ||
| ;; * Customize public vars (defcustom). | ||
|
|
||
| ;; ######## History ######################################## | ||
| ;; | ||
| ;; 0.6 (2012-10-23) l.david.andersson(at)sverige.nu | ||
| ;; Add key-chord-define-local, key-chord-unset-local, key-chord-unset-global | ||
| ;; 0.5 (2008-09-15) david(at)symsoft.se | ||
| ;; Bugfix sit-for; Improved examples; New E-mail in comment | ||
| ;; 0.4 (2005-05-07) david(at)symsoft.se | ||
| ;; Slightly better macro heuristics; Added option key-chord-in-macros | ||
| ;; 0.3 (2005-04-14) david(at)symsoft.se | ||
| ;; Require advice; More examples | ||
| ;; 0.2 (2003-09-13) david(at)symsoft.se | ||
| ;; Quick and dirty fix for keyboard macros | ||
| ;; 0.1 (2003-04-27) david(at)symsoft.se | ||
| ;; First release | ||
|
|
||
| ;;; Code: | ||
|
|
||
| (defvar key-chord-two-keys-delay 0.1 ; 0.05 or 0.1 | ||
| "Max time delay between two key press to be considered a key chord.") | ||
|
|
||
| (defvar key-chord-one-key-delay 0.2 ; 0.2 or 0.3 to avoid first autorepeat | ||
| "Max time delay between two press of the same key to be considered a key chord. | ||
| This should normally be a little longer than `key-chord-two-keys-delay'.") | ||
|
|
||
| (defvar key-chord-in-macros t | ||
| "If nil, don't expand key chords when executing keyboard macros. | ||
| If non-nil, expand chord sequenses in macros, but only if a similar chord was | ||
| entered during the last interactive macro recording. (This carries a bit of | ||
| guesswork. We can't know for sure when executing whether two keys were | ||
| typed quickly or slowly when recorded.)") | ||
|
|
||
| ;; Internal vars | ||
| (defvar key-chord-mode nil) | ||
|
|
||
| ;; Shortcut for key-chord-input-method: no need to test a key again if it | ||
| ;; didn't matched a chord the last time. Improves feedback during autorepeat. | ||
| (defvar key-chord-last-unmatched nil) | ||
|
|
||
| ;; Macro heuristics: Keep track of which chords was used when the last macro | ||
| ;; was defined. Or rather, only the first-char of the chords. Only expand | ||
| ;; matching chords during macro execution. | ||
| (defvar key-chord-in-last-kbd-macro nil) | ||
| (defvar key-chord-defining-kbd-macro nil) | ||
|
|
||
| ;;;###autoload | ||
| (defun key-chord-mode (arg) | ||
| "Toggle key chord mode. | ||
| With positive ARG enable the mode. With zero or negative arg disable the mode. | ||
| A key chord is two keys that are pressed simultaneously, or one key quickly | ||
| pressed twice. | ||
| \nSee functions `key-chord-define-global', `key-chord-define-local', and | ||
| `key-chord-define' and variables `key-chord-two-keys-delay' and | ||
| `key-chord-one-key-delay'." | ||
|
|
||
| (interactive "P") | ||
| (setq key-chord-mode (if arg | ||
| (> (prefix-numeric-value arg) 0) | ||
| (not key-chord-mode))) | ||
| (cond (key-chord-mode | ||
| (setq input-method-function 'key-chord-input-method) | ||
| (message "Key Chord mode on")) | ||
| (t | ||
| (setq input-method-function nil) | ||
| (message "Key Chord mode off")))) | ||
|
|
||
| ;;;###autoload | ||
| (defun key-chord-define-global (keys command) | ||
| "Define a key-chord of the two keys in KEYS starting a COMMAND. | ||
| \nKEYS can be a string or a vector of two elements. Currently only elements | ||
| that corresponds to ascii codes in the range 32 to 126 can be used. | ||
| \nCOMMAND can be an interactive function, a string, or nil. | ||
| If COMMAND is nil, the key-chord is removed. | ||
| \nNote that KEYS defined locally in the current buffer will have precedence." | ||
| (interactive "sSet key chord globally (2 keys): \nCSet chord \"%s\" to command: ") | ||
| (key-chord-define (current-global-map) keys command)) | ||
|
|
||
| ;;;###autoload | ||
| (defun key-chord-define-local (keys command) | ||
| "Locally define a key-chord of the two keys in KEYS starting a COMMAND. | ||
| \nKEYS can be a string or a vector of two elements. Currently only elements | ||
| that corresponds to ascii codes in the range 32 to 126 can be used. | ||
| \nCOMMAND can be an interactive function, a string, or nil. | ||
| If COMMAND is nil, the key-chord is removed. | ||
| \nThe binding goes in the current buffer's local map, | ||
| which in most cases is shared with all other buffers in the same major mode." | ||
| (interactive "sSet key chord locally (2 keys): \nCSet chord \"%s\" to command: ") | ||
| (key-chord-define (current-local-map) keys command)) | ||
|
|
||
| (defun key-chord-unset-global (keys) | ||
| "Remove global key-chord of the two keys in KEYS." | ||
| (interactive "sUnset key chord globally (2 keys): ") | ||
| (key-chord-define (current-local-map) keys nil)) | ||
|
|
||
| (defun key-chord-unset-local (keys) | ||
| "Remove local key-chord of the two keys in KEYS." | ||
| (interactive "sUnset key chord locally (2 keys): ") | ||
| (key-chord-define (current-local-map) keys nil)) | ||
|
|
||
| ;;;###autoload | ||
| (defun key-chord-define (keymap keys command) | ||
| "Define in KEYMAP, a key-chord of the two keys in KEYS starting a COMMAND. | ||
| \nKEYS can be a string or a vector of two elements. Currently only elements | ||
| that corresponds to ascii codes in the range 32 to 126 can be used. | ||
| \nCOMMAND can be an interactive function, a string, or nil. | ||
| If COMMAND is nil, the key-chord is removed." | ||
| (if (/= 2 (length keys)) | ||
| (error "Key-chord keys must have two elements")) | ||
| ;; Exotic chars in a string are >255 but define-key wants 128..255 for those | ||
| (let ((key1 (logand 255 (aref keys 0))) | ||
| (key2 (logand 255 (aref keys 1)))) | ||
| (if (eq key1 key2) | ||
| (define-key keymap (vector 'key-chord key1 key2) command) | ||
| ;; else | ||
| (define-key keymap (vector 'key-chord key1 key2) command) | ||
| (define-key keymap (vector 'key-chord key2 key1) command)))) | ||
|
|
||
| (defun key-chord-lookup-key1 (keymap key) | ||
| "Like lookup-key but no third arg and no numeric return value." | ||
| (let ((res (lookup-key keymap key))) | ||
| (if (numberp res) | ||
| nil | ||
| ;; else | ||
| res))) | ||
|
|
||
| (defun key-chord-lookup-key (key) | ||
| "Lookup KEY in all current key maps." | ||
| (let ((maps (current-minor-mode-maps)) | ||
| res) | ||
| (while (and maps (not res)) | ||
| (setq res (key-chord-lookup-key1 (car maps) key) | ||
| maps (cdr maps))) | ||
| (or res | ||
| (if (current-local-map) | ||
| (key-chord-lookup-key1 (current-local-map) key)) | ||
| (key-chord-lookup-key1 (current-global-map) key)))) | ||
|
|
||
| (defun key-chord-describe () | ||
| "List key chord bindings in a help buffer. | ||
| \nTwo key chords will be listed twice and there will be Prefix Commands. | ||
| Please ignore that." | ||
| (interactive) | ||
| (describe-bindings [key-chord])) | ||
|
|
||
| (defun key-chord-input-method (first-char) | ||
| "Input method controlled by key bindings with the prefix `key-chord'." | ||
| (if (and (not (eq first-char key-chord-last-unmatched)) | ||
| (key-chord-lookup-key (vector 'key-chord first-char))) | ||
| (let ((delay (if (key-chord-lookup-key (vector 'key-chord first-char first-char)) | ||
| key-chord-one-key-delay | ||
| ;; else | ||
| key-chord-two-keys-delay))) | ||
| (if (if executing-kbd-macro | ||
| (not (memq first-char key-chord-in-last-kbd-macro)) | ||
| (sit-for delay 0 'no-redisplay)) | ||
| (progn | ||
| (setq key-chord-last-unmatched nil) | ||
| (list first-char)) | ||
| ;; else input-pending-p | ||
| (let* ((input-method-function nil) | ||
| (next-char (read-event)) | ||
| (res (vector 'key-chord first-char next-char))) | ||
| (if (key-chord-lookup-key res) | ||
| (progn | ||
| (setq key-chord-defining-kbd-macro | ||
| (cons first-char key-chord-defining-kbd-macro)) | ||
| (list 'key-chord first-char next-char)) | ||
| ;; else put back next-char and return first-char | ||
| (setq unread-command-events (cons next-char unread-command-events)) | ||
| (if (eq first-char next-char) | ||
| (setq key-chord-last-unmatched first-char)) | ||
| (list first-char))))) | ||
| ;; else no key-chord keymap | ||
| (setq key-chord-last-unmatched first-char) | ||
| (list first-char))) | ||
|
|
||
| (require 'advice) | ||
|
|
||
| (defadvice start-kbd-macro (after key-chord activate) | ||
| (setq key-chord-defining-kbd-macro nil)) | ||
|
|
||
| (defadvice end-kbd-macro (after key-chord activate) | ||
| (setq key-chord-in-last-kbd-macro key-chord-defining-kbd-macro)) | ||
|
|
||
| (provide 'key-chord) | ||
|
|
||
| ;;; key-chord.el ends here |
| @@ -0,0 +1,319 @@ | ||
| ;;; powerline-separators.el --- Separators for Powerline | ||
|
|
||
| ;; Copyright (C) 2012-2013 Donald Ephraim Curtis | ||
| ;; Copyright (C) 2013 Jason Milkins | ||
| ;; Copyright (C) 2012 Nicolas Rougier | ||
|
|
||
| ;; Author: Donald Ephraim Curtis <dcurtis@milkbox.net> | ||
| ;; URL: http://github.com/milkypostman/powerline/ | ||
| ;; Version: 2.0 | ||
| ;; Keywords: mode-line | ||
|
|
||
| ;;; Commentary: | ||
| ;; | ||
| ;; Separators for Powerline. | ||
| ;; Included separators: alternate, arrow, arrow-fade, bar, box, brace, butt, | ||
| ;; chamfer, contour, curve, rounded, roundstub, slant, wave, zigzag, and nil. | ||
| ;; | ||
|
|
||
| ;;; Code: | ||
|
|
||
| (require 'cl-lib) | ||
| (require 'color) | ||
|
|
||
| (defun pl/interpolate (color1 color2) | ||
| "Interpolate between COLOR1 and COLOR2. | ||
| COLOR1 and COLOR2 must be supplied as hex strings with a leading #." | ||
| (let* ((c1 (color-name-to-rgb color1)) | ||
| (c2 (color-name-to-rgb color2)) | ||
| (red (/ (+ (nth 0 c1) (nth 0 c2)) 2)) | ||
| (green (/ (+ (nth 1 c1) (nth 1 c2)) 2)) | ||
| (blue (/ (+ (nth 2 c1) (nth 2 c2)) 2))) | ||
| (color-rgb-to-hex red green blue))) | ||
|
|
||
| (defun pl/hex-color (color) | ||
| "Get the hexadecimal value of COLOR." | ||
| (apply 'color-rgb-to-hex (color-name-to-rgb color))) | ||
|
|
||
| (defun pl/pattern (lst) | ||
| "Turn LST into an infinite pattern." | ||
| (when lst | ||
| (let ((pattern (cl-copy-list lst))) | ||
| (setcdr (last pattern) pattern)))) | ||
|
|
||
| (defun pl/pattern-to-string (pattern) | ||
| "Convert a PATTERN into a string that can be used in an XPM." | ||
| (concat "\"" (mapconcat 'number-to-string pattern "") "\",")) | ||
|
|
||
| (defun pl/reverse-pattern (pattern) | ||
| "Reverse each line in PATTERN." | ||
| (mapcar 'reverse pattern)) | ||
|
|
||
| (defun pl/row-pattern (fill total &optional fade) | ||
| "Make a list that has FILL 0s out of TOTAL 1s with FADE 2s to the right of the fill." | ||
| (unless fade | ||
| (setq fade 0)) | ||
| (let ((fill (min fill total)) | ||
| (fade (min fade (max (- total fill) 0)))) | ||
| (append (make-list fill 0) | ||
| (make-list fade 2) | ||
| (make-list (- total fill fade) 1)))) | ||
|
|
||
|
|
||
| (defun pl/pattern-defun (name dir width &rest patterns) | ||
| "Create a powerline function of NAME in DIR with WIDTH for PATTERNS. | ||
| PATTERNS is of the form (PATTERN HEADER FOOTER SECOND-PATTERN CENTER). | ||
| PATTERN is required, all other components are optional. | ||
| All generated functions generate the form: | ||
| HEADER | ||
| PATTERN ... | ||
| CENTER | ||
| SECOND-PATTERN ... | ||
| FOOTER | ||
| PATTERN and SECOND-PATTERN repeat infinitely to fill the space needed to generate a full height XPM. | ||
| PATTERN, HEADER, FOOTER, SECOND-PATTERN, CENTER are of the form ((COLOR ...) (COLOR ...) ...). | ||
| COLOR can be one of 0, 1, or 2, where 0 is the source color, 1 is the | ||
| destination color, and 2 is the interpolated color between 0 and 1." | ||
| (when (eq dir 'right) | ||
| (setq patterns (mapcar 'pl/reverse-pattern patterns))) | ||
| (let* ((pattern (pl/pattern (mapcar 'pl/pattern-to-string (car patterns)))) | ||
| (header (mapcar 'pl/pattern-to-string (nth 1 patterns))) | ||
| (footer (mapcar 'pl/pattern-to-string (nth 2 patterns))) | ||
| (second-pattern (pl/pattern (mapcar 'pl/pattern-to-string (nth 3 patterns)))) | ||
| (center (mapcar 'pl/pattern-to-string (nth 4 patterns))) | ||
| (reserve (+ (length header) (length footer) (length center)))) | ||
| (pl/wrap-defun name dir width | ||
| `((pattern-height (max (- height ,reserve) 0)) | ||
| (second-pattern-height (/ pattern-height 2)) | ||
| (pattern-height ,(if second-pattern '(ceiling pattern-height 2) 'pattern-height))) | ||
| `((mapconcat 'identity ',header "") | ||
| (mapconcat 'identity (cl-subseq ',pattern 0 pattern-height) "") | ||
| (mapconcat 'identity ',center "") | ||
| (mapconcat 'identity (cl-subseq ',second-pattern 0 second-pattern-height) "") | ||
| (mapconcat 'identity ',footer ""))))) | ||
|
|
||
| (defun pl/wrap-defun (name dir width let-vars body) | ||
| "Generate a powerline function of NAME in DIR with WIDTH using LET-VARS and BODY." | ||
| (let* ((src-face (if (eq dir 'left) 'face1 'face2)) | ||
| (dst-face (if (eq dir 'left) 'face2 'face1))) | ||
| `(defun ,(intern (format "powerline-%s-%s" name (symbol-name dir))) | ||
| (face1 face2 &optional height) | ||
| (when window-system | ||
| (unless height | ||
| (setq height (pl/separator-height))) | ||
| (let* ,(append `((color1 (when ,src-face | ||
| (pl/hex-color (face-attribute ,src-face :background)))) | ||
| (color2 (when ,dst-face | ||
| (pl/hex-color (face-attribute ,dst-face :background)))) | ||
| (colori (when (and color1 color2) (pl/interpolate color1 color2))) | ||
| (color1 (or color1 "None")) | ||
| (color2 (or color2 "None")) | ||
| (colori (or colori "None"))) | ||
| let-vars) | ||
| (create-image ,(append `(concat (format "/* XPM */ static char * %s_%s[] = { \"%s %s 3 1\", \"0 c %s\", \"1 c %s\", \"2 c %s\"," | ||
| ,(replace-regexp-in-string "-" "_" name) | ||
| (symbol-name ',dir) | ||
| ,width | ||
| height | ||
| color1 | ||
| color2 | ||
| colori)) | ||
| body | ||
| '("};")) | ||
| 'xpm t | ||
| :ascent 'center | ||
| :face (when (and face1 face2) | ||
| ,dst-face))))))) | ||
|
|
||
|
|
||
| (defmacro pl/alternate (dir) | ||
| "Generate an alternating pattern XPM function for DIR." | ||
| (pl/pattern-defun "alternate" dir 4 | ||
| '((2 2 1 1) | ||
| (0 0 2 2)))) | ||
|
|
||
| (defmacro pl/arrow (dir) | ||
| "Generate an arrow XPM function for DIR." | ||
| (let ((row-modifier (if (eq dir 'left) 'identity 'reverse))) | ||
| (pl/wrap-defun "arrow" dir 'middle-width | ||
| '((width (1- (/ height 2))) | ||
| (middle-width (1- (ceiling height 2)))) | ||
| `((cl-loop for i from 0 to width | ||
| concat (pl/pattern-to-string (,row-modifier (pl/row-pattern i middle-width)))) | ||
| (when (cl-oddp height) | ||
| (pl/pattern-to-string (make-list middle-width 0))) | ||
| (cl-loop for i from width downto 0 | ||
| concat (pl/pattern-to-string (,row-modifier (pl/row-pattern i middle-width)))))))) | ||
|
|
||
| (defmacro pl/arrow-fade (dir) | ||
| "Generate an arrow-fade XPM function for DIR." | ||
| (let* ((row-modifier (if (eq dir 'left) 'identity 'reverse))) | ||
| (pl/wrap-defun "arrow-fade" dir 'middle-width | ||
| '((width (1- (/ height 2))) | ||
| (middle-width (1+ (ceiling height 2)))) | ||
| `((cl-loop for i from 0 to width | ||
| concat (pl/pattern-to-string (,row-modifier (pl/row-pattern i middle-width 2)))) | ||
| (when (cl-oddp height) | ||
| (pl/pattern-to-string (,row-modifier (pl/row-pattern (1+ width) middle-width 2)))) | ||
| (cl-loop for i from width downto 0 | ||
| concat (pl/pattern-to-string (,row-modifier (pl/row-pattern i middle-width 2)))))))) | ||
|
|
||
| (defmacro pl/bar (dir) | ||
| "Generate a bar XPM function for DIR." | ||
| (pl/pattern-defun "bar" dir 2 | ||
| '((2 2)))) | ||
|
|
||
| (defmacro pl/box (dir) | ||
| "Generate a box XPM function for DIR." | ||
| (pl/pattern-defun "box" dir 2 | ||
| '((0 0) | ||
| (0 0) | ||
| (1 1) | ||
| (1 1)))) | ||
|
|
||
| (defmacro pl/brace (dir) | ||
| "Generate a brace XPM function for DIR." | ||
| (pl/pattern-defun "brace" dir 4 | ||
| '((0 1 1 1)) | ||
| '((1 1 1 1) | ||
| (2 1 1 1)) | ||
| '((2 1 1 1) | ||
| (1 1 1 1)) | ||
| '((0 1 1 1)) | ||
| '((0 2 1 1) | ||
| (0 2 1 1) | ||
| (0 0 2 1) | ||
| (0 0 0 0) | ||
| (0 0 2 1) | ||
| (0 2 1 1) | ||
| (0 2 1 1)))) | ||
|
|
||
| (defmacro pl/butt (dir) | ||
| "Generate a butt XPM function for DIR." | ||
| (pl/pattern-defun "butt" dir 3 | ||
| '((0 0 0)) | ||
| '((1 1 1) | ||
| (0 1 1) | ||
| (0 0 1)) | ||
| '((0 0 1) | ||
| (0 1 1) | ||
| (1 1 1)))) | ||
|
|
||
| (defmacro pl/chamfer (dir) | ||
| "Generate a chamfer XPM function for DIR." | ||
| (pl/pattern-defun "chamfer" dir 3 | ||
| '((0 0 0)) | ||
| '((1 1 1) | ||
| (0 1 1) | ||
| (0 0 1)))) | ||
|
|
||
| (defmacro pl/contour (dir) | ||
| "Generate a contour XPM function for DIR." | ||
| (pl/pattern-defun "contour" dir 10 | ||
| '((0 0 0 0 0 1 1 1 1 1)) | ||
| '((1 1 1 1 1 1 1 1 1 1) | ||
| (0 2 1 1 1 1 1 1 1 1) | ||
| (0 0 2 1 1 1 1 1 1 1) | ||
| (0 0 0 2 1 1 1 1 1 1) | ||
| (0 0 0 0 1 1 1 1 1 1) | ||
| (0 0 0 0 2 1 1 1 1 1)) | ||
| '((0 0 0 0 0 2 1 1 1 1) | ||
| (0 0 0 0 0 0 1 1 1 1) | ||
| (0 0 0 0 0 0 2 1 1 1) | ||
| (0 0 0 0 0 0 0 2 1 1) | ||
| (0 0 0 0 0 0 0 0 0 0)))) | ||
|
|
||
| (defmacro pl/curve (dir) | ||
| "Generate a curve XPM function for DIR." | ||
| (pl/pattern-defun "curve" dir 4 | ||
| '((0 0 0 0)) | ||
| '((1 1 1 1) | ||
| (2 1 1 1) | ||
| (0 0 1 1) | ||
| (0 0 2 1) | ||
| (0 0 0 1) | ||
| (0 0 0 2)) | ||
| '((0 0 0 2) | ||
| (0 0 0 1) | ||
| (0 0 2 1) | ||
| (0 0 1 1) | ||
| (2 1 1 1) | ||
| (1 1 1 1)))) | ||
|
|
||
| (defmacro pl/rounded (dir) | ||
| "Generate a rounded XPM function for DIR." | ||
| (pl/pattern-defun "rounded" dir 6 | ||
| '((0 0 0 0 0 0)) | ||
| '((2 1 1 1 1 1) | ||
| (0 0 2 1 1 1) | ||
| (0 0 0 0 1 1) | ||
| (0 0 0 0 2 1) | ||
| (0 0 0 0 0 1) | ||
| (0 0 0 0 0 2)))) | ||
|
|
||
| (defmacro pl/roundstub (dir) | ||
| "Generate a roundstub XPM function for DIR." | ||
| (pl/pattern-defun "roundstub" dir 3 | ||
| '((0 0 0)) | ||
| '((1 1 1) | ||
| (0 0 1) | ||
| (0 0 2)) | ||
| '((0 0 2) | ||
| (0 0 1) | ||
| (1 1 1)))) | ||
|
|
||
| (defmacro pl/slant (dir) | ||
| "Generate a slant XPM function for DIR." | ||
| (let* ((row-modifier (if (eq dir 'left) 'identity 'reverse))) | ||
| (pl/wrap-defun "slant" dir 'width | ||
| '((width (1- (ceiling height 2)))) | ||
| `((cl-loop for i from 0 to height | ||
| concat (pl/pattern-to-string (,row-modifier (pl/row-pattern (/ i 2) width)))))))) | ||
|
|
||
| (defmacro pl/wave (dir) | ||
| "Generate a wave XPM function for DIR." | ||
| (pl/pattern-defun "wave" dir 11 | ||
| '((0 0 0 0 0 0 1 1 1 1 1)) | ||
| '((2 1 1 1 1 1 1 1 1 1 1) | ||
| (0 0 1 1 1 1 1 1 1 1 1) | ||
| (0 0 0 1 1 1 1 1 1 1 1) | ||
| (0 0 0 2 1 1 1 1 1 1 1) | ||
| (0 0 0 0 1 1 1 1 1 1 1) | ||
| (0 0 0 0 2 1 1 1 1 1 1) | ||
| (0 0 0 0 0 1 1 1 1 1 1) | ||
| (0 0 0 0 0 1 1 1 1 1 1) | ||
| (0 0 0 0 0 2 1 1 1 1 1)) | ||
| '((0 0 0 0 0 0 2 1 1 1 1) | ||
| (0 0 0 0 0 0 0 1 1 1 1) | ||
| (0 0 0 0 0 0 0 1 1 1 1) | ||
| (0 0 0 0 0 0 0 2 1 1 1) | ||
| (0 0 0 0 0 0 0 0 1 1 1) | ||
| (0 0 0 0 0 0 0 0 2 1 1) | ||
| (0 0 0 0 0 0 0 0 0 0 2)))) | ||
|
|
||
| (defmacro pl/zigzag (dir) | ||
| "Generate a zigzag pattern XPM function for DIR." | ||
| (pl/pattern-defun "zigzag" dir 3 | ||
| '((1 1 1) | ||
| (0 1 1) | ||
| (0 0 1) | ||
| (0 0 0) | ||
| (0 0 1) | ||
| (0 1 1)))) | ||
|
|
||
| (defmacro pl/nil (dir) | ||
| "Generate a XPM function that returns nil for DIR." | ||
| `(defun ,(intern (format "powerline-nil-%s" (symbol-name dir))) | ||
| (face1 face2 &optional height) | ||
| nil)) | ||
|
|
||
|
|
||
| (provide 'powerline-separators) | ||
|
|
||
| ;;; powerline-separators.el ends here |
| @@ -0,0 +1,23 @@ | ||
| *~ | ||
| *.elc | ||
| auto-save-list | ||
| recentf | ||
| savehist | ||
| saveplace | ||
| eshell | ||
| elpa | ||
| el-get | ||
| semanticdb | ||
| url | ||
| ede-projects.el | ||
| .DS_Store | ||
| custom.el | ||
| places | ||
| .smex-items | ||
| savefile/ | ||
| /prelude-modules.el | ||
| projectile-bookmarks.eld | ||
| session* | ||
| .cask | ||
| tramp | ||
| /var/pcache |
| @@ -0,0 +1,3 @@ | ||
| /elpa | ||
| /savefile | ||
| /.cask |
| @@ -0,0 +1,31 @@ | ||
| # Contributing | ||
|
|
||
| If you discover issues, have ideas for improvements or new features, or | ||
| want to contribute a new module, please report them to the | ||
| [issue tracker][1] of the repository or submit a pull request. Please, | ||
| try to follow these guidelines when you do so. | ||
|
|
||
| ## Issue reporting | ||
|
|
||
| * Check that the issue has not already been reported. | ||
| * Check that the issue has not already been fixed in the latest code | ||
| (a.k.a. `master`). | ||
| * Be clear, concise and precise in your description of the problem. | ||
| * Open an issue with a descriptive title and a summary in grammatically correct, | ||
| complete sentences. | ||
| * Include any relevant code to the issue summary. | ||
|
|
||
| ## Pull requests | ||
|
|
||
| * Read [how to properly contribute to open source projects on Github][2]. | ||
| * Use a topic branch to easily amend a pull request later, if necessary. | ||
| * Write [good commit messages][3]. | ||
| * Use the same coding conventions as the rest of the project. | ||
| * Verify your Emacs Lisp code with `checkdoc` (<kbd>C-c ? d</kbd>). | ||
| * Open a [pull request][4] that relates to *only* one subject with a clear title | ||
| and description in grammatically correct, complete sentences. | ||
|
|
||
| [1]: https://github.com/bbatsov/prelude/issues | ||
| [2]: http://gun.io/blog/how-to-github-fork-branch-and-pull-request | ||
| [3]: http://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html | ||
| [4]: https://help.github.com/articles/using-pull-requests |
| @@ -0,0 +1,40 @@ | ||
| ((("Scotty" . | ||
| [0 0 0 1 0 0]) | ||
| ("OverloadedStrings" . | ||
| [0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0]) | ||
| ("fibs" . | ||
| [2 0 0 0]) | ||
| ("zipWith" . | ||
| [0 0 0 0 0 1 0]) | ||
| ("takeWhile" . | ||
| [0 0 0 0 0 0 0 0 1]) | ||
| ("doubleMe" . | ||
| [0 0 0 0 2 0 0 0]) | ||
| ("Double" . | ||
| [0 0 0 0 1 0]) | ||
| ("fac" . | ||
| [5 0 0]) | ||
| ("load" . | ||
| [1 0 0 0]) | ||
| ("delete-trailing-whitespace" . | ||
| [0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0]) | ||
| ("before-save-hook" . | ||
| [0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0]) | ||
| ("add-hook" . | ||
| [1 0 0 0 0 0 0 0]) | ||
| ("data1" . | ||
| [0 0 1 0 0]) | ||
| ("LOCKDIR" . | ||
| [1 0 0 0 1 0 0]) | ||
| ("HOME/dotfiles/walls/lock.png" . | ||
| [0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0]) | ||
| ("ack" . | ||
| [3 0 0]) | ||
| ("fib" . | ||
| [2 0 0]) | ||
| ("problem_1" . | ||
| [0 0 0 0 1 0 0 0 0]) | ||
| ("System.IO" . | ||
| [0 0 0 1 0 0 0 0 0]) | ||
| ("problem_2" . | ||
| [0 0 0 0 0 0 0 0 1]))) |
| @@ -0,0 +1,103 @@ | ||
| ;;; prelude-custom.el --- Emacs Prelude: Prelude's customizable variables. | ||
| ;; | ||
| ;; Copyright © 2011-2015 Bozhidar Batsov | ||
| ;; | ||
| ;; Author: Bozhidar Batsov <bozhidar@batsov.com> | ||
| ;; URL: https://github.com/bbatsov/prelude | ||
| ;; Version: 1.0.0 | ||
| ;; Keywords: convenience | ||
|
|
||
| ;; This file is not part of GNU Emacs. | ||
|
|
||
| ;;; Commentary: | ||
|
|
||
| ;; Refinements of the core editing experience in Emacs. | ||
|
|
||
| ;;; License: | ||
|
|
||
| ;; This program is free software; you can redistribute it and/or | ||
| ;; modify it under the terms of the GNU General Public License | ||
| ;; as published by the Free Software Foundation; either version 3 | ||
| ;; of the License, or (at your option) any later version. | ||
| ;; | ||
| ;; This program is distributed in the hope that it will be useful, | ||
| ;; but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| ;; GNU General Public License for more details. | ||
| ;; | ||
| ;; You should have received a copy of the GNU General Public License | ||
| ;; along with GNU Emacs; see the file COPYING. If not, write to the | ||
| ;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | ||
| ;; Boston, MA 02110-1301, USA. | ||
|
|
||
| ;;; Code: | ||
|
|
||
| ;; customize | ||
| (defgroup prelude nil | ||
| "Emacs Prelude configuration." | ||
| :prefix "prelude-" | ||
| :group 'convenience) | ||
|
|
||
| (defcustom prelude-auto-save t | ||
| "Non-nil values enable Prelude's auto save." | ||
| :type 'boolean | ||
| :group 'prelude) | ||
|
|
||
| (defcustom prelude-guru t | ||
| "Non-nil values enable `guru-mode'." | ||
| :type 'boolean | ||
| :group 'prelude) | ||
|
|
||
| (defcustom prelude-whitespace t | ||
| "Non-nil values enable Prelude's whitespace visualization." | ||
| :type 'boolean | ||
| :group 'prelude) | ||
|
|
||
| (defcustom prelude-clean-whitespace-on-save t | ||
| "Cleanup whitespace from file before it's saved. | ||
| Will only occur if `prelude-whitespace' is also enabled." | ||
| :type 'boolean | ||
| :group 'prelude) | ||
|
|
||
| (defcustom prelude-flyspell t | ||
| "Non-nil values enable Prelude's flyspell support." | ||
| :type 'boolean | ||
| :group 'prelude) | ||
|
|
||
| (defcustom prelude-user-init-file (expand-file-name "personal/" | ||
| user-emacs-directory) | ||
| "Path to your personal customization file. | ||
| Prelude recommends you only put personal customizations in the | ||
| personal folder. This variable allows you to specify a specific | ||
| folder as the one that should be visited when running | ||
| `prelude-find-user-init-file'. This can be easily set to the desired buffer | ||
| in lisp by putting `(setq prelude-user-init-file load-file-name)' | ||
| in the desired elisp file." | ||
| :type 'string | ||
| :group 'prelude) | ||
|
|
||
| (defcustom prelude-indent-sensitive-modes | ||
| '(conf-mode coffee-mode haml-mode python-mode slim-mode yaml-mode) | ||
| "Modes for which auto-indenting is suppressed." | ||
| :type 'list | ||
| :group 'prelude) | ||
|
|
||
| (defcustom prelude-yank-indent-modes '(LaTeX-mode TeX-mode) | ||
| "Modes in which to indent regions that are yanked (or yank-popped). | ||
| Only modes that don't derive from `prog-mode' should be listed here." | ||
| :type 'list | ||
| :group 'prelude) | ||
|
|
||
| (defcustom prelude-yank-indent-threshold 1000 | ||
| "Threshold (# chars) over which indentation does not automatically occur." | ||
| :type 'number | ||
| :group 'prelude) | ||
|
|
||
| (defcustom prelude-theme 'zenburn | ||
| "The default color theme, change this in your /personal/preload config." | ||
| :type 'symbol | ||
| :group 'prelude) | ||
|
|
||
| (provide 'prelude-custom) | ||
|
|
||
| ;;; prelude-custom.el ends here |
| @@ -0,0 +1,121 @@ | ||
| ;;; prelude-global-keybindings.el --- Emacs Prelude: some useful keybindings. | ||
| ;; | ||
| ;; Copyright © 2011-2015 Bozhidar Batsov | ||
| ;; | ||
| ;; Author: Bozhidar Batsov <bozhidar@batsov.com> | ||
| ;; URL: https://github.com/bbatsov/prelude | ||
| ;; Version: 1.0.0 | ||
| ;; Keywords: convenience | ||
|
|
||
| ;; This file is not part of GNU Emacs. | ||
|
|
||
| ;;; Commentary: | ||
|
|
||
| ;; Lots of useful keybindings. | ||
|
|
||
| ;;; License: | ||
|
|
||
| ;; This program is free software; you can redistribute it and/or | ||
| ;; modify it under the terms of the GNU General Public License | ||
| ;; as published by the Free Software Foundation; either version 3 | ||
| ;; of the License, or (at your option) any later version. | ||
| ;; | ||
| ;; This program is distributed in the hope that it will be useful, | ||
| ;; but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| ;; GNU General Public License for more details. | ||
| ;; | ||
| ;; You should have received a copy of the GNU General Public License | ||
| ;; along with GNU Emacs; see the file COPYING. If not, write to the | ||
| ;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | ||
| ;; Boston, MA 02110-1301, USA. | ||
|
|
||
| ;;; Code: | ||
|
|
||
| ;; Align your code in a pretty way. | ||
| (global-set-key (kbd "C-x \\") 'align-regexp) | ||
|
|
||
| ;; Font size | ||
| (global-set-key (kbd "C-+") 'text-scale-increase) | ||
| (global-set-key (kbd "C--") 'text-scale-decrease) | ||
|
|
||
| ;; Window switching. (C-x o goes to the next window) | ||
| (global-set-key (kbd "C-x O") (lambda () | ||
| (interactive) | ||
| (other-window -1))) ;; back one | ||
|
|
||
| ;; Indentation help | ||
| (global-set-key (kbd "C-^") 'prelude-top-join-line) | ||
|
|
||
| ;; Start proced in a similar manner to dired | ||
| (unless (eq system-type 'darwin) | ||
| (global-set-key (kbd "C-x p") 'proced)) | ||
|
|
||
| ;; Start eshell or switch to it if it's active. | ||
| (global-set-key (kbd "C-x m") 'eshell) | ||
|
|
||
| ;; Start a new eshell even if one is active. | ||
| (global-set-key (kbd "C-x M") (lambda () (interactive) (eshell t))) | ||
|
|
||
| ;; Start a regular shell if you prefer that. | ||
| (global-set-key (kbd "C-x M-m") 'shell) | ||
|
|
||
| ;; If you want to be able to M-x without meta | ||
| (global-set-key (kbd "C-x C-m") 'smex) | ||
|
|
||
| ;; A complementary binding to the apropos-command (C-h a) | ||
| (define-key 'help-command "A" 'apropos) | ||
|
|
||
| ;; A quick major mode help with discover-my-major | ||
| (define-key 'help-command (kbd "C-m") 'discover-my-major) | ||
|
|
||
| (define-key 'help-command (kbd "C-f") 'find-function) | ||
| (define-key 'help-command (kbd "C-k") 'find-function-on-key) | ||
| (define-key 'help-command (kbd "C-v") 'find-variable) | ||
| (define-key 'help-command (kbd "C-l") 'find-library) | ||
|
|
||
| (define-key 'help-command (kbd "C-i") 'info-display-manual) | ||
|
|
||
| ;; replace zap-to-char functionaity with the more powerful zop-to-char | ||
| (global-set-key (kbd "M-z") 'zop-up-to-char) | ||
| (global-set-key (kbd "M-Z") 'zop-to-char) | ||
|
|
||
| ;; kill lines backward | ||
| (global-set-key (kbd "C-<backspace>") (lambda () | ||
| (interactive) | ||
| (kill-line 0) | ||
| (indent-according-to-mode))) | ||
|
|
||
| (global-set-key [remap kill-whole-line] 'prelude-kill-whole-line) | ||
|
|
||
| ;; Activate occur easily inside isearch | ||
| (define-key isearch-mode-map (kbd "C-o") | ||
| (lambda () (interactive) | ||
| (let ((case-fold-search isearch-case-fold-search)) | ||
| (occur (if isearch-regexp | ||
| isearch-string | ||
| (regexp-quote isearch-string)))))) | ||
|
|
||
| ;; use hippie-expand instead of dabbrev | ||
| (global-set-key (kbd "M-/") 'hippie-expand) | ||
|
|
||
| ;; replace buffer-menu with ibuffer | ||
| (global-set-key (kbd "C-x C-b") 'ibuffer) | ||
|
|
||
| (unless (fboundp 'toggle-frame-fullscreen) | ||
| (global-set-key (kbd "<f11>") 'prelude-fullscreen)) | ||
|
|
||
| ;; toggle menu-bar visibility | ||
| (global-set-key (kbd "<f12>") 'menu-bar-mode) | ||
|
|
||
| (global-set-key (kbd "C-x g") 'magit-status) | ||
|
|
||
| (global-set-key (kbd "C-=") 'er/expand-region) | ||
|
|
||
| (global-set-key (kbd "C-c j") 'avy-goto-word-1) | ||
| (global-set-key (kbd "s-.") 'avy-goto-word-1) | ||
| (global-set-key (kbd "s-w") 'ace-window) | ||
|
|
||
| (provide 'prelude-global-keybindings) | ||
|
|
||
| ;;; prelude-global-keybindings.el ends here |
| @@ -0,0 +1,146 @@ | ||
| ;;; prelude-mode.el --- Emacs Prelude: minor mode | ||
| ;; | ||
| ;; Copyright © 2011-2015 Bozhidar Batsov | ||
| ;; | ||
| ;; Author: Bozhidar Batsov <bozhidar@batsov.com> | ||
| ;; URL: https://github.com/bbatsov/prelude | ||
| ;; Version: 1.0.0 | ||
| ;; Keywords: convenience | ||
|
|
||
| ;; This file is not part of GNU Emacs. | ||
|
|
||
| ;;; Commentary: | ||
|
|
||
| ;; A minor mode defining a local keymap, plus a menu. | ||
|
|
||
| ;;; License: | ||
|
|
||
| ;; This program is free software; you can redistribute it and/or | ||
| ;; modify it under the terms of the GNU General Public License | ||
| ;; as published by the Free Software Foundation; either version 3 | ||
| ;; of the License, or (at your option) any later version. | ||
| ;; | ||
| ;; This program is distributed in the hope that it will be useful, | ||
| ;; but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| ;; GNU General Public License for more details. | ||
| ;; | ||
| ;; You should have received a copy of the GNU General Public License | ||
| ;; along with GNU Emacs; see the file COPYING. If not, write to the | ||
| ;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | ||
| ;; Boston, MA 02110-1301, USA. | ||
|
|
||
| ;;; Code: | ||
| (require 'easymenu) | ||
|
|
||
| (defvar prelude-mode-map | ||
| (let ((map (make-sparse-keymap))) | ||
| (define-key map (kbd "C-c o") 'prelude-open-with) | ||
| (define-key map (kbd "C-c g") 'prelude-google) | ||
| (define-key map (kbd "C-c G") 'prelude-github) | ||
| (define-key map (kbd "C-c y") 'prelude-youtube) | ||
| (define-key map (kbd "C-c U") 'prelude-duckduckgo) | ||
| ;; mimic popular IDEs binding, note that it doesn't work in a terminal session | ||
| (define-key map [(shift return)] 'prelude-smart-open-line) | ||
| (define-key map (kbd "M-o") 'prelude-smart-open-line) | ||
| (define-key map [(control shift return)] 'prelude-smart-open-line-above) | ||
| (define-key map [(control shift up)] 'move-text-up) | ||
| (define-key map [(control shift down)] 'move-text-down) | ||
| (define-key map [(meta shift up)] 'move-text-up) | ||
| (define-key map [(meta shift down)] 'move-text-down) | ||
| (define-key map (kbd "C-c n") 'prelude-cleanup-buffer-or-region) | ||
| (define-key map (kbd "C-c f") 'prelude-recentf-ido-find-file) | ||
| (define-key map (kbd "C-M-z") 'prelude-indent-defun) | ||
| (define-key map (kbd "C-c u") 'prelude-view-url) | ||
| (define-key map (kbd "C-c e") 'prelude-eval-and-replace) | ||
| (define-key map (kbd "C-c s") 'prelude-swap-windows) | ||
| (define-key map (kbd "C-c D") 'prelude-delete-file-and-buffer) | ||
| (define-key map (kbd "C-c d") 'prelude-duplicate-current-line-or-region) | ||
| (define-key map (kbd "C-c M-d") 'prelude-duplicate-and-comment-current-line-or-region) | ||
| (define-key map (kbd "C-c r") 'prelude-rename-buffer-and-file) | ||
| (define-key map (kbd "C-c t") 'prelude-visit-term-buffer) | ||
| (define-key map (kbd "C-c k") 'prelude-kill-other-buffers) | ||
| (define-key map (kbd "C-c TAB") 'prelude-indent-rigidly-and-copy-to-clipboard) | ||
| (define-key map (kbd "C-c I") 'prelude-find-user-init-file) | ||
| (define-key map (kbd "C-c S") 'prelude-find-shell-init-file) | ||
| (define-key map (kbd "C-c i") 'prelude-goto-symbol) | ||
| ;; extra prefix for projectile | ||
| (define-key map (kbd "s-p") 'projectile-command-map) | ||
| ;; make some use of the Super key | ||
| (define-key map (kbd "s-g") 'god-local-mode) | ||
| (define-key map (kbd "s-r") 'prelude-recentf-ido-find-file) | ||
| (define-key map (kbd "s-j") 'prelude-top-join-line) | ||
| (define-key map (kbd "s-k") 'prelude-kill-whole-line) | ||
| (define-key map (kbd "s-m m") 'magit-status) | ||
| (define-key map (kbd "s-m l") 'magit-log) | ||
| (define-key map (kbd "s-m f") 'magit-file-log) | ||
| (define-key map (kbd "s-m b") 'magit-blame-mode) | ||
| (define-key map (kbd "s-o") 'prelude-smart-open-line-above) | ||
|
|
||
| map) | ||
| "Keymap for Prelude mode.") | ||
|
|
||
| (defun prelude-mode-add-menu () | ||
| "Add a menu entry for `prelude-mode' under Tools." | ||
| (easy-menu-add-item nil '("Tools") | ||
| '("Prelude" | ||
| ("Files" | ||
| ["Open with..." prelude-open-with] | ||
| ["Delete file and buffer" prelude-delete-file-and-buffer] | ||
| ["Rename buffer and file" prelude-rename-buffer-and-file]) | ||
|
|
||
| ("Buffers" | ||
| ["Clean up buffer or region" prelude-cleanup-buffer-or-region] | ||
| ["Kill other buffers" prelude-kill-other-buffers]) | ||
|
|
||
| ("Editing" | ||
| ["Insert empty line" prelude-insert-empty-line] | ||
| ["Move line up" prelude-move-line-up] | ||
| ["Move line down" prelude-move-line-down] | ||
| ["Duplicate line or region" prelude-duplicate-current-line-or-region] | ||
| ["Indent rigidly and copy to clipboard" prelude-indent-rigidly-and-copy-to-clipboard] | ||
| ["Insert date" prelude-insert-date] | ||
| ["Eval and replace" prelude-eval-and-replace] | ||
| ) | ||
|
|
||
| ("Windows" | ||
| ["Swap windows" prelude-swap-windows]) | ||
|
|
||
| ("General" | ||
| ["Visit term buffer" prelude-visit-term-buffer] | ||
| ["Search in Google" prelude-google] | ||
| ["View URL" prelude-view-url])) | ||
| "Search Files (Grep)...") | ||
|
|
||
| (easy-menu-add-item nil '("Tools") '("--") "Search Files (Grep)...")) | ||
|
|
||
| (defun prelude-mode-remove-menu () | ||
| "Remove `prelude-mode' menu entry." | ||
| (easy-menu-remove-item nil '("Tools") "Prelude") | ||
| (easy-menu-remove-item nil '("Tools") "--")) | ||
|
|
||
| ;; define minor mode | ||
| (define-minor-mode prelude-mode | ||
| "Minor mode to consolidate Emacs Prelude extensions. | ||
| \\{prelude-mode-map}" | ||
| :lighter " Pre" | ||
| :keymap prelude-mode-map | ||
| (if prelude-mode | ||
| ;; on start | ||
| (prelude-mode-add-menu) | ||
| ;; on stop | ||
| (prelude-mode-remove-menu))) | ||
|
|
||
| (define-globalized-minor-mode prelude-global-mode prelude-mode prelude-on) | ||
|
|
||
| (defun prelude-on () | ||
| "Turn on `prelude-mode'." | ||
| (prelude-mode +1)) | ||
|
|
||
| (defun prelude-off () | ||
| "Turn off `prelude-mode'." | ||
| (prelude-mode -1)) | ||
|
|
||
| (provide 'prelude-mode) | ||
| ;;; prelude-mode.el ends here |
| @@ -0,0 +1,70 @@ | ||
| ;;; prelude-osx.el --- Emacs Prelude: OSX specific settings. | ||
| ;; | ||
| ;; Copyright © 2011-2015 Bozhidar Batsov | ||
| ;; | ||
| ;; Author: Bozhidar Batsov <bozhidar@batsov.com> | ||
| ;; URL: https://github.com/bbatsov/prelude | ||
| ;; Version: 1.0.0 | ||
| ;; Keywords: convenience | ||
|
|
||
| ;; This file is not part of GNU Emacs. | ||
|
|
||
| ;;; Commentary: | ||
|
|
||
| ;; Some OSX specific stuff. | ||
|
|
||
| ;;; License: | ||
|
|
||
| ;; This program is free software; you can redistribute it and/or | ||
| ;; modify it under the terms of the GNU General Public License | ||
| ;; as published by the Free Software Foundation; either version 3 | ||
| ;; of the License, or (at your option) any later version. | ||
| ;; | ||
| ;; This program is distributed in the hope that it will be useful, | ||
| ;; but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| ;; GNU General Public License for more details. | ||
| ;; | ||
| ;; You should have received a copy of the GNU General Public License | ||
| ;; along with GNU Emacs; see the file COPYING. If not, write to the | ||
| ;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | ||
| ;; Boston, MA 02110-1301, USA. | ||
|
|
||
| ;;; Code: | ||
|
|
||
| ;; On OS X Emacs doesn't use the shell PATH if it's not started from | ||
| ;; the shell. Let's fix that: | ||
| (prelude-require-packages '(exec-path-from-shell vkill)) | ||
|
|
||
| (require 'exec-path-from-shell) | ||
| (exec-path-from-shell-initialize) | ||
|
|
||
| ;; It's all in the Meta | ||
| (setq ns-function-modifier 'hyper) | ||
|
|
||
| ;; proced-mode doesn't work on OS X so we use vkill instead | ||
| (autoload 'vkill "vkill" nil t) | ||
| (global-set-key (kbd "C-x p") 'vkill) | ||
|
|
||
| (defun prelude-swap-meta-and-super () | ||
| "Swap the mapping of Meta and Super. | ||
| Very useful for people using their Mac with a | ||
| Windows external keyboard from time to time." | ||
| (interactive) | ||
| (if (eq mac-command-modifier 'super) | ||
| (progn | ||
| (setq mac-command-modifier 'meta) | ||
| (setq mac-option-modifier 'super) | ||
| (message "Command is now bound to META and Option is bound to SUPER.")) | ||
| (progn | ||
| (setq mac-command-modifier 'super) | ||
| (setq mac-option-modifier 'meta) | ||
| (message "Command is now bound to SUPER and Option is bound to META.")))) | ||
|
|
||
| (define-key prelude-mode-map (kbd "C-c w") 'prelude-swap-meta-and-super) | ||
| (define-key prelude-mode-map (kbd "s-/") 'hippie-expand) | ||
|
|
||
| (menu-bar-mode +1) | ||
|
|
||
| (provide 'prelude-osx) | ||
| ;;; prelude-osx.el ends here |
| @@ -0,0 +1,194 @@ | ||
| ;;; prelude-packages.el --- Emacs Prelude: default package selection. | ||
| ;; | ||
| ;; Copyright © 2011-2015 Bozhidar Batsov | ||
| ;; | ||
| ;; Author: Bozhidar Batsov <bozhidar@batsov.com> | ||
| ;; URL: https://github.com/bbatsov/prelude | ||
| ;; Version: 1.0.0 | ||
| ;; Keywords: convenience | ||
|
|
||
| ;; This file is not part of GNU Emacs. | ||
|
|
||
| ;;; Commentary: | ||
|
|
||
| ;; Takes care of the automatic installation of all the packages required by | ||
| ;; Emacs Prelude. | ||
|
|
||
| ;;; License: | ||
|
|
||
| ;; This program is free software; you can redistribute it and/or | ||
| ;; modify it under the terms of the GNU General Public License | ||
| ;; as published by the Free Software Foundation; either version 3 | ||
| ;; of the License, or (at your option) any later version. | ||
| ;; | ||
| ;; This program is distributed in the hope that it will be useful, | ||
| ;; but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| ;; GNU General Public License for more details. | ||
| ;; | ||
| ;; You should have received a copy of the GNU General Public License | ||
| ;; along with GNU Emacs; see the file COPYING. If not, write to the | ||
| ;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | ||
| ;; Boston, MA 02110-1301, USA. | ||
|
|
||
| ;;; Code: | ||
| (require 'cl) | ||
| (require 'package) | ||
|
|
||
| (add-to-list 'package-archives | ||
| '("melpa" . "http://melpa.org/packages/") t) | ||
| ;; set package-user-dir to be relative to Prelude install path | ||
| (setq package-user-dir (expand-file-name "elpa" prelude-dir)) | ||
| (package-initialize) | ||
|
|
||
| (defvar prelude-packages | ||
| '(avy | ||
| anzu | ||
| browse-kill-ring | ||
| dash | ||
| discover-my-major | ||
| diff-hl | ||
| diminish | ||
| easy-kill | ||
| epl | ||
| expand-region | ||
| flycheck | ||
| gist | ||
| git-timemachine | ||
| gitconfig-mode | ||
| gitignore-mode | ||
| god-mode | ||
| grizzl | ||
| guru-mode | ||
| ov | ||
| projectile | ||
| magit | ||
| move-text | ||
| operate-on-number | ||
| smartparens | ||
| smartrep | ||
| undo-tree | ||
| volatile-highlights | ||
| zenburn-theme | ||
| zop-to-char) | ||
| "A list of packages to ensure are installed at launch.") | ||
|
|
||
| (defun prelude-packages-installed-p () | ||
| "Check if all packages in `prelude-packages' are installed." | ||
| (every #'package-installed-p prelude-packages)) | ||
|
|
||
| (defun prelude-require-package (package) | ||
| "Install PACKAGE unless already installed." | ||
| (unless (memq package prelude-packages) | ||
| (add-to-list 'prelude-packages package)) | ||
| (unless (package-installed-p package) | ||
| (package-install package))) | ||
|
|
||
| (defun prelude-require-packages (packages) | ||
| "Ensure PACKAGES are installed. | ||
| Missing packages are installed automatically." | ||
| (mapc #'prelude-require-package packages)) | ||
|
|
||
| (define-obsolete-function-alias 'prelude-ensure-module-deps 'prelude-require-packages) | ||
|
|
||
| (defun prelude-install-packages () | ||
| "Install all packages listed in `prelude-packages'." | ||
| (unless (prelude-packages-installed-p) | ||
| ;; check for new packages (package versions) | ||
| (message "%s" "Emacs Prelude is now refreshing its package database...") | ||
| (package-refresh-contents) | ||
| (message "%s" " done.") | ||
| ;; install the missing packages | ||
| (prelude-require-packages prelude-packages))) | ||
|
|
||
| ;; run package installation | ||
| (prelude-install-packages) | ||
|
|
||
| (defun prelude-list-foreign-packages () | ||
| "Browse third-party packages not bundled with Prelude. | ||
| Behaves similarly to `package-list-packages', but shows only the packages that | ||
| are installed and are not in `prelude-packages'. Useful for | ||
| removing unwanted packages." | ||
| (interactive) | ||
| (package-show-package-list | ||
| (set-difference package-activated-list prelude-packages))) | ||
|
|
||
| (defmacro prelude-auto-install (extension package mode) | ||
| "When file with EXTENSION is opened triggers auto-install of PACKAGE. | ||
| PACKAGE is installed only if not already present. The file is opened in MODE." | ||
| `(add-to-list 'auto-mode-alist | ||
| `(,extension . (lambda () | ||
| (unless (package-installed-p ',package) | ||
| (package-install ',package)) | ||
| (,mode))))) | ||
|
|
||
| (defvar prelude-auto-install-alist | ||
| '(("\\.clj\\'" clojure-mode clojure-mode) | ||
| ("\\.cmake\\'" cmake-mode cmake-mode) | ||
| ("CMakeLists\\.txt\\'" cmake-mode cmake-mode) | ||
| ("\\.coffee\\'" coffee-mode coffee-mode) | ||
| ("\\.css\\'" css-mode css-mode) | ||
| ("\\.csv\\'" csv-mode csv-mode) | ||
| ("\\.d\\'" d-mode d-mode) | ||
| ("\\.dart\\'" dart-mode dart-mode) | ||
| ("\\.ex\\'" elixir-mode elixir-mode) | ||
| ("\\.exs\\'" elixir-mode elixir-mode) | ||
| ("\\.elixir\\'" elixir-mode elixir-mode) | ||
| ("\\.erl\\'" erlang erlang-mode) | ||
| ("\\.feature\\'" feature-mode feature-mode) | ||
| ("\\.go\\'" go-mode go-mode) | ||
| ("\\.groovy\\'" groovy-mode groovy-mode) | ||
| ("\\.haml\\'" haml-mode haml-mode) | ||
| ("\\.hs\\'" haskell-mode haskell-mode) | ||
| ("\\.kv\\'" kivy-mode kivy-mode) | ||
| ("\\.latex\\'" auctex LaTeX-mode) | ||
| ("\\.less\\'" less-css-mode less-css-mode) | ||
| ("\\.lua\\'" lua-mode lua-mode) | ||
| ("\\.markdown\\'" markdown-mode markdown-mode) | ||
| ("\\.md\\'" markdown-mode markdown-mode) | ||
| ("\\.ml\\'" tuareg tuareg-mode) | ||
| ("\\.pp\\'" puppet-mode puppet-mode) | ||
| ("\\.php\\'" php-mode php-mode) | ||
| ("\\.proto\\'" protobuf-mode protobuf-mode) | ||
| ("\\.pyd\\'" cython-mode cython-mode) | ||
| ("\\.pyi\\'" cython-mode cython-mode) | ||
| ("\\.pyx\\'" cython-mode cython-mode) | ||
| ("PKGBUILD\\'" pkgbuild-mode pkgbuild-mode) | ||
| ("\\.rs\\'" rust-mode rust-mode) | ||
| ("\\.sass\\'" sass-mode sass-mode) | ||
| ("\\.scala\\'" scala-mode2 scala-mode) | ||
| ("\\.scss\\'" scss-mode scss-mode) | ||
| ("\\.slim\\'" slim-mode slim-mode) | ||
| ("\\.swift\\'" swift-mode swift-mode) | ||
| ("\\.textile\\'" textile-mode textile-mode) | ||
| ("\\.thrift\\'" thrift thrift-mode) | ||
| ("\\.yml\\'" yaml-mode yaml-mode) | ||
| ("\\.yaml\\'" yaml-mode yaml-mode) | ||
| ("Dockerfile\\'" dockerfile-mode dockerfile-mode))) | ||
|
|
||
| ;; markdown-mode doesn't have autoloads for the auto-mode-alist | ||
| ;; so we add them manually if it's already installed | ||
| (when (package-installed-p 'markdown-mode) | ||
| (add-to-list 'auto-mode-alist '("\\.markdown\\'" . gfm-mode)) | ||
| (add-to-list 'auto-mode-alist '("\\.md\\'" . gfm-mode))) | ||
|
|
||
| (when (package-installed-p 'pkgbuild-mode) | ||
| (add-to-list 'auto-mode-alist '("PKGBUILD\\'" . pkgbuild-mode))) | ||
|
|
||
| ;; build auto-install mappings | ||
| (mapc | ||
| (lambda (entry) | ||
| (let ((extension (car entry)) | ||
| (package (cadr entry)) | ||
| (mode (cadr (cdr entry)))) | ||
| (unless (package-installed-p package) | ||
| (prelude-auto-install extension package mode)))) | ||
| prelude-auto-install-alist) | ||
|
|
||
| (provide 'prelude-packages) | ||
| ;; Local Variables: | ||
| ;; byte-compile-warnings: (not cl-functions) | ||
| ;; End: | ||
|
|
||
| ;;; prelude-packages.el ends here |
| @@ -0,0 +1,74 @@ | ||
| ;;; prelude-ui.el --- Emacs Prelude: UI optimizations and tweaks. | ||
| ;; | ||
| ;; Copyright © 2011-2015 Bozhidar Batsov | ||
| ;; | ||
| ;; Author: Bozhidar Batsov <bozhidar@batsov.com> | ||
| ;; URL: https://github.com/bbatsov/prelude | ||
| ;; Version: 1.0.0 | ||
| ;; Keywords: convenience | ||
|
|
||
| ;; This file is not part of GNU Emacs. | ||
|
|
||
| ;;; Commentary: | ||
|
|
||
| ;; We dispense with most of the point and click UI, reduce the startup noise, | ||
| ;; configure smooth scolling and a nice theme that's easy on the eyes (zenburn). | ||
|
|
||
| ;;; License: | ||
|
|
||
| ;; This program is free software; you can redistribute it and/or | ||
| ;; modify it under the terms of the GNU General Public License | ||
| ;; as published by the Free Software Foundation; either version 3 | ||
| ;; of the License, or (at your option) any later version. | ||
| ;; | ||
| ;; This program is distributed in the hope that it will be useful, | ||
| ;; but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| ;; GNU General Public License for more details. | ||
| ;; | ||
| ;; You should have received a copy of the GNU General Public License | ||
| ;; along with GNU Emacs; see the file COPYING. If not, write to the | ||
| ;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | ||
| ;; Boston, MA 02110-1301, USA. | ||
|
|
||
| ;;; Code: | ||
|
|
||
| ;; the toolbar is just a waste of valuable screen estate | ||
| ;; in a tty tool-bar-mode does not properly auto-load, and is | ||
| ;; already disabled anyway | ||
| (when (fboundp 'tool-bar-mode) | ||
| (tool-bar-mode -1)) | ||
|
|
||
| (menu-bar-mode -1) | ||
|
|
||
| ;; the blinking cursor is nothing, but an annoyance | ||
| (blink-cursor-mode -1) | ||
|
|
||
| ;; disable startup screen | ||
| (setq inhibit-startup-screen t) | ||
|
|
||
| ;; nice scrolling | ||
| (setq scroll-margin 0 | ||
| scroll-conservatively 100000 | ||
| scroll-preserve-screen-position 1) | ||
|
|
||
| ;; mode line settings | ||
| (line-number-mode t) | ||
| (column-number-mode t) | ||
| (size-indication-mode t) | ||
|
|
||
| ;; enable y/n answers | ||
| (fset 'yes-or-no-p 'y-or-n-p) | ||
|
|
||
| ;; more useful frame title, that show either a file or a | ||
| ;; buffer name (if the buffer isn't visiting a file) | ||
| (setq frame-title-format | ||
| '("" invocation-name " Prelude - " (:eval (if (buffer-file-name) | ||
| (abbreviate-file-name (buffer-file-name)) | ||
| "%b")))) | ||
|
|
||
| ;; use zenburn as the default theme | ||
| (load-theme prelude-theme t) | ||
|
|
||
| (provide 'prelude-ui) | ||
| ;;; prelude-ui.el ends here |
| @@ -1 +1 @@ | ||
| Good signature from 474F05837FBDEF9B GNU ELPA Signing Agent <elpasign@elpa.gnu.org> (trust undefined) created at 2015-05-10T05:05:02-0400 using DSA |
| @@ -3185,7 +3185,7 @@ | ||
| [(0) | ||
| nil "Resize a frame. In particular, fit a frame to its buffers." single]) | ||
| (firestarter . | ||
| [(0 1 2) | ||
| nil "Execute (shell) commands on save" single]) | ||
| (fiplr . | ||
| [(0 1 3) | ||
| @@ -0,0 +1 @@ | ||
| 136 eric eric <eric@hera> Mon May 11 11:09:06 2015 |
| @@ -0,0 +1,73 @@ | ||
| ;;; -*- coding: utf-8 -*- | ||
|
|
||
| ;; ----- ido-last-directory-list ----- | ||
| ( | ||
| ("/home/eric/src/" . "haskell/") | ||
| ("/home/eric/doc/" . "org/") | ||
| ("/home/eric/dotfiles/" . "zsh/") | ||
| ("/home/eric/" . "src/") | ||
| ("/home/" . "eric/") | ||
| ("/" . "home/") | ||
| ) | ||
|
|
||
| ;; ----- ido-work-directory-list ----- | ||
| ( | ||
| "/home/eric/" | ||
| "/home/eric/src/pdr/labs/lab02/" | ||
| "/home/eric/src/pdr/labs/lab01/" | ||
| "/home/eric/src/haskell/" | ||
| "/home/eric/doc/org/" | ||
| "/home/eric/dotfiles/zsh/" | ||
| ) | ||
|
|
||
| ;; ----- ido-work-file-list ----- | ||
| ( | ||
| ".emacs" | ||
| "List.cpp" | ||
| "ListTest.cpp" | ||
| "TestListNode.cpp" | ||
| "LifeCycle.cpp" | ||
| "lifecycle.cpp" | ||
| "LifeCycle.h" | ||
| "update_repos.sh" | ||
| "baby.hs" | ||
| "euler2.hs" | ||
| ) | ||
|
|
||
| ;; ----- ido-dir-file-cache ----- | ||
| ( | ||
| ("/home/eric/" (21845 6447 196093 755000) ".newsrc-dribble" ".zshrc" ".gnome2_private/" ".bashrc" ".config/" ".m2/" ".viminfo" "../" ".newsrc" ".archey3.cfg" ".dmrc" ".ghc/" ".xscreensaver" "src/" ".ICEauthority" ".profile" ".cabal/" ".offlineimap/" ".emacs" ".xsession-errors.old" ".zshrc.bak" ".vim/" ".vimperator/" ".zlogout.bak" "tmp/" ".git-credential-cache/" ".authinfo" ".gstreamer-0.10/" ".w3m/" ".python_history" ".java/" ".zhistory" ".zprezto/" "./" ".esd_auth" ".oh-my-zsh/" ".emacs.d/" ".i3/" ".gnome/" ".ipython/" ".mysql/" ".gitconfig" ".inputrc" ".fonts/" ".dbus/" ".weechat/" ".zshenv" ".mozilla/" "update_repos.sh" ".zcompdump-hera-5.0.7" ".i3status.conf" ".lyrics/" "dotfiles/" ".bash_logout" ".WebIde80/" ".ncmpcpp/" ".Xauthority" "beerlamp/" ".lein/" ".ssh/" ".vimperatorrc" ".zpreztorc" ".zlogout" ".gnus" ".zlogin.bak" ".cache/" ".maildir/" ".hplip/" ".gem/" ".zshenv.bak" "doc/" ".ideavimrc" ".offlineimaprc" "bin/" ".eclipse/" ".vimrc" ".nanorc" ".zsh_history" ".zlogin" ".pki/" ".Xdefaults" ".emacs.d.pre-prelude.tar" ".thumbnails/" "incoming/" ".zprofile" ".gnupg/" ".bash_profile" ".bash_history" ".ncmpcpprc" ".zcompdump" ".zprofile.bak" ".newsrc.eld" ".Skype/" ".local/" ".xsession-errors" ".emacs~" ".gnome2/") | ||
|
|
||
| ("/home/eric/src/" (21845 2448 339015 128000) "../" "cs2150/" "./" "pdr/" "gaps/" "gtg/" "haskell/") | ||
|
|
||
| ("/home/eric/src/pdr/" (21838 57738 48793 949000) "../" "tutorials/" ".git/" "cs2150/" "LICENSE.md" "Makefile" "markdown.css" "./" "slides/" "book/" ".gitignore" "index.html" "README.md" "ibcm/" "utils/" "LICENSE.html" "docs/" "labs/" "exams/" "README.html") | ||
|
|
||
| ("/home/eric/src/pdr/labs/" (21838 57737 968792 691000) "lab08/" "lab04/" "../" "index.md" "lab03/" "./" "index.html" "lab10/" "lab09/" "lab11/" "lab01/" "lab06/" "lab07/" "lab02/" "lab05/" "lab12/") | ||
|
|
||
| ("/home/eric/src/pdr/labs/lab02/" (21845 6190 457440 479000) "../" "List.h" "list-diagram.png" "index.md" "ListNode.h" "./" "TestListNode.cpp" "index.html" "list-diagram.dia" "List.h.html" "List.cpp" "ListNode.cpp" "ListNode.h.html" "list-diagram.svg" "ListTest.cpp.html" "ListTest.cpp" "ListItr.h" "ListItr.h.html") | ||
|
|
||
| ("/home/eric/src/pdr/labs/lab01/" (21845 2177 738264 289000) "lifecycle.cpp" "../" "index.md" "svtest.cpp" "svutil.h.html" "./" "TestLifeCycle.cpp" "svutil.cpp" "list.cpp.html" "svutil.h" "index.html" "LifeCycle.h" "xToN.cpp" "list.h" "lifecycle.cpp.html" "svtest.cpp.html" "list.h.html" "svutil.cpp.html" "list.cpp" "LifeCycle.cpp") | ||
|
|
||
| ("/home/eric/doc/org/" (21844 10159 546485 480000) "../" ".git/" "./" ".gitignore" "cpp.org" "README.md" "apartment.org" "beerlamp.org" "todo.org" "jazz.org") | ||
|
|
||
| ("/home/eric/src/haskell/" (21844 56036 449791 851000) "baby.hs" "../" "euler1.hi" ".#baby.hs" "./" "unixtools.hs" "problem2.hs" "euler1.hs" "problem1.hs" "haskell1to10.hs" "euler2.hs" ".#euler2.hs") | ||
|
|
||
| ("/home/eric/dotfiles/zsh/" (21844 49707 268217 725000) ".zshrc" "../" "./") | ||
|
|
||
| ("/home/eric/doc/" (21840 49530 244007 927000) "../" "org/" "./") | ||
|
|
||
| ("/home/eric/dotfiles/" (21837 30510 934356 415000) "sublime/" "screenshots/" "scripts/" "../" "pacman/" ".git/" "./" "i3/" "firefox/" "walls/" "vim/" ".gitignore" "README.md" "nmp_packages.txt" "bash/" "emacs/" "zsh/" "terminator/" "new-tab/") | ||
|
|
||
| ("/home/eric/.zprezto/" (21841 32622 237744 271000) "../" ".git/" "CONTRIBUTING.md" ".gitmodules" "./" ".gitignore" "init.zsh" "README.md" "modules/" "runcoms/") | ||
|
|
||
| ("/home/eric/.zprezto/runcoms/" (21841 32622 241077 634000) "../" "zpreztorc" "zlogout" "./" "README.md" "zshenv" "zprofile" "zlogin" "zshrc") | ||
|
|
||
| ("/home/" (21837 30368 29186 13000) "../" "eric/" "./") | ||
|
|
||
| ("/home/eric/Documents/" (21840 49530 244007 927000) "../" "org/" "./") | ||
|
|
||
| ("/home/eric/Documents/org/" (21841 306 402052 119000) "../" ".git/" "./" ".#beerlamp.org" ".gitignore" "README.md" "#beerlamp.org#" "beerlamp.org") | ||
| ) | ||
|
|
||
| ;; ----- ido-unc-hosts-cache ----- | ||
| t |
| @@ -0,0 +1,135 @@ | ||
| ;;; init.el --- Prelude's configuration entry point. | ||
| ;; | ||
| ;; Copyright (c) 2011 Bozhidar Batsov | ||
| ;; | ||
| ;; Author: Bozhidar Batsov <bozhidar@batsov.com> | ||
| ;; URL: http://batsov.com/prelude | ||
| ;; Version: 1.0.0 | ||
| ;; Keywords: convenience | ||
|
|
||
| ;; This file is not part of GNU Emacs. | ||
|
|
||
| ;;; Commentary: | ||
|
|
||
| ;; This file simply sets up the default load path and requires | ||
| ;; the various modules defined within Emacs Prelude. | ||
|
|
||
| ;;; License: | ||
|
|
||
| ;; This program is free software; you can redistribute it and/or | ||
| ;; modify it under the terms of the GNU General Public License | ||
| ;; as published by the Free Software Foundation; either version 3 | ||
| ;; of the License, or (at your option) any later version. | ||
| ;; | ||
| ;; This program is distributed in the hope that it will be useful, | ||
| ;; but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| ;; GNU General Public License for more details. | ||
| ;; | ||
| ;; You should have received a copy of the GNU General Public License | ||
| ;; along with GNU Emacs; see the file COPYING. If not, write to the | ||
| ;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | ||
| ;; Boston, MA 02110-1301, USA. | ||
|
|
||
| ;;; Code: | ||
| (defvar current-user | ||
| (getenv | ||
| (if (equal system-type 'windows-nt) "USERNAME" "USER"))) | ||
|
|
||
| (message "Prelude is powering up... Be patient, Master %s!" current-user) | ||
|
|
||
| (when (version< emacs-version "24.1") | ||
| (error "Prelude requires at least GNU Emacs 24.1, but you're running %s" emacs-version)) | ||
|
|
||
| ;; Always load newest byte code | ||
| (setq load-prefer-newer t) | ||
|
|
||
| (defvar prelude-dir (file-name-directory load-file-name) | ||
| "The root dir of the Emacs Prelude distribution.") | ||
| (defvar prelude-core-dir (expand-file-name "core" prelude-dir) | ||
| "The home of Prelude's core functionality.") | ||
| (defvar prelude-modules-dir (expand-file-name "modules" prelude-dir) | ||
| "This directory houses all of the built-in Prelude modules.") | ||
| (defvar prelude-personal-dir (expand-file-name "personal" prelude-dir) | ||
| "This directory is for your personal configuration. | ||
| Users of Emacs Prelude are encouraged to keep their personal configuration | ||
| changes in this directory. All Emacs Lisp files there are loaded automatically | ||
| by Prelude.") | ||
| (defvar prelude-personal-preload-dir (expand-file-name "preload" prelude-personal-dir) | ||
| "This directory is for your personal configuration, that you want loaded before Prelude.") | ||
| (defvar prelude-vendor-dir (expand-file-name "vendor" prelude-dir) | ||
| "This directory houses packages that are not yet available in ELPA (or MELPA).") | ||
| (defvar prelude-savefile-dir (expand-file-name "savefile" prelude-dir) | ||
| "This folder stores all the automatically generated save/history-files.") | ||
| (defvar prelude-modules-file (expand-file-name "prelude-modules.el" prelude-dir) | ||
| "This files contains a list of modules that will be loaded by Prelude.") | ||
|
|
||
| (unless (file-exists-p prelude-savefile-dir) | ||
| (make-directory prelude-savefile-dir)) | ||
|
|
||
| (defun prelude-add-subfolders-to-load-path (parent-dir) | ||
| "Add all level PARENT-DIR subdirs to the `load-path'." | ||
| (dolist (f (directory-files parent-dir)) | ||
| (let ((name (expand-file-name f parent-dir))) | ||
| (when (and (file-directory-p name) | ||
| (not (string-prefix-p "." f))) | ||
| (add-to-list 'load-path name) | ||
| (prelude-add-subfolders-to-load-path name))))) | ||
|
|
||
| ;; add Prelude's directories to Emacs's `load-path' | ||
| (add-to-list 'load-path prelude-core-dir) | ||
| (add-to-list 'load-path prelude-modules-dir) | ||
| (add-to-list 'load-path prelude-vendor-dir) | ||
| (prelude-add-subfolders-to-load-path prelude-vendor-dir) | ||
|
|
||
| ;; reduce the frequency of garbage collection by making it happen on | ||
| ;; each 50MB of allocated data (the default is on every 0.76MB) | ||
| (setq gc-cons-threshold 50000000) | ||
|
|
||
| ;; warn when opening files bigger than 100MB | ||
| (setq large-file-warning-threshold 100000000) | ||
|
|
||
| ;; preload the personal settings from `prelude-personal-preload-dir' | ||
| (when (file-exists-p prelude-personal-preload-dir) | ||
| (message "Loading personal configuration files in %s..." prelude-personal-preload-dir) | ||
| (mapc 'load (directory-files prelude-personal-preload-dir 't "^[^#].*el$"))) | ||
|
|
||
| (message "Loading Prelude's core...") | ||
|
|
||
| ;; the core stuff | ||
| (require 'prelude-packages) | ||
| (require 'prelude-custom) ;; Needs to be loaded before core, editor and ui | ||
| (require 'prelude-ui) | ||
| (require 'prelude-core) | ||
| (require 'prelude-mode) | ||
| (require 'prelude-editor) | ||
| (require 'prelude-global-keybindings) | ||
|
|
||
| ;; OSX specific settings | ||
| (when (eq system-type 'darwin) | ||
| (require 'prelude-osx)) | ||
|
|
||
| (message "Loading Prelude's modules...") | ||
|
|
||
| ;; the modules | ||
| (if (file-exists-p prelude-modules-file) | ||
| (load prelude-modules-file) | ||
| (message "Missing modules file %s" prelude-modules-file) | ||
| (message "You can get started by copying the bundled example file")) | ||
|
|
||
| ;; config changes made through the customize UI will be store here | ||
| (setq custom-file (expand-file-name "custom.el" prelude-personal-dir)) | ||
|
|
||
| ;; load the personal settings (this includes `custom-file') | ||
| (when (file-exists-p prelude-personal-dir) | ||
| (message "Loading personal configuration files in %s..." prelude-personal-dir) | ||
| (mapc 'load (directory-files prelude-personal-dir 't "^[^#].*el$"))) | ||
|
|
||
| (message "Prelude is ready to do thy bidding, Master %s!" current-user) | ||
|
|
||
| (prelude-eval-after-init | ||
| ;; greet the use with some useful tip | ||
| (run-at-time 5 nil 'prelude-tip-of-the-day)) | ||
|
|
||
| ;;; init.el ends here |
| @@ -0,0 +1,96 @@ | ||
| # Makefile - for the org-mode distribution | ||
| # GNU make is required | ||
| # | ||
| # This file is not part of GNU Emacs | ||
|
|
||
| # set up environment | ||
| include mk/default.mk # defaults, customizable via "local.mk" | ||
| -include local.mk # optional local customization, use default.mk as template | ||
|
|
||
| # default target is "all" unless overridden in local.mk | ||
| all:: | ||
|
|
||
| # Describe valid make targets for org-mode. | ||
| .PHONY: targets help helpall | ||
| targets: help | ||
| help helpall:: | ||
| $(info ) | ||
| $(info Getting Help) | ||
| $(info ============) | ||
| $(info make help - show brief help) | ||
| $(info make targets - ditto) | ||
| $(info make helpall - show extended help) | ||
| $(info ) | ||
| $(info Build and Check) | ||
| $(info ===============) | ||
| $(info make - build Org ELisp and all documentation) | ||
| $(info make all - ditto) | ||
| $(info make compile - build Org ELisp files) | ||
| $(info make single - build Org ELisp files, single Emacs per source) | ||
| $(info make autoloads - create org-loaddefs.el to load Org in-place) | ||
| $(info make test - build Org ELisp files and run test suite) | ||
| helpall:: | ||
| $(info make test-dirty - check without building first) | ||
| $(info make compile-dirty - build only stale Org ELisp files) | ||
| $(info ) | ||
| $(info Compatibility) | ||
| $(info =============) | ||
| $(info make oldorg - what the old make did: compile autoloads info) | ||
| $(info ) | ||
| $(info Cleaning) | ||
| $(info ========) | ||
| $(info make clean - remove built Org ELisp files and documentation) | ||
| $(info make cleanall - remove everything that can be built and all remnants) | ||
| $(info make clean-install - remove previous Org installation) | ||
| $(info ) | ||
| $(info Configuration Check) | ||
| $(info ===================) | ||
| help helpall:: | ||
| $(info make config - check main configuration) | ||
| helpall:: | ||
| $(info make config-version - check Org version) | ||
| $(info make config-test - check test configuration) | ||
| $(info make config-exe - check executables configuration) | ||
| $(info make config-cmd - check command configuration) | ||
| $(info make config-all - check all configuration) | ||
| $(info ) | ||
| $(info Documentation) | ||
| $(info =============) | ||
| help helpall:: | ||
| $(info make doc - build all documentation) | ||
| helpall:: | ||
| $(info make docs - ditto) | ||
| help helpall:: | ||
| $(info make info - build Info documentation) | ||
| helpall:: | ||
| $(info make html - build HTML documentation) | ||
| $(info make pdf - build PDF documentation) | ||
| $(info make card - build reference cards) | ||
| $(info make refcard - ditto) | ||
| help helpall:: | ||
| $(info ) | ||
| $(info Installation) | ||
| $(info ============) | ||
| $(info make install - build and install Org) | ||
| helpall:: | ||
| $(info make install-etc - build and install files in /etc) | ||
| $(info make install-lisp - build and install Org Elisp files) | ||
| $(info make install-info - build and install Info documentation) | ||
| $(info ) | ||
| $(info Convenience) | ||
| $(info ===========) | ||
| $(info make up0 - pull from upstream) | ||
| $(info make up1 - pull from upstream, build and check) | ||
| $(info make up2 - pull from upstream, build, check and install) | ||
| $(info make update - pull from upstream and build) | ||
| $(info make update2 - pull from upstream, build and install) | ||
| $(info make uncompiled - combine cleanlisp and autoloads) | ||
| $(info make local.mk - create new local.mk as template for adaptation) | ||
| help helpall:: | ||
| $(info ) | ||
| $(info Full documentation on Worg) | ||
| $(info ==========================) | ||
| $(info http://orgmode.org/worg/dev/org-build-system.html) | ||
| @echo "" | ||
|
|
||
| include mk/targets.mk # toplevel make machinery |
| @@ -0,0 +1,47 @@ | ||
| The is a distribution of Org, a plain text notes and project planning | ||
| tool for Emacs. | ||
|
|
||
| The homepage of Org is at: | ||
| http://orgmode.org | ||
|
|
||
| The installations instructions are at: | ||
| http://orgmode.org/org.html#Installation | ||
|
|
||
| This distribution contains: | ||
|
|
||
| README | ||
| This file. | ||
|
|
||
| COPYING | ||
| The GNU General Public License. | ||
|
|
||
| Makefile | ||
| The makefile to compile and install Org. For installation | ||
| instructions, see the manual or the more detailed procedure | ||
| on Worg: http://orgmode.org/worg/dev/org-build-system.html | ||
|
|
||
| mk/ | ||
| Files needed for building Org. | ||
|
|
||
| lisp/ | ||
| Directory with all the Emacs Lisp files that make up Org. | ||
|
|
||
| doc/ | ||
| The documentation files. org.texi is the source of the | ||
| documentation, org.html and org.pdf are formatted versions of it. | ||
|
|
||
| contrib/ | ||
| A directory with third-party additions for Org. Some really cool | ||
| stuff is in there. | ||
|
|
||
| etc/ | ||
| Files needed for the ODT exporter. | ||
|
|
||
| testing/ | ||
| Testing suite for Org. | ||
|
|
||
| request-assign-future.txt | ||
| The form that contributors have to sign and get processed with | ||
| the FSF before contributed changes can be integrated into the Org | ||
| core. All files in this distribution except the contrib/ directory | ||
| have copyright assigned to the FSF. |
| @@ -0,0 +1,100 @@ | ||
| This directory contains add-ons to Org-mode. | ||
|
|
||
| These contributions are not part of GNU Emacs or of the official | ||
| Org-mode package. But the git repository for Org-mode is glad to | ||
| provide useful way to distribute and develop them as long as they | ||
| are distributed under a free software license. | ||
|
|
||
| Please put your contribution in one of these directories: | ||
|
|
||
| LISP (Emacs Lisp) | ||
| ================= | ||
|
|
||
| Org utils | ||
| ~~~~~~~~~ | ||
| org-annotate-file.el --- Annotate a file with org syntax | ||
| org-bibtex-extras.el --- Extras for working with org-bibtex entries | ||
| org-bookmark.el --- Links to bookmarks | ||
| org-bullets.el --- Show bullets in org-mode as UTF-8 characters | ||
| org-checklist.el --- org functions for checklist handling | ||
| org-choose.el --- Use TODO keywords to mark decision states | ||
| org-collector.el --- Collect properties into tables | ||
| org-colview-xemacs.el --- Column View in Org-mode, XEmacs-specific version | ||
| org-contacts.el --- Contacts management | ||
| org-contribdir.el --- Dummy file to mark the org contrib Lisp directory | ||
| org-depend.el --- TODO dependencies for Org-mode | ||
| org-drill.el --- Self-testing with org-learn | ||
| org-element.el --- Parser and applications for Org syntax | ||
| org-elisp-symbol.el --- Org links to emacs-lisp symbols | ||
| org-eval-light.el --- Evaluate in-buffer code on demand | ||
| org-eval.el --- The <lisp> tag, adapted from Muse | ||
| org-expiry.el --- Expiry mechanism for Org entries | ||
| org-export-generic.el --- Export framework for configurable backends | ||
| org-favtable.el --- Lookup table of favorite references and links | ||
| org-git-link.el --- Provide org links to specific file version | ||
| org-interactive-query.el --- Interactive modification of tags query | ||
| org-invoice.el --- Help manage client invoices in OrgMode | ||
| org-jira.el --- Add a jira:ticket protocol to Org | ||
| org-learn.el --- SuperMemo's incremental learning algorithm | ||
| org-mac-iCal.el --- Imports events from iCal.app to the Emacs diary | ||
| org-mac-link-grabber.el --- Grab links and URLs from various Mac applications | ||
| org-mac-message.el --- Links to Apple Mail.app messages from within Org-mode | ||
| org-mairix.el --- Hook mairix search into Org for different MUAs | ||
| org-man.el --- Support for links to manpages in Org-mode | ||
| org-mew.el --- Support for links to Mew messages | ||
| org-mime.el --- org html export for text/html MIME emails | ||
| org-mtags.el --- Support for some Muse-like tags in Org-mode | ||
| org-notify.el --- Notifications for Org-mode | ||
| org-notmuch.el --- Support for links to notmuch messages | ||
| org-panel.el --- Simple routines for us with bad memory | ||
| org-registry.el --- A registry for Org links | ||
| org-screen.el --- Visit screen sessions through Org-mode links | ||
| org-screenshot.el --- Take and manage screenshots in Org-mode files | ||
| org-secretary.el --- Team management with org-mode | ||
| org-static-mathjax.el --- Muse-like tags in Org-mode | ||
| org-sudoku.el --- Create and solve SUDOKU puzzles in Org tables | ||
| org-toc.el --- Table of contents for Org-mode buffer | ||
| org-track.el --- Keep up with Org development | ||
| org-velocity.el --- something like Notational Velocity for Org | ||
| org-vm.el --- Support for links to VM messages | ||
| org-w3m.el --- Support link/copy/paste from w3m to Org-mode | ||
| org-wikinodes.el --- CamelCase wiki-like links for Org | ||
| org-wl.el --- Support for links to Wanderlust messages | ||
| orgtbl-sqlinsert.el --- Convert Org-mode tables to SQL insertions | ||
|
|
||
| Org exporters | ||
| ~~~~~~~~~~~~~ | ||
| ox-confluence.el --- Confluence Wiki exporter | ||
| ox-deck.el --- deck.js presentations exporter | ||
| ox-groff.el --- Groff exporter | ||
| ox-koma-letter.el --- KOMA Scrlttr2 exporter | ||
| ox-rss.el --- RSS 2.0 exporter | ||
| ox-s5.el --- S5 presentations exporter | ||
| ox-taskjuggler.el --- TaskJuggler exporter | ||
|
|
||
| Org Babel languages | ||
| ~~~~~~~~~~~~~~~~~~~ | ||
| ob-eukleides.el --- Org-babel functions for eukleides evaluation | ||
| ob-fomus.el --- Org-babel functions for fomus evaluation | ||
| ob-julia.el --- Org-babel functions for julia evaluation | ||
| ob-mathomatic.el --- Org-babel functions for mathomatic evaluation | ||
| ob-oz.el --- Org-babel functions for Oz evaluation | ||
| ob-tcl.el --- Org-babel functions for tcl evaluation | ||
|
|
||
| External libraries | ||
| ~~~~~~~~~~~~~~~~~~ | ||
| htmlize.el --- Convert buffer text and decorations to HTML | ||
|
|
||
|
|
||
| SCRIPTS (shell, bash, etc.) | ||
| =========================== | ||
| StartOzServer.oz --- implements the Oz-side of the Org-babel Oz interface | ||
| dir2org.zsh --- Org compatible fs structure output | ||
| ditaa.jar --- ASCII to PNG converter by Stathis Sideris, GPL | ||
| org-docco.org --- docco side-by-side annotated code export to HTML | ||
| org2hpda --- Generate hipster pda style printouts from Org-mode | ||
| staticmathjax --- XULRunner application to process MathJax statically | ||
| x11idle.c --- get the idle time of your X session | ||
|
|
||
| This directory also contains supporting files for the following | ||
| packages: ob-oz.el, org-docco.org, and org-static-mathjax.el. |
| @@ -0,0 +1,98 @@ | ||
| ;;; ob-eukleides.el --- Org-babel functions for eukleides evaluation | ||
|
|
||
| ;; Copyright (C) 2010-2014 Free Software Foundation, Inc. | ||
|
|
||
| ;; Author: Luis Anaya | ||
| ;; Keywords: literate programming, reproducible research | ||
| ;; Homepage: http://orgmode.org | ||
|
|
||
| ;; This file is not part of GNU Emacs. | ||
|
|
||
| ;; This program is free software: you can redistribute it and/or modify | ||
| ;; it under the terms of the GNU General Public License as published by | ||
| ;; the Free Software Foundation, either version 3 of the License, or | ||
| ;; (at your option) any later version. | ||
|
|
||
| ;; This program is distributed in the hope that it will be useful, | ||
| ;; but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| ;; GNU General Public License for more details. | ||
|
|
||
| ;; You should have received a copy of the GNU General Public License | ||
| ;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. | ||
|
|
||
| ;;; Commentary: | ||
|
|
||
| ;; Org-Babel support for evaluating eukleides script. | ||
| ;; | ||
| ;; Inspired by Ian Yang's org-export-blocks-format-eukleides | ||
| ;; http://www.emacswiki.org/emacs/org-export-blocks-format-eukleides.el | ||
|
|
||
| ;;; Requirements: | ||
|
|
||
| ;; eukleides | http://eukleides.org | ||
| ;; eukleides | `org-eukleides-path' should point to the eukleides executablexs | ||
|
|
||
| ;;; Code: | ||
| (require 'ob) | ||
| (require 'ob-eval) | ||
|
|
||
| (defvar org-babel-default-header-args:eukleides | ||
| '((:results . "file") (:exports . "results")) | ||
| "Default arguments for evaluating a eukleides source block.") | ||
|
|
||
| (defcustom org-eukleides-path nil | ||
| "Path to the eukleides executable file." | ||
| :group 'org-babel | ||
| :type 'string) | ||
|
|
||
| (defcustom org-eukleides-eps-to-raster nil | ||
| "Command used to convert EPS to raster. Nil for no conversion." | ||
| :group 'org-babel | ||
| :type '(choice | ||
| (repeat :tag "Shell Command Sequence" (string :tag "Shell Command")) | ||
| (const :tag "sam2p" "a=%s;b=%s;sam2p ${a} ${b}" ) | ||
| (const :tag "NetPNM" "a=%s;b=%s;pstopnm -stdout ${a} | pnmtopng > ${b}" ) | ||
| (const :tag "None" nil))) | ||
|
|
||
| (defun org-babel-execute:eukleides (body params) | ||
| "Execute a block of eukleides code with org-babel. | ||
| This function is called by `org-babel-execute-src-block'." | ||
| (let* ((result-params (split-string (or (cdr (assoc :results params)) ""))) | ||
| (out-file (or (cdr (assoc :file params)) | ||
| (error "Eukleides requires a \":file\" header argument"))) | ||
| (cmdline (cdr (assoc :cmdline params))) | ||
| (in-file (org-babel-temp-file "eukleides-")) | ||
| (java (or (cdr (assoc :java params)) "")) | ||
| (cmd (if (not org-eukleides-path) | ||
| (error "`org-eukleides-path' is not set") | ||
| (concat (expand-file-name org-eukleides-path) | ||
| " -b --output=" | ||
| (org-babel-process-file-name | ||
| (concat | ||
| (file-name-sans-extension out-file) ".eps")) | ||
| " " | ||
| (org-babel-process-file-name in-file))))) | ||
| (unless (file-exists-p org-eukleides-path) | ||
| (error "Could not find eukleides at %s" org-eukleides-path)) | ||
|
|
||
| (if (string= (file-name-extension out-file) "png") | ||
| (if org-eukleides-eps-to-raster | ||
| (shell-command (format org-eukleides-eps-to-raster | ||
| (concat (file-name-sans-extension out-file) ".eps") | ||
| (concat (file-name-sans-extension out-file) ".png"))) | ||
| (error "Conversion to PNG not supported. use a file with an EPS name"))) | ||
|
|
||
| (with-temp-file in-file (insert body)) | ||
| (message "%s" cmd) (org-babel-eval cmd "") | ||
| nil)) ;; signal that output has already been written to file | ||
|
|
||
| (defun org-babel-prep-session:eukleides (session params) | ||
| "Return an error because eukleides does not support sessions." | ||
| (error "Eukleides does not support sessions")) | ||
|
|
||
| (provide 'ob-eukleides) | ||
|
|
||
|
|
||
|
|
||
| ;;; ob-eukleides.el ends here |
| @@ -0,0 +1,92 @@ | ||
| ;;; ob-fomus.el --- Org-babel functions for fomus evaluation | ||
|
|
||
| ;; Copyright (C) 2011-2014 Torsten Anders | ||
|
|
||
| ;; Author: Torsten Anders | ||
| ;; Keywords: literate programming, reproducible research | ||
| ;; Homepage: http://orgmode.org | ||
|
|
||
| ;; This file is not part of GNU Emacs. | ||
|
|
||
| ;; This program is free software; you can redistribute it and/or modify | ||
| ;; it under the terms of the GNU General Public License as published by | ||
| ;; the Free Software Foundation; either version 3, or (at your option) | ||
| ;; any later version. | ||
| ;; | ||
| ;; This program is distributed in the hope that it will be useful, | ||
| ;; but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| ;; GNU General Public License for more details. | ||
| ;; | ||
| ;; You should have received a copy of the GNU General Public License | ||
| ;; along with GNU Emacs; see the file COPYING. If not, write to the | ||
| ;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | ||
| ;; Boston, MA 02110-1301, USA. | ||
|
|
||
| ;;; Commentary: | ||
|
|
||
| ;; Org-Babel support for evaluating Fomus source code. | ||
| ;; For information on Fomus see http://fomus.sourceforge.net/ | ||
| ;; | ||
| ;; This differs from most standard languages in that | ||
| ;; | ||
| ;; 1) there is no such thing as a "session" in fomus | ||
| ;; | ||
| ;; 2) we are generally only going to return results of type "file" | ||
| ;; | ||
| ;; 3) we are adding the "file" and "cmdline" header arguments | ||
| ;; | ||
| ;; 4) there are no variables (at least for now) | ||
|
|
||
| ;;; Code: | ||
| (require 'ob) | ||
| (require 'ob-eval) | ||
|
|
||
| (defvar org-babel-default-header-args:fomus | ||
| '((:results . "file") (:exports . "results")) | ||
| "Default arguments to use when evaluating a fomus source block.") | ||
|
|
||
| (defun org-babel-expand-body:fomus (body params) | ||
| "Expand BODY according to PARAMS, return the expanded body." | ||
| (let ((vars (mapcar #'cdr (org-babel-get-header params :var)))) | ||
| (mapc | ||
| (lambda (pair) | ||
| (let ((name (symbol-name (car pair))) | ||
| (value (cdr pair))) | ||
| (setq body | ||
| (replace-regexp-in-string | ||
| (concat "\$" (regexp-quote name)) | ||
| (if (stringp value) value (format "%S" value)) | ||
| body)))) | ||
| vars) | ||
| body)) | ||
|
|
||
| (defun org-babel-execute:fomus (body params) | ||
| "Execute a block of Fomus code with org-babel. | ||
| This function is called by `org-babel-execute-src-block'." | ||
| (let* ((result-params (cdr (assoc :result-params params))) | ||
| (out-file (cdr (assoc :file params))) | ||
| (cmdline (cdr (assoc :cmdline params))) | ||
| (cmd (or (cdr (assoc :cmd params)) "fomus")) | ||
| (in-file (org-babel-temp-file "fomus-" ".fms"))) | ||
| (with-temp-file in-file | ||
| (insert (org-babel-expand-body:fomus body params))) | ||
| ;; TMP: testing | ||
| ;; (message (concat cmd | ||
| ;; " " (org-babel-process-file-name in-file) | ||
| ;; " " cmdline | ||
| ;; " -o " (org-babel-process-file-name out-file))) | ||
| (org-babel-eval | ||
| (concat cmd | ||
| " " (org-babel-process-file-name in-file) | ||
| " " cmdline | ||
| " -o " (org-babel-process-file-name out-file)) "") | ||
| nil)) ;; signal that output has already been written to file | ||
|
|
||
| (defun org-babel-prep-session:fomus (session params) | ||
| "Return an error because Fomus does not support sessions." | ||
| (error "Fomus does not support sessions")) | ||
|
|
||
| (provide 'ob-fomus) | ||
|
|
||
| ;;; ob-fomus.el ends here |
| @@ -0,0 +1,302 @@ | ||
| ;;; ob-julia.el --- org-babel functions for julia code evaluation | ||
|
|
||
| ;; Copyright (C) 2013, 2014 G. Jay Kerns | ||
| ;; Author: G. Jay Kerns, based on ob-R.el by Eric Schulte and Dan Davison | ||
|
|
||
| ;; This file is not part of GNU Emacs. | ||
|
|
||
| ;; This program is free software; you can redistribute it and/or modify | ||
| ;; it under the terms of the GNU General Public License as published by | ||
| ;; the Free Software Foundation; either version 3, or (at your option) | ||
| ;; any later version. | ||
| ;; | ||
| ;; This program is distributed in the hope that it will be useful, | ||
| ;; but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| ;; GNU General Public License for more details. | ||
| ;; | ||
| ;; You should have received a copy of the GNU General Public License | ||
| ;; along with GNU Emacs; see the file COPYING. If not, write to the | ||
| ;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | ||
| ;; Boston, MA 02110-1301, USA. | ||
|
|
||
| ;;; Commentary: | ||
|
|
||
| ;; The file provides Org-Babel support for evaluating julia code. | ||
| ;; | ||
| ;; See https://github.com/gjkerns/ob-julia/blob/master/ob-julia-doc.org | ||
| ;; for detailed instructions on how to get started. The git repository | ||
| ;; contains more documentation: git://github.com/gjkerns/ob-julia.git | ||
|
|
||
| ;;; Code: | ||
| (require 'ob) | ||
| (eval-when-compile (require 'cl)) | ||
|
|
||
| (declare-function orgtbl-to-csv "org-table" (table params)) | ||
| (declare-function julia "ext:ess-julia" (&optional start-args)) | ||
| (declare-function inferior-ess-send-input "ext:ess-inf" ()) | ||
| (declare-function ess-make-buffer-current "ext:ess-inf" ()) | ||
| (declare-function ess-eval-buffer "ext:ess-inf" (vis)) | ||
| (declare-function org-number-sequence "org-compat" (from &optional to inc)) | ||
| (declare-function org-remove-if-not "org" (predicate seq)) | ||
|
|
||
| (defconst org-babel-header-args:julia | ||
| '((width . :any) | ||
| (horizontal . :any) | ||
| (results . ((file list vector table scalar verbatim) | ||
| (raw org html latex code pp wrap) | ||
| (replace silent append prepend) | ||
| (output value graphics)))) | ||
| "julia-specific header arguments.") | ||
|
|
||
| (add-to-list 'org-babel-tangle-lang-exts '("julia" . "jl")) | ||
|
|
||
| (defvar org-babel-default-header-args:julia '()) | ||
|
|
||
| (defcustom org-babel-julia-command inferior-julia-program-name | ||
| "Name of command to use for executing julia code." | ||
| :group 'org-babel | ||
| :version "24.4" | ||
| :package-version '(Org . "8.0") | ||
| :type 'string) | ||
|
|
||
| (defvar ess-local-process-name) ; dynamically scoped | ||
| (defun org-babel-edit-prep:julia (info) | ||
| (let ((session (cdr (assoc :session (nth 2 info))))) | ||
| (when (and session (string-match "^\\*\\(.+?\\)\\*$" session)) | ||
| (save-match-data (org-babel-julia-initiate-session session nil))))) | ||
|
|
||
| (defun org-babel-expand-body:julia (body params &optional graphics-file) | ||
| "Expand BODY according to PARAMS, return the expanded body." | ||
| (let ((graphics-file | ||
| (or graphics-file (org-babel-julia-graphical-output-file params)))) | ||
| (mapconcat | ||
| #'identity | ||
| ((lambda (inside) | ||
| (if graphics-file | ||
| inside | ||
| inside)) | ||
| (append (org-babel-variable-assignments:julia params) | ||
| (list body))) "\n"))) | ||
|
|
||
| (defun org-babel-execute:julia (body params) | ||
| "Execute a block of julia code. | ||
| This function is called by `org-babel-execute-src-block'." | ||
| (save-excursion | ||
| (let* ((result-params (cdr (assoc :result-params params))) | ||
| (result-type (cdr (assoc :result-type params))) | ||
| (session (org-babel-julia-initiate-session | ||
| (cdr (assoc :session params)) params)) | ||
| (colnames-p (cdr (assoc :colnames params))) | ||
| (rownames-p (cdr (assoc :rownames params))) | ||
| (graphics-file (org-babel-julia-graphical-output-file params)) | ||
| (full-body (org-babel-expand-body:julia body params graphics-file)) | ||
| (result | ||
| (org-babel-julia-evaluate | ||
| session full-body result-type result-params | ||
| (or (equal "yes" colnames-p) | ||
| (org-babel-pick-name | ||
| (cdr (assoc :colname-names params)) colnames-p)) | ||
| (or (equal "yes" rownames-p) | ||
| (org-babel-pick-name | ||
| (cdr (assoc :rowname-names params)) rownames-p))))) | ||
| (if graphics-file nil result)))) | ||
|
|
||
| (defun org-babel-prep-session:julia (session params) | ||
| "Prepare SESSION according to the header arguments specified in PARAMS." | ||
| (let* ((session (org-babel-julia-initiate-session session params)) | ||
| (var-lines (org-babel-variable-assignments:julia params))) | ||
| (org-babel-comint-in-buffer session | ||
| (mapc (lambda (var) | ||
| (end-of-line 1) (insert var) (comint-send-input nil t) | ||
| (org-babel-comint-wait-for-output session)) var-lines)) | ||
| session)) | ||
|
|
||
| (defun org-babel-load-session:julia (session body params) | ||
| "Load BODY into SESSION." | ||
| (save-window-excursion | ||
| (let ((buffer (org-babel-prep-session:julia session params))) | ||
| (with-current-buffer buffer | ||
| (goto-char (process-mark (get-buffer-process (current-buffer)))) | ||
| (insert (org-babel-chomp body))) | ||
| buffer))) | ||
|
|
||
| ;; helper functions | ||
|
|
||
| (defun org-babel-variable-assignments:julia (params) | ||
| "Return list of julia statements assigning the block's variables." | ||
| (let ((vars (mapcar #'cdr (org-babel-get-header params :var)))) | ||
| (mapcar | ||
| (lambda (pair) | ||
| (org-babel-julia-assign-elisp | ||
| (car pair) (cdr pair) | ||
| (equal "yes" (cdr (assoc :colnames params))) | ||
| (equal "yes" (cdr (assoc :rownames params))))) | ||
| (mapcar | ||
| (lambda (i) | ||
| (cons (car (nth i vars)) | ||
| (org-babel-reassemble-table | ||
| (cdr (nth i vars)) | ||
| (cdr (nth i (cdr (assoc :colname-names params)))) | ||
| (cdr (nth i (cdr (assoc :rowname-names params))))))) | ||
| (org-number-sequence 0 (1- (length vars))))))) | ||
|
|
||
| (defun org-babel-julia-quote-csv-field (s) | ||
| "Quote field S for export to julia." | ||
| (if (stringp s) | ||
| (concat "\"" (mapconcat 'identity (split-string s "\"") "\"\"") "\"") | ||
| (format "%S" s))) | ||
|
|
||
| (defun org-babel-julia-assign-elisp (name value colnames-p rownames-p) | ||
| "Construct julia code assigning the elisp VALUE to a variable named NAME." | ||
| (if (listp value) | ||
| (let ((max (apply #'max (mapcar #'length (org-remove-if-not | ||
| #'sequencep value)))) | ||
| (min (apply #'min (mapcar #'length (org-remove-if-not | ||
| #'sequencep value)))) | ||
| (transition-file (org-babel-temp-file "julia-import-"))) | ||
| ;; ensure VALUE has an orgtbl structure (depth of at least 2) | ||
| (unless (listp (car value)) (setq value (list value))) | ||
| (with-temp-file transition-file | ||
| (insert | ||
| (orgtbl-to-csv value '(:fmt org-babel-julia-quote-csv-field)) | ||
| "\n")) | ||
| (let ((file (org-babel-process-file-name transition-file 'noquote)) | ||
| (header (if (or (eq (nth 1 value) 'hline) colnames-p) | ||
| "TRUE" "FALSE")) | ||
| (row-names (if rownames-p "1" "NULL"))) | ||
| (if (= max min) | ||
| (format "%s = readcsv(\"%s\")" name file) | ||
| (format "%s = readcsv(\"%s\")" | ||
| name file)))) | ||
| (format "%s = %s" name (org-babel-julia-quote-csv-field value)))) | ||
|
|
||
| (defvar ess-ask-for-ess-directory) ; dynamically scoped | ||
|
|
||
| (defun org-babel-julia-initiate-session (session params) | ||
| "If there is not a current julia process then create one." | ||
| (unless (string= session "none") | ||
| (let ((session (or session "*julia*")) | ||
| (ess-ask-for-ess-directory | ||
| (and (and (boundp 'ess-ask-for-ess-directory) ess-ask-for-ess-directory) | ||
| (not (cdr (assoc :dir params)))))) | ||
| (if (org-babel-comint-buffer-livep session) | ||
| session | ||
| (save-window-excursion | ||
| (require 'ess) (julia) | ||
| (rename-buffer | ||
| (if (bufferp session) | ||
| (buffer-name session) | ||
| (if (stringp session) | ||
| session | ||
| (buffer-name)))) | ||
| (current-buffer)))))) | ||
|
|
||
| (defun org-babel-julia-associate-session (session) | ||
| "Associate julia code buffer with a julia session. | ||
| Make SESSION be the inferior ESS process associated with the | ||
| current code buffer." | ||
| (setq ess-local-process-name | ||
| (process-name (get-buffer-process session))) | ||
| (ess-make-buffer-current)) | ||
|
|
||
| (defun org-babel-julia-graphical-output-file (params) | ||
| "Name of file to which julia should send graphical output." | ||
| (and (member "graphics" (cdr (assq :result-params params))) | ||
| (cdr (assq :file params)))) | ||
|
|
||
| (defvar org-babel-julia-eoe-indicator "print(\"org_babel_julia_eoe\")") | ||
| (defvar org-babel-julia-eoe-output "org_babel_julia_eoe") | ||
|
|
||
| (defvar org-babel-julia-write-object-command "writecsv(\"%s\",%s)") | ||
|
|
||
| ;; The following was a very complicated write object command | ||
| ;; The replacement needs to add error catching | ||
| ;(defvar org-babel-julia-write-object-command "{function(object,transfer.file){object;invisible(if(inherits(try({tfile<-tempfile();write.table(object,file=tfile,sep=\"\\t\",na=\"nil\",row.names=%s,col.names=%s,quote=FALSE);file.rename(tfile,transfer.file)},silent=TRUE),\"try-error\")){if(!file.exists(transfer.file))file.create(transfer.file)})}}(object=%s,transfer.file=\"%s\")") | ||
|
|
||
| (defun org-babel-julia-evaluate | ||
| (session body result-type result-params column-names-p row-names-p) | ||
| "Evaluate julia code in BODY." | ||
| (if session | ||
| (org-babel-julia-evaluate-session | ||
| session body result-type result-params column-names-p row-names-p) | ||
| (org-babel-julia-evaluate-external-process | ||
| body result-type result-params column-names-p row-names-p))) | ||
|
|
||
| (defun org-babel-julia-evaluate-external-process | ||
| (body result-type result-params column-names-p row-names-p) | ||
| "Evaluate BODY in external julia process. | ||
| If RESULT-TYPE equals 'output then return standard output as a | ||
| string. If RESULT-TYPE equals 'value then return the value of the | ||
| last statement in BODY, as elisp." | ||
| (case result-type | ||
| (value | ||
| (let ((tmp-file (org-babel-temp-file "julia-"))) | ||
| (org-babel-eval org-babel-julia-command | ||
| (format org-babel-julia-write-object-command | ||
| (org-babel-process-file-name tmp-file 'noquote) | ||
| (format "begin\n%s\nend" body))) | ||
| (org-babel-julia-process-value-result | ||
| (org-babel-result-cond result-params | ||
| (with-temp-buffer | ||
| (insert-file-contents tmp-file) | ||
| (buffer-string)) | ||
| (org-babel-import-elisp-from-file tmp-file '(4))) | ||
| column-names-p))) | ||
| (output (org-babel-eval org-babel-julia-command body)))) | ||
|
|
||
| (defun org-babel-julia-evaluate-session | ||
| (session body result-type result-params column-names-p row-names-p) | ||
| "Evaluate BODY in SESSION. | ||
| If RESULT-TYPE equals 'output then return standard output as a | ||
| string. If RESULT-TYPE equals 'value then return the value of the | ||
| last statement in BODY, as elisp." | ||
| (case result-type | ||
| (value | ||
| (with-temp-buffer | ||
| (insert (org-babel-chomp body)) | ||
| (let ((ess-local-process-name | ||
| (process-name (get-buffer-process session))) | ||
| (ess-eval-visibly-p nil)) | ||
| (ess-eval-buffer nil))) | ||
| (let ((tmp-file (org-babel-temp-file "julia-"))) | ||
| (org-babel-comint-eval-invisibly-and-wait-for-file | ||
| session tmp-file | ||
| (format org-babel-julia-write-object-command | ||
| (org-babel-process-file-name tmp-file 'noquote) "ans")) | ||
| (org-babel-julia-process-value-result | ||
| (org-babel-result-cond result-params | ||
| (with-temp-buffer | ||
| (insert-file-contents tmp-file) | ||
| (buffer-string)) | ||
| (org-babel-import-elisp-from-file tmp-file '(4))) | ||
| column-names-p))) | ||
| (output | ||
| (mapconcat | ||
| #'org-babel-chomp | ||
| (butlast | ||
| (delq nil | ||
| (mapcar | ||
| (lambda (line) (when (> (length line) 0) line)) | ||
| (mapcar | ||
| (lambda (line) ;; cleanup extra prompts left in output | ||
| (if (string-match | ||
| "^\\([ ]*[>+\\.][ ]?\\)+\\([[0-9]+\\|[ ]\\)" line) | ||
| (substring line (match-end 1)) | ||
| line)) | ||
| (org-babel-comint-with-output (session org-babel-julia-eoe-output) | ||
| (insert (mapconcat #'org-babel-chomp | ||
| (list body org-babel-julia-eoe-indicator) | ||
| "\n")) | ||
| (inferior-ess-send-input)))))) "\n")))) | ||
|
|
||
| (defun org-babel-julia-process-value-result (result column-names-p) | ||
| "julia-specific processing of return value. | ||
| Insert hline if column names in output have been requested." | ||
| (if column-names-p | ||
| (cons (car result) (cons 'hline (cdr result))) | ||
| result)) | ||
|
|
||
| (provide 'ob-julia) | ||
|
|
||
| ;;; ob-julia.el ends here |