randre03

.spacemacs

Oct 15th, 2016
924
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lisp 51.50 KB | None | 0 0
  1. ;; -*- mode: emacs-lisp -*-
  2. ;; This file is loaded by Spacemacs at startup.
  3. ;; It must be stored in your home directory.
  4.  
  5. (defun dotspacemacs/layers ()
  6.   "Configuration Layers declaration.
  7. You should not put any user code in this function besides modifying the variable
  8. values."
  9.   (setq-default
  10.    ;; Base distribution to use. This is a layer contained in the directory
  11.    ;; `+distribution'. For now available distributions are `spacemacs-base'
  12.    ;; or `spacemacs'. (default 'spacemacs)
  13.    dotspacemacs-distribution 'spacemacs
  14.    ;; Lazy installation of layers (i.e. layers are installed only when a file
  15.    ;; with a supported type is opened). Possible values are `all', `unused'
  16.    ;; and `nil'. `unused' will lazy install only unused layers (i.e. layers
  17.    ;; not listed in variable `dotspacemacs-configuration-layers'), `all' will
  18.    ;; lazy install any layer that support lazy installation even the layers
  19.    ;; listed in `dotspacemacs-configuration-layers'. `nil' disable the lazy
  20.    ;; installation feature and you have to explicitly list a layer in the
  21.    ;; variable `dotspacemacs-configuration-layers' to install it.
  22.    ;; (default 'unused)
  23.    dotspacemacs-enable-lazy-installation 'unused
  24.    ;; If non-nil then Spacemacs will ask for confirmation before installing
  25.    ;; a layer lazily. (default t)
  26.    dotspacemacs-ask-for-lazy-installation nil
  27.    ;; If non-nil layers with lazy install support are lazy installed.
  28.    ;; List of additional paths where to look for configuration layers.
  29.    ;; Paths must have a trailing slash (i.e. `~/.mycontribs/')
  30.    dotspacemacs-configuration-layer-path '()
  31.    ;; List of configuration layers to load.
  32.    dotspacemacs-configuration-layers
  33.    '(
  34.      sql
  35.      ;; ----------------------------------------------------------------
  36.      ;; Example of useful layers you may want to use right away.
  37.      ;; Uncomment some layer names and press <SPC f e R> (Vim style) or
  38.      ;; <M-m f e R> (Emacs style) to install them.
  39.      ;; ----------------------------------------------------------------
  40.      (auto-completion :variables
  41.                       auto-completion-return-key-behavior 'complete
  42.                       auto-completion-tab-key-behavior 'complete
  43.                       auto-completion-complete-with-key-sequence nil
  44.                       auto-completion-enable-sort-by-usage t
  45.                       auto-completion-enable-help-tooltip t
  46.                       auto-completion-enable-snippets-in-popup t)
  47.      better-defaults
  48.      (clojure :variables
  49.               clojure-enable-fancify-symbols t)
  50.      dash
  51.      ;;elfeed
  52.      elixir
  53.      ;;elm
  54.      emacs-lisp
  55.      ;;erc
  56.      erlang
  57.      git
  58.      github
  59.      haskell
  60.      html
  61.      (ibuffer :variables
  62.               ibuffer-group-buffers-by 'modes)
  63.      ;;idris
  64.      ivy
  65.      java
  66.      javascript
  67.      ;;lua
  68.      markdown
  69.      ;;(mu4e :variables
  70.      ;;mu4e-account-alist t
  71.      ;;mu4e-enable-mode-line t
  72.      ;;mu4e-enable-notifications t
  73.      ;;mu4e-installation-path "/usr/share/emacs/site-lisp")
  74.      ;;ocaml
  75.      org
  76.      osx
  77.      ;;racket
  78.      ;;react
  79.      ;;ruby-on-rails
  80.      rust
  81.      scala
  82.      ;;scheme
  83.      semantic
  84.      (shell :variables
  85.             shell-default-shell 'ansi-term
  86.             shell-default-height 30
  87.             shell-default-position 'bottom)
  88.      spell-checking
  89.      (syntax-checking :variables
  90.                       flycheck-scalastylerc (expand-file-name "/Users/randre03/scalastyle_config.xml"))
  91.      ;; themes-megapack
  92.      version-control
  93.      vinegar
  94.      )
  95.    ;; List of additional packages that will be installed without being
  96.    ;; wrapped in a layer. If you need some configuration for these
  97.    ;; packages, then consider creating a layer. You can also put the
  98.    ;; configuration in `dotspacemacs/user-config'.
  99.    dotspacemacs-additional-packages '(assess ; improved elisp testing
  100.                                       beacon
  101.                                       clojure-cheatsheet
  102.                                       company-flx
  103.                                       eval-in-repl
  104.                                       evil-terminal-cursor-changer
  105.                                       flycheck-clojure
  106.                                       flycheck-tip
  107.                                       hyperbole
  108.                                       mode-icons
  109.                                       olivetti
  110.                                       tiny
  111.                                       tldr
  112.                                       slamhound
  113.                                       ;;slime ;currently using for scheme
  114.                                       ;;tabbar
  115.                                       )
  116.    ;; A list of packages that cannot be updated.
  117.    dotspacemacs-frozen-packages '()
  118.    ;; A list of packages that will not be installed and loaded.
  119.    dotspacemacs-excluded-packages '()
  120.    ;; Defines the behaviour of Spacemacs when installing packages.
  121.    ;; Possible values are `used-only', `used-but-keep-unused' and `all'.
  122.    ;; `used-only' installs only explicitly used packages and uninstall any
  123.    ;; unused packages as well as their unused dependencies.
  124.    ;; `used-but-keep-unused' installs only the used packages but won't uninstall
  125.    ;; them if they become unused. `all' installs *all* packages supported by
  126.    ;; Spacemacs and never uninstall them. (default is `used-only')
  127.    dotspacemacs-install-packages 'used-only))
  128.  
  129. (defun dotspacemacs/init ()
  130.   "Initialization function.
  131. This function is called at the very startup of Spacemacs initialization
  132. before layers configuration.
  133. You should not put any user code in there besides modifying the variable
  134. values."
  135.   ;; This setq-default sexp is an exhaustive list of all the supported
  136.   ;; spacemacs settings.
  137.   (setq-default
  138.    ;; If non nil ELPA repositories are contacted via HTTPS whenever it's
  139.    ;; possible. Set it to nil if you have no way to use HTTPS in your
  140.    ;; environment, otherwise it is strongly recommended to let it set to t.
  141.    ;; This variable has no effect if Emacs is launched with the parameter
  142.    ;; `--insecure' which forces the value of this variable to nil.
  143.    ;; (default t)
  144.    dotspacemacs-elpa-https t
  145.    ;; Maximum allowed time in seconds to contact an ELPA repository.
  146.    dotspacemacs-elpa-timeout 10
  147.    ;; If non nil then spacemacs will check for updates at startup
  148.    ;; when the current branch is not `develop'. Note that checking for
  149.    ;; new versions works via git commands, thus it calls GitHub services
  150.    ;; whenever you start Emacs. (default nil)
  151.    dotspacemacs-check-for-update nil
  152.    ;; If non-nil, a form that evaluates to a package directory. For example, to
  153.    ;; use different package directories for different Emacs versions, set this
  154.    ;; to `emacs-version'.
  155.    dotspacemacs-elpa-subdirectory nil
  156.    ;; One of `vim', `emacs' or `hybrid'.
  157.    ;; `hybrid' is like `vim' except that `insert state' is replaced by the
  158.    ;; `hybrid state' with `emacs' key bindings. The value can also be a list
  159.    ;; with `:variables' keyword (similar to layers). Check the editing styles
  160.    ;; section of the documentation for details on available variables.
  161.    ;; (default 'vim)
  162.    dotspacemacs-editing-style 'vim
  163.    ;; If non nil output loading progress in `*Messages*' buffer. (default nil)
  164.    dotspacemacs-verbose-loading nil
  165.    ;; Specify the startup banner. Default value is `official', it displays
  166.    ;; the official spacemacs logo. An integer value is the index of text
  167.    ;; banner, `random' chooses a random text banner in `core/banners'
  168.    ;; directory. A string value must be a path to an image format supported
  169.    ;; by your Emacs build.
  170.    ;; If the value is nil then no banner is displayed. (default 'official)
  171.    dotspacemacs-startup-banner 'official
  172.    ;; List of items to show in startup buffer or an association list of
  173.    ;; the form `(list-type . list-size)`. If nil then it is disabled.
  174.    ;; Possible values for list-type are:
  175.    ;; `recents' `bookmarks' `projects' `agenda' `todos'."
  176.    ;; List sizes may be nil, in which case
  177.    ;; `spacemacs-buffer-startup-lists-length' takes effect.
  178.    dotspacemacs-startup-lists '((recents . 10)
  179.                                 (projects . 7))
  180.    ;; True if the home buffer should respond to resize events.
  181.    dotspacemacs-startup-buffer-responsive t
  182.    ;; Default major mode of the scratch buffer (default `text-mode')
  183.    dotspacemacs-scratch-mode 'emacs-lisp-mode
  184.    ;; List of themes, the first of the list is loaded when spacemacs starts.
  185.    ;; Press <SPC> T n to cycle to the next theme in the list (works great
  186.    ;; with 2 themes variants, one dark and one light)
  187.    dotspacemacs-themes '(solarized-dark
  188.                          spacemacs-dark
  189.                          solarized-light)
  190.    ;; If non nil the cursor color matches the state color in GUI Emacs.
  191.    dotspacemacs-colorize-cursor-according-to-state t
  192.    ;; Default font, or prioritized list of fonts. `powerline-scale' allows to
  193.    ;; quickly tweak the mode-line size to make separators look not too crappy.
  194.    dotspacemacs-default-font '("Fira Code"
  195.                                :size 13
  196.                                :weight normal
  197.                                :width normal
  198.                                :powerline-scale 1.1)
  199.    ;; The leader key
  200.    dotspacemacs-leader-key "SPC"
  201.    ;; The leader key accessible in `emacs state' and `insert state'
  202.    ;; (default "M-m")
  203.    dotspacemacs-emacs-leader-key "M-m"
  204.    ;; Major mode leader key is a shortcut key which is the equivalent of
  205.    ;; pressing `<leader> m`. Set it to `nil` to disable it. (default ",")
  206.    dotspacemacs-major-mode-leader-key ","
  207.    ;; Major mode leader key accessible in `emacs state' and `insert state'.
  208.    ;; (default "C-M-m)
  209.    dotspacemacs-major-mode-emacs-leader-key "C-M-m"
  210.    ;; The key used for Emacs commands (M-x) (after pressing on the leader key).
  211.    ;; (default "SPC")
  212.    dotspacemacs-emacs-command-key "SPC"
  213.    ;; These variables control whether separate commands are bound in the GUI to
  214.    ;; the key pairs C-i, TAB and C-m, RET.
  215.    ;; Setting it to a non-nil value, allows for separate commands under <C-i>
  216.    ;; and TAB or <C-m> and RET.
  217.    ;; In the terminal, these pairs are generally indistinguishable, so this only
  218.    ;; works in the GUI. (default nil)
  219.    dotspacemacs-distinguish-gui-tab nil
  220.    ;; If non nil `Y' is remapped to `y$' in Evil states. (default nil)
  221.    dotspacemacs-remap-Y-to-y$ t
  222.    ;; If non-nil, the shift mappings `<' and `>' retain visual state if used
  223.    ;; there. (default t)
  224.    dotspacemacs-retain-visual-state-on-shift t
  225.    ;; If non-nil, J and K move lines up and down when in visual mode.
  226.    ;; (default nil)
  227.    dotspacemacs-visual-line-move-text t
  228.    ;; If non nil, inverse the meaning of `g' in `:substitute' Evil ex-command.
  229.    ;; (default nil)
  230.    dotspacemacs-ex-substitute-global nil
  231.    ;; Name of the default layout (default "Default")
  232.    dotspacemacs-default-layout-name "1*"
  233.    ;; If non nil the default layout name is displayed in the mode-line.
  234.    ;; (default nil)
  235.    dotspacemacs-display-default-layout nil
  236.    ;; If non nil then the last auto saved layouts are resume automatically upon
  237.    ;; start. (default nil)
  238.    dotspacemacs-auto-resume-layouts nil
  239.    ;; Size (in MB) above which spacemacs will prompt to open the large file
  240.    ;; literally to avoid performance issues. Opening a file literally means that
  241.    ;; no major mode or minor modes are active. (default is 1)
  242.    dotspacemacs-large-file-size 1
  243.    ;; Location where to auto-save files. Possible values are `original' to
  244.    ;; auto-save the file in-place, `cache' to auto-save the file to another
  245.    ;; file stored in the cache directory and `nil' to disable auto-saving.
  246.    ;; (default 'cache)
  247.    dotspacemacs-auto-save-file-location 'cache
  248.    ;; Maximum number of rollback slots to keep in the cache. (default 5)
  249.    dotspacemacs-max-rollback-slots 5
  250.    ;; If non nil, `helm' will try to minimize the space it uses. (default nil)
  251.    dotspacemacs-helm-resize nil
  252.    ;; if non nil, the helm header is hidden when there is only one source.
  253.    ;; (default nil)
  254.    dotspacemacs-helm-no-header nil
  255.    ;; define the position to display `helm', options are `bottom', `top',
  256.    ;; `left', or `right'. (default 'bottom)
  257.    dotspacemacs-helm-position 'bottom
  258.    ;; Controls fuzzy matching in helm. If set to `always', force fuzzy matching
  259.    ;; in all non-asynchronous sources. If set to `source', preserve individual
  260.    ;; source settings. Else, disable fuzzy matching in all sources.
  261.    ;; (default 'always)
  262.    dotspacemacs-helm-use-fuzzy 'always
  263.    ;; If non nil the paste micro-state is enabled. When enabled pressing `p`
  264.    ;; several times cycle between the kill ring content. (default nil)
  265.    dotspacemacs-enable-paste-micro-state t
  266.    ;; Which-key delay in seconds. The which-key buffer is the popup listing
  267.    ;; the commands bound to the current keystroke sequence. (default 0.4)
  268.    dotspacemacs-which-key-delay 0.4
  269.    ;; Which-key frame position. Possible values are `right', `bottom' and
  270.    ;; `right-then-bottom'. right-then-bottom tries to display the frame to the
  271.    ;; right; if there is insufficient space it displays it at the bottom.
  272.    ;; (default 'bottom)
  273.    dotspacemacs-which-key-position 'bottom
  274.    ;; If non nil a progress bar is displayed when spacemacs is loading. This
  275.    ;; may increase the boot time on some systems and emacs builds, set it to
  276.    ;; nil to boost the loading time. (default t)
  277.    dotspacemacs-loading-progress-bar nil
  278.    ;; If non nil the frame is fullscreen when Emacs starts up. (default nil)
  279.    ;; (Emacs 24.4+ only)
  280.    dotspacemacs-fullscreen-at-startup nil
  281.    ;; If non nil `spacemacs/toggle-fullscreen' will not use native fullscreen.
  282.    ;; Use to disable fullscreen animations in OSX. (default nil)
  283.    dotspacemacs-fullscreen-use-non-native nil
  284.    ;; If non nil the frame is maximized when Emacs starts up.
  285.    ;; Takes effect only if `dotspacemacs-fullscreen-at-startup' is nil.
  286.    ;; (default nil) (Emacs 24.4+ only)
  287.    dotspacemacs-maximized-at-startup t
  288.    ;; A value from the range (0..100), in increasing opacity, which describes
  289.    ;; the transparency level of a frame when it's active or selected.
  290.    ;; Transparency can be toggled through `toggle-transparency'. (default 90)
  291.    dotspacemacs-active-transparency 100
  292.    ;; A value from the range (0..100), in increasing opacity, which describes
  293.    ;; the transparency level of a frame when it's inactive or deselected.
  294.    ;; Transparency can be toggled through `toggle-transparency'. (default 90)
  295.    dotspacemacs-inactive-transparency 90
  296.    ;; If non nil show the titles of transient states. (default t)
  297.    dotspacemacs-show-transient-state-title t
  298.    ;; If non nil show the color guide hint for transient state keys. (default t)
  299.    dotspacemacs-show-transient-state-color-guide t
  300.    ;; If non nil unicode symbols are displayed in the mode line. (default t)
  301.    dotspacemacs-mode-line-unicode-symbols nil
  302.    ;; If non nil smooth scrolling (native-scrolling) is enabled. Smooth
  303.    ;; scrolling overrides the default behavior of Emacs which recenters point
  304.    ;; when it reaches the top or bottom of the screen. (default t)
  305.    dotspacemacs-smooth-scrolling nil
  306.    ;; If non nil line numbers are turned on in all `prog-mode' and `text-mode'
  307.    ;; derivatives. If set to `relative', also turns on relative line numbers.
  308.    ;; (default nil)
  309.    dotspacemacs-line-numbers 'relative
  310.    ;; Code folding method. Possible values are `evil' and `origami'.
  311.    ;; (default 'evil)
  312.    dotspacemacs-folding-method 'evil
  313.    ;; If non-nil smartparens-strict-mode will be enabled in programming modes.
  314.    ;; (default nil)
  315.    dotspacemacs-smartparens-strict-mode t
  316.    ;; If non-nil pressing the closing parenthesis `)' key in insert mode passes
  317.    ;; over any automatically added closing parenthesis, bracket, quote, etc…
  318.    ;; This can be temporary disabled by pressing `C-q' before `)'. (default nil)
  319.    dotspacemacs-smart-closing-parenthesis t
  320.    ;; Select a scope to highlight delimiters. Possible values are `any',
  321.    ;; `current', `all' or `nil'. Default is `all' (highlight any scope and
  322.    ;; emphasis the current one). (default 'all)
  323.    dotspacemacs-highlight-delimiters 'all
  324.    ;; If non nil, advise quit functions to keep server open when quitting.
  325.    ;; (default nil)
  326.    dotspacemacs-persistent-server t
  327.    ;; List of search tool executable names. Spacemacs uses the first installed
  328.    ;; tool of the list. Supported tools are `ag', `pt', `ack' and `grep'.
  329.    ;; (default '("ag" "pt" "ack" "grep"))
  330.    dotspacemacs-search-tools '("ag" "pt" "ack" "grep")
  331.    ;; The default package repository used if no explicit repository has been
  332.    ;; specified with an installed package.
  333.    ;; Not used for now. (default nil)
  334.    dotspacemacs-default-package-repository nil
  335.    ;; Delete whitespace while saving buffer. Possible values are `all'
  336.    ;; to aggressively delete empty line and long sequences of whitespace,
  337.    ;; `trailing' to delete only the whitespace at end of lines, `changed'to
  338.    ;; delete only whitespace for changed lines or `nil' to disable cleanup.
  339.    ;; (default nil)
  340.    dotspacemacs-whitespace-cleanup 'all))
  341.  
  342. (defun dotspacemacs/user-init ()
  343.   "Initialization function for user code.
  344. It is called immediately after `dotspacemacs/init'.  You are free to put almost
  345. any user code here.  The exception is org related code, which should be placed
  346. in `dotspacemacs/user-config'."
  347.  
  348.   ;; Start daemon at beginning to allow emacsclient -c (aliased to e in zsh)
  349.   (server-start)
  350.  
  351.   ;; Default Directory
  352.   (setq default-directory "/Users/randre03/Dropbox/"))
  353.  
  354. (defun dotspacemacs/user-config ()
  355.   "Configuration function for user code.
  356. This function is called at the very end of Spacemacs initialization after
  357. layers configuration. You are free to put any user code."
  358.  
  359.   ;; Enable cursor changing in terminal emacs-basic-display
  360.   (unless (display-graphic-p)
  361.     (require 'evil-terminal-cursor-changer)
  362.     (evil-terminal-cursor-changer-activate))
  363.   (setq evil-motion-state-cursor 'box)  ; █
  364.   (setq evil-visual-state-cursor 'box)  ; █
  365.   (setq evil-normal-state-cursor 'box)  ; █
  366.   (setq evil-insert-state-cursor 'bar)  ; ⎸
  367.   ;;(setq evil-replace-state-cursor 'hbar); _
  368.   (setq evil-emacs-state-cursor  'hbar) ; _
  369.  
  370.   ;; Start Hyperbole
  371.   (require 'hyperbole)
  372.  
  373.   ;; To enable mode-icons
  374.   (mode-icons-mode)
  375.  
  376.   ;; Support for Multiple Cursors
  377.   (global-evil-mc-mode)
  378.   (global-unset-key (kbd "M-<down-mouse-1>"))
  379.   (global-set-key (kbd "M-<mouse-1>") 'mc/add-cursor-on-click)
  380.  
  381.   ;; (mac-auto-operator-composition-mode) ;;This is just to be used on the railwaycat version (otherwise uncomment the code immediately below)
  382.   ;;Fira Code Font Settings
  383.   (when (window-system)
  384.     (set-default-font "Fira Code"))
  385.   (let ((alist '((33 . ".\\(?:\\(?:==\\|!!\\)\\|[!=]\\)")
  386.                  (35 . ".\\(?:###\\|##\\|_(\\|[#(?[_{]\\)")
  387.                  (36 . ".\\(?:>\\)")
  388.                  (37 . ".\\(?:\\(?:%%\\)\\|%\\)")
  389.                  (38 . ".\\(?:\\(?:&&\\)\\|&\\)")
  390.                  (42 . ".\\(?:\\(?:\\*\\*/\\)\\|\\(?:\\*[*/]\\)\\|[*/>]\\)")
  391.                  (43 . ".\\(?:\\(?:\\+\\+\\)\\|[+>]\\)")
  392.                  (45 . ".\\(?:\\(?:-[>-]\\|<<\\|>>\\)\\|[<>}~-]\\)")
  393.                  (46 . ".\\(?:\\(?:\\.[.<]\\)\\|[.=-]\\)")
  394.                  (47 . ".\\(?:\\(?:\\*\\*\\|//\\|==\\)\\|[*/=>]\\)")
  395.                  (48 . ".\\(?:x[a-zA-Z]\\)")
  396.                  (58 . ".\\(?:::\\|[:=]\\)")
  397.                  (59 . ".\\(?:;;\\|;\\)")
  398.                  (60 . ".\\(?:\\(?:!--\\)\\|\\(?:~~\\|->\\|\\$>\\|\\*>\\|\\+>\\|--\\|<[<=-]\\|=[<=>]\\||>\\)\\|[*$+~/<=>|-]\\)")
  399.                  (61 . ".\\(?:\\(?:/=\\|:=\\|<<\\|=[=>]\\|>>\\)\\|[<=>~]\\)")
  400.                  (62 . ".\\(?:\\(?:=>\\|>[=>-]\\)\\|[=>-]\\)")
  401.                  (63 . ".\\(?:\\(\\?\\?\\)\\|[:=?]\\)")
  402.                  (91 . ".\\(?:]\\)")
  403.                  (92 . ".\\(?:\\(?:\\\\\\\\\\)\\|\\\\\\)")
  404.                  (94 . ".\\(?:=\\)")
  405.                  (119 . ".\\(?:ww\\)")
  406.                  (123 . ".\\(?:-\\)")
  407.                  (124 . ".\\(?:\\(?:|[=|]\\)\\|[=>|]\\)")
  408.                  (126 . ".\\(?:~>\\|~~\\|[>=@~-]\\)")
  409.                  )
  410.                ))
  411.     (dolist (char-regexp alist)
  412.       (set-char-table-range composition-function-table (car char-regexp)
  413.                             `([,(cdr char-regexp) 0 font-shape-gstring]))))
  414.  
  415.   ;; Personal settings
  416.   (setq user-full-name "Roger E. Randall, II"
  417.         user-mail-address "roger.randall@gmail.com")
  418.   (setq sentence-end-double-space nil)  ; Sentences end in a single space
  419.  
  420.   ;; Disk space is cheap...save backups
  421.   (setq backup-directory-alist "~/.emacs.d/backups")
  422.   (setq delete-old-versions -1)
  423.   (setq version-control t)
  424.   (setq vc-make-backup-files t)
  425.  
  426.   ;;http://emacsredux.com/blog/2015/05/09/emacs-on-os-x/
  427.   (setq insert-directory-program (executable-find "gls"))
  428.  
  429.   ;; Allows Paradox to shows number of stars packages have
  430.   ;; DO NOT SHARE NUMBER
  431.   (setq paradox-github-token '740d11f134624f7ea8483a2d6c95e651643f7a64)
  432.  
  433.   ;; -----BEGIN-EMAIL-SETTINGS------------------
  434.  
  435.   (require 'mu4e)
  436.   (add-to-list 'load-path "/usr/local/Cellar/mu/0.9.16/share/emacs/site-lisp/mu/mu4e")
  437.   (setq mail-user-agent 'mu4e-user-agent)
  438.  
  439.   ;; make sure emacs finds applications in /usr/local/bin
  440.   ;; (setq exec-path (cons "/usr/local/bin" exec-path))
  441.  
  442.   (setq mu4e-view-prefer-html t)
  443.   (setq mu4e-html2text-command "/usr/local/bin/w3m -T text/html")
  444.  
  445.   (setq mu4e-attachment-dir  "~/Downloads")
  446.  
  447.   ;; use 'fancy' non-ascii characters in various places in mu4e
  448.   (setq mu4e-use-fancy-chars t)
  449.  
  450.   ;; enable inline images
  451.   (setq mu4e-view-show-images t)
  452.   ;; use imagemagick, if available
  453.   (when (fboundp 'imagemagick-register-types)
  454.     (imagemagick-register-types))
  455.  
  456.   (setq mu4e-account-alist
  457.         '(("gmail"
  458.            ;; Under each account, set the account-specific variables you want.
  459.            ;; don't save messages to Sent Messages, Gmail/IMAP takes care of this
  460.            (mu4e-sent-messages-behavior 'delete)
  461.            (mu4e-sent-folder "/gmail/[Gmail]/Sent Mail")
  462.            (mu4e-drafts-folder "/gmail/[Gmail]/Drafts")
  463.            ;;(user-mail-address "roger.randall@gmail.com")
  464.            ;;(user-full-name "Roger E. Randall")
  465.            )
  466.           ("exchange"
  467.            (mu4e-sent-messages-behavior 'delete)
  468.            (mu4e-sent-folder "/exchange/Sent Items")
  469.            (mu4e-drafts-folder "/exchange/Drafts")
  470.            ;;(user-mail-address "roger@rogerrandall.com")
  471.            ;;(user-full-name "Roger E. Randall, II")
  472.            )))
  473.   ;;(mu4e/mail-account-reset)
  474.  
  475.   (setq mu4e-contexts
  476.         `( ,(make-mu4e-context
  477.              :name "gmail"
  478.              :enter-func (lambda () (mu4e-message "Switch to gmail context"))
  479.              ;; leave-func not defined
  480.              :match-func (lambda (msg)
  481.                            (when msg
  482.                              (mu4e-message-contact-field-matches msg
  483.                                                                  :to "roger.randall@gmail.com")))
  484.              :vars '(  ( user-mail-address       . "roger.randall@gmail.com"  )
  485.                        ( user-full-name     . "Roger E. Randall" )
  486.                        ( mu4e-compose-signature .
  487.                                                 (concat
  488.                                                  "- Roger\n"))))
  489.            ,(make-mu4e-context
  490.              :name "exchange"
  491.              :enter-func (lambda () (mu4e-message "Switch to exchange context"))
  492.              ;; leave-fun not defined
  493.              :match-func (lambda (msg)
  494.                            (when msg
  495.                              (mu4e-message-contact-field-matches msg
  496.                                                                  :to "roger@rogerrandall.com")))
  497.              :vars '(  ( user-mail-address       . "roger@rogerrandall.com" )
  498.                        ( user-full-name     . "Roger E. Randall, II" )
  499.                        ( mu4e-compose-signature .
  500.                                                 (concat
  501.                                                  "Roger E. Randall, II\n"
  502.                                                  "Functional & Reactive Developer\n"))))))
  503.  
  504.   ;; set `mu4e-context-policy` and `mu4e-compose-policy` to tweak when mu4e should
  505.   ;; guess or ask the correct context, e.g.
  506.  
  507.   ;; start with the first (default) context;
  508.   ;; default is to ask-if-none (ask when there's no context yet, and none match)
  509.   (setq mu4e-context-policy 'pick-first)
  510.  
  511.   ;; compose with the current context is no context matches;
  512.   ;; default is to ask
  513.   (setq mu4e-compose-context-policy nil)
  514.  
  515.   ;; Set up some common mu4e variables
  516.   (setq mu4e-maildir "~/maildir"
  517.         mu4e-trash-folder "/Trash"
  518.         mu4e-refile-folder "/Archive"
  519.         mu4e-get-mail-command "mbsync -a"
  520.         mu4e-update-interval 300
  521.         mu4e-compose-signature-auto-include t
  522.         mu4e-view-show-images t
  523.         mu4e-view-show-addresses t)
  524.  
  525.   ;; Mail directory shortcuts
  526.   (setq mu4e-maildir-shortcuts
  527.         '(("/gmail/INBOX" . ?g)
  528.           ("/exchange/INBOX" . ?e)))
  529.  
  530.   ;; Bookmarks
  531.   (setq mu4e-bookmarks
  532.         `(("flag:unread AND NOT flag:trashed" "Unread messages" ?u)
  533.           ("date:today..now" "Today's messages" ?t)
  534.           ("date:7d..now" "Last 7 days" ?w)
  535.           ("mime:image/*" "Messages with images" ?p)
  536.           (,(mapconcat 'identity
  537.                        (mapcar
  538.                         (lambda (maildir)
  539.                           (concat "maildir:" (car maildir)))
  540.                         mu4e-maildir-shortcuts) " OR ")
  541.            "All inboxes" ?i)))
  542.  
  543.   ;; ATTACH FILES USING DIRED
  544.   (require 'gnus-dired)
  545.   ;; make the `gnus-dired-mail-buffers' function also work on
  546.   ;; message-mode derived modes, such as mu4e-compose-mode
  547.   (defun gnus-dired-mail-buffers ()
  548.     "Return a list of active message buffers."
  549.     (let (buffers)
  550.       (save-current-buffer
  551.         (dolist (buffer (buffer-list t))
  552.           (set-buffer buffer)
  553.           (when (and (derived-mode-p 'message-mode)
  554.                      (null message-sent-message-via))
  555.             (push (buffer-name buffer) buffers))))
  556.       (nreverse buffers)))
  557.  
  558.   (setq gnus-dired-mail-mode 'mu4e-user-agent)
  559.   (add-hook 'dired-mode-hook 'turn-on-gnus-dired-mode)
  560.  
  561.   ;; SENDING MAIL USING MSMTP
  562.   (setq message-send-mail-function 'message-send-mail-with-sendmail)
  563.   (setq sendmail-program "/usr/local/bin/msmtp")
  564.   ;; tell msmtp to choose the SMTP server according to the from field in the outgoing email
  565.   (setq message-sendmail-extra-arguments '("--read-envelope-from"))
  566.   (setq message-sendmail-f-is-evil 't)
  567.  
  568.   (setq message-kill-buffer-on-exit t)
  569.  
  570.   ;; -----END-OF-EMAIL-SETTINGS------------------
  571.  
  572.   ;; Show customized tabs
  573.   ;;(tabbar-mode)
  574.   ;;(setq tabbar-use-images nil) ; use characters instead of images to speed-up tabbar
  575.   ;;(global-set-key [M-left] 'tabbar-backward-tab)
  576.   ;;(global-set-key [M-right] 'tabbar-forward-tab)
  577.  
  578.   ;; Show filename and path in frame (titlebar)
  579.   (setq frame-title-format
  580.         '(:eval
  581.           (if buffer-file-name
  582.               (replace-regexp-in-string
  583.                "\\\\" "/"
  584.                (replace-regexp-in-string
  585.                 (regexp-quote (getenv "HOME")) "~"
  586.                 (convert-standard-filename buffer-file-name)))
  587.             (buffer-name))))
  588.  
  589.   ;; AUTO-COMPLETION SETTINGS
  590.   (global-company-mode)            ; Always use company-mode for auto-completion
  591.   (with-eval-after-load 'company
  592.     (company-flx-mode +1))
  593.   (setq company-tooltip-limit 20)  ; bigger popup window
  594.   (setq company-idle-delay .30) ; decrease delay before autocompletion popup shows
  595.   (setq company-echo-delay 0)   ; remove annoying blinking
  596.   (setq company-begin-commands '(self-insert-command)) ; start autocompletion only after typing
  597.  
  598.   ;; AGGRESSIVE INDENT SETTINGS
  599.   (global-aggressive-indent-mode 1)
  600.   (add-to-list 'aggressive-indent-excluded-modes 'html-mode)
  601.   (add-to-list 'aggressive-indent-excluded-modes 'scala-mode)
  602.  
  603.   ;; ADDITIONAL IBUFFER MODE SETTINGS
  604.   (setq ibuffer-show-empty-filter-groups nil) ; Don't show empty groups
  605.   (add-hook 'ibuffer-mode-hook                ; Keep iBuffer up to date
  606.             '(lambda ()
  607.                (ibuffer-auto-mode 1)))
  608.  
  609.   ;; Use Emacs terminfo, not system terminfo
  610.   (setq system-uses-terminfo nil)
  611.  
  612.   ;; CLOJURE CONFIG
  613.   (setq nrepl-hide-special-buffers t) ; hides non-essential nrepl buffers when you C-x b
  614.   (add-hook 'cider-repl-mode-hook #'smartparens-strict-mode)
  615.   (add-hook 'cider-repl-mode-hook #'rainbow-delimiters-mode) ; turn on rainbow-delimiters in repl
  616.   (add-hook 'clojure-mode-hook #'evil-cleverparens-mode)
  617.   (setq cider-font-lock-dynamically '(macro core function var))
  618.   (setq cider-overlays-use-font-lock t)
  619.   (setq cider-repl-display-help-banner nil)
  620.   (setq cider-repl-pop-to-buffer-on-connect nil)
  621.   (add-hook 'cider-repl-mode-hook #'eldoc-mode)
  622.   (setq cider-repl-wrap-history t)
  623.  
  624.   ;; ELM - Config
  625.   ;;(add-to-list 'company-backends 'company-elm)
  626.   ;;(add-hook 'elm-mode-hook #'elm-oracle-setup-completion)
  627.  
  628.   ;; HASKELL Settings
  629.  
  630.   ;; http://oremacs.com/2014/12/26/the-little-package-that-could/
  631.   (require 'tiny)
  632.   (tiny-setup-default)
  633.  
  634.   ;; IVY Settings
  635.   (setq ivy-use-virtual-buffers t)
  636.   (setq ivy-height 10)
  637.   (setq ivy-count-format "(%d/%d) ")
  638.   (setq magit-completing-read-function 'ivy-completing-read)
  639.  
  640.   ;; SCALA - Config
  641.   (setq exec-path (append exec-path '("/usr/local/bin")))
  642.   (setq exec-path (append exec-path '("/usr/local/lib/scala-2.11.8/bin")))
  643.   (add-hook 'scala-mode-hook 'ensime-mode)
  644.   (add-hook 'scala-mode-hook 'flycheck-mode)
  645.   ;; (setq prettify-symbols-alist scala-prettify-symbols-alist)
  646.   ;; (prettify-symbols-mode)
  647.  
  648.   ;; Configure SLIME setup - SCHEME
  649.   ;;(setq inferior-lisp-program "/usr/local/bin/sbcl") ; point to SBLC location
  650.   ;;(setq slime-contribs '(slime-fancy))
  651.   ;; Configure xscheme for working with Scheme
  652.   ;; (load "~/.emacs.d/xscheme.el")             ; loads mit-scheme's xscheme file
  653.   ;; (defun load-xscheme () (require 'xscheme)) ; xscheme provides additional functions
  654.   ;; (add-hook 'scheme-mode-hook 'load-xscheme) ; for
  655.   ;; working with scheme in REPL
  656.  
  657.   ;; Configure Chicken SCHEME
  658.   (setq scheme-program-name "csi -:c")
  659.   (setq geiser-active-implementations '(chicken))
  660.   (setq geiser-mode-start-repl-p 't)
  661.  
  662.   ;; JAVA Setings
  663.   ;;(setq eclim-eclipse-dirs "~/opt/eclipse"
  664.   ;;  eclim-executable "~/opt/eclipse/eclim")
  665.  
  666.   ;; Configure EMACS for ELISP Development
  667.   (eval-after-load "dash" '(dash-enable-font-lock))
  668.   ;; Add directories to load-path so emacs can check when (require) file during ELISP development
  669.   (let ((default-directory "~/bin/elisp/"))
  670.     (normal-top-level-add-subdirs-to-load-path))
  671.  
  672.   ;; ELIXIR CONFIG
  673.   (add-hook 'alchemist-mode-hook 'company-mode)
  674.   (setq alchemist-goto-elixir-source-dir "/usr/local/lib/elixir-master/lib/elixir/src/")
  675.   (setq alchemist-goto-erlang-source-dir "/usr/local/lib/erlang/lib/")
  676.   ;; (eval-after-load "alchemist"  ;; This is a workaround to avoid Alchemist from freezing spacemacs.
  677.   ;;   '(defun alchemist-company--wait-for-doc-buffer ()
  678.   ;;      (setf num 50)
  679.   ;;      (while (and (not alchemist-company-doc-lookup-done)
  680.   ;;                  (> (decf num) 1))
  681.   ;;        (sit-for 0.01))))
  682.  
  683.   ;; Configure Rust
  684.   (setq-default rust-enable-racer t)
  685.   (setq racer-cmd "/Users/randre03/.cargo/bin/racer")
  686.   (setq racer-rust-src-path "/usr/local/lib/rustc-1.6.0/src/")
  687.   (add-hook 'rust-mode-hook #'racer-mode)
  688.   (add-hook 'racer-mode-hook #'eldoc-mode)
  689.   (add-hook 'racer-mode-hook #'company-mode)
  690.  
  691.   ;; Allow Markdown Mode to know which markdown genetator to use to generate preview
  692.   (custom-set-variables
  693.    '(markdown-command "/usr/local/bin/pandoc"))
  694.   (add-hook 'markdown-mode-hook
  695.             '(lambda ()
  696.                (set (make-local-variable 'company-backends) '(company-dabbrev))
  697.                (linum-mode -1) ;; There's a bug that won't let olivetti work with this.
  698.                (olivetti-mode)
  699.                (flyspell-mode 1)))
  700.  
  701.   ;; EVAL-IN-REPL - https://github.com/kaz-yos/eval-in-repl
  702.   (require 'eval-in-repl)
  703.   ;; Comment to jump to next expression after evaluating current line
  704.   (setq eir-jump-after-eval nil)
  705. ;;; ielm support (for emacs lisp)
  706.   (require 'eval-in-repl-ielm)
  707.   ;; for .el files
  708.   (define-key emacs-lisp-mode-map (kbd "<C-return>") 'eir-eval-in-ielm)
  709.   ;; for *scratch*
  710.   (define-key lisp-interaction-mode-map (kbd "<C-return>") 'eir-eval-in-ielm)
  711.   ;; for M-x info
  712.   (define-key Info-mode-map (kbd "<C-return>") 'eir-eval-in-ielm)
  713. ;;; Cider support
  714.   (require 'eval-in-repl-cider)
  715.   (define-key clojure-mode-map (kbd "<C-return>") 'eir-eval-in-cider)
  716. ;;; racket-mode support (for Racket; if not using Geiser)
  717.   ;;(require 'eval-in-repl-racket)
  718.   ;;(define-key racket-mode-map (kbd "<C-return>") 'eir-eval-in-racket)
  719.  
  720.   ;; Scheme support (if not using Geiser))
  721.   ;; (require 'scheme)    ; if not done elsewhere
  722.   ;; (require 'cmuscheme) ; if not done elsewhere
  723.   ;; (require 'eval-in-repl-scheme)
  724.   ;; (add-hook 'scheme-mode-hook
  725.   ;;    '(lambda ()
  726.   ;;       (local-set-key (kbd "<C-return>") 'eir-eval-in-scheme)))
  727.  
  728.   ;; Javascript support
  729.   ;;(require 'js3-mode)  ; if not done elsewhere
  730.   ;;(require 'js2-mode)  ; if not done elsewhere
  731.   ;;(require 'js-comint) ; if not done elsewhere
  732.   ;;(with-eval-after-load 'js3-mode
  733.   ;;(require 'eval-in-repl-javascript)
  734.   ;;(define-key js3-mode-map (kbd "<C-return>") 'eir-eval-in-javascript))
  735.   ;;(with-eval-after-load 'js2-mode
  736.   ;;(require 'eval-in-repl-javascript)
  737.   ;;(define-key js2-mode-map (kbd "<C-return>") 'eir-eval-in-javascript))
  738.   (add-to-list 'load-path "/Users/randre03/tern/emacs/")
  739.   (setq exec-path (append exec-path '("/Users/randre03/tern/bin/")))
  740.   (autoload 'tern-mode "tern.el" nil t)
  741.  
  742.   ;; Shell support
  743.   (require 'eval-in-repl-shell)
  744.   (add-hook 'sh-mode-hook
  745.             '(lambda()
  746.                (local-set-key (kbd "C-<return>") 'eir-eval-in-shell)))
  747.  
  748.   ;; Version with opposite behavior to eir-jump-after-eval configuration
  749.   (defun eir-eval-in-shell2 ()
  750.  
  751.     (require 'ansi-color)
  752.     (defun endless/colorize-compilation ()
  753.       "Colorize from `compilation-filter-start' to `point'."
  754.       (let ((inhibit-read-only t))
  755.         (ansi-color-apply-on-region
  756.          compilation-filter-start (point))))
  757.  
  758.     (add-hook 'compilation-filter-hook
  759.               #'endless/colorize-compilation)   "eval-in-repl for shell script (opposite behavior)
  760.  
  761. This version has the opposite behavior to the eir-jump-after-eval
  762. configuration when invoked to evaluate a line."
  763.               (interactive)
  764.               (let ((eir-jump-after-eval (not eir-jump-after-eval)))
  765.                 (eir-eval-in-shell)))
  766.   (add-hook 'sh-mode-hook
  767.             '(lambda()
  768.                (local-set-key (kbd "C-M-<return>") 'eir-eval-in-shell2)))
  769.  
  770.   ;; Configure Flycheck
  771.   (add-hook 'after-init-hook #'global-flycheck-mode)
  772.   (eval-after-load 'flycheck '(flycheck-clojure-setup))
  773.   (setq flycheck-pos-tip-timeout 10)
  774.   ;;(add-hook 'flycheck-mode-hook #'flycheck-cask-setup)
  775.  
  776.   ;; Configure Spacemacs' SPC-o keybindings (o is reserved for user)
  777.   (evil-leader/set-key "ob" 'browse-url-of-file) ; view current file in open/default browser
  778.   (evil-leader/set-key "oc" 'comment-or-uncomment-sexp) ; See Premium Lisp/Clojure comment function below
  779.   (evil-leader/set-key "od" 'bjm/move-file-here)        ; See below
  780.   (evil-leader/set-key "om" 'mu4e)      ; Launch mu4e
  781.   (evil-leader/set-key "os" 'endless/ispell-word-then-abbrev) ; See function below
  782.   (evil-leader/set-key "ow" 'toggle-window-split) ; See definition below
  783.  
  784.   ;; ELFEED CONFIG
  785.   ;;(elfeed :variables rmh-elfeed-org-files (list "~/.emacs.d/private/elfeed1.org"))
  786.   ;;(elfeed :variables elfeed-enable-web-interface f)
  787.   ;;(elfeed :variables url-queue-timeout 30)
  788.  
  789.   ;; Configure erc (emacs' IRC mode)
  790.   ;; (setq erc-autojoin-channels-alist '(("freenode.net"
  791.   ;;                                      "#clojure"
  792.   ;;                                      "#clojure-beginners"
  793.   ;;                                      "#elixir-lang"
  794.   ;;                                      "#emacs"))
  795.   ;;       erc-server "irc.freenode.net"
  796.   ;;       erc-nick "randall_dev")
  797.  
  798.   ;; Switch : and ; && Switch j and k with jk and kj
  799.   (define-key evil-normal-state-map (kbd ";") 'evil-ex)
  800.   (define-key evil-normal-state-map (kbd ":") 'evil-repeat-find-char)
  801.   (define-key evil-normal-state-map (kbd "j") 'evil-next-visual-line)
  802.   (define-key evil-normal-state-map (kbd "k") 'evil-previous-visual-line)
  803.  
  804.   ;; BEACON Config
  805.   (beacon-mode 1)
  806.   (setq beacon-push-mark 35)
  807.   (setq beacon-blink-when-point-moves 3)
  808.   (setq beacon--blink-on-focus t)
  809.   (setq beacon-color "#666600")
  810.   ;;(setq beacon-dont-blink-major-modes 'mu4e)
  811.  
  812.   (helm-linum-relative-mode 1)
  813.  
  814.   (setq powerline-default-separator nil)
  815.   (setq delete-by-moving-to-trash t)    ; send deleted files to OSX trash
  816.   (setq initial-frame-alist '((top .0) (left .0) (width . 158) (height . 60))) ; Set initial frame size upon opening
  817.   ;; (custom-set-faces ; Background color in terminal is not very nice under Solarized Dark, so this is a workaround
  818.   ;;  (if (not window-system) '(default ((t (:background "nil"))))))
  819.  
  820. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  821.   ;; Toggle a Vertical Split to Horizontal and vice versa
  822.   ;; http://emacswiki.org/emacs/ToggleWindowSplit
  823. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  824.   (defun toggle-window-split ()
  825.     (interactive)
  826.     (if (= (count-windows) 2)
  827.         (let* ((this-win-buffer (window-buffer))
  828.                (next-win-buffer (window-buffer (next-window)))
  829.                (this-win-edges (window-edges (selected-window)))
  830.                (next-win-edges (window-edges (next-window)))
  831.                (this-win-2nd (not (and (<= (car this-win-edges)
  832.                                            (car next-win-edges))
  833.                                        (<= (cadr this-win-edges)
  834.                                            (cadr next-win-edges)))))
  835.                (splitter
  836.                 (if (= (car this-win-edges)
  837.                        (car (window-edges (next-window))))
  838.                     'split-window-horizontally
  839.                   'split-window-vertically)))
  840.           (delete-other-windows)
  841.           (let ((first-win (selected-window)))
  842.             (funcall splitter)
  843.             (if this-win-2nd (other-window 1))
  844.             (set-window-buffer (selected-window) this-win-buffer)
  845.             (set-window-buffer (next-window) next-win-buffer)
  846.             (select-window first-win)
  847.             (if this-win-2nd (other-window 1))))))
  848.  
  849. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  850.   ;; Lisp/Clojure Commenting Code
  851.   ;; http://endlessparentheses.com/a-comment-or-uncomment-sexp-command.html?source=rss
  852. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  853.   (defun uncomment-sexp (&optional n)
  854.     "Uncomment a sexp around point."
  855.     (interactive "P")
  856.     (let* ((initial-point (point-marker))
  857.            (p)
  858.            (end (save-excursion
  859.                   (when (elt (syntax-ppss) 4)
  860.                     (re-search-backward comment-start-skip
  861.                                         (line-beginning-position)
  862.                                         t))
  863.                   (setq p (point-marker))
  864.                   (comment-forward (point-max))
  865.                   (point-marker)))
  866.            (beg (save-excursion
  867.                   (forward-line 0)
  868.                   (while (= end (save-excursion
  869.                                   (comment-forward (point-max))
  870.                                   (point)))
  871.                     (forward-line -1))
  872.                   (goto-char (line-end-position))
  873.                   (re-search-backward comment-start-skip
  874.                                       (line-beginning-position)
  875.                                       t)
  876.                   (while (looking-at-p comment-start-skip)
  877.                     (forward-char -1))
  878.                   (point-marker))))
  879.       (unless (= beg end)
  880.         (uncomment-region beg end)
  881.         (goto-char p)
  882.         ;; Indentify the "top-level" sexp inside the comment.
  883.         (while (and (ignore-errors (backward-up-list) t)
  884.                     (>= (point) beg))
  885.           (skip-chars-backward (rx (syntax expression-prefix)))
  886.           (setq p (point-marker)))
  887.         ;; Re-comment everything before it.
  888.         (ignore-errors
  889.           (comment-region beg p))
  890.         ;; And everything after it.
  891.         (goto-char p)
  892.         (forward-sexp (or n 1))
  893.         (skip-chars-forward "\r\n[:blank:]")
  894.         (if (< (point) end)
  895.             (ignore-errors
  896.               (comment-region (point) end))
  897.           ;; If this is a closing delimiter, pull it up.
  898.           (goto-char end)
  899.           (skip-chars-forward "\r\n[:blank:]")
  900.           (when (= 5 (car (syntax-after (point))))
  901.             (delete-indentation))))
  902.       ;; Without a prefix, it's more useful to leave point where
  903.       ;; it was.
  904.       (unless n
  905.         (goto-char initial-point))))
  906.  
  907.   (defun comment-sexp--raw ()
  908.     "Comment the sexp at point or ahead of point."
  909.     (pcase (or (bounds-of-thing-at-point 'sexp)
  910.                (save-excursion
  911.                  (skip-chars-forward "\r\n[:blank:]")
  912.                  (bounds-of-thing-at-point 'sexp)))
  913.       (`(,l . ,r)
  914.        (goto-char r)
  915.        (skip-chars-forward "\r\n[:blank:]")
  916.        (comment-region l r)
  917.        (skip-chars-forward "\r\n[:blank:]"))))
  918.  
  919.   (defun comment-or-uncomment-sexp (&optional n)
  920.     "Comment the sexp at point and move past it.
  921. If already inside (or before) a comment, uncomment instead.
  922. With a prefix argument N, (un)comment that many sexps."
  923.     (interactive "P")
  924.     (if (or (elt (syntax-ppss) 4)
  925.             (< (save-excursion
  926.                  (skip-chars-forward "\r\n[:blank:]")
  927.                  (point))
  928.                (save-excursion
  929.                  (comment-forward 1)
  930.                  (point))))
  931.         (uncomment-sexp n)
  932.       (dotimes (_ (or n 1))
  933.         (comment-sexp--raw))))
  934.  
  935. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  936.   ;; Correct Mis-Spellings
  937.   ;; http://endlessparentheses.com/ispell-and-abbrev-the-perfect-auto-correct.html
  938. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  939.   ;; (define-key ctl-x-map "\C-i"
  940.   ;;  #'endless/ispell-word-then-abbrev)
  941.  
  942.   (defun endless/ispell-word-then-abbrev (p)
  943.     "Call `ispell-word', then create an abbrev for it.
  944. With prefix P, create local abbrev. Otherwise it will
  945. be global."
  946.     (interactive "P")
  947.     (let (bef aft)
  948.       (save-excursion
  949.         (while (progn
  950.                  (backward-word)
  951.                  (and (setq bef (thing-at-point 'word))
  952.                       (not (ispell-word nil 'quiet)))))
  953.         (setq aft (thing-at-point 'word)))
  954.       (when (and aft bef (not (equal aft bef)))
  955.         (setq aft (downcase aft))
  956.         (setq bef (downcase bef))
  957.         (define-abbrev
  958.           (if p local-abbrev-table global-abbrev-table)
  959.           bef aft)
  960.         (message "\"%s\" now expands to \"%s\" %sally"
  961.                  bef aft (if p "loc" "glob")))))
  962.  
  963.   (setq save-abbrevs 'silently)
  964.   (setq-default abbrev-mode t)
  965.  
  966. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  967.   ;; Move Downloaded file to current directory
  968.   ;; http://pragmaticemacs.com/emacs/quickly-move-a-file-to-the-current-directory/
  969. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  970.   ;; start directory
  971.   (defvar bjm/move-file-here-start-dir (expand-file-name "~/Downloads"))
  972.  
  973.   (defun bjm/move-file-here ()
  974.     "Move file from somewhere else to here.
  975. The file is taken from a start directory set by `bjm/move-file-here-start-dir' and moved to the current directory if invoked in dired, or else the directory containing current buffer. The user is presented with a list of files in the start directory, from which to select the file to move, sorted by most recent first."
  976.     (interactive)
  977.     (let (file-list target-dir file-list-sorted start-file start-file-full)
  978.       ;; clean directories from list but keep times
  979.       (setq file-list
  980.             (-remove (lambda (x) (nth 1 x))
  981.                      (directory-files-and-attributes bjm/move-file-here-start-dir)))
  982.  
  983.       ;; get target directory
  984.       ;; http://ergoemacs.org/emacs/emacs_copy_file_path.html
  985.       (setq target-dir
  986.             (if (equal major-mode 'dired-mode)
  987.                 (expand-file-name default-directory)
  988.               (if (null (buffer-file-name))
  989.                   (user-error "ERROR: current buffer is not associated with a file.")
  990.                 (file-name-directory (buffer-file-name)))))
  991.  
  992.       ;; sort list by most recent
  993.       ;;http://stackoverflow.com/questions/26514437/emacs-sort-list-of-directories-files-by-modification-date
  994.       (setq file-list-sorted
  995.             (mapcar #'car
  996.                     (sort file-list
  997.                           #'(lambda (x y) (time-less-p (nth 6 y) (nth 6 x))))))
  998.  
  999.       ;; use ivy to select start-file
  1000.       (setq start-file (ivy-read
  1001.                         (concat "Move selected file to " target-dir ":")
  1002.                         file-list-sorted
  1003.                         :re-builder #'ivy--regex
  1004.                         :sort nil
  1005.                         :initial-input nil))
  1006.  
  1007.       ;; add full path to start file and end-file
  1008.       (setq start-file-full
  1009.             (expand-file-name start-file bjm/move-file-here-start-dir))
  1010.       (setq end-file
  1011.             (expand-file-name (file-name-nondirectory start-file) target-dir))
  1012.       (rename-file start-file-full end-file)
  1013.       (message "moved %s to %s" start-file-full end-file)))
  1014.  
  1015.   )
  1016.  
  1017. ;; Do not write anything past this comment. This is where Emacs will
  1018. ;; auto-generate custom variable definitions.
  1019. (custom-set-variables
  1020.  ;; custom-set-variables was added by Custom.
  1021.  ;; If you edit it by hand, you could mess it up, so be careful.
  1022.  ;; Your init file should contain only one such instance.
  1023.  ;; If there is more than one, they won't work right.
  1024.  '(gud-gdb-command-name "gdb --annotate=1")
  1025.  '(hproperty:but-emphasize-p t)
  1026.  '(hyperbole-web-search-alist
  1027.    (quote
  1028.     (("Dictionary" . "https://en.wiktionary.org/wiki/%s")
  1029.      ("Elisp" . "http://www.google.com/search?q=%s+filetype:el")
  1030.      ("Google" . "http://www.google.com/search?q=%s")
  1031.      ("Hub(git)" . "https://github.com/search?ref=simplesearch&q=%s")
  1032.      ("Images" . "http://www.google.com/images?hl=en&q=%s")
  1033.      ("Maps" . "http://maps.google.com/maps?q=%s")
  1034.      ("RFCs" . "https://tools.ietf.org/html/rfc%s")
  1035.      ("StackOverflow" . "https://stackoverflow.com/search?q=%s")
  1036.      ("Twitter" . "https://twitter.com/search?q=%s")
  1037.      ("Wikipedia" . "https://en.wikipedia.org/wiki/%s"))))
  1038.  '(hyrolo-kill-buffers-after-use t)
  1039.  '(large-file-warning-threshold nil)
  1040.  '(markdown-command "/usr/local/bin/pandoc")
  1041.  '(org-agenda-files (quote ("~/Dropbox/Link to Documents/help.org")))
  1042.  '(package-archives
  1043.    (quote
  1044.     (("gnu" . "http://elpa.gnu.org/packages/")
  1045.      ("marmalade" . "https://marmalade-repo.org/packages/")
  1046.      ("melpa" . "https://melpa.org/packages/")
  1047.      ("org" . "http://orgmode.org/elpa/")
  1048.      ("gnu" . "https://elpa.gnu.org/packages/"))))
  1049.  '(package-selected-packages
  1050.    (quote
  1051.     (sql-indent clojure-cheatsheet company-flx pug-mode olivetti nil-theme seq evil-lispy lispyville tiny evil-terminal-cursor-changer shm ruby-end helm-flyspell company-racer bracketed-paste osx-dictionary company-emacs-eclim zoutline eclim dumb-jump cargo elfeed elfeed-goodies elfeed-org elfeed-web tldr intero hlint-refactor hindent haskell-snippets flycheck-haskell company-ghci company-ghc ghc haskell-mode company-cabal cmm-mode notmuch org nm xcscope ggtags emoji-cheat-sheet-plus disaster company-ycmd ycmd request-deferred deferred company-emoji company-c-headers cmake-mode clang-format hyperbole marshal mode-icons counsel-dash org-projectile mwim github-search evil-unimpaired f mu4e-maildirs-extension mu4e-alert emacs-eclim lua-mode slack emojify circe oauth2 websocket ht restclient ob-http nlinum-relative nlinum evil-commentary ess-smart-equals ess-R-object-popup ess-R-data-view ctable ess julia-mode erlang zonokai-theme zenburn-theme zen-and-art-theme underwater-theme ujelly-theme twilight-theme twilight-bright-theme twilight-anti-bright-theme tronesque-theme toxi-theme tao-theme tangotango-theme tango-plus-theme tango-2-theme sunny-day-theme sublime-themes subatomic256-theme subatomic-theme stekene-theme soothe-theme soft-stone-theme soft-morning-theme soft-charcoal-theme smyx-theme seti-theme reverse-theme railscasts-theme purple-haze-theme professional-theme planet-theme phoenix-dark-pink-theme phoenix-dark-mono-theme pastels-on-dark-theme organic-green-theme omtose-phellack-theme oldlace-theme occidental-theme obsidian-theme noctilux-theme niflheim-theme naquadah-theme mustang-theme monokai-theme monochrome-theme molokai-theme moe-theme minimal-theme material-theme majapahit-theme lush-theme light-soap-theme jbeans-theme jazz-theme ir-black-theme inkpot-theme heroku-theme hemisu-theme hc-zenburn-theme gruvbox-theme gruber-darker-theme grandshell-theme gotham-theme gandalf-theme flatui-theme flatland-theme firebelly-theme farmhouse-theme espresso-theme dracula-theme django-theme darktooth-theme darkokai-theme darkmine-theme darkburn-theme dakrone-theme cyberpunk-theme colorsarenice-theme color-theme-sanityinc-tomorrow color-theme-sanityinc-solarized clues-theme cherry-blossom-theme busybee-theme bubbleberry-theme birds-of-paradise-plus-theme badwolf-theme anti-zenburn-theme ample-zen-theme ample-theme alect-themes afternoon-theme lispy wgrep smex ivy-hydra flyspell-correct-ivy counsel-projectile counsel swiper ivy rust-mode alert log4e gntp macrostep skewer-mode simple-httpd json-snatcher json-reformat parent-mode request haml-mode gitignore-mode fringe-helper git-gutter+ git-gutter gh logito pcache flyspell-correct-helm flycheck-mix flx git-commit with-editor smartparens anzu scala-mode diminish web-completion-data pos-tip hydra inflections edn multiple-cursors paredit s peg eval-sexp-fu highlight spinner queue key-chord bind-key packed m-buffer company pkg-info epl ace-window async auto-complete package-build yoshi-theme apropospriate-theme sbt-mode tern bind-map dash clojure-mode flycheck helm-dash dash-at-point dash-functional avy iedit yasnippet magit-popup spacegray-theme cider js2-mode which-key spaceline smooth-scrolling helm-ag flyspell-correct beacon alchemist evil helm popup helm-core projectile markdown-mode magit xterm-color ws-butler window-numbering web-mode web-beautify volatile-highlights vi-tilde-fringe uuidgen utop use-package undo-tree tuareg toml-mode toc-org tagedit stickyfunc-enhance srefactor spacemacs-theme solarized-theme smeargle slime slim-mode slamhound shell-pop scss-mode sass-mode reveal-in-osx-finder restart-emacs rainbow-delimiters racket-mode racer quelpa powerline popwin persp-mode pcre2el pbcopy paradox page-break-lines osx-trash orgit org-repo-todo org-present org-pomodoro org-plus-contrib org-download org-bullets open-junk-file ocp-indent noflet neotree multi-term move-text mmm-mode merlin markdown-toc magit-gitflow magit-gh-pulls lorem-ipsum livid-mode linum-relative link-hint leuven-theme less-css-mode launchctl json-mode js2-refactor js-doc jade-mode info+ indent-guide ido-vertical-mode ibuffer-projectile hungry-delete htmlize hl-todo highlight-parentheses highlight-numbers highlight-indentation help-fns+ helm-themes helm-swoop helm-projectile helm-mode-manager helm-make helm-gitignore helm-flx helm-descbinds helm-css-scss helm-company helm-c-yasnippet goto-chg google-translate golden-ratio gnuplot github-clone github-browse-file gitconfig-mode gitattributes-mode git-timemachine git-messenger git-link git-gutter-fringe git-gutter-fringe+ gist gh-md geiser flycheck-tip flycheck-rust flycheck-pos-tip flycheck-elm flycheck-clojure flx-ido fill-column-indicator fancy-battery eyebrowse expand-region exec-path-from-shell evil-visualstar evil-visual-mark-mode evil-tutor evil-surround evil-search-highlight-persist evil-numbers evil-nerd-commenter evil-mc evil-matchit evil-magit evil-lisp-state evil-indent-plus evil-iedit-state evil-exchange evil-escape evil-ediff evil-args evil-anzu eval-in-repl eshell-z eshell-prompt-extras esh-help ensime emmet-mode elm-mode elixir-mode elisp-slime-nav diff-hl define-word company-web company-tern company-statistics company-quickhelp column-enforce-mode coffee-mode clojure-snippets clj-refactor clean-aindent-mode cider-eval-sexp-fu buffer-move buffer-flip auto-yasnippet auto-highlight-symbol auto-dictionary auto-compile assess aggressive-indent adaptive-wrap ace-link ace-jump-helm-line ac-ispell)))
  1052.  '(send-mail-function (quote smtpmail-send-it))
  1053.  '(smtpmail-smtp-server "smtp.gmail.com")
  1054.  '(smtpmail-smtp-service 25))
  1055. (custom-set-faces
  1056.  ;; custom-set-faces was added by Custom.
  1057.  ;; If you edit it by hand, you could mess it up, so be careful.
  1058.  ;; Your init file should contain only one such instance.
  1059.  ;; If there is more than one, they won't work right.
  1060.  )
Add Comment
Please, Sign In to add comment