Using Emacs Prelude now.... gonna figure things out
Signed-off-by: TuDatTr <tran.tuan-dat@mailbox.org>clean_emacs
parent
215bf58939
commit
51695cb484
181
emacs/.emacs
181
emacs/.emacs
|
@ -1,181 +1,8 @@
|
||||||
;;; package --- summary
|
;;; .emacs --- My personal emacs file
|
||||||
;; auctex -- installed -- Integrated environment for *TeX*
|
|
||||||
;; dummyparens -- installed -- paranthesis auto-pairing and wrapping
|
|
||||||
;; elpy -- installed -- Emacs Python Development Environment
|
|
||||||
;; flycheck -- installed -- On-the-fly syntax checking
|
|
||||||
;; forest-blue-theme -- installed -- Emacs theme with a dark background
|
|
||||||
;; google-this -- installed -- A set of functions and bindings to google under point
|
|
||||||
;; nyan-mode -- installed -- Nyan Cat shows position in current buffer in mode-line.
|
|
||||||
;; rainbow-mode -- installed -- Colorize color names in buffers
|
|
||||||
;; company -- dependency -- Modular text completion framework
|
|
||||||
;; dash -- dependency -- A modern list library for Emacs
|
|
||||||
;; epl -- dependency -- Emacs Package Library
|
|
||||||
;; find-file-in-project -- dependency -- Find file/directory for review Diff/Patch/Commit efficiently everywhere
|
|
||||||
;; highlight-indentation -- dependency -- Minor modes for highlight indentation
|
|
||||||
;; ivy -- dependency -- Incremental Vertical completYon
|
|
||||||
;; pkg-info -- dependency -- Information about packages
|
|
||||||
;; popup -- dependency -- Visual Popup User Interface
|
|
||||||
;; pyvenv -- dependency -- Python virtual environment interface
|
|
||||||
;; s -- dependency -- The long lost Emacs string manipulation library.
|
|
||||||
;; yasnippet -- dependency -- Yet another snippet extension for Emacs.
|
|
||||||
|
|
||||||
;;; Code:
|
|
||||||
(package-initialize)
|
|
||||||
|
|
||||||
;; Package Repos
|
|
||||||
(when (>= emacs-major-version 24)
|
|
||||||
(require 'package)
|
|
||||||
(add-to-list
|
|
||||||
'package-archives
|
|
||||||
; '("melpa" . "http://stable.melpa.org/packages/") ; many packages won't show if using stable
|
|
||||||
'("melpa" . "http://melpa.milkbox.net/packages/")
|
|
||||||
'("elpy" . "http://jorgenschaefer.github.io/packages/")
|
|
||||||
)
|
|
||||||
)
|
|
||||||
;; Global functions
|
|
||||||
|
|
||||||
; Copy and Paste
|
|
||||||
; https://github.com/Boruch-Baum
|
|
||||||
(defun my-copy-to-xclipboard(arg)
|
|
||||||
(interactive "P")
|
|
||||||
(cond
|
|
||||||
((not (use-region-p))
|
|
||||||
(message "Nothing to yank to X-clipboard"))
|
|
||||||
((and (not (display-graphic-p))
|
|
||||||
(/= 0 (shell-command-on-region
|
|
||||||
(region-beginning) (region-end) "xsel -i -b")))
|
|
||||||
(error "Is program `xsel' installed?"))
|
|
||||||
(t
|
|
||||||
(when (display-graphic-p)
|
|
||||||
(call-interactively 'clipboard-kill-ring-save))
|
|
||||||
(message "Yanked region to X-clipboard")
|
|
||||||
(when arg
|
|
||||||
(kill-region (region-beginning) (region-end)))
|
|
||||||
(deactivate-mark))))
|
|
||||||
|
|
||||||
(defun my-cut-to-xclipboard()
|
|
||||||
(interactive)
|
|
||||||
(my-copy-to-xclipboard t))
|
|
||||||
|
|
||||||
(defun my-paste-from-xclipboard()
|
|
||||||
"Uses shell command `xsel -o' to paste from x-clipboard. With
|
|
||||||
one prefix arg, pastes from X-PRIMARY, and with two prefix args,
|
|
||||||
pastes from X-SECONDARY."
|
|
||||||
(interactive)
|
|
||||||
(if (display-graphic-p)
|
|
||||||
(clipboard-yank)
|
|
||||||
(let*
|
|
||||||
((opt (prefix-numeric-value current-prefix-arg))
|
|
||||||
(opt (cond
|
|
||||||
((= 1 opt) "b")
|
|
||||||
((= 4 opt) "p")
|
|
||||||
((= 16 opt) "s"))))
|
|
||||||
(insert (shell-command-to-string (concat "xsel -o -" opt))))))
|
|
||||||
|
|
||||||
;; Theme
|
|
||||||
(custom-set-variables
|
|
||||||
;; custom-set-variables was added by Custom.
|
|
||||||
;; If you edit it by hand, you could mess it up, so be careful.
|
|
||||||
;; Your init file should contain only one such instance.
|
|
||||||
;; If there is more than one, they won't work right.
|
|
||||||
'(custom-safe-themes
|
|
||||||
(quote
|
|
||||||
("66881e95c0eda61d34aa7f08ebacf03319d37fe202d68ecf6a1dbfd49d664bc3" default)))
|
|
||||||
'(dp-pairs
|
|
||||||
(quote
|
|
||||||
(("(" ")" nil)
|
|
||||||
("[" "]" nil)
|
|
||||||
("{" "}" dp-brace-post-handler))))
|
|
||||||
'(elpy-dedicated-shells t)
|
|
||||||
'(elpy-shell-display-buffer-after-send t)
|
|
||||||
'(global-font-lock-mode t)
|
|
||||||
'(package-selected-packages
|
|
||||||
(quote
|
|
||||||
(auto-complete nyan-mode google-this dummyparens flycheck rainbow-mode elpy auctex forest-blue-theme))))
|
|
||||||
(custom-set-faces
|
|
||||||
;; custom-set-faces was added by Custom.
|
|
||||||
;; If you edit it by hand, you could mess it up, so be careful.
|
|
||||||
;; Your init file should contain only one such instance.
|
|
||||||
;; If there is more than one, they won't work right.
|
|
||||||
'(font-latex-bold-face ((t (:foreground "brightcyan"))))
|
|
||||||
'(font-latex-sedate-face ((t (:foreground "brightcyan"))))
|
|
||||||
'(font-lock-comment-face ((t (:foreground "color-142"))))
|
|
||||||
'(font-lock-doc-face ((t (:foreground "color-83"))))
|
|
||||||
'(font-lock-keyword-face ((t (:foreground "brightcyan" :weight bold))))
|
|
||||||
'(font-lock-type-face ((t (:foreground "green"))))
|
|
||||||
'(highlight-indentation-face ((t (:background "green")))))
|
|
||||||
|
|
||||||
|
|
||||||
;; Functions:
|
|
||||||
; Load Theme
|
|
||||||
(load-theme 'forest-blue t)
|
|
||||||
|
|
||||||
; Python
|
|
||||||
(elpy-enable)
|
|
||||||
(defalias 'workon 'pyvenv-workon)
|
|
||||||
(workon "~/.virtualenv/default")
|
|
||||||
|
|
||||||
(defun pyexec ()
|
|
||||||
"Execute the python program in an external terminal."
|
|
||||||
(interactive)
|
|
||||||
(when buffer-file-name
|
|
||||||
(shell-command (concat "termite --hold -e \"python " buffer-file-name "\""))
|
|
||||||
)
|
|
||||||
)
|
|
||||||
|
|
||||||
; C++
|
|
||||||
(defun cppexec ()
|
|
||||||
"Execute the cpp program in an external terminal."
|
|
||||||
(interactive)
|
|
||||||
(when buffer-file-name
|
|
||||||
(shell-command (concat "termite -e \"g++ " buffer-file-name "\""))
|
|
||||||
(shell-command (concat "termite --hold -e \"./a.out\""))
|
|
||||||
)
|
|
||||||
)
|
|
||||||
|
|
||||||
; LaTeX
|
|
||||||
(require 'tex)
|
|
||||||
(setq TeX-auto-save t)
|
|
||||||
(setq TeX-parse-self t)
|
|
||||||
(setq-default TeX-master nil)
|
|
||||||
|
|
||||||
(fset 'next-section
|
|
||||||
(lambda (&optional arg) "Next section." (interactive "p") (kmacro-exec-ring-item (quote ("\\sec
" 0 "%d")) arg)))
|
|
||||||
(fset 'prev-section
|
|
||||||
(lambda (&optional arg) "Previous section" (interactive "p") (kmacro-exec-ring-item (quote ("\\sec
" 0 "%d")) arg)))
|
|
||||||
|
|
||||||
; Yasnippet
|
|
||||||
(setq yas-snippet-dirs
|
|
||||||
'("~/.emacs.d/snippets" ;; personal snippets/copied ones
|
|
||||||
)
|
|
||||||
)
|
|
||||||
|
|
||||||
;; Modes
|
|
||||||
(show-paren-mode 1)
|
|
||||||
(menu-bar-mode -1)
|
|
||||||
(google-this-mode 1)
|
|
||||||
(nyan-mode 1)
|
|
||||||
(TeX-global-PDF-mode t)
|
|
||||||
(yas-global-mode t)
|
|
||||||
(global-dummyparens-mode)
|
|
||||||
(add-hook 'after-init-hook #'global-flycheck-mode)
|
|
||||||
|
|
||||||
;; Custom Keybinds
|
|
||||||
(global-set-key (kbd "C-c C-w") 'my-cut-to-xclipboard)
|
|
||||||
(global-set-key (kbd "C-c M-w") 'my-copy-to-xclipboard)
|
|
||||||
(global-set-key (kbd "C-c M-y") 'my-paste-from-xclipboard)
|
|
||||||
(global-set-key (kbd "C-x g") 'google-this-mode-submap)
|
|
||||||
(eval-after-load 'latex
|
|
||||||
'(define-key LaTeX-mode-map (kbd "C-c n") 'next-section))
|
|
||||||
(eval-after-load 'latex
|
|
||||||
'(define-key LaTeX-mode-map (kbd "C-c p") 'prev-section))
|
|
||||||
(eval-after-load 'cc-mode
|
|
||||||
'(define-key c++-mode-map (kbd "C-c C-c") 'cppexec))
|
|
||||||
(eval-after-load 'elpy
|
|
||||||
'(define-key elpy-mode-map (kbd "C-c C-c") 'pyexec)
|
|
||||||
)
|
|
||||||
|
|
||||||
;;; Commentary:
|
;;; Commentary:
|
||||||
|
|
||||||
(provide '.emacs)
|
;;; Code:
|
||||||
|
|
||||||
|
(provide 'emacs)
|
||||||
;;; .emacs ends here
|
;;; .emacs ends here
|
||||||
|
|
|
@ -0,0 +1,26 @@
|
||||||
|
*~
|
||||||
|
*.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
|
||||||
|
.emacs.desktop
|
||||||
|
.emacs.desktop.lock
|
||||||
|
network-security.data
|
|
@ -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,730 @@
|
||||||
|
[![License GPL 3][badge-license]](http://www.gnu.org/licenses/gpl-3.0.txt)
|
||||||
|
[![Liberapay](https://liberapay.com/assets/widgets/donate.svg)](https://liberapay.com/bbatsov/donate)
|
||||||
|
[![Patreon](https://img.shields.io/badge/patreon-donate-orange.svg)](https://www.patreon.com/bbatsov)
|
||||||
|
|
||||||
|
Emacs Prelude
|
||||||
|
=============
|
||||||
|
|
||||||
|
[![Join the chat at https://gitter.im/bbatsov/prelude](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/bbatsov/prelude?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
|
||||||
|
|
||||||
|
Prelude is an Emacs distribution that aims to enhance the default
|
||||||
|
Emacs experience. Prelude alters a lot of the default settings,
|
||||||
|
bundles a plethora of additional packages and adds its own core
|
||||||
|
library to the mix. The final product offers an easy to use Emacs
|
||||||
|
configuration for Emacs newcomers and lots of additional power for
|
||||||
|
Emacs power users.
|
||||||
|
|
||||||
|
Prelude is compatible **ONLY with GNU Emacs 24.4+**. In general you're
|
||||||
|
advised to always run Prelude with the latest Emacs - currently
|
||||||
|
**25.2**.
|
||||||
|
|
||||||
|
You can support the development of Prelude via
|
||||||
|
[Salt](https://bountysource.com/teams/prelude),
|
||||||
|
[Patreon](https://www.patreon.com/bbatsov) and
|
||||||
|
[Liberapay](https://liberapay.com/bbatsov/donate).
|
||||||
|
|
||||||
|
[![Liberapay](https://liberapay.com/assets/widgets/donate.svg)](https://liberapay.com/bbatsov/donate)
|
||||||
|
[![Patreon](https://img.shields.io/badge/patreon-donate-orange.svg)](https://www.patreon.com/bbatsov)
|
||||||
|
|
||||||
|
**Table of Contents**
|
||||||
|
|
||||||
|
- [Fast Forward](#fast-forward)
|
||||||
|
- [Installing Emacs](#installing-emacs)
|
||||||
|
- [Installation](#installation)
|
||||||
|
- [Automated](#automated)
|
||||||
|
- [Via Curl](#via-curl)
|
||||||
|
- [Via Wget](#via-wget)
|
||||||
|
- [Manual](#manual)
|
||||||
|
- [Updating Prelude](#updating-prelude)
|
||||||
|
- [Manual update](#manual-update)
|
||||||
|
- [Update all bundled packages](#update-all-bundled-packages)
|
||||||
|
- [Update Prelude's code](#update-preludes-code)
|
||||||
|
- [Restart Prelude](#restart-prelude)
|
||||||
|
- [Automatic update](#automatic-update)
|
||||||
|
- [Enabling additional modules](#enabling-additional-modules)
|
||||||
|
- [Running](#running)
|
||||||
|
- [Getting to know Prelude](#getting-to-know-prelude)
|
||||||
|
- [Keymap](#keymap)
|
||||||
|
- [Global](#global)
|
||||||
|
- [Prelude Mode](#prelude-mode)
|
||||||
|
- [macOS modifier keys](#macos-modifier-keys)
|
||||||
|
- [Projectile](#projectile)
|
||||||
|
- [Helm](#helm)
|
||||||
|
- [Key-chords](#key-chords)
|
||||||
|
- [Disabling key-chords](#disabling-key-chords)
|
||||||
|
- [Automatic package installation](#automatic-package-installation)
|
||||||
|
- [Color Themes](#color-themes)
|
||||||
|
- [Personalizing](#personalizing)
|
||||||
|
- [Disabling whitespace-mode](#disabling-whitespace-mode)
|
||||||
|
- [Disable flyspell-mode](#disable-flyspell-mode)
|
||||||
|
- [Caveats & Pitfalls](#caveats--pitfalls)
|
||||||
|
- [Updating bundled packages](#updating-bundled-packages)
|
||||||
|
- [Problems with flyspell-mode](#problems-with-flyspell-mode)
|
||||||
|
- [Ugly colors in the terminal Emacs version](#ugly-colors-in-the-terminal-emacs-version)
|
||||||
|
- [MELPA error on initial startup](#melpa-error-on-initial-startup)
|
||||||
|
- [Warnings on arrow navigation in editor buffers](#warnings-on-arrow-navigation-in-editor-buffers)
|
||||||
|
- [Customized C-a behavior](#customized-c-a-behavior)
|
||||||
|
- [Poor ido matching performance on large datasets](#poor-ido-matching-performance-on-large-datasets)
|
||||||
|
- [Windows compatibility](#windows-compatibility)
|
||||||
|
- [Known issues](#known-issues)
|
||||||
|
- [Support](#support)
|
||||||
|
- [Contributors](#contributors)
|
||||||
|
- [Bugs & Improvements](#bugs--improvements)
|
||||||
|
|
||||||
|
## Fast Forward
|
||||||
|
|
||||||
|
Assuming you're using an Unix-like OS (`*BSD`, `GNU/Linux`, `macOS`, `Solaris`,
|
||||||
|
etc), you already have Emacs 24.4+ installed, as well as `git` & `curl` you
|
||||||
|
can skip the whole manual and just type in your favorite shell the
|
||||||
|
following command:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
curl -L https://git.io/epre | sh
|
||||||
|
```
|
||||||
|
|
||||||
|
You can now power up your Emacs, sit back and enjoy Prelude,
|
||||||
|
forgetting about the rest of this manual.
|
||||||
|
|
||||||
|
There are two environment variables you can use to control the
|
||||||
|
source repository and the installation directory. To change the
|
||||||
|
installation directory:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
export PRELUDE_INSTALL_DIR="$HOME/.emacs.d" && curl -L https://github.com/bbatsov/prelude/raw/master/utils/installer.sh | sh
|
||||||
|
```
|
||||||
|
|
||||||
|
To change the source repository:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
export PRELUDE_URL="https://github.com/yourname/prelude.git" && curl -L https://github.com/bbatsov/prelude/raw/master/utils/installer.sh | sh
|
||||||
|
```
|
||||||
|
|
||||||
|
Note that the installer will back up any existing `.emacs` file or
|
||||||
|
`.emacs.d` since it will unpack Prelude's code in `.emacs.d`. If
|
||||||
|
you're doing a manual install make sure you don't have a `.emacs` file
|
||||||
|
or back up your existing `.emacs.d` directory manually.
|
||||||
|
|
||||||
|
Don't forget to adjust your `prelude-modules.el` file once the installation is done.
|
||||||
|
By default most of the modules that ship with Prelude are not loaded.
|
||||||
|
|
||||||
|
## Installing Emacs
|
||||||
|
|
||||||
|
Obviously to use the Emacs Prelude you have to install Emacs
|
||||||
|
first. Have a look at
|
||||||
|
the
|
||||||
|
[WikEmacs articles on installing Emacs](http://wikemacs.org/index.php/Installing_Emacs).
|
||||||
|
|
||||||
|
## Installation
|
||||||
|
|
||||||
|
### Automated
|
||||||
|
|
||||||
|
You can install **Emacs Prelude** via the command line with either `curl` or
|
||||||
|
`wget`. Naturally `git` is also required.
|
||||||
|
|
||||||
|
#### Via Curl
|
||||||
|
|
||||||
|
If you're using `curl` type the following command:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
curl -L https://github.com/bbatsov/prelude/raw/master/utils/installer.sh | sh
|
||||||
|
```
|
||||||
|
|
||||||
|
#### Via Wget
|
||||||
|
|
||||||
|
If you're using `wget` type:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
wget --no-check-certificate https://github.com/bbatsov/prelude/raw/master/utils/installer.sh -O - | sh
|
||||||
|
```
|
||||||
|
|
||||||
|
### Manual
|
||||||
|
|
||||||
|
Make sure you do not have any `~/.emacs` file present.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
git clone git://github.com/bbatsov/prelude.git path/to/local/repo
|
||||||
|
ln -s path/to/local/repo ~/.emacs.d
|
||||||
|
cd ~/.emacs.d
|
||||||
|
```
|
||||||
|
|
||||||
|
If you are using Windows, you should check what Emacs thinks the `~` directory is by running Emacs and typing `C-x d ~/<RET>`, and then adjust the command appropriately.
|
||||||
|
|
||||||
|
## Updating Prelude
|
||||||
|
|
||||||
|
### Manual update
|
||||||
|
|
||||||
|
The update procedure is fairly straightforward and consists of 3 steps:
|
||||||
|
|
||||||
|
#### Update all bundled packages
|
||||||
|
|
||||||
|
Just run <kbd>M-x package-list-packages RET U x</kbd>.
|
||||||
|
|
||||||
|
#### Update Prelude's code
|
||||||
|
|
||||||
|
```bash
|
||||||
|
cd path/to/prelude/installation
|
||||||
|
git pull
|
||||||
|
```
|
||||||
|
|
||||||
|
The `path/to/prelude/installation` is usually `~/.emacs.d` (at least
|
||||||
|
on Unix systems).
|
||||||
|
|
||||||
|
#### Restart Prelude
|
||||||
|
|
||||||
|
It's generally a good idea to stop Emacs after you do the update. The
|
||||||
|
next time Prelude starts it will install any new dependencies (if
|
||||||
|
there are such).
|
||||||
|
|
||||||
|
### Automatic update
|
||||||
|
|
||||||
|
Simply run <kbd>M-x prelude-update</kbd> from Emacs itself and restart Emacs afterwards.
|
||||||
|
|
||||||
|
## Pinning packages
|
||||||
|
|
||||||
|
By default, Prelude will install packages from the melpa and gnu package
|
||||||
|
repositories. Occasionally package integration can break when upgrading packages.
|
||||||
|
This can be avoided by pinning packages to stable versions in other repositories.
|
||||||
|
To do so, copy `prelude-pinned-packages.el` from the sample directory to
|
||||||
|
Prelude's root directory and adjust the [variables](https://www.gnu.org/software/emacs/manual/html_node/emacs/Package-Installation.html)
|
||||||
|
inside accordingly.
|
||||||
|
|
||||||
|
## Enabling additional modules
|
||||||
|
|
||||||
|
By default most of the modules that ship with Prelude are not loaded. For more information on the functionality provided by these modules visit the [docs](modules/doc/README.md).
|
||||||
|
|
||||||
|
```lisp
|
||||||
|
;;; Uncomment the modules you'd like to use and restart Prelude afterwards
|
||||||
|
|
||||||
|
(require 'prelude-c)
|
||||||
|
;; (require 'prelude-clojure)
|
||||||
|
;; (require 'prelude-coffee)
|
||||||
|
;; (require 'prelude-common-lisp)
|
||||||
|
;; (require 'prelude-css)
|
||||||
|
(require 'prelude-emacs-lisp)
|
||||||
|
(require 'prelude-erc)
|
||||||
|
;; (require 'prelude-erlang)
|
||||||
|
;; (require 'prelude-elixir)
|
||||||
|
;; (require 'prelude-haskell)
|
||||||
|
(require 'prelude-js)
|
||||||
|
;; (require 'prelude-latex)
|
||||||
|
(require 'prelude-lisp)
|
||||||
|
;; (require 'prelude-mediawiki)
|
||||||
|
(require 'prelude-org)
|
||||||
|
(require 'prelude-perl)
|
||||||
|
;; (require 'prelude-python)
|
||||||
|
;; (require 'prelude-ruby)
|
||||||
|
;; (require 'prelude-scala)
|
||||||
|
(require 'prelude-scheme)
|
||||||
|
;; (require 'prelude-scss)
|
||||||
|
;; (require 'prelude-web)
|
||||||
|
(require 'prelude-xml)
|
||||||
|
```
|
||||||
|
|
||||||
|
You'll need to adjust your `prelude-modules.el` file once the
|
||||||
|
installation is done. If you are doing a manual install then you first
|
||||||
|
need to copy the `prelude-modules.el` available in the sample
|
||||||
|
directory to the root of `path/to/prelude/installation` and then
|
||||||
|
adjust that one.
|
||||||
|
|
||||||
|
After you've uncommented a module you should either restart Emacs or evaluate the module
|
||||||
|
`require` expression with <kbd>C-x C-e</kbd>.
|
||||||
|
|
||||||
|
## Running
|
||||||
|
|
||||||
|
Nothing fancy here. Just start Emacs as usual. Personally I run Emacs
|
||||||
|
in daemon mode:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
emacs --daemon
|
||||||
|
```
|
||||||
|
|
||||||
|
Afterwards I connect to the server with either a terminal or a GUI
|
||||||
|
client like this:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
emacsclient -t
|
||||||
|
emacsclient -c
|
||||||
|
```
|
||||||
|
|
||||||
|
You'd probably do well to put a few aliases in your `.zshrc` (or
|
||||||
|
`.bashrc`):
|
||||||
|
|
||||||
|
```bash
|
||||||
|
alias e='emacsclient -t'
|
||||||
|
alias ec='emacsclient -c'
|
||||||
|
alias vim='emacsclient -t'
|
||||||
|
alias vi='emacsclient -t'
|
||||||
|
```
|
||||||
|
|
||||||
|
The last two aliases are helpful if you're used to editing files from
|
||||||
|
the command line using `vi(m)`.
|
||||||
|
|
||||||
|
You can also open a file with the cursor positioned directly on a specific line:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
emacsclient somefile:1234
|
||||||
|
```
|
||||||
|
|
||||||
|
This will open file 'somefile' and set cursor on line 1234.
|
||||||
|
|
||||||
|
## Getting to know Prelude
|
||||||
|
|
||||||
|
Certainly the best way to understand how Prelude enhances the default
|
||||||
|
Emacs experience is to peruse Prelude's source code (which is
|
||||||
|
obviously written in Emacs Lisp). Understanding the code is not
|
||||||
|
necessary of course. Prelude includes a `prelude-mode` minor Emacs mode
|
||||||
|
which collects some of the additional functionality added by
|
||||||
|
Prelude. It also adds an additional keymap that binds many of those
|
||||||
|
extensions to keybindings.
|
||||||
|
|
||||||
|
### Keymap
|
||||||
|
|
||||||
|
#### Global
|
||||||
|
|
||||||
|
Keybinding | Description
|
||||||
|
-------------------|------------------------------------------------------------
|
||||||
|
<kbd>C-x \\</kbd> | `align-regexp`
|
||||||
|
<kbd>C-+</kbd> | Increase font size(`text-scale-increase`).
|
||||||
|
<kbd>C--</kbd> | Decrease font size(`text-scale-decrease`).
|
||||||
|
<kbd>C-x O</kbd> | Go back to previous window (the inverse of `other-window` (`C-x o`)).
|
||||||
|
<kbd>C-^</kbd> | Join two lines into one(`crux-top-join-line`).
|
||||||
|
<kbd>C-x p</kbd> | Start `proced` (manage processes from Emacs; works only in Linux).
|
||||||
|
<kbd>C-x m</kbd> | Start `eshell`.
|
||||||
|
<kbd>C-x M-m</kbd> | Start your default shell.
|
||||||
|
<kbd>C-x C-m</kbd> | Alias for `M-x`.
|
||||||
|
<kbd>M-X</kbd> | Like `M-x` but limited to commands that are relevant to the active major mode.
|
||||||
|
<kbd>C-h A</kbd> | Run `apropos` (search in all Emacs symbols).
|
||||||
|
<kbd>C-h C-m</kbd> | Display key bindings of current major mode and descriptions of every binding.
|
||||||
|
<kbd>M-/</kbd> | Run `hippie-expand` (a replacement for the default `dabbrev-expand`).
|
||||||
|
<kbd>C-x C-b</kbd> | Open `ibuffer` (a replacement for the default `buffer-list`).
|
||||||
|
<kbd>F11</kbd> | Make the window full screen.
|
||||||
|
<kbd>F12</kbd> | Toggle the Emacs menu bar.
|
||||||
|
<kbd>C-x g</kbd> | Open Magit's status buffer.
|
||||||
|
<kbd>C-x M-g</kbd> | Open Magit's popup of popups.
|
||||||
|
<kbd>M-Z</kbd> | Zap up to char.
|
||||||
|
<kbd>C-=</kbd> | Run `expand-region` (incremental text selection).
|
||||||
|
<kbd>C-a</kbd> | Run `crux-move-beginning-of-line`. Read [this](http://emacsredux.com/blog/2013/05/22/smarter-navigation-to-the-beginning-of-a-line/) for details.
|
||||||
|
|
||||||
|
#### Prelude Mode
|
||||||
|
|
||||||
|
Keybinding | Description
|
||||||
|
-------------------|------------------------------------------------------------
|
||||||
|
<kbd>C-c o</kbd> | Open the currently visited file with an external program.
|
||||||
|
<kbd>C-c i</kbd> | Search for a symbol, only for buffers that contain code
|
||||||
|
<kbd>C-c g</kbd> | Search in Google for the thing under point (or an interactive query).
|
||||||
|
<kbd>C-c G</kbd> | Search in GitHub for the thing under point (or an interactive query).
|
||||||
|
<kbd>C-c y</kbd> | Search in YouTube for the thing under point (or an interactive query).
|
||||||
|
<kbd>C-c U</kbd> | Search in Duckduckgo for the thing under point (or an interactive query).
|
||||||
|
<kbd>C-S-RET</kbd> or <kbd>Super-o</kbd> | Insert an empty line above the current line and indent it properly.
|
||||||
|
<kbd>S-RET</kbd> or <kbd>M-o</kbd> | Insert an empty line and indent it properly (as in most IDEs).
|
||||||
|
<kbd>C-S-up</kbd> or <kbd>M-S-up</kbd> | Move the current line or region up.
|
||||||
|
<kbd>C-S-down</kbd> or <kbd>M-S-down</kbd>| Move the current line or region down.
|
||||||
|
<kbd>C-c n</kbd> | Fix indentation in buffer and strip whitespace.
|
||||||
|
<kbd>C-c f</kbd> | Open recently visited file.
|
||||||
|
<kbd>C-M-\\</kbd> | Indent region (if selected) or the entire buffer.
|
||||||
|
<kbd>C-c u</kbd> | Open a new buffer containing the contents of URL.
|
||||||
|
<kbd>C-c e</kbd> | Eval a bit of Emacs Lisp code and replace it with its result.
|
||||||
|
<kbd>C-c s</kbd> | Swap two active windows.
|
||||||
|
<kbd>C-c D</kbd> | Delete current file and buffer.
|
||||||
|
<kbd>C-c d</kbd> | Duplicate the current line (or region).
|
||||||
|
<kbd>C-c M-d</kbd> | Duplicate and comment the current line (or region).
|
||||||
|
<kbd>C-c r</kbd> | Rename the current buffer and its visiting file if any.
|
||||||
|
<kbd>C-c t</kbd> | Open a terminal emulator (`ansi-term`).
|
||||||
|
<kbd>C-c k</kbd> | Kill all open buffers except the one you're currently in.
|
||||||
|
<kbd>C-c TAB</kbd> | Indent and copy region to clipboard
|
||||||
|
<kbd>C-c I</kbd> | Open user's init file.
|
||||||
|
<kbd>C-c S</kbd> | Open shell's init file.
|
||||||
|
<kbd>C-c . +</kbd> | Increment integer at point. Default is +1.
|
||||||
|
<kbd>C-c . -</kbd> | Decrement integer at point. Default is -1.
|
||||||
|
<kbd>C-c . *</kbd> | Multiply integer at point. Default is *2.
|
||||||
|
<kbd>C-c . /</kbd> | Divide integer at point. Default is /2.
|
||||||
|
<kbd>C-c . \\</kbd> | Modulo integer at point. Default is modulo 2.
|
||||||
|
<kbd>C-c . ^</kbd> | Power to the integer at point. Default is ^2.
|
||||||
|
<kbd>C-c . <</kbd> | Left-shift integer at point. Default is 1 position to the left.
|
||||||
|
<kbd>C-c . ></kbd> | Right-shift integer at point. Default is 1 position to the right.
|
||||||
|
<kbd>C-c . #</kbd> | Convert integer at point to specified base. Default is 10.
|
||||||
|
<kbd>C-c . %</kbd> | Replace integer at point with another specified integer.
|
||||||
|
<kbd>C-c . '</kbd> | Perform arithmetic operations on integer at point. User specifies the operator.
|
||||||
|
<kbd>Super-g</kbd> | Toggle between God mode and non-God mode
|
||||||
|
<kbd>Super-r</kbd> | Recent files
|
||||||
|
<kbd>Super-j</kbd> | Join lines
|
||||||
|
<kbd>Super-k</kbd> | Kill whole line
|
||||||
|
<kbd>Super-m m</kbd> | Magit status
|
||||||
|
<kbd>Super-m l</kbd> | Magit log
|
||||||
|
<kbd>Super-m f</kbd> | Magit file log
|
||||||
|
<kbd>Super-m b</kbd> | Magit blame mode
|
||||||
|
|
||||||
|
**Note**: For various arithmetic operations, the prefix `C-c .` only needs to be pressed once for the first operation.
|
||||||
|
For subsequent operations, only the appropriate operations (i.e. `+`, `-`, `*`, `/`... needs to be pressed).
|
||||||
|
|
||||||
|
#### macOS modifier keys
|
||||||
|
|
||||||
|
Prelude does not mess by default with the standard mapping of `Command` (to `Super`) and `Option` (to `Meta`).
|
||||||
|
|
||||||
|
If you want to swap them add this to your personal config:
|
||||||
|
|
||||||
|
```lisp
|
||||||
|
(setq mac-command-modifier 'meta)
|
||||||
|
(setq mac-option-modifier 'super)
|
||||||
|
```
|
||||||
|
|
||||||
|
You can also temporarily swap them with `C-c w` (`M-x prelude-swap-meta-and-super`).
|
||||||
|
|
||||||
|
**Note**: I'd highly recommend to all macOS users to consider
|
||||||
|
[remapping Return to
|
||||||
|
Control](http://emacsredux.com/blog/2013/11/12/a-crazy-productivity-boost-remap-return-to-control/)
|
||||||
|
instead. That's an epic productivity boost and it's not as crazy as it sounds!
|
||||||
|
|
||||||
|
#### Projectile
|
||||||
|
|
||||||
|
Here's a list of functionality provided by [Projectile](https://github.com/bbatsov/projectile):
|
||||||
|
|
||||||
|
Keybinding | Description
|
||||||
|
-------------------|------------------------------------------------------------
|
||||||
|
<kbd>C-c p f</kbd> | Display a list of all files in the project. With a prefix argument it will clear the cache first.
|
||||||
|
<kbd>C-c p d</kbd> | Display a list of all directories in the project. With a prefix argument it will clear the cache first.
|
||||||
|
<kbd>C-c p T</kbd> | Display a list of all test files(specs, features, etc) in the project.
|
||||||
|
<kbd>C-c p s g</kbd> | Run grep on the files in the project.
|
||||||
|
<kbd>C-c p s s</kbd> | Runs `ag` on the project. Requires the presence of `ag.el`.
|
||||||
|
<kbd>M-- C-c p s g</kbd> | Run grep on `projectile-grep-default-files` in the project.
|
||||||
|
<kbd>C-c p b</kbd> | Display a list of all project buffers currently open.
|
||||||
|
<kbd>C-c p o</kbd> | Runs `multi-occur` on all project buffers currently open.
|
||||||
|
<kbd>C-c p r</kbd> | Runs interactive query-replace on all files in the projects.
|
||||||
|
<kbd>C-c p i</kbd> | Invalidates the project cache (if existing).
|
||||||
|
<kbd>C-c p R</kbd> | Regenerates the projects `TAGS` file.
|
||||||
|
<kbd>C-c p k</kbd> | Kills all project buffers.
|
||||||
|
<kbd>C-c p D</kbd> | Opens the root of the project in `dired`.
|
||||||
|
<kbd>C-c p e</kbd> | Shows a list of recently visited project files.
|
||||||
|
<kbd>C-c p a</kbd> | Switch between files with the same name but different extensions.
|
||||||
|
<kbd>C-c p c</kbd> | Runs a standard compilation command for your type of project.
|
||||||
|
<kbd>C-c p P</kbd> | Runs a standard test command for your type of project.
|
||||||
|
<kbd>C-c p z</kbd> | Adds the currently visited to the cache.
|
||||||
|
<kbd>C-c p p</kbd> | Display a list of known projects you can switch to.
|
||||||
|
|
||||||
|
Prelude adds an extra keymap prefix `S-p` (`S` stands for
|
||||||
|
`Super`), so you can use `S-p` instead of `C-c p`. By default on Windows keyboard
|
||||||
|
`Super` is mapped to the `Windows` key and on macOS keyboards `Super` is mapped
|
||||||
|
to the `Command` key.
|
||||||
|
|
||||||
|
If you ever forget any of Projectile's keybindings just do a:
|
||||||
|
|
||||||
|
<kbd>C-c p C-h</kbd>
|
||||||
|
|
||||||
|
#### Helm
|
||||||
|
|
||||||
|
Helm is setup according to this guide: [A Package in a league of its own: Helm](http://tuhdo.github.io/helm-intro.html).
|
||||||
|
|
||||||
|
You can learn Helm usage and key bindings following the guide. <kbd>C-c h</kbd> is Prelude's default prefix key for Helm.
|
||||||
|
If you don't remember any key binding, append <kbd>C-h</kbd> after <kbd>C-c h</kbd> for a list of key bindings in Helm.
|
||||||
|
|
||||||
|
If you love Helm and want to use Helm globally with enhanced `helm-find-files`, `helm-buffer-lists`..., you will have to also add `(require 'prelude-helm-everywhere)`.
|
||||||
|
When `prelude-helm-everywhere` is activated, Helm enables these global key bindings:
|
||||||
|
|
||||||
|
Key binding | Description
|
||||||
|
-------------------|----------------------------------------------
|
||||||
|
<kbd>M-x</kbd> | Run [helm-M-x](http://tuhdo.github.io/helm-intro.html#sec-3), an interactive version of <kbd>M-x</kdb>.
|
||||||
|
<kbd>M-y</kbd> | Run [helm-show-kill-ring](http://tuhdo.github.io/helm-intro.html#sec-4), shows the content of `kill-ring`.
|
||||||
|
<kbd>C-x b </kbd> | Run [helm-mini](http://tuhdo.github.io/helm-intro.html#sec-5), an interactive version of `C-x b` with more features.
|
||||||
|
<kbd>C-x C-f</kbd> | Run [helm-find-files](http://tuhdo.github.io/helm-intro.html#sec-6), an interactive version of `find-file` with more features.
|
||||||
|
<kbd>C-h f </kbd> | Run [helm-apropos](http://tuhdo.github.io/helm-intro.html#sec-13), an interactive version of `apropos-command`.
|
||||||
|
<kbd>C-h r</kbd> | Run [helm-info-emacs](http://tuhdo.github.io/helm-intro.html#sec-14), an interactive version of `info-emacs-manual`.
|
||||||
|
<kbd>C-h C-l </kbd>| Run `helm-locate-library` that can search for locations of any file loaded into Emacs.
|
||||||
|
|
||||||
|
This key binding is activated in `shell-mode`:
|
||||||
|
|
||||||
|
Key Binding | Description
|
||||||
|
-------------------|----------------------------------------------
|
||||||
|
<kbd>C-c C-l</kbd> | Run `helm-comint-input-ring` that shows `shell` history using Helm interface.
|
||||||
|
|
||||||
|
This key bindings is activated in `eshell-mode`:
|
||||||
|
|
||||||
|
Key Binding | Description
|
||||||
|
-------------------|----------------------------------------------
|
||||||
|
<kbd>C-c C-l</kbd> | Run `helm-eshell-history` that shows `eshell` history using Helm interface.
|
||||||
|
|
||||||
|
If you prefer Ido in everywhere, you should not add `prelude-helm-everywhere`, so you can use Helm along with Ido and Prelude's default commands.
|
||||||
|
|
||||||
|
You can always reactivate Helm with `(prelude-global-helm-global-mode-on)`.
|
||||||
|
|
||||||
|
**NOTICE**: In `helm-M-x`, you have to pass prefix argument *AFTER* you run `helm-M-x`,
|
||||||
|
because your prefix argument will be displayed in the modeline when in `helm-M-x`
|
||||||
|
buffer. Passing prefix argument **BEFORE** =helm-M-x= **has no effect**.
|
||||||
|
|
||||||
|
|
||||||
|
#### Key-chords
|
||||||
|
|
||||||
|
**Key-chords are available only when the `prelude-key-chord` module has been enabled.**
|
||||||
|
|
||||||
|
Keybinding | Description
|
||||||
|
-------------------|----------------------------------------------
|
||||||
|
<kbd>jj</kbd> | Jump to the beginning of a word(`avy-goto-word-1`)
|
||||||
|
<kbd>jk</kbd> | Jump to a character(`avy-goto-char`)
|
||||||
|
<kbd>jl</kbd> | Jump to the beginning of a line(`avy-goto-line`)
|
||||||
|
<kbd>JJ</kbd> | Jump back to previous buffer(`crux-switch-to-previous-buffer`)
|
||||||
|
<kbd>uu</kbd> | View edits as a tree(`undo-tree-visualize`)
|
||||||
|
<kbd>xx</kbd> | Executed extended command(`execute-extended-command`)
|
||||||
|
<kbd>yy</kbd> | Browse the kill ring(`browse-kill-ring`)
|
||||||
|
|
||||||
|
##### Disabling key-chords
|
||||||
|
|
||||||
|
In some cases you may not want to have a key-chord that is defined by prelude,
|
||||||
|
in which case you can disable the binding in your `personal.el` file by setting
|
||||||
|
its command to `nil`. For example, to disable the `jj` key-chord add the
|
||||||
|
following line:
|
||||||
|
|
||||||
|
```lisp
|
||||||
|
(key-chord-define-global "jj" nil)
|
||||||
|
```
|
||||||
|
|
||||||
|
If you're an `evil-mode` user you'll probably do well to disable `key-chord-mode` altogether:
|
||||||
|
|
||||||
|
```lisp
|
||||||
|
(key-chord-mode -1)
|
||||||
|
```
|
||||||
|
|
||||||
|
#### vim emulation
|
||||||
|
|
||||||
|
If you want to use vim inside of emacs enable the `prelude-evil` module which provides
|
||||||
|
support for `evil-mode`.
|
||||||
|
|
||||||
|
## Automatic package installation
|
||||||
|
|
||||||
|
The default Prelude installation comes with a bare minimum of
|
||||||
|
functionality. It will however install add-ons for various programming
|
||||||
|
languages and frameworks on demand. For instance - if you try to open
|
||||||
|
a `.clj` file `clojure-mode`, `cider` and Prelude's enhanced Lisp
|
||||||
|
configuration will be installed automatically for you.
|
||||||
|
|
||||||
|
You can, of course, install anything you wish manually as well.
|
||||||
|
|
||||||
|
### Color Themes
|
||||||
|
|
||||||
|
Emacs provides a dozen of
|
||||||
|
built-in themes you can use out-of-the-box by invoking the `M-x
|
||||||
|
load-theme` command.
|
||||||
|
|
||||||
|
[Zenburn](https://github.com/bbatsov/zenburn-emacs) is the default
|
||||||
|
color theme in Prelude, but you can change it at your discretion. Why
|
||||||
|
Zenburn? I (and lots of hackers around the world) find it pretty neat
|
||||||
|
for some reason. Personally I find the default theme pretty tiresome
|
||||||
|
for the eyes, that's why I took that "controversial" decision to
|
||||||
|
replace it. You can, of course, easily go back to the default (or
|
||||||
|
select another theme entirely).
|
||||||
|
|
||||||
|
To disable Zenburn just put in your personal config the following
|
||||||
|
line:
|
||||||
|
|
||||||
|
```lisp
|
||||||
|
(disable-theme 'zenburn)
|
||||||
|
```
|
||||||
|
|
||||||
|
Or you can use another theme altogether by adding something in `personal/preload` like:
|
||||||
|
|
||||||
|
```lisp
|
||||||
|
(prelude-require-package 'solarized)
|
||||||
|
(setq prelude-theme 'solarized-dark)
|
||||||
|
```
|
||||||
|
|
||||||
|
**Note** [Solarized](https://github.com/bbatsov/zenburn-emacs) is not
|
||||||
|
available by default - you'll have to install it from MELPA first,
|
||||||
|
therefore the need for `prelude-require-package`. Alternatively you
|
||||||
|
can manually install the package like this - `M-x package-install RET
|
||||||
|
solarized-theme`.
|
||||||
|
|
||||||
|
Finally, if you don't want any theme at all, you can add this to your
|
||||||
|
`personal/preload`:
|
||||||
|
|
||||||
|
```lisp
|
||||||
|
(setq prelude-theme nil)
|
||||||
|
```
|
||||||
|
|
||||||
|
### Personalizing
|
||||||
|
|
||||||
|
**Fork** (instead of cloning) the official Prelude repo and add your
|
||||||
|
own touch to it. You're advised to **avoid changing stuff outside of
|
||||||
|
the personal folder** to avoid having to deal with git merge conflicts
|
||||||
|
in the future.
|
||||||
|
|
||||||
|
If you'd like to add some auto installation of packages in your
|
||||||
|
personal config use the following code:
|
||||||
|
|
||||||
|
```lisp
|
||||||
|
(prelude-require-packages '(some-package some-other-package))
|
||||||
|
```
|
||||||
|
|
||||||
|
If you require just a single package you can also use:
|
||||||
|
|
||||||
|
```lisp
|
||||||
|
(prelude-require-package 'some-package)
|
||||||
|
```
|
||||||
|
|
||||||
|
#### Preloading personal config
|
||||||
|
|
||||||
|
Sometimes you might want to load code before Prelude has started loading. Prelude will automatically preload all
|
||||||
|
Emacs Lisp files in your `personal/preload` directory. Note that at this point you can't using anything from
|
||||||
|
Prelude, except a few variables like `prelude-dir`, etc (since nothing is yet loaded).
|
||||||
|
|
||||||
|
#### Disabling whitespace-mode
|
||||||
|
|
||||||
|
Although `whitespace-mode` is awesome, some people might find it too
|
||||||
|
intrusive. You can disable it in your
|
||||||
|
personal config with the following bit of code:
|
||||||
|
|
||||||
|
```lisp
|
||||||
|
(setq prelude-whitespace nil)
|
||||||
|
```
|
||||||
|
|
||||||
|
If you like `whitespace-mode`, but prefer it to not automatically
|
||||||
|
cleanup your file on save, you can disable that behavior by setting
|
||||||
|
`prelude-clean-whitespace-on-save` to `nil` in your config file with:
|
||||||
|
|
||||||
|
```lisp
|
||||||
|
(setq prelude-clean-whitespace-on-save nil)
|
||||||
|
```
|
||||||
|
|
||||||
|
The `prelude-clean-whitespace-on-save` setting can also be set on a
|
||||||
|
per-file or directory basis by using a file variable or a
|
||||||
|
`.dir-locals.el` file.
|
||||||
|
|
||||||
|
|
||||||
|
#### Disable flyspell-mode
|
||||||
|
|
||||||
|
If you're not fond of spellchecking on the fly:
|
||||||
|
|
||||||
|
```lisp
|
||||||
|
(setq prelude-flyspell nil)
|
||||||
|
```
|
||||||
|
|
||||||
|
## Caveats & Pitfalls
|
||||||
|
|
||||||
|
### Updating bundled packages
|
||||||
|
|
||||||
|
Generally it's a good idea to do a package update before running
|
||||||
|
updating Prelude, since the latest Prelude code might depend on newer
|
||||||
|
versions of the bundled packages than you would currently have
|
||||||
|
installed.
|
||||||
|
|
||||||
|
If you're doing manual Prelude updates you should always do a package update first.
|
||||||
|
|
||||||
|
`M-x package-list-packages RET U x`
|
||||||
|
|
||||||
|
That's not necessary if you're using `M-x prelude-update`, since it
|
||||||
|
will automatically update the installed packages.
|
||||||
|
|
||||||
|
### Problems with flyspell-mode
|
||||||
|
|
||||||
|
Prelude makes heavy use of the flyspell-mode package for spell
|
||||||
|
checking of various things. The proper operation of flyspell depends
|
||||||
|
on the presence of the `aspell` program and an `en` dictionary on your
|
||||||
|
system. You can install `aspell` and the dictionary on OS X with
|
||||||
|
`homebrew` like this:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
brew install aspell --with-lang=en
|
||||||
|
```
|
||||||
|
|
||||||
|
On Linux distros - just use your distro's package manager.
|
||||||
|
|
||||||
|
### Ugly colors in the terminal Emacs version
|
||||||
|
|
||||||
|
If your Emacs looks considerably uglier in a terminal (compared to the
|
||||||
|
GUI version) try adding this to your `.bashrc` or `.zshrc`:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
export TERM=xterm-256color
|
||||||
|
```
|
||||||
|
|
||||||
|
Source the `.bashrc` file and start Emacs again.
|
||||||
|
|
||||||
|
### MELPA error on initial startup
|
||||||
|
|
||||||
|
If you get some http connection error related to the MELPA repo
|
||||||
|
just do a manual `M-x package-refresh-contents` and restart Emacs
|
||||||
|
afterwards.
|
||||||
|
|
||||||
|
### Warnings on arrow navigation in editor buffers
|
||||||
|
|
||||||
|
This is not a bug - it's a feature! I firmly believe that the one true
|
||||||
|
way to use Emacs is by using it the way it was intended to be used (as
|
||||||
|
far as navigation is concerned at least).
|
||||||
|
|
||||||
|
If you'd like to be take this a step further and disable the arrow key navigation
|
||||||
|
completely put this in your personal config:
|
||||||
|
|
||||||
|
```lisp
|
||||||
|
(setq guru-warn-only nil)
|
||||||
|
```
|
||||||
|
|
||||||
|
To disable `guru-mode` completely add the following snippet to your
|
||||||
|
personal Emacs config:
|
||||||
|
|
||||||
|
```lisp
|
||||||
|
(setq prelude-guru nil)
|
||||||
|
```
|
||||||
|
|
||||||
|
### Customized C-a behavior
|
||||||
|
|
||||||
|
Prelude overrides `C-a` to behave as described
|
||||||
|
[here](http://emacsredux.com/blog/2013/05/22/smarter-navigation-to-the-beginning-of-a-line/). If
|
||||||
|
you don't like that simply add this to your personal config:
|
||||||
|
|
||||||
|
```lisp
|
||||||
|
(global-set-key [remap move-beginning-of-line]
|
||||||
|
'move-beginning-of-line)
|
||||||
|
```
|
||||||
|
|
||||||
|
### Poor ido matching performance on large datasets
|
||||||
|
|
||||||
|
Prelude swaps the default `ido` flex matching with the more powerful
|
||||||
|
[ido-flx](https://github.com/lewang/flx).
|
||||||
|
|
||||||
|
The sorting algorithm `flx` uses is more complex, but yields better results.
|
||||||
|
|
||||||
|
On slower machines, it may be necessary to lower `flx-ido-threshold` to
|
||||||
|
ensure a smooth experience.
|
||||||
|
|
||||||
|
```lisp
|
||||||
|
(setq flx-ido-threshold 1000)
|
||||||
|
```
|
||||||
|
|
||||||
|
You can always disable the improved sorting algorithm all together like this:
|
||||||
|
|
||||||
|
```lisp
|
||||||
|
(flx-ido-mode -1)
|
||||||
|
```
|
||||||
|
|
||||||
|
### Windows compatibility
|
||||||
|
|
||||||
|
While everything in Prelude should work fine in Windows, I test it only
|
||||||
|
with Linux & OS X, so there are Windows related problems from time to
|
||||||
|
time. This situation will probably improve over time.
|
||||||
|
|
||||||
|
## Known issues
|
||||||
|
|
||||||
|
Check out the project's
|
||||||
|
[issue list](https://github.com/bbatsov/prelude/issues?sort=created&direction=desc&state=open)
|
||||||
|
a list of unresolved issues. By the way - feel free to fix any of them
|
||||||
|
and send me a pull request. :-)
|
||||||
|
|
||||||
|
## Support
|
||||||
|
|
||||||
|
Support is available via several channels:
|
||||||
|
|
||||||
|
* Prelude's Google Group <emacs-prelude@googlegroups.com>
|
||||||
|
* Prelude's Freenode channel (`#prelude-emacs`)
|
||||||
|
* [Gitter](https://gitter.im/bbatsov/prelude)
|
||||||
|
.
|
||||||
|
## Contributors
|
||||||
|
|
||||||
|
Here's a [list](https://github.com/bbatsov/prelude/contributors) of all the people who have contributed to the
|
||||||
|
development of Emacs Prelude.
|
||||||
|
|
||||||
|
## Bugs & Improvements
|
||||||
|
|
||||||
|
Bug reports and suggestions for improvements are always
|
||||||
|
welcome. GitHub pull requests are even better! :-)
|
||||||
|
|
||||||
|
Cheers,<br/>
|
||||||
|
[Bozhidar](https://twitter.com/bbatsov)
|
||||||
|
|
||||||
|
[badge-license]: https://img.shields.io/badge/license-GPL_3-green.svg
|
|
@ -0,0 +1,178 @@
|
||||||
|
;;; prelude-core.el --- Emacs Prelude: Core Prelude functions.
|
||||||
|
;;
|
||||||
|
;; Copyright © 2011-2017 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:
|
||||||
|
|
||||||
|
;; Here are the definitions of most of the functions added by 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 'thingatpt)
|
||||||
|
(require 'dash)
|
||||||
|
(require 'ov)
|
||||||
|
|
||||||
|
(defun prelude-buffer-mode (buffer-or-name)
|
||||||
|
"Retrieve the `major-mode' of BUFFER-OR-NAME."
|
||||||
|
(with-current-buffer buffer-or-name
|
||||||
|
major-mode))
|
||||||
|
|
||||||
|
(defun prelude-search (query-url prompt)
|
||||||
|
"Open the search url constructed with the QUERY-URL.
|
||||||
|
PROMPT sets the `read-string prompt."
|
||||||
|
(browse-url
|
||||||
|
(concat query-url
|
||||||
|
(url-hexify-string
|
||||||
|
(if mark-active
|
||||||
|
(buffer-substring (region-beginning) (region-end))
|
||||||
|
(read-string prompt))))))
|
||||||
|
|
||||||
|
(defmacro prelude-install-search-engine (search-engine-name search-engine-url search-engine-prompt)
|
||||||
|
"Given some information regarding a search engine, install the interactive command to search through them"
|
||||||
|
`(defun ,(intern (format "prelude-%s" search-engine-name)) ()
|
||||||
|
,(format "Search %s with a query or region if any." search-engine-name)
|
||||||
|
(interactive)
|
||||||
|
(prelude-search ,search-engine-url ,search-engine-prompt)))
|
||||||
|
|
||||||
|
(prelude-install-search-engine "google" "http://www.google.com/search?q=" "Google: ")
|
||||||
|
(prelude-install-search-engine "youtube" "http://www.youtube.com/results?search_query=" "Search YouTube: ")
|
||||||
|
(prelude-install-search-engine "github" "https://github.com/search?q=" "Search GitHub: ")
|
||||||
|
(prelude-install-search-engine "duckduckgo" "https://duckduckgo.com/?t=lm&q=" "Search DuckDuckGo: ")
|
||||||
|
|
||||||
|
(defun prelude-todo-ov-evaporate (_ov _after _beg _end &optional _length)
|
||||||
|
(let ((inhibit-modification-hooks t))
|
||||||
|
(if _after (ov-reset _ov))))
|
||||||
|
|
||||||
|
(defun prelude-annotate-todo ()
|
||||||
|
"Put fringe marker on TODO: lines in the current buffer."
|
||||||
|
(interactive)
|
||||||
|
(ov-set (format "[[:space:]]*%s+[[:space:]]*TODO:" comment-start)
|
||||||
|
'before-string
|
||||||
|
(propertize (format "A")
|
||||||
|
'display '(left-fringe right-triangle))
|
||||||
|
'modification-hooks '(prelude-todo-ov-evaporate)))
|
||||||
|
|
||||||
|
(defun prelude-recompile-init ()
|
||||||
|
"Byte-compile all your dotfiles again."
|
||||||
|
(interactive)
|
||||||
|
(byte-recompile-directory prelude-dir 0))
|
||||||
|
|
||||||
|
(defvar prelude-tips
|
||||||
|
'("Press <C-c o> to open a file with external program."
|
||||||
|
"Press <C-c p f> to navigate a project's files with ido."
|
||||||
|
"Press <s-r> to open a recently visited file."
|
||||||
|
"Press <C-c p s g> to run grep on a project."
|
||||||
|
"Press <C-c p p> to switch between projects."
|
||||||
|
"Press <C-=> to expand the selected region."
|
||||||
|
"Press <C-c g> to search in Google."
|
||||||
|
"Press <C-c G> to search in GitHub."
|
||||||
|
"Press <C-c y> to search in YouTube."
|
||||||
|
"Press <C-c U> to search in DuckDuckGo."
|
||||||
|
"Press <C-c r> to rename the current buffer and the file it's visiting if any."
|
||||||
|
"Press <C-c t> to open a terminal in Emacs."
|
||||||
|
"Press <C-c k> to kill all the buffers, but the active one."
|
||||||
|
"Press <C-x g> to run magit-status."
|
||||||
|
"Press <C-c D> to delete the current file and buffer."
|
||||||
|
"Press <C-c s> to swap two windows."
|
||||||
|
"Press <S-RET> or <M-o> to open a line beneath the current one."
|
||||||
|
"Press <s-o> to open a line above the current one."
|
||||||
|
"Press <C-c C-z> in a Elisp buffer to launch an interactive Elisp shell."
|
||||||
|
"Press <C-Backspace> to kill a line backwards."
|
||||||
|
"Press <C-S-Backspace> or <s-k> to kill the whole line."
|
||||||
|
"Press <s-j> or <C-^> to join lines."
|
||||||
|
"Press <s-.> or <C-c j> to jump to the start of a word in any visible window."
|
||||||
|
"Press <f11> to toggle fullscreen mode."
|
||||||
|
"Press <f12> to toggle the menu bar."
|
||||||
|
"Explore the Tools->Prelude menu to find out about some of Prelude extensions to Emacs."
|
||||||
|
"Access the official Emacs manual by pressing <C-h r>."
|
||||||
|
"Visit the EmacsWiki at http://emacswiki.org to find out even more about Emacs."))
|
||||||
|
|
||||||
|
(defun prelude-tip-of-the-day ()
|
||||||
|
"Display a random entry from `prelude-tips'."
|
||||||
|
(interactive)
|
||||||
|
(when (and prelude-tips (not (window-minibuffer-p)))
|
||||||
|
;; pick a new random seed
|
||||||
|
(random t)
|
||||||
|
(message
|
||||||
|
(concat "Prelude tip: " (nth (random (length prelude-tips)) prelude-tips)))))
|
||||||
|
|
||||||
|
(defun prelude-eval-after-init (form)
|
||||||
|
"Add `(lambda () FORM)' to `after-init-hook'.
|
||||||
|
|
||||||
|
If Emacs has already finished initialization, also eval FORM immediately."
|
||||||
|
(let ((func (list 'lambda nil form)))
|
||||||
|
(add-hook 'after-init-hook func)
|
||||||
|
(when after-init-time
|
||||||
|
(eval form))))
|
||||||
|
|
||||||
|
(require 'epl)
|
||||||
|
|
||||||
|
(defun prelude-update ()
|
||||||
|
"Update Prelude to its latest version."
|
||||||
|
(interactive)
|
||||||
|
(when (y-or-n-p "Do you want to update Prelude? ")
|
||||||
|
(message "Updating installed packages...")
|
||||||
|
(epl-upgrade)
|
||||||
|
(message "Updating Prelude...")
|
||||||
|
(cd prelude-dir)
|
||||||
|
(shell-command "git pull")
|
||||||
|
(prelude-recompile-init)
|
||||||
|
(message "Update finished. Restart Emacs to complete the process.")))
|
||||||
|
|
||||||
|
(defun prelude-update-packages (&optional arg)
|
||||||
|
"Update Prelude's packages.
|
||||||
|
This includes package installed via `prelude-require-package'.
|
||||||
|
|
||||||
|
With a prefix ARG updates all installed packages."
|
||||||
|
(interactive "P")
|
||||||
|
(when (y-or-n-p "Do you want to update Prelude's packages? ")
|
||||||
|
(if arg
|
||||||
|
(epl-upgrade)
|
||||||
|
(epl-upgrade (-filter (lambda (p) (memq (epl-package-name p) prelude-packages))
|
||||||
|
(epl-installed-packages))))
|
||||||
|
(message "Update finished. Restart Emacs to complete the process.")))
|
||||||
|
|
||||||
|
;;; Emacs in OSX already has fullscreen support
|
||||||
|
;;; Emacs has a similar built-in command in 24.4
|
||||||
|
(defun prelude-fullscreen ()
|
||||||
|
"Make Emacs window fullscreen.
|
||||||
|
|
||||||
|
This follows freedesktop standards, should work in X servers."
|
||||||
|
(interactive)
|
||||||
|
(if (eq window-system 'x)
|
||||||
|
(x-send-client-message nil 0 nil "_NET_WM_STATE" 32
|
||||||
|
'(2 "_NET_WM_STATE_FULLSCREEN" 0))
|
||||||
|
(error "Only X server is supported")))
|
||||||
|
|
||||||
|
(defun prelude-wrap-with (s)
|
||||||
|
"Create a wrapper function for smartparens using S."
|
||||||
|
`(lambda (&optional arg)
|
||||||
|
(interactive "P")
|
||||||
|
(sp-wrap-with-pair ,s)))
|
||||||
|
|
||||||
|
(provide 'prelude-core)
|
||||||
|
;;; prelude-core.el ends here
|
|
@ -0,0 +1,103 @@
|
||||||
|
;;; prelude-custom.el --- Emacs Prelude: Prelude's customizable variables.
|
||||||
|
;;
|
||||||
|
;; Copyright © 2011-2017 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
|
||||||
|
`crux-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,440 @@
|
||||||
|
;;; prelude-editor.el --- Emacs Prelude: enhanced core editing experience.
|
||||||
|
;;
|
||||||
|
;; Copyright © 2011-2017 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:
|
||||||
|
|
||||||
|
;; Death to the tabs! However, tabs historically indent to the next
|
||||||
|
;; 8-character offset; specifying anything else will cause *mass*
|
||||||
|
;; confusion, as it will change the appearance of every existing file.
|
||||||
|
;; In some cases (python), even worse -- it will change the semantics
|
||||||
|
;; (meaning) of the program.
|
||||||
|
;;
|
||||||
|
;; Emacs modes typically provide a standard means to change the
|
||||||
|
;; indentation width -- eg. c-basic-offset: use that to adjust your
|
||||||
|
;; personal indentation width, while maintaining the style (and
|
||||||
|
;; meaning) of any files you load.
|
||||||
|
(setq-default indent-tabs-mode nil) ;; don't use tabs to indent
|
||||||
|
(setq-default tab-width 8) ;; but maintain correct appearance
|
||||||
|
|
||||||
|
;; Newline at end of file
|
||||||
|
(setq require-final-newline t)
|
||||||
|
|
||||||
|
;; delete the selection with a keypress
|
||||||
|
(delete-selection-mode t)
|
||||||
|
|
||||||
|
;; store all backup and autosave files in the tmp dir
|
||||||
|
(setq backup-directory-alist
|
||||||
|
`((".*" . ,temporary-file-directory)))
|
||||||
|
(setq auto-save-file-name-transforms
|
||||||
|
`((".*" ,temporary-file-directory t)))
|
||||||
|
|
||||||
|
;; autosave the undo-tree history
|
||||||
|
(setq undo-tree-history-directory-alist
|
||||||
|
`((".*" . ,temporary-file-directory)))
|
||||||
|
(setq undo-tree-auto-save-history t)
|
||||||
|
|
||||||
|
;; revert buffers automatically when underlying files are changed externally
|
||||||
|
(global-auto-revert-mode t)
|
||||||
|
|
||||||
|
;; hippie expand is dabbrev expand on steroids
|
||||||
|
(setq hippie-expand-try-functions-list '(try-expand-dabbrev
|
||||||
|
try-expand-dabbrev-all-buffers
|
||||||
|
try-expand-dabbrev-from-kill
|
||||||
|
try-complete-file-name-partially
|
||||||
|
try-complete-file-name
|
||||||
|
try-expand-all-abbrevs
|
||||||
|
try-expand-list
|
||||||
|
try-expand-line
|
||||||
|
try-complete-lisp-symbol-partially
|
||||||
|
try-complete-lisp-symbol))
|
||||||
|
|
||||||
|
;; smart tab behavior - indent or complete
|
||||||
|
(setq tab-always-indent 'complete)
|
||||||
|
|
||||||
|
;; smart pairing for all
|
||||||
|
(require 'smartparens-config)
|
||||||
|
(setq sp-base-key-bindings 'paredit)
|
||||||
|
(setq sp-autoskip-closing-pair 'always)
|
||||||
|
(setq sp-hybrid-kill-entire-symbol nil)
|
||||||
|
(sp-use-paredit-bindings)
|
||||||
|
|
||||||
|
(show-smartparens-global-mode +1)
|
||||||
|
|
||||||
|
(define-key prog-mode-map (kbd "M-(") (prelude-wrap-with "("))
|
||||||
|
;; FIXME: pick terminal friendly binding
|
||||||
|
;; (define-key prog-mode-map (kbd "M-[") (prelude-wrap-with "["))
|
||||||
|
(define-key prog-mode-map (kbd "M-\"") (prelude-wrap-with "\""))
|
||||||
|
|
||||||
|
;; disable annoying blink-matching-paren
|
||||||
|
(setq blink-matching-paren nil)
|
||||||
|
|
||||||
|
;; diminish keeps the modeline tidy
|
||||||
|
(require 'diminish)
|
||||||
|
|
||||||
|
;; meaningful names for buffers with the same name
|
||||||
|
(require 'uniquify)
|
||||||
|
(setq uniquify-buffer-name-style 'forward)
|
||||||
|
(setq uniquify-separator "/")
|
||||||
|
(setq uniquify-after-kill-buffer-p t) ; rename after killing uniquified
|
||||||
|
(setq uniquify-ignore-buffers-re "^\\*") ; don't muck with special buffers
|
||||||
|
|
||||||
|
;; saveplace remembers your location in a file when saving files
|
||||||
|
(setq save-place-file (expand-file-name "saveplace" prelude-savefile-dir))
|
||||||
|
;; activate it for all buffers
|
||||||
|
(if (< emacs-major-version 25)
|
||||||
|
(progn (require 'saveplace)
|
||||||
|
(setq-default save-place t))
|
||||||
|
(save-place-mode 1))
|
||||||
|
|
||||||
|
;; savehist keeps track of some history
|
||||||
|
(require 'savehist)
|
||||||
|
(setq savehist-additional-variables
|
||||||
|
;; search entries
|
||||||
|
'(search-ring regexp-search-ring)
|
||||||
|
;; save every minute
|
||||||
|
savehist-autosave-interval 60
|
||||||
|
;; keep the home clean
|
||||||
|
savehist-file (expand-file-name "savehist" prelude-savefile-dir))
|
||||||
|
(savehist-mode +1)
|
||||||
|
|
||||||
|
;; save recent files
|
||||||
|
(require 'recentf)
|
||||||
|
(setq recentf-save-file (expand-file-name "recentf" prelude-savefile-dir)
|
||||||
|
recentf-max-saved-items 500
|
||||||
|
recentf-max-menu-items 15
|
||||||
|
;; disable recentf-cleanup on Emacs start, because it can cause
|
||||||
|
;; problems with remote files
|
||||||
|
recentf-auto-cleanup 'never)
|
||||||
|
|
||||||
|
(defun prelude-recentf-exclude-p (file)
|
||||||
|
"A predicate to decide whether to exclude FILE from recentf."
|
||||||
|
(let ((file-dir (file-truename (file-name-directory file))))
|
||||||
|
(-any-p (lambda (dir)
|
||||||
|
(string-prefix-p dir file-dir))
|
||||||
|
(mapcar 'file-truename (list prelude-savefile-dir package-user-dir)))))
|
||||||
|
|
||||||
|
(add-to-list 'recentf-exclude 'prelude-recentf-exclude-p)
|
||||||
|
|
||||||
|
(recentf-mode +1)
|
||||||
|
|
||||||
|
;; use shift + arrow keys to switch between visible buffers
|
||||||
|
(require 'windmove)
|
||||||
|
(windmove-default-keybindings)
|
||||||
|
|
||||||
|
;; automatically save buffers associated with files on buffer switch
|
||||||
|
;; and on windows switch
|
||||||
|
(defun prelude-auto-save-command ()
|
||||||
|
"Save the current buffer if `prelude-auto-save' is not nil."
|
||||||
|
(when (and prelude-auto-save
|
||||||
|
buffer-file-name
|
||||||
|
(buffer-modified-p (current-buffer))
|
||||||
|
(file-writable-p buffer-file-name))
|
||||||
|
(save-buffer)))
|
||||||
|
|
||||||
|
(defmacro advise-commands (advice-name commands class &rest body)
|
||||||
|
"Apply advice named ADVICE-NAME to multiple COMMANDS.
|
||||||
|
|
||||||
|
The body of the advice is in BODY."
|
||||||
|
`(progn
|
||||||
|
,@(mapcar (lambda (command)
|
||||||
|
`(defadvice ,command (,class ,(intern (concat (symbol-name command) "-" advice-name)) activate)
|
||||||
|
,@body))
|
||||||
|
commands)))
|
||||||
|
|
||||||
|
;; advise all window switching functions
|
||||||
|
(advise-commands "auto-save"
|
||||||
|
(switch-to-buffer other-window windmove-up windmove-down windmove-left windmove-right)
|
||||||
|
before
|
||||||
|
(prelude-auto-save-command))
|
||||||
|
|
||||||
|
(add-hook 'mouse-leave-buffer-hook 'prelude-auto-save-command)
|
||||||
|
|
||||||
|
(when (version<= "24.4" emacs-version)
|
||||||
|
(add-hook 'focus-out-hook 'prelude-auto-save-command))
|
||||||
|
|
||||||
|
(defadvice set-buffer-major-mode (after set-major-mode activate compile)
|
||||||
|
"Set buffer major mode according to `auto-mode-alist'."
|
||||||
|
(let* ((name (buffer-name buffer))
|
||||||
|
(mode (assoc-default name auto-mode-alist 'string-match)))
|
||||||
|
(when (and mode (consp mode))
|
||||||
|
(setq mode (car mode)))
|
||||||
|
(with-current-buffer buffer (if mode (funcall mode)))))
|
||||||
|
|
||||||
|
;; highlight the current line
|
||||||
|
(global-hl-line-mode +1)
|
||||||
|
|
||||||
|
(require 'volatile-highlights)
|
||||||
|
(volatile-highlights-mode t)
|
||||||
|
(diminish 'volatile-highlights-mode)
|
||||||
|
|
||||||
|
;; note - this should be after volatile-highlights is required
|
||||||
|
;; add the ability to cut the current line, without marking it
|
||||||
|
(require 'rect)
|
||||||
|
(crux-with-region-or-line kill-region)
|
||||||
|
|
||||||
|
;; tramp, for sudo access
|
||||||
|
(require 'tramp)
|
||||||
|
;; keep in mind known issues with zsh - see emacs wiki
|
||||||
|
(setq tramp-default-method "ssh")
|
||||||
|
|
||||||
|
(set-default 'imenu-auto-rescan t)
|
||||||
|
|
||||||
|
;; flyspell-mode does spell-checking on the fly as you type
|
||||||
|
(require 'flyspell)
|
||||||
|
(setq ispell-program-name "aspell" ; use aspell instead of ispell
|
||||||
|
ispell-extra-args '("--sug-mode=ultra"))
|
||||||
|
|
||||||
|
(defun prelude-enable-flyspell ()
|
||||||
|
"Enable command `flyspell-mode' if `prelude-flyspell' is not nil."
|
||||||
|
(when (and prelude-flyspell (executable-find ispell-program-name))
|
||||||
|
(flyspell-mode +1)))
|
||||||
|
|
||||||
|
(defun prelude-cleanup-maybe ()
|
||||||
|
"Invoke `whitespace-cleanup' if `prelude-clean-whitespace-on-save' is not nil."
|
||||||
|
(when prelude-clean-whitespace-on-save
|
||||||
|
(whitespace-cleanup)))
|
||||||
|
|
||||||
|
(defun prelude-enable-whitespace ()
|
||||||
|
"Enable `whitespace-mode' if `prelude-whitespace' is not nil."
|
||||||
|
(when prelude-whitespace
|
||||||
|
;; keep the whitespace decent all the time (in this buffer)
|
||||||
|
(add-hook 'before-save-hook 'prelude-cleanup-maybe nil t)
|
||||||
|
(whitespace-mode +1)))
|
||||||
|
|
||||||
|
(add-hook 'text-mode-hook 'prelude-enable-flyspell)
|
||||||
|
(add-hook 'text-mode-hook 'prelude-enable-whitespace)
|
||||||
|
|
||||||
|
;; enable narrowing commands
|
||||||
|
(put 'narrow-to-region 'disabled nil)
|
||||||
|
(put 'narrow-to-page 'disabled nil)
|
||||||
|
(put 'narrow-to-defun 'disabled nil)
|
||||||
|
|
||||||
|
;; enabled change region case commands
|
||||||
|
(put 'upcase-region 'disabled nil)
|
||||||
|
(put 'downcase-region 'disabled nil)
|
||||||
|
|
||||||
|
;; enable erase-buffer command
|
||||||
|
(put 'erase-buffer 'disabled nil)
|
||||||
|
|
||||||
|
(require 'expand-region)
|
||||||
|
|
||||||
|
;; bookmarks
|
||||||
|
(require 'bookmark)
|
||||||
|
(setq bookmark-default-file (expand-file-name "bookmarks" prelude-savefile-dir)
|
||||||
|
bookmark-save-flag 1)
|
||||||
|
|
||||||
|
;; projectile is a project management mode
|
||||||
|
(require 'projectile)
|
||||||
|
(setq projectile-cache-file (expand-file-name "projectile.cache" prelude-savefile-dir))
|
||||||
|
(projectile-global-mode t)
|
||||||
|
|
||||||
|
;; avy allows us to effectively navigate to visible things
|
||||||
|
(require 'avy)
|
||||||
|
(setq avy-background t)
|
||||||
|
(setq avy-style 'at-full)
|
||||||
|
|
||||||
|
;; anzu-mode enhances isearch & query-replace by showing total matches and current match position
|
||||||
|
(require 'anzu)
|
||||||
|
(diminish 'anzu-mode)
|
||||||
|
(global-anzu-mode)
|
||||||
|
|
||||||
|
(global-set-key (kbd "M-%") 'anzu-query-replace)
|
||||||
|
(global-set-key (kbd "C-M-%") 'anzu-query-replace-regexp)
|
||||||
|
|
||||||
|
;; dired - reuse current buffer by pressing 'a'
|
||||||
|
(put 'dired-find-alternate-file 'disabled nil)
|
||||||
|
|
||||||
|
;; always delete and copy recursively
|
||||||
|
(setq dired-recursive-deletes 'always)
|
||||||
|
(setq dired-recursive-copies 'always)
|
||||||
|
|
||||||
|
;; if there is a dired buffer displayed in the next window, use its
|
||||||
|
;; current subdir, instead of the current subdir of this dired buffer
|
||||||
|
(setq dired-dwim-target t)
|
||||||
|
|
||||||
|
;; enable some really cool extensions like C-x C-j(dired-jump)
|
||||||
|
(require 'dired-x)
|
||||||
|
|
||||||
|
;; ediff - don't start another frame
|
||||||
|
(require 'ediff)
|
||||||
|
(setq ediff-window-setup-function 'ediff-setup-windows-plain)
|
||||||
|
|
||||||
|
;; clean up obsolete buffers automatically
|
||||||
|
(require 'midnight)
|
||||||
|
|
||||||
|
;; smarter kill-ring navigation
|
||||||
|
(require 'browse-kill-ring)
|
||||||
|
(browse-kill-ring-default-keybindings)
|
||||||
|
(global-set-key (kbd "s-y") 'browse-kill-ring)
|
||||||
|
|
||||||
|
(defadvice exchange-point-and-mark (before deactivate-mark activate compile)
|
||||||
|
"When called with no active region, do not activate mark."
|
||||||
|
(interactive
|
||||||
|
(list (not (region-active-p)))))
|
||||||
|
|
||||||
|
(require 'tabify)
|
||||||
|
(defmacro with-region-or-buffer (func)
|
||||||
|
"When called with no active region, call FUNC on current buffer."
|
||||||
|
`(defadvice ,func (before with-region-or-buffer activate compile)
|
||||||
|
(interactive
|
||||||
|
(if mark-active
|
||||||
|
(list (region-beginning) (region-end))
|
||||||
|
(list (point-min) (point-max))))))
|
||||||
|
|
||||||
|
(with-region-or-buffer indent-region)
|
||||||
|
(with-region-or-buffer untabify)
|
||||||
|
|
||||||
|
;; automatically indenting yanked text if in programming-modes
|
||||||
|
(defun yank-advised-indent-function (beg end)
|
||||||
|
"Do indentation, as long as the region isn't too large."
|
||||||
|
(if (<= (- end beg) prelude-yank-indent-threshold)
|
||||||
|
(indent-region beg end nil)))
|
||||||
|
|
||||||
|
(advise-commands "indent" (yank yank-pop) after
|
||||||
|
"If current mode is one of `prelude-yank-indent-modes',
|
||||||
|
indent yanked text (with prefix arg don't indent)."
|
||||||
|
(if (and (not (ad-get-arg 0))
|
||||||
|
(not (member major-mode prelude-indent-sensitive-modes))
|
||||||
|
(or (derived-mode-p 'prog-mode)
|
||||||
|
(member major-mode prelude-yank-indent-modes)))
|
||||||
|
(let ((transient-mark-mode nil))
|
||||||
|
(yank-advised-indent-function (region-beginning) (region-end)))))
|
||||||
|
|
||||||
|
;; abbrev config
|
||||||
|
(add-hook 'text-mode-hook 'abbrev-mode)
|
||||||
|
|
||||||
|
;; make a shell script executable automatically on save
|
||||||
|
(add-hook 'after-save-hook
|
||||||
|
'executable-make-buffer-file-executable-if-script-p)
|
||||||
|
|
||||||
|
;; .zsh file is shell script too
|
||||||
|
(add-to-list 'auto-mode-alist '("\\.zsh\\'" . shell-script-mode))
|
||||||
|
|
||||||
|
;; whitespace-mode config
|
||||||
|
(require 'whitespace)
|
||||||
|
(setq whitespace-line-column 80) ;; limit line length
|
||||||
|
(setq whitespace-style '(face tabs empty trailing lines-tail))
|
||||||
|
|
||||||
|
;; saner regex syntax
|
||||||
|
(require 're-builder)
|
||||||
|
(setq reb-re-syntax 'string)
|
||||||
|
|
||||||
|
(require 'eshell)
|
||||||
|
(setq eshell-directory-name (expand-file-name "eshell" prelude-savefile-dir))
|
||||||
|
|
||||||
|
(setq semanticdb-default-save-directory
|
||||||
|
(expand-file-name "semanticdb" prelude-savefile-dir))
|
||||||
|
|
||||||
|
;; Compilation from Emacs
|
||||||
|
(defun prelude-colorize-compilation-buffer ()
|
||||||
|
"Colorize a compilation mode buffer."
|
||||||
|
(interactive)
|
||||||
|
;; we don't want to mess with child modes such as grep-mode, ack, ag, etc
|
||||||
|
(when (eq major-mode 'compilation-mode)
|
||||||
|
(let ((inhibit-read-only t))
|
||||||
|
(ansi-color-apply-on-region (point-min) (point-max)))))
|
||||||
|
|
||||||
|
(require 'compile)
|
||||||
|
(setq compilation-ask-about-save nil ; Just save before compiling
|
||||||
|
compilation-always-kill t ; Just kill old compile processes before
|
||||||
|
; starting the new one
|
||||||
|
compilation-scroll-output 'first-error ; Automatically scroll to first
|
||||||
|
; error
|
||||||
|
)
|
||||||
|
|
||||||
|
;; Colorize output of Compilation Mode, see
|
||||||
|
;; http://stackoverflow.com/a/3072831/355252
|
||||||
|
(require 'ansi-color)
|
||||||
|
(add-hook 'compilation-filter-hook #'prelude-colorize-compilation-buffer)
|
||||||
|
|
||||||
|
;; enable Prelude's keybindings
|
||||||
|
(prelude-global-mode t)
|
||||||
|
|
||||||
|
;; sensible undo
|
||||||
|
(global-undo-tree-mode)
|
||||||
|
(diminish 'undo-tree-mode)
|
||||||
|
|
||||||
|
;; enable winner-mode to manage window configurations
|
||||||
|
(winner-mode +1)
|
||||||
|
|
||||||
|
;; diff-hl
|
||||||
|
(global-diff-hl-mode +1)
|
||||||
|
(add-hook 'dired-mode-hook 'diff-hl-dired-mode)
|
||||||
|
(add-hook 'magit-post-refresh-hook 'diff-hl-magit-post-refresh)
|
||||||
|
|
||||||
|
;; easy-kill
|
||||||
|
(global-set-key [remap kill-ring-save] 'easy-kill)
|
||||||
|
(global-set-key [remap mark-sexp] 'easy-mark)
|
||||||
|
|
||||||
|
;; operate-on-number
|
||||||
|
(require 'operate-on-number)
|
||||||
|
(require 'smartrep)
|
||||||
|
|
||||||
|
(smartrep-define-key global-map "C-c ."
|
||||||
|
'(("+" . apply-operation-to-number-at-point)
|
||||||
|
("-" . apply-operation-to-number-at-point)
|
||||||
|
("*" . apply-operation-to-number-at-point)
|
||||||
|
("/" . apply-operation-to-number-at-point)
|
||||||
|
("\\" . apply-operation-to-number-at-point)
|
||||||
|
("^" . apply-operation-to-number-at-point)
|
||||||
|
("<" . apply-operation-to-number-at-point)
|
||||||
|
(">" . apply-operation-to-number-at-point)
|
||||||
|
("#" . apply-operation-to-number-at-point)
|
||||||
|
("%" . apply-operation-to-number-at-point)
|
||||||
|
("'" . operate-on-number-at-point)))
|
||||||
|
|
||||||
|
(defadvice server-visit-files (before parse-numbers-in-lines (files proc &optional nowait) activate)
|
||||||
|
"Open file with emacsclient with cursors positioned on requested line.
|
||||||
|
Most of console-based utilities prints filename in format
|
||||||
|
'filename:linenumber'. So you may wish to open filename in that format.
|
||||||
|
Just call:
|
||||||
|
|
||||||
|
emacsclient filename:linenumber
|
||||||
|
|
||||||
|
and file 'filename' will be opened and cursor set on line 'linenumber'"
|
||||||
|
(ad-set-arg 0
|
||||||
|
(mapcar (lambda (fn)
|
||||||
|
(let ((name (car fn)))
|
||||||
|
(if (string-match "^\\(.*?\\):\\([0-9]+\\)\\(?::\\([0-9]+\\)\\)?$" name)
|
||||||
|
(cons
|
||||||
|
(match-string 1 name)
|
||||||
|
(cons (string-to-number (match-string 2 name))
|
||||||
|
(string-to-number (or (match-string 3 name) ""))))
|
||||||
|
fn))) files)))
|
||||||
|
|
||||||
|
;; use settings from .editorconfig file when present
|
||||||
|
(require 'editorconfig)
|
||||||
|
(editorconfig-mode 1)
|
||||||
|
|
||||||
|
(provide 'prelude-editor)
|
||||||
|
|
||||||
|
;;; prelude-editor.el ends here
|
|
@ -0,0 +1,116 @@
|
||||||
|
;;; prelude-global-keybindings.el --- Emacs Prelude: some useful keybindings.
|
||||||
|
;;
|
||||||
|
;; Copyright © 2011-2017 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-^") 'crux-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 functionality 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] 'crux-kill-whole-line)
|
||||||
|
|
||||||
|
;; Activate occur easily inside isearch
|
||||||
|
(define-key isearch-mode-map (kbd "C-o") 'isearch-occur)
|
||||||
|
|
||||||
|
;; 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-x M-g") 'magit-dispatch-popup)
|
||||||
|
|
||||||
|
(global-set-key (kbd "C-=") 'er/expand-region)
|
||||||
|
|
||||||
|
(global-set-key (kbd "C-c j") 'avy-goto-word-or-subword-1)
|
||||||
|
(global-set-key (kbd "s-.") 'avy-goto-word-or-subword-1)
|
||||||
|
(global-set-key (kbd "s-w") 'ace-window)
|
||||||
|
|
||||||
|
(provide 'prelude-global-keybindings)
|
||||||
|
|
||||||
|
;;; prelude-global-keybindings.el ends here
|
|
@ -0,0 +1,149 @@
|
||||||
|
;;; prelude-mode.el --- Emacs Prelude: minor mode
|
||||||
|
;;
|
||||||
|
;; Copyright © 2011-2017 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)
|
||||||
|
(require 'imenu-anywhere)
|
||||||
|
(require 'crux)
|
||||||
|
|
||||||
|
(defvar prelude-mode-map
|
||||||
|
(let ((map (make-sparse-keymap)))
|
||||||
|
(define-key map (kbd "C-c o") 'crux-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 (kbd "C-a") 'crux-move-beginning-of-line)
|
||||||
|
(define-key map [(shift return)] 'crux-smart-open-line)
|
||||||
|
(define-key map (kbd "M-o") 'crux-smart-open-line)
|
||||||
|
(define-key map [(control shift return)] 'crux-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") 'crux-cleanup-buffer-or-region)
|
||||||
|
(define-key map (kbd "C-c f") 'crux-recentf-ido-find-file)
|
||||||
|
(define-key map (kbd "C-M-z") 'crux-indent-defun)
|
||||||
|
(define-key map (kbd "C-c u") 'crux-view-url)
|
||||||
|
(define-key map (kbd "C-c e") 'crux-eval-and-replace)
|
||||||
|
(define-key map (kbd "C-c s") 'crux-swap-windows)
|
||||||
|
(define-key map (kbd "C-c D") 'crux-delete-file-and-buffer)
|
||||||
|
(define-key map (kbd "C-c d") 'crux-duplicate-current-line-or-region)
|
||||||
|
(define-key map (kbd "C-c M-d") 'crux-duplicate-and-comment-current-line-or-region)
|
||||||
|
(define-key map (kbd "C-c r") 'crux-rename-buffer-and-file)
|
||||||
|
(define-key map (kbd "C-c t") 'crux-visit-term-buffer)
|
||||||
|
(define-key map (kbd "C-c k") 'crux-kill-other-buffers)
|
||||||
|
(define-key map (kbd "C-c TAB") 'crux-indent-rigidly-and-copy-to-clipboard)
|
||||||
|
(define-key map (kbd "C-c I") 'crux-find-user-init-file)
|
||||||
|
(define-key map (kbd "C-c S") 'crux-find-shell-init-file)
|
||||||
|
(define-key map (kbd "C-c i") 'imenu-anywhere)
|
||||||
|
;; 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") 'crux-recentf-ido-find-file)
|
||||||
|
(define-key map (kbd "s-j") 'crux-top-join-line)
|
||||||
|
(define-key map (kbd "s-k") 'crux-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-log-buffer-file)
|
||||||
|
(define-key map (kbd "s-m b") 'magit-blame)
|
||||||
|
(define-key map (kbd "s-o") 'crux-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..." crux-open-with]
|
||||||
|
["Delete file and buffer" crux-delete-file-and-buffer]
|
||||||
|
["Rename buffer and file" crux-rename-buffer-and-file])
|
||||||
|
|
||||||
|
("Buffers"
|
||||||
|
["Clean up buffer or region" crux-cleanup-buffer-or-region]
|
||||||
|
["Kill other buffers" crux-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" crux-indent-rigidly-and-copy-to-clipboard]
|
||||||
|
["Insert date" crux-insert-date]
|
||||||
|
["Eval and replace" crux-eval-and-replace]
|
||||||
|
)
|
||||||
|
|
||||||
|
("Windows"
|
||||||
|
["Swap windows" crux-swap-windows])
|
||||||
|
|
||||||
|
("General"
|
||||||
|
["Visit term buffer" crux-visit-term-buffer]
|
||||||
|
["Search in Google" prelude-google]
|
||||||
|
["View URL" crux-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,75 @@
|
||||||
|
;;; prelude-osx.el --- Emacs Prelude: OSX specific settings.
|
||||||
|
;;
|
||||||
|
;; Copyright © 2011-2017 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)
|
||||||
|
|
||||||
|
;; Enable emoji, and stop the UI from freezing when trying to display them.
|
||||||
|
(if (fboundp 'set-fontset-font)
|
||||||
|
(set-fontset-font t 'unicode "Apple Color Emoji" nil 'prepend))
|
||||||
|
|
||||||
|
|
||||||
|
(provide 'prelude-osx)
|
||||||
|
;;; prelude-osx.el ends here
|
|
@ -0,0 +1,217 @@
|
||||||
|
;;; prelude-packages.el --- Emacs Prelude: default package selection.
|
||||||
|
;;
|
||||||
|
;; Copyright © 2011-2017 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)
|
||||||
|
|
||||||
|
;; accessing a package repo over https on Windows is a no go, so we
|
||||||
|
;; fallback to http there
|
||||||
|
(if (eq system-type 'windows-nt)
|
||||||
|
(add-to-list 'package-archives
|
||||||
|
'("melpa" . "http://melpa.org/packages/") t)
|
||||||
|
(add-to-list 'package-archives
|
||||||
|
'("melpa" . "https://melpa.org/packages/") t))
|
||||||
|
|
||||||
|
;; load the pinned packages
|
||||||
|
(let ((prelude-pinned-packages-file (expand-file-name "prelude-pinned-packages.el" prelude-dir)))
|
||||||
|
(if (file-exists-p prelude-pinned-packages-file)
|
||||||
|
(load prelude-pinned-packages-file)))
|
||||||
|
|
||||||
|
;; 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
|
||||||
|
'(ace-window
|
||||||
|
avy
|
||||||
|
anzu
|
||||||
|
beacon
|
||||||
|
browse-kill-ring
|
||||||
|
crux
|
||||||
|
dash
|
||||||
|
discover-my-major
|
||||||
|
diff-hl
|
||||||
|
diminish
|
||||||
|
easy-kill
|
||||||
|
editorconfig
|
||||||
|
epl
|
||||||
|
expand-region
|
||||||
|
flycheck
|
||||||
|
gist
|
||||||
|
git-timemachine
|
||||||
|
gitconfig-mode
|
||||||
|
gitignore-mode
|
||||||
|
god-mode
|
||||||
|
grizzl
|
||||||
|
guru-mode
|
||||||
|
imenu-anywhere
|
||||||
|
ov
|
||||||
|
projectile
|
||||||
|
magit
|
||||||
|
move-text
|
||||||
|
operate-on-number
|
||||||
|
smart-mode-line
|
||||||
|
smartparens
|
||||||
|
smartrep
|
||||||
|
undo-tree
|
||||||
|
volatile-highlights
|
||||||
|
which-key
|
||||||
|
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)
|
||||||
|
("Cask" cask-mode cask-mode)
|
||||||
|
("\\.d\\'" d-mode d-mode)
|
||||||
|
("\\.dart\\'" dart-mode dart-mode)
|
||||||
|
("\\.elm\\'" elm-mode elm-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)
|
||||||
|
("\\.json\\'" json-mode json-mode)
|
||||||
|
("\\.kt\\'" kotlin-mode kotlin-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-mode scala-mode)
|
||||||
|
("\\.scss\\'" scss-mode scss-mode)
|
||||||
|
("\\.slim\\'" slim-mode slim-mode)
|
||||||
|
("\\.styl\\'" stylus-mode stylus-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,92 @@
|
||||||
|
;;; prelude-ui.el --- Emacs Prelude: UI optimizations and tweaks.
|
||||||
|
;;
|
||||||
|
;; Copyright © 2011-2017 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 the annoying bell ring
|
||||||
|
(setq ring-bell-function 'ignore)
|
||||||
|
|
||||||
|
;; 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
|
||||||
|
(when prelude-theme
|
||||||
|
(load-theme prelude-theme t))
|
||||||
|
|
||||||
|
(require 'smart-mode-line)
|
||||||
|
(setq sml/no-confirm-load-theme t)
|
||||||
|
;; delegate theming to the currently active theme
|
||||||
|
(setq sml/theme nil)
|
||||||
|
(add-hook 'after-init-hook #'sml/setup)
|
||||||
|
|
||||||
|
;; show the cursor when moving after big movements in the window
|
||||||
|
(require 'beacon)
|
||||||
|
(beacon-mode +1)
|
||||||
|
|
||||||
|
;; show available keybindings after you start typing
|
||||||
|
(require 'which-key)
|
||||||
|
(which-key-mode +1)
|
||||||
|
|
||||||
|
(provide 'prelude-ui)
|
||||||
|
;;; prelude-ui.el ends here
|
|
@ -0,0 +1,148 @@
|
||||||
|
;;; init.el --- Prelude's configuration entry point.
|
||||||
|
;;
|
||||||
|
;; Copyright (c) 2011-2017 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:
|
||||||
|
|
||||||
|
;; Added by Package.el. This must come before configurations of
|
||||||
|
;; installed packages. Don't delete this line. If you don't want it,
|
||||||
|
;; just comment it out by adding a semicolon to the start of the line.
|
||||||
|
;; You may delete these explanatory comments.
|
||||||
|
;(package-initialize)
|
||||||
|
|
||||||
|
(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.4")
|
||||||
|
(error "Prelude requires at least GNU Emacs 24.4, 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 from sample/prelude-modules.el"))
|
||||||
|
|
||||||
|
;; config changes made through the customize UI will be stored 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)
|
||||||
|
|
||||||
|
;; Patch security vulnerability in Emacs versions older than 25.3
|
||||||
|
(when (version< emacs-version "25.3")
|
||||||
|
(eval-after-load "enriched"
|
||||||
|
'(defun enriched-decode-display-prop (start end &optional param)
|
||||||
|
(list start end))))
|
||||||
|
|
||||||
|
(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,30 @@
|
||||||
|
# Emacs Prelude Modules
|
||||||
|
|
||||||
|
Prelude provides extra functionality through modules. Some modules may
|
||||||
|
require extra steps to enable all functionality. These steps and the
|
||||||
|
functionality provided by these modules are documented on the
|
||||||
|
following links.
|
||||||
|
|
||||||
|
- C
|
||||||
|
- Clojure
|
||||||
|
- Coffee
|
||||||
|
- Common-Lisp
|
||||||
|
- CSS
|
||||||
|
- Emacs-Lisp
|
||||||
|
- [ERC](prelude-erc.md)
|
||||||
|
- Erlang
|
||||||
|
- Elixir
|
||||||
|
- Haskell
|
||||||
|
- JS
|
||||||
|
- Latex
|
||||||
|
- Lisp
|
||||||
|
- Markdown
|
||||||
|
- MediaWiki
|
||||||
|
- Org
|
||||||
|
- Perl
|
||||||
|
- [Python](prelude-python.md)
|
||||||
|
- Ruby
|
||||||
|
- Scala
|
||||||
|
- Scheme
|
||||||
|
- Scss
|
||||||
|
- Web
|
|
@ -0,0 +1,50 @@
|
||||||
|
# Prelude ERC Quickstart
|
||||||
|
|
||||||
|
## Customizing Server list
|
||||||
|
|
||||||
|
If you want to join a list of servers on `M-x start-irc`, other than
|
||||||
|
the default list, please redefine the variable `my-fav-irc` as follows
|
||||||
|
in your personal config
|
||||||
|
|
||||||
|
``` emacs-lisp
|
||||||
|
(setq my-fav-irc '("irc.freenode.net"
|
||||||
|
"irc.oftc.net"
|
||||||
|
"irc.mozilla.org"
|
||||||
|
"irc.gnome.org"))
|
||||||
|
```
|
||||||
|
|
||||||
|
## Customizing Last Quit Message
|
||||||
|
|
||||||
|
If you want to customize your IRC Last Quit Message from *Asta la
|
||||||
|
vista* to something more funkier, please redefine `bye-irc-message` as
|
||||||
|
follows
|
||||||
|
|
||||||
|
``` emacs-lisp
|
||||||
|
(setq bye-erc-message "adios")
|
||||||
|
```
|
||||||
|
|
||||||
|
## Reading NickServ passwords from auth-source plugin
|
||||||
|
|
||||||
|
If you want to automatically authenticate while logging into IRC
|
||||||
|
servers set the `erc-prompt-for-password` to nil as follows
|
||||||
|
|
||||||
|
``` emacs-lisp
|
||||||
|
(setq erc-prompt-for-password nil)
|
||||||
|
```
|
||||||
|
|
||||||
|
Now you can set password in plaintext in .authinfo file in the netRC
|
||||||
|
format or you it encrypted in .authinfo.gpg file after setting up gpg
|
||||||
|
in emacs
|
||||||
|
|
||||||
|
## Opening all ERC buffers in a new perspective
|
||||||
|
Many a time when we start IRC with the `start-irc` command, all the
|
||||||
|
channels open in our existing workspace, which can be annoying to
|
||||||
|
some; especially to those who like to organize their buffers into
|
||||||
|
separate groups (perspectives). To avoid this scenario, it is better
|
||||||
|
to group all the ERC buffers into one perspective called `IRC` when
|
||||||
|
`start-irc` is called. To enable this set the `prelude-new-irc-persp`
|
||||||
|
variable to true as follows
|
||||||
|
|
||||||
|
``` emacs-lisp
|
||||||
|
(setq prelude-new-irc-persp t)
|
||||||
|
```
|
|
@ -0,0 +1,18 @@
|
||||||
|
# Prelude Python Quickstart
|
||||||
|
|
||||||
|
## Python Mode
|
||||||
|
|
||||||
|
Emacs comes with Python programming support through the built-in
|
||||||
|
Python-mode. Whenever you are editing Python code run `C-h m` to
|
||||||
|
look at the Python mode key bindings. Alternatively look at the
|
||||||
|
menu bar entries under Python. To toggle the menu bar press `F12`.
|
||||||
|
|
||||||
|
## Syntax checking
|
||||||
|
|
||||||
|
Prelude ships with [Flycheck](https://github.com/flycheck/flycheck),
|
||||||
|
an on the fly syntax checker. Flycheck has support for two Python
|
||||||
|
syntax checkers, [Pylint](http://www.pylint.org/) and
|
||||||
|
[Flake8](http://flake8.readthedocs.org/en/latest/). In
|
||||||
|
order to have Flycheck support on the fly syntax checking for
|
||||||
|
Python you need to have either of these installed and accessible to
|
||||||
|
Emacs. In order to manually choose a checker run `C-c ! s`.
|
|
@ -0,0 +1,59 @@
|
||||||
|
;;; prelude-c.el --- Emacs Prelude: cc-mode configuration.
|
||||||
|
;;
|
||||||
|
;; Copyright © 2011-2017 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 basic configuration for cc-mode and the modes derived from it.
|
||||||
|
|
||||||
|
;;; 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 'prelude-programming)
|
||||||
|
|
||||||
|
(defun prelude-c-mode-common-defaults ()
|
||||||
|
(setq c-default-style "k&r"
|
||||||
|
c-basic-offset 4)
|
||||||
|
(c-set-offset 'substatement-open 0))
|
||||||
|
|
||||||
|
(setq prelude-c-mode-common-hook 'prelude-c-mode-common-defaults)
|
||||||
|
|
||||||
|
;; this will affect all modes derived from cc-mode, like
|
||||||
|
;; java-mode, php-mode, etc
|
||||||
|
(add-hook 'c-mode-common-hook (lambda ()
|
||||||
|
(run-hooks 'prelude-c-mode-common-hook)))
|
||||||
|
|
||||||
|
(defun prelude-makefile-mode-defaults ()
|
||||||
|
(whitespace-toggle-options '(tabs))
|
||||||
|
(setq indent-tabs-mode t ))
|
||||||
|
|
||||||
|
(setq prelude-makefile-mode-hook 'prelude-makefile-mode-defaults)
|
||||||
|
|
||||||
|
(add-hook 'makefile-mode-hook (lambda ()
|
||||||
|
(run-hooks 'prelude-makefile-mode-hook)))
|
||||||
|
(provide 'prelude-c)
|
||||||
|
|
||||||
|
;;; prelude-c.el ends here
|
|
@ -0,0 +1,66 @@
|
||||||
|
;;; prelude-clojure.el --- Emacs Prelude: Clojure programming configuration.
|
||||||
|
;;
|
||||||
|
;; Copyright © 2011-2017 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:
|
||||||
|
|
||||||
|
;; Some basic configuration for clojure-mode.
|
||||||
|
|
||||||
|
;;; 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 'prelude-lisp)
|
||||||
|
(prelude-require-packages '(clojure-mode cider))
|
||||||
|
|
||||||
|
(eval-after-load 'clojure-mode
|
||||||
|
'(progn
|
||||||
|
(defun prelude-clojure-mode-defaults ()
|
||||||
|
(subword-mode +1)
|
||||||
|
(run-hooks 'prelude-lisp-coding-hook))
|
||||||
|
|
||||||
|
(setq prelude-clojure-mode-hook 'prelude-clojure-mode-defaults)
|
||||||
|
|
||||||
|
(add-hook 'clojure-mode-hook (lambda ()
|
||||||
|
(run-hooks 'prelude-clojure-mode-hook)))))
|
||||||
|
|
||||||
|
(eval-after-load 'cider
|
||||||
|
'(progn
|
||||||
|
(setq nrepl-log-messages t)
|
||||||
|
|
||||||
|
(add-hook 'cider-mode-hook 'eldoc-mode)
|
||||||
|
|
||||||
|
(defun prelude-cider-repl-mode-defaults ()
|
||||||
|
(subword-mode +1)
|
||||||
|
(run-hooks 'prelude-interactive-lisp-coding-hook))
|
||||||
|
|
||||||
|
(setq prelude-cider-repl-mode-hook 'prelude-cider-repl-mode-defaults)
|
||||||
|
|
||||||
|
(add-hook 'cider-repl-mode-hook (lambda ()
|
||||||
|
(run-hooks 'prelude-cider-repl-mode-hook)))))
|
||||||
|
|
||||||
|
(provide 'prelude-clojure)
|
||||||
|
|
||||||
|
;;; prelude-clojure.el ends here
|
|
@ -0,0 +1,60 @@
|
||||||
|
;;; prelude-coffee.el --- Emacs Prelude: CoffeeScript programming support.
|
||||||
|
;;
|
||||||
|
;; Copyright © 2011-2017 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:
|
||||||
|
|
||||||
|
;; CoffeeScript is a nice little language that comples to JavaScript.
|
||||||
|
|
||||||
|
;;; 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 'prelude-programming)
|
||||||
|
(prelude-require-package 'coffee-mode)
|
||||||
|
|
||||||
|
(eval-after-load 'coffee-mode
|
||||||
|
'(progn
|
||||||
|
;; CoffeeScript uses two spaces.
|
||||||
|
(setq coffee-tab-width 2)
|
||||||
|
|
||||||
|
;; remove the "Generated by CoffeeScript" header
|
||||||
|
(add-to-list 'coffee-args-compile "--no-header")
|
||||||
|
|
||||||
|
(defun prelude-coffee-mode-defaults ()
|
||||||
|
;; Update the already compiled js on save
|
||||||
|
(and (buffer-file-name)
|
||||||
|
(file-exists-p (buffer-file-name))
|
||||||
|
(file-exists-p (coffee-compiled-file-name (buffer-file-name)))
|
||||||
|
(coffee-cos-mode t))
|
||||||
|
(subword-mode +1))
|
||||||
|
|
||||||
|
(setq prelude-coffee-mode-hook 'prelude-coffee-mode-defaults)
|
||||||
|
|
||||||
|
(add-hook 'coffee-mode-hook (lambda ()
|
||||||
|
(run-hooks 'prelude-coffee-mode-hook)))))
|
||||||
|
(provide 'prelude-coffee)
|
||||||
|
|
||||||
|
;;; prelude-coffee.el ends here
|
|
@ -0,0 +1,85 @@
|
||||||
|
;;; prelude-common-lisp.el --- Emacs Prelude: lisp-mode and SLIME config.
|
||||||
|
;;
|
||||||
|
;; Copyright © 2011-2017 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:
|
||||||
|
|
||||||
|
;; Configuration for lisp-mode and SLIME.
|
||||||
|
|
||||||
|
;;; 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 'prelude-lisp)
|
||||||
|
|
||||||
|
(prelude-require-package 'slime)
|
||||||
|
|
||||||
|
;; the SBCL configuration file is in Common Lisp
|
||||||
|
(add-to-list 'auto-mode-alist '("\\.sbclrc\\'" . lisp-mode))
|
||||||
|
|
||||||
|
;; Open files with .cl extension in lisp-mode
|
||||||
|
(add-to-list 'auto-mode-alist '("\\.cl\\'" . lisp-mode))
|
||||||
|
|
||||||
|
;; a list of alternative Common Lisp implementations that can be
|
||||||
|
;; used with SLIME. Note that their presence render
|
||||||
|
;; inferior-lisp-program useless. This variable holds a list of
|
||||||
|
;; programs and if you invoke SLIME with a negative prefix
|
||||||
|
;; argument, M-- M-x slime, you can select a program from that list.
|
||||||
|
(setq slime-lisp-implementations
|
||||||
|
'((ccl ("ccl"))
|
||||||
|
(clisp ("clisp" "-q"))
|
||||||
|
(cmucl ("cmucl" "-quiet"))
|
||||||
|
(sbcl ("sbcl" "--noinform") :coding-system utf-8-unix)))
|
||||||
|
|
||||||
|
;; select the default value from slime-lisp-implementations
|
||||||
|
(if (and (eq system-type 'darwin)
|
||||||
|
(executable-find "ccl"))
|
||||||
|
;; default to Clozure CL on OS X
|
||||||
|
(setq slime-default-lisp 'ccl)
|
||||||
|
;; default to SBCL on Linux and Windows
|
||||||
|
(setq slime-default-lisp 'sbcl))
|
||||||
|
|
||||||
|
;; Add fancy slime contribs
|
||||||
|
(setq slime-contribs '(slime-fancy slime-cl-indent))
|
||||||
|
|
||||||
|
(add-hook 'lisp-mode-hook (lambda () (run-hooks 'prelude-lisp-coding-hook)))
|
||||||
|
;; rainbow-delimeters messes up colors in slime-repl, and doesn't seem to work
|
||||||
|
;; anyway, so we won't use prelude-lisp-coding-defaults.
|
||||||
|
(add-hook 'slime-repl-mode-hook (lambda ()
|
||||||
|
(smartparens-strict-mode +1)
|
||||||
|
(whitespace-mode -1)))
|
||||||
|
|
||||||
|
(eval-after-load "slime"
|
||||||
|
'(progn
|
||||||
|
(setq slime-complete-symbol-function 'slime-fuzzy-complete-symbol
|
||||||
|
slime-fuzzy-completion-in-place t
|
||||||
|
slime-enable-evaluate-in-emacs t
|
||||||
|
slime-autodoc-use-multiline-p t
|
||||||
|
slime-auto-start 'always)
|
||||||
|
(define-key slime-mode-map (kbd "C-c C-s") 'slime-selector)))
|
||||||
|
|
||||||
|
(provide 'prelude-common-lisp)
|
||||||
|
|
||||||
|
;;; prelude-common-lisp.el ends here
|
|
@ -0,0 +1,48 @@
|
||||||
|
;;; prelude-company.el --- company-mode setup
|
||||||
|
;;
|
||||||
|
;; Copyright © 2011-2017 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:
|
||||||
|
|
||||||
|
;; company-mode config.
|
||||||
|
|
||||||
|
;;; 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:
|
||||||
|
(prelude-require-packages '(company))
|
||||||
|
|
||||||
|
(require 'company)
|
||||||
|
|
||||||
|
(setq company-idle-delay 0.5)
|
||||||
|
(setq company-tooltip-limit 10)
|
||||||
|
(setq company-minimum-prefix-length 2)
|
||||||
|
;; invert the navigation direction if the the completion popup-isearch-match
|
||||||
|
;; is displayed on top (happens near the bottom of windows)
|
||||||
|
(setq company-tooltip-flip-when-above t)
|
||||||
|
|
||||||
|
(global-company-mode 1)
|
||||||
|
|
||||||
|
(provide 'prelude-company)
|
||||||
|
;;; prelude-company.el ends here
|
|
@ -0,0 +1,51 @@
|
||||||
|
;;; prelude-css.el --- Emacs Prelude: css support
|
||||||
|
;;
|
||||||
|
;; Copyright © 2011-2017 Bozhidar Batsov
|
||||||
|
;;
|
||||||
|
;; Author: Bozhidar Batsov <bozhidar@batsov.com>
|
||||||
|
;; URL: http://www.batsov.com/emacs-prelude
|
||||||
|
;; Version: 1.0.0
|
||||||
|
;; Keywords: convenience
|
||||||
|
|
||||||
|
;; This file is not part of GNU Emacs.
|
||||||
|
|
||||||
|
;;; Commentary:
|
||||||
|
|
||||||
|
;; Some basic configuration for css-mode.
|
||||||
|
|
||||||
|
;;; 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:
|
||||||
|
|
||||||
|
(eval-after-load 'css-mode
|
||||||
|
'(progn
|
||||||
|
(prelude-require-packages '(rainbow-mode))
|
||||||
|
|
||||||
|
(setq css-indent-offset 2)
|
||||||
|
|
||||||
|
(defun prelude-css-mode-defaults ()
|
||||||
|
(rainbow-mode +1)
|
||||||
|
(run-hooks 'prelude-prog-mode-hook))
|
||||||
|
|
||||||
|
(setq prelude-css-mode-hook 'prelude-css-mode-defaults)
|
||||||
|
|
||||||
|
(add-hook 'css-mode-hook (lambda ()
|
||||||
|
(run-hooks 'prelude-css-mode-hook)))))
|
||||||
|
|
||||||
|
(provide 'prelude-css)
|
||||||
|
;;; prelude-css.el ends here
|
|
@ -0,0 +1,40 @@
|
||||||
|
;;; prelude-elixir.el --- Emacs Prelude: Elixir programming support.
|
||||||
|
;;
|
||||||
|
;; Copyright © 2014-2017 Samuel Tonini
|
||||||
|
;;
|
||||||
|
;; Author: Samuel Tonini <tonini.samuel@gmail.com>
|
||||||
|
;; Version: 1.0.0
|
||||||
|
;; Keywords: convenience elixir
|
||||||
|
|
||||||
|
;; This file is not part of GNU Emacs.
|
||||||
|
|
||||||
|
;;; Commentary:
|
||||||
|
|
||||||
|
;; Some basic configuration for Elixir development.
|
||||||
|
|
||||||
|
;;; 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 'prelude-programming)
|
||||||
|
|
||||||
|
(prelude-require-packages '(elixir-mode alchemist))
|
||||||
|
|
||||||
|
(provide 'prelude-elixir)
|
||||||
|
|
||||||
|
;;; prelude-elixir.el ends here
|
|
@ -0,0 +1,120 @@
|
||||||
|
;;; prelude-emacs-lisp.el --- Emacs Prelude: Nice config for Elisp programming.
|
||||||
|
;;
|
||||||
|
;; Copyright © 2011-2017 Bozhidar Batsov
|
||||||
|
;;
|
||||||
|
;; Author: Bozhidar Batsov <bozhidar@batsov.com>
|
||||||
|
;; URL: https://github.com/bbatsov/prelude
|
||||||
|
;; Version: 1.0.0
|
||||||
|
;; Keywords: convenience
|
||||||
|
;; Package-Requires: ((prelude-lisp "1.0.0"))
|
||||||
|
|
||||||
|
;; This file is not part of GNU Emacs.
|
||||||
|
|
||||||
|
;;; Commentary:
|
||||||
|
|
||||||
|
;; Nice config for Elisp Programming.
|
||||||
|
|
||||||
|
;;; 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 'prelude-lisp)
|
||||||
|
(require 'crux)
|
||||||
|
|
||||||
|
(prelude-require-packages '(elisp-slime-nav rainbow-mode))
|
||||||
|
|
||||||
|
(defun prelude-recompile-elc-on-save ()
|
||||||
|
"Recompile your elc when saving an elisp file."
|
||||||
|
(add-hook 'after-save-hook
|
||||||
|
(lambda ()
|
||||||
|
(when (and
|
||||||
|
(string-prefix-p prelude-dir (file-truename buffer-file-name))
|
||||||
|
(file-exists-p (byte-compile-dest-file buffer-file-name)))
|
||||||
|
(emacs-lisp-byte-compile)))
|
||||||
|
nil
|
||||||
|
t))
|
||||||
|
|
||||||
|
(defun prelude-visit-ielm ()
|
||||||
|
"Switch to default `ielm' buffer.
|
||||||
|
Start `ielm' if it's not already running."
|
||||||
|
(interactive)
|
||||||
|
(crux-start-or-switch-to 'ielm "*ielm*"))
|
||||||
|
|
||||||
|
(define-key emacs-lisp-mode-map (kbd "C-c C-z") 'prelude-visit-ielm)
|
||||||
|
(define-key emacs-lisp-mode-map (kbd "C-c C-c") 'eval-defun)
|
||||||
|
(define-key emacs-lisp-mode-map (kbd "C-c C-b") 'eval-buffer)
|
||||||
|
|
||||||
|
(defun prelude-conditional-emacs-lisp-checker ()
|
||||||
|
"Don't check doc style in Emacs Lisp test files."
|
||||||
|
(let ((file-name (buffer-file-name)))
|
||||||
|
(when (and file-name (string-match-p ".*-tests?\\.el\\'" file-name))
|
||||||
|
(setq-local flycheck-checkers '(emacs-lisp)))))
|
||||||
|
|
||||||
|
(defun prelude-emacs-lisp-mode-defaults ()
|
||||||
|
"Sensible defaults for `emacs-lisp-mode'."
|
||||||
|
(run-hooks 'prelude-lisp-coding-hook)
|
||||||
|
(eldoc-mode +1)
|
||||||
|
(prelude-recompile-elc-on-save)
|
||||||
|
(rainbow-mode +1)
|
||||||
|
(setq mode-name "EL")
|
||||||
|
(prelude-conditional-emacs-lisp-checker))
|
||||||
|
|
||||||
|
(setq prelude-emacs-lisp-mode-hook 'prelude-emacs-lisp-mode-defaults)
|
||||||
|
|
||||||
|
(add-hook 'emacs-lisp-mode-hook (lambda ()
|
||||||
|
(run-hooks 'prelude-emacs-lisp-mode-hook)))
|
||||||
|
|
||||||
|
(add-to-list 'auto-mode-alist '("Cask\\'" . emacs-lisp-mode))
|
||||||
|
|
||||||
|
;; ielm is an interactive Emacs Lisp shell
|
||||||
|
(defun prelude-ielm-mode-defaults ()
|
||||||
|
"Sensible defaults for `ielm'."
|
||||||
|
(run-hooks 'prelude-interactive-lisp-coding-hook)
|
||||||
|
(eldoc-mode +1))
|
||||||
|
|
||||||
|
(setq prelude-ielm-mode-hook 'prelude-ielm-mode-defaults)
|
||||||
|
|
||||||
|
(add-hook 'ielm-mode-hook (lambda ()
|
||||||
|
(run-hooks 'prelude-ielm-mode-hook)))
|
||||||
|
|
||||||
|
(eval-after-load "elisp-slime-nav"
|
||||||
|
'(diminish 'elisp-slime-nav-mode))
|
||||||
|
(eval-after-load "rainbow-mode"
|
||||||
|
'(diminish 'rainbow-mode))
|
||||||
|
(eval-after-load "eldoc"
|
||||||
|
'(diminish 'eldoc-mode))
|
||||||
|
|
||||||
|
(eval-after-load "ielm"
|
||||||
|
'(progn
|
||||||
|
(define-key ielm-map (kbd "M-(") (prelude-wrap-with "("))
|
||||||
|
(define-key ielm-map (kbd "M-\"") (prelude-wrap-with "\""))))
|
||||||
|
|
||||||
|
;; enable elisp-slime-nav-mode
|
||||||
|
(dolist (hook '(emacs-lisp-mode-hook ielm-mode-hook))
|
||||||
|
(add-hook hook 'elisp-slime-nav-mode))
|
||||||
|
|
||||||
|
(defun conditionally-enable-smartparens-mode ()
|
||||||
|
"Enable `smartparens-mode' in the minibuffer, during `eval-expression'."
|
||||||
|
(if (eq this-command 'eval-expression)
|
||||||
|
(smartparens-mode 1)))
|
||||||
|
|
||||||
|
(add-hook 'minibuffer-setup-hook 'conditionally-enable-smartparens-mode)
|
||||||
|
|
||||||
|
(provide 'prelude-emacs-lisp)
|
||||||
|
|
||||||
|
;;; prelude-emacs-lisp.el ends here
|
|
@ -0,0 +1,162 @@
|
||||||
|
;;; prelude-erc.el --- Emacs Prelude: ERC mode configuration.
|
||||||
|
;;
|
||||||
|
;; Copyright © 2011-2017 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 basic configuration for ERC mode, which should make your
|
||||||
|
;; IRC experience a bit more pleasant.
|
||||||
|
|
||||||
|
;;; 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 'erc)
|
||||||
|
(require 'erc-log)
|
||||||
|
(require 'erc-notify)
|
||||||
|
(require 'erc-spelling)
|
||||||
|
(require 'erc-autoaway)
|
||||||
|
|
||||||
|
;; Interpret mIRC-style color commands in IRC chats
|
||||||
|
(setq erc-interpret-mirc-color t)
|
||||||
|
|
||||||
|
;; The following are commented out by default, but users of other
|
||||||
|
;; non-Emacs IRC clients might find them useful.
|
||||||
|
;; Kill buffers for channels after /part
|
||||||
|
(setq erc-kill-buffer-on-part t)
|
||||||
|
;; Kill buffers for private queries after quitting the server
|
||||||
|
(setq erc-kill-queries-on-quit t)
|
||||||
|
;; Kill buffers for server messages after quitting the server
|
||||||
|
(setq erc-kill-server-buffer-on-quit t)
|
||||||
|
|
||||||
|
;; open query buffers in the current window
|
||||||
|
(setq erc-query-display 'buffer)
|
||||||
|
|
||||||
|
;; exclude boring stuff from tracking
|
||||||
|
(erc-track-mode t)
|
||||||
|
(setq erc-track-exclude-types '("JOIN" "NICK" "PART" "QUIT" "MODE"
|
||||||
|
"324" "329" "332" "333" "353" "477"))
|
||||||
|
|
||||||
|
;; logging
|
||||||
|
(setq erc-log-channels-directory "~/.erc/logs/")
|
||||||
|
|
||||||
|
(if (not (file-exists-p erc-log-channels-directory))
|
||||||
|
(mkdir erc-log-channels-directory t))
|
||||||
|
|
||||||
|
(setq erc-save-buffer-on-part t)
|
||||||
|
;; FIXME - this advice is wrong and is causing problems on Emacs exit
|
||||||
|
;; (defadvice save-buffers-kill-emacs (before save-logs (arg) activate)
|
||||||
|
;; (save-some-buffers t (lambda () (when (eq major-mode 'erc-mode) t))))
|
||||||
|
|
||||||
|
;; truncate long irc buffers
|
||||||
|
(erc-truncate-mode +1)
|
||||||
|
|
||||||
|
;; enable spell checking
|
||||||
|
(when prelude-flyspell
|
||||||
|
(erc-spelling-mode 1))
|
||||||
|
;; set different dictionaries by different servers/channels
|
||||||
|
;;(setq erc-spelling-dictionaries '(("#emacs" "american")))
|
||||||
|
|
||||||
|
(defvar erc-notify-nick-alist nil
|
||||||
|
"Alist of nicks and the last time they tried to trigger a
|
||||||
|
notification")
|
||||||
|
|
||||||
|
(defvar erc-notify-timeout 10
|
||||||
|
"Number of seconds that must elapse between notifications from
|
||||||
|
the same person.")
|
||||||
|
|
||||||
|
(defun erc-notify-allowed-p (nick &optional delay)
|
||||||
|
"Return non-nil if a notification should be made for NICK.
|
||||||
|
If DELAY is specified, it will be the minimum time in seconds
|
||||||
|
that can occur between two notifications. The default is
|
||||||
|
`erc-notify-timeout'."
|
||||||
|
(unless delay (setq delay erc-notify-timeout))
|
||||||
|
(let ((cur-time (time-to-seconds (current-time)))
|
||||||
|
(cur-assoc (assoc nick erc-notify-nick-alist))
|
||||||
|
(last-time nil))
|
||||||
|
(if cur-assoc
|
||||||
|
(progn
|
||||||
|
(setq last-time (cdr cur-assoc))
|
||||||
|
(setcdr cur-assoc cur-time)
|
||||||
|
(> (abs (- cur-time last-time)) delay))
|
||||||
|
(push (cons nick cur-time) erc-notify-nick-alist)
|
||||||
|
t)))
|
||||||
|
|
||||||
|
;; autoaway setup
|
||||||
|
(setq erc-auto-discard-away t)
|
||||||
|
(setq erc-autoaway-idle-seconds 600)
|
||||||
|
(setq erc-autoaway-use-emacs-idle t)
|
||||||
|
|
||||||
|
;; utf-8 always and forever
|
||||||
|
(setq erc-server-coding-system '(utf-8 . utf-8))
|
||||||
|
|
||||||
|
|
||||||
|
(defvar my-fav-irc '( "irc.freenode.net" )
|
||||||
|
"Stores the list of IRC servers that you want to connect to with start-irc.")
|
||||||
|
|
||||||
|
(defvar bye-irc-message "Asta la vista"
|
||||||
|
"Message string to be sent while quitting IRC.")
|
||||||
|
|
||||||
|
(defcustom prelude-new-irc-persp nil
|
||||||
|
"True (t) means start IRC in new perspective."
|
||||||
|
:type 'boolean
|
||||||
|
:require 'prelude-erc
|
||||||
|
:group 'prelude)
|
||||||
|
|
||||||
|
(defun connect-to-erc (server)
|
||||||
|
"Connects securely to IRC SERVER over TLS at port 6697."
|
||||||
|
(erc-tls :server server
|
||||||
|
:port 6697
|
||||||
|
:nick erc-nick ))
|
||||||
|
|
||||||
|
(defun start-irc ()
|
||||||
|
"Connect to IRC?"
|
||||||
|
(interactive)
|
||||||
|
(when (y-or-n-p "Do you want to start IRC? ")
|
||||||
|
(when prelude-new-irc-persp
|
||||||
|
(persp-switch "IRC"))
|
||||||
|
(mapcar 'connect-to-erc my-fav-irc)))
|
||||||
|
|
||||||
|
(defun filter-server-buffers ()
|
||||||
|
(delq nil
|
||||||
|
(mapcar
|
||||||
|
(lambda (x) (and (erc-server-buffer-p x) x))
|
||||||
|
(buffer-list))))
|
||||||
|
|
||||||
|
(defun stop-irc ()
|
||||||
|
"Disconnects from all irc servers."
|
||||||
|
(interactive)
|
||||||
|
(when prelude-new-irc-persp
|
||||||
|
(persp-switch "IRC"))
|
||||||
|
(dolist (buffer (filter-server-buffers))
|
||||||
|
(message "Server buffer: %s" (buffer-name buffer))
|
||||||
|
(with-current-buffer buffer
|
||||||
|
(erc-quit-server bye-irc-message)))
|
||||||
|
(when prelude-new-irc-persp
|
||||||
|
(persp-kill "IRC")))
|
||||||
|
|
||||||
|
(provide 'prelude-erc)
|
||||||
|
|
||||||
|
;;; prelude-erc.el ends here
|
|
@ -0,0 +1,60 @@
|
||||||
|
;;; prelude-erlang.el --- Emacs Prelude: Erlang programming support.
|
||||||
|
;;
|
||||||
|
;; Copyright © 2011-2017 Gleb Peregud
|
||||||
|
;;
|
||||||
|
;; Author: Gleb Peregud <gleber.p@gmail.com>
|
||||||
|
;; Version: 1.0.0
|
||||||
|
;; Keywords: convenience erlang
|
||||||
|
|
||||||
|
;; This file is not part of GNU Emacs.
|
||||||
|
|
||||||
|
;;; Commentary:
|
||||||
|
|
||||||
|
;; Erlang is a concurrent functional language.
|
||||||
|
|
||||||
|
;;; 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 'prelude-programming)
|
||||||
|
(prelude-require-packages '(erlang))
|
||||||
|
|
||||||
|
(defcustom wrangler-path nil
|
||||||
|
"The location of wrangler elisp directory."
|
||||||
|
:group 'prelude-erlang
|
||||||
|
:type 'string
|
||||||
|
:safe 'stringp)
|
||||||
|
|
||||||
|
(require 'projectile)
|
||||||
|
|
||||||
|
(when (require 'erlang-start nil t)
|
||||||
|
|
||||||
|
(eval-after-load 'erlang-mode
|
||||||
|
'(progn
|
||||||
|
(flymake-mode)))
|
||||||
|
|
||||||
|
(when (not (null wrangler-path))
|
||||||
|
(add-to-list 'load-path wrangler-path)
|
||||||
|
(require 'wrangler)))
|
||||||
|
|
||||||
|
(add-hook 'erlang-mode-hook (lambda ()
|
||||||
|
(setq erlang-compile-function 'projectile-compile-project)))
|
||||||
|
|
||||||
|
(provide 'prelude-erlang)
|
||||||
|
|
||||||
|
;;; prelude-erlang.el ends here
|
|
@ -0,0 +1,152 @@
|
||||||
|
;;; prelude-evil.el --- Emacs Prelude: evil-mode configuration.
|
||||||
|
;;
|
||||||
|
;; Copyright © 2011-2017 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:
|
||||||
|
|
||||||
|
;; Some basic configuration for evil-mode.
|
||||||
|
|
||||||
|
;;; 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:
|
||||||
|
|
||||||
|
;;; goto-chg lets you use the g-; and g-, to go to recent changes
|
||||||
|
;;; evil-visualstar enables searching visual selection with *
|
||||||
|
;;; evil-numbers enables vim style numeric incrementing and decrementing
|
||||||
|
|
||||||
|
(prelude-require-packages '(evil goto-chg evil-surround evil-visualstar evil-numbers))
|
||||||
|
|
||||||
|
(require 'evil-visualstar)
|
||||||
|
|
||||||
|
(setq evil-mode-line-format 'before)
|
||||||
|
|
||||||
|
(setq evil-emacs-state-cursor '("red" box))
|
||||||
|
(setq evil-normal-state-cursor '("gray" box))
|
||||||
|
(setq evil-visual-state-cursor '("gray" box))
|
||||||
|
(setq evil-insert-state-cursor '("gray" bar))
|
||||||
|
(setq evil-motion-state-cursor '("gray" box))
|
||||||
|
|
||||||
|
;; prevent esc-key from translating to meta-key in terminal mode
|
||||||
|
(setq evil-esc-delay 0)
|
||||||
|
|
||||||
|
(evil-mode 1)
|
||||||
|
(global-evil-surround-mode 1)
|
||||||
|
|
||||||
|
(define-key evil-normal-state-map (kbd "C-A")
|
||||||
|
'evil-numbers/inc-at-pt)
|
||||||
|
(define-key evil-normal-state-map (kbd "C-S-A")
|
||||||
|
'evil-numbers/dec-at-pt)
|
||||||
|
|
||||||
|
;;
|
||||||
|
;; Other useful Commands
|
||||||
|
;;
|
||||||
|
(evil-ex-define-cmd "W" 'evil-write-all)
|
||||||
|
(evil-ex-define-cmd "Tree" 'speedbar-get-focus)
|
||||||
|
(evil-ex-define-cmd "linum" 'linum-mode)
|
||||||
|
(evil-ex-define-cmd "Align" 'align-regexp)
|
||||||
|
|
||||||
|
(defun prelude-yank-to-end-of-line ()
|
||||||
|
"Yank to end of line."
|
||||||
|
(interactive)
|
||||||
|
(evil-yank (point) (point-at-eol)))
|
||||||
|
|
||||||
|
(define-key evil-normal-state-map
|
||||||
|
(kbd "Y") 'prelude-yank-to-end-of-line)
|
||||||
|
|
||||||
|
(defun prelude-shift-left-visual ()
|
||||||
|
"Shift left and restore visual selection."
|
||||||
|
(interactive)
|
||||||
|
(evil-shift-left (region-beginning) (region-end))
|
||||||
|
(evil-normal-state)
|
||||||
|
(evil-visual-restore))
|
||||||
|
|
||||||
|
(defun prelude-shift-right-visual ()
|
||||||
|
"Shift right and restore visual selection."
|
||||||
|
(interactive)
|
||||||
|
(evil-shift-right (region-beginning) (region-end))
|
||||||
|
(evil-normal-state)
|
||||||
|
(evil-visual-restore))
|
||||||
|
|
||||||
|
(define-key evil-visual-state-map (kbd ">") 'prelude-shift-right-visual)
|
||||||
|
(define-key evil-visual-state-map (kbd "<") 'prelude-shift-left-visual)
|
||||||
|
|
||||||
|
;; Scrolling
|
||||||
|
(defun prelude-evil-scroll-down-other-window ()
|
||||||
|
(interactive)
|
||||||
|
(scroll-other-window))
|
||||||
|
|
||||||
|
(defun prelude-evil-scroll-up-other-window ()
|
||||||
|
(interactive)
|
||||||
|
(scroll-other-window '-))
|
||||||
|
|
||||||
|
(define-key evil-normal-state-map
|
||||||
|
(kbd "C-S-d") 'prelude-evil-scroll-down-other-window)
|
||||||
|
|
||||||
|
(define-key evil-normal-state-map
|
||||||
|
(kbd "C-S-u") 'prelude-evil-scroll-up-other-window)
|
||||||
|
|
||||||
|
;;
|
||||||
|
;; Magit from avsej
|
||||||
|
;;
|
||||||
|
(evil-add-hjkl-bindings magit-log-mode-map 'emacs)
|
||||||
|
(evil-add-hjkl-bindings magit-commit-mode-map 'emacs)
|
||||||
|
(evil-add-hjkl-bindings magit-branch-manager-mode-map 'emacs
|
||||||
|
"K" 'magit-discard
|
||||||
|
"L" 'magit-log-popup)
|
||||||
|
(evil-add-hjkl-bindings magit-status-mode-map 'emacs
|
||||||
|
"K" 'magit-discard
|
||||||
|
"l" 'magit-log-popup
|
||||||
|
"h" 'magit-diff-toggle-refine-hunk)
|
||||||
|
|
||||||
|
(setq evil-shift-width 2)
|
||||||
|
|
||||||
|
;;; enable avy with evil-mode
|
||||||
|
(define-key evil-normal-state-map (kbd "SPC") 'avy-goto-word-1)
|
||||||
|
|
||||||
|
;;; snagged from Eric S. Fraga
|
||||||
|
;;; http://lists.gnu.org/archive/html/emacs-orgmode/2012-05/msg00153.html
|
||||||
|
(defun prelude-evil-key-bindings-for-org ()
|
||||||
|
;;(message "Defining evil key bindings for org")
|
||||||
|
(evil-declare-key 'normal org-mode-map
|
||||||
|
"gk" 'outline-up-heading
|
||||||
|
"gj" 'outline-next-visible-heading
|
||||||
|
"H" 'org-beginning-of-line ; smarter behaviour on headlines etc.
|
||||||
|
"L" 'org-end-of-line ; smarter behaviour on headlines etc.
|
||||||
|
"t" 'org-todo ; mark a TODO item as DONE
|
||||||
|
",c" 'org-cycle
|
||||||
|
(kbd "TAB") 'org-cycle
|
||||||
|
",e" 'org-export-dispatch
|
||||||
|
",n" 'outline-next-visible-heading
|
||||||
|
",p" 'outline-previous-visible-heading
|
||||||
|
",t" 'org-set-tags-command
|
||||||
|
",u" 'outline-up-heading
|
||||||
|
"$" 'org-end-of-line ; smarter behaviour on headlines etc.
|
||||||
|
"^" 'org-beginning-of-line ; ditto
|
||||||
|
"-" 'org-ctrl-c-minus ; change bullet style
|
||||||
|
"<" 'org-metaleft ; out-dent
|
||||||
|
">" 'org-metaright ; indent
|
||||||
|
))
|
||||||
|
(prelude-evil-key-bindings-for-org)
|
||||||
|
(provide 'prelude-evil)
|
|
@ -0,0 +1,84 @@
|
||||||
|
;;; prelude-go.el --- Emacs Prelude: Go programming support.
|
||||||
|
;;
|
||||||
|
;; Author: Doug MacEachern
|
||||||
|
;; Version: 1.0.0
|
||||||
|
;; Keywords: convenience go
|
||||||
|
|
||||||
|
;; This file is not part of GNU Emacs.
|
||||||
|
|
||||||
|
;;; Commentary:
|
||||||
|
|
||||||
|
;; Prelude configuration for Go
|
||||||
|
|
||||||
|
;;; 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 'prelude-programming)
|
||||||
|
|
||||||
|
(prelude-require-packages '(go-mode
|
||||||
|
company-go
|
||||||
|
go-eldoc
|
||||||
|
go-projectile
|
||||||
|
gotest))
|
||||||
|
|
||||||
|
(require 'go-projectile)
|
||||||
|
|
||||||
|
;; Ignore go test -c output files
|
||||||
|
(add-to-list 'completion-ignored-extensions ".test")
|
||||||
|
|
||||||
|
(define-key 'help-command (kbd "G") 'godoc)
|
||||||
|
|
||||||
|
(eval-after-load 'go-mode
|
||||||
|
'(progn
|
||||||
|
(defun prelude-go-mode-defaults ()
|
||||||
|
;; Add to default go-mode key bindings
|
||||||
|
(let ((map go-mode-map))
|
||||||
|
(define-key map (kbd "C-c a") 'go-test-current-project) ;; current package, really
|
||||||
|
(define-key map (kbd "C-c m") 'go-test-current-file)
|
||||||
|
(define-key map (kbd "C-c .") 'go-test-current-test)
|
||||||
|
(define-key map (kbd "C-c b") 'go-run)
|
||||||
|
(define-key map (kbd "C-h f") 'godoc-at-point))
|
||||||
|
|
||||||
|
;; Prefer goimports to gofmt if installed
|
||||||
|
(let ((goimports (executable-find "goimports")))
|
||||||
|
(when goimports
|
||||||
|
(setq gofmt-command goimports)))
|
||||||
|
|
||||||
|
;; gofmt on save
|
||||||
|
(add-hook 'before-save-hook 'gofmt-before-save nil t)
|
||||||
|
|
||||||
|
;; stop whitespace being highlighted
|
||||||
|
(whitespace-toggle-options '(tabs))
|
||||||
|
|
||||||
|
;; Company mode settings
|
||||||
|
(set (make-local-variable 'company-backends) '(company-go))
|
||||||
|
|
||||||
|
;; El-doc for Go
|
||||||
|
(go-eldoc-setup)
|
||||||
|
|
||||||
|
;; CamelCase aware editing operations
|
||||||
|
(subword-mode +1))
|
||||||
|
|
||||||
|
(setq prelude-go-mode-hook 'prelude-go-mode-defaults)
|
||||||
|
|
||||||
|
(add-hook 'go-mode-hook (lambda ()
|
||||||
|
(run-hooks 'prelude-go-mode-hook)))))
|
||||||
|
|
||||||
|
(provide 'prelude-go)
|
||||||
|
;;; prelude-go.el ends here
|
|
@ -0,0 +1,53 @@
|
||||||
|
;;; prelude-haskell.el --- Emacs Prelude: Nice config for Haskell programming.
|
||||||
|
;;
|
||||||
|
;; Copyright © 2011-2017 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:
|
||||||
|
|
||||||
|
;; Nice config for Haskell programming.
|
||||||
|
|
||||||
|
;;; 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 'prelude-programming)
|
||||||
|
(prelude-require-packages '(haskell-mode))
|
||||||
|
|
||||||
|
(eval-after-load 'haskell-mode
|
||||||
|
'(progn
|
||||||
|
(defun prelude-haskell-mode-defaults ()
|
||||||
|
(subword-mode +1)
|
||||||
|
(eldoc-mode +1)
|
||||||
|
(haskell-indentation-mode +1)
|
||||||
|
(interactive-haskell-mode +1))
|
||||||
|
|
||||||
|
(setq prelude-haskell-mode-hook 'prelude-haskell-mode-defaults)
|
||||||
|
|
||||||
|
(add-hook 'haskell-mode-hook (lambda ()
|
||||||
|
(run-hooks 'prelude-haskell-mode-hook)))))
|
||||||
|
|
||||||
|
(provide 'prelude-haskell)
|
||||||
|
|
||||||
|
;;; prelude-haskell.el ends here
|
|
@ -0,0 +1,72 @@
|
||||||
|
;;; prelude-helm-everywhere.el --- Enable Helm everywhere
|
||||||
|
;;
|
||||||
|
;; Copyright © 2014-2017 Tu, Do Hoang
|
||||||
|
;;
|
||||||
|
;; Author: Tu, Do Hoang (tuhdo1710@gmail.com)
|
||||||
|
;; URL: https://github.com/bbatsov/prelude
|
||||||
|
;; Version: 1.0.0
|
||||||
|
;; Keywords: convenience
|
||||||
|
|
||||||
|
;; This file is not part of GNU Emacs.
|
||||||
|
|
||||||
|
;;; Commentary:
|
||||||
|
|
||||||
|
;; Enable Helm everywhere with global key bindings to replace common
|
||||||
|
;; global bindings and `helm-mode' is activated to replace `completing-read'
|
||||||
|
;; with `helm-completing-read-default', so users can use Helm with every prompt.
|
||||||
|
|
||||||
|
;;; 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 'prelude-helm)
|
||||||
|
(prelude-require-packages '(helm-descbinds helm-ag))
|
||||||
|
(require 'helm-eshell)
|
||||||
|
|
||||||
|
(global-set-key (kbd "M-x") 'helm-M-x)
|
||||||
|
(global-set-key (kbd "C-x C-m") 'helm-M-x)
|
||||||
|
(global-set-key (kbd "M-y") 'helm-show-kill-ring)
|
||||||
|
(global-set-key (kbd "C-x b") 'helm-mini)
|
||||||
|
(global-set-key (kbd "C-x C-b") 'helm-buffers-list)
|
||||||
|
(global-set-key (kbd "C-x C-f") 'helm-find-files)
|
||||||
|
(global-set-key (kbd "C-h f") 'helm-apropos)
|
||||||
|
(global-set-key (kbd "C-h r") 'helm-info-emacs)
|
||||||
|
(global-set-key (kbd "C-h C-l") 'helm-locate-library)
|
||||||
|
(define-key prelude-mode-map (kbd "C-c f") 'helm-recentf)
|
||||||
|
|
||||||
|
(define-key minibuffer-local-map (kbd "C-c C-l") 'helm-minibuffer-history)
|
||||||
|
|
||||||
|
(define-key isearch-mode-map (kbd "C-o") 'helm-occur-from-isearch)
|
||||||
|
|
||||||
|
;; shell history.
|
||||||
|
(define-key shell-mode-map (kbd "C-c C-l") 'helm-comint-input-ring)
|
||||||
|
|
||||||
|
;; use helm to list eshell history
|
||||||
|
(add-hook 'eshell-mode-hook
|
||||||
|
#'(lambda ()
|
||||||
|
(substitute-key-definition 'eshell-list-history 'helm-eshell-history eshell-mode-map)))
|
||||||
|
|
||||||
|
(substitute-key-definition 'find-tag 'helm-etags-select global-map)
|
||||||
|
(setq projectile-completion-system 'helm)
|
||||||
|
(helm-descbinds-mode)
|
||||||
|
(helm-mode 1)
|
||||||
|
|
||||||
|
;; enable Helm version of Projectile with replacment commands
|
||||||
|
(helm-projectile-on)
|
||||||
|
|
||||||
|
(provide 'prelude-helm-everywhere)
|
||||||
|
;; prelude-helm-everywhere.el ends here.
|
|
@ -0,0 +1,67 @@
|
||||||
|
;;; prelude-helm.el --- Helm setup
|
||||||
|
;;
|
||||||
|
;; Copyright © 2011-2017 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 configuration for Helm following this guide:
|
||||||
|
;; http://tuhdo.github.io/helm-intro.html
|
||||||
|
|
||||||
|
;;; 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:
|
||||||
|
|
||||||
|
(prelude-require-packages '(helm helm-projectile))
|
||||||
|
|
||||||
|
(require 'helm-config)
|
||||||
|
(require 'helm-projectile)
|
||||||
|
|
||||||
|
(when (executable-find "curl")
|
||||||
|
(setq helm-google-suggest-use-curl-p t))
|
||||||
|
|
||||||
|
;; See https://github.com/bbatsov/prelude/pull/670 for a detailed
|
||||||
|
;; discussion of these options.
|
||||||
|
(setq helm-split-window-in-side-p t
|
||||||
|
helm-buffers-fuzzy-matching t
|
||||||
|
helm-move-to-line-cycle-in-source t
|
||||||
|
helm-ff-search-library-in-sexp t
|
||||||
|
helm-ff-file-name-history-use-recentf t)
|
||||||
|
|
||||||
|
;; The default "C-x c" is quite close to "C-x C-c", which quits Emacs.
|
||||||
|
;; Changed to "C-c h". Note: We must set "C-c h" globally, because we
|
||||||
|
;; cannot change `helm-command-prefix-key' once `helm-config' is loaded.
|
||||||
|
(global-set-key (kbd "C-c h") 'helm-command-prefix)
|
||||||
|
(global-unset-key (kbd "C-x c"))
|
||||||
|
|
||||||
|
(define-key helm-command-map (kbd "o") 'helm-occur)
|
||||||
|
(define-key helm-command-map (kbd "g") 'helm-do-grep)
|
||||||
|
(define-key helm-command-map (kbd "C-c w") 'helm-wikipedia-suggest)
|
||||||
|
(define-key helm-command-map (kbd "SPC") 'helm-all-mark-rings)
|
||||||
|
|
||||||
|
(push "Press <C-c p h> to navigate a project in Helm." prelude-tips)
|
||||||
|
|
||||||
|
(provide 'prelude-helm)
|
||||||
|
|
||||||
|
;;; prelude-helm.el ends here
|
|
@ -0,0 +1,64 @@
|
||||||
|
;;; prelude-ido.el --- Ido setup
|
||||||
|
;;
|
||||||
|
;; Copyright © 2011-2017 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:
|
||||||
|
|
||||||
|
;; Ido-related config.
|
||||||
|
|
||||||
|
;;; 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:
|
||||||
|
(prelude-require-packages '(flx-ido ido-completing-read+ smex))
|
||||||
|
|
||||||
|
(require 'ido)
|
||||||
|
(require 'ido-completing-read+)
|
||||||
|
(require 'flx-ido)
|
||||||
|
|
||||||
|
(setq ido-enable-prefix nil
|
||||||
|
ido-enable-flex-matching t
|
||||||
|
ido-create-new-buffer 'always
|
||||||
|
ido-use-filename-at-point 'guess
|
||||||
|
ido-max-prospects 10
|
||||||
|
ido-save-directory-list-file (expand-file-name "ido.hist" prelude-savefile-dir)
|
||||||
|
ido-default-file-method 'selected-window
|
||||||
|
ido-auto-merge-work-directories-length -1)
|
||||||
|
(ido-mode +1)
|
||||||
|
(ido-ubiquitous-mode +1)
|
||||||
|
|
||||||
|
;;; smarter fuzzy matching for ido
|
||||||
|
(flx-ido-mode +1)
|
||||||
|
;; disable ido faces to see flx highlights
|
||||||
|
(setq ido-use-faces nil)
|
||||||
|
|
||||||
|
;;; smex, remember recently and most frequently used commands
|
||||||
|
(require 'smex)
|
||||||
|
(setq smex-save-file (expand-file-name ".smex-items" prelude-savefile-dir))
|
||||||
|
(smex-initialize)
|
||||||
|
(global-set-key (kbd "M-x") 'smex)
|
||||||
|
(global-set-key (kbd "M-X") 'smex-major-mode-commands)
|
||||||
|
|
||||||
|
(provide 'prelude-ido)
|
||||||
|
;;; prelude-ido.el ends here
|
|
@ -0,0 +1,70 @@
|
||||||
|
;;; prelude-ivy.el --- Ivy setup
|
||||||
|
;;
|
||||||
|
;; Copyright © 2011-2017 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:
|
||||||
|
|
||||||
|
;; Ivy-related config.
|
||||||
|
|
||||||
|
;;; 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:
|
||||||
|
(prelude-require-packages '(ivy swiper counsel))
|
||||||
|
|
||||||
|
;; ivy is a powerful alternative to the popular ido-mode
|
||||||
|
|
||||||
|
(require 'ivy)
|
||||||
|
|
||||||
|
(ivy-mode 1)
|
||||||
|
(setq ivy-use-virtual-buffers t)
|
||||||
|
(setq enable-recursive-minibuffers t)
|
||||||
|
(global-set-key (kbd "C-c C-r") 'ivy-resume)
|
||||||
|
(global-set-key (kbd "<f6>") 'ivy-resume)
|
||||||
|
|
||||||
|
(setq projectile-completion-system 'ivy)
|
||||||
|
|
||||||
|
;; swiper provides enhanced buffer search
|
||||||
|
|
||||||
|
(global-set-key "\C-s" 'swiper)
|
||||||
|
|
||||||
|
|
||||||
|
;; counsel supercharges a lot of commands with some ivy magic
|
||||||
|
|
||||||
|
(global-set-key (kbd "M-x") 'counsel-M-x)
|
||||||
|
(global-set-key (kbd "C-x C-f") 'counsel-find-file)
|
||||||
|
(global-set-key (kbd "<f1> f") 'counsel-describe-function)
|
||||||
|
(global-set-key (kbd "<f1> v") 'counsel-describe-variable)
|
||||||
|
(global-set-key (kbd "<f1> l") 'counsel-find-library)
|
||||||
|
(global-set-key (kbd "<f2> i") 'counsel-info-lookup-symbol)
|
||||||
|
(global-set-key (kbd "<f2> u") 'counsel-unicode-char)
|
||||||
|
(global-set-key (kbd "C-c g") 'counsel-git)
|
||||||
|
(global-set-key (kbd "C-c j") 'counsel-git-grep)
|
||||||
|
(global-set-key (kbd "C-c k") 'counsel-ag)
|
||||||
|
(global-set-key (kbd "C-x l") 'counsel-locate)
|
||||||
|
(define-key minibuffer-local-map (kbd "C-r") 'counsel-minibuffer-history)
|
||||||
|
|
||||||
|
|
||||||
|
(provide 'prelude-ivy)
|
||||||
|
;;; prelude-ivy.el ends here
|
|
@ -0,0 +1,58 @@
|
||||||
|
;;; prelude-js.el --- Emacs Prelude: js-mode configuration.
|
||||||
|
;;
|
||||||
|
;; Copyright © 2011-2017 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 basic configuration for js-mode.
|
||||||
|
|
||||||
|
;;; 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 'prelude-programming)
|
||||||
|
(prelude-require-packages '(js2-mode json-mode))
|
||||||
|
|
||||||
|
(require 'js2-mode)
|
||||||
|
|
||||||
|
(add-to-list 'auto-mode-alist '("\\.js\\'" . js2-mode))
|
||||||
|
(add-to-list 'auto-mode-alist '("\\.pac\\'" . js2-mode))
|
||||||
|
(add-to-list 'interpreter-mode-alist '("node" . js2-mode))
|
||||||
|
|
||||||
|
(eval-after-load 'js2-mode
|
||||||
|
'(progn
|
||||||
|
(defun prelude-js-mode-defaults ()
|
||||||
|
;; electric-layout-mode doesn't play nice with smartparens
|
||||||
|
(setq-local electric-layout-rules '((?\; . after)))
|
||||||
|
(setq mode-name "JS2")
|
||||||
|
(js2-imenu-extras-mode +1))
|
||||||
|
|
||||||
|
(setq prelude-js-mode-hook 'prelude-js-mode-defaults)
|
||||||
|
|
||||||
|
(add-hook 'js2-mode-hook (lambda () (run-hooks 'prelude-js-mode-hook)))))
|
||||||
|
|
||||||
|
(provide 'prelude-js)
|
||||||
|
|
||||||
|
;;; prelude-js.el ends here
|
|
@ -0,0 +1,60 @@
|
||||||
|
;;; prelude-key-chord.el --- Key chord setup
|
||||||
|
;;
|
||||||
|
;; Copyright © 2011-2017 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:
|
||||||
|
|
||||||
|
;; Configure key-chord key bindings.
|
||||||
|
|
||||||
|
;;; 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:
|
||||||
|
(prelude-require-package 'key-chord)
|
||||||
|
|
||||||
|
(require 'key-chord)
|
||||||
|
|
||||||
|
(key-chord-define-global "jj" 'avy-goto-word-1)
|
||||||
|
(key-chord-define-global "jl" 'avy-goto-line)
|
||||||
|
(key-chord-define-global "jk" 'avy-goto-char)
|
||||||
|
(key-chord-define-global "JJ" 'crux-switch-to-previous-buffer)
|
||||||
|
(key-chord-define-global "uu" 'undo-tree-visualize)
|
||||||
|
(key-chord-define-global "xx" 'execute-extended-command)
|
||||||
|
(key-chord-define-global "yy" 'browse-kill-ring)
|
||||||
|
|
||||||
|
(defvar key-chord-tips '("Press <jj> quickly to jump to the beginning of a visible word."
|
||||||
|
"Press <jl> quickly to jump to a visible line."
|
||||||
|
"Press <jk> quickly to jump to a visible character."
|
||||||
|
"Press <JJ> quickly to switch to previous buffer."
|
||||||
|
"Press <uu> quickly to visualize the undo tree."
|
||||||
|
"Press <xx> quickly to execute extended command."
|
||||||
|
"Press <yy> quickly to browse the kill ring."))
|
||||||
|
|
||||||
|
(setq prelude-tips (append prelude-tips key-chord-tips))
|
||||||
|
|
||||||
|
(key-chord-mode +1)
|
||||||
|
|
||||||
|
(provide 'prelude-key-chord)
|
||||||
|
|
||||||
|
;;; prelude-key-chord.el ends here
|
|
@ -0,0 +1,93 @@
|
||||||
|
;;; prelude-latex.el --- Emacs Prelude: Sane setup for LaTeX writers.
|
||||||
|
;;
|
||||||
|
;; Copyright © 2011-2017 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:
|
||||||
|
|
||||||
|
;; Nice defaults for the premium LaTeX editing mode auctex.
|
||||||
|
|
||||||
|
;;; 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:
|
||||||
|
|
||||||
|
(prelude-require-packages '(auctex cdlatex))
|
||||||
|
(require 'smartparens-latex)
|
||||||
|
;; for case
|
||||||
|
(require 'cl)
|
||||||
|
|
||||||
|
(eval-after-load "company"
|
||||||
|
'(progn
|
||||||
|
(prelude-require-packages '(company-auctex))
|
||||||
|
(company-auctex-init)))
|
||||||
|
|
||||||
|
(defcustom prelude-latex-fast-math-entry 'LaTeX-math-mode
|
||||||
|
"Method used for fast math symbol entry in LaTeX."
|
||||||
|
:link '(function-link :tag "AUCTeX Math Mode" LaTeX-math-mode)
|
||||||
|
:link '(emacs-commentary-link :tag "CDLaTeX" "cdlatex.el")
|
||||||
|
:group 'prelude
|
||||||
|
:type '(choice (const :tag "None" nil)
|
||||||
|
(const :tag "AUCTeX Math Mode" LaTeX-math-mode)
|
||||||
|
(const :tag "CDLaTeX" cdlatex)))
|
||||||
|
|
||||||
|
;; AUCTeX configuration
|
||||||
|
(setq TeX-auto-save t)
|
||||||
|
(setq TeX-parse-self t)
|
||||||
|
(setq TeX-close-quote "")
|
||||||
|
(setq TeX-open-quote "")
|
||||||
|
|
||||||
|
(setq-default TeX-master nil)
|
||||||
|
|
||||||
|
;; use pdflatex
|
||||||
|
(setq TeX-PDF-mode t)
|
||||||
|
|
||||||
|
;; sensible defaults for OS X, other OSes should be covered out-of-the-box
|
||||||
|
(when (eq system-type 'darwin)
|
||||||
|
(setq TeX-view-program-selection
|
||||||
|
'((output-dvi "DVI Viewer")
|
||||||
|
(output-pdf "PDF Viewer")
|
||||||
|
(output-html "HTML Viewer")))
|
||||||
|
|
||||||
|
(setq TeX-view-program-list
|
||||||
|
'(("DVI Viewer" "open %o")
|
||||||
|
("PDF Viewer" "open %o")
|
||||||
|
("HTML Viewer" "open %o"))))
|
||||||
|
|
||||||
|
(defun prelude-latex-mode-defaults ()
|
||||||
|
"Default Prelude hook for `LaTeX-mode'."
|
||||||
|
(turn-on-auto-fill)
|
||||||
|
(abbrev-mode +1)
|
||||||
|
(smartparens-mode +1)
|
||||||
|
(case prelude-latex-fast-math-entry
|
||||||
|
(LaTeX-math-mode (LaTeX-math-mode 1))
|
||||||
|
(cdlatex (turn-on-cdlatex))))
|
||||||
|
|
||||||
|
(setq prelude-latex-mode-hook 'prelude-latex-mode-defaults)
|
||||||
|
|
||||||
|
(add-hook 'LaTeX-mode-hook (lambda ()
|
||||||
|
(run-hooks 'prelude-latex-mode-hook)))
|
||||||
|
|
||||||
|
(provide 'prelude-latex)
|
||||||
|
|
||||||
|
;;; prelude-latex.el ends here
|
|
@ -0,0 +1,64 @@
|
||||||
|
;;; prelude-lisp.el --- Emacs Prelude: Configuration common to all lisp modes.
|
||||||
|
;;
|
||||||
|
;; Copyright © 2011-2017 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:
|
||||||
|
|
||||||
|
;; Configuration shared between all modes related to lisp-like languages.
|
||||||
|
|
||||||
|
;;; 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 'prelude-programming)
|
||||||
|
(prelude-require-packages '(rainbow-delimiters))
|
||||||
|
|
||||||
|
;; Lisp configuration
|
||||||
|
(define-key read-expression-map (kbd "TAB") 'completion-at-point)
|
||||||
|
|
||||||
|
;; wrap keybindings
|
||||||
|
(define-key lisp-mode-shared-map (kbd "M-(") (prelude-wrap-with "("))
|
||||||
|
;; FIXME: Pick terminal-friendly binding.
|
||||||
|
;;(define-key lisp-mode-shared-map (kbd "M-[") (prelude-wrap-with "["))
|
||||||
|
(define-key lisp-mode-shared-map (kbd "M-\"") (prelude-wrap-with "\""))
|
||||||
|
|
||||||
|
;; a great lisp coding hook
|
||||||
|
(defun prelude-lisp-coding-defaults ()
|
||||||
|
(smartparens-strict-mode +1)
|
||||||
|
(rainbow-delimiters-mode +1))
|
||||||
|
|
||||||
|
(setq prelude-lisp-coding-hook 'prelude-lisp-coding-defaults)
|
||||||
|
|
||||||
|
;; interactive modes don't need whitespace checks
|
||||||
|
(defun prelude-interactive-lisp-coding-defaults ()
|
||||||
|
(smartparens-strict-mode +1)
|
||||||
|
(rainbow-delimiters-mode +1)
|
||||||
|
(whitespace-mode -1))
|
||||||
|
|
||||||
|
(setq prelude-interactive-lisp-coding-hook 'prelude-interactive-lisp-coding-defaults)
|
||||||
|
|
||||||
|
(provide 'prelude-lisp)
|
||||||
|
|
||||||
|
;;; prelude-lisp.el ends here
|
|
@ -0,0 +1,47 @@
|
||||||
|
;;; prelude-mediawiki.el --- Emacs Prelude: mediawiki editing config
|
||||||
|
;;
|
||||||
|
;; Copyright © 2011-2017 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:
|
||||||
|
|
||||||
|
;; Basic configs for access to WikEmacs and Wikipedia.
|
||||||
|
|
||||||
|
;;; 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:
|
||||||
|
|
||||||
|
(prelude-require-packages '(mediawiki))
|
||||||
|
|
||||||
|
(eval-after-load 'mediawiki
|
||||||
|
'(progn
|
||||||
|
(setq mediawiki-site-alist '(("Wikipedia" "http://en.wikipedia.org/w" "" "" "Main Page")
|
||||||
|
("WikEmacs" "http://wikemacs.org/w/" "" "" "Main Page")))
|
||||||
|
|
||||||
|
;; Emacs users care more for WikEmacs than Wikipedia :-)
|
||||||
|
(setq mediawiki-site-default "WikEmacs")))
|
||||||
|
|
||||||
|
(provide 'prelude-mediawiki)
|
||||||
|
|
||||||
|
;;; prelude-mediawiki.el ends here
|
|
@ -0,0 +1,92 @@
|
||||||
|
;;; prelude-ocaml.el --- Emacs Prelude: decent Perl coding settings.
|
||||||
|
;;
|
||||||
|
;; Copyright © 2014-2017 Geoff Shannon
|
||||||
|
;;
|
||||||
|
;; Author: Geoff Shannon <geoffpshannon@gmail.com>
|
||||||
|
;; URL: https://github.com/bbatsov/prelude
|
||||||
|
;; Version: 1.0.0
|
||||||
|
;; Keywords: convenience
|
||||||
|
|
||||||
|
;; This file is not part of GNU Emacs.
|
||||||
|
|
||||||
|
;;; Commentary:
|
||||||
|
|
||||||
|
;; tuareg is the preferred ocaml mode for Emacs
|
||||||
|
|
||||||
|
;; These setups for ocaml assume that you are using the OPAM package
|
||||||
|
;; manager (http://opam.ocaml.org/).
|
||||||
|
|
||||||
|
;; Because of the apparent complexity of getting emacs environment
|
||||||
|
;; variables setup to use opam correctly, it is instead easier to use
|
||||||
|
;; opam itself to execute any necessary commands.
|
||||||
|
|
||||||
|
;; Also, the standard OCaml toplevel usage has been replaced in favor
|
||||||
|
;; of UTOP, the universal toplevel, and we assume that you are using
|
||||||
|
;; the Jane Street Core libraries rather than the regular OCaml
|
||||||
|
;; standard libraries
|
||||||
|
|
||||||
|
;; The minimum required setup for using Prelude's OCaml setup would be
|
||||||
|
;; to install OPAM, and then, minimally `opam install core utop'. A
|
||||||
|
;; good getting started guide is available at
|
||||||
|
;; https://github.com/realworldocaml/book/wiki/Installation-Instructions
|
||||||
|
|
||||||
|
;;; 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:
|
||||||
|
|
||||||
|
(prelude-require-packages '(tuareg utop merlin flycheck-ocaml))
|
||||||
|
|
||||||
|
(require 'tuareg)
|
||||||
|
(require 'utop)
|
||||||
|
(require 'merlin)
|
||||||
|
|
||||||
|
(setq auto-mode-alist
|
||||||
|
(append '(("\\.ml[ily]?\\'" . tuareg-mode)
|
||||||
|
("\\.topml\\'" . tuareg-mode))
|
||||||
|
auto-mode-alist))
|
||||||
|
|
||||||
|
(with-eval-after-load 'merlin
|
||||||
|
;; Disable Merlin's own error checking
|
||||||
|
(setq merlin-error-after-save nil)
|
||||||
|
|
||||||
|
;; Enable Flycheck checker
|
||||||
|
(flycheck-ocaml-setup))
|
||||||
|
|
||||||
|
(add-hook 'tuareg-mode-hook #'utop-minor-mode)
|
||||||
|
(add-hook 'tuareg-mode-hook #'merlin-mode)
|
||||||
|
|
||||||
|
(add-hook 'tuareg-mode-hook (lambda ()
|
||||||
|
(progn
|
||||||
|
(define-key tuareg-mode-map (kbd "C-c C-s")
|
||||||
|
'utop)
|
||||||
|
(setq compile-command
|
||||||
|
"opam config exec corebuild "))))
|
||||||
|
|
||||||
|
;; Setup merlin completions company is used by default in prelude
|
||||||
|
(add-to-list 'company-backends 'merlin-company-backend)
|
||||||
|
|
||||||
|
;; Merlin also offers support for autocomplete, uncomment this next line
|
||||||
|
;; to activate it.
|
||||||
|
;; (setq merlin-use-auto-complete-mode t)
|
||||||
|
|
||||||
|
(setq utop-command "opam config exec utop -- -emacs"
|
||||||
|
merlin-error-after-save nil)
|
||||||
|
|
||||||
|
(provide 'prelude-ocaml)
|
||||||
|
|
||||||
|
;;; prelude-ocaml.el ends here
|
|
@ -0,0 +1,58 @@
|
||||||
|
;;; prelude-org.el --- Emacs Prelude: org-mode configuration.
|
||||||
|
;;
|
||||||
|
;; Copyright © 2011-2017 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 basic configuration for org-mode.
|
||||||
|
|
||||||
|
;;; 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:
|
||||||
|
|
||||||
|
(add-to-list 'auto-mode-alist '("\\.org\\’" . org-mode))
|
||||||
|
(global-set-key "\C-cl" 'org-store-link)
|
||||||
|
(global-set-key "\C-ca" 'org-agenda)
|
||||||
|
(global-set-key "\C-cb" 'org-iswitchb)
|
||||||
|
(setq org-log-done t)
|
||||||
|
|
||||||
|
(defun prelude-org-mode-defaults ()
|
||||||
|
(let ((oldmap (cdr (assoc 'prelude-mode minor-mode-map-alist)))
|
||||||
|
(newmap (make-sparse-keymap)))
|
||||||
|
(set-keymap-parent newmap oldmap)
|
||||||
|
(define-key newmap (kbd "C-c +") nil)
|
||||||
|
(define-key newmap (kbd "C-c -") nil)
|
||||||
|
(define-key newmap (kbd "C-a") nil)
|
||||||
|
(make-local-variable 'minor-mode-overriding-map-alist)
|
||||||
|
(push `(prelude-mode . ,newmap) minor-mode-overriding-map-alist))
|
||||||
|
)
|
||||||
|
|
||||||
|
(setq prelude-org-mode-hook 'prelude-org-mode-defaults)
|
||||||
|
|
||||||
|
(add-hook 'org-mode-hook (lambda () (run-hooks 'prelude-org-mode-hook)))
|
||||||
|
|
||||||
|
(provide 'prelude-org)
|
||||||
|
|
||||||
|
;;; prelude-org.el ends here
|
|
@ -0,0 +1,70 @@
|
||||||
|
;;; prelude-perl.el --- Emacs Prelude: decent Perl coding settings.
|
||||||
|
;;
|
||||||
|
;; Copyright © 2011-2017 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:
|
||||||
|
|
||||||
|
;; cperl-mode is the best Perl mode for Emacs out there.
|
||||||
|
|
||||||
|
;;; 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 'prelude-programming)
|
||||||
|
|
||||||
|
;; use cperl-mode instead of perl-mode
|
||||||
|
(defalias 'perl-mode 'cperl-mode)
|
||||||
|
|
||||||
|
(define-key 'help-command "P" 'cperl-perldoc)
|
||||||
|
|
||||||
|
(defun prelude-cperl-mode-defaults ()
|
||||||
|
(setq cperl-indent-level 4)
|
||||||
|
(setq cperl-continued-statement-offset 8)
|
||||||
|
;; cperl-hairy affects all those variables, but I prefer
|
||||||
|
;; a more fine-grained approach as far as they are concerned
|
||||||
|
(setq cperl-font-lock t)
|
||||||
|
(setq cperl-electric-lbrace-space t)
|
||||||
|
(setq cperl-electric-parens nil)
|
||||||
|
(setq cperl-electric-linefeed nil)
|
||||||
|
(setq cperl-electric-keywords nil)
|
||||||
|
(setq cperl-info-on-command-no-prompt t)
|
||||||
|
(setq cperl-clobber-lisp-bindings t)
|
||||||
|
(setq cperl-lazy-help-time 3)
|
||||||
|
|
||||||
|
;; if you want all the bells and whistles
|
||||||
|
;; (setq cperl-hairy)
|
||||||
|
|
||||||
|
(set-face-background 'cperl-array-face nil)
|
||||||
|
(set-face-background 'cperl-hash-face nil)
|
||||||
|
(setq cperl-invalid-face nil))
|
||||||
|
|
||||||
|
(setq prelude-cperl-mode-hook 'prelude-cperl-mode-defaults)
|
||||||
|
|
||||||
|
(add-hook 'cperl-mode-hook (lambda ()
|
||||||
|
(run-hooks 'prelude-cperl-mode-hook)) t)
|
||||||
|
|
||||||
|
(provide 'prelude-perl)
|
||||||
|
|
||||||
|
;;; prelude-perl.el ends here
|
|
@ -0,0 +1,91 @@
|
||||||
|
;;; prelude-programming.el --- Emacs Prelude: prog-mode configuration
|
||||||
|
;;
|
||||||
|
;; Copyright © 2011-2017 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 basic prog-mode configuration and programming related utilities.
|
||||||
|
|
||||||
|
;;; 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:
|
||||||
|
|
||||||
|
(defun prelude-local-comment-auto-fill ()
|
||||||
|
(set (make-local-variable 'comment-auto-fill-only-comments) t))
|
||||||
|
|
||||||
|
(defun prelude-font-lock-comment-annotations ()
|
||||||
|
"Highlight a bunch of well known comment annotations.
|
||||||
|
|
||||||
|
This functions should be added to the hooks of major modes for programming."
|
||||||
|
(font-lock-add-keywords
|
||||||
|
nil '(("\\<\\(\\(FIX\\(ME\\)?\\|TODO\\|OPTIMIZE\\|HACK\\|REFACTOR\\):\\)"
|
||||||
|
1 font-lock-warning-face t))))
|
||||||
|
|
||||||
|
;; show the name of the current function definition in the modeline
|
||||||
|
(require 'which-func)
|
||||||
|
(which-function-mode 1)
|
||||||
|
|
||||||
|
;; in Emacs 24 programming major modes generally derive from a common
|
||||||
|
;; mode named prog-mode; for others, we'll arrange for our mode
|
||||||
|
;; defaults function to run prelude-prog-mode-hook directly. To
|
||||||
|
;; augment and/or counteract these defaults your own function
|
||||||
|
;; to prelude-prog-mode-hook, using:
|
||||||
|
;;
|
||||||
|
;; (add-hook 'prelude-prog-mode-hook 'my-prog-mode-defaults t)
|
||||||
|
;;
|
||||||
|
;; (the final optional t sets the *append* argument)
|
||||||
|
|
||||||
|
;; smart curly braces
|
||||||
|
(sp-pair "{" nil :post-handlers
|
||||||
|
'(((lambda (&rest _ignored)
|
||||||
|
(crux-smart-open-line-above)) "RET")))
|
||||||
|
|
||||||
|
;; enlist a more liberal guru
|
||||||
|
(setq guru-warn-only t)
|
||||||
|
|
||||||
|
(defun prelude-prog-mode-defaults ()
|
||||||
|
"Default coding hook, useful with any programming language."
|
||||||
|
(when (and (executable-find ispell-program-name)
|
||||||
|
prelude-flyspell)
|
||||||
|
(flyspell-prog-mode))
|
||||||
|
(when prelude-guru
|
||||||
|
(guru-mode +1))
|
||||||
|
(smartparens-mode +1)
|
||||||
|
(prelude-enable-whitespace)
|
||||||
|
(prelude-local-comment-auto-fill)
|
||||||
|
(prelude-font-lock-comment-annotations))
|
||||||
|
|
||||||
|
(setq prelude-prog-mode-hook 'prelude-prog-mode-defaults)
|
||||||
|
|
||||||
|
(add-hook 'prog-mode-hook (lambda ()
|
||||||
|
(run-hooks 'prelude-prog-mode-hook)))
|
||||||
|
|
||||||
|
;; enable on-the-fly syntax checking
|
||||||
|
(if (fboundp 'global-flycheck-mode)
|
||||||
|
(global-flycheck-mode +1)
|
||||||
|
(add-hook 'prog-mode-hook 'flycheck-mode))
|
||||||
|
|
||||||
|
(provide 'prelude-programming)
|
||||||
|
;;; prelude-programming.el ends here
|
|
@ -0,0 +1,111 @@
|
||||||
|
;;; prelude-python.el --- Emacs Prelude: python.el configuration.
|
||||||
|
;;
|
||||||
|
;; Copyright © 2011-2017 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 basic configuration for python.el (the latest and greatest
|
||||||
|
;; Python mode Emacs has to offer).
|
||||||
|
|
||||||
|
;;; 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:
|
||||||
|
|
||||||
|
(prelude-require-package 'anaconda-mode)
|
||||||
|
|
||||||
|
(when (boundp 'company-backends)
|
||||||
|
(prelude-require-package 'company-anaconda)
|
||||||
|
(add-to-list 'company-backends 'company-anaconda))
|
||||||
|
|
||||||
|
(require 'electric)
|
||||||
|
(require 'prelude-programming)
|
||||||
|
|
||||||
|
;; Copy pasted from ruby-mode.el
|
||||||
|
(defun prelude-python--encoding-comment-required-p ()
|
||||||
|
(re-search-forward "[^\0-\177]" nil t))
|
||||||
|
|
||||||
|
(defun prelude-python--detect-encoding ()
|
||||||
|
(let ((coding-system
|
||||||
|
(or save-buffer-coding-system
|
||||||
|
buffer-file-coding-system)))
|
||||||
|
(if coding-system
|
||||||
|
(symbol-name
|
||||||
|
(or (coding-system-get coding-system 'mime-charset)
|
||||||
|
(coding-system-change-eol-conversion coding-system nil)))
|
||||||
|
"ascii-8bit")))
|
||||||
|
|
||||||
|
(defun prelude-python--insert-coding-comment (encoding)
|
||||||
|
(let ((newlines (if (looking-at "^\\s *$") "\n" "\n\n")))
|
||||||
|
(insert (format "# coding: %s" encoding) newlines)))
|
||||||
|
|
||||||
|
(defun prelude-python-mode-set-encoding ()
|
||||||
|
"Insert a magic comment header with the proper encoding if necessary."
|
||||||
|
(save-excursion
|
||||||
|
(widen)
|
||||||
|
(goto-char (point-min))
|
||||||
|
(when (prelude-python--encoding-comment-required-p)
|
||||||
|
(goto-char (point-min))
|
||||||
|
(let ((coding-system (prelude-python--detect-encoding)))
|
||||||
|
(when coding-system
|
||||||
|
(if (looking-at "^#!") (beginning-of-line 2))
|
||||||
|
(cond ((looking-at "\\s *#\\s *.*\\(en\\)?coding\\s *:\\s *\\([-a-z0-9_]*\\)")
|
||||||
|
;; update existing encoding comment if necessary
|
||||||
|
(unless (string= (match-string 2) coding-system)
|
||||||
|
(goto-char (match-beginning 2))
|
||||||
|
(delete-region (point) (match-end 2))
|
||||||
|
(insert coding-system)))
|
||||||
|
((looking-at "\\s *#.*coding\\s *[:=]"))
|
||||||
|
(t (prelude-python--insert-coding-comment coding-system)))
|
||||||
|
(when (buffer-modified-p)
|
||||||
|
(basic-save-buffer-1)))))))
|
||||||
|
|
||||||
|
(when (fboundp 'exec-path-from-shell-copy-env)
|
||||||
|
(exec-path-from-shell-copy-env "PYTHONPATH"))
|
||||||
|
|
||||||
|
(defun prelude-python-mode-defaults ()
|
||||||
|
"Defaults for Python programming."
|
||||||
|
(subword-mode +1)
|
||||||
|
(anaconda-mode 1)
|
||||||
|
(eldoc-mode 1)
|
||||||
|
(setq-local electric-layout-rules
|
||||||
|
'((?: . (lambda ()
|
||||||
|
(and (zerop (first (syntax-ppss)))
|
||||||
|
(python-info-statement-starts-block-p)
|
||||||
|
'after)))))
|
||||||
|
(when (fboundp #'python-imenu-create-flat-index)
|
||||||
|
(setq-local imenu-create-index-function
|
||||||
|
#'python-imenu-create-flat-index))
|
||||||
|
(add-hook 'post-self-insert-hook
|
||||||
|
#'electric-layout-post-self-insert-function nil 'local)
|
||||||
|
(add-hook 'after-save-hook 'prelude-python-mode-set-encoding nil 'local))
|
||||||
|
|
||||||
|
(setq prelude-python-mode-hook 'prelude-python-mode-defaults)
|
||||||
|
|
||||||
|
(add-hook 'python-mode-hook (lambda ()
|
||||||
|
(run-hooks 'prelude-python-mode-hook)))
|
||||||
|
|
||||||
|
(provide 'prelude-python)
|
||||||
|
|
||||||
|
;;; prelude-python.el ends here
|
|
@ -0,0 +1,78 @@
|
||||||
|
;;; prelude-ruby.el --- Emacs Prelude: A nice setup for Ruby (and Rails) devs.
|
||||||
|
;;
|
||||||
|
;; Copyright © 2011-2017 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 basic configuration for Ruby and Rails development.
|
||||||
|
|
||||||
|
;;; 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 'prelude-programming)
|
||||||
|
|
||||||
|
(prelude-require-packages '(ruby-tools inf-ruby yari))
|
||||||
|
|
||||||
|
;; Rake files are ruby, too, as are gemspecs, rackup files, and gemfiles.
|
||||||
|
(add-to-list 'auto-mode-alist '("\\.rake\\'" . ruby-mode))
|
||||||
|
(add-to-list 'auto-mode-alist '("Rakefile\\'" . ruby-mode))
|
||||||
|
(add-to-list 'auto-mode-alist '("\\.gemspec\\'" . ruby-mode))
|
||||||
|
(add-to-list 'auto-mode-alist '("\\.ru\\'" . ruby-mode))
|
||||||
|
(add-to-list 'auto-mode-alist '("Gemfile\\'" . ruby-mode))
|
||||||
|
(add-to-list 'auto-mode-alist '("Guardfile\\'" . ruby-mode))
|
||||||
|
(add-to-list 'auto-mode-alist '("Capfile\\'" . ruby-mode))
|
||||||
|
(add-to-list 'auto-mode-alist '("\\.cap\\'" . ruby-mode))
|
||||||
|
(add-to-list 'auto-mode-alist '("\\.thor\\'" . ruby-mode))
|
||||||
|
(add-to-list 'auto-mode-alist '("\\.rabl\\'" . ruby-mode))
|
||||||
|
(add-to-list 'auto-mode-alist '("Thorfile\\'" . ruby-mode))
|
||||||
|
(add-to-list 'auto-mode-alist '("Vagrantfile\\'" . ruby-mode))
|
||||||
|
(add-to-list 'auto-mode-alist '("\\.jbuilder\\'" . ruby-mode))
|
||||||
|
(add-to-list 'auto-mode-alist '("Podfile\\'" . ruby-mode))
|
||||||
|
(add-to-list 'auto-mode-alist '("\\.podspec\\'" . ruby-mode))
|
||||||
|
(add-to-list 'auto-mode-alist '("Puppetfile\\'" . ruby-mode))
|
||||||
|
(add-to-list 'auto-mode-alist '("Berksfile\\'" . ruby-mode))
|
||||||
|
(add-to-list 'auto-mode-alist '("Appraisals\\'" . ruby-mode))
|
||||||
|
|
||||||
|
;; We never want to edit Rubinius bytecode
|
||||||
|
(add-to-list 'completion-ignored-extensions ".rbc")
|
||||||
|
|
||||||
|
(define-key 'help-command (kbd "R") 'yari)
|
||||||
|
|
||||||
|
(eval-after-load 'ruby-mode
|
||||||
|
'(progn
|
||||||
|
(defun prelude-ruby-mode-defaults ()
|
||||||
|
(inf-ruby-minor-mode +1)
|
||||||
|
(ruby-tools-mode +1)
|
||||||
|
;; CamelCase aware editing operations
|
||||||
|
(subword-mode +1))
|
||||||
|
|
||||||
|
(setq prelude-ruby-mode-hook 'prelude-ruby-mode-defaults)
|
||||||
|
|
||||||
|
(add-hook 'ruby-mode-hook (lambda ()
|
||||||
|
(run-hooks 'prelude-ruby-mode-hook)))))
|
||||||
|
|
||||||
|
(provide 'prelude-ruby)
|
||||||
|
;;; prelude-ruby.el ends here
|
|
@ -0,0 +1,66 @@
|
||||||
|
;;; prelude-rust.el --- Emacs Prelude: Rust programming support.
|
||||||
|
;;
|
||||||
|
;; Authors: Doug MacEachern, Manoel Vilela
|
||||||
|
;; Version: 1.0.1
|
||||||
|
;; Keywords: convenience rust
|
||||||
|
|
||||||
|
;; This file is not part of GNU Emacs.
|
||||||
|
|
||||||
|
;;; Commentary:
|
||||||
|
|
||||||
|
;; Prelude configuration for Rust
|
||||||
|
|
||||||
|
;;; 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 'prelude-programming)
|
||||||
|
|
||||||
|
;; You may need installing the following packages on your system:
|
||||||
|
;; * rustc (Rust Compiler)
|
||||||
|
;; * cargo (Rust Package Manager)
|
||||||
|
;; * racer (Rust Completion Tool)
|
||||||
|
;; * rustfmt (Rust Tool for formatting code)
|
||||||
|
|
||||||
|
(prelude-require-packages '(rust-mode
|
||||||
|
racer
|
||||||
|
flycheck-rust
|
||||||
|
cargo))
|
||||||
|
|
||||||
|
(setq rust-format-on-save t)
|
||||||
|
|
||||||
|
(eval-after-load 'rust-mode
|
||||||
|
'(progn
|
||||||
|
(add-hook 'rust-mode-hook 'racer-mode)
|
||||||
|
(add-hook 'racer-mode-hook 'eldoc-mode)
|
||||||
|
(add-hook 'rust-mode-hook 'cargo-minor-mode)
|
||||||
|
(add-hook 'rust-mode-hook 'flycheck-rust-setup)
|
||||||
|
(add-hook 'flycheck-mode-hook 'flycheck-rust-setup)
|
||||||
|
|
||||||
|
(defun prelude-rust-mode-defaults ()
|
||||||
|
(local-set-key (kbd "C-c C-d") 'racer-describe)
|
||||||
|
;; CamelCase aware editing operations
|
||||||
|
(subword-mode +1))
|
||||||
|
|
||||||
|
(setq prelude-rust-mode-hook 'prelude-rust-mode-defaults)
|
||||||
|
|
||||||
|
(add-hook 'rust-mode-hook (lambda ()
|
||||||
|
(run-hooks 'prelude-rust-mode-hook)))))
|
||||||
|
|
||||||
|
(provide 'prelude-rust)
|
||||||
|
;;; prelude-rust.el ends here
|
|
@ -0,0 +1,48 @@
|
||||||
|
;;; prelude-scala.el --- Emacs Prelude: scala-mode configuration.
|
||||||
|
;;
|
||||||
|
;; Copyright © 2011-2017 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 basic support for the Scala programming language
|
||||||
|
|
||||||
|
;;; 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 'prelude-programming)
|
||||||
|
(prelude-require-packages '(scala-mode ensime))
|
||||||
|
|
||||||
|
(defun prelude-scala-mode-defaults ()
|
||||||
|
(subword-mode +1)
|
||||||
|
(ensime-mode +1))
|
||||||
|
|
||||||
|
(setq prelude-scala-mode-hook 'prelude-scala-mode-defaults)
|
||||||
|
|
||||||
|
(add-hook 'scala-mode-hook (lambda ()
|
||||||
|
(run-hooks 'prelude-scala-mode-hook)))
|
||||||
|
(provide 'prelude-scala)
|
||||||
|
|
||||||
|
;;; prelude-scala.el ends here
|
|
@ -0,0 +1,50 @@
|
||||||
|
;;; prelude-scheme.el --- Emacs Prelude: Some defaults for Scheme.
|
||||||
|
;;
|
||||||
|
;; Copyright © 2011-2017 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 basic configuration for Scheme programming.
|
||||||
|
|
||||||
|
;;; 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:
|
||||||
|
(prelude-require-package 'geiser)
|
||||||
|
|
||||||
|
(require 'prelude-lisp)
|
||||||
|
(require 'geiser)
|
||||||
|
|
||||||
|
;; geiser replies on a REPL to provide autodoc and completion
|
||||||
|
(setq geiser-mode-start-repl-p t)
|
||||||
|
|
||||||
|
;; keep the home clean
|
||||||
|
(setq geiser-repl-history-filename
|
||||||
|
(expand-file-name "geiser-history" prelude-savefile-dir))
|
||||||
|
|
||||||
|
(add-hook 'scheme-mode-hook (lambda () (run-hooks 'prelude-lisp-coding-hook)))
|
||||||
|
|
||||||
|
(provide 'prelude-scheme)
|
||||||
|
|
||||||
|
;;; prelude-scheme.el ends here
|
|
@ -0,0 +1,49 @@
|
||||||
|
;;; prelude-scss.el --- Emacs Prelude: scss support
|
||||||
|
;;
|
||||||
|
;; Copyright © 2011-2017 Bozhidar Batsov
|
||||||
|
;;
|
||||||
|
;; Author: Bozhidar Batsov <bozhidar@batsov.com>
|
||||||
|
;; URL: http://www.batsov.com/emacs-prelude
|
||||||
|
;; Version: 1.0.0
|
||||||
|
;; Keywords: convenience
|
||||||
|
|
||||||
|
;; This file is not part of GNU Emacs.
|
||||||
|
|
||||||
|
;;; Commentary:
|
||||||
|
|
||||||
|
;; Some basic configuration for scss-mode.
|
||||||
|
|
||||||
|
;;; 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 'prelude-css)
|
||||||
|
(prelude-require-packages '(scss-mode))
|
||||||
|
|
||||||
|
;; turn off annoying auto-compile on save
|
||||||
|
(setq scss-compile-at-save nil)
|
||||||
|
|
||||||
|
(defun prelude-scss-mode-defaults ()
|
||||||
|
(prelude-css-mode-defaults))
|
||||||
|
|
||||||
|
(setq prelude-scss-mode-hook 'prelude-scss-mode-defaults)
|
||||||
|
|
||||||
|
(add-hook 'scss-mode-hook (lambda () (run-hooks 'prelude-scss-mode-hook)))
|
||||||
|
|
||||||
|
(provide 'prelude-scss)
|
||||||
|
;;; prelude-scss.el ends here
|
|
@ -0,0 +1,51 @@
|
||||||
|
;;; prelude-shell.el --- Emacs Prelude: sh-mode configuration.
|
||||||
|
;;
|
||||||
|
;; Copyright © 2011-2017 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 basic configuration for cc-mode and the modes derived from it.
|
||||||
|
|
||||||
|
;;; 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 'sh-script)
|
||||||
|
|
||||||
|
;; recognize prezto files as zsh scripts
|
||||||
|
(defvar prelude-prezto-files '("zlogin" "zlogin" "zlogout" "zpreztorc" "zprofile" "zshenv" "zshrc"))
|
||||||
|
|
||||||
|
(mapc (lambda (file)
|
||||||
|
(add-to-list 'auto-mode-alist `(,(format "\\%s\\'" file) . sh-mode)))
|
||||||
|
prelude-prezto-files)
|
||||||
|
|
||||||
|
(add-hook 'sh-mode-hook
|
||||||
|
(lambda ()
|
||||||
|
(if (and buffer-file-name
|
||||||
|
(member (file-name-nondirectory buffer-file-name) prelude-prezto-files))
|
||||||
|
(sh-set-shell "zsh"))))
|
||||||
|
|
||||||
|
(provide 'prelude-shell)
|
||||||
|
;;; prelude-shell.el ends here
|
|
@ -0,0 +1,73 @@
|
||||||
|
;;; prelude-web.el --- Emacs Prelude: web template support
|
||||||
|
;;
|
||||||
|
;; Copyright © 2011-2017 Bozhidar Batsov
|
||||||
|
;;
|
||||||
|
;; Author: Bozhidar Batsov <bozhidar@batsov.com>
|
||||||
|
;; URL: http://www.batsov.com/emacs-prelude
|
||||||
|
;; Version: 1.0.0
|
||||||
|
;; Keywords: convenience
|
||||||
|
|
||||||
|
;; This file is not part of GNU Emacs.
|
||||||
|
|
||||||
|
;;; Commentary:
|
||||||
|
|
||||||
|
;; Some basic configuration for web-mode.
|
||||||
|
|
||||||
|
;;; 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:
|
||||||
|
|
||||||
|
(prelude-require-packages '(web-mode))
|
||||||
|
|
||||||
|
(require 'web-mode)
|
||||||
|
|
||||||
|
(add-to-list 'auto-mode-alist '("\\.phtml\\'" . web-mode))
|
||||||
|
(add-to-list 'auto-mode-alist '("\\.tpl\\.php\\'" . web-mode))
|
||||||
|
(add-to-list 'auto-mode-alist '("\\.tpl\\'" . web-mode))
|
||||||
|
(add-to-list 'auto-mode-alist '("\\.blade\\.php\\'" . web-mode))
|
||||||
|
(add-to-list 'auto-mode-alist '("\\.jsp\\'" . web-mode))
|
||||||
|
(add-to-list 'auto-mode-alist '("\\.as[cp]x\\'" . web-mode))
|
||||||
|
(add-to-list 'auto-mode-alist '("\\.erb\\'" . web-mode))
|
||||||
|
(add-to-list 'auto-mode-alist '("\\.html?\\'" . web-mode))
|
||||||
|
(add-to-list 'auto-mode-alist
|
||||||
|
'("/\\(views\\|html\\|theme\\|templates\\)/.*\\.php\\'" . web-mode))
|
||||||
|
|
||||||
|
;; make web-mode play nice with smartparens
|
||||||
|
(setq web-mode-enable-auto-pairing nil)
|
||||||
|
|
||||||
|
(sp-with-modes '(web-mode)
|
||||||
|
(sp-local-pair "%" "%"
|
||||||
|
:unless '(sp-in-string-p)
|
||||||
|
:post-handlers '(((lambda (&rest _ignored)
|
||||||
|
(just-one-space)
|
||||||
|
(save-excursion (insert " ")))
|
||||||
|
"SPC" "=" "#")))
|
||||||
|
(sp-local-tag "%" "<% " " %>")
|
||||||
|
(sp-local-tag "=" "<%= " " %>")
|
||||||
|
(sp-local-tag "#" "<%# " " %>"))
|
||||||
|
|
||||||
|
(eval-after-load 'web-mode
|
||||||
|
'(progn
|
||||||
|
(defun prelude-web-mode-defaults ())
|
||||||
|
(setq prelude-web-mode-hook 'prelude-web-mode-defaults)
|
||||||
|
|
||||||
|
(add-hook 'web-mode-hook (lambda ()
|
||||||
|
(run-hooks 'prelude-web-mode-hook)))))
|
||||||
|
|
||||||
|
(provide 'prelude-web)
|
||||||
|
;;; prelude-web.el ends here
|
|
@ -0,0 +1,50 @@
|
||||||
|
;;; prelude-xml.el --- Emacs Prelude: XML editing configuration.
|
||||||
|
;;
|
||||||
|
;; Copyright © 2011-2017 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 basic nxml-mode configuration.
|
||||||
|
|
||||||
|
;;; 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 'nxml-mode)
|
||||||
|
|
||||||
|
(push '("<\\?xml" . nxml-mode) magic-mode-alist)
|
||||||
|
|
||||||
|
;; pom files should be treated as xml files
|
||||||
|
(add-to-list 'auto-mode-alist '("\\.pom$" . nxml-mode))
|
||||||
|
|
||||||
|
(setq nxml-child-indent 4)
|
||||||
|
(setq nxml-attribute-indent 4)
|
||||||
|
(setq nxml-auto-insert-xml-declaration-flag nil)
|
||||||
|
(setq nxml-bind-meta-tab-to-complete-flag t)
|
||||||
|
(setq nxml-slash-auto-complete-flag t)
|
||||||
|
|
||||||
|
(provide 'prelude-xml)
|
||||||
|
|
||||||
|
;;; prelude-xml.el ends here
|
|
@ -0,0 +1,44 @@
|
||||||
|
;;; prelude-yaml.el --- Emacs Prelude: YAML programming support.
|
||||||
|
;;
|
||||||
|
;; Copyright © 2011-2017 Bozhidar Batsov
|
||||||
|
;;
|
||||||
|
;; Author: ToBeReplaced
|
||||||
|
;; URL: http://batsov.com/prelude
|
||||||
|
;; Version: 1.0.0
|
||||||
|
;; Keywords: convenience yaml
|
||||||
|
|
||||||
|
;; This file is not part of GNU Emacs.
|
||||||
|
|
||||||
|
;;; Commentary:
|
||||||
|
|
||||||
|
;; Prelude configuration for YAML.
|
||||||
|
|
||||||
|
;;; 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:
|
||||||
|
(prelude-require-packages '(yaml-mode))
|
||||||
|
|
||||||
|
;; yaml-mode doesn't derive from prog-mode, but we can at least enable
|
||||||
|
;; whitespace-mode and apply cleanup.
|
||||||
|
(add-hook 'yaml-mode-hook 'whitespace-mode)
|
||||||
|
(add-hook 'yaml-mode-hook 'subword-mode)
|
||||||
|
(add-hook 'yaml-mode-hook
|
||||||
|
(lambda () (add-hook 'before-save-hook 'prelude-cleanup-maybe nil t)))
|
||||||
|
|
||||||
|
(provide 'prelude-yaml)
|
||||||
|
;;; prelude-yaml.el ends here
|
|
@ -0,0 +1,5 @@
|
||||||
|
;; This will make sure that nothing in your personal directory will be
|
||||||
|
;; forced through the emacs-lisp-checkdoc flychecker. That's a great
|
||||||
|
;; checker for real modules, but these are just config files, and you
|
||||||
|
;; deserve not to get warnings all the time
|
||||||
|
((emacs-lisp-mode . ((flycheck-disabled-checkers . (emacs-lisp-checkdoc)))))
|
|
@ -0,0 +1,40 @@
|
||||||
|
;;; Uncomment the modules you'd like to use and restart Prelude afterwards
|
||||||
|
|
||||||
|
;; Emacs IRC client
|
||||||
|
(require 'prelude-erc)
|
||||||
|
;; (require 'prelude-ido) ;; Super charges Emacs completion for C-x C-f and more
|
||||||
|
(require 'prelude-ivy) ;; A mighty modern alternative to ido
|
||||||
|
;; (require 'prelude-helm) ;; Interface for narrowing and search
|
||||||
|
;; (require 'prelude-helm-everywhere) ;; Enable Helm everywhere
|
||||||
|
(require 'prelude-company)
|
||||||
|
;; (require 'prelude-key-chord) ;; Binds useful features to key combinations
|
||||||
|
;; (require 'prelude-mediawiki)
|
||||||
|
;; (require 'prelude-evil)
|
||||||
|
|
||||||
|
;;; Programming languages support
|
||||||
|
(require 'prelude-c)
|
||||||
|
;; (require 'prelude-clojure)
|
||||||
|
;; (require 'prelude-coffee)
|
||||||
|
;; (require 'prelude-common-lisp)
|
||||||
|
;; (require 'prelude-css)
|
||||||
|
(require 'prelude-emacs-lisp)
|
||||||
|
;; (require 'prelude-erlang)
|
||||||
|
;; (require 'prelude-elixir)
|
||||||
|
;; (require 'prelude-go)
|
||||||
|
;; (require 'prelude-haskell)
|
||||||
|
(require 'prelude-js)
|
||||||
|
;; (require 'prelude-latex)
|
||||||
|
(require 'prelude-lisp)
|
||||||
|
;; (require 'prelude-ocaml)
|
||||||
|
(require 'prelude-org) ;; Org-mode helps you keep TODO lists, notes and more
|
||||||
|
(require 'prelude-perl)
|
||||||
|
;; (require 'prelude-python)
|
||||||
|
;; (require 'prelude-ruby)
|
||||||
|
;; (require 'prelude-rust)
|
||||||
|
;; (require 'prelude-scala)
|
||||||
|
(require 'prelude-scheme)
|
||||||
|
(require 'prelude-shell)
|
||||||
|
;; (require 'prelude-scss)
|
||||||
|
;; (require 'prelude-web) ;; Emacs mode for web templates
|
||||||
|
(require 'prelude-xml)
|
||||||
|
;; (require 'prelude-yaml)
|
|
@ -0,0 +1,133 @@
|
||||||
|
(add-to-list 'package-archives
|
||||||
|
'("melpa-stable" . "https://stable.melpa.org/packages/") t)
|
||||||
|
|
||||||
|
(setq package-pinned-packages
|
||||||
|
'(
|
||||||
|
(ace-window . "melpa-stable")
|
||||||
|
(alchemist . "melpa-stable")
|
||||||
|
(anaconda-mode . "melpa-stable")
|
||||||
|
(anzu . "melpa-stable")
|
||||||
|
(async . "melpa-stable")
|
||||||
|
(avy . "melpa-stable")
|
||||||
|
(browse-kill-ring . "melpa-stable")
|
||||||
|
(caml . "melpa-stable")
|
||||||
|
(cask-mode . "melpa-stable")
|
||||||
|
(cdlatex . "melpa-stable")
|
||||||
|
(cider . "melpa-stable")
|
||||||
|
(clojure-mode . "melpa-stable")
|
||||||
|
(cmake-mode . "melpa-stable")
|
||||||
|
(coffee-mode . "melpa-stable")
|
||||||
|
(company . "melpa-stable")
|
||||||
|
(company-anaconda . "melpa-stable")
|
||||||
|
(company-auctex . "melpa-stable")
|
||||||
|
(company-go . "melpa-stable")
|
||||||
|
(crux . "melpa-stable")
|
||||||
|
(cython-mode . "melpa-stable")
|
||||||
|
(d-mode . "melpa-stable")
|
||||||
|
(dart-mode . "melpa-stable")
|
||||||
|
(dash . "melpa-stable")
|
||||||
|
(diff-hl . "melpa-stable")
|
||||||
|
(diminish . "melpa-stable")
|
||||||
|
(discover-my-major . "melpa-stable")
|
||||||
|
(dockerfile-mode . "melpa-stable")
|
||||||
|
(easy-kill . "melpa-stable")
|
||||||
|
(elisp-slime-nav . "melpa-stable")
|
||||||
|
(elixir-mode . "melpa-stable")
|
||||||
|
(elm-mode . "melpa-stable")
|
||||||
|
(ensime . "melpa-stable")
|
||||||
|
(epl . "melpa-stable")
|
||||||
|
(erlang . "melpa-stable")
|
||||||
|
(evil . "melpa-stable")
|
||||||
|
(evil-numbers . "melpa-stable")
|
||||||
|
(evil-surround . "melpa-stable")
|
||||||
|
(evil-visualstar . "melpa-stable")
|
||||||
|
(exec-path-from-shell . "melpa-stable")
|
||||||
|
(expand-region . "melpa-stable")
|
||||||
|
(f . "melpa-stable")
|
||||||
|
(feature-mode . "melpa-stable")
|
||||||
|
(flx . "melpa-stable")
|
||||||
|
(flx-ido . "melpa-stable")
|
||||||
|
(flycheck . "melpa-stable")
|
||||||
|
(flycheck-ocaml . "melpa-stable")
|
||||||
|
(geiser . "melpa-stable")
|
||||||
|
(gh . "melpa-stable")
|
||||||
|
(gist . "melpa-stable")
|
||||||
|
(git-commit . "melpa-stable")
|
||||||
|
(git-timemachine . "melpa-stable")
|
||||||
|
(gitconfig-mode . "melpa-stable")
|
||||||
|
(gitignore-mode . "melpa-stable")
|
||||||
|
(go-eldoc . "melpa-stable")
|
||||||
|
(go-guru . "melpa-stable")
|
||||||
|
(go-mode . "melpa-stable")
|
||||||
|
(go-projectile . "melpa-stable")
|
||||||
|
(go-rename . "melpa-stable")
|
||||||
|
(gotest . "melpa-stable")
|
||||||
|
(goto-chg . "melpa-stable")
|
||||||
|
(grizzl . "melpa-stable")
|
||||||
|
(groovy-mode . "melpa-stable")
|
||||||
|
(guru-mode . "melpa-stable")
|
||||||
|
(haml-mode . "melpa-stable")
|
||||||
|
(haskell-mode . "melpa-stable")
|
||||||
|
(helm . "melpa-stable")
|
||||||
|
(helm-ag . "melpa-stable")
|
||||||
|
(helm-core . "melpa-stable")
|
||||||
|
(helm-descbinds . "melpa-stable")
|
||||||
|
(helm-projectile . "melpa-stable")
|
||||||
|
(imenu-anywhere . "melpa-stable")
|
||||||
|
(inf-ruby . "melpa-stable")
|
||||||
|
(js2-mode . "melpa-stable")
|
||||||
|
(json-mode . "melpa-stable")
|
||||||
|
(json-reformat . "melpa-stable")
|
||||||
|
(json-snatcher . "melpa-stable")
|
||||||
|
(kivy-mode . "melpa-stable")
|
||||||
|
(less-css-mode . "melpa-stable")
|
||||||
|
(logito . "melpa-stable")
|
||||||
|
(lua-mode . "melpa-stable")
|
||||||
|
(macrostep . "melpa-stable")
|
||||||
|
(magit . "melpa-stable")
|
||||||
|
(magit-popup . "melpa-stable")
|
||||||
|
(makey . "melpa-stable")
|
||||||
|
(markdown-mode . "melpa-stable")
|
||||||
|
(marshal . "melpa-stable")
|
||||||
|
(mediawiki . "melpa-stable")
|
||||||
|
(merlin . "melpa-stable")
|
||||||
|
(operate-on-number . "melpa-stable")
|
||||||
|
(ov . "melpa-stable")
|
||||||
|
(pcache . "melpa-stable")
|
||||||
|
(php-mode . "melpa-stable")
|
||||||
|
(pkg-info . "melpa-stable")
|
||||||
|
(pkgbuild-mode . "melpa-stable")
|
||||||
|
(popup . "melpa-stable")
|
||||||
|
(projectile . "melpa-stable")
|
||||||
|
(protobuf-mode . "melpa-stable")
|
||||||
|
(puppet-mode . "melpa-stable")
|
||||||
|
(pythonic . "melpa-stable")
|
||||||
|
(queue . "gnu")
|
||||||
|
(rich-minority . "melpa-stable")
|
||||||
|
(ruby-tools . "melpa-stable")
|
||||||
|
(s . "melpa-stable")
|
||||||
|
(sass-mode . "melpa-stable")
|
||||||
|
(sbt-mode . "melpa-stable")
|
||||||
|
(scala-mode . "melpa-stable")
|
||||||
|
(scss-mode . "melpa-stable")
|
||||||
|
(slim-mode . "melpa-stable")
|
||||||
|
(slime . "melpa-stable")
|
||||||
|
(smart-mode-line . "melpa-stable")
|
||||||
|
(smartparens . "melpa-stable")
|
||||||
|
(smartrep . "melpa-stable")
|
||||||
|
(smex . "melpa-stable")
|
||||||
|
(spinner . "gnu")
|
||||||
|
(stylus-mode . "melpa-stable")
|
||||||
|
(swift-mode . "melpa-stable")
|
||||||
|
(thrift . "melpa-stable")
|
||||||
|
(tuareg . "melpa-stable")
|
||||||
|
(utop . "melpa-stable")
|
||||||
|
(volatile-highlights . "melpa-stable")
|
||||||
|
(web-mode . "melpa-stable")
|
||||||
|
(which-key . "melpa-stable")
|
||||||
|
(with-editor . "melpa-stable")
|
||||||
|
(yaml-mode . "melpa-stable")
|
||||||
|
(yasnippet . "melpa-stable")
|
||||||
|
(zenburn-theme . "melpa-stable")
|
||||||
|
(zop-to-char . "melpa-stable")
|
||||||
|
))
|
|
@ -1 +0,0 @@
|
||||||
cc-mode
|
|
|
@ -1,12 +0,0 @@
|
||||||
(require 'yasnippet)
|
|
||||||
|
|
||||||
(defun yas-c++-class-name (str)
|
|
||||||
"Search for a class name like `DerivedClass' in STR
|
|
||||||
(which may look like `DerivedClass : ParentClass1, ParentClass2, ...')
|
|
||||||
|
|
||||||
If found, the class name is returned, otherwise STR is returned"
|
|
||||||
(yas-substr str "[^: ]*"))
|
|
||||||
|
|
||||||
(defun yas-c++-class-method-declare-choice ()
|
|
||||||
"Choose and return the end of a C++11 class method declaration"
|
|
||||||
(yas-choose-value '(";" " = default;" " = delete;")))
|
|
Binary file not shown.
|
@ -1,8 +0,0 @@
|
||||||
# -*- mode: snippet -*-
|
|
||||||
# name: accumulate
|
|
||||||
# key: acl
|
|
||||||
# --
|
|
||||||
auto sum = std::accumulate(std::begin(${1:container}), std::end($1), 0, [](int total, $2) {
|
|
||||||
$3
|
|
||||||
});
|
|
||||||
$0
|
|
|
@ -1,6 +0,0 @@
|
||||||
# -*- mode: snippet -*-
|
|
||||||
# name: accumulate
|
|
||||||
# key: acm
|
|
||||||
# --
|
|
||||||
auto sum = std::accumulate(std::begin(${1:container}), std::end($1), 0);
|
|
||||||
$0
|
|
|
@ -1,9 +0,0 @@
|
||||||
# -*- mode: snippet -*-
|
|
||||||
# name: adjacent_find
|
|
||||||
# key: ajf
|
|
||||||
# --
|
|
||||||
auto pos = std::adjacent_find(std::begin(${1:container}), std::end($1));
|
|
||||||
if (pos != std::end($1)) {
|
|
||||||
$2
|
|
||||||
}
|
|
||||||
$0
|
|
|
@ -1,10 +0,0 @@
|
||||||
# -*- mode: snippet -*-
|
|
||||||
# name: all_of
|
|
||||||
# key: alo
|
|
||||||
# --
|
|
||||||
if (std::all_of(std::begin(${1:container}), std::end($1), []($2) {
|
|
||||||
$3
|
|
||||||
})) {
|
|
||||||
$4
|
|
||||||
}
|
|
||||||
$0
|
|
|
@ -1,10 +0,0 @@
|
||||||
# -*- mode: snippet -*-
|
|
||||||
# name: any_of
|
|
||||||
# key: ano
|
|
||||||
# --
|
|
||||||
if (std::any_of(std::begin(${1:container}), std::end($1), []($2) {
|
|
||||||
$3
|
|
||||||
})) {
|
|
||||||
$4
|
|
||||||
}
|
|
||||||
$0
|
|
|
@ -1,5 +0,0 @@
|
||||||
# -*- mode: snippet -*-
|
|
||||||
# name: assert
|
|
||||||
# key: ass
|
|
||||||
# --
|
|
||||||
assert($0);
|
|
|
@ -1,5 +0,0 @@
|
||||||
# -*- mode: snippet -*-
|
|
||||||
# name : v.begin(), v.end()
|
|
||||||
# key: beginend
|
|
||||||
# --
|
|
||||||
${1:v}.begin(), $1.end
|
|
|
@ -1,7 +0,0 @@
|
||||||
# -*- mode: snippet -*-
|
|
||||||
# name: boost_require
|
|
||||||
# key: req
|
|
||||||
# group: boost
|
|
||||||
# --
|
|
||||||
BOOST_REQUIRE( ${1:condition} );
|
|
||||||
$0
|
|
|
@ -1,5 +0,0 @@
|
||||||
# -*- mode: snippet -*-
|
|
||||||
# name: cerr
|
|
||||||
# key: err
|
|
||||||
# --
|
|
||||||
cerr << $0;
|
|
|
@ -1,5 +0,0 @@
|
||||||
# -*- mode: snippet -*-
|
|
||||||
# name: cin
|
|
||||||
# key: cin
|
|
||||||
# --
|
|
||||||
cin >> $0;
|
|
|
@ -1,11 +0,0 @@
|
||||||
# -*- mode: snippet -*-
|
|
||||||
# name: class
|
|
||||||
# key: cls
|
|
||||||
# --
|
|
||||||
class ${1:Name}
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
${1:$(yas/substr yas-text "[^: ]*")}();
|
|
||||||
${2:virtual ~${1:$(yas/substr yas-text "[^: ]*")}();}
|
|
||||||
};
|
|
||||||
$0
|
|
|
@ -1,44 +0,0 @@
|
||||||
# -*- mode: snippet -*-
|
|
||||||
# name: class11
|
|
||||||
# key: cls11
|
|
||||||
# group: c++11
|
|
||||||
# uuid: d7c41f87-9b8a-479d-bb12-89f4cbdd46a7
|
|
||||||
# contributor: Ved Vyas
|
|
||||||
# desc: Snippet for C++11 classes based on c++-mode/class. Allows for Rule of
|
|
||||||
# [0, All]. A choice between ";", " = default;", and " = delete;" is presented
|
|
||||||
# for each method. The methods and some of the optional keywords/specifiers are
|
|
||||||
# exposed as fields that users can easily skip-and-clear.
|
|
||||||
# Hackish query-replace-regexp to renumber non-mirror fields in the region
|
|
||||||
# between public and protected (can use N as a field number in the snippet):
|
|
||||||
# \${[0-9N]*:\([^\$]\) -> ${\,(+ 2 \#):\1
|
|
||||||
# References:
|
|
||||||
# 1. http://en.cppreference.com/w/cpp/language/rule_of_three#Rule_of_five
|
|
||||||
# 2. https://en.wikipedia.org/wiki/Rule_of_three_%28C%2B%2B_programming%29#Example_in_C.2B.2B
|
|
||||||
# 3. http://stackoverflow.com/a/4782927
|
|
||||||
# --
|
|
||||||
class ${1:Name}
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
${2: ${3://! Default constructor
|
|
||||||
}${1:$(yas-c++-class-name yas-text)}()${4:;$(yas-c++-class-method-declare-choice)}
|
|
||||||
|
|
||||||
}${5: ${6://! Copy constructor
|
|
||||||
}${1:$(yas-c++-class-name yas-text)}(const ${1:$(yas-c++-class-name yas-text)} &other)${7:;$(yas-c++-class-method-declare-choice)}
|
|
||||||
|
|
||||||
}${8: ${9://! Move constructor
|
|
||||||
}${1:$(yas-c++-class-name yas-text)}(${1:$(yas-c++-class-name yas-text)} &&other)${10: noexcept}${11:;$(yas-c++-class-method-declare-choice)}
|
|
||||||
|
|
||||||
}${12: ${13://! Destructor
|
|
||||||
}${14:virtual }~${1:$(yas-c++-class-name yas-text)}()${15: noexcept}${16:;$(yas-c++-class-method-declare-choice)}
|
|
||||||
|
|
||||||
}${17: ${18://! Copy assignment operator
|
|
||||||
}${1:$(yas-c++-class-name yas-text)}& operator=(const ${1:$(yas-c++-class-name yas-text)} &other)${19:;$(yas-c++-class-method-declare-choice)}
|
|
||||||
|
|
||||||
}${20: ${21://! Move assignment operator
|
|
||||||
}${1:$(yas-c++-class-name yas-text)}& operator=(${1:$(yas-c++-class-name yas-text)} &&other)${22: noexcept}${23:;$(yas-c++-class-method-declare-choice)}
|
|
||||||
|
|
||||||
}$0
|
|
||||||
|
|
||||||
protected:
|
|
||||||
private:
|
|
||||||
};
|
|
|
@ -1,8 +0,0 @@
|
||||||
# -*- mode: snippet -*-
|
|
||||||
# name: count_if
|
|
||||||
# key: cni
|
|
||||||
# --
|
|
||||||
auto n = std::count_if(std::begin(${1:container}), std::end($1), []($2) {
|
|
||||||
$3
|
|
||||||
});
|
|
||||||
$0
|
|
|
@ -1,6 +0,0 @@
|
||||||
# -*- mode: snippet -*-
|
|
||||||
# name: count
|
|
||||||
# key: cnt
|
|
||||||
# --
|
|
||||||
auto n = std::count(std::begin(${1:container}), std::end($1), $2);
|
|
||||||
$0
|
|
|
@ -1,8 +0,0 @@
|
||||||
# -*- mode: snippet -*-
|
|
||||||
# name: const_[]
|
|
||||||
# key: c[
|
|
||||||
# --
|
|
||||||
const ${1:Type}& operator[](${2:int index}) const
|
|
||||||
{
|
|
||||||
$0
|
|
||||||
}
|
|
|
@ -1,8 +0,0 @@
|
||||||
# -*- mode: snippet -*-
|
|
||||||
# name: constructor
|
|
||||||
# key: ct
|
|
||||||
# --
|
|
||||||
${1:Class}::$1(${2:args}) ${3: : ${4:init}}
|
|
||||||
{
|
|
||||||
$0
|
|
||||||
}
|
|
|
@ -1,8 +0,0 @@
|
||||||
# -*- mode: snippet -*-
|
|
||||||
# contributor: York Zhao <gtdplatform@gmail.com>
|
|
||||||
# name: cout
|
|
||||||
# key: cout
|
|
||||||
# --
|
|
||||||
`(progn (goto-char (point-min)) (unless (re-search-forward
|
|
||||||
"^using\\s-+namespace std;" nil 'no-errer) "std::"))
|
|
||||||
`cout << $0${1: << "${2:\n}"};
|
|
|
@ -1,6 +0,0 @@
|
||||||
# -*- mode: snippet -*-
|
|
||||||
# name: copy_backward
|
|
||||||
# key: cpb
|
|
||||||
# --
|
|
||||||
std::copy_backward(std::begin(${1:container}), std::end($1), std::end($1));
|
|
||||||
$0
|
|
|
@ -1,9 +0,0 @@
|
||||||
# -*- mode: snippet -*-
|
|
||||||
# name: copy_if
|
|
||||||
# key: cpi
|
|
||||||
# --
|
|
||||||
std::copy_if(std::begin(${1:container}), std::end($1), std::begin($2),
|
|
||||||
[]($3) {
|
|
||||||
$4
|
|
||||||
});
|
|
||||||
$0
|
|
|
@ -1,6 +0,0 @@
|
||||||
# -*- mode: snippet -*-
|
|
||||||
# name: copy_n
|
|
||||||
# key: cpn
|
|
||||||
# --
|
|
||||||
std::copy_n(std::begin(${1:container}), $2, std::end($1));
|
|
||||||
$0
|
|
|
@ -1,5 +0,0 @@
|
||||||
# -*- mode: snippet -*-
|
|
||||||
# name: cpp
|
|
||||||
# key: cpp
|
|
||||||
# --
|
|
||||||
#include "`(file-name-nondirectory (file-name-sans-extension (buffer-file-name)))`.h"
|
|
|
@ -1,6 +0,0 @@
|
||||||
# -*- mode: snippet -*-
|
|
||||||
# name: copy
|
|
||||||
# key: cpy
|
|
||||||
# --
|
|
||||||
std::copy(std::begin(${1:container}), std::end($1), std::begin($2));
|
|
||||||
$0
|
|
|
@ -1,5 +0,0 @@
|
||||||
# -*- mode: snippet -*-
|
|
||||||
# name: cstd
|
|
||||||
# key: cstd
|
|
||||||
# --
|
|
||||||
#include <cstdlib>
|
|
|
@ -1,5 +0,0 @@
|
||||||
# -*- mode: snippet -*-
|
|
||||||
# name: d+=
|
|
||||||
# key: d+=
|
|
||||||
# --
|
|
||||||
${1:MyClass}& operator+=(${2:const $1 &});
|
|
|
@ -1,5 +0,0 @@
|
||||||
# -*- mode: snippet -*-
|
|
||||||
# name: d_operator<<
|
|
||||||
# key: <<
|
|
||||||
# --
|
|
||||||
friend std::ostream& operator<<(std::ostream&, const ${1:Class}&);
|
|
|
@ -1,5 +0,0 @@
|
||||||
# -*- mode: snippet -*-
|
|
||||||
# name: d_operator[]
|
|
||||||
# key: [
|
|
||||||
# --
|
|
||||||
${1:Type}& operator[](${2:int index});
|
|
|
@ -1,5 +0,0 @@
|
||||||
# -*- mode: snippet -*-
|
|
||||||
# name: d_operator[]_const
|
|
||||||
# key: c[
|
|
||||||
# --
|
|
||||||
const ${1:Type}& operator[](${2:int index}) const;
|
|
|
@ -1,5 +0,0 @@
|
||||||
# -*- mode: snippet -*-
|
|
||||||
# name: d_operator>>
|
|
||||||
# key: >>
|
|
||||||
# --
|
|
||||||
friend std::istream& operator>>(std::istream&, const ${1:Class}&);
|
|
|
@ -1,5 +0,0 @@
|
||||||
# -*- mode: snippet -*-
|
|
||||||
# name: d_operator<<
|
|
||||||
# key: <<
|
|
||||||
# --
|
|
||||||
friend std::ostream& operator<<(std::ostream&, const ${1:Class}&);
|
|
|
@ -1,5 +0,0 @@
|
||||||
# -*- mode: snippet -*-
|
|
||||||
# name: delete
|
|
||||||
# key: dl
|
|
||||||
# --
|
|
||||||
delete ${1:pointer};
|
|
|
@ -1,5 +0,0 @@
|
||||||
# -*- mode: snippet -*-
|
|
||||||
# name: delete[]
|
|
||||||
# key: dla
|
|
||||||
# --
|
|
||||||
delete[] ${1:arr};
|
|
|
@ -1,7 +0,0 @@
|
||||||
# -*- mode: snippet -*-
|
|
||||||
# name: doc
|
|
||||||
# key: doc
|
|
||||||
# --
|
|
||||||
/**
|
|
||||||
* $0
|
|
||||||
*/
|
|
|
@ -1,5 +0,0 @@
|
||||||
# -*- mode: snippet -*-
|
|
||||||
# name: dynamic_casting
|
|
||||||
# key: cast
|
|
||||||
# --
|
|
||||||
check_and_cast<${1:Type} *>(${2:msg});
|
|
|
@ -1,7 +0,0 @@
|
||||||
# -*- mode: snippet -*-
|
|
||||||
# name: enum
|
|
||||||
# key: enum
|
|
||||||
# --
|
|
||||||
enum ${1:NAME}{
|
|
||||||
$0
|
|
||||||
};
|
|
|
@ -1,8 +0,0 @@
|
||||||
# -*- mode: snippet -*-
|
|
||||||
# name: equal
|
|
||||||
# key: eql
|
|
||||||
# --
|
|
||||||
if (std::equal(std::begin(${1:container}), std::end($1), std::begin($2))) {
|
|
||||||
$3
|
|
||||||
}
|
|
||||||
$0
|
|
|
@ -1,6 +0,0 @@
|
||||||
# -*- mode: snippet -*-
|
|
||||||
# name: remove
|
|
||||||
# key: erm
|
|
||||||
# --
|
|
||||||
${1:container}.erase(std::remove(std::begin($1), std::end($1), $2), std::end($1));
|
|
||||||
$0
|
|
|
@ -1,10 +0,0 @@
|
||||||
# -*- mode: snippet -*-
|
|
||||||
# name: find_first_of
|
|
||||||
# key: ffo
|
|
||||||
# --
|
|
||||||
auto pos = std::find_first_of(std::begin(${1:container}), std::end($1),
|
|
||||||
std::begin($2), std::end($3));
|
|
||||||
if (pos != std::end($1)) {
|
|
||||||
$4
|
|
||||||
}
|
|
||||||
$0
|
|
|
@ -1,6 +0,0 @@
|
||||||
# -*- mode: snippet -*-
|
|
||||||
# name: fill
|
|
||||||
# key: fil
|
|
||||||
# --
|
|
||||||
std::fill(std::begin(${1:container}), std::end($1), $2);
|
|
||||||
$0
|
|
|
@ -1,11 +0,0 @@
|
||||||
# -*- mode: snippet -*-
|
|
||||||
# name: find_if_not
|
|
||||||
# key: fin
|
|
||||||
# --
|
|
||||||
auto pos = std::find_if_not(std::begin(${1:container}), std::end($1),[]($2) {
|
|
||||||
$3
|
|
||||||
});
|
|
||||||
if (pos != std::end($1)) {
|
|
||||||
$4
|
|
||||||
}
|
|
||||||
$0
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue