├── personal
├── .gitkeep
└── preload
│ └── .gitkeep
├── themes
└── .gitkeep
├── vendor
└── .gitkeep
├── .projectile
├── .gitignore
├── modules
├── doc
│ ├── README.md
│ └── prelude-python.md
├── prelude-yaml.el
├── prelude-scala.el
├── prelude-company.el
├── prelude-scss.el
├── prelude-xml.el
├── prelude-css.el
├── prelude-mediawiki.el
├── prelude-scheme.el
├── prelude-haskell.el
├── prelude-shell.el
├── prelude-erlang.el
├── prelude-js.el
├── prelude-c.el
├── prelude-org.el
├── prelude-coffee.el
├── prelude-ido.el
├── prelude-clojure.el
├── prelude-lisp.el
├── prelude-key-chord.el
├── prelude-perl.el
├── prelude-helm.el
├── prelude-helm-everywhere.el
├── prelude-web.el
├── prelude-common-lisp.el
├── prelude-latex.el
├── prelude-ruby.el
├── prelude-go.el
├── prelude-programming.el
├── prelude-ocaml.el
├── prelude-emacs-lisp.el
├── prelude-python.el
├── prelude-erc.el
└── prelude-evil.el
├── sample
└── prelude-modules.el
├── CONTRIBUTING.md
├── core
├── prelude-osx.el
├── prelude-ui.el
├── prelude-custom.el
├── prelude-global-keybindings.el
├── prelude-mode.el
├── prelude-packages.el
├── prelude-editor.el
└── prelude-core.el
├── abbrev_defs
├── init.el
├── utils
└── installer.sh
└── README.md
/personal/.gitkeep:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/themes/.gitkeep:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/vendor/.gitkeep:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/personal/preload/.gitkeep:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/.projectile:
--------------------------------------------------------------------------------
1 | /elpa
2 | /savefile
3 | /.cask
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | *~
2 | *.elc
3 | auto-save-list
4 | recentf
5 | savehist
6 | saveplace
7 | eshell
8 | elpa
9 | el-get
10 | semanticdb
11 | url
12 | ede-projects.el
13 | .DS_Store
14 | custom.el
15 | places
16 | .smex-items
17 | savefile/
18 | /prelude-modules.el
19 | projectile-bookmarks.eld
20 | session*
21 | .cask
22 | tramp
23 | /var/pcache
24 |
--------------------------------------------------------------------------------
/modules/doc/README.md:
--------------------------------------------------------------------------------
1 | # Emacs Prelude Modules
2 |
3 | Prelude provides extra functionality through modules. Some modules may
4 | require extra steps to enable all functionality. These steps and the
5 | functionality provided by these modules are documented on the
6 | following links.
7 |
8 | - C
9 | - Clojure
10 | - Coffee
11 | - Common-Lisp
12 | - CSS
13 | - Emacs-Lisp
14 | - ERC
15 | - Erlang
16 | - Haskell
17 | - JS
18 | - Latex
19 | - Lisp
20 | - Markdown
21 | - MediaWiki
22 | - Org
23 | - Perl
24 | - [Python](prelude-python.md)
25 | - Ruby
26 | - Scala
27 | - Scheme
28 | - Scss
29 | - Web
30 |
--------------------------------------------------------------------------------
/modules/doc/prelude-python.md:
--------------------------------------------------------------------------------
1 | # Prelude Python Quickstart
2 |
3 | ## Python Mode
4 |
5 | Emacs comes with Python programming support through the built-in
6 | Python-mode. Whenever you are editing Python code run `C-h m` to
7 | look at the Python mode key bindings. Alternatively look at the
8 | menu bar entries under Python. To toggle the menu bar press `F12`.
9 |
10 | ## Syntax checking
11 |
12 | Prelude ships with [Flycheck](https://github.com/flycheck/flycheck),
13 | an on the fly syntax checker. Flycheck has support for two Python
14 | syntax checkers, [Pylint](http://www.pylint.org/) and
15 | [Flake8](http://flake8.readthedocs.org/en/latest/). In
16 | order to have Flycheck support on the fly syntax checking for
17 | Python you need to have either of these installed and accessible to
18 | Emacs. In order to manually choose a checker run `C-c ! s`.
19 |
--------------------------------------------------------------------------------
/sample/prelude-modules.el:
--------------------------------------------------------------------------------
1 | ;;; Uncomment the modules you'd like to use and restart Prelude afterwards
2 |
3 | ;; Emacs IRC client
4 | (require 'prelude-erc)
5 | (require 'prelude-ido) ;; Super charges Emacs completion for C-x C-f and more
6 | ;; (require 'prelude-helm) ;; Interface for narrowing and search
7 | ;; (require 'prelude-helm-everywhere) ;; Enable Helm everywhere
8 | (require 'prelude-company)
9 | ;; (require 'prelude-key-chord) ;; Binds useful features to key combinations
10 | ;; (require 'prelude-mediawiki)
11 | ;; (require 'prelude-evil)
12 |
13 | ;;; Programming languages support
14 | (require 'prelude-c)
15 | ;; (require 'prelude-clojure)
16 | ;; (require 'prelude-coffee)
17 | ;; (require 'prelude-common-lisp)
18 | ;; (require 'prelude-css)
19 | (require 'prelude-emacs-lisp)
20 | ;; (require 'prelude-erlang)
21 | ;; (require 'prelude-go)
22 | ;; (require 'prelude-haskell)
23 | (require 'prelude-js)
24 | ;; (require 'prelude-latex)
25 | (require 'prelude-lisp)
26 | ;; (require 'prelude-ocaml)
27 | (require 'prelude-org) ;; Org-mode helps you keep TODO lists, notes and more
28 | (require 'prelude-perl)
29 | ;; (require 'prelude-python)
30 | ;; (require 'prelude-ruby)
31 | ;; (require 'prelude-scala)
32 | (require 'prelude-scheme)
33 | (require 'prelude-shell)
34 | ;; (require 'prelude-scss)
35 | ;; (require 'prelude-web) ;; Emacs mode for web templates
36 | (require 'prelude-xml)
37 | ;; (require 'prelude-yaml)
38 |
--------------------------------------------------------------------------------
/CONTRIBUTING.md:
--------------------------------------------------------------------------------
1 | # Contributing
2 |
3 | If you discover issues, have ideas for improvements or new features, or
4 | want to contribute a new module, please report them to the
5 | [issue tracker][1] of the repository or submit a pull request. Please,
6 | try to follow these guidelines when you do so.
7 |
8 | ## Issue reporting
9 |
10 | * Check that the issue has not already been reported.
11 | * Check that the issue has not already been fixed in the latest code
12 | (a.k.a. `master`).
13 | * Be clear, concise and precise in your description of the problem.
14 | * Open an issue with a descriptive title and a summary in grammatically correct,
15 | complete sentences.
16 | * Include any relevant code to the issue summary.
17 |
18 | ## Pull requests
19 |
20 | * Read [how to properly contribute to open source projects on Github][2].
21 | * Use a topic branch to easily amend a pull request later, if necessary.
22 | * Write [good commit messages][3].
23 | * Use the same coding conventions as the rest of the project.
24 | * Verify your Emacs Lisp code with `checkdoc` (C-c ? d).
25 | * Open a [pull request][4] that relates to *only* one subject with a clear title
26 | and description in grammatically correct, complete sentences.
27 |
28 | [1]: https://github.com/bbatsov/prelude/issues
29 | [2]: http://gun.io/blog/how-to-github-fork-branch-and-pull-request
30 | [3]: http://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html
31 | [4]: https://help.github.com/articles/using-pull-requests
32 |
--------------------------------------------------------------------------------
/modules/prelude-yaml.el:
--------------------------------------------------------------------------------
1 | ;;; prelude-yaml.el --- Emacs Prelude: YAML programming support.
2 | ;;
3 | ;; Copyright © 2011-2014 Bozhidar Batsov
4 | ;;
5 | ;; Author: ToBeReplaced
6 | ;; URL: http://batsov.com/prelude
7 | ;; Version: 1.0.0
8 | ;; Keywords: convenience yaml
9 |
10 | ;; This file is not part of GNU Emacs.
11 |
12 | ;;; Commentary:
13 |
14 | ;; Prelude configuration for YAML.
15 |
16 | ;;; License:
17 |
18 | ;; This program is free software; you can redistribute it and/or
19 | ;; modify it under the terms of the GNU General Public License
20 | ;; as published by the Free Software Foundation; either version 3
21 | ;; of the License, or (at your option) any later version.
22 | ;;
23 | ;; This program is distributed in the hope that it will be useful,
24 | ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
25 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
26 | ;; GNU General Public License for more details.
27 | ;;
28 | ;; You should have received a copy of the GNU General Public License
29 | ;; along with GNU Emacs; see the file COPYING. If not, write to the
30 | ;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
31 | ;; Boston, MA 02110-1301, USA.
32 |
33 | ;;; Code:
34 | (prelude-require-packages '(yaml-mode))
35 |
36 | ;; yaml-mode doesn't derive from prog-mode, but we can at least enable
37 | ;; whitespace-mode and apply cleanup.
38 | (add-hook 'yaml-mode-hook 'whitespace-mode)
39 | (add-hook 'yaml-mode-hook 'subword-mode)
40 | (add-hook 'yaml-mode-hook
41 | (lambda () (add-hook 'before-save-hook 'prelude-cleanup-maybe nil t)))
42 |
43 | (provide 'prelude-yaml)
44 | ;;; prelude-yaml.el ends here
45 |
--------------------------------------------------------------------------------
/modules/prelude-scala.el:
--------------------------------------------------------------------------------
1 | ;;; prelude-scala.el --- Emacs Prelude: scala-mode configuration.
2 | ;;
3 | ;; Copyright © 2011-2014 Bozhidar Batsov
4 | ;;
5 | ;; Author: Bozhidar Batsov
6 | ;; URL: https://github.com/bbatsov/prelude
7 | ;; Version: 1.0.0
8 | ;; Keywords: convenience
9 |
10 | ;; This file is not part of GNU Emacs.
11 |
12 | ;;; Commentary:
13 |
14 | ;; Some basic support for the Scala programming language
15 |
16 | ;;; License:
17 |
18 | ;; This program is free software; you can redistribute it and/or
19 | ;; modify it under the terms of the GNU General Public License
20 | ;; as published by the Free Software Foundation; either version 3
21 | ;; of the License, or (at your option) any later version.
22 | ;;
23 | ;; This program is distributed in the hope that it will be useful,
24 | ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
25 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
26 | ;; GNU General Public License for more details.
27 | ;;
28 | ;; You should have received a copy of the GNU General Public License
29 | ;; along with GNU Emacs; see the file COPYING. If not, write to the
30 | ;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
31 | ;; Boston, MA 02110-1301, USA.
32 |
33 | ;;; Code:
34 |
35 | (require 'prelude-programming)
36 | (prelude-require-packages '(scala-mode2))
37 |
38 | (defun prelude-scala-mode-defaults ()
39 | (subword-mode +1))
40 |
41 | (setq prelude-scala-mode-hook 'prelude-scala-mode-defaults)
42 |
43 | (add-hook 'scala-mode-hook (lambda ()
44 | (run-hooks 'prelude-scala-mode-hook)))
45 | (provide 'prelude-scala)
46 |
47 | ;;; prelude-scala.el ends here
48 |
--------------------------------------------------------------------------------
/modules/prelude-company.el:
--------------------------------------------------------------------------------
1 | ;;; prelude-company.el --- company-mode setup
2 | ;;
3 | ;; Copyright © 2011-2014 Bozhidar Batsov
4 | ;;
5 | ;; Author: Bozhidar Batsov
6 | ;; URL: https://github.com/bbatsov/prelude
7 | ;; Version: 1.0.0
8 | ;; Keywords: convenience
9 |
10 | ;; This file is not part of GNU Emacs.
11 |
12 | ;;; Commentary:
13 |
14 | ;; company-mode config.
15 |
16 | ;;; License:
17 |
18 | ;; This program is free software; you can redistribute it and/or
19 | ;; modify it under the terms of the GNU General Public License
20 | ;; as published by the Free Software Foundation; either version 3
21 | ;; of the License, or (at your option) any later version.
22 | ;;
23 | ;; This program is distributed in the hope that it will be useful,
24 | ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
25 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
26 | ;; GNU General Public License for more details.
27 | ;;
28 | ;; You should have received a copy of the GNU General Public License
29 | ;; along with GNU Emacs; see the file COPYING. If not, write to the
30 | ;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
31 | ;; Boston, MA 02110-1301, USA.
32 |
33 | ;;; Code:
34 | (prelude-require-packages '(company))
35 |
36 | (require 'company)
37 |
38 | (setq company-idle-delay 0.5)
39 | (setq company-tooltip-limit 10)
40 | (setq company-minimum-prefix-length 2)
41 | ;; invert the navigation direction if the the completion popup-isearch-match
42 | ;; is displayed on top (happens near the bottom of windows)
43 | (setq company-tooltip-flip-when-above t)
44 |
45 | (global-company-mode 1)
46 |
47 | (provide 'prelude-company)
48 | ;;; prelude-company.el ends here
49 |
--------------------------------------------------------------------------------
/modules/prelude-scss.el:
--------------------------------------------------------------------------------
1 | ;;; prelude-scss.el --- Emacs Prelude: scss support
2 | ;;
3 | ;; Copyright © 2011-2014 Bozhidar Batsov
4 | ;;
5 | ;; Author: Bozhidar Batsov
6 | ;; URL: http://www.batsov.com/emacs-prelude
7 | ;; Version: 1.0.0
8 | ;; Keywords: convenience
9 |
10 | ;; This file is not part of GNU Emacs.
11 |
12 | ;;; Commentary:
13 |
14 | ;; Some basic configuration for scss-mode.
15 |
16 | ;;; License:
17 |
18 | ;; This program is free software; you can redistribute it and/or
19 | ;; modify it under the terms of the GNU General Public License
20 | ;; as published by the Free Software Foundation; either version 3
21 | ;; of the License, or (at your option) any later version.
22 | ;;
23 | ;; This program is distributed in the hope that it will be useful,
24 | ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
25 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
26 | ;; GNU General Public License for more details.
27 | ;;
28 | ;; You should have received a copy of the GNU General Public License
29 | ;; along with GNU Emacs; see the file COPYING. If not, write to the
30 | ;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
31 | ;; Boston, MA 02110-1301, USA.
32 |
33 | ;;; Code:
34 |
35 | (require 'prelude-css)
36 | (prelude-require-packages '(scss-mode))
37 |
38 | ;; turn off annoying auto-compile on save
39 | (setq scss-compile-at-save nil)
40 |
41 | (defun prelude-scss-mode-defaults ()
42 | (prelude-css-mode-defaults))
43 |
44 | (setq prelude-scss-mode-hook 'prelude-scss-mode-defaults)
45 |
46 | (add-hook 'scss-mode-hook (lambda () (run-hooks 'prelude-scss-mode-hook)))
47 |
48 | (provide 'prelude-scss)
49 | ;;; prelude-scss.el ends here
50 |
--------------------------------------------------------------------------------
/modules/prelude-xml.el:
--------------------------------------------------------------------------------
1 | ;;; prelude-xml.el --- Emacs Prelude: XML editing configuration.
2 | ;;
3 | ;; Copyright © 2011-2014 Bozhidar Batsov
4 | ;;
5 | ;; Author: Bozhidar Batsov
6 | ;; URL: https://github.com/bbatsov/prelude
7 | ;; Version: 1.0.0
8 | ;; Keywords: convenience
9 |
10 | ;; This file is not part of GNU Emacs.
11 |
12 | ;;; Commentary:
13 |
14 | ;; Some basic nxml-mode configuration.
15 |
16 | ;;; License:
17 |
18 | ;; This program is free software; you can redistribute it and/or
19 | ;; modify it under the terms of the GNU General Public License
20 | ;; as published by the Free Software Foundation; either version 3
21 | ;; of the License, or (at your option) any later version.
22 | ;;
23 | ;; This program is distributed in the hope that it will be useful,
24 | ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
25 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
26 | ;; GNU General Public License for more details.
27 | ;;
28 | ;; You should have received a copy of the GNU General Public License
29 | ;; along with GNU Emacs; see the file COPYING. If not, write to the
30 | ;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
31 | ;; Boston, MA 02110-1301, USA.
32 |
33 | ;;; Code:
34 |
35 | (require 'nxml-mode)
36 |
37 | (push '("<\\?xml" . nxml-mode) magic-mode-alist)
38 |
39 | ;; pom files should be treated as xml files
40 | (add-to-list 'auto-mode-alist '("\\.pom$" . nxml-mode))
41 |
42 | (setq nxml-child-indent 4)
43 | (setq nxml-attribute-indent 4)
44 | (setq nxml-auto-insert-xml-declaration-flag nil)
45 | (setq nxml-bind-meta-tab-to-complete-flag t)
46 | (setq nxml-slash-auto-complete-flag t)
47 |
48 | (provide 'prelude-xml)
49 |
50 | ;;; prelude-xml.el ends here
51 |
--------------------------------------------------------------------------------
/modules/prelude-css.el:
--------------------------------------------------------------------------------
1 | ;;; prelude-css.el --- Emacs Prelude: css support
2 | ;;
3 | ;; Copyright © 2011-2014 Bozhidar Batsov
4 | ;;
5 | ;; Author: Bozhidar Batsov
6 | ;; URL: http://www.batsov.com/emacs-prelude
7 | ;; Version: 1.0.0
8 | ;; Keywords: convenience
9 |
10 | ;; This file is not part of GNU Emacs.
11 |
12 | ;;; Commentary:
13 |
14 | ;; Some basic configuration for css-mode.
15 |
16 | ;;; License:
17 |
18 | ;; This program is free software; you can redistribute it and/or
19 | ;; modify it under the terms of the GNU General Public License
20 | ;; as published by the Free Software Foundation; either version 3
21 | ;; of the License, or (at your option) any later version.
22 | ;;
23 | ;; This program is distributed in the hope that it will be useful,
24 | ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
25 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
26 | ;; GNU General Public License for more details.
27 | ;;
28 | ;; You should have received a copy of the GNU General Public License
29 | ;; along with GNU Emacs; see the file COPYING. If not, write to the
30 | ;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
31 | ;; Boston, MA 02110-1301, USA.
32 |
33 | ;;; Code:
34 |
35 | (eval-after-load 'css-mode
36 | '(progn
37 | (prelude-require-packages '(rainbow-mode))
38 |
39 | (setq css-indent-offset 2)
40 |
41 | (defun prelude-css-mode-defaults ()
42 | (rainbow-mode +1)
43 | (run-hooks 'prelude-prog-mode-hook))
44 |
45 | (setq prelude-css-mode-hook 'prelude-css-mode-defaults)
46 |
47 | (add-hook 'css-mode-hook (lambda ()
48 | (run-hooks 'prelude-css-mode-hook)))))
49 |
50 | (provide 'prelude-css)
51 | ;;; prelude-css.el ends here
52 |
--------------------------------------------------------------------------------
/modules/prelude-mediawiki.el:
--------------------------------------------------------------------------------
1 | ;;; prelude-mediawiki.el --- Emacs Prelude: mediawiki editing config
2 | ;;
3 | ;; Copyright © 2011-2014 Bozhidar Batsov
4 | ;;
5 | ;; Author: Bozhidar Batsov
6 | ;; URL: https://github.com/bbatsov/prelude
7 | ;; Version: 1.0.0
8 | ;; Keywords: convenience
9 |
10 | ;; This file is not part of GNU Emacs.
11 |
12 | ;;; Commentary:
13 |
14 | ;; Basic configs for access to WikEmacs and Wikipedia.
15 |
16 | ;;; License:
17 |
18 | ;; This program is free software; you can redistribute it and/or
19 | ;; modify it under the terms of the GNU General Public License
20 | ;; as published by the Free Software Foundation; either version 3
21 | ;; of the License, or (at your option) any later version.
22 | ;;
23 | ;; This program is distributed in the hope that it will be useful,
24 | ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
25 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
26 | ;; GNU General Public License for more details.
27 | ;;
28 | ;; You should have received a copy of the GNU General Public License
29 | ;; along with GNU Emacs; see the file COPYING. If not, write to the
30 | ;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
31 | ;; Boston, MA 02110-1301, USA.
32 |
33 | ;;; Code:
34 |
35 | (prelude-require-packages '(mediawiki))
36 |
37 | (eval-after-load 'mediawiki
38 | '(progn
39 | (setq mediawiki-site-alist '(("Wikipedia" "http://en.wikipedia.org/w" "" "" "Main Page")
40 | ("WikEmacs" "http://wikemacs.org/w/" "" "" "Main Page")))
41 |
42 | ;; Emacs users care more for WikEmacs than Wikipedia :-)
43 | (setq mediawiki-site-default "WikEmacs")))
44 |
45 | (provide 'prelude-mediawiki)
46 |
47 | ;;; prelude-mediawiki.el ends here
48 |
--------------------------------------------------------------------------------
/modules/prelude-scheme.el:
--------------------------------------------------------------------------------
1 | ;;; prelude-scheme.el --- Emacs Prelude: Some defaults for Scheme.
2 | ;;
3 | ;; Copyright © 2011-2014 Bozhidar Batsov
4 | ;;
5 | ;; Author: Bozhidar Batsov
6 | ;; URL: https://github.com/bbatsov/prelude
7 | ;; Version: 1.0.0
8 | ;; Keywords: convenience
9 |
10 | ;; This file is not part of GNU Emacs.
11 |
12 | ;;; Commentary:
13 |
14 | ;; Some basic configuration for Scheme programming.
15 |
16 | ;;; License:
17 |
18 | ;; This program is free software; you can redistribute it and/or
19 | ;; modify it under the terms of the GNU General Public License
20 | ;; as published by the Free Software Foundation; either version 3
21 | ;; of the License, or (at your option) any later version.
22 | ;;
23 | ;; This program is distributed in the hope that it will be useful,
24 | ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
25 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
26 | ;; GNU General Public License for more details.
27 | ;;
28 | ;; You should have received a copy of the GNU General Public License
29 | ;; along with GNU Emacs; see the file COPYING. If not, write to the
30 | ;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
31 | ;; Boston, MA 02110-1301, USA.
32 |
33 | ;;; Code:
34 | (prelude-require-package 'geiser)
35 |
36 | (require 'prelude-lisp)
37 | (require 'geiser)
38 |
39 | ;; geiser replies on a REPL to provide autodoc and completion
40 | (setq geiser-mode-start-repl-p t)
41 |
42 | ;; keep the home clean
43 | (setq geiser-repl-history-filename
44 | (expand-file-name "geiser-history" prelude-savefile-dir))
45 |
46 | (add-hook 'scheme-mode-hook (lambda () (run-hooks 'prelude-lisp-coding-hook)))
47 |
48 | (provide 'prelude-scheme)
49 |
50 | ;;; prelude-scheme.el ends here
51 |
--------------------------------------------------------------------------------
/modules/prelude-haskell.el:
--------------------------------------------------------------------------------
1 | ;;; prelude-haskell.el --- Emacs Prelude: Nice config for Haskell programming.
2 | ;;
3 | ;; Copyright © 2011-2014 Bozhidar Batsov
4 | ;;
5 | ;; Author: Bozhidar Batsov
6 | ;; URL: https://github.com/bbatsov/prelude
7 | ;; Version: 1.0.0
8 | ;; Keywords: convenience
9 |
10 | ;; This file is not part of GNU Emacs.
11 |
12 | ;;; Commentary:
13 |
14 | ;; Nice config for Haskell programming.
15 |
16 | ;;; License:
17 |
18 | ;; This program is free software; you can redistribute it and/or
19 | ;; modify it under the terms of the GNU General Public License
20 | ;; as published by the Free Software Foundation; either version 3
21 | ;; of the License, or (at your option) any later version.
22 | ;;
23 | ;; This program is distributed in the hope that it will be useful,
24 | ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
25 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
26 | ;; GNU General Public License for more details.
27 | ;;
28 | ;; You should have received a copy of the GNU General Public License
29 | ;; along with GNU Emacs; see the file COPYING. If not, write to the
30 | ;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
31 | ;; Boston, MA 02110-1301, USA.
32 |
33 | ;;; Code:
34 |
35 | (require 'prelude-programming)
36 | (prelude-require-packages '(haskell-mode))
37 |
38 | (eval-after-load 'haskell-mode
39 | '(progn
40 | (defun prelude-haskell-mode-defaults ()
41 | (subword-mode +1)
42 | (turn-on-haskell-doc-mode)
43 | (turn-on-haskell-indentation)
44 | (interactive-haskell-mode +1))
45 |
46 | (setq prelude-haskell-mode-hook 'prelude-haskell-mode-defaults)
47 |
48 | (add-hook 'haskell-mode-hook (lambda ()
49 | (run-hooks 'prelude-haskell-mode-hook)))))
50 |
51 | (provide 'prelude-haskell)
52 |
53 | ;;; prelude-haskell.el ends here
54 |
--------------------------------------------------------------------------------
/modules/prelude-shell.el:
--------------------------------------------------------------------------------
1 | ;;; prelude-shell.el --- Emacs Prelude: sh-mode configuration.
2 | ;;
3 | ;; Copyright © 2011-2014 Bozhidar Batsov
4 | ;;
5 | ;; Author: Bozhidar Batsov
6 | ;; URL: https://github.com/bbatsov/prelude
7 | ;; Version: 1.0.0
8 | ;; Keywords: convenience
9 |
10 | ;; This file is not part of GNU Emacs.
11 |
12 | ;;; Commentary:
13 |
14 | ;; Some basic configuration for cc-mode and the modes derived from it.
15 |
16 | ;;; License:
17 |
18 | ;; This program is free software; you can redistribute it and/or
19 | ;; modify it under the terms of the GNU General Public License
20 | ;; as published by the Free Software Foundation; either version 3
21 | ;; of the License, or (at your option) any later version.
22 | ;;
23 | ;; This program is distributed in the hope that it will be useful,
24 | ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
25 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
26 | ;; GNU General Public License for more details.
27 | ;;
28 | ;; You should have received a copy of the GNU General Public License
29 | ;; along with GNU Emacs; see the file COPYING. If not, write to the
30 | ;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
31 | ;; Boston, MA 02110-1301, USA.
32 |
33 | ;;; Code:
34 |
35 | (require 'sh-script)
36 |
37 | ;; recognize pretzo files as zsh scripts
38 | (defvar prelude-pretzo-files '("zlogin" "zlogin" "zlogout" "zpretzorc" "zprofile" "zshenv" "zshrc"))
39 |
40 | (mapc (lambda (file)
41 | (add-to-list 'auto-mode-alist `(,(format "\\%s\\'" file) . sh-mode)))
42 | prelude-pretzo-files)
43 |
44 | (add-hook 'sh-mode-hook
45 | (lambda ()
46 | (if (and buffer-file-name
47 | (member (file-name-nondirectory buffer-file-name) prelude-pretzo-files))
48 | (sh-set-shell "zsh"))))
49 |
50 | (provide 'prelude-shell)
51 | ;;; prelude-shell.el ends here
52 |
--------------------------------------------------------------------------------
/modules/prelude-erlang.el:
--------------------------------------------------------------------------------
1 | ;;; prelude-erlang.el --- Emacs Prelude: Erlang programming support.
2 | ;;
3 | ;; Copyright © 2011-2014 Gleb Peregud
4 | ;;
5 | ;; Author: Gleb Peregud
6 | ;; Version: 1.0.0
7 | ;; Keywords: convenience erlang
8 |
9 | ;; This file is not part of GNU Emacs.
10 |
11 | ;;; Commentary:
12 |
13 | ;; Erlang is a concurrent functional language.
14 |
15 | ;;; License:
16 |
17 | ;; This program is free software; you can redistribute it and/or
18 | ;; modify it under the terms of the GNU General Public License
19 | ;; as published by the Free Software Foundation; either version 3
20 | ;; of the License, or (at your option) any later version.
21 | ;;
22 | ;; This program is distributed in the hope that it will be useful,
23 | ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
24 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
25 | ;; GNU General Public License for more details.
26 | ;;
27 | ;; You should have received a copy of the GNU General Public License
28 | ;; along with GNU Emacs; see the file COPYING. If not, write to the
29 | ;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
30 | ;; Boston, MA 02110-1301, USA.
31 |
32 | ;;; Code:
33 |
34 | (require 'prelude-programming)
35 | (prelude-require-packages '(erlang))
36 |
37 | (defcustom wrangler-path nil
38 | "The location of wrangler elisp directory."
39 | :group 'prelude-erlang
40 | :type 'string
41 | :safe 'stringp)
42 |
43 | (require 'projectile)
44 |
45 | (when (require 'erlang-start nil t)
46 |
47 | (eval-after-load 'erlang-mode
48 | '(progn
49 | (flymake-mode)))
50 |
51 | (when (not (null wrangler-path))
52 | (add-to-list 'load-path wrangler-path)
53 | (require 'wrangler)))
54 |
55 | (add-hook 'erlang-mode-hook (lambda ()
56 | (setq erlang-compile-function 'projectile-compile-project)))
57 |
58 | (provide 'prelude-erlang)
59 |
60 | ;;; prelude-erlang.el ends here
61 |
--------------------------------------------------------------------------------
/modules/prelude-js.el:
--------------------------------------------------------------------------------
1 | ;;; prelude-js.el --- Emacs Prelude: js-mode configuration.
2 | ;;
3 | ;; Copyright © 2011-2014 Bozhidar Batsov
4 | ;;
5 | ;; Author: Bozhidar Batsov
6 | ;; URL: https://github.com/bbatsov/prelude
7 | ;; Version: 1.0.0
8 | ;; Keywords: convenience
9 |
10 | ;; This file is not part of GNU Emacs.
11 |
12 | ;;; Commentary:
13 |
14 | ;; Some basic configuration for js-mode.
15 |
16 | ;;; License:
17 |
18 | ;; This program is free software; you can redistribute it and/or
19 | ;; modify it under the terms of the GNU General Public License
20 | ;; as published by the Free Software Foundation; either version 3
21 | ;; of the License, or (at your option) any later version.
22 | ;;
23 | ;; This program is distributed in the hope that it will be useful,
24 | ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
25 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
26 | ;; GNU General Public License for more details.
27 | ;;
28 | ;; You should have received a copy of the GNU General Public License
29 | ;; along with GNU Emacs; see the file COPYING. If not, write to the
30 | ;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
31 | ;; Boston, MA 02110-1301, USA.
32 |
33 | ;;; Code:
34 |
35 | (require 'prelude-programming)
36 | (prelude-require-packages '(js2-mode json-mode))
37 |
38 | (require 'js2-mode)
39 |
40 | (add-to-list 'auto-mode-alist '("\\.js\\'" . js2-mode))
41 | (add-to-list 'auto-mode-alist '("\\.pac\\'" . js2-mode))
42 | (add-to-list 'interpreter-mode-alist '("node" . js2-mode))
43 |
44 | (eval-after-load 'js2-mode
45 | '(progn
46 | (defun prelude-js-mode-defaults ()
47 | ;; electric-layout-mode doesn't play nice with smartparens
48 | (setq-local electric-layout-rules '((?\; . after)))
49 | (setq mode-name "JS2")
50 | (js2-imenu-extras-mode +1))
51 |
52 | (setq prelude-js-mode-hook 'prelude-js-mode-defaults)
53 |
54 | (add-hook 'js2-mode-hook (lambda () (run-hooks 'prelude-js-mode-hook)))))
55 |
56 | (provide 'prelude-js)
57 |
58 | ;;; prelude-js.el ends here
59 |
--------------------------------------------------------------------------------
/modules/prelude-c.el:
--------------------------------------------------------------------------------
1 | ;;; prelude-c.el --- Emacs Prelude: cc-mode configuration.
2 | ;;
3 | ;; Copyright © 2011-2014 Bozhidar Batsov
4 | ;;
5 | ;; Author: Bozhidar Batsov
6 | ;; URL: https://github.com/bbatsov/prelude
7 | ;; Version: 1.0.0
8 | ;; Keywords: convenience
9 |
10 | ;; This file is not part of GNU Emacs.
11 |
12 | ;;; Commentary:
13 |
14 | ;; Some basic configuration for cc-mode and the modes derived from it.
15 |
16 | ;;; License:
17 |
18 | ;; This program is free software; you can redistribute it and/or
19 | ;; modify it under the terms of the GNU General Public License
20 | ;; as published by the Free Software Foundation; either version 3
21 | ;; of the License, or (at your option) any later version.
22 | ;;
23 | ;; This program is distributed in the hope that it will be useful,
24 | ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
25 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
26 | ;; GNU General Public License for more details.
27 | ;;
28 | ;; You should have received a copy of the GNU General Public License
29 | ;; along with GNU Emacs; see the file COPYING. If not, write to the
30 | ;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
31 | ;; Boston, MA 02110-1301, USA.
32 |
33 | ;;; Code:
34 |
35 | (require 'prelude-programming)
36 |
37 | (defun prelude-c-mode-common-defaults ()
38 | (setq c-basic-offset 4)
39 | (c-set-offset 'substatement-open 0))
40 |
41 | (setq prelude-c-mode-common-hook 'prelude-c-mode-common-defaults)
42 |
43 | ;; this will affect all modes derived from cc-mode, like
44 | ;; java-mode, php-mode, etc
45 | (add-hook 'c-mode-common-hook (lambda ()
46 | (run-hooks 'prelude-c-mode-common-hook)))
47 |
48 | (defun prelude-makefile-mode-defaults ()
49 | (whitespace-toggle-options '(tabs))
50 | (setq indent-tabs-mode t ))
51 |
52 | (setq prelude-makefile-mode-hook 'prelude-makefile-mode-defaults)
53 |
54 | (add-hook 'makefile-mode-hook (lambda ()
55 | (run-hooks 'prelude-makefile-mode-hook)))
56 | (provide 'prelude-c)
57 |
58 | ;;; prelude-c.el ends here
59 |
--------------------------------------------------------------------------------
/modules/prelude-org.el:
--------------------------------------------------------------------------------
1 | ;;; prelude-org.el --- Emacs Prelude: org-mode configuration.
2 | ;;
3 | ;; Copyright © 2011-2014 Bozhidar Batsov
4 | ;;
5 | ;; Author: Bozhidar Batsov
6 | ;; URL: https://github.com/bbatsov/prelude
7 | ;; Version: 1.0.0
8 | ;; Keywords: convenience
9 |
10 | ;; This file is not part of GNU Emacs.
11 |
12 | ;;; Commentary:
13 |
14 | ;; Some basic configuration for org-mode.
15 |
16 | ;;; License:
17 |
18 | ;; This program is free software; you can redistribute it and/or
19 | ;; modify it under the terms of the GNU General Public License
20 | ;; as published by the Free Software Foundation; either version 3
21 | ;; of the License, or (at your option) any later version.
22 | ;;
23 | ;; This program is distributed in the hope that it will be useful,
24 | ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
25 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
26 | ;; GNU General Public License for more details.
27 | ;;
28 | ;; You should have received a copy of the GNU General Public License
29 | ;; along with GNU Emacs; see the file COPYING. If not, write to the
30 | ;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
31 | ;; Boston, MA 02110-1301, USA.
32 |
33 | ;;; Code:
34 |
35 | (add-to-list 'auto-mode-alist '("\\.org\\’" . org-mode))
36 | (global-set-key "\C-cl" 'org-store-link)
37 | (global-set-key "\C-ca" 'org-agenda)
38 | (global-set-key "\C-cb" 'org-iswitchb)
39 | (setq org-log-done t)
40 |
41 | (defun prelude-org-mode-defaults ()
42 | (let ((oldmap (cdr (assoc 'prelude-mode minor-mode-map-alist)))
43 | (newmap (make-sparse-keymap)))
44 | (set-keymap-parent newmap oldmap)
45 | (define-key newmap (kbd "C-c +") nil)
46 | (define-key newmap (kbd "C-c -") nil)
47 | (make-local-variable 'minor-mode-overriding-map-alist)
48 | (push `(prelude-mode . ,newmap) minor-mode-overriding-map-alist))
49 | )
50 |
51 | (setq prelude-org-mode-hook 'prelude-org-mode-defaults)
52 |
53 | (add-hook 'org-mode-hook (lambda () (run-hooks 'prelude-org-mode-hook)))
54 |
55 | (provide 'prelude-org)
56 |
57 | ;;; prelude-org.el ends here
58 |
--------------------------------------------------------------------------------
/modules/prelude-coffee.el:
--------------------------------------------------------------------------------
1 | ;;; prelude-coffee.el --- Emacs Prelude: CoffeeScript programming support.
2 | ;;
3 | ;; Copyright © 2011-2014 Bozhidar Batsov
4 | ;;
5 | ;; Author: Bozhidar Batsov
6 | ;; URL: https://github.com/bbatsov/prelude
7 | ;; Version: 1.0.0
8 | ;; Keywords: convenience
9 |
10 | ;; This file is not part of GNU Emacs.
11 |
12 | ;;; Commentary:
13 |
14 | ;; CoffeeScript is a nice little language that comples to JavaScript.
15 |
16 | ;;; License:
17 |
18 | ;; This program is free software; you can redistribute it and/or
19 | ;; modify it under the terms of the GNU General Public License
20 | ;; as published by the Free Software Foundation; either version 3
21 | ;; of the License, or (at your option) any later version.
22 | ;;
23 | ;; This program is distributed in the hope that it will be useful,
24 | ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
25 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
26 | ;; GNU General Public License for more details.
27 | ;;
28 | ;; You should have received a copy of the GNU General Public License
29 | ;; along with GNU Emacs; see the file COPYING. If not, write to the
30 | ;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
31 | ;; Boston, MA 02110-1301, USA.
32 |
33 | ;;; Code:
34 |
35 | (require 'prelude-programming)
36 | (prelude-require-package 'coffee-mode)
37 |
38 | (eval-after-load 'coffee-mode
39 | '(progn
40 | ;; CoffeeScript uses two spaces.
41 | (setq coffee-tab-width 2)
42 |
43 | ;; remove the "Generated by CoffeeScript" header
44 | (add-to-list 'coffee-args-compile "--no-header")
45 |
46 | (defun prelude-coffee-mode-defaults ()
47 | ;; Update the already compiled js on save
48 | (and (buffer-file-name)
49 | (file-exists-p (buffer-file-name))
50 | (file-exists-p (coffee-compiled-file-name (buffer-file-name)))
51 | (coffee-cos-mode t))
52 | (subword-mode +1))
53 |
54 | (setq prelude-coffee-mode-hook 'prelude-coffee-mode-defaults)
55 |
56 | (add-hook 'coffee-mode-hook (lambda ()
57 | (run-hooks 'prelude-coffee-mode-hook)))))
58 | (provide 'prelude-coffee)
59 |
60 | ;;; prelude-coffee.el ends here
61 |
--------------------------------------------------------------------------------
/modules/prelude-ido.el:
--------------------------------------------------------------------------------
1 | ;;; prelude-ido.el --- Ido setup
2 | ;;
3 | ;; Copyright © 2011-2014 Bozhidar Batsov
4 | ;;
5 | ;; Author: Bozhidar Batsov
6 | ;; URL: https://github.com/bbatsov/prelude
7 | ;; Version: 1.0.0
8 | ;; Keywords: convenience
9 |
10 | ;; This file is not part of GNU Emacs.
11 |
12 | ;;; Commentary:
13 |
14 | ;; Ido-related config.
15 |
16 | ;;; License:
17 |
18 | ;; This program is free software; you can redistribute it and/or
19 | ;; modify it under the terms of the GNU General Public License
20 | ;; as published by the Free Software Foundation; either version 3
21 | ;; of the License, or (at your option) any later version.
22 | ;;
23 | ;; This program is distributed in the hope that it will be useful,
24 | ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
25 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
26 | ;; GNU General Public License for more details.
27 | ;;
28 | ;; You should have received a copy of the GNU General Public License
29 | ;; along with GNU Emacs; see the file COPYING. If not, write to the
30 | ;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
31 | ;; Boston, MA 02110-1301, USA.
32 |
33 | ;;; Code:
34 | (prelude-require-packages '(flx-ido ido-ubiquitous smex))
35 |
36 | (require 'ido)
37 | (require 'ido-ubiquitous)
38 | (require 'flx-ido)
39 |
40 | (setq ido-enable-prefix nil
41 | ido-enable-flex-matching t
42 | ido-create-new-buffer 'always
43 | ido-use-filename-at-point 'guess
44 | ido-max-prospects 10
45 | ido-save-directory-list-file (expand-file-name "ido.hist" prelude-savefile-dir)
46 | ido-default-file-method 'selected-window
47 | ido-auto-merge-work-directories-length -1)
48 | (ido-mode +1)
49 | (ido-ubiquitous-mode +1)
50 |
51 | ;;; smarter fuzzy matching for ido
52 | (flx-ido-mode +1)
53 | ;; disable ido faces to see flx highlights
54 | (setq ido-use-faces nil)
55 |
56 | ;;; smex, remember recently and most frequently used commands
57 | (require 'smex)
58 | (setq smex-save-file (expand-file-name ".smex-items" prelude-savefile-dir))
59 | (smex-initialize)
60 | (global-set-key (kbd "M-x") 'smex)
61 | (global-set-key (kbd "M-X") 'smex-major-mode-commands)
62 |
63 | (provide 'prelude-ido)
64 | ;;; prelude-ido.el ends here
65 |
--------------------------------------------------------------------------------
/modules/prelude-clojure.el:
--------------------------------------------------------------------------------
1 | ;;; prelude-clojure.el --- Emacs Prelude: Clojure programming configuration.
2 | ;;
3 | ;; Copyright © 2011-2014 Bozhidar Batsov
4 | ;;
5 | ;; Author: Bozhidar Batsov
6 | ;; URL: http://batsov.com/prelude
7 | ;; Version: 1.0.0
8 | ;; Keywords: convenience
9 |
10 | ;; This file is not part of GNU Emacs.
11 |
12 | ;;; Commentary:
13 |
14 | ;; Some basic configuration for clojure-mode.
15 |
16 | ;;; License:
17 |
18 | ;; This program is free software; you can redistribute it and/or
19 | ;; modify it under the terms of the GNU General Public License
20 | ;; as published by the Free Software Foundation; either version 3
21 | ;; of the License, or (at your option) any later version.
22 | ;;
23 | ;; This program is distributed in the hope that it will be useful,
24 | ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
25 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
26 | ;; GNU General Public License for more details.
27 | ;;
28 | ;; You should have received a copy of the GNU General Public License
29 | ;; along with GNU Emacs; see the file COPYING. If not, write to the
30 | ;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
31 | ;; Boston, MA 02110-1301, USA.
32 |
33 | ;;; Code:
34 |
35 | (require 'prelude-lisp)
36 | (prelude-require-packages '(clojure-mode cider))
37 |
38 | (eval-after-load 'clojure-mode
39 | '(progn
40 | (defun prelude-clojure-mode-defaults ()
41 | (subword-mode +1)
42 | (run-hooks 'prelude-lisp-coding-hook))
43 |
44 | (setq prelude-clojure-mode-hook 'prelude-clojure-mode-defaults)
45 |
46 | (add-hook 'clojure-mode-hook (lambda ()
47 | (run-hooks 'prelude-clojure-mode-hook)))))
48 |
49 | (eval-after-load 'cider
50 | '(progn
51 | (setq nrepl-log-messages t)
52 |
53 | (add-hook 'cider-mode-hook 'cider-turn-on-eldoc-mode)
54 |
55 | (defun prelude-cider-repl-mode-defaults ()
56 | (subword-mode +1)
57 | (run-hooks 'prelude-interactive-lisp-coding-hook))
58 |
59 | (setq prelude-cider-repl-mode-hook 'prelude-cider-repl-mode-defaults)
60 |
61 | (add-hook 'cider-repl-mode-hook (lambda ()
62 | (run-hooks 'prelude-cider-repl-mode-hook)))))
63 |
64 | (provide 'prelude-clojure)
65 |
66 | ;;; prelude-clojure.el ends here
67 |
--------------------------------------------------------------------------------
/modules/prelude-lisp.el:
--------------------------------------------------------------------------------
1 | ;;; prelude-lisp.el --- Emacs Prelude: Configuration common to all lisp modes.
2 | ;;
3 | ;; Copyright © 2011-2014 Bozhidar Batsov
4 | ;;
5 | ;; Author: Bozhidar Batsov
6 | ;; URL: https://github.com/bbatsov/prelude
7 | ;; Version: 1.0.0
8 | ;; Keywords: convenience
9 |
10 | ;; This file is not part of GNU Emacs.
11 |
12 | ;;; Commentary:
13 |
14 | ;; Configuration shared between all modes related to lisp-like languages.
15 |
16 | ;;; License:
17 |
18 | ;; This program is free software; you can redistribute it and/or
19 | ;; modify it under the terms of the GNU General Public License
20 | ;; as published by the Free Software Foundation; either version 3
21 | ;; of the License, or (at your option) any later version.
22 | ;;
23 | ;; This program is distributed in the hope that it will be useful,
24 | ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
25 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
26 | ;; GNU General Public License for more details.
27 | ;;
28 | ;; You should have received a copy of the GNU General Public License
29 | ;; along with GNU Emacs; see the file COPYING. If not, write to the
30 | ;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
31 | ;; Boston, MA 02110-1301, USA.
32 |
33 | ;;; Code:
34 |
35 | (require 'prelude-programming)
36 | (prelude-require-packages '(rainbow-delimiters))
37 |
38 | ;; Lisp configuration
39 | (define-key read-expression-map (kbd "TAB") 'completion-at-point)
40 |
41 | ;; wrap keybindings
42 | (define-key lisp-mode-shared-map (kbd "M-(") (prelude-wrap-with "("))
43 | ;; FIXME: Pick terminal-friendly binding.
44 | ;;(define-key lisp-mode-shared-map (kbd "M-[") (prelude-wrap-with "["))
45 | (define-key lisp-mode-shared-map (kbd "M-\"") (prelude-wrap-with "\""))
46 |
47 | ;; a great lisp coding hook
48 | (defun prelude-lisp-coding-defaults ()
49 | (smartparens-strict-mode +1)
50 | (rainbow-delimiters-mode +1))
51 |
52 | (setq prelude-lisp-coding-hook 'prelude-lisp-coding-defaults)
53 |
54 | ;; interactive modes don't need whitespace checks
55 | (defun prelude-interactive-lisp-coding-defaults ()
56 | (smartparens-strict-mode +1)
57 | (rainbow-delimiters-mode +1)
58 | (whitespace-mode -1))
59 |
60 | (setq prelude-interactive-lisp-coding-hook 'prelude-interactive-lisp-coding-defaults)
61 |
62 | (provide 'prelude-lisp)
63 |
64 | ;;; prelude-lisp.el ends here
65 |
--------------------------------------------------------------------------------
/modules/prelude-key-chord.el:
--------------------------------------------------------------------------------
1 | ;;; prelude-key-chord.el --- Key chord setup
2 | ;;
3 | ;; Copyright © 2011-2014 Bozhidar Batsov
4 | ;;
5 | ;; Author: Bozhidar Batsov
6 | ;; URL: https://github.com/bbatsov/prelude
7 | ;; Version: 1.0.0
8 | ;; Keywords: convenience
9 |
10 | ;; This file is not part of GNU Emacs.
11 |
12 | ;;; Commentary:
13 |
14 | ;; Configure key-chord key bindings.
15 |
16 | ;;; License:
17 |
18 | ;; This program is free software; you can redistribute it and/or
19 | ;; modify it under the terms of the GNU General Public License
20 | ;; as published by the Free Software Foundation; either version 3
21 | ;; of the License, or (at your option) any later version.
22 | ;;
23 | ;; This program is distributed in the hope that it will be useful,
24 | ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
25 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
26 | ;; GNU General Public License for more details.
27 | ;;
28 | ;; You should have received a copy of the GNU General Public License
29 | ;; along with GNU Emacs; see the file COPYING. If not, write to the
30 | ;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
31 | ;; Boston, MA 02110-1301, USA.
32 |
33 | ;;; Code:
34 | (prelude-require-package 'key-chord)
35 |
36 | (require 'key-chord)
37 |
38 | (key-chord-define-global "jj" 'ace-jump-word-mode)
39 | (key-chord-define-global "jl" 'ace-jump-line-mode)
40 | (key-chord-define-global "jk" 'ace-jump-char-mode)
41 | (key-chord-define-global "JJ" 'prelude-switch-to-previous-buffer)
42 | (key-chord-define-global "uu" 'undo-tree-visualize)
43 | (key-chord-define-global "xx" 'execute-extended-command)
44 | (key-chord-define-global "yy" 'browse-kill-ring)
45 |
46 | (defvar key-chord-tips '("Press quickly to jump to the beginning of a visible word."
47 | "Press quickly to jump to a visible line."
48 | "Press quickly to jump to a visible character."
49 | "Press quickly to switch to previous buffer."
50 | "Press quickly to visualize the undo tree."
51 | "Press quickly to execute extended command."
52 | "Press quickly to browse the kill ring."))
53 |
54 | (setq prelude-tips (append prelude-tips key-chord-tips))
55 |
56 | (key-chord-mode +1)
57 |
58 | (provide 'prelude-key-chord)
59 |
60 | ;;; prelude-key-chord.el ends here
61 |
--------------------------------------------------------------------------------
/modules/prelude-perl.el:
--------------------------------------------------------------------------------
1 | ;;; prelude-perl.el --- Emacs Prelude: decent Perl coding settings.
2 | ;;
3 | ;; Copyright © 2011-2014 Bozhidar Batsov
4 | ;;
5 | ;; Author: Bozhidar Batsov
6 | ;; URL: https://github.com/bbatsov/prelude
7 | ;; Version: 1.0.0
8 | ;; Keywords: convenience
9 |
10 | ;; This file is not part of GNU Emacs.
11 |
12 | ;;; Commentary:
13 |
14 | ;; cperl-mode is the best Perl mode for Emacs out there.
15 |
16 | ;;; License:
17 |
18 | ;; This program is free software; you can redistribute it and/or
19 | ;; modify it under the terms of the GNU General Public License
20 | ;; as published by the Free Software Foundation; either version 3
21 | ;; of the License, or (at your option) any later version.
22 | ;;
23 | ;; This program is distributed in the hope that it will be useful,
24 | ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
25 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
26 | ;; GNU General Public License for more details.
27 | ;;
28 | ;; You should have received a copy of the GNU General Public License
29 | ;; along with GNU Emacs; see the file COPYING. If not, write to the
30 | ;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
31 | ;; Boston, MA 02110-1301, USA.
32 |
33 | ;;; Code:
34 |
35 | (require 'prelude-programming)
36 |
37 | ;; use cperl-mode instead of perl-mode
38 | (defalias 'perl-mode 'cperl-mode)
39 |
40 | (define-key 'help-command "P" 'cperl-perldoc)
41 |
42 | (defun prelude-cperl-mode-defaults ()
43 | (setq cperl-indent-level 4)
44 | (setq cperl-continued-statement-offset 8)
45 | ;; cperl-hairy affects all those variables, but I prefer
46 | ;; a more fine-grained approach as far as they are concerned
47 | (setq cperl-font-lock t)
48 | (setq cperl-electric-lbrace-space t)
49 | (setq cperl-electric-parens nil)
50 | (setq cperl-electric-linefeed nil)
51 | (setq cperl-electric-keywords nil)
52 | (setq cperl-info-on-command-no-prompt t)
53 | (setq cperl-clobber-lisp-bindings t)
54 | (setq cperl-lazy-help-time 3)
55 |
56 | ;; if you want all the bells and whistles
57 | ;; (setq cperl-hairy)
58 |
59 | (set-face-background 'cperl-array-face nil)
60 | (set-face-background 'cperl-hash-face nil)
61 | (setq cperl-invalid-face nil))
62 |
63 | (setq prelude-cperl-mode-hook 'prelude-cperl-mode-defaults)
64 |
65 | (add-hook 'cperl-mode-hook (lambda ()
66 | (run-hooks 'prelude-cperl-mode-hook)) t)
67 |
68 | (provide 'prelude-perl)
69 |
70 | ;;; prelude-perl.el ends here
71 |
--------------------------------------------------------------------------------
/core/prelude-osx.el:
--------------------------------------------------------------------------------
1 | ;;; prelude-osx.el --- Emacs Prelude: OSX specific settings.
2 | ;;
3 | ;; Copyright © 2011-2014 Bozhidar Batsov
4 | ;;
5 | ;; Author: Bozhidar Batsov
6 | ;; URL: https://github.com/bbatsov/prelude
7 | ;; Version: 1.0.0
8 | ;; Keywords: convenience
9 |
10 | ;; This file is not part of GNU Emacs.
11 |
12 | ;;; Commentary:
13 |
14 | ;; Some OSX specific stuff.
15 |
16 | ;;; License:
17 |
18 | ;; This program is free software; you can redistribute it and/or
19 | ;; modify it under the terms of the GNU General Public License
20 | ;; as published by the Free Software Foundation; either version 3
21 | ;; of the License, or (at your option) any later version.
22 | ;;
23 | ;; This program is distributed in the hope that it will be useful,
24 | ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
25 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
26 | ;; GNU General Public License for more details.
27 | ;;
28 | ;; You should have received a copy of the GNU General Public License
29 | ;; along with GNU Emacs; see the file COPYING. If not, write to the
30 | ;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
31 | ;; Boston, MA 02110-1301, USA.
32 |
33 | ;;; Code:
34 |
35 | ;; On OS X Emacs doesn't use the shell PATH if it's not started from
36 | ;; the shell. Let's fix that:
37 | (prelude-require-packages '(exec-path-from-shell vkill))
38 |
39 | (require 'exec-path-from-shell)
40 | (exec-path-from-shell-initialize)
41 |
42 | ;; It's all in the Meta
43 | (setq ns-function-modifier 'hyper)
44 |
45 | ;; proced-mode doesn't work on OS X so we use vkill instead
46 | (autoload 'vkill "vkill" nil t)
47 | (global-set-key (kbd "C-x p") 'vkill)
48 |
49 | (defun prelude-swap-meta-and-super ()
50 | "Swap the mapping of Meta and Super.
51 | Very useful for people using their Mac with a
52 | Windows external keyboard from time to time."
53 | (interactive)
54 | (if (eq mac-command-modifier 'super)
55 | (progn
56 | (setq mac-command-modifier 'meta)
57 | (setq mac-option-modifier 'super)
58 | (message "Command is now bound to META and Option is bound to SUPER."))
59 | (progn
60 | (setq mac-command-modifier 'super)
61 | (setq mac-option-modifier 'meta)
62 | (message "Command is now bound to SUPER and Option is bound to META."))))
63 |
64 | (define-key prelude-mode-map (kbd "C-c w") 'prelude-swap-meta-and-super)
65 | (define-key prelude-mode-map (kbd "s-/") 'hippie-expand)
66 |
67 | (menu-bar-mode +1)
68 |
69 | (provide 'prelude-osx)
70 | ;;; prelude-osx.el ends here
71 |
--------------------------------------------------------------------------------
/modules/prelude-helm.el:
--------------------------------------------------------------------------------
1 | ;;; prelude-helm.el --- Helm setup
2 | ;;
3 | ;; Copyright © 2011-2014 Bozhidar Batsov
4 | ;;
5 | ;; Author: Bozhidar Batsov
6 | ;; URL: https://github.com/bbatsov/prelude
7 | ;; Version: 1.0.0
8 | ;; Keywords: convenience
9 |
10 | ;; This file is not part of GNU Emacs.
11 |
12 | ;;; Commentary:
13 |
14 | ;; Some configuration for Helm following this guide:
15 | ;; http://tuhdo.github.io/helm-intro.html
16 |
17 | ;;; License:
18 |
19 | ;; This program is free software; you can redistribute it and/or
20 | ;; modify it under the terms of the GNU General Public License
21 | ;; as published by the Free Software Foundation; either version 3
22 | ;; of the License, or (at your option) any later version.
23 | ;;
24 | ;; This program is distributed in the hope that it will be useful,
25 | ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
26 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
27 | ;; GNU General Public License for more details.
28 | ;;
29 | ;; You should have received a copy of the GNU General Public License
30 | ;; along with GNU Emacs; see the file COPYING. If not, write to the
31 | ;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
32 | ;; Boston, MA 02110-1301, USA.
33 |
34 | ;;; Code:
35 |
36 | (prelude-require-packages '(helm helm-projectile))
37 |
38 | (require 'helm-config)
39 | (require 'helm-projectile)
40 |
41 | (when (executable-find "curl")
42 | (setq helm-google-suggest-use-curl-p t))
43 |
44 | ;; See https://github.com/bbatsov/prelude/pull/670 for a detailed
45 | ;; discussion of these options.
46 | (setq helm-split-window-in-side-p t
47 | helm-buffers-fuzzy-matching t
48 | helm-move-to-line-cycle-in-source t
49 | helm-ff-search-library-in-sexp t
50 | helm-ff-file-name-history-use-recentf t)
51 |
52 | ;; The default "C-x c" is quite close to "C-x C-c", which quits Emacs.
53 | ;; Changed to "C-c h". Note: We must set "C-c h" globally, because we
54 | ;; cannot change `helm-command-prefix-key' once `helm-config' is loaded.
55 | (global-set-key (kbd "C-c h") 'helm-command-prefix)
56 | (global-unset-key (kbd "C-x c"))
57 |
58 | (define-key helm-command-map (kbd "o") 'helm-occur)
59 | (define-key helm-command-map (kbd "g") 'helm-do-grep)
60 | (define-key helm-command-map (kbd "C-c w") 'helm-wikipedia-suggest)
61 | (define-key helm-command-map (kbd "SPC") 'helm-all-mark-rings)
62 |
63 | (push "Press to navigate a project in Helm." prelude-tips)
64 |
65 | (provide 'prelude-helm)
66 |
67 | ;;; prelude-helm.el ends here
68 |
--------------------------------------------------------------------------------
/modules/prelude-helm-everywhere.el:
--------------------------------------------------------------------------------
1 | ;;; prelude-helm-everywhere.el --- Enable Helm everywhere
2 | ;;
3 | ;; Copyright © 2014 Tu, Do Hoang
4 | ;;
5 | ;; Author: Tu, Do Hoang (tuhdo1710@gmail.com)
6 | ;; URL: https://github.com/bbatsov/prelude
7 | ;; Version: 1.0.0
8 | ;; Keywords: convenience
9 |
10 | ;; This file is not part of GNU Emacs.
11 |
12 | ;;; Commentary:
13 |
14 | ;; Enable Helm everywhere with global key bindings to replace common
15 | ;; global bindings and `helm-mode' is activated to replace `completing-read'
16 | ;; with `helm-completing-read-default', so users can use Helm with every prompt.
17 |
18 | ;;; License:
19 |
20 | ;; This program is free software; you can redistribute it and/or
21 | ;; modify it under the terms of the GNU General Public License
22 | ;; as published by the Free Software Foundation; either version 3
23 | ;; of the License, or (at your option) any later version.
24 | ;;
25 | ;; This program is distributed in the hope that it will be useful,
26 | ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
27 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
28 | ;; GNU General Public License for more details.
29 | ;;
30 | ;; You should have received a copy of the GNU General Public License
31 | ;; along with GNU Emacs; see the file COPYING. If not, write to the
32 | ;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
33 | ;; Boston, MA 02110-1301, USA.
34 |
35 | ;;; Code:
36 | (require 'prelude-helm)
37 | (prelude-require-packages '(helm-descbinds))
38 | (require 'helm-eshell)
39 |
40 | (global-set-key (kbd "M-x") 'helm-M-x)
41 | (global-set-key (kbd "C-x C-m") 'helm-M-x)
42 | (global-set-key (kbd "M-y") 'helm-show-kill-ring)
43 | (global-set-key (kbd "C-x b") 'helm-mini)
44 | (global-set-key (kbd "C-x C-f") 'helm-find-files)
45 | (global-set-key (kbd "C-h f") 'helm-apropos)
46 | (global-set-key (kbd "C-h r") 'helm-info-emacs)
47 | (global-set-key (kbd "C-h C-l") 'helm-locate-library)
48 | (define-key prelude-mode-map (kbd "C-c f") 'helm-recentf)
49 |
50 | (define-key minibuffer-local-map (kbd "C-c C-l") 'helm-minibuffer-history)
51 |
52 | ;; shell history.
53 | (define-key shell-mode-map (kbd "C-c C-l") 'helm-comint-input-ring)
54 |
55 | ;; use helm to list eshell history
56 | (add-hook 'eshell-mode-hook
57 | #'(lambda ()
58 | (substitute-key-definition 'eshell-list-history 'helm-eshell-history eshell-mode-map)))
59 |
60 | (substitute-key-definition 'find-tag 'helm-etags-select global-map)
61 | (setq projectile-completion-system 'helm)
62 | (helm-descbinds-mode)
63 | (helm-mode 1)
64 |
65 | ;; enable Helm version of Projectile with replacment commands
66 | (helm-projectile-on)
67 |
68 | (provide 'prelude-helm-everywhere)
69 | ;; prelude-helm-everywhere.el ends here.
70 |
--------------------------------------------------------------------------------
/core/prelude-ui.el:
--------------------------------------------------------------------------------
1 | ;;; prelude-ui.el --- Emacs Prelude: UI optimizations and tweaks.
2 | ;;
3 | ;; Copyright © 2011-2014 Bozhidar Batsov
4 | ;;
5 | ;; Author: Bozhidar Batsov
6 | ;; URL: https://github.com/bbatsov/prelude
7 | ;; Version: 1.0.0
8 | ;; Keywords: convenience
9 |
10 | ;; This file is not part of GNU Emacs.
11 |
12 | ;;; Commentary:
13 |
14 | ;; We dispense with most of the point and click UI, reduce the startup noise,
15 | ;; configure smooth scolling and a nice theme that's easy on the eyes (zenburn).
16 |
17 | ;;; License:
18 |
19 | ;; This program is free software; you can redistribute it and/or
20 | ;; modify it under the terms of the GNU General Public License
21 | ;; as published by the Free Software Foundation; either version 3
22 | ;; of the License, or (at your option) any later version.
23 | ;;
24 | ;; This program is distributed in the hope that it will be useful,
25 | ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
26 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
27 | ;; GNU General Public License for more details.
28 | ;;
29 | ;; You should have received a copy of the GNU General Public License
30 | ;; along with GNU Emacs; see the file COPYING. If not, write to the
31 | ;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
32 | ;; Boston, MA 02110-1301, USA.
33 |
34 | ;;; Code:
35 |
36 | ;; the toolbar is just a waste of valuable screen estate
37 | ;; in a tty tool-bar-mode does not properly auto-load, and is
38 | ;; already disabled anyway
39 | (when (fboundp 'tool-bar-mode)
40 | (tool-bar-mode -1))
41 |
42 | (menu-bar-mode -1)
43 |
44 | ;; the blinking cursor is nothing, but an annoyance
45 | (blink-cursor-mode -1)
46 |
47 | ;; disable startup screen
48 | (setq inhibit-startup-screen t)
49 |
50 | ;; nice scrolling
51 | (setq scroll-margin 0
52 | scroll-conservatively 100000
53 | scroll-preserve-screen-position 1)
54 |
55 | ;; mode line settings
56 | (line-number-mode t)
57 | (column-number-mode t)
58 | (size-indication-mode t)
59 |
60 | ;; make the fringe (gutter) smaller
61 | ;; the argument is a width in pixels (the default is 8)
62 | (if (fboundp 'fringe-mode)
63 | (fringe-mode 4))
64 |
65 | ;; enable y/n answers
66 | (fset 'yes-or-no-p 'y-or-n-p)
67 |
68 | ;; more useful frame title, that show either a file or a
69 | ;; buffer name (if the buffer isn't visiting a file)
70 | (setq frame-title-format
71 | '("" invocation-name " Prelude - " (:eval (if (buffer-file-name)
72 | (abbreviate-file-name (buffer-file-name))
73 | "%b"))))
74 |
75 | ;; use zenburn as the default theme
76 | (load-theme prelude-theme t)
77 |
78 | (provide 'prelude-ui)
79 | ;;; prelude-ui.el ends here
80 |
--------------------------------------------------------------------------------
/modules/prelude-web.el:
--------------------------------------------------------------------------------
1 | ;;; prelude-web.el --- Emacs Prelude: web template support
2 | ;;
3 | ;; Copyright © 2011-2014 Bozhidar Batsov
4 | ;;
5 | ;; Author: Bozhidar Batsov
6 | ;; URL: http://www.batsov.com/emacs-prelude
7 | ;; Version: 1.0.0
8 | ;; Keywords: convenience
9 |
10 | ;; This file is not part of GNU Emacs.
11 |
12 | ;;; Commentary:
13 |
14 | ;; Some basic configuration for web-mode.
15 |
16 | ;;; License:
17 |
18 | ;; This program is free software; you can redistribute it and/or
19 | ;; modify it under the terms of the GNU General Public License
20 | ;; as published by the Free Software Foundation; either version 3
21 | ;; of the License, or (at your option) any later version.
22 | ;;
23 | ;; This program is distributed in the hope that it will be useful,
24 | ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
25 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
26 | ;; GNU General Public License for more details.
27 | ;;
28 | ;; You should have received a copy of the GNU General Public License
29 | ;; along with GNU Emacs; see the file COPYING. If not, write to the
30 | ;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
31 | ;; Boston, MA 02110-1301, USA.
32 |
33 | ;;; Code:
34 |
35 | (prelude-require-packages '(web-mode))
36 |
37 | (require 'web-mode)
38 |
39 | (add-to-list 'auto-mode-alist '("\\.phtml\\'" . web-mode))
40 | (add-to-list 'auto-mode-alist '("\\.tpl\\.php\\'" . web-mode))
41 | (add-to-list 'auto-mode-alist '("\\.tpl\\'" . web-mode))
42 | (add-to-list 'auto-mode-alist '("\\.blade\\.php\\'" . web-mode))
43 | (add-to-list 'auto-mode-alist '("\\.jsp\\'" . web-mode))
44 | (add-to-list 'auto-mode-alist '("\\.as[cp]x\\'" . web-mode))
45 | (add-to-list 'auto-mode-alist '("\\.erb\\'" . web-mode))
46 | (add-to-list 'auto-mode-alist '("\\.html?\\'" . web-mode))
47 | (add-to-list 'auto-mode-alist
48 | '("/\\(views\\|html\\|theme\\|templates\\)/.*\\.php\\'" . web-mode))
49 |
50 | ;; make web-mode play nice with smartparens
51 | (setq web-mode-enable-auto-pairing nil)
52 |
53 | (sp-with-modes '(web-mode)
54 | (sp-local-pair "%" "%"
55 | :unless '(sp-in-string-p)
56 | :post-handlers '(((lambda (&rest _ignored)
57 | (just-one-space)
58 | (save-excursion (insert " ")))
59 | "SPC" "=" "#")))
60 | (sp-local-pair "<% " " %>" :insert "C-c %")
61 | (sp-local-pair "<%= " " %>" :insert "C-c =")
62 | (sp-local-pair "<%# " " %>" :insert "C-c #")
63 | (sp-local-tag "%" "<% " " %>")
64 | (sp-local-tag "=" "<%= " " %>")
65 | (sp-local-tag "#" "<%# " " %>"))
66 |
67 | (eval-after-load 'web-mode
68 | '(progn
69 | (defun prelude-web-mode-defaults ())
70 | (setq prelude-web-mode-hook 'prelude-web-mode-defaults)
71 |
72 | (add-hook 'web-mode-hook (lambda ()
73 | (run-hooks 'prelude-web-mode-hook)))))
74 |
75 | (provide 'prelude-web)
76 | ;;; prelude-web.el ends here
77 |
--------------------------------------------------------------------------------
/modules/prelude-common-lisp.el:
--------------------------------------------------------------------------------
1 | ;;; prelude-common-lisp.el --- Emacs Prelude: lisp-mode and SLIME config.
2 | ;;
3 | ;; Copyright © 2011-2014 Bozhidar Batsov
4 | ;;
5 | ;; Author: Bozhidar Batsov
6 | ;; URL: https://github.com/bbatsov/prelude
7 | ;; Version: 1.0.0
8 | ;; Keywords: convenience
9 |
10 | ;; This file is not part of GNU Emacs.
11 |
12 | ;;; Commentary:
13 |
14 | ;; Configuration for lisp-mode and SLIME.
15 |
16 | ;;; License:
17 |
18 | ;; This program is free software; you can redistribute it and/or
19 | ;; modify it under the terms of the GNU General Public License
20 | ;; as published by the Free Software Foundation; either version 3
21 | ;; of the License, or (at your option) any later version.
22 | ;;
23 | ;; This program is distributed in the hope that it will be useful,
24 | ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
25 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
26 | ;; GNU General Public License for more details.
27 | ;;
28 | ;; You should have received a copy of the GNU General Public License
29 | ;; along with GNU Emacs; see the file COPYING. If not, write to the
30 | ;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
31 | ;; Boston, MA 02110-1301, USA.
32 |
33 | ;;; Code:
34 |
35 | (require 'prelude-lisp)
36 |
37 | (prelude-require-package 'slime)
38 |
39 | ;; the SBCL configuration file is in Common Lisp
40 | (add-to-list 'auto-mode-alist '("\\.sbclrc\\'" . lisp-mode))
41 |
42 | ;; Open files with .cl extension in lisp-mode
43 | (add-to-list 'auto-mode-alist '("\\.cl\\'" . lisp-mode))
44 |
45 | ;; a list of alternative Common Lisp implementations that can be
46 | ;; used with SLIME. Note that their presence render
47 | ;; inferior-lisp-program useless. This variable holds a list of
48 | ;; programs and if you invoke SLIME with a negative prefix
49 | ;; argument, M-- M-x slime, you can select a program from that list.
50 | (setq slime-lisp-implementations
51 | '((ccl ("ccl"))
52 | (clisp ("clisp" "-q"))
53 | (cmucl ("cmucl" "-quiet"))
54 | (sbcl ("sbcl" "--noinform") :coding-system utf-8-unix)))
55 |
56 | ;; select the default value from slime-lisp-implementations
57 | (if (eq system-type 'darwin)
58 | ;; default to Clozure CL on OS X
59 | (setq slime-default-lisp 'ccl)
60 | ;; default to SBCL on Linux and Windows
61 | (setq slime-default-lisp 'sbcl))
62 |
63 | (add-hook 'lisp-mode-hook (lambda () (run-hooks 'prelude-lisp-coding-hook)))
64 | (add-hook 'slime-repl-mode-hook (lambda () (run-hooks 'prelude-interactive-lisp-coding-hook)))
65 |
66 | (eval-after-load "slime"
67 | '(progn
68 | (setq slime-complete-symbol-function 'slime-fuzzy-complete-symbol
69 | slime-fuzzy-completion-in-place t
70 | slime-enable-evaluate-in-emacs t
71 | slime-autodoc-use-multiline-p t
72 | slime-auto-start 'always)
73 |
74 | (define-key slime-mode-map (kbd "TAB") 'slime-indent-and-complete-symbol)
75 | (define-key slime-mode-map (kbd "C-c C-s") 'slime-selector)))
76 |
77 | (provide 'prelude-common-lisp)
78 |
79 | ;;; prelude-common-lisp.el ends here
80 |
--------------------------------------------------------------------------------
/modules/prelude-latex.el:
--------------------------------------------------------------------------------
1 | ;;; prelude-latex.el --- Emacs Prelude: Sane setup for LaTeX writers.
2 | ;;
3 | ;; Copyright © 2011-2014 Bozhidar Batsov
4 | ;;
5 | ;; Author: Bozhidar Batsov
6 | ;; URL: https://github.com/bbatsov/prelude
7 | ;; Version: 1.0.0
8 | ;; Keywords: convenience
9 |
10 | ;; This file is not part of GNU Emacs.
11 |
12 | ;;; Commentary:
13 |
14 | ;; Nice defaults for the premium LaTeX editing mode auctex.
15 |
16 | ;;; License:
17 |
18 | ;; This program is free software; you can redistribute it and/or
19 | ;; modify it under the terms of the GNU General Public License
20 | ;; as published by the Free Software Foundation; either version 3
21 | ;; of the License, or (at your option) any later version.
22 | ;;
23 | ;; This program is distributed in the hope that it will be useful,
24 | ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
25 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
26 | ;; GNU General Public License for more details.
27 | ;;
28 | ;; You should have received a copy of the GNU General Public License
29 | ;; along with GNU Emacs; see the file COPYING. If not, write to the
30 | ;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
31 | ;; Boston, MA 02110-1301, USA.
32 |
33 | ;;; Code:
34 |
35 | (prelude-require-packages '(auctex cdlatex))
36 | (require 'smartparens-latex)
37 | ;; for case
38 | (require 'cl)
39 |
40 | (eval-after-load "company"
41 | '(progn
42 | (prelude-require-packages '(company-auctex))
43 | (company-auctex-init)))
44 |
45 | (defcustom prelude-latex-fast-math-entry 'LaTeX-math-mode
46 | "Method used for fast math symbol entry in LaTeX."
47 | :link '(function-link :tag "AUCTeX Math Mode" LaTeX-math-mode)
48 | :link '(emacs-commentary-link :tag "CDLaTeX" "cdlatex.el")
49 | :group 'prelude
50 | :type '(choice (const :tag "None" nil)
51 | (const :tag "AUCTeX Math Mode" LaTeX-math-mode)
52 | (const :tag "CDLaTeX" cdlatex)))
53 |
54 | ;; AUCTeX configuration
55 | (setq TeX-auto-save t)
56 | (setq TeX-parse-self t)
57 |
58 | (setq-default TeX-master nil)
59 |
60 | ;; use pdflatex
61 | (setq TeX-PDF-mode t)
62 |
63 | ;; sensible defaults for OS X, other OSes should be covered out-of-the-box
64 | (when (eq system-type 'darwin)
65 | (setq TeX-view-program-selection
66 | '((output-dvi "DVI Viewer")
67 | (output-pdf "PDF Viewer")
68 | (output-html "HTML Viewer")))
69 |
70 | (setq TeX-view-program-list
71 | '(("DVI Viewer" "open %o")
72 | ("PDF Viewer" "open %o")
73 | ("HTML Viewer" "open %o"))))
74 |
75 | (defun prelude-latex-mode-defaults ()
76 | "Default Prelude hook for `LaTeX-mode'."
77 | (turn-on-auto-fill)
78 | (abbrev-mode +1)
79 | (smartparens-mode +1)
80 | (case prelude-latex-fast-math-entry
81 | (LaTeX-math-mode (LaTeX-math-mode 1))
82 | (cdlatex (turn-on-cdlatex))))
83 |
84 | (setq prelude-latex-mode-hook 'prelude-latex-mode-defaults)
85 |
86 | (add-hook 'LaTeX-mode-hook (lambda ()
87 | (run-hooks 'prelude-latex-mode-hook)))
88 |
89 | (provide 'prelude-latex)
90 |
91 | ;;; prelude-latex.el ends here
92 |
--------------------------------------------------------------------------------
/modules/prelude-ruby.el:
--------------------------------------------------------------------------------
1 | ;;; prelude-ruby.el --- Emacs Prelude: A nice setup for Ruby (and Rails) devs.
2 | ;;
3 | ;; Copyright © 2011-2014 Bozhidar Batsov
4 | ;;
5 | ;; Author: Bozhidar Batsov
6 | ;; URL: https://github.com/bbatsov/prelude
7 | ;; Version: 1.0.0
8 | ;; Keywords: convenience
9 |
10 | ;; This file is not part of GNU Emacs.
11 |
12 | ;;; Commentary:
13 |
14 | ;; Some basic configuration for Ruby and Rails development.
15 |
16 | ;;; License:
17 |
18 | ;; This program is free software; you can redistribute it and/or
19 | ;; modify it under the terms of the GNU General Public License
20 | ;; as published by the Free Software Foundation; either version 3
21 | ;; of the License, or (at your option) any later version.
22 | ;;
23 | ;; This program is distributed in the hope that it will be useful,
24 | ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
25 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
26 | ;; GNU General Public License for more details.
27 | ;;
28 | ;; You should have received a copy of the GNU General Public License
29 | ;; along with GNU Emacs; see the file COPYING. If not, write to the
30 | ;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
31 | ;; Boston, MA 02110-1301, USA.
32 |
33 | ;;; Code:
34 |
35 | (require 'prelude-programming)
36 |
37 | (prelude-require-packages '(ruby-tools inf-ruby yari))
38 |
39 | ;; Rake files are ruby, too, as are gemspecs, rackup files, and gemfiles.
40 | (add-to-list 'auto-mode-alist '("\\.rake\\'" . ruby-mode))
41 | (add-to-list 'auto-mode-alist '("Rakefile\\'" . ruby-mode))
42 | (add-to-list 'auto-mode-alist '("\\.gemspec\\'" . ruby-mode))
43 | (add-to-list 'auto-mode-alist '("\\.ru\\'" . ruby-mode))
44 | (add-to-list 'auto-mode-alist '("Gemfile\\'" . ruby-mode))
45 | (add-to-list 'auto-mode-alist '("Guardfile\\'" . ruby-mode))
46 | (add-to-list 'auto-mode-alist '("Capfile\\'" . ruby-mode))
47 | (add-to-list 'auto-mode-alist '("\\.thor\\'" . ruby-mode))
48 | (add-to-list 'auto-mode-alist '("\\.rabl\\'" . ruby-mode))
49 | (add-to-list 'auto-mode-alist '("Thorfile\\'" . ruby-mode))
50 | (add-to-list 'auto-mode-alist '("Vagrantfile\\'" . ruby-mode))
51 | (add-to-list 'auto-mode-alist '("\\.jbuilder\\'" . ruby-mode))
52 | (add-to-list 'auto-mode-alist '("Podfile\\'" . ruby-mode))
53 | (add-to-list 'auto-mode-alist '("\\.podspec\\'" . ruby-mode))
54 | (add-to-list 'auto-mode-alist '("Puppetfile\\'" . ruby-mode))
55 | (add-to-list 'auto-mode-alist '("Berksfile\\'" . ruby-mode))
56 | (add-to-list 'auto-mode-alist '("Appraisals\\'" . ruby-mode))
57 |
58 | ;; We never want to edit Rubinius bytecode
59 | (add-to-list 'completion-ignored-extensions ".rbc")
60 |
61 | (define-key 'help-command (kbd "R") 'yari)
62 |
63 | (eval-after-load 'ruby-mode
64 | '(progn
65 | (defun prelude-ruby-mode-defaults ()
66 | (inf-ruby-minor-mode +1)
67 | (ruby-tools-mode +1)
68 | ;; CamelCase aware editing operations
69 | (subword-mode +1))
70 |
71 | (setq prelude-ruby-mode-hook 'prelude-ruby-mode-defaults)
72 |
73 | (add-hook 'ruby-mode-hook (lambda ()
74 | (run-hooks 'prelude-ruby-mode-hook)))))
75 |
76 | (provide 'prelude-ruby)
77 | ;;; prelude-ruby.el ends here
78 |
--------------------------------------------------------------------------------
/modules/prelude-go.el:
--------------------------------------------------------------------------------
1 | ;;; prelude-go.el --- Emacs Prelude: Go programming support.
2 | ;;
3 | ;; Author: Doug MacEachern
4 | ;; Version: 1.0.0
5 | ;; Keywords: convenience go
6 |
7 | ;; This file is not part of GNU Emacs.
8 |
9 | ;;; Commentary:
10 |
11 | ;; Prelude configuration for Go
12 |
13 | ;;; License:
14 |
15 | ;; This program is free software; you can redistribute it and/or
16 | ;; modify it under the terms of the GNU General Public License
17 | ;; as published by the Free Software Foundation; either version 3
18 | ;; of the License, or (at your option) any later version.
19 | ;;
20 | ;; This program is distributed in the hope that it will be useful,
21 | ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
22 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23 | ;; GNU General Public License for more details.
24 | ;;
25 | ;; You should have received a copy of the GNU General Public License
26 | ;; along with GNU Emacs; see the file COPYING. If not, write to the
27 | ;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
28 | ;; Boston, MA 02110-1301, USA.
29 |
30 | ;;; Code:
31 |
32 | (require 'prelude-programming)
33 |
34 | (prelude-require-packages '(go-mode
35 | company-go
36 | go-eldoc
37 | go-projectile
38 | gotest))
39 |
40 | (require 'go-projectile)
41 |
42 | ;; Ignore go test -c output files
43 | (add-to-list 'completion-ignored-extensions ".test")
44 |
45 | (define-key 'help-command (kbd "G") 'godoc)
46 |
47 | (eval-after-load 'go-mode
48 | '(progn
49 | (defun prelude-go-mode-defaults ()
50 | ;; Add to default go-mode key bindings
51 | (let ((map go-mode-map))
52 | (define-key map (kbd "C-c a") 'go-test-current-project) ;; current package, really
53 | (define-key map (kbd "C-c m") 'go-test-current-file)
54 | (define-key map (kbd "C-c .") 'go-test-current-test)
55 | (define-key map (kbd "C-c b") 'go-run)
56 | (define-key map (kbd "C-h f") 'godoc-at-point))
57 |
58 | ;; Prefer goimports to gofmt if installed
59 | (let ((goimports (executable-find "goimports")))
60 | (when goimports
61 | (setq gofmt-command goimports)))
62 |
63 | ;; gofmt on save
64 | (add-hook 'before-save-hook 'gofmt-before-save nil t)
65 |
66 | ;; stop whitespace being highlighted
67 | (whitespace-toggle-options '(tabs))
68 |
69 | ;; Company mode settings
70 | (set (make-local-variable 'company-backends) '(company-go))
71 |
72 | ;; El-doc for Go
73 | (go-eldoc-setup)
74 |
75 | ;; CamelCase aware editing operations
76 | (subword-mode +1))
77 |
78 | (setq prelude-go-mode-hook 'prelude-go-mode-defaults)
79 |
80 | (add-hook 'go-mode-hook (lambda ()
81 | (run-hooks 'prelude-go-mode-hook)))
82 |
83 | ;; Enable go-oracle-mode if available
84 | (let ((oracle (executable-find "oracle")))
85 | (when oracle
86 | (setq go-oracle-command oracle)
87 | (autoload 'go-oracle-mode "oracle")
88 | (add-hook 'go-mode-hook 'go-oracle-mode)))))
89 |
90 | (provide 'prelude-go)
91 | ;;; prelude-go.el ends here
92 |
--------------------------------------------------------------------------------
/modules/prelude-programming.el:
--------------------------------------------------------------------------------
1 | ;;; prelude-programming.el --- Emacs Prelude: prog-mode configuration
2 | ;;
3 | ;; Copyright © 2011-2014 Bozhidar Batsov
4 | ;;
5 | ;; Author: Bozhidar Batsov
6 | ;; URL: https://github.com/bbatsov/prelude
7 | ;; Version: 1.0.0
8 | ;; Keywords: convenience
9 |
10 | ;; This file is not part of GNU Emacs.
11 |
12 | ;;; Commentary:
13 |
14 | ;; Some basic prog-mode configuration and programming related utilities.
15 |
16 | ;;; License:
17 |
18 | ;; This program is free software; you can redistribute it and/or
19 | ;; modify it under the terms of the GNU General Public License
20 | ;; as published by the Free Software Foundation; either version 3
21 | ;; of the License, or (at your option) any later version.
22 | ;;
23 | ;; This program is distributed in the hope that it will be useful,
24 | ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
25 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
26 | ;; GNU General Public License for more details.
27 | ;;
28 | ;; You should have received a copy of the GNU General Public License
29 | ;; along with GNU Emacs; see the file COPYING. If not, write to the
30 | ;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
31 | ;; Boston, MA 02110-1301, USA.
32 |
33 | ;;; Code:
34 |
35 | (prelude-require-packages '(guru-mode))
36 |
37 | (defun prelude-local-comment-auto-fill ()
38 | (set (make-local-variable 'comment-auto-fill-only-comments) t))
39 |
40 | (defun prelude-font-lock-comment-annotations ()
41 | "Highlight a bunch of well known comment annotations.
42 |
43 | This functions should be added to the hooks of major modes for programming."
44 | (font-lock-add-keywords
45 | nil '(("\\<\\(\\(FIX\\(ME\\)?\\|TODO\\|OPTIMIZE\\|HACK\\|REFACTOR\\):\\)"
46 | 1 font-lock-warning-face t))))
47 |
48 | ;; show the name of the current function definition in the modeline
49 | (require 'which-func)
50 | (which-function-mode 1)
51 |
52 | ;; in Emacs 24 programming major modes generally derive from a common
53 | ;; mode named prog-mode; for others, we'll arrange for our mode
54 | ;; defaults function to run prelude-prog-mode-hook directly. To
55 | ;; augment and/or counteract these defaults your own function
56 | ;; to prelude-prog-mode-hook, using:
57 | ;;
58 | ;; (add-hook 'prelude-prog-mode-hook 'my-prog-mode-defaults t)
59 | ;;
60 | ;; (the final optional t sets the *append* argument)
61 |
62 | ;; smart curly braces
63 | (sp-pair "{" nil :post-handlers
64 | '(((lambda (&rest _ignored)
65 | (prelude-smart-open-line-above)) "RET")))
66 |
67 | ;; enlist a more liberal guru
68 | (setq guru-warn-only t)
69 |
70 | (defun prelude-prog-mode-defaults ()
71 | "Default coding hook, useful with any programming language."
72 | (when (and (executable-find ispell-program-name)
73 | prelude-flyspell)
74 | (flyspell-prog-mode))
75 | (when prelude-guru
76 | (guru-mode +1))
77 | (smartparens-mode +1)
78 | (prelude-enable-whitespace)
79 | (prelude-local-comment-auto-fill)
80 | (prelude-font-lock-comment-annotations))
81 |
82 | (setq prelude-prog-mode-hook 'prelude-prog-mode-defaults)
83 |
84 | (add-hook 'prog-mode-hook (lambda ()
85 | (run-hooks 'prelude-prog-mode-hook)))
86 |
87 | ;; enable on-the-fly syntax checking
88 | (if (fboundp 'global-flycheck-mode)
89 | (global-flycheck-mode +1)
90 | (add-hook 'prog-mode-hook 'flycheck-mode))
91 |
92 | (provide 'prelude-programming)
93 | ;;; prelude-programming.el ends here
94 |
--------------------------------------------------------------------------------
/modules/prelude-ocaml.el:
--------------------------------------------------------------------------------
1 | ;;; prelude-ocaml.el --- Emacs Prelude: decent Perl coding settings.
2 | ;;
3 | ;; Copyright © 2014 Geoff Shannon
4 | ;;
5 | ;; Author: Geoff Shannon
6 | ;; URL: https://github.com/bbatsov/prelude
7 | ;; Version: 1.0.0
8 | ;; Keywords: convenience
9 |
10 | ;; This file is not part of GNU Emacs.
11 |
12 | ;;; Commentary:
13 |
14 | ;; tuareg is the preferred ocaml mode for Emacs
15 |
16 | ;; These setups for ocaml assume that you are using the OPAM package
17 | ;; manager (http://opam.ocaml.org/).
18 |
19 | ;; Because of the apparent complexity of getting emacs environment
20 | ;; variables setup to use opam correctly, it is instead easier to use
21 | ;; opam itself to execute any necessary commands.
22 |
23 | ;; Also, the standard OCaml toplevel usage has been replaced in favor
24 | ;; of UTOP, the universal toplevel, and we assume that you are using
25 | ;; the Jane Street Core libraries rather than the regular OCaml
26 | ;; standard libraries
27 |
28 | ;; The minimum required setup for using Prelude's OCaml setup would be
29 | ;; to install OPAM, and then, minimally `opam install core utop'. A
30 | ;; good getting started guide is available at
31 | ;; https://github.com/realworldocaml/book/wiki/Installation-Instructions
32 |
33 | ;;; License:
34 |
35 | ;; This program is free software; you can redistribute it and/or
36 | ;; modify it under the terms of the GNU General Public License
37 | ;; as published by the Free Software Foundation; either version 3
38 | ;; of the License, or (at your option) any later version.
39 | ;;
40 | ;; This program is distributed in the hope that it will be useful,
41 | ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
42 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
43 | ;; GNU General Public License for more details.
44 | ;;
45 | ;; You should have received a copy of the GNU General Public License
46 | ;; along with GNU Emacs; see the file COPYING. If not, write to the
47 | ;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
48 | ;; Boston, MA 02110-1301, USA.
49 |
50 | ;;; Code:
51 |
52 | (prelude-require-packages '(tuareg utop merlin flycheck-ocaml))
53 |
54 | (require 'tuareg)
55 | (require 'utop)
56 | (require 'merlin)
57 |
58 | (setq auto-mode-alist
59 | (append '(("\\.ml[ily]?\\'" . tuareg-mode)
60 | ("\\.topml\\'" . tuareg-mode))
61 | auto-mode-alist))
62 |
63 | (with-eval-after-load 'merlin
64 | ;; Disable Merlin's own error checking
65 | (setq merlin-error-after-save nil)
66 |
67 | ;; Enable Flycheck checker
68 | (flycheck-ocaml-setup))
69 |
70 | (add-hook 'tuareg-mode-hook #'utop-setup-ocaml-buffer)
71 | (add-hook 'tuareg-mode-hook #'merlin-mode)
72 |
73 | (add-hook 'tuareg-mode-hook (lambda ()
74 | (progn
75 | (define-key tuareg-mode-map (kbd "C-c C-s")
76 | 'utop)
77 | (setq compile-command
78 | "opam config exec corebuild "))))
79 |
80 | ;; Setup merlin completions company is used by default in prelude
81 | (add-to-list 'company-backends 'merlin-company-backend)
82 |
83 | ;; Merlin also offers support for autocomplete, uncomment this next line
84 | ;; to activate it.
85 | ;; (setq merlin-use-auto-complete-mode t)
86 |
87 | (setq utop-command "opam config exec utop -- -emacs"
88 | merlin-error-after-save nil)
89 |
90 | (provide 'prelude-ocaml)
91 |
92 | ;;; prelude-ocaml.el ends here
93 |
--------------------------------------------------------------------------------
/core/prelude-custom.el:
--------------------------------------------------------------------------------
1 | ;;; prelude-custom.el --- Emacs Prelude: Prelude's customizable variables.
2 | ;;
3 | ;; Copyright © 2011-2014 Bozhidar Batsov
4 | ;;
5 | ;; Author: Bozhidar Batsov
6 | ;; URL: https://github.com/bbatsov/prelude
7 | ;; Version: 1.0.0
8 | ;; Keywords: convenience
9 |
10 | ;; This file is not part of GNU Emacs.
11 |
12 | ;;; Commentary:
13 |
14 | ;; Refinements of the core editing experience in Emacs.
15 |
16 | ;;; License:
17 |
18 | ;; This program is free software; you can redistribute it and/or
19 | ;; modify it under the terms of the GNU General Public License
20 | ;; as published by the Free Software Foundation; either version 3
21 | ;; of the License, or (at your option) any later version.
22 | ;;
23 | ;; This program is distributed in the hope that it will be useful,
24 | ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
25 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
26 | ;; GNU General Public License for more details.
27 | ;;
28 | ;; You should have received a copy of the GNU General Public License
29 | ;; along with GNU Emacs; see the file COPYING. If not, write to the
30 | ;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
31 | ;; Boston, MA 02110-1301, USA.
32 |
33 | ;;; Code:
34 |
35 | ;; customize
36 | (defgroup prelude nil
37 | "Emacs Prelude configuration."
38 | :prefix "prelude-"
39 | :group 'convenience)
40 |
41 | (defcustom prelude-auto-save t
42 | "Non-nil values enable Prelude's auto save."
43 | :type 'boolean
44 | :group 'prelude)
45 |
46 | (defcustom prelude-guru t
47 | "Non-nil values enable `guru-mode'."
48 | :type 'boolean
49 | :group 'prelude)
50 |
51 | (defcustom prelude-whitespace t
52 | "Non-nil values enable Prelude's whitespace visualization."
53 | :type 'boolean
54 | :group 'prelude)
55 |
56 | (defcustom prelude-clean-whitespace-on-save t
57 | "Cleanup whitespace from file before it's saved.
58 | Will only occur if `prelude-whitespace' is also enabled."
59 | :type 'boolean
60 | :group 'prelude)
61 |
62 | (defcustom prelude-flyspell t
63 | "Non-nil values enable Prelude's flyspell support."
64 | :type 'boolean
65 | :group 'prelude)
66 |
67 | (defcustom prelude-user-init-file (expand-file-name "personal/"
68 | user-emacs-directory)
69 | "Path to your personal customization file.
70 | Prelude recommends you only put personal customizations in the
71 | personal folder. This variable allows you to specify a specific
72 | folder as the one that should be visited when running
73 | `prelude-find-user-init-file'. This can be easily set to the desired buffer
74 | in lisp by putting `(setq prelude-user-init-file load-file-name)'
75 | in the desired elisp file."
76 | :type 'string
77 | :group 'prelude)
78 |
79 | (defcustom prelude-indent-sensitive-modes
80 | '(conf-mode coffee-mode haml-mode python-mode slim-mode yaml-mode)
81 | "Modes for which auto-indenting is suppressed."
82 | :type 'list
83 | :group 'prelude)
84 |
85 | (defcustom prelude-yank-indent-modes '(LaTeX-mode TeX-mode)
86 | "Modes in which to indent regions that are yanked (or yank-popped).
87 | Only modes that don't derive from `prog-mode' should be listed here."
88 | :type 'list
89 | :group 'prelude)
90 |
91 | (defcustom prelude-yank-indent-threshold 1000
92 | "Threshold (# chars) over which indentation does not automatically occur."
93 | :type 'number
94 | :group 'prelude)
95 |
96 | (defcustom prelude-theme 'zenburn
97 | "The default color theme, change this in your /personal/preload config."
98 | :type 'symbol
99 | :group 'prelude)
100 |
101 | (provide 'prelude-custom)
102 |
103 | ;;; prelude-custom.el ends here
104 |
--------------------------------------------------------------------------------
/modules/prelude-emacs-lisp.el:
--------------------------------------------------------------------------------
1 | ;;; prelude-emacs-lisp.el --- Emacs Prelude: Nice config for Elisp programming.
2 | ;;
3 | ;; Copyright © 2011-2014 Bozhidar Batsov
4 | ;;
5 | ;; Author: Bozhidar Batsov
6 | ;; URL: https://github.com/bbatsov/prelude
7 | ;; Version: 1.0.0
8 | ;; Keywords: convenience
9 | ;; Package-Requires: ((prelude-lisp "1.0.0"))
10 |
11 | ;; This file is not part of GNU Emacs.
12 |
13 | ;;; Commentary:
14 |
15 | ;; Nice config for Elisp Programming.
16 |
17 | ;;; License:
18 |
19 | ;; This program is free software; you can redistribute it and/or
20 | ;; modify it under the terms of the GNU General Public License
21 | ;; as published by the Free Software Foundation; either version 3
22 | ;; of the License, or (at your option) any later version.
23 | ;;
24 | ;; This program is distributed in the hope that it will be useful,
25 | ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
26 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
27 | ;; GNU General Public License for more details.
28 | ;;
29 | ;; You should have received a copy of the GNU General Public License
30 | ;; along with GNU Emacs; see the file COPYING. If not, write to the
31 | ;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
32 | ;; Boston, MA 02110-1301, USA.
33 |
34 | ;;; Code:
35 |
36 | (require 'prelude-lisp)
37 |
38 | (defun prelude-recompile-elc-on-save ()
39 | "Recompile your elc when saving an elisp file."
40 | (add-hook 'after-save-hook
41 | (lambda ()
42 | (when (and
43 | (string-prefix-p prelude-dir (file-truename buffer-file-name))
44 | (file-exists-p (byte-compile-dest-file buffer-file-name)))
45 | (emacs-lisp-byte-compile)))
46 | nil
47 | t))
48 |
49 | (defun prelude-visit-ielm ()
50 | "Switch to default `ielm' buffer.
51 | Start `ielm' if it's not already running."
52 | (interactive)
53 | (prelude-start-or-switch-to 'ielm "*ielm*"))
54 |
55 | (define-key emacs-lisp-mode-map (kbd "C-c C-z") 'prelude-visit-ielm)
56 | (define-key emacs-lisp-mode-map (kbd "C-c C-c") 'eval-defun)
57 | (define-key emacs-lisp-mode-map (kbd "C-c C-b") 'eval-buffer)
58 |
59 | (defun prelude-conditional-emacs-lisp-checker ()
60 | "Don't check doc style in Emacs Lisp test files."
61 | (let ((file-name (buffer-file-name)))
62 | (when (and file-name (string-match-p ".*-tests?\\.el\\'" file-name))
63 | (setq-local flycheck-checkers '(emacs-lisp)))))
64 |
65 | (defun prelude-emacs-lisp-mode-defaults ()
66 | "Sensible defaults for `emacs-lisp-mode'."
67 | (run-hooks 'prelude-lisp-coding-hook)
68 | (turn-on-eldoc-mode)
69 | (prelude-recompile-elc-on-save)
70 | (rainbow-mode +1)
71 | (setq mode-name "EL")
72 | (prelude-conditional-emacs-lisp-checker))
73 |
74 | (setq prelude-emacs-lisp-mode-hook 'prelude-emacs-lisp-mode-defaults)
75 |
76 | (add-hook 'emacs-lisp-mode-hook (lambda ()
77 | (run-hooks 'prelude-emacs-lisp-mode-hook)))
78 |
79 | (add-to-list 'auto-mode-alist '("Cask\\'" . emacs-lisp-mode))
80 |
81 | ;; ielm is an interactive Emacs Lisp shell
82 | (defun prelude-ielm-mode-defaults ()
83 | "Sensible defaults for `ielm'."
84 | (run-hooks 'prelude-interactive-lisp-coding-hook)
85 | (turn-on-eldoc-mode))
86 |
87 | (setq prelude-ielm-mode-hook 'prelude-ielm-mode-defaults)
88 |
89 | (add-hook 'ielm-mode-hook (lambda ()
90 | (run-hooks 'prelude-ielm-mode-hook)))
91 |
92 | (eval-after-load "elisp-slime-nav"
93 | '(diminish 'elisp-slime-nav-mode))
94 | (eval-after-load "rainbow-mode"
95 | '(diminish 'rainbow-mode))
96 | (eval-after-load "eldoc"
97 | '(diminish 'eldoc-mode))
98 |
99 | (eval-after-load "ielm"
100 | '(progn
101 | (define-key ielm-map (kbd "M-(") (prelude-wrap-with "("))
102 | (define-key ielm-map (kbd "M-\"") (prelude-wrap-with "\""))))
103 |
104 | ;; enable elisp-slime-nav-mode
105 | (dolist (hook '(emacs-lisp-mode-hook ielm-mode-hook))
106 | (add-hook hook 'elisp-slime-nav-mode))
107 |
108 | (defun conditionally-enable-smartparens-mode ()
109 | "Enable `smartparens-mode' in the minibuffer, during `eval-expression'."
110 | (if (eq this-command 'eval-expression)
111 | (smartparens-mode 1)))
112 |
113 | (add-hook 'minibuffer-setup-hook 'conditionally-enable-smartparens-mode)
114 |
115 | (provide 'prelude-emacs-lisp)
116 |
117 | ;;; prelude-emacs-lisp.el ends here
118 |
--------------------------------------------------------------------------------
/modules/prelude-python.el:
--------------------------------------------------------------------------------
1 | ;;; prelude-python.el --- Emacs Prelude: python.el configuration.
2 | ;;
3 | ;; Copyright © 2011-2014 Bozhidar Batsov
4 | ;;
5 | ;; Author: Bozhidar Batsov
6 | ;; URL: https://github.com/bbatsov/prelude
7 | ;; Version: 1.0.0
8 | ;; Keywords: convenience
9 |
10 | ;; This file is not part of GNU Emacs.
11 |
12 | ;;; Commentary:
13 |
14 | ;; Some basic configuration for python.el (the latest and greatest
15 | ;; Python mode Emacs has to offer).
16 |
17 | ;;; License:
18 |
19 | ;; This program is free software; you can redistribute it and/or
20 | ;; modify it under the terms of the GNU General Public License
21 | ;; as published by the Free Software Foundation; either version 3
22 | ;; of the License, or (at your option) any later version.
23 | ;;
24 | ;; This program is distributed in the hope that it will be useful,
25 | ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
26 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
27 | ;; GNU General Public License for more details.
28 | ;;
29 | ;; You should have received a copy of the GNU General Public License
30 | ;; along with GNU Emacs; see the file COPYING. If not, write to the
31 | ;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
32 | ;; Boston, MA 02110-1301, USA.
33 |
34 | ;;; Code:
35 |
36 | (prelude-require-package 'anaconda-mode)
37 |
38 | (when (boundp 'company-backends)
39 | (prelude-require-package 'company-anaconda)
40 | (add-to-list 'company-backends 'company-anaconda))
41 |
42 | (require 'electric)
43 | (require 'prelude-programming)
44 |
45 | ;; Copy pasted from ruby-mode.el
46 | (defun prelude-python--encoding-comment-required-p ()
47 | (re-search-forward "[^\0-\177]" nil t))
48 |
49 | (defun prelude-python--detect-encoding ()
50 | (let ((coding-system
51 | (or save-buffer-coding-system
52 | buffer-file-coding-system)))
53 | (if coding-system
54 | (symbol-name
55 | (or (coding-system-get coding-system 'mime-charset)
56 | (coding-system-change-eol-conversion coding-system nil)))
57 | "ascii-8bit")))
58 |
59 | (defun prelude-python--insert-coding-comment (encoding)
60 | (let ((newlines (if (looking-at "^\\s *$") "\n" "\n\n")))
61 | (insert (format "# coding: %s" encoding) newlines)))
62 |
63 | (defun prelude-python-mode-set-encoding ()
64 | "Insert a magic comment header with the proper encoding if necessary."
65 | (save-excursion
66 | (widen)
67 | (goto-char (point-min))
68 | (when (prelude-python--encoding-comment-required-p)
69 | (goto-char (point-min))
70 | (let ((coding-system (prelude-python--detect-encoding)))
71 | (when coding-system
72 | (if (looking-at "^#!") (beginning-of-line 2))
73 | (cond ((looking-at "\\s *#\\s *.*\\(en\\)?coding\\s *:\\s *\\([-a-z0-9_]*\\)")
74 | ;; update existing encoding comment if necessary
75 | (unless (string= (match-string 2) coding-system)
76 | (goto-char (match-beginning 2))
77 | (delete-region (point) (match-end 2))
78 | (insert coding-system)))
79 | ((looking-at "\\s *#.*coding\\s *[:=]"))
80 | (t (prelude-python--insert-coding-comment coding-system)))
81 | (when (buffer-modified-p)
82 | (basic-save-buffer-1)))))))
83 |
84 | (when (fboundp 'exec-path-from-shell-copy-env)
85 | (exec-path-from-shell-copy-env "PYTHONPATH"))
86 |
87 | (defun prelude-python-mode-defaults ()
88 | "Defaults for Python programming."
89 | (subword-mode +1)
90 | (anaconda-mode)
91 | (eldoc-mode)
92 | (setq-local electric-layout-rules
93 | '((?: . (lambda ()
94 | (and (zerop (first (syntax-ppss)))
95 | (python-info-statement-starts-block-p)
96 | 'after)))))
97 | (when (fboundp #'python-imenu-create-flat-index)
98 | (setq-local imenu-create-index-function
99 | #'python-imenu-create-flat-index))
100 | (add-hook 'post-self-insert-hook
101 | #'electric-layout-post-self-insert-function nil 'local)
102 | (add-hook 'after-save-hook 'prelude-python-mode-set-encoding nil 'local))
103 |
104 | (setq prelude-python-mode-hook 'prelude-python-mode-defaults)
105 |
106 | (add-hook 'python-mode-hook (lambda ()
107 | (run-hooks 'prelude-python-mode-hook)))
108 |
109 | (provide 'prelude-python)
110 |
111 | ;;; prelude-python.el ends here
112 |
--------------------------------------------------------------------------------
/core/prelude-global-keybindings.el:
--------------------------------------------------------------------------------
1 | ;;; prelude-global-keybindings.el --- Emacs Prelude: some useful keybindings.
2 | ;;
3 | ;; Copyright © 2011-2014 Bozhidar Batsov
4 | ;;
5 | ;; Author: Bozhidar Batsov
6 | ;; URL: https://github.com/bbatsov/prelude
7 | ;; Version: 1.0.0
8 | ;; Keywords: convenience
9 |
10 | ;; This file is not part of GNU Emacs.
11 |
12 | ;;; Commentary:
13 |
14 | ;; Lots of useful keybindings.
15 |
16 | ;;; License:
17 |
18 | ;; This program is free software; you can redistribute it and/or
19 | ;; modify it under the terms of the GNU General Public License
20 | ;; as published by the Free Software Foundation; either version 3
21 | ;; of the License, or (at your option) any later version.
22 | ;;
23 | ;; This program is distributed in the hope that it will be useful,
24 | ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
25 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
26 | ;; GNU General Public License for more details.
27 | ;;
28 | ;; You should have received a copy of the GNU General Public License
29 | ;; along with GNU Emacs; see the file COPYING. If not, write to the
30 | ;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
31 | ;; Boston, MA 02110-1301, USA.
32 |
33 | ;;; Code:
34 |
35 | ;; Align your code in a pretty way.
36 | (global-set-key (kbd "C-x \\") 'align-regexp)
37 |
38 | ;; Font size
39 | (global-set-key (kbd "C-+") 'text-scale-increase)
40 | (global-set-key (kbd "C--") 'text-scale-decrease)
41 |
42 | ;; Window switching. (C-x o goes to the next window)
43 | (global-set-key (kbd "C-x O") (lambda ()
44 | (interactive)
45 | (other-window -1))) ;; back one
46 |
47 | ;; Indentation help
48 | (global-set-key (kbd "C-^") 'prelude-top-join-line)
49 |
50 | ;; Start proced in a similar manner to dired
51 | (unless (eq system-type 'darwin)
52 | (global-set-key (kbd "C-x p") 'proced))
53 |
54 | ;; Start eshell or switch to it if it's active.
55 | (global-set-key (kbd "C-x m") 'eshell)
56 |
57 | ;; Start a new eshell even if one is active.
58 | (global-set-key (kbd "C-x M") (lambda () (interactive) (eshell t)))
59 |
60 | ;; Start a regular shell if you prefer that.
61 | (global-set-key (kbd "C-x M-m") 'shell)
62 |
63 | ;; If you want to be able to M-x without meta
64 | (global-set-key (kbd "C-x C-m") 'smex)
65 |
66 | ;; A complementary binding to the apropos-command (C-h a)
67 | (define-key 'help-command "A" 'apropos)
68 |
69 | ;; A quick major mode help with discover-my-major
70 | (define-key 'help-command (kbd "C-m") 'discover-my-major)
71 |
72 | (define-key 'help-command (kbd "C-f") 'find-function)
73 | (define-key 'help-command (kbd "C-k") 'find-function-on-key)
74 | (define-key 'help-command (kbd "C-v") 'find-variable)
75 | (define-key 'help-command (kbd "C-l") 'find-library)
76 |
77 | (define-key 'help-command (kbd "C-i") 'info-display-manual)
78 |
79 | ;; a complement to the zap-to-char command, that doesn't eat up the target character
80 | (autoload 'zap-up-to-char "misc" "Kill up to, but not including ARGth occurrence of CHAR.")
81 | (global-set-key (kbd "M-Z") 'zap-up-to-char)
82 |
83 | ;; kill lines backward
84 | (global-set-key (kbd "C-") (lambda ()
85 | (interactive)
86 | (kill-line 0)
87 | (indent-according-to-mode)))
88 |
89 | (global-set-key [remap kill-whole-line] 'prelude-kill-whole-line)
90 |
91 | ;; Activate occur easily inside isearch
92 | (define-key isearch-mode-map (kbd "C-o")
93 | (lambda () (interactive)
94 | (let ((case-fold-search isearch-case-fold-search))
95 | (occur (if isearch-regexp
96 | isearch-string
97 | (regexp-quote isearch-string))))))
98 |
99 | ;; use hippie-expand instead of dabbrev
100 | (global-set-key (kbd "M-/") 'hippie-expand)
101 |
102 | ;; replace buffer-menu with ibuffer
103 | (global-set-key (kbd "C-x C-b") 'ibuffer)
104 |
105 | (unless (fboundp 'toggle-frame-fullscreen)
106 | (global-set-key (kbd "") 'prelude-fullscreen))
107 |
108 | ;; toggle menu-bar visibility
109 | (global-set-key (kbd "") 'menu-bar-mode)
110 |
111 | (global-set-key (kbd "C-x g") 'magit-status)
112 |
113 | (global-set-key (kbd "C-=") 'er/expand-region)
114 |
115 | (global-set-key (kbd "C-c j") 'ace-jump-mode)
116 | (global-set-key (kbd "s-.") 'ace-jump-mode)
117 | (global-set-key (kbd "C-c J") 'ace-jump-buffer)
118 | (global-set-key (kbd "s->") 'ace-jump-buffer)
119 | (global-set-key (kbd "s-w") 'ace-window)
120 |
121 | (provide 'prelude-global-keybindings)
122 |
123 | ;;; prelude-global-keybindings.el ends here
124 |
--------------------------------------------------------------------------------
/abbrev_defs:
--------------------------------------------------------------------------------
1 | ;;-*-coding: utf-8;-*-
2 | (define-abbrev-table 'Buffer-menu-mode-abbrev-table '())
3 |
4 | (define-abbrev-table 'Info-edit-mode-abbrev-table '())
5 |
6 | (define-abbrev-table 'awk-mode-abbrev-table
7 | '(
8 | ))
9 |
10 | (define-abbrev-table 'bookmark-bmenu-mode-abbrev-table '())
11 |
12 | (define-abbrev-table 'bookmark-edit-annotation-mode-abbrev-table '())
13 |
14 | (define-abbrev-table 'browse-kill-ring-edit-mode-abbrev-table '())
15 |
16 | (define-abbrev-table 'browse-kill-ring-mode-abbrev-table '())
17 |
18 | (define-abbrev-table 'c++-mode-abbrev-table
19 | '(
20 | ))
21 |
22 | (define-abbrev-table 'c-mode-abbrev-table
23 | '(
24 | ))
25 |
26 | (define-abbrev-table 'calc-trail-mode-abbrev-table '())
27 |
28 | (define-abbrev-table 'change-log-mode-abbrev-table '())
29 |
30 | (define-abbrev-table 'comint-mode-abbrev-table '())
31 |
32 | (define-abbrev-table 'completion-list-mode-abbrev-table '())
33 |
34 | (define-abbrev-table 'diff-mode-abbrev-table '())
35 |
36 | (define-abbrev-table 'edit-abbrevs-mode-abbrev-table '())
37 |
38 | (define-abbrev-table 'emacs-lisp-byte-code-mode-abbrev-table '())
39 |
40 | (define-abbrev-table 'emacs-lisp-mode-abbrev-table '())
41 |
42 | (define-abbrev-table 'epa-info-mode-abbrev-table '())
43 |
44 | (define-abbrev-table 'epa-key-list-mode-abbrev-table '())
45 |
46 | (define-abbrev-table 'epa-key-mode-abbrev-table '())
47 |
48 | (define-abbrev-table 'erc-list-menu-mode-abbrev-table '())
49 |
50 | (define-abbrev-table 'erc-mode-abbrev-table '())
51 |
52 | (define-abbrev-table 'eshell-mode-abbrev-table '())
53 |
54 | (define-abbrev-table 'evil-command-window-mode-abbrev-table '())
55 |
56 | (define-abbrev-table 'flycheck-error-list-mode-abbrev-table '())
57 |
58 | (define-abbrev-table 'fundamental-mode-abbrev-table '())
59 |
60 | (define-abbrev-table 'git-commit-mode-abbrev-table '())
61 |
62 | (define-abbrev-table 'git-rebase-mode-abbrev-table '())
63 |
64 | (define-abbrev-table 'global-abbrev-table
65 | '(
66 | ("perche'" "perché" nil 1)
67 | ("poiche'" "poiché" nil 1)
68 | ("e'" "è" nil 1)
69 | ("piu'" "più" nil 1)
70 | ("pero'" "però" nil 1)
71 | ("puo'" "può" nil 1)
72 | ("senno'" "sennò" nil 1)
73 | ))
74 |
75 | (define-abbrev-table 'grep-mode-abbrev-table '())
76 |
77 | (define-abbrev-table 'help-mode-abbrev-table '())
78 |
79 | (define-abbrev-table 'html-mode-abbrev-table '())
80 |
81 | (define-abbrev-table 'ibuffer-mode-abbrev-table '())
82 |
83 | (define-abbrev-table 'idl-mode-abbrev-table '())
84 |
85 | (define-abbrev-table 'java-mode-abbrev-table
86 | '(
87 | ))
88 |
89 | (define-abbrev-table 'js2-mode-abbrev-table '())
90 |
91 | (define-abbrev-table 'lisp-mode-abbrev-table '())
92 |
93 | (define-abbrev-table 'log-edit-mode-abbrev-table '())
94 |
95 | (define-abbrev-table 'magit-branch-manager-mode-abbrev-table '())
96 |
97 | (define-abbrev-table 'magit-cherry-mode-abbrev-table '())
98 |
99 | (define-abbrev-table 'magit-commit-mode-abbrev-table '())
100 |
101 | (define-abbrev-table 'magit-diff-mode-abbrev-table '())
102 |
103 | (define-abbrev-table 'magit-log-mode-abbrev-table '())
104 |
105 | (define-abbrev-table 'magit-mode-abbrev-table '())
106 |
107 | (define-abbrev-table 'magit-process-mode-abbrev-table '())
108 |
109 | (define-abbrev-table 'magit-reflog-mode-abbrev-table '())
110 |
111 | (define-abbrev-table 'magit-status-mode-abbrev-table '())
112 |
113 | (define-abbrev-table 'magit-wazzup-mode-abbrev-table '())
114 |
115 | (define-abbrev-table 'message-mode-abbrev-table '())
116 |
117 | (define-abbrev-table 'messages-buffer-mode-abbrev-table '())
118 |
119 | (define-abbrev-table 'nxml-mode-abbrev-table '())
120 |
121 | (define-abbrev-table 'objc-mode-abbrev-table
122 | '(
123 | ))
124 |
125 | (define-abbrev-table 'occur-edit-mode-abbrev-table '())
126 |
127 | (define-abbrev-table 'occur-mode-abbrev-table '())
128 |
129 | (define-abbrev-table 'package-menu-mode-abbrev-table '())
130 |
131 | (define-abbrev-table 'pike-mode-abbrev-table
132 | '(
133 | ))
134 |
135 | (define-abbrev-table 'process-menu-mode-abbrev-table '())
136 |
137 | (define-abbrev-table 'prog-mode-abbrev-table '())
138 |
139 | (define-abbrev-table 'reb-lisp-mode-abbrev-table '())
140 |
141 | (define-abbrev-table 'reb-mode-abbrev-table '())
142 |
143 | (define-abbrev-table 'select-tags-table-mode-abbrev-table '())
144 |
145 | (define-abbrev-table 'sgml-mode-abbrev-table '())
146 |
147 | (define-abbrev-table 'sh-mode-abbrev-table '())
148 |
149 | (define-abbrev-table 'shell-mode-abbrev-table '())
150 |
151 | (define-abbrev-table 'special-mode-abbrev-table '())
152 |
153 | (define-abbrev-table 'tabulated-list-mode-abbrev-table '())
154 |
155 | (define-abbrev-table 'term-mode-abbrev-table '())
156 |
157 | (define-abbrev-table 'text-mode-abbrev-table '())
158 |
159 | (define-abbrev-table 'vc-dir-mode-abbrev-table '())
160 |
161 | (define-abbrev-table 'vc-git-log-edit-mode-abbrev-table '())
162 |
163 | (define-abbrev-table 'vc-git-log-view-mode-abbrev-table '())
164 |
165 |
--------------------------------------------------------------------------------
/modules/prelude-erc.el:
--------------------------------------------------------------------------------
1 | ;;; prelude-erc.el --- Emacs Prelude: ERC mode configuration.
2 | ;;
3 | ;; Copyright © 2011-2014 Bozhidar Batsov
4 | ;;
5 | ;; Author: Bozhidar Batsov
6 | ;; URL: https://github.com/bbatsov/prelude
7 | ;; Version: 1.0.0
8 | ;; Keywords: convenience
9 |
10 | ;; This file is not part of GNU Emacs.
11 |
12 | ;;; Commentary:
13 |
14 | ;; Some basic configuration for ERC mode, which should make your
15 | ;; IRC experience a bit more pleasant.
16 |
17 | ;;; License:
18 |
19 | ;; This program is free software; you can redistribute it and/or
20 | ;; modify it under the terms of the GNU General Public License
21 | ;; as published by the Free Software Foundation; either version 3
22 | ;; of the License, or (at your option) any later version.
23 | ;;
24 | ;; This program is distributed in the hope that it will be useful,
25 | ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
26 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
27 | ;; GNU General Public License for more details.
28 | ;;
29 | ;; You should have received a copy of the GNU General Public License
30 | ;; along with GNU Emacs; see the file COPYING. If not, write to the
31 | ;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
32 | ;; Boston, MA 02110-1301, USA.
33 |
34 | ;;; Code:
35 |
36 | (require 'erc)
37 | (require 'erc-log)
38 | (require 'erc-notify)
39 | (require 'erc-spelling)
40 | (require 'erc-autoaway)
41 |
42 | ;; Interpret mIRC-style color commands in IRC chats
43 | (setq erc-interpret-mirc-color t)
44 |
45 | ;; The following are commented out by default, but users of other
46 | ;; non-Emacs IRC clients might find them useful.
47 | ;; Kill buffers for channels after /part
48 | (setq erc-kill-buffer-on-part t)
49 | ;; Kill buffers for private queries after quitting the server
50 | (setq erc-kill-queries-on-quit t)
51 | ;; Kill buffers for server messages after quitting the server
52 | (setq erc-kill-server-buffer-on-quit t)
53 |
54 | ;; open query buffers in the current window
55 | (setq erc-query-display 'buffer)
56 |
57 | ;; exclude boring stuff from tracking
58 | (erc-track-mode t)
59 | (setq erc-track-exclude-types '("JOIN" "NICK" "PART" "QUIT" "MODE"
60 | "324" "329" "332" "333" "353" "477"))
61 |
62 | ;; logging
63 | (setq erc-log-channels-directory "~/.erc/logs/")
64 |
65 | (if (not (file-exists-p erc-log-channels-directory))
66 | (mkdir erc-log-channels-directory t))
67 |
68 | (setq erc-save-buffer-on-part t)
69 | ;; FIXME - this advice is wrong and is causing problems on Emacs exit
70 | ;; (defadvice save-buffers-kill-emacs (before save-logs (arg) activate)
71 | ;; (save-some-buffers t (lambda () (when (eq major-mode 'erc-mode) t))))
72 |
73 | ;; truncate long irc buffers
74 | (erc-truncate-mode +1)
75 |
76 | ;; enable spell checking
77 | (erc-spelling-mode 1)
78 | ;; set different dictionaries by different servers/channels
79 | ;;(setq erc-spelling-dictionaries '(("#emacs" "american")))
80 |
81 | (defvar erc-notify-nick-alist nil
82 | "Alist of nicks and the last time they tried to trigger a
83 | notification")
84 |
85 | (defvar erc-notify-timeout 10
86 | "Number of seconds that must elapse between notifications from
87 | the same person.")
88 |
89 | (defun erc-notify-allowed-p (nick &optional delay)
90 | "Return non-nil if a notification should be made for NICK.
91 | If DELAY is specified, it will be the minimum time in seconds
92 | that can occur between two notifications. The default is
93 | `erc-notify-timeout'."
94 | (unless delay (setq delay erc-notify-timeout))
95 | (let ((cur-time (time-to-seconds (current-time)))
96 | (cur-assoc (assoc nick erc-notify-nick-alist))
97 | (last-time nil))
98 | (if cur-assoc
99 | (progn
100 | (setq last-time (cdr cur-assoc))
101 | (setcdr cur-assoc cur-time)
102 | (> (abs (- cur-time last-time)) delay))
103 | (push (cons nick cur-time) erc-notify-nick-alist)
104 | t)))
105 |
106 | ;; autoaway setup
107 | (setq erc-auto-discard-away t)
108 | (setq erc-autoaway-idle-seconds 600)
109 | (setq erc-autoaway-use-emacs-idle t)
110 |
111 | ;; utf-8 always and forever
112 | (setq erc-server-coding-system '(utf-8 . utf-8))
113 |
114 | (defun start-irc ()
115 | "Connect to IRC."
116 | (interactive)
117 | (when (y-or-n-p "Do you want to start IRC? ")
118 | (erc :server "irc.freenode.net" :port 6667 :nick erc-nick)))
119 |
120 | (defun filter-server-buffers ()
121 | (delq nil
122 | (mapcar
123 | (lambda (x) (and (erc-server-buffer-p x) x))
124 | (buffer-list))))
125 |
126 | (defun stop-irc ()
127 | "Disconnects from all irc servers"
128 | (interactive)
129 | (dolist (buffer (filter-server-buffers))
130 | (message "Server buffer: %s" (buffer-name buffer))
131 | (with-current-buffer buffer
132 | (erc-quit-server "Asta la vista"))))
133 |
134 | (setq erc-autojoin-channels-alist '(("freenode.net" "#prelude-emacs" "#projectile")))
135 |
136 | (provide 'prelude-erc)
137 |
138 | ;;; prelude-erc.el ends here
139 |
--------------------------------------------------------------------------------
/modules/prelude-evil.el:
--------------------------------------------------------------------------------
1 | ;;; prelude-evil.el --- Emacs Prelude: evil-mode configuration.
2 | ;;
3 | ;; Copyright © 2011-2014 Bozhidar Batsov
4 | ;;
5 | ;; Author: Bozhidar Batsov
6 | ;; URL: http://batsov.com/prelude
7 | ;; Version: 1.0.0
8 | ;; Keywords: convenience
9 |
10 | ;; This file is not part of GNU Emacs.
11 |
12 | ;;; Commentary:
13 |
14 | ;; Some basic configuration for evil-mode.
15 |
16 | ;;; License:
17 |
18 | ;; This program is free software; you can redistribute it and/or
19 | ;; modify it under the terms of the GNU General Public License
20 | ;; as published by the Free Software Foundation; either version 3
21 | ;; of the License, or (at your option) any later version.
22 | ;;
23 | ;; This program is distributed in the hope that it will be useful,
24 | ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
25 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
26 | ;; GNU General Public License for more details.
27 | ;;
28 | ;; You should have received a copy of the GNU General Public License
29 | ;; along with GNU Emacs; see the file COPYING. If not, write to the
30 | ;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
31 | ;; Boston, MA 02110-1301, USA.
32 |
33 | ;;; Code:
34 |
35 | ;;; goto-chg lets you use the g-; and g-, to go to recent changes
36 | ;;; evil-visualstar enables searching visual selection with *
37 | ;;; evil-numbers enables vim style numeric incrementing and decrementing
38 |
39 | (prelude-require-packages '(evil goto-chg evil-surround evil-visualstar evil-numbers))
40 |
41 | (require 'evil-visualstar)
42 |
43 | (setq evil-mode-line-format 'before)
44 |
45 | (setq evil-emacs-state-cursor '("red" box))
46 | (setq evil-normal-state-cursor '("gray" box))
47 | (setq evil-visual-state-cursor '("gray" box))
48 | (setq evil-insert-state-cursor '("gray" bar))
49 | (setq evil-motion-state-cursor '("gray" box))
50 |
51 | ;; prevent esc-key from translating to meta-key in terminal mode
52 | (setq evil-esc-delay 0)
53 |
54 | (evil-mode 1)
55 | (global-evil-surround-mode 1)
56 |
57 | (define-key evil-normal-state-map (kbd "C-A")
58 | 'evil-numbers/inc-at-pt)
59 | (define-key evil-normal-state-map (kbd "C-S-A")
60 | 'evil-numbers/dec-at-pt)
61 |
62 | ;;
63 | ;; Other useful Commands
64 | ;;
65 | (evil-ex-define-cmd "W" 'evil-write-all)
66 | (evil-ex-define-cmd "Tree" 'speedbar-get-focus)
67 | (evil-ex-define-cmd "linum" 'linum-mode)
68 | (evil-ex-define-cmd "Align" 'align-regexp)
69 |
70 | (defun prelude-yank-to-end-of-line ()
71 | "Yank to end of line."
72 | (interactive)
73 | (evil-yank (point) (point-at-eol)))
74 |
75 | (define-key evil-normal-state-map
76 | (kbd "Y") 'prelude-yank-to-end-of-line)
77 |
78 | (defun prelude-shift-left-visual ()
79 | "Shift left and restore visual selection."
80 | (interactive)
81 | (evil-shift-left (region-beginning) (region-end))
82 | (evil-normal-state)
83 | (evil-visual-restore))
84 |
85 | (defun prelude-shift-right-visual ()
86 | "Shift right and restore visual selection."
87 | (interactive)
88 | (evil-shift-right (region-beginning) (region-end))
89 | (evil-normal-state)
90 | (evil-visual-restore))
91 |
92 | (define-key evil-visual-state-map (kbd ">") 'prelude-shift-right-visual)
93 | (define-key evil-visual-state-map (kbd "<") 'prelude-shift-left-visual)
94 |
95 | ;; Scrolling
96 | (defun prelude-evil-scroll-down-other-window ()
97 | (interactive)
98 | (scroll-other-window))
99 |
100 | (defun prelude-evil-scroll-up-other-window ()
101 | (interactive)
102 | (scroll-other-window '-))
103 |
104 | (define-key evil-normal-state-map
105 | (kbd "C-S-d") 'prelude-evil-scroll-down-other-window)
106 |
107 | (define-key evil-normal-state-map
108 | (kbd "C-S-u") 'prelude-evil-scroll-up-other-window)
109 |
110 | ;;
111 | ;; Magit from avsej
112 | ;;
113 | (evil-add-hjkl-bindings magit-log-mode-map 'emacs)
114 | (evil-add-hjkl-bindings magit-commit-mode-map 'emacs)
115 | (evil-add-hjkl-bindings magit-branch-manager-mode-map 'emacs
116 | "K" 'magit-discard-item
117 | "L" 'magit-key-mode-popup-logging)
118 | (evil-add-hjkl-bindings magit-status-mode-map 'emacs
119 | "K" 'magit-discard-item
120 | "l" 'magit-key-mode-popup-logging
121 | "h" 'magit-toggle-diff-refine-hunk)
122 |
123 | (setq evil-shift-width 2)
124 |
125 | ;;; enable ace-jump mode with evil-mode
126 | (define-key evil-normal-state-map (kbd "SPC") 'ace-jump-mode)
127 |
128 | ;;; snagged from Eric S. Fraga
129 | ;;; http://lists.gnu.org/archive/html/emacs-orgmode/2012-05/msg00153.html
130 | (defun prelude-evil-key-bindings-for-org ()
131 | ;;(message "Defining evil key bindings for org")
132 | (evil-declare-key 'normal org-mode-map
133 | "gk" 'outline-up-heading
134 | "gj" 'outline-next-visible-heading
135 | "H" 'org-beginning-of-line ; smarter behaviour on headlines etc.
136 | "L" 'org-end-of-line ; smarter behaviour on headlines etc.
137 | "t" 'org-todo ; mark a TODO item as DONE
138 | ",c" 'org-cycle
139 | (kbd "TAB") 'org-cycle
140 | ",e" 'org-export-dispatch
141 | ",n" 'outline-next-visible-heading
142 | ",p" 'outline-previous-visible-heading
143 | ",t" 'org-set-tags-command
144 | ",u" 'outline-up-heading
145 | "$" 'org-end-of-line ; smarter behaviour on headlines etc.
146 | "^" 'org-beginning-of-line ; ditto
147 | "-" 'org-ctrl-c-minus ; change bullet style
148 | "<" 'org-metaleft ; out-dent
149 | ">" 'org-metaright ; indent
150 | ))
151 | (prelude-evil-key-bindings-for-org)
152 | (provide 'prelude-evil)
153 |
--------------------------------------------------------------------------------
/core/prelude-mode.el:
--------------------------------------------------------------------------------
1 | ;;; prelude-mode.el --- Emacs Prelude: minor mode
2 | ;;
3 | ;; Copyright © 2011-2014 Bozhidar Batsov
4 | ;;
5 | ;; Author: Bozhidar Batsov
6 | ;; URL: https://github.com/bbatsov/prelude
7 | ;; Version: 1.0.0
8 | ;; Keywords: convenience
9 |
10 | ;; This file is not part of GNU Emacs.
11 |
12 | ;;; Commentary:
13 |
14 | ;; A minor mode defining a local keymap, plus a menu.
15 |
16 | ;;; License:
17 |
18 | ;; This program is free software; you can redistribute it and/or
19 | ;; modify it under the terms of the GNU General Public License
20 | ;; as published by the Free Software Foundation; either version 3
21 | ;; of the License, or (at your option) any later version.
22 | ;;
23 | ;; This program is distributed in the hope that it will be useful,
24 | ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
25 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
26 | ;; GNU General Public License for more details.
27 | ;;
28 | ;; You should have received a copy of the GNU General Public License
29 | ;; along with GNU Emacs; see the file COPYING. If not, write to the
30 | ;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
31 | ;; Boston, MA 02110-1301, USA.
32 |
33 | ;;; Code:
34 | (require 'easymenu)
35 |
36 | (defvar prelude-mode-map
37 | (let ((map (make-sparse-keymap)))
38 | (define-key map (kbd "C-c o") 'prelude-open-with)
39 | (define-key map (kbd "C-c g") 'prelude-google)
40 | (define-key map (kbd "C-c G") 'prelude-github)
41 | (define-key map (kbd "C-c y") 'prelude-youtube)
42 | (define-key map (kbd "C-c U") 'prelude-duckduckgo)
43 | ;; mimic popular IDEs binding, note that it doesn't work in a terminal session
44 | (define-key map [(shift return)] 'prelude-smart-open-line)
45 | (define-key map (kbd "M-o") 'prelude-smart-open-line)
46 | (define-key map [(control shift return)] 'prelude-smart-open-line-above)
47 | (define-key map [(control shift up)] 'move-text-up)
48 | (define-key map [(control shift down)] 'move-text-down)
49 | (define-key map [(meta shift up)] 'move-text-up)
50 | (define-key map [(meta shift down)] 'move-text-down)
51 | (define-key map (kbd "C-c n") 'prelude-cleanup-buffer-or-region)
52 | (define-key map (kbd "C-c f") 'prelude-recentf-ido-find-file)
53 | (define-key map (kbd "C-M-z") 'prelude-indent-defun)
54 | (define-key map (kbd "C-c u") 'prelude-view-url)
55 | (define-key map (kbd "C-c e") 'prelude-eval-and-replace)
56 | (define-key map (kbd "C-c s") 'prelude-swap-windows)
57 | (define-key map (kbd "C-c D") 'prelude-delete-file-and-buffer)
58 | (define-key map (kbd "C-c d") 'prelude-duplicate-current-line-or-region)
59 | (define-key map (kbd "C-c M-d") 'prelude-duplicate-and-comment-current-line-or-region)
60 | (define-key map (kbd "C-c r") 'prelude-rename-buffer-and-file)
61 | (define-key map (kbd "C-c t") 'prelude-visit-term-buffer)
62 | (define-key map (kbd "C-c k") 'prelude-kill-other-buffers)
63 | (define-key map (kbd "C-c TAB") 'prelude-indent-rigidly-and-copy-to-clipboard)
64 | (define-key map (kbd "C-c I") 'prelude-find-user-init-file)
65 | (define-key map (kbd "C-c S") 'prelude-find-shell-init-file)
66 | (define-key map (kbd "C-c i") 'prelude-goto-symbol)
67 | ;; extra prefix for projectile
68 | (define-key map (kbd "s-p") 'projectile-command-map)
69 | ;; make some use of the Super key
70 | (define-key map (kbd "s-g") 'god-local-mode)
71 | (define-key map (kbd "s-r") 'prelude-recentf-ido-find-file)
72 | (define-key map (kbd "s-j") 'prelude-top-join-line)
73 | (define-key map (kbd "s-k") 'prelude-kill-whole-line)
74 | (define-key map (kbd "s-m m") 'magit-status)
75 | (define-key map (kbd "s-m l") 'magit-log)
76 | (define-key map (kbd "s-m f") 'magit-file-log)
77 | (define-key map (kbd "s-m b") 'magit-blame-mode)
78 | (define-key map (kbd "s-o") 'prelude-smart-open-line-above)
79 |
80 | map)
81 | "Keymap for Prelude mode.")
82 |
83 | (defun prelude-mode-add-menu ()
84 | "Add a menu entry for `prelude-mode' under Tools."
85 | (easy-menu-add-item nil '("Tools")
86 | '("Prelude"
87 | ("Files"
88 | ["Open with..." prelude-open-with]
89 | ["Delete file and buffer" prelude-delete-file-and-buffer]
90 | ["Rename buffer and file" prelude-rename-buffer-and-file]
91 | ["Copy file name to clipboard" prelude-copy-file-name-to-clipboard])
92 |
93 | ("Buffers"
94 | ["Clean up buffer or region" prelude-cleanup-buffer-or-region]
95 | ["Kill other buffers" prelude-kill-other-buffers])
96 |
97 | ("Editing"
98 | ["Insert empty line" prelude-insert-empty-line]
99 | ["Move line up" prelude-move-line-up]
100 | ["Move line down" prelude-move-line-down]
101 | ["Duplicate line or region" prelude-duplicate-current-line-or-region]
102 | ["Indent rigidly and copy to clipboard" prelude-indent-rigidly-and-copy-to-clipboard]
103 | ["Insert date" prelude-insert-date]
104 | ["Eval and replace" prelude-eval-and-replace]
105 | )
106 |
107 | ("Windows"
108 | ["Swap windows" prelude-swap-windows])
109 |
110 | ("General"
111 | ["Visit term buffer" prelude-visit-term-buffer]
112 | ["Search in Google" prelude-google]
113 | ["View URL" prelude-view-url]))
114 | "Search Files (Grep)...")
115 |
116 | (easy-menu-add-item nil '("Tools") '("--") "Search Files (Grep)..."))
117 |
118 | (defun prelude-mode-remove-menu ()
119 | "Remove `prelude-mode' menu entry."
120 | (easy-menu-remove-item nil '("Tools") "Prelude")
121 | (easy-menu-remove-item nil '("Tools") "--"))
122 |
123 | ;; define minor mode
124 | (define-minor-mode prelude-mode
125 | "Minor mode to consolidate Emacs Prelude extensions.
126 |
127 | \\{prelude-mode-map}"
128 | :lighter " Pre"
129 | :keymap prelude-mode-map
130 | (if prelude-mode
131 | ;; on start
132 | (prelude-mode-add-menu)
133 | ;; on stop
134 | (prelude-mode-remove-menu)))
135 |
136 | (define-globalized-minor-mode prelude-global-mode prelude-mode prelude-on)
137 |
138 | (defun prelude-on ()
139 | "Turn on `prelude-mode'."
140 | (prelude-mode +1))
141 |
142 | (defun prelude-off ()
143 | "Turn off `prelude-mode'."
144 | (prelude-mode -1))
145 |
146 | (provide 'prelude-mode)
147 | ;;; prelude-mode.el ends here
148 |
--------------------------------------------------------------------------------
/core/prelude-packages.el:
--------------------------------------------------------------------------------
1 | ;;; prelude-packages.el --- Emacs Prelude: default package selection.
2 | ;;
3 | ;; Copyright © 2011-2014 Bozhidar Batsov
4 | ;;
5 | ;; Author: Bozhidar Batsov
6 | ;; URL: https://github.com/bbatsov/prelude
7 | ;; Version: 1.0.0
8 | ;; Keywords: convenience
9 |
10 | ;; This file is not part of GNU Emacs.
11 |
12 | ;;; Commentary:
13 |
14 | ;; Takes care of the automatic installation of all the packages required by
15 | ;; Emacs Prelude.
16 |
17 | ;;; License:
18 |
19 | ;; This program is free software; you can redistribute it and/or
20 | ;; modify it under the terms of the GNU General Public License
21 | ;; as published by the Free Software Foundation; either version 3
22 | ;; of the License, or (at your option) any later version.
23 | ;;
24 | ;; This program is distributed in the hope that it will be useful,
25 | ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
26 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
27 | ;; GNU General Public License for more details.
28 | ;;
29 | ;; You should have received a copy of the GNU General Public License
30 | ;; along with GNU Emacs; see the file COPYING. If not, write to the
31 | ;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
32 | ;; Boston, MA 02110-1301, USA.
33 |
34 | ;;; Code:
35 | (require 'cl)
36 | (require 'package)
37 |
38 | (add-to-list 'package-archives
39 | '("melpa" . "http://melpa.org/packages/") t)
40 | ;; set package-user-dir to be relative to Prelude install path
41 | (setq package-user-dir (expand-file-name "elpa" prelude-dir))
42 | (package-initialize)
43 |
44 | (defvar prelude-packages
45 | '(ace-jump-mode
46 | ace-jump-buffer
47 | ace-window
48 | ack-and-a-half
49 | anzu
50 | browse-kill-ring
51 | dash
52 | discover-my-major
53 | diff-hl
54 | diminish
55 | easy-kill
56 | elisp-slime-nav
57 | epl
58 | expand-region
59 | flycheck
60 | gist
61 | git-timemachine
62 | gitconfig-mode
63 | gitignore-mode
64 | god-mode
65 | grizzl
66 | guru-mode
67 | ov
68 | projectile
69 | magit
70 | move-text
71 | operate-on-number
72 | rainbow-mode
73 | smartparens
74 | smartrep
75 | undo-tree
76 | volatile-highlights
77 | zenburn-theme)
78 | "A list of packages to ensure are installed at launch.")
79 |
80 | (defun prelude-packages-installed-p ()
81 | "Check if all packages in `prelude-packages' are installed."
82 | (every #'package-installed-p prelude-packages))
83 |
84 | (defun prelude-require-package (package)
85 | "Install PACKAGE unless already installed."
86 | (unless (memq package prelude-packages)
87 | (add-to-list 'prelude-packages package))
88 | (unless (package-installed-p package)
89 | (package-install package)))
90 |
91 | (defun prelude-require-packages (packages)
92 | "Ensure PACKAGES are installed.
93 | Missing packages are installed automatically."
94 | (mapc #'prelude-require-package packages))
95 |
96 | (define-obsolete-function-alias 'prelude-ensure-module-deps 'prelude-require-packages)
97 |
98 | (defun prelude-install-packages ()
99 | "Install all packages listed in `prelude-packages'."
100 | (unless (prelude-packages-installed-p)
101 | ;; check for new packages (package versions)
102 | (message "%s" "Emacs Prelude is now refreshing its package database...")
103 | (package-refresh-contents)
104 | (message "%s" " done.")
105 | ;; install the missing packages
106 | (prelude-require-packages prelude-packages)))
107 |
108 | ;; run package installation
109 | (prelude-install-packages)
110 |
111 | (defun prelude-list-foreign-packages ()
112 | "Browse third-party packages not bundled with Prelude.
113 |
114 | Behaves similarly to `package-list-packages', but shows only the packages that
115 | are installed and are not in `prelude-packages'. Useful for
116 | removing unwanted packages."
117 | (interactive)
118 | (package-show-package-list
119 | (set-difference package-activated-list prelude-packages)))
120 |
121 | (defmacro prelude-auto-install (extension package mode)
122 | "When file with EXTENSION is opened triggers auto-install of PACKAGE.
123 | PACKAGE is installed only if not already present. The file is opened in MODE."
124 | `(add-to-list 'auto-mode-alist
125 | `(,extension . (lambda ()
126 | (unless (package-installed-p ',package)
127 | (package-install ',package))
128 | (,mode)))))
129 |
130 | (defvar prelude-auto-install-alist
131 | '(("\\.clj\\'" clojure-mode clojure-mode)
132 | ("\\.coffee\\'" coffee-mode coffee-mode)
133 | ("\\.css\\'" css-mode css-mode)
134 | ("\\.csv\\'" csv-mode csv-mode)
135 | ("\\.d\\'" d-mode d-mode)
136 | ("\\.dart\\'" dart-mode dart-mode)
137 | ("\\.ex\\'" elixir-mode elixir-mode)
138 | ("\\.exs\\'" elixir-mode elixir-mode)
139 | ("\\.elixir\\'" elixir-mode elixir-mode)
140 | ("\\.erl\\'" erlang erlang-mode)
141 | ("\\.feature\\'" feature-mode feature-mode)
142 | ("\\.go\\'" go-mode go-mode)
143 | ("\\.groovy\\'" groovy-mode groovy-mode)
144 | ("\\.haml\\'" haml-mode haml-mode)
145 | ("\\.hs\\'" haskell-mode haskell-mode)
146 | ("\\.kv\\'" kivy-mode kivy-mode)
147 | ("\\.latex\\'" auctex LaTeX-mode)
148 | ("\\.less\\'" less-css-mode less-css-mode)
149 | ("\\.lua\\'" lua-mode lua-mode)
150 | ("\\.markdown\\'" markdown-mode markdown-mode)
151 | ("\\.md\\'" markdown-mode markdown-mode)
152 | ("\\.ml\\'" tuareg tuareg-mode)
153 | ("\\.pp\\'" puppet-mode puppet-mode)
154 | ("\\.php\\'" php-mode php-mode)
155 | ("PKGBUILD\\'" pkgbuild-mode pkgbuild-mode)
156 | ("\\.rs\\'" rust-mode rust-mode)
157 | ("\\.sass\\'" sass-mode sass-mode)
158 | ("\\.scala\\'" scala-mode2 scala-mode)
159 | ("\\.scss\\'" scss-mode scss-mode)
160 | ("\\.slim\\'" slim-mode slim-mode)
161 | ("\\.swift\\'" swift-mode swift-mode)
162 | ("\\.textile\\'" textile-mode textile-mode)
163 | ("\\.thrift\\'" thrift thrift-mode)
164 | ("\\.yml\\'" yaml-mode yaml-mode)
165 | ("\\.yaml\\'" yaml-mode yaml-mode)
166 | ("Dockerfile\\'" dockerfile-mode dockerfile-mode)))
167 |
168 | ;; markdown-mode doesn't have autoloads for the auto-mode-alist
169 | ;; so we add them manually if it's already installed
170 | (when (package-installed-p 'markdown-mode)
171 | (add-to-list 'auto-mode-alist '("\\.markdown\\'" . markdown-mode))
172 | (add-to-list 'auto-mode-alist '("\\.md\\'" . markdown-mode)))
173 |
174 | (when (package-installed-p 'pkgbuild-mode)
175 | (add-to-list 'auto-mode-alist '("PKGBUILD\\'" . pkgbuild-mode)))
176 |
177 | ;; build auto-install mappings
178 | (mapc
179 | (lambda (entry)
180 | (let ((extension (car entry))
181 | (package (cadr entry))
182 | (mode (cadr (cdr entry))))
183 | (unless (package-installed-p package)
184 | (prelude-auto-install extension package mode))))
185 | prelude-auto-install-alist)
186 |
187 | (provide 'prelude-packages)
188 | ;; Local Variables:
189 | ;; byte-compile-warnings: (not cl-functions)
190 | ;; End:
191 |
192 | ;;; prelude-packages.el ends here
193 |
--------------------------------------------------------------------------------
/init.el:
--------------------------------------------------------------------------------
1 | ;;; init.el --- Prelude's configuration entry point.
2 | ;;
3 | ;; Copyright (c) 2011 Bozhidar Batsov
4 | ;;
5 | ;; Author: Bozhidar Batsov
6 | ;; URL: http://batsov.com/prelude
7 | ;; Version: 1.0.0
8 | ;; Keywords: convenience
9 |
10 | ;; This file is not part of GNU Emacs.
11 |
12 | ;;; Commentary:
13 |
14 | ;; This file simply sets up the default load path and requires
15 | ;; the various modules defined within Emacs Prelude.
16 |
17 | ;;; License:
18 |
19 | ;; This program is free software; you can redistribute it and/or
20 | ;; modify it under the terms of the GNU General Public License
21 | ;; as published by the Free Software Foundation; either version 3
22 | ;; of the License, or (at your option) any later version.
23 | ;;
24 | ;; This program is distributed in the hope that it will be useful,
25 | ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
26 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
27 | ;; GNU General Public License for more details.
28 | ;;
29 | ;; You should have received a copy of the GNU General Public License
30 | ;; along with GNU Emacs; see the file COPYING. If not, write to the
31 | ;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
32 | ;; Boston, MA 02110-1301, USA.
33 |
34 | ;;; Code:
35 | (defvar current-user
36 | (getenv
37 | (if (equal system-type 'windows-nt) "USERNAME" "USER")))
38 |
39 | (message "Prelude is powering up... Be patient, Master %s!" current-user)
40 |
41 | (when (version< emacs-version "24.1")
42 | (error "Prelude requires at least GNU Emacs 24.1, but you're running %s" emacs-version))
43 |
44 | ;; Always load newest byte code
45 | (setq load-prefer-newer t)
46 |
47 | (defvar prelude-dir (file-name-directory load-file-name)
48 | "The root dir of the Emacs Prelude distribution.")
49 | (defvar prelude-core-dir (expand-file-name "core" prelude-dir)
50 | "The home of Prelude's core functionality.")
51 | (defvar prelude-modules-dir (expand-file-name "modules" prelude-dir)
52 | "This directory houses all of the built-in Prelude modules.")
53 | (defvar prelude-personal-dir (expand-file-name "personal" prelude-dir)
54 | "This directory is for your personal configuration.
55 |
56 | Users of Emacs Prelude are encouraged to keep their personal configuration
57 | changes in this directory. All Emacs Lisp files there are loaded automatically
58 | by Prelude.")
59 | (defvar prelude-personal-preload-dir (expand-file-name "preload" prelude-personal-dir)
60 | "This directory is for your personal configuration, that you want loaded before Prelude.")
61 | (defvar prelude-vendor-dir (expand-file-name "vendor" prelude-dir)
62 | "This directory houses packages that are not yet available in ELPA (or MELPA).")
63 | (defvar prelude-savefile-dir (expand-file-name "savefile" prelude-dir)
64 | "This folder stores all the automatically generated save/history-files.")
65 | (defvar prelude-modules-file (expand-file-name "prelude-modules.el" prelude-dir)
66 | "This files contains a list of modules that will be loaded by Prelude.")
67 |
68 | (unless (file-exists-p prelude-savefile-dir)
69 | (make-directory prelude-savefile-dir))
70 |
71 | (defun prelude-add-subfolders-to-load-path (parent-dir)
72 | "Add all level PARENT-DIR subdirs to the `load-path'."
73 | (dolist (f (directory-files parent-dir))
74 | (let ((name (expand-file-name f parent-dir)))
75 | (when (and (file-directory-p name)
76 | (not (string-prefix-p "." f)))
77 | (add-to-list 'load-path name)
78 | (prelude-add-subfolders-to-load-path name)))))
79 |
80 | ;; add Prelude's directories to Emacs's `load-path'
81 | (add-to-list 'load-path prelude-core-dir)
82 | (add-to-list 'load-path prelude-modules-dir)
83 | (add-to-list 'load-path prelude-vendor-dir)
84 | (prelude-add-subfolders-to-load-path prelude-vendor-dir)
85 |
86 | ;; reduce the frequency of garbage collection by making it happen on
87 | ;; each 50MB of allocated data (the default is on every 0.76MB)
88 | (setq gc-cons-threshold 50000000)
89 |
90 | ;; warn when opening files bigger than 100MB
91 | (setq large-file-warning-threshold 100000000)
92 |
93 | ;; preload the personal settings from `prelude-personal-preload-dir'
94 | (when (file-exists-p prelude-personal-preload-dir)
95 | (message "Loading personal configuration files in %s..." prelude-personal-preload-dir)
96 | (mapc 'load (directory-files prelude-personal-preload-dir 't "^[^#].*el$")))
97 |
98 | (message "Loading Prelude's core...")
99 |
100 | ;; the core stuff
101 | (require 'prelude-packages)
102 | (require 'prelude-custom) ;; Needs to be loaded before core, editor and ui
103 | (require 'prelude-ui)
104 | (require 'prelude-core)
105 | (require 'prelude-mode)
106 | (require 'prelude-editor)
107 | (require 'prelude-global-keybindings)
108 |
109 | ;; OSX specific settings
110 | (when (eq system-type 'darwin)
111 | (require 'prelude-osx))
112 |
113 | (message "Loading Prelude's modules...")
114 |
115 | ;; the modules
116 | (when (file-exists-p prelude-modules-file)
117 | (load prelude-modules-file))
118 |
119 | ;; config changes made through the customize UI will be store here
120 | (setq custom-file (expand-file-name "custom.el" prelude-personal-dir))
121 |
122 | ;; load the personal settings (this includes `custom-file')
123 | (when (file-exists-p prelude-personal-dir)
124 | (message "Loading personal configuration files in %s..." prelude-personal-dir)
125 | (mapc 'load (directory-files prelude-personal-dir 't "^[^#].*el$")))
126 |
127 | (message "Prelude is ready to do thy bidding, Master %s!" current-user)
128 |
129 | (prelude-eval-after-init
130 | ;; greet the use with some useful tip
131 | (run-at-time 5 nil 'prelude-tip-of-the-day))
132 |
133 | ;;; init.el ends here
134 |
135 |
136 | ;;; MIO
137 |
138 | (auto-save-mode 0)
139 |
140 | (setq ispell-dictionary "american")
141 | (setq abbrev-file-name "~/.emacs.d/abbrev_defs") ;; tell emacs where to read abbrev
142 | (setq save-abbrevs t)
143 | (if (file-exists-p abbrev-file-name)
144 | (quietly-read-abbrev-file))
145 |
146 | (setq org-capture-templates
147 | (quote (("t" "todo" entry (file (concat org-directory "/gtd.org"))
148 | "* TODO %?\n%U\n%a\n" :clock-in t :clock-resume t)
149 | ("n" "note" entry (file (concat org-directory "/gtd.org"))
150 | "* %? :NOTE:\n%U\n%a\n" :clock-in t :clock-resume t)
151 | ("j" "Journal" entry (file+datetree (concat org-directory "/diary.org"))
152 | "* %?\n%U\n" :clock-in t :clock-resume t)
153 | )))
154 | (setq org-default-notes-file (concat org-directory "/notes.org"))
155 |
156 | (load-theme 'solarized-dark)
157 | (global-set-key (kbd "") 'delete-char)
158 | (global-set-key (kbd "C-j") 'ace-jump-mode)
159 | (global-set-key [C-mouse-4] 'text-scale-increase)
160 | (global-set-key [C-mouse-5] 'text-scale-decrease)
161 | (global-set-key (kbd "C-S-v") 'yank)
162 |
163 | (require 'yascroll)
164 | (global-yascroll-bar-mode)
165 | (toggle-scroll-bar 0)
166 |
167 | (require 'multi-term)
168 | (setq multi-term-program "/bin/bash")
169 |
170 | (defun term-send-esc ()
171 | "Send ESC in term mode."
172 | (interactive)
173 | (term-send-raw-string "\e"))
174 |
175 | (add-to-list 'term-bind-key-alist '("C-c C-e" . term-send-escape))
176 | (add-to-list 'term-bind-key-alist '("C-c C-d" . term-send-oef))
177 |
178 | ;; MULTIPLE CURSORS
179 | (require 'multiple-cursors)
180 |
181 | (global-set-key (kbd "C-S-c C-S-c") 'mc/edit-lines)
182 | (global-set-key (kbd "C->") 'mc/mark-next-like-this)
183 | (global-set-key (kbd "C-<") 'mc/mark-previous-like-this)
184 | (global-set-key (kbd "C-c C-<") 'mc/mark-all-like-this)
185 |
--------------------------------------------------------------------------------
/utils/installer.sh:
--------------------------------------------------------------------------------
1 | install_prelude () {
2 | printf " Cloning the Prelude's GitHub repository...\n$RESET"
3 | if [ x$PRELUDE_VERBOSE != x ]
4 | then
5 | /usr/bin/env git clone $PRELUDE_URL "$PRELUDE_INSTALL_DIR"
6 | else
7 | /usr/bin/env git clone $PRELUDE_URL "$PRELUDE_INSTALL_DIR" > /dev/null
8 | fi
9 | if ! [ $? -eq 0 ]
10 | then
11 | printf "$RED A fatal error occurred during Prelude's installation. Aborting..."
12 | exit 1
13 | fi
14 | }
15 |
16 | make_prelude_dirs () {
17 | printf " Making the required directories.\n$RESET"
18 | mkdir -p "$PRELUDE_INSTALL_DIR/vendor" "$PRELUDE_INSTALL_DIR/personal"
19 | mkdir -p "$PRELUDE_INSTALL_DIR/themes"
20 | mkdir -p "$PRELUDE_INSTALL_DIR/savefile"
21 | }
22 |
23 | colors_ () {
24 | case "$SHELL" in
25 | *zsh)
26 | autoload colors && colors
27 | eval RESET='$reset_color'
28 | for COLOR in RED GREEN YELLOW BLUE MAGENTA CYAN BLACK WHITE
29 | do
30 | eval $COLOR='$fg_no_bold[${(L)COLOR}]'
31 | eval B$COLOR='$fg_bold[${(L)COLOR}]'
32 | done
33 | ;;
34 | *)
35 | RESET='\e[0m' # Reset
36 | RED='\e[0;31m' # Red
37 | GREEN='\e[0;32m' # Green
38 | YELLOW='\e[0;33m' # Yellow
39 | BLUE='\e[0;34m' # Blue
40 | PURPLE='\e[0;35m' # Magenta
41 | CYAN='\e[0;36m' # Cyan
42 | WHITE='\e[0;37m' # White
43 | BRED='\e[1;31m' # Bold Red
44 | BGREEN='\e[1;32m' # Bold Green
45 | BYELLOW='\e[1;33m' # Bold Yellow
46 | BBLUE='\e[1;34m' # Bold Blue
47 | BPURPLE='\e[1;35m' # Bold Magenta
48 | BCYAN='\e[1;36m' # Bold Cyan
49 | BWHITE='\e[1;37m' # Bold White
50 | ;;
51 | esac
52 | }
53 |
54 | # Commandline args:
55 | # -d/--directory [dir]
56 | # Install prelude into the specified directory. If 'dir' is a relative path prefix it with $HOME.
57 | # Defaults to '$HOME/.emacs.d'
58 | # -c/--colors
59 | # Enable colors
60 | # -s/--source [url]
61 | # Clone prelude from 'url'.
62 | # Defaults to 'https://github.com/bbatsov/prelude.git'
63 | # -i/--into
64 | # If one exists, install into the existing config
65 | # -n/--no-bytecompile
66 | # Skip the compilation of the prelude files.
67 | # -h/--help
68 | # Print help
69 | # -v/--verbose
70 | # Verbose output, for debugging
71 |
72 | usage() {
73 | printf "Usage: $0 [OPTION]\n"
74 | printf " -c, --colors \t \t \t Enable colors.\n"
75 | printf " -d, --directory [dir] \t Install prelude into the specified directory.\n"
76 | printf " \t \t \t \t If 'dir' is a relative path prefix with $HOME.\n"
77 | printf " \t \t \t \t Defaults to $HOME/.emacs.d\n"
78 | printf " -s, --source [url] \t \t Clone prelude from 'url'.\n"
79 | printf " \t \t \t \t Defaults to 'https://github.com/bbatsov/prelude.git'.\n"
80 | printf " -n, --no-bytecompile \t \t Skip the bytecompilation step of prelude.\n"
81 | printf " -i, --into \t \t \t Install Prelude into a subdirectory in the existing configuration\n"
82 | printf " \t \t \t \t The default behavious is to install prelude into the existing\n"
83 | printf " \t \t \t \t emacs configuration.\n"
84 | printf " -h, --help \t \t \t Display this help and exit\n"
85 | printf " -v, --verbose \t \t Display verbose information\n"
86 | printf "\n"
87 | }
88 |
89 | ### Parse cli
90 | while [ $# -gt 0 ]
91 | do
92 | case $1 in
93 | -d | --directory)
94 | PRELUDE_INSTALL_DIR=$2
95 | shift 2
96 | ;;
97 | -c | --colors)
98 | colors_
99 | shift 1
100 | ;;
101 | -s | --source)
102 | PRELUDE_URL=$2
103 | shift 2
104 | ;;
105 | -i | --into)
106 | PRELUDE_INTO='true'
107 | shift 1
108 | ;;
109 | -n | --no-bytecompile)
110 | PRELUDE_SKIP_BC='true'
111 | shift 1
112 | ;;
113 | -h | --help)
114 | usage
115 | exit 0
116 | ;;
117 | -v | --verbose)
118 | PRELUDE_VERBOSE='true';
119 | shift 1
120 | ;;
121 | *)
122 | printf "Unkown option: $1\n"
123 | shift 1
124 | ;;
125 | esac
126 | done
127 |
128 | VERBOSE_COLOR=$BBLUE
129 |
130 | [ -z "$PRELUDE_URL" ] && PRELUDE_URL="https://github.com/bbatsov/prelude.git"
131 | [ -z "$PRELUDE_INSTALL_DIR" ] && PRELUDE_INSTALL_DIR="$HOME/.emacs.d"
132 |
133 | if [ x$PRELUDE_VERBOSE != x ]
134 | then
135 | printf "$VERBOSE_COLOR"
136 | printf "PRELUDE_VERBOSE = $PRELUDE_VERBOSE\n"
137 | printf "INSTALL_DIR = $PRELUDE_INSTALL_DIR\n"
138 | printf "SOURCE_URL = $PRELUDE_URL\n"
139 | printf "$RESET"
140 | if [ -n "$PRELUDE_SKIP_BC" ]
141 | then
142 | printf "Skipping bytecompilation.\n"
143 | fi
144 | if [ -n "$PRELUDE_INTO" ]
145 | then
146 | printf "Replacing existing config (if one exists).\n"
147 | fi
148 | printf "$RESET"
149 | fi
150 |
151 | # If prelude is already installed
152 | if [ -d "$PRELUDE_INSTALL_DIR/core/prelude-core.el" ]
153 | then
154 | printf "\n\n$BRED"
155 | printf "You already have Prelude installed.$RESET\nYou'll need to remove $PRELUDE_INSTALL_DIR/prelude if you want to install Prelude again.\n"
156 | printf "If you want to update your copy of prelude, run 'git pull origin master' from your prelude directory\n\n"
157 | exit 1;
158 | fi
159 |
160 | ### Check dependencies
161 | printf "$CYAN Checking to see if git is installed... $RESET"
162 | if hash git 2>&-
163 | then
164 | printf "$GREEN found.$RESET\n"
165 | else
166 | printf "$RED not found. Aborting installation!$RESET\n"
167 | exit 1
168 | fi;
169 |
170 | printf "$CYAN Checking to see if aspell is installed... "
171 | if hash aspell 2>&-
172 | then
173 | printf "$GREEN found.$RESET\n"
174 | else
175 | printf "$RED not found. Install aspell to benefit from flyspell-mode!$RESET\n"
176 | fi
177 |
178 | printf "$CYAN Checking to see if ack is installed... "
179 | if hash ack 2>&- || hash ack-grep 2>&-
180 | then
181 | printf "$GREEN found.$RESET\n"
182 | else
183 | printf "$RED not found. You'll need it to use ack-and-a-half!$RESET\n"
184 | fi
185 |
186 | ### Check emacs version
187 | if [ $(emacs --version 2>/dev/null | sed -n 's/.*[^0-9.]\([0-9]*\.[0-9.]*\).*/\1/p;q' | sed 's/\..*//g') -lt 24 ]
188 | then
189 | printf "$YELLOW WARNING:$RESET Prelude depends on emacs $RED 24$RESET !\n"
190 | fi
191 |
192 | if [ -d "$PRELUDE_INSTALL_DIR" ] || [ -f "$PRELUDE_INSTALL_DIR" ]
193 | then
194 | # Existing file/directory found -> backup
195 | printf " Backing up the existing config to $PRELUDE_INSTALL_DIR.pre-prelude.tar.\n"
196 | tar -cf "$PRELUDE_INSTALL_DIR.pre-prelude.tar" "$PRELUDE_INSTALL_DIR" > /dev/null 2>&1
197 | PRELUDE_INSTALL_DIR_ORIG="$PRELUDE_INSTALL_DIR"
198 | # Overwrite existing?
199 | [ -n "$PRELUDE_INTO" ] && PRELUDE_INSTALL_DIR="$PRELUDE_INSTALL_DIR/prelude"
200 | # Clear destination directory for git clone to work
201 | rm -fr "$PRELUDE_INSTALL_DIR"
202 | mkdir "$PRELUDE_INSTALL_DIR"
203 | # Replace existing config
204 | install_prelude
205 | make_prelude_dirs
206 | # Reinstate files that weren't replaced
207 | tar --skip-old-files -xf "$PRELUDE_INSTALL_DIR_ORIG.pre-prelude.tar" "$PRELUDE_INSTALL_DIR" > /dev/null 2>&1
208 | [ -n "$PRELUDE_INTO" ] && cp "$PRELUDE_INSTALL_DIR/sample/prelude-modules.el" "$PRELUDE_INSTALL_DIR"
209 | elif [ -e "$PRELUDE_INSTALL_DIR" ]
210 | then
211 | # File exist but not a regular file or directory
212 | # WTF NOW?
213 | printf "$BRED $PRELUDE_INSTALL_DIR exist but isn't a file or directory.\n"
214 | printf "$BRED please remove this file or install prelude in a different directory"
215 | printf "$BRED (-d flag)\n$RESET"
216 | exit 1
217 | else
218 | # Nothing yet so just install prelude
219 | install_prelude
220 | make_prelude_dirs
221 | cp "$PRELUDE_INSTALL_DIR/sample/prelude-modules.el" "$PRELUDE_INSTALL_DIR"
222 | fi
223 |
224 | if [ -z "$PRELUDE_SKIP_BC" ];
225 | then
226 | if which emacs > /dev/null 2>&1
227 | then
228 | printf " Bytecompiling Prelude.\n"
229 | if [ x$PRELUDE_VERBOSE != x ]
230 | then
231 | emacs -batch -f batch-byte-compile "$PRELUDE_INSTALL_DIR/core"/*.el
232 | else
233 | emacs -batch -f batch-byte-compile "$PRELUDE_INSTALL_DIR/core"/*.el > /dev/null 2>&1
234 | fi
235 | else
236 | printf "$YELLOW Emacs not found.$RESET Skipping bytecompilation.\n"
237 | fi
238 | else
239 | printf "Skipping bytecompilation.\n"
240 | fi
241 |
242 | printf "\n"
243 | printf "$BBLUE ____ _ _ \n"
244 | printf "$BBLUE | _ \ _ __ ___| |_ _ __| | ___ \n"
245 | printf "$BBLUE | |_) | __/ _ \ | | | |/ _ |/ _ \ \n"
246 | printf "$BBLUE | __/| | | __/ | |_| | (_| | __/ \n"
247 | printf "$BBLUE |_| |_| \___|_|\__,_|\__,_|\___| \n\n"
248 | printf "$GREEN ... is now installed and ready to do thy bidding, Master $USER!$RESET\n"
249 | printf "$GREEN Don't forget to adjust the modules you want to use in $PRELUDE_INSTALL_DIR/prelude-modules.el!$RESET\n"
250 |
--------------------------------------------------------------------------------
/core/prelude-editor.el:
--------------------------------------------------------------------------------
1 | ;;; prelude-editor.el --- Emacs Prelude: enhanced core editing experience.
2 | ;;
3 | ;; Copyright © 2011-2014 Bozhidar Batsov
4 | ;;
5 | ;; Author: Bozhidar Batsov
6 | ;; URL: https://github.com/bbatsov/prelude
7 | ;; Version: 1.0.0
8 | ;; Keywords: convenience
9 |
10 | ;; This file is not part of GNU Emacs.
11 |
12 | ;;; Commentary:
13 |
14 | ;; Refinements of the core editing experience in Emacs.
15 |
16 | ;;; License:
17 |
18 | ;; This program is free software; you can redistribute it and/or
19 | ;; modify it under the terms of the GNU General Public License
20 | ;; as published by the Free Software Foundation; either version 3
21 | ;; of the License, or (at your option) any later version.
22 | ;;
23 | ;; This program is distributed in the hope that it will be useful,
24 | ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
25 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
26 | ;; GNU General Public License for more details.
27 | ;;
28 | ;; You should have received a copy of the GNU General Public License
29 | ;; along with GNU Emacs; see the file COPYING. If not, write to the
30 | ;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
31 | ;; Boston, MA 02110-1301, USA.
32 |
33 | ;;; Code:
34 |
35 | ;; Death to the tabs! However, tabs historically indent to the next
36 | ;; 8-character offset; specifying anything else will cause *mass*
37 | ;; confusion, as it will change the appearance of every existing file.
38 | ;; In some cases (python), even worse -- it will change the semantics
39 | ;; (meaning) of the program.
40 | ;;
41 | ;; Emacs modes typically provide a standard means to change the
42 | ;; indentation width -- eg. c-basic-offset: use that to adjust your
43 | ;; personal indentation width, while maintaining the style (and
44 | ;; meaning) of any files you load.
45 | (setq-default indent-tabs-mode nil) ;; don't use tabs to indent
46 | (setq-default tab-width 8) ;; but maintain correct appearance
47 |
48 | ;; Newline at end of file
49 | (setq require-final-newline t)
50 |
51 | ;; delete the selection with a keypress
52 | (delete-selection-mode t)
53 |
54 | ;; store all backup and autosave files in the tmp dir
55 | (setq backup-directory-alist
56 | `((".*" . ,temporary-file-directory)))
57 | (setq auto-save-file-name-transforms
58 | `((".*" ,temporary-file-directory t)))
59 |
60 | ;; revert buffers automatically when underlying files are changed externally
61 | (global-auto-revert-mode t)
62 |
63 | ;; hippie expand is dabbrev expand on steroids
64 | (setq hippie-expand-try-functions-list '(try-expand-dabbrev
65 | try-expand-dabbrev-all-buffers
66 | try-expand-dabbrev-from-kill
67 | try-complete-file-name-partially
68 | try-complete-file-name
69 | try-expand-all-abbrevs
70 | try-expand-list
71 | try-expand-line
72 | try-complete-lisp-symbol-partially
73 | try-complete-lisp-symbol))
74 |
75 | ;; smart tab behavior - indent or complete
76 | (setq tab-always-indent 'complete)
77 |
78 | ;; smart pairing for all
79 | (require 'smartparens-config)
80 | (setq sp-base-key-bindings 'paredit)
81 | (setq sp-autoskip-closing-pair 'always)
82 | (setq sp-hybrid-kill-entire-symbol nil)
83 | (sp-use-paredit-bindings)
84 |
85 | (show-smartparens-global-mode +1)
86 |
87 | (define-key prog-mode-map (kbd "M-(") (prelude-wrap-with "("))
88 | ;; FIXME: pick terminal friendly binding
89 | ;; (define-key prog-mode-map (kbd "M-[") (prelude-wrap-with "["))
90 | (define-key prog-mode-map (kbd "M-\"") (prelude-wrap-with "\""))
91 |
92 | ;; disable annoying blink-matching-paren
93 | (setq blink-matching-paren nil)
94 |
95 | ;; diminish keeps the modeline tidy
96 | (require 'diminish)
97 |
98 | ;; meaningful names for buffers with the same name
99 | (require 'uniquify)
100 | (setq uniquify-buffer-name-style 'forward)
101 | (setq uniquify-separator "/")
102 | (setq uniquify-after-kill-buffer-p t) ; rename after killing uniquified
103 | (setq uniquify-ignore-buffers-re "^\\*") ; don't muck with special buffers
104 |
105 | ;; saveplace remembers your location in a file when saving files
106 | (require 'saveplace)
107 | (setq save-place-file (expand-file-name "saveplace" prelude-savefile-dir))
108 | ;; activate it for all buffers
109 | (setq-default save-place t)
110 |
111 | ;; savehist keeps track of some history
112 | (require 'savehist)
113 | (setq savehist-additional-variables
114 | ;; search entries
115 | '(search-ring regexp-search-ring)
116 | ;; save every minute
117 | savehist-autosave-interval 60
118 | ;; keep the home clean
119 | savehist-file (expand-file-name "savehist" prelude-savefile-dir))
120 | (savehist-mode +1)
121 |
122 | ;; save recent files
123 | (require 'recentf)
124 | (setq recentf-save-file (expand-file-name "recentf" prelude-savefile-dir)
125 | recentf-max-saved-items 500
126 | recentf-max-menu-items 15
127 | ;; disable recentf-cleanup on Emacs start, because it can cause
128 | ;; problems with remote files
129 | recentf-auto-cleanup 'never)
130 |
131 | (defun prelude-recentf-exclude-p (file)
132 | "A predicate to decide whether to exclude FILE from recentf."
133 | (let ((file-dir (file-truename (file-name-directory file))))
134 | (-any-p (lambda (dir)
135 | (string-prefix-p dir file-dir))
136 | (mapcar 'file-truename (list prelude-savefile-dir package-user-dir)))))
137 |
138 | (add-to-list 'recentf-exclude 'prelude-recentf-exclude-p)
139 | ;; ignore magit's commit message files
140 | (add-to-list 'recentf-exclude "COMMIT_EDITMSG\\'")
141 |
142 | (recentf-mode +1)
143 |
144 | ;; use shift + arrow keys to switch between visible buffers
145 | (require 'windmove)
146 | (windmove-default-keybindings)
147 |
148 | ;; automatically save buffers associated with files on buffer switch
149 | ;; and on windows switch
150 | (defun prelude-auto-save-command ()
151 | "Save the current buffer if `prelude-auto-save' is not nil."
152 | (when (and prelude-auto-save
153 | buffer-file-name
154 | (buffer-modified-p (current-buffer))
155 | (file-writable-p buffer-file-name))
156 | (save-buffer)))
157 |
158 | (defmacro advise-commands (advice-name commands class &rest body)
159 | "Apply advice named ADVICE-NAME to multiple COMMANDS.
160 |
161 | The body of the advice is in BODY."
162 | `(progn
163 | ,@(mapcar (lambda (command)
164 | `(defadvice ,command (,class ,(intern (concat (symbol-name command) "-" advice-name)) activate)
165 | ,@body))
166 | commands)))
167 |
168 | ;; advise all window switching functions
169 | (advise-commands "auto-save"
170 | (switch-to-buffer other-window windmove-up windmove-down windmove-left windmove-right)
171 | before
172 | (prelude-auto-save-command))
173 |
174 | (add-hook 'mouse-leave-buffer-hook 'prelude-auto-save-command)
175 |
176 | (when (version<= "24.4" emacs-version)
177 | (add-hook 'focus-out-hook 'prelude-auto-save-command))
178 |
179 | (defadvice set-buffer-major-mode (after set-major-mode activate compile)
180 | "Set buffer major mode according to `auto-mode-alist'."
181 | (let* ((name (buffer-name buffer))
182 | (mode (assoc-default name auto-mode-alist 'string-match)))
183 | (with-current-buffer buffer (if mode (funcall mode)))))
184 |
185 | ;; highlight the current line
186 | (global-hl-line-mode +1)
187 |
188 | (require 'volatile-highlights)
189 | (volatile-highlights-mode t)
190 | (diminish 'volatile-highlights-mode)
191 |
192 | ;; tramp, for sudo access
193 | (require 'tramp)
194 | ;; keep in mind known issues with zsh - see emacs wiki
195 | (setq tramp-default-method "ssh")
196 |
197 | (set-default 'imenu-auto-rescan t)
198 |
199 | ;; flyspell-mode does spell-checking on the fly as you type
200 | (require 'flyspell)
201 | (setq ispell-program-name "aspell" ; use aspell instead of ispell
202 | ispell-extra-args '("--sug-mode=ultra"))
203 |
204 | (defun prelude-enable-flyspell ()
205 | "Enable command `flyspell-mode' if `prelude-flyspell' is not nil."
206 | (when (and prelude-flyspell (executable-find ispell-program-name))
207 | (flyspell-mode +1)))
208 |
209 | (defun prelude-cleanup-maybe ()
210 | "Invoke `whitespace-cleanup' if `prelude-clean-whitespace-on-save' is not nil."
211 | (when prelude-clean-whitespace-on-save
212 | (whitespace-cleanup)))
213 |
214 | (defun prelude-enable-whitespace ()
215 | "Enable `whitespace-mode' if `prelude-whitespace' is not nil."
216 | (when prelude-whitespace
217 | ;; keep the whitespace decent all the time (in this buffer)
218 | (add-hook 'before-save-hook 'prelude-cleanup-maybe nil t)
219 | (whitespace-mode +1)))
220 |
221 | (add-hook 'text-mode-hook 'prelude-enable-flyspell)
222 | (add-hook 'text-mode-hook 'prelude-enable-whitespace)
223 |
224 | ;; enable narrowing commands
225 | (put 'narrow-to-region 'disabled nil)
226 | (put 'narrow-to-page 'disabled nil)
227 | (put 'narrow-to-defun 'disabled nil)
228 |
229 | ;; enabled change region case commands
230 | (put 'upcase-region 'disabled nil)
231 | (put 'downcase-region 'disabled nil)
232 |
233 | ;; enable erase-buffer command
234 | (put 'erase-buffer 'disabled nil)
235 |
236 | (require 'expand-region)
237 |
238 | ;; bookmarks
239 | (require 'bookmark)
240 | (setq bookmark-default-file (expand-file-name "bookmarks" prelude-savefile-dir)
241 | bookmark-save-flag 1)
242 |
243 | ;; projectile is a project management mode
244 | (require 'projectile)
245 | (setq projectile-cache-file (expand-file-name "projectile.cache" prelude-savefile-dir))
246 | (projectile-global-mode t)
247 |
248 | ;; anzu-mode enhances isearch & query-replace by showing total matches and current match position
249 | (require 'anzu)
250 | (diminish 'anzu-mode)
251 | (global-anzu-mode)
252 |
253 | (global-set-key (kbd "M-%") 'anzu-query-replace)
254 | (global-set-key (kbd "C-M-%") 'anzu-query-replace-regexp)
255 |
256 | ;; shorter aliases for ack-and-a-half commands
257 | (defalias 'ack 'ack-and-a-half)
258 | (defalias 'ack-same 'ack-and-a-half-same)
259 | (defalias 'ack-find-file 'ack-and-a-half-find-file)
260 | (defalias 'ack-find-file-same 'ack-and-a-half-find-file-same)
261 |
262 | ;; dired - reuse current buffer by pressing 'a'
263 | (put 'dired-find-alternate-file 'disabled nil)
264 |
265 | ;; always delete and copy recursively
266 | (setq dired-recursive-deletes 'always)
267 | (setq dired-recursive-copies 'always)
268 |
269 | ;; if there is a dired buffer displayed in the next window, use its
270 | ;; current subdir, instead of the current subdir of this dired buffer
271 | (setq dired-dwim-target t)
272 |
273 | ;; enable some really cool extensions like C-x C-j(dired-jump)
274 | (require 'dired-x)
275 |
276 | ;; ediff - don't start another frame
277 | (require 'ediff)
278 | (setq ediff-window-setup-function 'ediff-setup-windows-plain)
279 |
280 | ;; clean up obsolete buffers automatically
281 | (require 'midnight)
282 |
283 | ;; smarter kill-ring navigation
284 | (require 'browse-kill-ring)
285 | (browse-kill-ring-default-keybindings)
286 | (global-set-key (kbd "s-y") 'browse-kill-ring)
287 |
288 | (defadvice exchange-point-and-mark (before deactivate-mark activate compile)
289 | "When called with no active region, do not activate mark."
290 | (interactive
291 | (list (not (region-active-p)))))
292 |
293 | (defmacro with-region-or-buffer (func)
294 | "When called with no active region, call FUNC on current buffer."
295 | `(defadvice ,func (before with-region-or-buffer activate compile)
296 | (interactive
297 | (if mark-active
298 | (list (region-beginning) (region-end))
299 | (list (point-min) (point-max))))))
300 |
301 | (with-region-or-buffer indent-region)
302 | (with-region-or-buffer untabify)
303 |
304 | ;; automatically indenting yanked text if in programming-modes
305 | (defun yank-advised-indent-function (beg end)
306 | "Do indentation, as long as the region isn't too large."
307 | (if (<= (- end beg) prelude-yank-indent-threshold)
308 | (indent-region beg end nil)))
309 |
310 | (advise-commands "indent" (yank yank-pop) after
311 | "If current mode is one of `prelude-yank-indent-modes',
312 | indent yanked text (with prefix arg don't indent)."
313 | (if (and (not (ad-get-arg 0))
314 | (not (member major-mode prelude-indent-sensitive-modes))
315 | (or (derived-mode-p 'prog-mode)
316 | (member major-mode prelude-yank-indent-modes)))
317 | (let ((transient-mark-mode nil))
318 | (yank-advised-indent-function (region-beginning) (region-end)))))
319 |
320 | ;; abbrev config
321 | (add-hook 'text-mode-hook 'abbrev-mode)
322 |
323 | ;; make a shell script executable automatically on save
324 | (add-hook 'after-save-hook
325 | 'executable-make-buffer-file-executable-if-script-p)
326 |
327 | ;; .zsh file is shell script too
328 | (add-to-list 'auto-mode-alist '("\\.zsh\\'" . shell-script-mode))
329 |
330 | ;; whitespace-mode config
331 | (require 'whitespace)
332 | (setq whitespace-line-column 80) ;; limit line length
333 | (setq whitespace-style '(face tabs empty trailing lines-tail))
334 |
335 | ;; saner regex syntax
336 | (require 're-builder)
337 | (setq reb-re-syntax 'string)
338 |
339 | (require 'eshell)
340 | (setq eshell-directory-name (expand-file-name "eshell" prelude-savefile-dir))
341 |
342 | (setq semanticdb-default-save-directory
343 | (expand-file-name "semanticdb" prelude-savefile-dir))
344 |
345 | ;; Compilation from Emacs
346 | (defun prelude-colorize-compilation-buffer ()
347 | "Colorize a compilation mode buffer."
348 | (interactive)
349 | ;; we don't want to mess with child modes such as grep-mode, ack, ag, etc
350 | (when (eq major-mode 'compilation-mode)
351 | (let ((inhibit-read-only t))
352 | (ansi-color-apply-on-region (point-min) (point-max)))))
353 |
354 | (require 'compile)
355 | (setq compilation-ask-about-save nil ; Just save before compiling
356 | compilation-always-kill t ; Just kill old compile processes before
357 | ; starting the new one
358 | compilation-scroll-output 'first-error ; Automatically scroll to first
359 | ; error
360 | )
361 |
362 | ;; Colorize output of Compilation Mode, see
363 | ;; http://stackoverflow.com/a/3072831/355252
364 | (require 'ansi-color)
365 | (add-hook 'compilation-filter-hook #'prelude-colorize-compilation-buffer)
366 |
367 | ;; enable Prelude's keybindings
368 | (prelude-global-mode t)
369 |
370 | ;; sensible undo
371 | (global-undo-tree-mode)
372 | (diminish 'undo-tree-mode)
373 |
374 | ;; enable winner-mode to manage window configurations
375 | (winner-mode +1)
376 |
377 | ;; diff-hl
378 | (global-diff-hl-mode +1)
379 | (add-hook 'dired-mode-hook 'diff-hl-dired-mode)
380 |
381 | ;; easy-kill
382 | (global-set-key [remap kill-ring-save] 'easy-kill)
383 | (global-set-key [remap mark-sexp] 'easy-mark)
384 |
385 | ;; operate-on-number
386 | (require 'operate-on-number)
387 | (smartrep-define-key global-map "C-c ."
388 | '(("+" . apply-operation-to-number-at-point)
389 | ("-" . apply-operation-to-number-at-point)
390 | ("*" . apply-operation-to-number-at-point)
391 | ("/" . apply-operation-to-number-at-point)
392 | ("\\" . apply-operation-to-number-at-point)
393 | ("^" . apply-operation-to-number-at-point)
394 | ("<" . apply-operation-to-number-at-point)
395 | (">" . apply-operation-to-number-at-point)
396 | ("#" . apply-operation-to-number-at-point)
397 | ("%" . apply-operation-to-number-at-point)
398 | ("'" . operate-on-number-at-point)))
399 |
400 | (defadvice server-visit-files (before parse-numbers-in-lines (files proc &optional nowait) activate)
401 | "Open file with emacsclient with cursors positioned on requested line.
402 | Most of console-based utilities prints filename in format
403 | 'filename:linenumber'. So you may wish to open filename in that format.
404 | Just call:
405 |
406 | emacsclient filename:linenumber
407 |
408 | and file 'filename' will be opened and cursor set on line 'linenumber'"
409 | (ad-set-arg 0
410 | (mapcar (lambda (fn)
411 | (let ((name (car fn)))
412 | (if (string-match "^\\(.*?\\):\\([0-9]+\\)\\(?::\\([0-9]+\\)\\)?$" name)
413 | (cons
414 | (match-string 1 name)
415 | (cons (string-to-number (match-string 2 name))
416 | (string-to-number (or (match-string 3 name) ""))))
417 | fn))) files)))
418 |
419 | (provide 'prelude-editor)
420 |
421 | ;;; prelude-editor.el ends here
422 |
--------------------------------------------------------------------------------
/core/prelude-core.el:
--------------------------------------------------------------------------------
1 | ;;; prelude-core.el --- Emacs Prelude: Core Prelude functions.
2 | ;;
3 | ;; Copyright © 2011-2014 Bozhidar Batsov
4 | ;;
5 | ;; Author: Bozhidar Batsov
6 | ;; URL: https://github.com/bbatsov/prelude
7 | ;; Version: 1.0.0
8 | ;; Keywords: convenience
9 |
10 | ;; This file is not part of GNU Emacs.
11 |
12 | ;;; Commentary:
13 |
14 | ;; Here are the definitions of most of the functions added by Prelude.
15 |
16 | ;;; License:
17 |
18 | ;; This program is free software; you can redistribute it and/or
19 | ;; modify it under the terms of the GNU General Public License
20 | ;; as published by the Free Software Foundation; either version 3
21 | ;; of the License, or (at your option) any later version.
22 | ;;
23 | ;; This program is distributed in the hope that it will be useful,
24 | ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
25 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
26 | ;; GNU General Public License for more details.
27 | ;;
28 | ;; You should have received a copy of the GNU General Public License
29 | ;; along with GNU Emacs; see the file COPYING. If not, write to the
30 | ;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
31 | ;; Boston, MA 02110-1301, USA.
32 |
33 | ;;; Code:
34 |
35 | (require 'thingatpt)
36 | (require 'dash)
37 | (require 'ov)
38 |
39 | (defun prelude-open-with (arg)
40 | "Open visited file in default external program.
41 | When in dired mode, open file under the cursor.
42 |
43 | With a prefix ARG always prompt for command to use."
44 | (interactive "P")
45 | (let* ((current-file-name
46 | (if (eq major-mode 'dired-mode)
47 | (dired-get-file-for-visit)
48 | buffer-file-name))
49 | (open (pcase system-type
50 | (`darwin "open")
51 | ((or `gnu `gnu/linux `gnu/kfreebsd) "xdg-open")))
52 | (program (if (or arg (not open))
53 | (read-shell-command "Open current file with: ")
54 | open)))
55 | (start-process "prelude-open-with-process" nil program current-file-name)))
56 |
57 | (defun prelude-buffer-mode (buffer-or-name)
58 | "Retrieve the `major-mode' of BUFFER-OR-NAME."
59 | (with-current-buffer buffer-or-name
60 | major-mode))
61 |
62 | (defvar prelude-term-buffer-name "ansi"
63 | "The default `ansi-term' name used by `prelude-visit-term-buffer'.
64 | This variable can be set via .dir-locals.el to provide multi-term support.")
65 |
66 | (defun prelude-visit-term-buffer ()
67 | "Create or visit a terminal buffer."
68 | (interactive)
69 | (prelude-start-or-switch-to (lambda ()
70 | (ansi-term (getenv "SHELL") (concat prelude-term-buffer-name "-term")))
71 | (format "*%s-term*" prelude-term-buffer-name)))
72 |
73 | (defun prelude-search (query-url prompt)
74 | "Open the search url constructed with the QUERY-URL.
75 | PROMPT sets the `read-string prompt."
76 | (browse-url
77 | (concat query-url
78 | (url-hexify-string
79 | (if mark-active
80 | (buffer-substring (region-beginning) (region-end))
81 | (read-string prompt))))))
82 |
83 | (defmacro prelude-install-search-engine (search-engine-name search-engine-url search-engine-prompt)
84 | "Given some information regarding a search engine, install the interactive command to search through them"
85 | `(defun ,(intern (format "prelude-%s" search-engine-name)) ()
86 | ,(format "Search %s with a query or region if any." search-engine-name)
87 | (interactive)
88 | (prelude-search ,search-engine-url ,search-engine-prompt)))
89 |
90 | (prelude-install-search-engine "google" "http://www.google.com/search?q=" "Google: ")
91 | (prelude-install-search-engine "youtube" "http://www.youtube.com/results?search_query=" "Search YouTube: ")
92 | (prelude-install-search-engine "github" "https://github.com/search?q=" "Search GitHub: ")
93 | (prelude-install-search-engine "duckduckgo" "https://duckduckgo.com/?t=lm&q=" "Search DuckDuckGo: ")
94 |
95 | (defun prelude-indent-rigidly-and-copy-to-clipboard (begin end arg)
96 | "Indent region between BEGIN and END by ARG columns and copy to clipboard."
97 | (interactive "r\nP")
98 | (let ((arg (or arg 4))
99 | (buffer (current-buffer)))
100 | (with-temp-buffer
101 | (insert-buffer-substring-no-properties buffer begin end)
102 | (indent-rigidly (point-min) (point-max) arg)
103 | (clipboard-kill-ring-save (point-min) (point-max)))))
104 |
105 | (defun prelude-smart-open-line-above ()
106 | "Insert an empty line above the current line.
107 | Position the cursor at it's beginning, according to the current mode."
108 | (interactive)
109 | (move-beginning-of-line nil)
110 | (newline-and-indent)
111 | (forward-line -1)
112 | (indent-according-to-mode))
113 |
114 | (defun prelude-smart-open-line (arg)
115 | "Insert an empty line after the current line.
116 | Position the cursor at its beginning, according to the current mode.
117 |
118 | With a prefix ARG open line above the current line."
119 | (interactive "P")
120 | (if arg
121 | (prelude-smart-open-line-above)
122 | (progn
123 | (move-end-of-line nil)
124 | (newline-and-indent))))
125 |
126 | (defun prelude-top-join-line ()
127 | "Join the current line with the line beneath it."
128 | (interactive)
129 | (delete-indentation 1))
130 |
131 | (defun prelude-kill-whole-line (&optional arg)
132 | "A simple wrapper around command `kill-whole-line' that respects indentation.
133 | Passes ARG to command `kill-whole-line' when provided."
134 | (interactive "p")
135 | (kill-whole-line arg)
136 | (back-to-indentation))
137 |
138 | (defun prelude-move-beginning-of-line (arg)
139 | "Move point back to indentation of beginning of line.
140 |
141 | Move point to the first non-whitespace character on this line.
142 | If point is already there, move to the beginning of the line.
143 | Effectively toggle between the first non-whitespace character and
144 | the beginning of the line.
145 |
146 | If ARG is not nil or 1, move forward ARG - 1 lines first. If
147 | point reaches the beginning or end of the buffer, stop there."
148 | (interactive "^p")
149 | (setq arg (or arg 1))
150 |
151 | ;; Move lines first
152 | (when (/= arg 1)
153 | (let ((line-move-visual nil))
154 | (forward-line (1- arg))))
155 |
156 | (let ((orig-point (point)))
157 | (back-to-indentation)
158 | (when (= orig-point (point))
159 | (move-beginning-of-line 1))))
160 |
161 | (global-set-key [remap move-beginning-of-line]
162 | 'prelude-move-beginning-of-line)
163 |
164 | (defun prelude-indent-defun ()
165 | "Indent the current defun."
166 | (interactive)
167 | (save-excursion
168 | (mark-defun)
169 | (indent-region (region-beginning) (region-end))))
170 |
171 | (defun prelude-todo-ov-evaporate (_ov _after _beg _end &optional _length)
172 | (let ((inhibit-modification-hooks t))
173 | (if _after (ov-reset _ov))))
174 |
175 | (defun prelude-annotate-todo ()
176 | "Put fringe marker on TODO: lines in the curent buffer."
177 | (interactive)
178 | (ov-set (format "[[:space:]]*%s+[[:space:]]*TODO:" comment-start)
179 | 'before-string
180 | (propertize (format "A")
181 | 'display '(left-fringe right-triangle))
182 | 'modification-hooks '(prelude-todo-ov-evaporate)))
183 |
184 | (defun prelude-copy-file-name-to-clipboard ()
185 | "Copy the current buffer file name to the clipboard."
186 | (interactive)
187 | (let ((filename (if (equal major-mode 'dired-mode)
188 | default-directory
189 | (buffer-file-name))))
190 | (when filename
191 | (kill-new filename)
192 | (message "Copied buffer file name '%s' to the clipboard." filename))))
193 |
194 | (defun prelude-get-positions-of-line-or-region ()
195 | "Return positions (beg . end) of the current line
196 | or region."
197 | (let (beg end)
198 | (if (and mark-active (> (point) (mark)))
199 | (exchange-point-and-mark))
200 | (setq beg (line-beginning-position))
201 | (if mark-active
202 | (exchange-point-and-mark))
203 | (setq end (line-end-position))
204 | (cons beg end)))
205 |
206 | (defun prelude-duplicate-current-line-or-region (arg)
207 | "Duplicates the current line or region ARG times.
208 | If there's no region, the current line will be duplicated. However, if
209 | there's a region, all lines that region covers will be duplicated."
210 | (interactive "p")
211 | (pcase-let* ((origin (point))
212 | (`(,beg . ,end) (prelude-get-positions-of-line-or-region))
213 | (region (buffer-substring-no-properties beg end)))
214 | (-dotimes arg
215 | (lambda (n)
216 | (goto-char end)
217 | (newline)
218 | (insert region)
219 | (setq end (point))))
220 | (goto-char (+ origin (* (length region) arg) arg))))
221 |
222 | (defun prelude-duplicate-and-comment-current-line-or-region (arg)
223 | "Duplicates and comments the current line or region ARG times.
224 | If there's no region, the current line will be duplicated. However, if
225 | there's a region, all lines that region covers will be duplicated."
226 | (interactive "p")
227 | (pcase-let* ((origin (point))
228 | (`(,beg . ,end) (prelude-get-positions-of-line-or-region))
229 | (region (buffer-substring-no-properties beg end)))
230 | (comment-or-uncomment-region beg end)
231 | (setq end (line-end-position))
232 | (-dotimes arg
233 | (lambda (n)
234 | (goto-char end)
235 | (newline)
236 | (insert region)
237 | (setq end (point))))
238 | (goto-char (+ origin (* (length region) arg) arg))))
239 |
240 | (defun prelude-rename-buffer-and-file ()
241 | "Rename current buffer and if the buffer is visiting a file, rename it too."
242 | (interactive)
243 | (let ((filename (buffer-file-name)))
244 | (if (not (and filename (file-exists-p filename)))
245 | (rename-buffer (read-from-minibuffer "New name: " (buffer-name)))
246 | (let ((new-name (read-file-name "New name: " filename)))
247 | (cond
248 | ((vc-backend filename) (vc-rename-file filename new-name))
249 | (t
250 | (rename-file filename new-name t)
251 | (set-visited-file-name new-name t t)))))))
252 |
253 | (defun prelude-delete-file-and-buffer ()
254 | "Kill the current buffer and deletes the file it is visiting."
255 | (interactive)
256 | (let ((filename (buffer-file-name)))
257 | (when filename
258 | (if (vc-backend filename)
259 | (vc-delete-file filename)
260 | (when (y-or-n-p (format "Are you sure you want to delete %s? " filename))
261 | (delete-file filename)
262 | (message "Deleted file %s" filename)
263 | (kill-buffer))))))
264 |
265 | (defun prelude-view-url ()
266 | "Open a new buffer containing the contents of URL."
267 | (interactive)
268 | (let* ((default (thing-at-point-url-at-point))
269 | (url (read-from-minibuffer "URL: " default)))
270 | (switch-to-buffer (url-retrieve-synchronously url))
271 | (rename-buffer url t)
272 | (goto-char (point-min))
273 | (re-search-forward "^$")
274 | (delete-region (point-min) (point))
275 | (delete-blank-lines)
276 | (set-auto-mode)))
277 |
278 | (defun prelude-cleanup-buffer-or-region ()
279 | "Cleanup a region if selected, otherwise the whole buffer."
280 | (interactive)
281 | (call-interactively 'untabify)
282 | (unless (member major-mode prelude-indent-sensitive-modes)
283 | (call-interactively 'indent-region))
284 | (whitespace-cleanup))
285 |
286 | (defun prelude-eval-and-replace ()
287 | "Replace the preceding sexp with its value."
288 | (interactive)
289 | (let ((value (eval (preceding-sexp))))
290 | (backward-kill-sexp)
291 | (insert (format "%s" value))))
292 |
293 | (defun prelude-recompile-init ()
294 | "Byte-compile all your dotfiles again."
295 | (interactive)
296 | (byte-recompile-directory prelude-dir 0))
297 |
298 | (defun prelude-sudo-edit (&optional arg)
299 | "Edit currently visited file as root.
300 |
301 | With a prefix ARG prompt for a file to visit.
302 | Will also prompt for a file to visit if current
303 | buffer is not visiting a file."
304 | (interactive "P")
305 | (if (or arg (not buffer-file-name))
306 | (find-file (concat "/sudo:root@localhost:"
307 | (ido-read-file-name "Find file(as root): ")))
308 | (find-alternate-file (concat "/sudo:root@localhost:" buffer-file-name))))
309 |
310 | (defadvice ido-find-file (after find-file-sudo activate)
311 | "Find file as root if necessary."
312 | (unless (or (tramp-tramp-file-p buffer-file-name)
313 | (equal major-mode 'dired-mode)
314 | (not (file-exists-p (file-name-directory buffer-file-name)))
315 | (file-writable-p buffer-file-name))
316 | (find-alternate-file (concat "/sudo:root@localhost:" buffer-file-name))))
317 |
318 | (defun prelude-start-or-switch-to (function buffer-name)
319 | "Invoke FUNCTION if there is no buffer with BUFFER-NAME.
320 | Otherwise switch to the buffer named BUFFER-NAME. Don't clobber
321 | the current buffer."
322 | (if (not (get-buffer buffer-name))
323 | (progn
324 | (split-window-sensibly (selected-window))
325 | (other-window 1)
326 | (funcall function))
327 | (switch-to-buffer-other-window buffer-name)))
328 |
329 | (defun prelude-insert-date ()
330 | "Insert a timestamp according to locale's date and time format."
331 | (interactive)
332 | (insert (format-time-string "%c" (current-time))))
333 |
334 | (defun prelude-recentf-ido-find-file ()
335 | "Find a recent file using ido."
336 | (interactive)
337 | (let ((file (ido-completing-read "Choose recent file: "
338 | (-map 'abbreviate-file-name recentf-list)
339 | nil t)))
340 | (when file
341 | (find-file file))))
342 |
343 | (defun prelude-swap-windows ()
344 | "If you have 2 windows, it swaps them."
345 | (interactive)
346 | (if (/= (count-windows) 2)
347 | (message "You need exactly 2 windows to do this.")
348 | (let* ((w1 (car (window-list)))
349 | (w2 (cadr (window-list)))
350 | (b1 (window-buffer w1))
351 | (b2 (window-buffer w2))
352 | (s1 (window-start w1))
353 | (s2 (window-start w2)))
354 | (set-window-buffer w1 b2)
355 | (set-window-buffer w2 b1)
356 | (set-window-start w1 s2)
357 | (set-window-start w2 s1)))
358 | (other-window 1))
359 |
360 | (defun prelude-switch-to-previous-buffer ()
361 | "Switch to previously open buffer.
362 | Repeated invocations toggle between the two most recently open buffers."
363 | (interactive)
364 | (switch-to-buffer (other-buffer (current-buffer) 1)))
365 |
366 | (defun prelude-kill-other-buffers ()
367 | "Kill all buffers but the current one.
368 | Doesn't mess with special buffers."
369 | (interactive)
370 | (-each
371 | (->> (buffer-list)
372 | (-filter #'buffer-file-name)
373 | (--remove (eql (current-buffer) it)))
374 | #'kill-buffer))
375 |
376 | (defun prelude-create-scratch-buffer ()
377 | "Create a new scratch buffer."
378 | (interactive)
379 | (let ((buf (generate-new-buffer "*scratch*")))
380 | (switch-to-buffer buf)
381 | (funcall initial-major-mode)))
382 |
383 | (defvar prelude-tips
384 | '("Press to open a file with external program."
385 | "Press to navigate a project's files with ido."
386 | "Press to run grep on a project."
387 | "Press to switch between projects."
388 | "Press to expand the selected region."
389 | "Press to search in Google."
390 | "Press to search in GitHub."
391 | "Press to search in YouTube."
392 | "Press to search in DuckDuckGo."
393 | "Press to rename the current buffer and the file it's visiting if any."
394 | "Press to open a terminal in Emacs."
395 | "Press to kill all the buffers, but the active one."
396 | "Press to run magit-status."
397 | "Press to delete the current file and buffer."
398 | "Press to swap two windows."
399 | "Press or to open a line beneath the current one."
400 | "Press to open a line above the current one."
401 | "Press in a Elisp buffer to launch an interactive Elisp shell."
402 | "Press to kill a line backwards."
403 | "Press or to kill the whole line."
404 | "Press to toggle fullscreen mode."
405 | "Press to toggle the menu bar."
406 | "Explore the Tools->Prelude menu to find out about some of Prelude extensions to Emacs."
407 | "Access the official Emacs manual by pressing ."
408 | "Visit the EmacsWiki at http://emacswiki.org to find out even more about Emacs."))
409 |
410 | (defun prelude-tip-of-the-day ()
411 | "Display a random entry from `prelude-tips'."
412 | (interactive)
413 | (unless (window-minibuffer-p)
414 | ;; pick a new random seed
415 | (random t)
416 | (message
417 | (concat "Prelude tip: " (nth (random (length prelude-tips)) prelude-tips)))))
418 |
419 | (defun prelude-eval-after-init (form)
420 | "Add `(lambda () FORM)' to `after-init-hook'.
421 |
422 | If Emacs has already finished initialization, also eval FORM immediately."
423 | (let ((func (list 'lambda nil form)))
424 | (add-hook 'after-init-hook func)
425 | (when after-init-time
426 | (eval form))))
427 |
428 | (require 'epl)
429 |
430 | (defun prelude-update ()
431 | "Update Prelude to its latest version."
432 | (interactive)
433 | (when (y-or-n-p "Do you want to update Prelude? ")
434 | (message "Updating installed packages...")
435 | (epl-upgrade)
436 | (message "Updating Prelude...")
437 | (cd prelude-dir)
438 | (shell-command "git pull")
439 | (prelude-recompile-init)
440 | (message "Update finished. Restart Emacs to complete the process.")))
441 |
442 | (defun prelude-update-packages (&optional arg)
443 | "Update Prelude's packages.
444 | This includes package installed via `prelude-require-package'.
445 |
446 | With a prefix ARG updates all installed packages."
447 | (interactive "P")
448 | (when (y-or-n-p "Do you want to update Prelude's packages? ")
449 | (if arg
450 | (epl-upgrade)
451 | (epl-upgrade (-filter (lambda (p) (memq (epl-package-name p) prelude-packages))
452 | (epl-installed-packages))))
453 | (message "Update finished. Restart Emacs to complete the process.")))
454 |
455 | ;;; Emacs in OSX already has fullscreen support
456 | ;;; Emacs has a similar built-in command in 24.4
457 | (defun prelude-fullscreen ()
458 | "Make Emacs window fullscreen.
459 |
460 | This follows freedesktop standards, should work in X servers."
461 | (interactive)
462 | (if (eq window-system 'x)
463 | (x-send-client-message nil 0 nil "_NET_WM_STATE" 32
464 | '(2 "_NET_WM_STATE_FULLSCREEN" 0))
465 | (error "Only X server is supported")))
466 |
467 | (defun prelude-find-user-init-file (&optional arg)
468 | "Edit the `prelude-user-init-file', in another window.
469 | With a prefix argument ARG, find the `user-init-file' instead."
470 | (interactive "P")
471 | (if arg (find-file-other-window user-init-file)
472 | (find-file-other-window prelude-user-init-file)))
473 |
474 | (defun prelude-find-shell-init-file ()
475 | "Edit the shell init file in another window."
476 | (interactive)
477 | (let* ((shell (car (reverse (s-split "/" (getenv "SHELL")))))
478 | (shell-init-file (cond
479 | ((s-equals? "zsh" shell) ".zshrc")
480 | ((s-equals? "bash" shell) ".bashrc")
481 | (t (error "Unknown shell")))))
482 | (find-file-other-window (expand-file-name shell-init-file (getenv "HOME")))))
483 |
484 | (defun prelude-wrap-with (s)
485 | "Create a wrapper function for smartparens using S."
486 | `(lambda (&optional arg)
487 | (interactive "P")
488 | (sp-wrap-with-pair ,s)))
489 |
490 | (defun prelude-goto-symbol (&optional symbol-list)
491 | "Refresh imenu and jump to a place in the buffer using Ido."
492 | (interactive)
493 | (cond
494 | ((not symbol-list)
495 | (let (name-and-pos symbol-names position)
496 | (while (progn
497 | (imenu--cleanup)
498 | (setq imenu--index-alist nil)
499 | (prelude-goto-symbol (imenu--make-index-alist))
500 | (setq selected-symbol
501 | (completing-read "Symbol? " (reverse symbol-names)))
502 | (string= (car imenu--rescan-item) selected-symbol)))
503 | (unless (and (boundp 'mark-active) mark-active)
504 | (push-mark nil t nil))
505 | (setq position (cdr (assoc selected-symbol name-and-pos)))
506 | (cond
507 | ((overlayp position)
508 | (goto-char (overlay-start position)))
509 | (t
510 | (goto-char position)))
511 | (recenter)))
512 | ((listp symbol-list)
513 | (dolist (symbol symbol-list)
514 | (let (name position)
515 | (cond
516 | ((and (listp symbol) (imenu--subalist-p symbol))
517 | (prelude-goto-symbol symbol))
518 | ((listp symbol)
519 | (setq name (car symbol))
520 | (setq position (cdr symbol)))
521 | ((stringp symbol)
522 | (setq name symbol)
523 | (setq position
524 | (get-text-property 1 'org-imenu-marker symbol))))
525 | (unless (or (null position) (null name)
526 | (string= (car imenu--rescan-item) name))
527 | (add-to-list 'symbol-names (substring-no-properties name))
528 | (add-to-list 'name-and-pos (cons (substring-no-properties name) position))))))))
529 |
530 | (provide 'prelude-core)
531 | ;;; prelude-core.el ends here
532 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | [![License GPL 3][badge-license]](http://www.gnu.org/licenses/gpl-3.0.txt)
2 | [](https://www.gittip.com/bbatsov/)
3 |
4 | Emacs Prelude
5 | =============
6 |
7 | Prelude is an Emacs distribution that aims to enhance the default
8 | Emacs experience. Prelude alters a lot of the default settings,
9 | bundles a plethora of additional packages and adds its own core
10 | library to the mix. The final product offers an easy to use Emacs
11 | configuration for Emacs newcomers and lots of additional power for
12 | Emacs power users.
13 |
14 | Prelude is compatible **ONLY with GNU Emacs 24.x**. In general you're
15 | advised to always run Prelude with the latest Emacs - currently
16 | **24.4**.
17 |
18 | **Table of Contents**
19 |
20 | - [Fast Forward](#fast-forward)
21 | - [Installing Emacs 24](#installing-emacs-24)
22 | - [Installation](#installation)
23 | - [Automated](#automated)
24 | - [Via Curl](#via-curl)
25 | - [Via Wget](#via-wget)
26 | - [Manual](#manual)
27 | - [Updating Prelude](#updating-prelude)
28 | - [Manual update](#manual-update)
29 | - [Update all bundled packages](#update-all-bundled-packages)
30 | - [Update Prelude's code](#update-preludes-code)
31 | - [Restart Prelude](#restart-prelude)
32 | - [Automatic update](#automatic-update)
33 | - [Enabling additional modules](#enabling-additional-modules)
34 | - [Running](#running)
35 | - [Getting to know Prelude](#getting-to-know-prelude)
36 | - [Keymap](#keymap)
37 | - [Global](#global)
38 | - [Prelude Mode](#prelude-mode)
39 | - [OSX modifier keys](#osx-modifier-keys)
40 | - [Projectile](#projectile)
41 | - [Helm](#helm)
42 | - [Key-chords](#key-chords)
43 | - [Disabling key-chords](#disabling-key-chords)
44 | - [Automatic package installation](#automatic-package-installation)
45 | - [Color Themes](#color-themes)
46 | - [Personalizing](#personalizing)
47 | - [Disabling whitespace-mode](#disabling-whitespace-mode)
48 | - [Disable flyspell-mode](#disable-flyspell-mode)
49 | - [Caveats & Pitfalls](#caveats--pitfalls)
50 | - [Updating bundled packages](#updating-bundled-packages)
51 | - [Problems with flyspell-mode](#problems-with-flyspell-mode)
52 | - [Ugly colors in the terminal Emacs version](#ugly-colors-in-the-terminal-emacs-version)
53 | - [MELPA error on initial startup](#melpa-error-on-initial-startup)
54 | - [Warnings on arrow navigation in editor buffers](#warnings-on-navigation-in-editor-buffers)
55 | - [Customized C-a behavior](#customized-c-a-behavior)
56 | - [Poor ido matching performance on large datasets](#poor-ido-matching-performance-on-large-datasets)
57 | - [Windows compatibility](#windows-compatibility)
58 | - [Known issues](#known-issues)
59 | - [Support](#support)
60 | - [Contributors](#contributors)
61 | - [Bugs & Improvements](#bugs--improvements)
62 |
63 | ## Fast Forward
64 |
65 | Assuming you're using an Unix-like OS (`*BSD`, `GNU/Linux`, `OS X`, `Solaris`,
66 | etc), you already have Emacs 24 installed, as well as `git` & `curl` you
67 | can skip the whole manual and just type in your favorite shell the
68 | following command:
69 |
70 | ```bash
71 | curl -L http://git.io/epre | sh
72 | ```
73 |
74 | You can now power up your Emacs, sit back and enjoy Prelude,
75 | forgetting about the rest of this manual.
76 |
77 | There are two environment variables you can use to control the
78 | source repository and the installation directory. To change the
79 | installation directory:
80 |
81 | ```bash
82 | export PRELUDE_INSTALL_DIR="$HOME/.emacs.d" && curl -L https://github.com/bbatsov/prelude/raw/master/utils/installer.sh | sh
83 | ```
84 |
85 | To change the source repository:
86 |
87 | ```bash
88 | export PRELUDE_URL="https://github.com/yourname/prelude.git" && curl -L https://github.com/bbatsov/prelude/raw/master/utils/installer.sh | sh
89 | ```
90 |
91 | Note that the installer will back up any existing `.emacs` file or
92 | `.emacs.d` since it will unpack Prelude's code in `.emacs.d`. If
93 | you're doing a manual install make sure you don't have a `.emacs` file
94 | or back up your existing `.emacs.d` directory manually.
95 |
96 | Don't forget to adjust your `prelude-modules.el` file once the installation is done.
97 | By default most of the modules that ship with Prelude are not loaded.
98 |
99 | ## Installing Emacs 24
100 |
101 | Obviously to use the Emacs Prelude you have to install Emacs 24
102 | first. Have a look at the [WikEmacs articles on installing Emacs](http://wikemacs.org/index.php/Installing_Emacs).
103 |
104 | ## Installation
105 |
106 | ### Automated
107 |
108 | You can install **Emacs Prelude** via the command line with either `curl` or
109 | `wget`. Naturally `git` is also required.
110 |
111 | #### Via Curl
112 |
113 | If you're using `curl` type the following command:
114 |
115 | ```bash
116 | curl -L https://github.com/bbatsov/prelude/raw/master/utils/installer.sh | sh
117 | ```
118 |
119 | #### Via Wget
120 |
121 | If you're using `wget` type:
122 |
123 | ```bash
124 | wget --no-check-certificate https://github.com/bbatsov/prelude/raw/master/utils/installer.sh -O - | sh
125 | ```
126 |
127 | ### Manual
128 |
129 | ```bash
130 | git clone git://github.com/bbatsov/prelude.git path/to/local/repo
131 | ln -s path/to/local/repo ~/.emacs.d
132 | cd ~/.emacs.d
133 | ```
134 |
135 | If you are using Windows, you should check what Emacs thinks the `~` directory is by running Emacs and typing `C-x d ~/`, and then adjust the command appropriately.
136 |
137 | ## Updating Prelude
138 |
139 | ### Manual update
140 |
141 | The update procedure is fairly straightforward and consists of 3 steps:
142 |
143 | #### Update all bundled packages
144 |
145 | Just run M-x package-list-packages RET U x.
146 |
147 | #### Update Prelude's code
148 |
149 | ```bash
150 | cd path/to/prelude/installation
151 | git pull
152 | ```
153 |
154 | The `path/to/prelude/installation` is usually `~/.emacs.d` (at least
155 | on Unix systems).
156 |
157 | #### Restart Prelude
158 |
159 | It's generally a good idea to stop Emacs after you do the update. The
160 | next time Prelude starts it will install any new dependencies (if
161 | there are such).
162 |
163 | ### Automatic update
164 |
165 | Simply run M-x prelude-update from Emacs itself and restart Emacs afterwards.
166 |
167 | ## Enabling additional modules
168 |
169 | 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).
170 |
171 | ```lisp
172 | ;;; Uncomment the modules you'd like to use and restart Prelude afterwards
173 |
174 | (require 'prelude-c)
175 | ;; (require 'prelude-clojure)
176 | ;; (require 'prelude-coffee)
177 | ;; (require 'prelude-common-lisp)
178 | ;; (require 'prelude-css)
179 | (require 'prelude-emacs-lisp)
180 | (require 'prelude-erc)
181 | ;; (require 'prelude-erlang)
182 | ;; (require 'prelude-haskell)
183 | (require 'prelude-js)
184 | ;; (require 'prelude-latex)
185 | (require 'prelude-lisp)
186 | ;; (require 'prelude-mediawiki)
187 | (require 'prelude-org)
188 | (require 'prelude-perl)
189 | ;; (require 'prelude-python)
190 | ;; (require 'prelude-ruby)
191 | ;; (require 'prelude-scala)
192 | (require 'prelude-scheme)
193 | ;; (require 'prelude-scss)
194 | ;; (require 'prelude-web)
195 | (require 'prelude-xml)
196 | ```
197 |
198 | You'll need to adjust your `prelude-modules.el` file once the
199 | installation is done. If you are doing a manual install then you first
200 | need to copy the `prelude-modules.el` available in the sample
201 | directory to the root of `path/to/prelude/installation` and then
202 | adjust that one.
203 |
204 | After you've uncommented a module you should either restart Emacs or evaluate the module
205 | `require` expression with C-x C-e.
206 |
207 | ## Running
208 |
209 | Nothing fancy here. Just start Emacs as usual. Personally I run Emacs
210 | in daemon mode:
211 |
212 | ```bash
213 | emacs --daemon
214 | ```
215 |
216 | Afterwards I connect to the server with either a terminal or a GUI
217 | client like this:
218 |
219 | ```bash
220 | emacsclient -t
221 | emacsclient -c
222 | ```
223 |
224 | You'd probably do well to put a few aliases in your `.zshrc` (or
225 | `.bashrc`):
226 |
227 | ```bash
228 | alias e='emacsclient -t'
229 | alias ec='emacsclient -c'
230 | alias vim='emacsclient -t'
231 | alias vi='emacsclient -t'
232 | ```
233 |
234 | The last two aliases are helpful if you're used to editing files from
235 | the command line using `vi(m)`.
236 |
237 | Also you can open a file with cursor on choosen line:
238 |
239 | ```bash
240 | emacsclient somefile:1234
241 | ```
242 |
243 | This will open file 'somefile' and set cursor on line 1234.
244 |
245 | ## Getting to know Prelude
246 |
247 | Certainly the best way to understand how Prelude enhances the default
248 | Emacs experience is to peruse Prelude's source code (which is
249 | obviously written in Emacs Lisp). Understanding the code is not
250 | necessary of course. Prelude includes a `prelude-mode` minor Emacs mode
251 | which collects some of the additional functionality added by
252 | Prelude. It also adds an additional keymap that binds many of those
253 | extensions to keybindings.
254 |
255 | ### Keymap
256 |
257 | #### Global
258 |
259 | Keybinding | Description
260 | -------------------|------------------------------------------------------------
261 | C-x \\ | `align-regexp`
262 | C-+ | Increase font size(`text-scale-increase`).
263 | C-- | Decrease font size(`text-scale-decrease`).
264 | C-x O | Go back to previous window (the inverse of `other-window` (`C-x o`)).
265 | C-^ | Join two lines into one(`prelude-top-join-line`).
266 | C-x p | Start `proced` (manage processes from Emacs; works only in Linux).
267 | C-x m | Start `eshell`.
268 | C-x M-m | Start your default shell.
269 | C-x C-m | Alias for `M-x`.
270 | M-X | Like `M-x` but limited to commands that are relevant to the active major mode.
271 | C-h A | Run `apropos` (search in all Emacs symbols).
272 | C-h C-m | Display key bindings of current major mode and descriptions of every binding.
273 | M-/ | Run `hippie-expand` (a replacement for the default `dabbrev-expand`).
274 | C-x C-b | Open `ibuffer` (a replacement for the default `buffer-list`).
275 | F11 | Make the window full screen.
276 | F12 | Toggle the Emacs menu bar.
277 | C-x g | Open Magit's status buffer.
278 | M-Z | Zap up to char.
279 | C-c J or Super-> | Switch between buffers with [`ace-jump-buffer`](https://github.com/waymondo/ace-jump-buffer)
280 | C-= | Run `expand-region` (incremental text selection).
281 | C-a | Run `prelude-move-beginning-of-line`. Read [this](http://emacsredux.com/blog/2013/05/22/smarter-navigation-to-the-beginning-of-a-line/) for details.
282 |
283 | #### Prelude Mode
284 |
285 | Keybinding | Description
286 | -------------------|------------------------------------------------------------
287 | C-c o | Open the currently visited file with an external program.
288 | C-c i | Search for a symbol, only for buffers that contain code
289 | C-c g | Search in Google for the thing under point (or an interactive query).
290 | C-c G | Search in GitHub for the thing under point (or an interactive query).
291 | C-c y | Search in YouTube for the thing under point (or an interactive query).
292 | C-c U | Search in Duckduckgo for the thing under point (or an interactive query).
293 | C-S-RET or Super-o | Insert an empty line above the current line and indent it properly.
294 | S-RET or M-o | Insert an empty line and indent it properly (as in most IDEs).
295 | C-S-up or M-S-up | Move the current line or region up.
296 | C-S-down or M-S-down| Move the current line or region down.
297 | C-c n | Fix indentation in buffer and strip whitespace.
298 | C-c f | Open recently visited file.
299 | C-M-\\ | Indent region (if selected) or the entire buffer.
300 | C-c u | Open a new buffer containing the contents of URL.
301 | C-c e | Eval a bit of Emacs Lisp code and replace it with its result.
302 | C-c s | Swap two active windows.
303 | C-c D | Delete current file and buffer.
304 | C-c d | Duplicate the current line (or region).
305 | C-c M-d | Duplicate and comment the current line (or region).
306 | C-c r | Rename the current buffer and its visiting file if any.
307 | C-c t | Open a terminal emulator (`ansi-term`).
308 | C-c k | Kill all open buffers except the one you're currently in.
309 | C-c TAB | Indent and copy region to clipboard
310 | C-c I | Open user's init file.
311 | C-c S | Open shell's init file.
312 | C-c . + | Increment integer at point. Default is +1.
313 | C-c . - | Decrement integer at point. Default is -1.
314 | C-c . * | Multiply integer at point. Default is *2.
315 | C-c . / | Divide integer at point. Default is /2.
316 | C-c . \\ | Modulo integer at point. Default is modulo 2.
317 | C-c . ^ | Power to the integer at point. Default is ^2.
318 | C-c . < | Left-shift integer at point. Default is 1 position to the left.
319 | C-c . > | Right-shift integer at point. Default is 1 position to the right.
320 | C-c . # | Convert integer at point to specified base. Default is 10.
321 | C-c . % | Replace integer at point with another specified integer.
322 | C-c . ' | Perform arithmetic operations on integer at point. User specifies the operator.
323 | Super-g | Toggle between God mode and non-God mode
324 | Super-r | Recent files
325 | Super-j | Join lines
326 | Super-k | Kill whole line
327 | Super-m m | Magit status
328 | Super-m l | Magit log
329 | Super-m f | Magit file log
330 | Super-m b | Magit blame mode
331 |
332 | **Note**: For various arithmetic operations, the prefix `C-c .` only needs to be pressed once for the first operation.
333 | For subsequent operations, only the appropriate operations (i.e. `+`, `-`, `*`, `/`... needs to be pressed).
334 |
335 | #### OSX modifier keys
336 |
337 | Prelude does not mess by default with the standard mapping of `Command` (to `Super`) and `Option` (to `Meta`).
338 |
339 | If you want to swap them add this to your personal config:
340 |
341 | ```lisp
342 | (setq mac-command-modifier 'meta)
343 | (setq mac-option-modifier 'super)
344 | ```
345 |
346 | You can also temporarily swap them with `C-c w` (`M-x prelude-swap-meta-and-super`).
347 |
348 | #### Projectile
349 |
350 | Here's a list of functionality provided by [Projectile](https://github.com/bbatsov/projectile):
351 |
352 | Keybinding | Description
353 | -------------------|------------------------------------------------------------
354 | C-c p f | Display a list of all files in the project. With a prefix argument it will clear the cache first.
355 | C-c p d | Display a list of all directories in the project. With a prefix argument it will clear the cache first.
356 | C-c p T | Display a list of all test files(specs, features, etc) in the project.
357 | C-c p s g | Run grep on the files in the project.
358 | M-- C-c p s g | Run grep on `projectile-grep-default-files` in the project.
359 | C-c p b | Display a list of all project buffers currently open.
360 | C-c p o | Runs `multi-occur` on all project buffers currently open.
361 | C-c p r | Runs interactive query-replace on all files in the projects.
362 | C-c p i | Invalidates the project cache (if existing).
363 | C-c p R | Regenerates the projects `TAGS` file.
364 | C-c p k | Kills all project buffers.
365 | C-c p D | Opens the root of the project in `dired`.
366 | C-c p e | Shows a list of recently visited project files.
367 | C-c p s a | Runs `ack` on the project. Requires the presence of `ack-and-a-half`.
368 | C-c p s s | Runs `ag` on the project. Requires the presence of `ag.el`.
369 | C-c p a | Runs `ack` on the project. Requires the presence of `ack-and-a-half`.
370 | C-c p c | Runs a standard compilation command for your type of project.
371 | C-c p P | Runs a standard test command for your type of project.
372 | C-c p z | Adds the currently visited to the cache.
373 | C-c p p | Display a list of known projects you can switch to.
374 |
375 | Prelude adds an extra keymap prefix `S-p` (`S` stands for
376 | `Super`), so you can use `S-p` instead of `C-c p`.
377 |
378 | If you ever forget any of Projectile's keybindings just do a:
379 |
380 | C-c p C-h
381 |
382 | #### Helm
383 |
384 | Helm is setup according to this guide: [A Package in a league of its own: Helm](http://tuhdo.github.io/helm-intro.html).
385 |
386 | You can learn Helm usage and key bindings following the guide. C-c h is Prelude's default prefix key for Helm.
387 | If you don't remember any key binding, append C-h after C-c h for a list of key bindings in Helm.
388 |
389 | 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)`.
390 | When `prelude-helm-everywhere` is activated, Helm enables these global key bindings:
391 |
392 | Key binding | Description
393 | -------------------|----------------------------------------------
394 | M-x | Run [helm-M-x](http://tuhdo.github.io/helm-intro.html#sec-3), an interactive version of M-x.
395 | M-y | Run [helm-show-kill-ring](http://tuhdo.github.io/helm-intro.html#sec-4), shows the content of `kill-ring`.
396 | C-x b | Run [helm-mini](http://tuhdo.github.io/helm-intro.html#sec-5), an interactive version of `C-x b` with more features.
397 | C-x C-f | Run [helm-find-files](http://tuhdo.github.io/helm-intro.html#sec-6), an interactive version of `find-file` with more features.
398 | C-h f | Run [helm-apropos](http://tuhdo.github.io/helm-intro.html#sec-13), an interactive version of `apropos-command`.
399 | C-h r | Run [helm-info-emacs](http://tuhdo.github.io/helm-intro.html#sec-14), an interactive version of `info-emacs-manual`.
400 | C-h C-l | Run `helm-locate-library` that can search for locations of any file loaded into Emacs.
401 |
402 | This key binding is activated in `shell-mode`:
403 |
404 | Key Binding | Description
405 | -------------------|----------------------------------------------
406 | C-c C-l | Run `helm-comint-input-ring` that shows `shell` history using Helm interface.
407 |
408 | This key bindings is activated in `eshell-mode`:
409 |
410 | Key Binding | Description
411 | -------------------|----------------------------------------------
412 | C-c C-l | Run `helm-eshell-history` that shows `eshell` history using Helm interface.
413 |
414 | 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.
415 |
416 | You can always reactivate Helm with `(prelude-global-helm-global-mode-on)`.
417 |
418 |
419 | #### Key-chords
420 |
421 | **Key-chords are available only when the `prelude-key-chord` module has been enabled.**
422 |
423 | Keybinding | Description
424 | -------------------|----------------------------------------------
425 | jj | Jump to the beginning of a word(`ace-jump-word-mode`)
426 | jk | Jump to a character(`ace-jump-char-mode`)
427 | jl | Jump to the beginning of a line(`ace-jump-line-mode`)
428 | JJ | Jump back to previous buffer(`prelude-switch-to-previous-buffer`)
429 | uu | View edits as a tree(`undo-tree-visualize`)
430 | xx | Executed extended command(`execute-extended-command`)
431 | yy | Browse the kill ring(`browse-kill-ring`)
432 |
433 | ##### Disabling key-chords
434 |
435 | In some cases you may not want to have a key-chord that is defined by prelude,
436 | in which case you can disable the binding in your `personal.el` file by setting
437 | its command to `nil`. For example, to disable the `jj` key-chord add the
438 | following line:
439 |
440 | ```lisp
441 | (key-chord-define-global "jj" nil)
442 | ```
443 |
444 | If you're an `evil-mode` user you'll probably do well to disable `key-chord-mode` altogether:
445 |
446 | ```lisp
447 | (key-chord-mode -1)
448 | ```
449 |
450 | #### vim emulation
451 |
452 | If you want to use vim inside of emacs enable the `prelude-evil` module which provides
453 | support for `evil-mode`.
454 |
455 | ## Automatic package installation
456 |
457 | The default Prelude installation comes with a bare minimum of
458 | functionality. It will however install add-ons for various programming
459 | languages and frameworks on demand. For instance - if you try to open
460 | a `.clj` file `clojure-mode`, `cider` and Prelude's enhanced Lisp
461 | configuration will be installed automatically for you.
462 |
463 | You can, of course, install anything you wish manually as well.
464 |
465 | ### Color Themes
466 |
467 | Emacs 24 ships with a new theming facility that effectively renders
468 | the old color-theme package obsolete. Emacs 24 provides a dozen of
469 | built-in themes you can use out-of-the-box by invoking the `M-x
470 | load-theme` command.
471 |
472 | [Zenburn](https://github.com/bbatsov/zenburn-emacs) is the default color theme in Prelude, but you can change it
473 | at your discretion. Why Zenburn? I (and lots of hackers around the
474 | world) find it pretty neat for some reason. Personally I find the
475 | default theme pretty tiresome for the eyes, that's why I took that
476 | "controversial" decision to replace it. You can, of course, easily go
477 | back to the default (or select another theme entirely).
478 |
479 | To disable Zenburn just put in your personal config the following
480 | line:
481 |
482 | ```lisp
483 | (disable-theme 'zenburn)
484 | ```
485 |
486 | Or you can use another theme altogether by adding something in `personal/preload` like:
487 |
488 | ```lisp
489 | (setq prelude-theme 'solarized-dark)
490 | ```
491 |
492 | **P.S.** Solarized is not available by default - you'll have to
493 | install it from MELPA first (`M-x package-install RET
494 | solarized-theme`).
495 |
496 | ### Personalizing
497 |
498 | Fork the official Prelude repo and add your own touch to it. You're advised to avoid changing stuff outside of the
499 | personal folder to avoid having to deal with git merge conflicts in the future.
500 |
501 | If you'd like to add some auto installation of packages in your
502 | personal config use the following code:
503 |
504 | ```lisp
505 | (prelude-require-packages '(some-package some-other-package))
506 | ```
507 |
508 | If you require just a single package you can also use:
509 |
510 | ```lisp
511 | (prelude-require-package 'some-package)
512 | ```
513 |
514 | #### Preloading personal config
515 |
516 | Sometimes you might want to load code before Prelude has started loading. Prelude will automatically preload all
517 | Emacs Lisp files in your `personal/preload` directory. Note that at this point you can't using anything from
518 | Prelude, except a few variables like `prelude-dir`, etc (since nothing is yet loaded).
519 |
520 | #### Disabling whitespace-mode
521 |
522 | Although `whitespace-mode` is awesome some people might find it too
523 | intrusive. You can disable it in your
524 | personal config with the following bit of code:
525 |
526 | ```lisp
527 | (setq prelude-whitespace nil)
528 | ```
529 |
530 | If you like `whitespace-mode` but prefer it to not automatically
531 | cleanup your file on save, you can disable that behavior by setting
532 | prelude-clean-whitespace-on-save to nil in your config file with:
533 |
534 | ```lisp
535 | (setq prelude-clean-whitespace-on-save nil)
536 | ```
537 |
538 | The prelude-clean-whitespace-on-save setting can also be set on a
539 | per-file or directory basis by using a file variable or a
540 | .dir-locals.el file.
541 |
542 |
543 | #### Disable flyspell-mode
544 |
545 | If you're not fond of spellchecking on the fly:
546 |
547 | ```lisp
548 | (setq prelude-flyspell nil)
549 | ```
550 |
551 | ## Caveats & Pitfalls
552 |
553 | ### Updating bundled packages
554 |
555 | Generally it's a good idea to do a package update before running
556 | updating Prelude, since the latest Prelude code might depend on newer
557 | versions of the bundled packages than you would currently have
558 | installed.
559 |
560 | If you're doing manual Prelude updates you should always do a package update first.
561 |
562 | `M-x package-list-packages RET U x`
563 |
564 | That's not necessary if you're using `M-x prelude-update`, since it
565 | will automatically update the installed packages.
566 |
567 | ### Problems with flyspell-mode
568 |
569 | Prelude makes heavy use of the flyspell-mode package for spell
570 | checking of various things. The proper operation of flyspell depends
571 | on the presence of the `aspell` program and an `en` dictionary on your
572 | system. You can install `aspell` and the dictionary on OS X with
573 | `homebrew` like this:
574 |
575 | ```bash
576 | brew install aspell --with-lang=en
577 | ```
578 |
579 | On Linux distros - just use your distro's package manager.
580 |
581 | ### Ugly colors in the terminal Emacs version
582 |
583 | If your Emacs looks considerably uglier in a terminal (compared to the
584 | GUI version) try adding this to your `.bashrc` or `.zshrc`:
585 |
586 | ```bash
587 | export TERM=xterm-256color
588 | ```
589 |
590 | Source the `.bashrc` file and start Emacs again.
591 |
592 | ### MELPA error on initial startup
593 |
594 | If you get some http connection error related to the MELPA repo
595 | just do a manual `M-x package-refresh-contents` and restart Emacs
596 | afterwards.
597 |
598 | ### Warnings on arrow navigation in editor buffers
599 |
600 | This is not a bug - it's a feature! I firmly believe that the one true
601 | way to use Emacs is by using it the way it was intended to be used (as
602 | far as navigation is concerned at least).
603 |
604 | If you'd like to be take this a step further and disable the arrow key navigation
605 | completely put this in your personal config:
606 |
607 | ```lisp
608 | (setq guru-warn-only nil)
609 | ```
610 |
611 | To disable `guru-mode` completely add the following snippet to your
612 | personal Emacs config:
613 |
614 | ```lisp
615 | (setq prelude-guru nil)
616 | ```
617 |
618 | ### Customized C-a behavior
619 |
620 | Prelude overrides `C-a` to behave as described
621 | [here](http://emacsredux.com/blog/2013/05/22/smarter-navigation-to-the-beginning-of-a-line/). If
622 | you don't like that simply add this to your personal config:
623 |
624 | ```lisp
625 | (global-set-key [remap move-beginning-of-line]
626 | 'move-beginning-of-line)
627 | ```
628 |
629 | ### Poor ido matching performance on large datasets
630 |
631 | Prelude swaps the default `ido` flex matching with the more powerful
632 | [ido-flx](https://github.com/lewang/flx).
633 |
634 | The sorting algorithm `flx` uses is more complex, but yields better results.
635 |
636 | On slower machines, it may be necessary to lower `flx-ido-threshhold` to
637 | ensure a smooth experience.
638 |
639 | ```lisp
640 | (setq flx-ido-threshhold 1000)
641 | ```
642 |
643 | You can always disable the improved sorting algorithm all together like this:
644 |
645 | ```lisp
646 | (flx-ido-mode -1)
647 | ```
648 |
649 | ### Windows compatibility
650 |
651 | While everything in Prelude should work fine in Windows, I test it only
652 | with Linux & OSX, so there are Windows related problems from time to
653 | time. This situation will probably improve over time.
654 |
655 | ## Known issues
656 |
657 | Check out the project's
658 | [issue list](https://github.com/bbatsov/prelude/issues?sort=created&direction=desc&state=open)
659 | a list of unresolved issues. By the way - feel free to fix any of them
660 | and send me a pull request. :-)
661 |
662 | ## Support
663 |
664 | Support is available via the Prelude Google Group .
665 |
666 | There's also a Freenode channel you can visit - `#prelude-emacs`.
667 |
668 | ## Contributors
669 |
670 | Here's a [list](https://github.com/bbatsov/prelude/contributors) of all the people who have contributed to the
671 | development of Emacs Prelude.
672 |
673 | ## Bugs & Improvements
674 |
675 | Bug reports and suggestions for improvements are always
676 | welcome. GitHub pull requests are even better! :-)
677 |
678 | I'm also accepting financial contributions via [gittip](https://www.gittip.com/bbatsov).
679 |
680 | [](https://www.gittip.com/bbatsov)
681 |
682 | Cheers,
683 | [Bozhidar](https://twitter.com/bbatsov)
684 |
685 | [badge-license]: https://img.shields.io/badge/license-GPL_3-green.svg
686 |
--------------------------------------------------------------------------------