Using Emacs Prelude now.... gonna figure things out

Signed-off-by: TuDatTr <tran.tuan-dat@mailbox.org>
This commit is contained in:
TuDatTr
2018-01-08 03:42:57 +01:00
parent 215bf58939
commit 51695cb484
347 changed files with 5407 additions and 2297 deletions

View File

@@ -0,0 +1,30 @@
# Emacs Prelude Modules
Prelude provides extra functionality through modules. Some modules may
require extra steps to enable all functionality. These steps and the
functionality provided by these modules are documented on the
following links.
- C
- Clojure
- Coffee
- Common-Lisp
- CSS
- Emacs-Lisp
- [ERC](prelude-erc.md)
- Erlang
- Elixir
- Haskell
- JS
- Latex
- Lisp
- Markdown
- MediaWiki
- Org
- Perl
- [Python](prelude-python.md)
- Ruby
- Scala
- Scheme
- Scss
- Web

View File

@@ -0,0 +1,50 @@
# Prelude ERC Quickstart
## Customizing Server list
If you want to join a list of servers on `M-x start-irc`, other than
the default list, please redefine the variable `my-fav-irc` as follows
in your personal config
``` emacs-lisp
(setq my-fav-irc '("irc.freenode.net"
"irc.oftc.net"
"irc.mozilla.org"
"irc.gnome.org"))
```
## Customizing Last Quit Message
If you want to customize your IRC Last Quit Message from *Asta la
vista* to something more funkier, please redefine `bye-irc-message` as
follows
``` emacs-lisp
(setq bye-erc-message "adios")
```
## Reading NickServ passwords from auth-source plugin
If you want to automatically authenticate while logging into IRC
servers set the `erc-prompt-for-password` to nil as follows
``` emacs-lisp
(setq erc-prompt-for-password nil)
```
Now you can set password in plaintext in .authinfo file in the netRC
format or you it encrypted in .authinfo.gpg file after setting up gpg
in emacs
## Opening all ERC buffers in a new perspective
Many a time when we start IRC with the `start-irc` command, all the
channels open in our existing workspace, which can be annoying to
some; especially to those who like to organize their buffers into
separate groups (perspectives). To avoid this scenario, it is better
to group all the ERC buffers into one perspective called `IRC` when
`start-irc` is called. To enable this set the `prelude-new-irc-persp`
variable to true as follows
``` emacs-lisp
(setq prelude-new-irc-persp t)
```

View File

@@ -0,0 +1,18 @@
# Prelude Python Quickstart
## Python Mode
Emacs comes with Python programming support through the built-in
Python-mode. Whenever you are editing Python code run `C-h m` to
look at the Python mode key bindings. Alternatively look at the
menu bar entries under Python. To toggle the menu bar press `F12`.
## Syntax checking
Prelude ships with [Flycheck](https://github.com/flycheck/flycheck),
an on the fly syntax checker. Flycheck has support for two Python
syntax checkers, [Pylint](http://www.pylint.org/) and
[Flake8](http://flake8.readthedocs.org/en/latest/). In
order to have Flycheck support on the fly syntax checking for
Python you need to have either of these installed and accessible to
Emacs. In order to manually choose a checker run `C-c ! s`.

View File

@@ -0,0 +1,59 @@
;;; prelude-c.el --- Emacs Prelude: cc-mode configuration.
;;
;; Copyright © 2011-2017 Bozhidar Batsov
;;
;; Author: Bozhidar Batsov <bozhidar@batsov.com>
;; URL: https://github.com/bbatsov/prelude
;; Version: 1.0.0
;; Keywords: convenience
;; This file is not part of GNU Emacs.
;;; Commentary:
;; Some basic configuration for cc-mode and the modes derived from it.
;;; License:
;; This program is free software; you can redistribute it and/or
;; modify it under the terms of the GNU General Public License
;; as published by the Free Software Foundation; either version 3
;; of the License, or (at your option) any later version.
;;
;; This program is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;; GNU General Public License for more details.
;;
;; You should have received a copy of the GNU General Public License
;; along with GNU Emacs; see the file COPYING. If not, write to the
;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
;; Boston, MA 02110-1301, USA.
;;; Code:
(require 'prelude-programming)
(defun prelude-c-mode-common-defaults ()
(setq c-default-style "k&r"
c-basic-offset 4)
(c-set-offset 'substatement-open 0))
(setq prelude-c-mode-common-hook 'prelude-c-mode-common-defaults)
;; this will affect all modes derived from cc-mode, like
;; java-mode, php-mode, etc
(add-hook 'c-mode-common-hook (lambda ()
(run-hooks 'prelude-c-mode-common-hook)))
(defun prelude-makefile-mode-defaults ()
(whitespace-toggle-options '(tabs))
(setq indent-tabs-mode t ))
(setq prelude-makefile-mode-hook 'prelude-makefile-mode-defaults)
(add-hook 'makefile-mode-hook (lambda ()
(run-hooks 'prelude-makefile-mode-hook)))
(provide 'prelude-c)
;;; prelude-c.el ends here

View File

@@ -0,0 +1,66 @@
;;; prelude-clojure.el --- Emacs Prelude: Clojure programming configuration.
;;
;; Copyright © 2011-2017 Bozhidar Batsov
;;
;; Author: Bozhidar Batsov <bozhidar@batsov.com>
;; URL: http://batsov.com/prelude
;; Version: 1.0.0
;; Keywords: convenience
;; This file is not part of GNU Emacs.
;;; Commentary:
;; Some basic configuration for clojure-mode.
;;; License:
;; This program is free software; you can redistribute it and/or
;; modify it under the terms of the GNU General Public License
;; as published by the Free Software Foundation; either version 3
;; of the License, or (at your option) any later version.
;;
;; This program is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;; GNU General Public License for more details.
;;
;; You should have received a copy of the GNU General Public License
;; along with GNU Emacs; see the file COPYING. If not, write to the
;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
;; Boston, MA 02110-1301, USA.
;;; Code:
(require 'prelude-lisp)
(prelude-require-packages '(clojure-mode cider))
(eval-after-load 'clojure-mode
'(progn
(defun prelude-clojure-mode-defaults ()
(subword-mode +1)
(run-hooks 'prelude-lisp-coding-hook))
(setq prelude-clojure-mode-hook 'prelude-clojure-mode-defaults)
(add-hook 'clojure-mode-hook (lambda ()
(run-hooks 'prelude-clojure-mode-hook)))))
(eval-after-load 'cider
'(progn
(setq nrepl-log-messages t)
(add-hook 'cider-mode-hook 'eldoc-mode)
(defun prelude-cider-repl-mode-defaults ()
(subword-mode +1)
(run-hooks 'prelude-interactive-lisp-coding-hook))
(setq prelude-cider-repl-mode-hook 'prelude-cider-repl-mode-defaults)
(add-hook 'cider-repl-mode-hook (lambda ()
(run-hooks 'prelude-cider-repl-mode-hook)))))
(provide 'prelude-clojure)
;;; prelude-clojure.el ends here

View File

@@ -0,0 +1,60 @@
;;; prelude-coffee.el --- Emacs Prelude: CoffeeScript programming support.
;;
;; Copyright © 2011-2017 Bozhidar Batsov
;;
;; Author: Bozhidar Batsov <bozhidar@batsov.com>
;; URL: https://github.com/bbatsov/prelude
;; Version: 1.0.0
;; Keywords: convenience
;; This file is not part of GNU Emacs.
;;; Commentary:
;; CoffeeScript is a nice little language that comples to JavaScript.
;;; License:
;; This program is free software; you can redistribute it and/or
;; modify it under the terms of the GNU General Public License
;; as published by the Free Software Foundation; either version 3
;; of the License, or (at your option) any later version.
;;
;; This program is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;; GNU General Public License for more details.
;;
;; You should have received a copy of the GNU General Public License
;; along with GNU Emacs; see the file COPYING. If not, write to the
;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
;; Boston, MA 02110-1301, USA.
;;; Code:
(require 'prelude-programming)
(prelude-require-package 'coffee-mode)
(eval-after-load 'coffee-mode
'(progn
;; CoffeeScript uses two spaces.
(setq coffee-tab-width 2)
;; remove the "Generated by CoffeeScript" header
(add-to-list 'coffee-args-compile "--no-header")
(defun prelude-coffee-mode-defaults ()
;; Update the already compiled js on save
(and (buffer-file-name)
(file-exists-p (buffer-file-name))
(file-exists-p (coffee-compiled-file-name (buffer-file-name)))
(coffee-cos-mode t))
(subword-mode +1))
(setq prelude-coffee-mode-hook 'prelude-coffee-mode-defaults)
(add-hook 'coffee-mode-hook (lambda ()
(run-hooks 'prelude-coffee-mode-hook)))))
(provide 'prelude-coffee)
;;; prelude-coffee.el ends here

View File

@@ -0,0 +1,85 @@
;;; prelude-common-lisp.el --- Emacs Prelude: lisp-mode and SLIME config.
;;
;; Copyright © 2011-2017 Bozhidar Batsov
;;
;; Author: Bozhidar Batsov <bozhidar@batsov.com>
;; URL: https://github.com/bbatsov/prelude
;; Version: 1.0.0
;; Keywords: convenience
;; This file is not part of GNU Emacs.
;;; Commentary:
;; Configuration for lisp-mode and SLIME.
;;; License:
;; This program is free software; you can redistribute it and/or
;; modify it under the terms of the GNU General Public License
;; as published by the Free Software Foundation; either version 3
;; of the License, or (at your option) any later version.
;;
;; This program is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;; GNU General Public License for more details.
;;
;; You should have received a copy of the GNU General Public License
;; along with GNU Emacs; see the file COPYING. If not, write to the
;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
;; Boston, MA 02110-1301, USA.
;;; Code:
(require 'prelude-lisp)
(prelude-require-package 'slime)
;; the SBCL configuration file is in Common Lisp
(add-to-list 'auto-mode-alist '("\\.sbclrc\\'" . lisp-mode))
;; Open files with .cl extension in lisp-mode
(add-to-list 'auto-mode-alist '("\\.cl\\'" . lisp-mode))
;; a list of alternative Common Lisp implementations that can be
;; used with SLIME. Note that their presence render
;; inferior-lisp-program useless. This variable holds a list of
;; programs and if you invoke SLIME with a negative prefix
;; argument, M-- M-x slime, you can select a program from that list.
(setq slime-lisp-implementations
'((ccl ("ccl"))
(clisp ("clisp" "-q"))
(cmucl ("cmucl" "-quiet"))
(sbcl ("sbcl" "--noinform") :coding-system utf-8-unix)))
;; select the default value from slime-lisp-implementations
(if (and (eq system-type 'darwin)
(executable-find "ccl"))
;; default to Clozure CL on OS X
(setq slime-default-lisp 'ccl)
;; default to SBCL on Linux and Windows
(setq slime-default-lisp 'sbcl))
;; Add fancy slime contribs
(setq slime-contribs '(slime-fancy slime-cl-indent))
(add-hook 'lisp-mode-hook (lambda () (run-hooks 'prelude-lisp-coding-hook)))
;; rainbow-delimeters messes up colors in slime-repl, and doesn't seem to work
;; anyway, so we won't use prelude-lisp-coding-defaults.
(add-hook 'slime-repl-mode-hook (lambda ()
(smartparens-strict-mode +1)
(whitespace-mode -1)))
(eval-after-load "slime"
'(progn
(setq slime-complete-symbol-function 'slime-fuzzy-complete-symbol
slime-fuzzy-completion-in-place t
slime-enable-evaluate-in-emacs t
slime-autodoc-use-multiline-p t
slime-auto-start 'always)
(define-key slime-mode-map (kbd "C-c C-s") 'slime-selector)))
(provide 'prelude-common-lisp)
;;; prelude-common-lisp.el ends here

View File

@@ -0,0 +1,48 @@
;;; prelude-company.el --- company-mode setup
;;
;; Copyright © 2011-2017 Bozhidar Batsov
;;
;; Author: Bozhidar Batsov <bozhidar@batsov.com>
;; URL: https://github.com/bbatsov/prelude
;; Version: 1.0.0
;; Keywords: convenience
;; This file is not part of GNU Emacs.
;;; Commentary:
;; company-mode config.
;;; License:
;; This program is free software; you can redistribute it and/or
;; modify it under the terms of the GNU General Public License
;; as published by the Free Software Foundation; either version 3
;; of the License, or (at your option) any later version.
;;
;; This program is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;; GNU General Public License for more details.
;;
;; You should have received a copy of the GNU General Public License
;; along with GNU Emacs; see the file COPYING. If not, write to the
;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
;; Boston, MA 02110-1301, USA.
;;; Code:
(prelude-require-packages '(company))
(require 'company)
(setq company-idle-delay 0.5)
(setq company-tooltip-limit 10)
(setq company-minimum-prefix-length 2)
;; invert the navigation direction if the the completion popup-isearch-match
;; is displayed on top (happens near the bottom of windows)
(setq company-tooltip-flip-when-above t)
(global-company-mode 1)
(provide 'prelude-company)
;;; prelude-company.el ends here

View File

@@ -0,0 +1,51 @@
;;; prelude-css.el --- Emacs Prelude: css support
;;
;; Copyright © 2011-2017 Bozhidar Batsov
;;
;; Author: Bozhidar Batsov <bozhidar@batsov.com>
;; URL: http://www.batsov.com/emacs-prelude
;; Version: 1.0.0
;; Keywords: convenience
;; This file is not part of GNU Emacs.
;;; Commentary:
;; Some basic configuration for css-mode.
;;; License:
;; This program is free software; you can redistribute it and/or
;; modify it under the terms of the GNU General Public License
;; as published by the Free Software Foundation; either version 3
;; of the License, or (at your option) any later version.
;;
;; This program is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;; GNU General Public License for more details.
;;
;; You should have received a copy of the GNU General Public License
;; along with GNU Emacs; see the file COPYING. If not, write to the
;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
;; Boston, MA 02110-1301, USA.
;;; Code:
(eval-after-load 'css-mode
'(progn
(prelude-require-packages '(rainbow-mode))
(setq css-indent-offset 2)
(defun prelude-css-mode-defaults ()
(rainbow-mode +1)
(run-hooks 'prelude-prog-mode-hook))
(setq prelude-css-mode-hook 'prelude-css-mode-defaults)
(add-hook 'css-mode-hook (lambda ()
(run-hooks 'prelude-css-mode-hook)))))
(provide 'prelude-css)
;;; prelude-css.el ends here

View File

@@ -0,0 +1,40 @@
;;; prelude-elixir.el --- Emacs Prelude: Elixir programming support.
;;
;; Copyright © 2014-2017 Samuel Tonini
;;
;; Author: Samuel Tonini <tonini.samuel@gmail.com>
;; Version: 1.0.0
;; Keywords: convenience elixir
;; This file is not part of GNU Emacs.
;;; Commentary:
;; Some basic configuration for Elixir development.
;;; License:
;; This program is free software; you can redistribute it and/or
;; modify it under the terms of the GNU General Public License
;; as published by the Free Software Foundation; either version 3
;; of the License, or (at your option) any later version.
;;
;; This program is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;; GNU General Public License for more details.
;;
;; You should have received a copy of the GNU General Public License
;; along with GNU Emacs; see the file COPYING. If not, write to the
;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
;; Boston, MA 02110-1301, USA.
;;; Code:
(require 'prelude-programming)
(prelude-require-packages '(elixir-mode alchemist))
(provide 'prelude-elixir)
;;; prelude-elixir.el ends here

View File

@@ -0,0 +1,120 @@
;;; prelude-emacs-lisp.el --- Emacs Prelude: Nice config for Elisp programming.
;;
;; Copyright © 2011-2017 Bozhidar Batsov
;;
;; Author: Bozhidar Batsov <bozhidar@batsov.com>
;; URL: https://github.com/bbatsov/prelude
;; Version: 1.0.0
;; Keywords: convenience
;; Package-Requires: ((prelude-lisp "1.0.0"))
;; This file is not part of GNU Emacs.
;;; Commentary:
;; Nice config for Elisp Programming.
;;; License:
;; This program is free software; you can redistribute it and/or
;; modify it under the terms of the GNU General Public License
;; as published by the Free Software Foundation; either version 3
;; of the License, or (at your option) any later version.
;;
;; This program is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;; GNU General Public License for more details.
;;
;; You should have received a copy of the GNU General Public License
;; along with GNU Emacs; see the file COPYING. If not, write to the
;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
;; Boston, MA 02110-1301, USA.
;;; Code:
(require 'prelude-lisp)
(require 'crux)
(prelude-require-packages '(elisp-slime-nav rainbow-mode))
(defun prelude-recompile-elc-on-save ()
"Recompile your elc when saving an elisp file."
(add-hook 'after-save-hook
(lambda ()
(when (and
(string-prefix-p prelude-dir (file-truename buffer-file-name))
(file-exists-p (byte-compile-dest-file buffer-file-name)))
(emacs-lisp-byte-compile)))
nil
t))
(defun prelude-visit-ielm ()
"Switch to default `ielm' buffer.
Start `ielm' if it's not already running."
(interactive)
(crux-start-or-switch-to 'ielm "*ielm*"))
(define-key emacs-lisp-mode-map (kbd "C-c C-z") 'prelude-visit-ielm)
(define-key emacs-lisp-mode-map (kbd "C-c C-c") 'eval-defun)
(define-key emacs-lisp-mode-map (kbd "C-c C-b") 'eval-buffer)
(defun prelude-conditional-emacs-lisp-checker ()
"Don't check doc style in Emacs Lisp test files."
(let ((file-name (buffer-file-name)))
(when (and file-name (string-match-p ".*-tests?\\.el\\'" file-name))
(setq-local flycheck-checkers '(emacs-lisp)))))
(defun prelude-emacs-lisp-mode-defaults ()
"Sensible defaults for `emacs-lisp-mode'."
(run-hooks 'prelude-lisp-coding-hook)
(eldoc-mode +1)
(prelude-recompile-elc-on-save)
(rainbow-mode +1)
(setq mode-name "EL")
(prelude-conditional-emacs-lisp-checker))
(setq prelude-emacs-lisp-mode-hook 'prelude-emacs-lisp-mode-defaults)
(add-hook 'emacs-lisp-mode-hook (lambda ()
(run-hooks 'prelude-emacs-lisp-mode-hook)))
(add-to-list 'auto-mode-alist '("Cask\\'" . emacs-lisp-mode))
;; ielm is an interactive Emacs Lisp shell
(defun prelude-ielm-mode-defaults ()
"Sensible defaults for `ielm'."
(run-hooks 'prelude-interactive-lisp-coding-hook)
(eldoc-mode +1))
(setq prelude-ielm-mode-hook 'prelude-ielm-mode-defaults)
(add-hook 'ielm-mode-hook (lambda ()
(run-hooks 'prelude-ielm-mode-hook)))
(eval-after-load "elisp-slime-nav"
'(diminish 'elisp-slime-nav-mode))
(eval-after-load "rainbow-mode"
'(diminish 'rainbow-mode))
(eval-after-load "eldoc"
'(diminish 'eldoc-mode))
(eval-after-load "ielm"
'(progn
(define-key ielm-map (kbd "M-(") (prelude-wrap-with "("))
(define-key ielm-map (kbd "M-\"") (prelude-wrap-with "\""))))
;; enable elisp-slime-nav-mode
(dolist (hook '(emacs-lisp-mode-hook ielm-mode-hook))
(add-hook hook 'elisp-slime-nav-mode))
(defun conditionally-enable-smartparens-mode ()
"Enable `smartparens-mode' in the minibuffer, during `eval-expression'."
(if (eq this-command 'eval-expression)
(smartparens-mode 1)))
(add-hook 'minibuffer-setup-hook 'conditionally-enable-smartparens-mode)
(provide 'prelude-emacs-lisp)
;;; prelude-emacs-lisp.el ends here

View File

@@ -0,0 +1,162 @@
;;; prelude-erc.el --- Emacs Prelude: ERC mode configuration.
;;
;; Copyright © 2011-2017 Bozhidar Batsov
;;
;; Author: Bozhidar Batsov <bozhidar@batsov.com>
;; URL: https://github.com/bbatsov/prelude
;; Version: 1.0.0
;; Keywords: convenience
;; This file is not part of GNU Emacs.
;;; Commentary:
;; Some basic configuration for ERC mode, which should make your
;; IRC experience a bit more pleasant.
;;; License:
;; This program is free software; you can redistribute it and/or
;; modify it under the terms of the GNU General Public License
;; as published by the Free Software Foundation; either version 3
;; of the License, or (at your option) any later version.
;;
;; This program is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;; GNU General Public License for more details.
;;
;; You should have received a copy of the GNU General Public License
;; along with GNU Emacs; see the file COPYING. If not, write to the
;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
;; Boston, MA 02110-1301, USA.
;;; Code:
(require 'erc)
(require 'erc-log)
(require 'erc-notify)
(require 'erc-spelling)
(require 'erc-autoaway)
;; Interpret mIRC-style color commands in IRC chats
(setq erc-interpret-mirc-color t)
;; The following are commented out by default, but users of other
;; non-Emacs IRC clients might find them useful.
;; Kill buffers for channels after /part
(setq erc-kill-buffer-on-part t)
;; Kill buffers for private queries after quitting the server
(setq erc-kill-queries-on-quit t)
;; Kill buffers for server messages after quitting the server
(setq erc-kill-server-buffer-on-quit t)
;; open query buffers in the current window
(setq erc-query-display 'buffer)
;; exclude boring stuff from tracking
(erc-track-mode t)
(setq erc-track-exclude-types '("JOIN" "NICK" "PART" "QUIT" "MODE"
"324" "329" "332" "333" "353" "477"))
;; logging
(setq erc-log-channels-directory "~/.erc/logs/")
(if (not (file-exists-p erc-log-channels-directory))
(mkdir erc-log-channels-directory t))
(setq erc-save-buffer-on-part t)
;; FIXME - this advice is wrong and is causing problems on Emacs exit
;; (defadvice save-buffers-kill-emacs (before save-logs (arg) activate)
;; (save-some-buffers t (lambda () (when (eq major-mode 'erc-mode) t))))
;; truncate long irc buffers
(erc-truncate-mode +1)
;; enable spell checking
(when prelude-flyspell
(erc-spelling-mode 1))
;; set different dictionaries by different servers/channels
;;(setq erc-spelling-dictionaries '(("#emacs" "american")))
(defvar erc-notify-nick-alist nil
"Alist of nicks and the last time they tried to trigger a
notification")
(defvar erc-notify-timeout 10
"Number of seconds that must elapse between notifications from
the same person.")
(defun erc-notify-allowed-p (nick &optional delay)
"Return non-nil if a notification should be made for NICK.
If DELAY is specified, it will be the minimum time in seconds
that can occur between two notifications. The default is
`erc-notify-timeout'."
(unless delay (setq delay erc-notify-timeout))
(let ((cur-time (time-to-seconds (current-time)))
(cur-assoc (assoc nick erc-notify-nick-alist))
(last-time nil))
(if cur-assoc
(progn
(setq last-time (cdr cur-assoc))
(setcdr cur-assoc cur-time)
(> (abs (- cur-time last-time)) delay))
(push (cons nick cur-time) erc-notify-nick-alist)
t)))
;; autoaway setup
(setq erc-auto-discard-away t)
(setq erc-autoaway-idle-seconds 600)
(setq erc-autoaway-use-emacs-idle t)
;; utf-8 always and forever
(setq erc-server-coding-system '(utf-8 . utf-8))
(defvar my-fav-irc '( "irc.freenode.net" )
"Stores the list of IRC servers that you want to connect to with start-irc.")
(defvar bye-irc-message "Asta la vista"
"Message string to be sent while quitting IRC.")
(defcustom prelude-new-irc-persp nil
"True (t) means start IRC in new perspective."
:type 'boolean
:require 'prelude-erc
:group 'prelude)
(defun connect-to-erc (server)
"Connects securely to IRC SERVER over TLS at port 6697."
(erc-tls :server server
:port 6697
:nick erc-nick ))
(defun start-irc ()
"Connect to IRC?"
(interactive)
(when (y-or-n-p "Do you want to start IRC? ")
(when prelude-new-irc-persp
(persp-switch "IRC"))
(mapcar 'connect-to-erc my-fav-irc)))
(defun filter-server-buffers ()
(delq nil
(mapcar
(lambda (x) (and (erc-server-buffer-p x) x))
(buffer-list))))
(defun stop-irc ()
"Disconnects from all irc servers."
(interactive)
(when prelude-new-irc-persp
(persp-switch "IRC"))
(dolist (buffer (filter-server-buffers))
(message "Server buffer: %s" (buffer-name buffer))
(with-current-buffer buffer
(erc-quit-server bye-irc-message)))
(when prelude-new-irc-persp
(persp-kill "IRC")))
(provide 'prelude-erc)
;;; prelude-erc.el ends here

View File

@@ -0,0 +1,60 @@
;;; prelude-erlang.el --- Emacs Prelude: Erlang programming support.
;;
;; Copyright © 2011-2017 Gleb Peregud
;;
;; Author: Gleb Peregud <gleber.p@gmail.com>
;; Version: 1.0.0
;; Keywords: convenience erlang
;; This file is not part of GNU Emacs.
;;; Commentary:
;; Erlang is a concurrent functional language.
;;; License:
;; This program is free software; you can redistribute it and/or
;; modify it under the terms of the GNU General Public License
;; as published by the Free Software Foundation; either version 3
;; of the License, or (at your option) any later version.
;;
;; This program is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;; GNU General Public License for more details.
;;
;; You should have received a copy of the GNU General Public License
;; along with GNU Emacs; see the file COPYING. If not, write to the
;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
;; Boston, MA 02110-1301, USA.
;;; Code:
(require 'prelude-programming)
(prelude-require-packages '(erlang))
(defcustom wrangler-path nil
"The location of wrangler elisp directory."
:group 'prelude-erlang
:type 'string
:safe 'stringp)
(require 'projectile)
(when (require 'erlang-start nil t)
(eval-after-load 'erlang-mode
'(progn
(flymake-mode)))
(when (not (null wrangler-path))
(add-to-list 'load-path wrangler-path)
(require 'wrangler)))
(add-hook 'erlang-mode-hook (lambda ()
(setq erlang-compile-function 'projectile-compile-project)))
(provide 'prelude-erlang)
;;; prelude-erlang.el ends here

View File

@@ -0,0 +1,152 @@
;;; prelude-evil.el --- Emacs Prelude: evil-mode configuration.
;;
;; Copyright © 2011-2017 Bozhidar Batsov
;;
;; Author: Bozhidar Batsov <bozhidar@batsov.com>
;; URL: http://batsov.com/prelude
;; Version: 1.0.0
;; Keywords: convenience
;; This file is not part of GNU Emacs.
;;; Commentary:
;; Some basic configuration for evil-mode.
;;; License:
;; This program is free software; you can redistribute it and/or
;; modify it under the terms of the GNU General Public License
;; as published by the Free Software Foundation; either version 3
;; of the License, or (at your option) any later version.
;;
;; This program is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;; GNU General Public License for more details.
;;
;; You should have received a copy of the GNU General Public License
;; along with GNU Emacs; see the file COPYING. If not, write to the
;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
;; Boston, MA 02110-1301, USA.
;;; Code:
;;; goto-chg lets you use the g-; and g-, to go to recent changes
;;; evil-visualstar enables searching visual selection with *
;;; evil-numbers enables vim style numeric incrementing and decrementing
(prelude-require-packages '(evil goto-chg evil-surround evil-visualstar evil-numbers))
(require 'evil-visualstar)
(setq evil-mode-line-format 'before)
(setq evil-emacs-state-cursor '("red" box))
(setq evil-normal-state-cursor '("gray" box))
(setq evil-visual-state-cursor '("gray" box))
(setq evil-insert-state-cursor '("gray" bar))
(setq evil-motion-state-cursor '("gray" box))
;; prevent esc-key from translating to meta-key in terminal mode
(setq evil-esc-delay 0)
(evil-mode 1)
(global-evil-surround-mode 1)
(define-key evil-normal-state-map (kbd "C-A")
'evil-numbers/inc-at-pt)
(define-key evil-normal-state-map (kbd "C-S-A")
'evil-numbers/dec-at-pt)
;;
;; Other useful Commands
;;
(evil-ex-define-cmd "W" 'evil-write-all)
(evil-ex-define-cmd "Tree" 'speedbar-get-focus)
(evil-ex-define-cmd "linum" 'linum-mode)
(evil-ex-define-cmd "Align" 'align-regexp)
(defun prelude-yank-to-end-of-line ()
"Yank to end of line."
(interactive)
(evil-yank (point) (point-at-eol)))
(define-key evil-normal-state-map
(kbd "Y") 'prelude-yank-to-end-of-line)
(defun prelude-shift-left-visual ()
"Shift left and restore visual selection."
(interactive)
(evil-shift-left (region-beginning) (region-end))
(evil-normal-state)
(evil-visual-restore))
(defun prelude-shift-right-visual ()
"Shift right and restore visual selection."
(interactive)
(evil-shift-right (region-beginning) (region-end))
(evil-normal-state)
(evil-visual-restore))
(define-key evil-visual-state-map (kbd ">") 'prelude-shift-right-visual)
(define-key evil-visual-state-map (kbd "<") 'prelude-shift-left-visual)
;; Scrolling
(defun prelude-evil-scroll-down-other-window ()
(interactive)
(scroll-other-window))
(defun prelude-evil-scroll-up-other-window ()
(interactive)
(scroll-other-window '-))
(define-key evil-normal-state-map
(kbd "C-S-d") 'prelude-evil-scroll-down-other-window)
(define-key evil-normal-state-map
(kbd "C-S-u") 'prelude-evil-scroll-up-other-window)
;;
;; Magit from avsej
;;
(evil-add-hjkl-bindings magit-log-mode-map 'emacs)
(evil-add-hjkl-bindings magit-commit-mode-map 'emacs)
(evil-add-hjkl-bindings magit-branch-manager-mode-map 'emacs
"K" 'magit-discard
"L" 'magit-log-popup)
(evil-add-hjkl-bindings magit-status-mode-map 'emacs
"K" 'magit-discard
"l" 'magit-log-popup
"h" 'magit-diff-toggle-refine-hunk)
(setq evil-shift-width 2)
;;; enable avy with evil-mode
(define-key evil-normal-state-map (kbd "SPC") 'avy-goto-word-1)
;;; snagged from Eric S. Fraga
;;; http://lists.gnu.org/archive/html/emacs-orgmode/2012-05/msg00153.html
(defun prelude-evil-key-bindings-for-org ()
;;(message "Defining evil key bindings for org")
(evil-declare-key 'normal org-mode-map
"gk" 'outline-up-heading
"gj" 'outline-next-visible-heading
"H" 'org-beginning-of-line ; smarter behaviour on headlines etc.
"L" 'org-end-of-line ; smarter behaviour on headlines etc.
"t" 'org-todo ; mark a TODO item as DONE
",c" 'org-cycle
(kbd "TAB") 'org-cycle
",e" 'org-export-dispatch
",n" 'outline-next-visible-heading
",p" 'outline-previous-visible-heading
",t" 'org-set-tags-command
",u" 'outline-up-heading
"$" 'org-end-of-line ; smarter behaviour on headlines etc.
"^" 'org-beginning-of-line ; ditto
"-" 'org-ctrl-c-minus ; change bullet style
"<" 'org-metaleft ; out-dent
">" 'org-metaright ; indent
))
(prelude-evil-key-bindings-for-org)
(provide 'prelude-evil)

View File

@@ -0,0 +1,84 @@
;;; prelude-go.el --- Emacs Prelude: Go programming support.
;;
;; Author: Doug MacEachern
;; Version: 1.0.0
;; Keywords: convenience go
;; This file is not part of GNU Emacs.
;;; Commentary:
;; Prelude configuration for Go
;;; License:
;; This program is free software; you can redistribute it and/or
;; modify it under the terms of the GNU General Public License
;; as published by the Free Software Foundation; either version 3
;; of the License, or (at your option) any later version.
;;
;; This program is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;; GNU General Public License for more details.
;;
;; You should have received a copy of the GNU General Public License
;; along with GNU Emacs; see the file COPYING. If not, write to the
;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
;; Boston, MA 02110-1301, USA.
;;; Code:
(require 'prelude-programming)
(prelude-require-packages '(go-mode
company-go
go-eldoc
go-projectile
gotest))
(require 'go-projectile)
;; Ignore go test -c output files
(add-to-list 'completion-ignored-extensions ".test")
(define-key 'help-command (kbd "G") 'godoc)
(eval-after-load 'go-mode
'(progn
(defun prelude-go-mode-defaults ()
;; Add to default go-mode key bindings
(let ((map go-mode-map))
(define-key map (kbd "C-c a") 'go-test-current-project) ;; current package, really
(define-key map (kbd "C-c m") 'go-test-current-file)
(define-key map (kbd "C-c .") 'go-test-current-test)
(define-key map (kbd "C-c b") 'go-run)
(define-key map (kbd "C-h f") 'godoc-at-point))
;; Prefer goimports to gofmt if installed
(let ((goimports (executable-find "goimports")))
(when goimports
(setq gofmt-command goimports)))
;; gofmt on save
(add-hook 'before-save-hook 'gofmt-before-save nil t)
;; stop whitespace being highlighted
(whitespace-toggle-options '(tabs))
;; Company mode settings
(set (make-local-variable 'company-backends) '(company-go))
;; El-doc for Go
(go-eldoc-setup)
;; CamelCase aware editing operations
(subword-mode +1))
(setq prelude-go-mode-hook 'prelude-go-mode-defaults)
(add-hook 'go-mode-hook (lambda ()
(run-hooks 'prelude-go-mode-hook)))))
(provide 'prelude-go)
;;; prelude-go.el ends here

View File

@@ -0,0 +1,53 @@
;;; prelude-haskell.el --- Emacs Prelude: Nice config for Haskell programming.
;;
;; Copyright © 2011-2017 Bozhidar Batsov
;;
;; Author: Bozhidar Batsov <bozhidar@batsov.com>
;; URL: https://github.com/bbatsov/prelude
;; Version: 1.0.0
;; Keywords: convenience
;; This file is not part of GNU Emacs.
;;; Commentary:
;; Nice config for Haskell programming.
;;; License:
;; This program is free software; you can redistribute it and/or
;; modify it under the terms of the GNU General Public License
;; as published by the Free Software Foundation; either version 3
;; of the License, or (at your option) any later version.
;;
;; This program is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;; GNU General Public License for more details.
;;
;; You should have received a copy of the GNU General Public License
;; along with GNU Emacs; see the file COPYING. If not, write to the
;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
;; Boston, MA 02110-1301, USA.
;;; Code:
(require 'prelude-programming)
(prelude-require-packages '(haskell-mode))
(eval-after-load 'haskell-mode
'(progn
(defun prelude-haskell-mode-defaults ()
(subword-mode +1)
(eldoc-mode +1)
(haskell-indentation-mode +1)
(interactive-haskell-mode +1))
(setq prelude-haskell-mode-hook 'prelude-haskell-mode-defaults)
(add-hook 'haskell-mode-hook (lambda ()
(run-hooks 'prelude-haskell-mode-hook)))))
(provide 'prelude-haskell)
;;; prelude-haskell.el ends here

View File

@@ -0,0 +1,72 @@
;;; prelude-helm-everywhere.el --- Enable Helm everywhere
;;
;; Copyright © 2014-2017 Tu, Do Hoang
;;
;; Author: Tu, Do Hoang (tuhdo1710@gmail.com)
;; URL: https://github.com/bbatsov/prelude
;; Version: 1.0.0
;; Keywords: convenience
;; This file is not part of GNU Emacs.
;;; Commentary:
;; Enable Helm everywhere with global key bindings to replace common
;; global bindings and `helm-mode' is activated to replace `completing-read'
;; with `helm-completing-read-default', so users can use Helm with every prompt.
;;; License:
;; This program is free software; you can redistribute it and/or
;; modify it under the terms of the GNU General Public License
;; as published by the Free Software Foundation; either version 3
;; of the License, or (at your option) any later version.
;;
;; This program is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;; GNU General Public License for more details.
;;
;; You should have received a copy of the GNU General Public License
;; along with GNU Emacs; see the file COPYING. If not, write to the
;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
;; Boston, MA 02110-1301, USA.
;;; Code:
(require 'prelude-helm)
(prelude-require-packages '(helm-descbinds helm-ag))
(require 'helm-eshell)
(global-set-key (kbd "M-x") 'helm-M-x)
(global-set-key (kbd "C-x C-m") 'helm-M-x)
(global-set-key (kbd "M-y") 'helm-show-kill-ring)
(global-set-key (kbd "C-x b") 'helm-mini)
(global-set-key (kbd "C-x C-b") 'helm-buffers-list)
(global-set-key (kbd "C-x C-f") 'helm-find-files)
(global-set-key (kbd "C-h f") 'helm-apropos)
(global-set-key (kbd "C-h r") 'helm-info-emacs)
(global-set-key (kbd "C-h C-l") 'helm-locate-library)
(define-key prelude-mode-map (kbd "C-c f") 'helm-recentf)
(define-key minibuffer-local-map (kbd "C-c C-l") 'helm-minibuffer-history)
(define-key isearch-mode-map (kbd "C-o") 'helm-occur-from-isearch)
;; shell history.
(define-key shell-mode-map (kbd "C-c C-l") 'helm-comint-input-ring)
;; use helm to list eshell history
(add-hook 'eshell-mode-hook
#'(lambda ()
(substitute-key-definition 'eshell-list-history 'helm-eshell-history eshell-mode-map)))
(substitute-key-definition 'find-tag 'helm-etags-select global-map)
(setq projectile-completion-system 'helm)
(helm-descbinds-mode)
(helm-mode 1)
;; enable Helm version of Projectile with replacment commands
(helm-projectile-on)
(provide 'prelude-helm-everywhere)
;; prelude-helm-everywhere.el ends here.

View File

@@ -0,0 +1,67 @@
;;; prelude-helm.el --- Helm setup
;;
;; Copyright © 2011-2017 Bozhidar Batsov
;;
;; Author: Bozhidar Batsov <bozhidar@batsov.com>
;; URL: https://github.com/bbatsov/prelude
;; Version: 1.0.0
;; Keywords: convenience
;; This file is not part of GNU Emacs.
;;; Commentary:
;; Some configuration for Helm following this guide:
;; http://tuhdo.github.io/helm-intro.html
;;; License:
;; This program is free software; you can redistribute it and/or
;; modify it under the terms of the GNU General Public License
;; as published by the Free Software Foundation; either version 3
;; of the License, or (at your option) any later version.
;;
;; This program is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;; GNU General Public License for more details.
;;
;; You should have received a copy of the GNU General Public License
;; along with GNU Emacs; see the file COPYING. If not, write to the
;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
;; Boston, MA 02110-1301, USA.
;;; Code:
(prelude-require-packages '(helm helm-projectile))
(require 'helm-config)
(require 'helm-projectile)
(when (executable-find "curl")
(setq helm-google-suggest-use-curl-p t))
;; See https://github.com/bbatsov/prelude/pull/670 for a detailed
;; discussion of these options.
(setq helm-split-window-in-side-p t
helm-buffers-fuzzy-matching t
helm-move-to-line-cycle-in-source t
helm-ff-search-library-in-sexp t
helm-ff-file-name-history-use-recentf t)
;; The default "C-x c" is quite close to "C-x C-c", which quits Emacs.
;; Changed to "C-c h". Note: We must set "C-c h" globally, because we
;; cannot change `helm-command-prefix-key' once `helm-config' is loaded.
(global-set-key (kbd "C-c h") 'helm-command-prefix)
(global-unset-key (kbd "C-x c"))
(define-key helm-command-map (kbd "o") 'helm-occur)
(define-key helm-command-map (kbd "g") 'helm-do-grep)
(define-key helm-command-map (kbd "C-c w") 'helm-wikipedia-suggest)
(define-key helm-command-map (kbd "SPC") 'helm-all-mark-rings)
(push "Press <C-c p h> to navigate a project in Helm." prelude-tips)
(provide 'prelude-helm)
;;; prelude-helm.el ends here

View File

@@ -0,0 +1,64 @@
;;; prelude-ido.el --- Ido setup
;;
;; Copyright © 2011-2017 Bozhidar Batsov
;;
;; Author: Bozhidar Batsov <bozhidar@batsov.com>
;; URL: https://github.com/bbatsov/prelude
;; Version: 1.0.0
;; Keywords: convenience
;; This file is not part of GNU Emacs.
;;; Commentary:
;; Ido-related config.
;;; License:
;; This program is free software; you can redistribute it and/or
;; modify it under the terms of the GNU General Public License
;; as published by the Free Software Foundation; either version 3
;; of the License, or (at your option) any later version.
;;
;; This program is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;; GNU General Public License for more details.
;;
;; You should have received a copy of the GNU General Public License
;; along with GNU Emacs; see the file COPYING. If not, write to the
;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
;; Boston, MA 02110-1301, USA.
;;; Code:
(prelude-require-packages '(flx-ido ido-completing-read+ smex))
(require 'ido)
(require 'ido-completing-read+)
(require 'flx-ido)
(setq ido-enable-prefix nil
ido-enable-flex-matching t
ido-create-new-buffer 'always
ido-use-filename-at-point 'guess
ido-max-prospects 10
ido-save-directory-list-file (expand-file-name "ido.hist" prelude-savefile-dir)
ido-default-file-method 'selected-window
ido-auto-merge-work-directories-length -1)
(ido-mode +1)
(ido-ubiquitous-mode +1)
;;; smarter fuzzy matching for ido
(flx-ido-mode +1)
;; disable ido faces to see flx highlights
(setq ido-use-faces nil)
;;; smex, remember recently and most frequently used commands
(require 'smex)
(setq smex-save-file (expand-file-name ".smex-items" prelude-savefile-dir))
(smex-initialize)
(global-set-key (kbd "M-x") 'smex)
(global-set-key (kbd "M-X") 'smex-major-mode-commands)
(provide 'prelude-ido)
;;; prelude-ido.el ends here

View File

@@ -0,0 +1,70 @@
;;; prelude-ivy.el --- Ivy setup
;;
;; Copyright © 2011-2017 Bozhidar Batsov
;;
;; Author: Bozhidar Batsov <bozhidar@batsov.com>
;; URL: https://github.com/bbatsov/prelude
;; Version: 1.0.0
;; Keywords: convenience
;; This file is not part of GNU Emacs.
;;; Commentary:
;; Ivy-related config.
;;; License:
;; This program is free software; you can redistribute it and/or
;; modify it under the terms of the GNU General Public License
;; as published by the Free Software Foundation; either version 3
;; of the License, or (at your option) any later version.
;;
;; This program is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;; GNU General Public License for more details.
;;
;; You should have received a copy of the GNU General Public License
;; along with GNU Emacs; see the file COPYING. If not, write to the
;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
;; Boston, MA 02110-1301, USA.
;;; Code:
(prelude-require-packages '(ivy swiper counsel))
;; ivy is a powerful alternative to the popular ido-mode
(require 'ivy)
(ivy-mode 1)
(setq ivy-use-virtual-buffers t)
(setq enable-recursive-minibuffers t)
(global-set-key (kbd "C-c C-r") 'ivy-resume)
(global-set-key (kbd "<f6>") 'ivy-resume)
(setq projectile-completion-system 'ivy)
;; swiper provides enhanced buffer search
(global-set-key "\C-s" 'swiper)
;; counsel supercharges a lot of commands with some ivy magic
(global-set-key (kbd "M-x") 'counsel-M-x)
(global-set-key (kbd "C-x C-f") 'counsel-find-file)
(global-set-key (kbd "<f1> f") 'counsel-describe-function)
(global-set-key (kbd "<f1> v") 'counsel-describe-variable)
(global-set-key (kbd "<f1> l") 'counsel-find-library)
(global-set-key (kbd "<f2> i") 'counsel-info-lookup-symbol)
(global-set-key (kbd "<f2> u") 'counsel-unicode-char)
(global-set-key (kbd "C-c g") 'counsel-git)
(global-set-key (kbd "C-c j") 'counsel-git-grep)
(global-set-key (kbd "C-c k") 'counsel-ag)
(global-set-key (kbd "C-x l") 'counsel-locate)
(define-key minibuffer-local-map (kbd "C-r") 'counsel-minibuffer-history)
(provide 'prelude-ivy)
;;; prelude-ivy.el ends here

View File

@@ -0,0 +1,58 @@
;;; prelude-js.el --- Emacs Prelude: js-mode configuration.
;;
;; Copyright © 2011-2017 Bozhidar Batsov
;;
;; Author: Bozhidar Batsov <bozhidar@batsov.com>
;; URL: https://github.com/bbatsov/prelude
;; Version: 1.0.0
;; Keywords: convenience
;; This file is not part of GNU Emacs.
;;; Commentary:
;; Some basic configuration for js-mode.
;;; License:
;; This program is free software; you can redistribute it and/or
;; modify it under the terms of the GNU General Public License
;; as published by the Free Software Foundation; either version 3
;; of the License, or (at your option) any later version.
;;
;; This program is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;; GNU General Public License for more details.
;;
;; You should have received a copy of the GNU General Public License
;; along with GNU Emacs; see the file COPYING. If not, write to the
;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
;; Boston, MA 02110-1301, USA.
;;; Code:
(require 'prelude-programming)
(prelude-require-packages '(js2-mode json-mode))
(require 'js2-mode)
(add-to-list 'auto-mode-alist '("\\.js\\'" . js2-mode))
(add-to-list 'auto-mode-alist '("\\.pac\\'" . js2-mode))
(add-to-list 'interpreter-mode-alist '("node" . js2-mode))
(eval-after-load 'js2-mode
'(progn
(defun prelude-js-mode-defaults ()
;; electric-layout-mode doesn't play nice with smartparens
(setq-local electric-layout-rules '((?\; . after)))
(setq mode-name "JS2")
(js2-imenu-extras-mode +1))
(setq prelude-js-mode-hook 'prelude-js-mode-defaults)
(add-hook 'js2-mode-hook (lambda () (run-hooks 'prelude-js-mode-hook)))))
(provide 'prelude-js)
;;; prelude-js.el ends here

View File

@@ -0,0 +1,60 @@
;;; prelude-key-chord.el --- Key chord setup
;;
;; Copyright © 2011-2017 Bozhidar Batsov
;;
;; Author: Bozhidar Batsov <bozhidar@batsov.com>
;; URL: https://github.com/bbatsov/prelude
;; Version: 1.0.0
;; Keywords: convenience
;; This file is not part of GNU Emacs.
;;; Commentary:
;; Configure key-chord key bindings.
;;; License:
;; This program is free software; you can redistribute it and/or
;; modify it under the terms of the GNU General Public License
;; as published by the Free Software Foundation; either version 3
;; of the License, or (at your option) any later version.
;;
;; This program is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;; GNU General Public License for more details.
;;
;; You should have received a copy of the GNU General Public License
;; along with GNU Emacs; see the file COPYING. If not, write to the
;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
;; Boston, MA 02110-1301, USA.
;;; Code:
(prelude-require-package 'key-chord)
(require 'key-chord)
(key-chord-define-global "jj" 'avy-goto-word-1)
(key-chord-define-global "jl" 'avy-goto-line)
(key-chord-define-global "jk" 'avy-goto-char)
(key-chord-define-global "JJ" 'crux-switch-to-previous-buffer)
(key-chord-define-global "uu" 'undo-tree-visualize)
(key-chord-define-global "xx" 'execute-extended-command)
(key-chord-define-global "yy" 'browse-kill-ring)
(defvar key-chord-tips '("Press <jj> quickly to jump to the beginning of a visible word."
"Press <jl> quickly to jump to a visible line."
"Press <jk> quickly to jump to a visible character."
"Press <JJ> quickly to switch to previous buffer."
"Press <uu> quickly to visualize the undo tree."
"Press <xx> quickly to execute extended command."
"Press <yy> quickly to browse the kill ring."))
(setq prelude-tips (append prelude-tips key-chord-tips))
(key-chord-mode +1)
(provide 'prelude-key-chord)
;;; prelude-key-chord.el ends here

View File

@@ -0,0 +1,93 @@
;;; prelude-latex.el --- Emacs Prelude: Sane setup for LaTeX writers.
;;
;; Copyright © 2011-2017 Bozhidar Batsov
;;
;; Author: Bozhidar Batsov <bozhidar@batsov.com>
;; URL: https://github.com/bbatsov/prelude
;; Version: 1.0.0
;; Keywords: convenience
;; This file is not part of GNU Emacs.
;;; Commentary:
;; Nice defaults for the premium LaTeX editing mode auctex.
;;; License:
;; This program is free software; you can redistribute it and/or
;; modify it under the terms of the GNU General Public License
;; as published by the Free Software Foundation; either version 3
;; of the License, or (at your option) any later version.
;;
;; This program is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;; GNU General Public License for more details.
;;
;; You should have received a copy of the GNU General Public License
;; along with GNU Emacs; see the file COPYING. If not, write to the
;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
;; Boston, MA 02110-1301, USA.
;;; Code:
(prelude-require-packages '(auctex cdlatex))
(require 'smartparens-latex)
;; for case
(require 'cl)
(eval-after-load "company"
'(progn
(prelude-require-packages '(company-auctex))
(company-auctex-init)))
(defcustom prelude-latex-fast-math-entry 'LaTeX-math-mode
"Method used for fast math symbol entry in LaTeX."
:link '(function-link :tag "AUCTeX Math Mode" LaTeX-math-mode)
:link '(emacs-commentary-link :tag "CDLaTeX" "cdlatex.el")
:group 'prelude
:type '(choice (const :tag "None" nil)
(const :tag "AUCTeX Math Mode" LaTeX-math-mode)
(const :tag "CDLaTeX" cdlatex)))
;; AUCTeX configuration
(setq TeX-auto-save t)
(setq TeX-parse-self t)
(setq TeX-close-quote "")
(setq TeX-open-quote "")
(setq-default TeX-master nil)
;; use pdflatex
(setq TeX-PDF-mode t)
;; sensible defaults for OS X, other OSes should be covered out-of-the-box
(when (eq system-type 'darwin)
(setq TeX-view-program-selection
'((output-dvi "DVI Viewer")
(output-pdf "PDF Viewer")
(output-html "HTML Viewer")))
(setq TeX-view-program-list
'(("DVI Viewer" "open %o")
("PDF Viewer" "open %o")
("HTML Viewer" "open %o"))))
(defun prelude-latex-mode-defaults ()
"Default Prelude hook for `LaTeX-mode'."
(turn-on-auto-fill)
(abbrev-mode +1)
(smartparens-mode +1)
(case prelude-latex-fast-math-entry
(LaTeX-math-mode (LaTeX-math-mode 1))
(cdlatex (turn-on-cdlatex))))
(setq prelude-latex-mode-hook 'prelude-latex-mode-defaults)
(add-hook 'LaTeX-mode-hook (lambda ()
(run-hooks 'prelude-latex-mode-hook)))
(provide 'prelude-latex)
;;; prelude-latex.el ends here

View File

@@ -0,0 +1,64 @@
;;; prelude-lisp.el --- Emacs Prelude: Configuration common to all lisp modes.
;;
;; Copyright © 2011-2017 Bozhidar Batsov
;;
;; Author: Bozhidar Batsov <bozhidar@batsov.com>
;; URL: https://github.com/bbatsov/prelude
;; Version: 1.0.0
;; Keywords: convenience
;; This file is not part of GNU Emacs.
;;; Commentary:
;; Configuration shared between all modes related to lisp-like languages.
;;; License:
;; This program is free software; you can redistribute it and/or
;; modify it under the terms of the GNU General Public License
;; as published by the Free Software Foundation; either version 3
;; of the License, or (at your option) any later version.
;;
;; This program is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;; GNU General Public License for more details.
;;
;; You should have received a copy of the GNU General Public License
;; along with GNU Emacs; see the file COPYING. If not, write to the
;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
;; Boston, MA 02110-1301, USA.
;;; Code:
(require 'prelude-programming)
(prelude-require-packages '(rainbow-delimiters))
;; Lisp configuration
(define-key read-expression-map (kbd "TAB") 'completion-at-point)
;; wrap keybindings
(define-key lisp-mode-shared-map (kbd "M-(") (prelude-wrap-with "("))
;; FIXME: Pick terminal-friendly binding.
;;(define-key lisp-mode-shared-map (kbd "M-[") (prelude-wrap-with "["))
(define-key lisp-mode-shared-map (kbd "M-\"") (prelude-wrap-with "\""))
;; a great lisp coding hook
(defun prelude-lisp-coding-defaults ()
(smartparens-strict-mode +1)
(rainbow-delimiters-mode +1))
(setq prelude-lisp-coding-hook 'prelude-lisp-coding-defaults)
;; interactive modes don't need whitespace checks
(defun prelude-interactive-lisp-coding-defaults ()
(smartparens-strict-mode +1)
(rainbow-delimiters-mode +1)
(whitespace-mode -1))
(setq prelude-interactive-lisp-coding-hook 'prelude-interactive-lisp-coding-defaults)
(provide 'prelude-lisp)
;;; prelude-lisp.el ends here

View File

@@ -0,0 +1,47 @@
;;; prelude-mediawiki.el --- Emacs Prelude: mediawiki editing config
;;
;; Copyright © 2011-2017 Bozhidar Batsov
;;
;; Author: Bozhidar Batsov <bozhidar@batsov.com>
;; URL: https://github.com/bbatsov/prelude
;; Version: 1.0.0
;; Keywords: convenience
;; This file is not part of GNU Emacs.
;;; Commentary:
;; Basic configs for access to WikEmacs and Wikipedia.
;;; License:
;; This program is free software; you can redistribute it and/or
;; modify it under the terms of the GNU General Public License
;; as published by the Free Software Foundation; either version 3
;; of the License, or (at your option) any later version.
;;
;; This program is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;; GNU General Public License for more details.
;;
;; You should have received a copy of the GNU General Public License
;; along with GNU Emacs; see the file COPYING. If not, write to the
;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
;; Boston, MA 02110-1301, USA.
;;; Code:
(prelude-require-packages '(mediawiki))
(eval-after-load 'mediawiki
'(progn
(setq mediawiki-site-alist '(("Wikipedia" "http://en.wikipedia.org/w" "" "" "Main Page")
("WikEmacs" "http://wikemacs.org/w/" "" "" "Main Page")))
;; Emacs users care more for WikEmacs than Wikipedia :-)
(setq mediawiki-site-default "WikEmacs")))
(provide 'prelude-mediawiki)
;;; prelude-mediawiki.el ends here

View File

@@ -0,0 +1,92 @@
;;; prelude-ocaml.el --- Emacs Prelude: decent Perl coding settings.
;;
;; Copyright © 2014-2017 Geoff Shannon
;;
;; Author: Geoff Shannon <geoffpshannon@gmail.com>
;; URL: https://github.com/bbatsov/prelude
;; Version: 1.0.0
;; Keywords: convenience
;; This file is not part of GNU Emacs.
;;; Commentary:
;; tuareg is the preferred ocaml mode for Emacs
;; These setups for ocaml assume that you are using the OPAM package
;; manager (http://opam.ocaml.org/).
;; Because of the apparent complexity of getting emacs environment
;; variables setup to use opam correctly, it is instead easier to use
;; opam itself to execute any necessary commands.
;; Also, the standard OCaml toplevel usage has been replaced in favor
;; of UTOP, the universal toplevel, and we assume that you are using
;; the Jane Street Core libraries rather than the regular OCaml
;; standard libraries
;; The minimum required setup for using Prelude's OCaml setup would be
;; to install OPAM, and then, minimally `opam install core utop'. A
;; good getting started guide is available at
;; https://github.com/realworldocaml/book/wiki/Installation-Instructions
;;; License:
;; This program is free software; you can redistribute it and/or
;; modify it under the terms of the GNU General Public License
;; as published by the Free Software Foundation; either version 3
;; of the License, or (at your option) any later version.
;;
;; This program is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;; GNU General Public License for more details.
;;
;; You should have received a copy of the GNU General Public License
;; along with GNU Emacs; see the file COPYING. If not, write to the
;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
;; Boston, MA 02110-1301, USA.
;;; Code:
(prelude-require-packages '(tuareg utop merlin flycheck-ocaml))
(require 'tuareg)
(require 'utop)
(require 'merlin)
(setq auto-mode-alist
(append '(("\\.ml[ily]?\\'" . tuareg-mode)
("\\.topml\\'" . tuareg-mode))
auto-mode-alist))
(with-eval-after-load 'merlin
;; Disable Merlin's own error checking
(setq merlin-error-after-save nil)
;; Enable Flycheck checker
(flycheck-ocaml-setup))
(add-hook 'tuareg-mode-hook #'utop-minor-mode)
(add-hook 'tuareg-mode-hook #'merlin-mode)
(add-hook 'tuareg-mode-hook (lambda ()
(progn
(define-key tuareg-mode-map (kbd "C-c C-s")
'utop)
(setq compile-command
"opam config exec corebuild "))))
;; Setup merlin completions company is used by default in prelude
(add-to-list 'company-backends 'merlin-company-backend)
;; Merlin also offers support for autocomplete, uncomment this next line
;; to activate it.
;; (setq merlin-use-auto-complete-mode t)
(setq utop-command "opam config exec utop -- -emacs"
merlin-error-after-save nil)
(provide 'prelude-ocaml)
;;; prelude-ocaml.el ends here

View File

@@ -0,0 +1,58 @@
;;; prelude-org.el --- Emacs Prelude: org-mode configuration.
;;
;; Copyright © 2011-2017 Bozhidar Batsov
;;
;; Author: Bozhidar Batsov <bozhidar@batsov.com>
;; URL: https://github.com/bbatsov/prelude
;; Version: 1.0.0
;; Keywords: convenience
;; This file is not part of GNU Emacs.
;;; Commentary:
;; Some basic configuration for org-mode.
;;; License:
;; This program is free software; you can redistribute it and/or
;; modify it under the terms of the GNU General Public License
;; as published by the Free Software Foundation; either version 3
;; of the License, or (at your option) any later version.
;;
;; This program is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;; GNU General Public License for more details.
;;
;; You should have received a copy of the GNU General Public License
;; along with GNU Emacs; see the file COPYING. If not, write to the
;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
;; Boston, MA 02110-1301, USA.
;;; Code:
(add-to-list 'auto-mode-alist '("\\.org\\" . org-mode))
(global-set-key "\C-cl" 'org-store-link)
(global-set-key "\C-ca" 'org-agenda)
(global-set-key "\C-cb" 'org-iswitchb)
(setq org-log-done t)
(defun prelude-org-mode-defaults ()
(let ((oldmap (cdr (assoc 'prelude-mode minor-mode-map-alist)))
(newmap (make-sparse-keymap)))
(set-keymap-parent newmap oldmap)
(define-key newmap (kbd "C-c +") nil)
(define-key newmap (kbd "C-c -") nil)
(define-key newmap (kbd "C-a") nil)
(make-local-variable 'minor-mode-overriding-map-alist)
(push `(prelude-mode . ,newmap) minor-mode-overriding-map-alist))
)
(setq prelude-org-mode-hook 'prelude-org-mode-defaults)
(add-hook 'org-mode-hook (lambda () (run-hooks 'prelude-org-mode-hook)))
(provide 'prelude-org)
;;; prelude-org.el ends here

View File

@@ -0,0 +1,70 @@
;;; prelude-perl.el --- Emacs Prelude: decent Perl coding settings.
;;
;; Copyright © 2011-2017 Bozhidar Batsov
;;
;; Author: Bozhidar Batsov <bozhidar@batsov.com>
;; URL: https://github.com/bbatsov/prelude
;; Version: 1.0.0
;; Keywords: convenience
;; This file is not part of GNU Emacs.
;;; Commentary:
;; cperl-mode is the best Perl mode for Emacs out there.
;;; License:
;; This program is free software; you can redistribute it and/or
;; modify it under the terms of the GNU General Public License
;; as published by the Free Software Foundation; either version 3
;; of the License, or (at your option) any later version.
;;
;; This program is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;; GNU General Public License for more details.
;;
;; You should have received a copy of the GNU General Public License
;; along with GNU Emacs; see the file COPYING. If not, write to the
;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
;; Boston, MA 02110-1301, USA.
;;; Code:
(require 'prelude-programming)
;; use cperl-mode instead of perl-mode
(defalias 'perl-mode 'cperl-mode)
(define-key 'help-command "P" 'cperl-perldoc)
(defun prelude-cperl-mode-defaults ()
(setq cperl-indent-level 4)
(setq cperl-continued-statement-offset 8)
;; cperl-hairy affects all those variables, but I prefer
;; a more fine-grained approach as far as they are concerned
(setq cperl-font-lock t)
(setq cperl-electric-lbrace-space t)
(setq cperl-electric-parens nil)
(setq cperl-electric-linefeed nil)
(setq cperl-electric-keywords nil)
(setq cperl-info-on-command-no-prompt t)
(setq cperl-clobber-lisp-bindings t)
(setq cperl-lazy-help-time 3)
;; if you want all the bells and whistles
;; (setq cperl-hairy)
(set-face-background 'cperl-array-face nil)
(set-face-background 'cperl-hash-face nil)
(setq cperl-invalid-face nil))
(setq prelude-cperl-mode-hook 'prelude-cperl-mode-defaults)
(add-hook 'cperl-mode-hook (lambda ()
(run-hooks 'prelude-cperl-mode-hook)) t)
(provide 'prelude-perl)
;;; prelude-perl.el ends here

View File

@@ -0,0 +1,91 @@
;;; prelude-programming.el --- Emacs Prelude: prog-mode configuration
;;
;; Copyright © 2011-2017 Bozhidar Batsov
;;
;; Author: Bozhidar Batsov <bozhidar@batsov.com>
;; URL: https://github.com/bbatsov/prelude
;; Version: 1.0.0
;; Keywords: convenience
;; This file is not part of GNU Emacs.
;;; Commentary:
;; Some basic prog-mode configuration and programming related utilities.
;;; License:
;; This program is free software; you can redistribute it and/or
;; modify it under the terms of the GNU General Public License
;; as published by the Free Software Foundation; either version 3
;; of the License, or (at your option) any later version.
;;
;; This program is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;; GNU General Public License for more details.
;;
;; You should have received a copy of the GNU General Public License
;; along with GNU Emacs; see the file COPYING. If not, write to the
;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
;; Boston, MA 02110-1301, USA.
;;; Code:
(defun prelude-local-comment-auto-fill ()
(set (make-local-variable 'comment-auto-fill-only-comments) t))
(defun prelude-font-lock-comment-annotations ()
"Highlight a bunch of well known comment annotations.
This functions should be added to the hooks of major modes for programming."
(font-lock-add-keywords
nil '(("\\<\\(\\(FIX\\(ME\\)?\\|TODO\\|OPTIMIZE\\|HACK\\|REFACTOR\\):\\)"
1 font-lock-warning-face t))))
;; show the name of the current function definition in the modeline
(require 'which-func)
(which-function-mode 1)
;; in Emacs 24 programming major modes generally derive from a common
;; mode named prog-mode; for others, we'll arrange for our mode
;; defaults function to run prelude-prog-mode-hook directly. To
;; augment and/or counteract these defaults your own function
;; to prelude-prog-mode-hook, using:
;;
;; (add-hook 'prelude-prog-mode-hook 'my-prog-mode-defaults t)
;;
;; (the final optional t sets the *append* argument)
;; smart curly braces
(sp-pair "{" nil :post-handlers
'(((lambda (&rest _ignored)
(crux-smart-open-line-above)) "RET")))
;; enlist a more liberal guru
(setq guru-warn-only t)
(defun prelude-prog-mode-defaults ()
"Default coding hook, useful with any programming language."
(when (and (executable-find ispell-program-name)
prelude-flyspell)
(flyspell-prog-mode))
(when prelude-guru
(guru-mode +1))
(smartparens-mode +1)
(prelude-enable-whitespace)
(prelude-local-comment-auto-fill)
(prelude-font-lock-comment-annotations))
(setq prelude-prog-mode-hook 'prelude-prog-mode-defaults)
(add-hook 'prog-mode-hook (lambda ()
(run-hooks 'prelude-prog-mode-hook)))
;; enable on-the-fly syntax checking
(if (fboundp 'global-flycheck-mode)
(global-flycheck-mode +1)
(add-hook 'prog-mode-hook 'flycheck-mode))
(provide 'prelude-programming)
;;; prelude-programming.el ends here

View File

@@ -0,0 +1,111 @@
;;; prelude-python.el --- Emacs Prelude: python.el configuration.
;;
;; Copyright © 2011-2017 Bozhidar Batsov
;;
;; Author: Bozhidar Batsov <bozhidar@batsov.com>
;; URL: https://github.com/bbatsov/prelude
;; Version: 1.0.0
;; Keywords: convenience
;; This file is not part of GNU Emacs.
;;; Commentary:
;; Some basic configuration for python.el (the latest and greatest
;; Python mode Emacs has to offer).
;;; License:
;; This program is free software; you can redistribute it and/or
;; modify it under the terms of the GNU General Public License
;; as published by the Free Software Foundation; either version 3
;; of the License, or (at your option) any later version.
;;
;; This program is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;; GNU General Public License for more details.
;;
;; You should have received a copy of the GNU General Public License
;; along with GNU Emacs; see the file COPYING. If not, write to the
;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
;; Boston, MA 02110-1301, USA.
;;; Code:
(prelude-require-package 'anaconda-mode)
(when (boundp 'company-backends)
(prelude-require-package 'company-anaconda)
(add-to-list 'company-backends 'company-anaconda))
(require 'electric)
(require 'prelude-programming)
;; Copy pasted from ruby-mode.el
(defun prelude-python--encoding-comment-required-p ()
(re-search-forward "[^\0-\177]" nil t))
(defun prelude-python--detect-encoding ()
(let ((coding-system
(or save-buffer-coding-system
buffer-file-coding-system)))
(if coding-system
(symbol-name
(or (coding-system-get coding-system 'mime-charset)
(coding-system-change-eol-conversion coding-system nil)))
"ascii-8bit")))
(defun prelude-python--insert-coding-comment (encoding)
(let ((newlines (if (looking-at "^\\s *$") "\n" "\n\n")))
(insert (format "# coding: %s" encoding) newlines)))
(defun prelude-python-mode-set-encoding ()
"Insert a magic comment header with the proper encoding if necessary."
(save-excursion
(widen)
(goto-char (point-min))
(when (prelude-python--encoding-comment-required-p)
(goto-char (point-min))
(let ((coding-system (prelude-python--detect-encoding)))
(when coding-system
(if (looking-at "^#!") (beginning-of-line 2))
(cond ((looking-at "\\s *#\\s *.*\\(en\\)?coding\\s *:\\s *\\([-a-z0-9_]*\\)")
;; update existing encoding comment if necessary
(unless (string= (match-string 2) coding-system)
(goto-char (match-beginning 2))
(delete-region (point) (match-end 2))
(insert coding-system)))
((looking-at "\\s *#.*coding\\s *[:=]"))
(t (prelude-python--insert-coding-comment coding-system)))
(when (buffer-modified-p)
(basic-save-buffer-1)))))))
(when (fboundp 'exec-path-from-shell-copy-env)
(exec-path-from-shell-copy-env "PYTHONPATH"))
(defun prelude-python-mode-defaults ()
"Defaults for Python programming."
(subword-mode +1)
(anaconda-mode 1)
(eldoc-mode 1)
(setq-local electric-layout-rules
'((?: . (lambda ()
(and (zerop (first (syntax-ppss)))
(python-info-statement-starts-block-p)
'after)))))
(when (fboundp #'python-imenu-create-flat-index)
(setq-local imenu-create-index-function
#'python-imenu-create-flat-index))
(add-hook 'post-self-insert-hook
#'electric-layout-post-self-insert-function nil 'local)
(add-hook 'after-save-hook 'prelude-python-mode-set-encoding nil 'local))
(setq prelude-python-mode-hook 'prelude-python-mode-defaults)
(add-hook 'python-mode-hook (lambda ()
(run-hooks 'prelude-python-mode-hook)))
(provide 'prelude-python)
;;; prelude-python.el ends here

View File

@@ -0,0 +1,78 @@
;;; prelude-ruby.el --- Emacs Prelude: A nice setup for Ruby (and Rails) devs.
;;
;; Copyright © 2011-2017 Bozhidar Batsov
;;
;; Author: Bozhidar Batsov <bozhidar@batsov.com>
;; URL: https://github.com/bbatsov/prelude
;; Version: 1.0.0
;; Keywords: convenience
;; This file is not part of GNU Emacs.
;;; Commentary:
;; Some basic configuration for Ruby and Rails development.
;;; License:
;; This program is free software; you can redistribute it and/or
;; modify it under the terms of the GNU General Public License
;; as published by the Free Software Foundation; either version 3
;; of the License, or (at your option) any later version.
;;
;; This program is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;; GNU General Public License for more details.
;;
;; You should have received a copy of the GNU General Public License
;; along with GNU Emacs; see the file COPYING. If not, write to the
;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
;; Boston, MA 02110-1301, USA.
;;; Code:
(require 'prelude-programming)
(prelude-require-packages '(ruby-tools inf-ruby yari))
;; Rake files are ruby, too, as are gemspecs, rackup files, and gemfiles.
(add-to-list 'auto-mode-alist '("\\.rake\\'" . ruby-mode))
(add-to-list 'auto-mode-alist '("Rakefile\\'" . ruby-mode))
(add-to-list 'auto-mode-alist '("\\.gemspec\\'" . ruby-mode))
(add-to-list 'auto-mode-alist '("\\.ru\\'" . ruby-mode))
(add-to-list 'auto-mode-alist '("Gemfile\\'" . ruby-mode))
(add-to-list 'auto-mode-alist '("Guardfile\\'" . ruby-mode))
(add-to-list 'auto-mode-alist '("Capfile\\'" . ruby-mode))
(add-to-list 'auto-mode-alist '("\\.cap\\'" . ruby-mode))
(add-to-list 'auto-mode-alist '("\\.thor\\'" . ruby-mode))
(add-to-list 'auto-mode-alist '("\\.rabl\\'" . ruby-mode))
(add-to-list 'auto-mode-alist '("Thorfile\\'" . ruby-mode))
(add-to-list 'auto-mode-alist '("Vagrantfile\\'" . ruby-mode))
(add-to-list 'auto-mode-alist '("\\.jbuilder\\'" . ruby-mode))
(add-to-list 'auto-mode-alist '("Podfile\\'" . ruby-mode))
(add-to-list 'auto-mode-alist '("\\.podspec\\'" . ruby-mode))
(add-to-list 'auto-mode-alist '("Puppetfile\\'" . ruby-mode))
(add-to-list 'auto-mode-alist '("Berksfile\\'" . ruby-mode))
(add-to-list 'auto-mode-alist '("Appraisals\\'" . ruby-mode))
;; We never want to edit Rubinius bytecode
(add-to-list 'completion-ignored-extensions ".rbc")
(define-key 'help-command (kbd "R") 'yari)
(eval-after-load 'ruby-mode
'(progn
(defun prelude-ruby-mode-defaults ()
(inf-ruby-minor-mode +1)
(ruby-tools-mode +1)
;; CamelCase aware editing operations
(subword-mode +1))
(setq prelude-ruby-mode-hook 'prelude-ruby-mode-defaults)
(add-hook 'ruby-mode-hook (lambda ()
(run-hooks 'prelude-ruby-mode-hook)))))
(provide 'prelude-ruby)
;;; prelude-ruby.el ends here

View File

@@ -0,0 +1,66 @@
;;; prelude-rust.el --- Emacs Prelude: Rust programming support.
;;
;; Authors: Doug MacEachern, Manoel Vilela
;; Version: 1.0.1
;; Keywords: convenience rust
;; This file is not part of GNU Emacs.
;;; Commentary:
;; Prelude configuration for Rust
;;; License:
;; This program is free software; you can redistribute it and/or
;; modify it under the terms of the GNU General Public License
;; as published by the Free Software Foundation; either version 3
;; of the License, or (at your option) any later version.
;;
;; This program is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;; GNU General Public License for more details.
;;
;; You should have received a copy of the GNU General Public License
;; along with GNU Emacs; see the file COPYING. If not, write to the
;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
;; Boston, MA 02110-1301, USA.
;;; Code:
(require 'prelude-programming)
;; You may need installing the following packages on your system:
;; * rustc (Rust Compiler)
;; * cargo (Rust Package Manager)
;; * racer (Rust Completion Tool)
;; * rustfmt (Rust Tool for formatting code)
(prelude-require-packages '(rust-mode
racer
flycheck-rust
cargo))
(setq rust-format-on-save t)
(eval-after-load 'rust-mode
'(progn
(add-hook 'rust-mode-hook 'racer-mode)
(add-hook 'racer-mode-hook 'eldoc-mode)
(add-hook 'rust-mode-hook 'cargo-minor-mode)
(add-hook 'rust-mode-hook 'flycheck-rust-setup)
(add-hook 'flycheck-mode-hook 'flycheck-rust-setup)
(defun prelude-rust-mode-defaults ()
(local-set-key (kbd "C-c C-d") 'racer-describe)
;; CamelCase aware editing operations
(subword-mode +1))
(setq prelude-rust-mode-hook 'prelude-rust-mode-defaults)
(add-hook 'rust-mode-hook (lambda ()
(run-hooks 'prelude-rust-mode-hook)))))
(provide 'prelude-rust)
;;; prelude-rust.el ends here

View File

@@ -0,0 +1,48 @@
;;; prelude-scala.el --- Emacs Prelude: scala-mode configuration.
;;
;; Copyright © 2011-2017 Bozhidar Batsov
;;
;; Author: Bozhidar Batsov <bozhidar@batsov.com>
;; URL: https://github.com/bbatsov/prelude
;; Version: 1.0.0
;; Keywords: convenience
;; This file is not part of GNU Emacs.
;;; Commentary:
;; Some basic support for the Scala programming language
;;; License:
;; This program is free software; you can redistribute it and/or
;; modify it under the terms of the GNU General Public License
;; as published by the Free Software Foundation; either version 3
;; of the License, or (at your option) any later version.
;;
;; This program is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;; GNU General Public License for more details.
;;
;; You should have received a copy of the GNU General Public License
;; along with GNU Emacs; see the file COPYING. If not, write to the
;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
;; Boston, MA 02110-1301, USA.
;;; Code:
(require 'prelude-programming)
(prelude-require-packages '(scala-mode ensime))
(defun prelude-scala-mode-defaults ()
(subword-mode +1)
(ensime-mode +1))
(setq prelude-scala-mode-hook 'prelude-scala-mode-defaults)
(add-hook 'scala-mode-hook (lambda ()
(run-hooks 'prelude-scala-mode-hook)))
(provide 'prelude-scala)
;;; prelude-scala.el ends here

View File

@@ -0,0 +1,50 @@
;;; prelude-scheme.el --- Emacs Prelude: Some defaults for Scheme.
;;
;; Copyright © 2011-2017 Bozhidar Batsov
;;
;; Author: Bozhidar Batsov <bozhidar@batsov.com>
;; URL: https://github.com/bbatsov/prelude
;; Version: 1.0.0
;; Keywords: convenience
;; This file is not part of GNU Emacs.
;;; Commentary:
;; Some basic configuration for Scheme programming.
;;; License:
;; This program is free software; you can redistribute it and/or
;; modify it under the terms of the GNU General Public License
;; as published by the Free Software Foundation; either version 3
;; of the License, or (at your option) any later version.
;;
;; This program is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;; GNU General Public License for more details.
;;
;; You should have received a copy of the GNU General Public License
;; along with GNU Emacs; see the file COPYING. If not, write to the
;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
;; Boston, MA 02110-1301, USA.
;;; Code:
(prelude-require-package 'geiser)
(require 'prelude-lisp)
(require 'geiser)
;; geiser replies on a REPL to provide autodoc and completion
(setq geiser-mode-start-repl-p t)
;; keep the home clean
(setq geiser-repl-history-filename
(expand-file-name "geiser-history" prelude-savefile-dir))
(add-hook 'scheme-mode-hook (lambda () (run-hooks 'prelude-lisp-coding-hook)))
(provide 'prelude-scheme)
;;; prelude-scheme.el ends here

View File

@@ -0,0 +1,49 @@
;;; prelude-scss.el --- Emacs Prelude: scss support
;;
;; Copyright © 2011-2017 Bozhidar Batsov
;;
;; Author: Bozhidar Batsov <bozhidar@batsov.com>
;; URL: http://www.batsov.com/emacs-prelude
;; Version: 1.0.0
;; Keywords: convenience
;; This file is not part of GNU Emacs.
;;; Commentary:
;; Some basic configuration for scss-mode.
;;; License:
;; This program is free software; you can redistribute it and/or
;; modify it under the terms of the GNU General Public License
;; as published by the Free Software Foundation; either version 3
;; of the License, or (at your option) any later version.
;;
;; This program is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;; GNU General Public License for more details.
;;
;; You should have received a copy of the GNU General Public License
;; along with GNU Emacs; see the file COPYING. If not, write to the
;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
;; Boston, MA 02110-1301, USA.
;;; Code:
(require 'prelude-css)
(prelude-require-packages '(scss-mode))
;; turn off annoying auto-compile on save
(setq scss-compile-at-save nil)
(defun prelude-scss-mode-defaults ()
(prelude-css-mode-defaults))
(setq prelude-scss-mode-hook 'prelude-scss-mode-defaults)
(add-hook 'scss-mode-hook (lambda () (run-hooks 'prelude-scss-mode-hook)))
(provide 'prelude-scss)
;;; prelude-scss.el ends here

View File

@@ -0,0 +1,51 @@
;;; prelude-shell.el --- Emacs Prelude: sh-mode configuration.
;;
;; Copyright © 2011-2017 Bozhidar Batsov
;;
;; Author: Bozhidar Batsov <bozhidar@batsov.com>
;; URL: https://github.com/bbatsov/prelude
;; Version: 1.0.0
;; Keywords: convenience
;; This file is not part of GNU Emacs.
;;; Commentary:
;; Some basic configuration for cc-mode and the modes derived from it.
;;; License:
;; This program is free software; you can redistribute it and/or
;; modify it under the terms of the GNU General Public License
;; as published by the Free Software Foundation; either version 3
;; of the License, or (at your option) any later version.
;;
;; This program is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;; GNU General Public License for more details.
;;
;; You should have received a copy of the GNU General Public License
;; along with GNU Emacs; see the file COPYING. If not, write to the
;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
;; Boston, MA 02110-1301, USA.
;;; Code:
(require 'sh-script)
;; recognize prezto files as zsh scripts
(defvar prelude-prezto-files '("zlogin" "zlogin" "zlogout" "zpreztorc" "zprofile" "zshenv" "zshrc"))
(mapc (lambda (file)
(add-to-list 'auto-mode-alist `(,(format "\\%s\\'" file) . sh-mode)))
prelude-prezto-files)
(add-hook 'sh-mode-hook
(lambda ()
(if (and buffer-file-name
(member (file-name-nondirectory buffer-file-name) prelude-prezto-files))
(sh-set-shell "zsh"))))
(provide 'prelude-shell)
;;; prelude-shell.el ends here

View File

@@ -0,0 +1,73 @@
;;; prelude-web.el --- Emacs Prelude: web template support
;;
;; Copyright © 2011-2017 Bozhidar Batsov
;;
;; Author: Bozhidar Batsov <bozhidar@batsov.com>
;; URL: http://www.batsov.com/emacs-prelude
;; Version: 1.0.0
;; Keywords: convenience
;; This file is not part of GNU Emacs.
;;; Commentary:
;; Some basic configuration for web-mode.
;;; License:
;; This program is free software; you can redistribute it and/or
;; modify it under the terms of the GNU General Public License
;; as published by the Free Software Foundation; either version 3
;; of the License, or (at your option) any later version.
;;
;; This program is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;; GNU General Public License for more details.
;;
;; You should have received a copy of the GNU General Public License
;; along with GNU Emacs; see the file COPYING. If not, write to the
;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
;; Boston, MA 02110-1301, USA.
;;; Code:
(prelude-require-packages '(web-mode))
(require 'web-mode)
(add-to-list 'auto-mode-alist '("\\.phtml\\'" . web-mode))
(add-to-list 'auto-mode-alist '("\\.tpl\\.php\\'" . web-mode))
(add-to-list 'auto-mode-alist '("\\.tpl\\'" . web-mode))
(add-to-list 'auto-mode-alist '("\\.blade\\.php\\'" . web-mode))
(add-to-list 'auto-mode-alist '("\\.jsp\\'" . web-mode))
(add-to-list 'auto-mode-alist '("\\.as[cp]x\\'" . web-mode))
(add-to-list 'auto-mode-alist '("\\.erb\\'" . web-mode))
(add-to-list 'auto-mode-alist '("\\.html?\\'" . web-mode))
(add-to-list 'auto-mode-alist
'("/\\(views\\|html\\|theme\\|templates\\)/.*\\.php\\'" . web-mode))
;; make web-mode play nice with smartparens
(setq web-mode-enable-auto-pairing nil)
(sp-with-modes '(web-mode)
(sp-local-pair "%" "%"
:unless '(sp-in-string-p)
:post-handlers '(((lambda (&rest _ignored)
(just-one-space)
(save-excursion (insert " ")))
"SPC" "=" "#")))
(sp-local-tag "%" "<% " " %>")
(sp-local-tag "=" "<%= " " %>")
(sp-local-tag "#" "<%# " " %>"))
(eval-after-load 'web-mode
'(progn
(defun prelude-web-mode-defaults ())
(setq prelude-web-mode-hook 'prelude-web-mode-defaults)
(add-hook 'web-mode-hook (lambda ()
(run-hooks 'prelude-web-mode-hook)))))
(provide 'prelude-web)
;;; prelude-web.el ends here

View File

@@ -0,0 +1,50 @@
;;; prelude-xml.el --- Emacs Prelude: XML editing configuration.
;;
;; Copyright © 2011-2017 Bozhidar Batsov
;;
;; Author: Bozhidar Batsov <bozhidar@batsov.com>
;; URL: https://github.com/bbatsov/prelude
;; Version: 1.0.0
;; Keywords: convenience
;; This file is not part of GNU Emacs.
;;; Commentary:
;; Some basic nxml-mode configuration.
;;; License:
;; This program is free software; you can redistribute it and/or
;; modify it under the terms of the GNU General Public License
;; as published by the Free Software Foundation; either version 3
;; of the License, or (at your option) any later version.
;;
;; This program is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;; GNU General Public License for more details.
;;
;; You should have received a copy of the GNU General Public License
;; along with GNU Emacs; see the file COPYING. If not, write to the
;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
;; Boston, MA 02110-1301, USA.
;;; Code:
(require 'nxml-mode)
(push '("<\\?xml" . nxml-mode) magic-mode-alist)
;; pom files should be treated as xml files
(add-to-list 'auto-mode-alist '("\\.pom$" . nxml-mode))
(setq nxml-child-indent 4)
(setq nxml-attribute-indent 4)
(setq nxml-auto-insert-xml-declaration-flag nil)
(setq nxml-bind-meta-tab-to-complete-flag t)
(setq nxml-slash-auto-complete-flag t)
(provide 'prelude-xml)
;;; prelude-xml.el ends here

View File

@@ -0,0 +1,44 @@
;;; prelude-yaml.el --- Emacs Prelude: YAML programming support.
;;
;; Copyright © 2011-2017 Bozhidar Batsov
;;
;; Author: ToBeReplaced
;; URL: http://batsov.com/prelude
;; Version: 1.0.0
;; Keywords: convenience yaml
;; This file is not part of GNU Emacs.
;;; Commentary:
;; Prelude configuration for YAML.
;;; License:
;; This program is free software; you can redistribute it and/or
;; modify it under the terms of the GNU General Public License
;; as published by the Free Software Foundation; either version 3
;; of the License, or (at your option) any later version.
;;
;; This program is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;; GNU General Public License for more details.
;;
;; You should have received a copy of the GNU General Public License
;; along with GNU Emacs; see the file COPYING. If not, write to the
;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
;; Boston, MA 02110-1301, USA.
;;; Code:
(prelude-require-packages '(yaml-mode))
;; yaml-mode doesn't derive from prog-mode, but we can at least enable
;; whitespace-mode and apply cleanup.
(add-hook 'yaml-mode-hook 'whitespace-mode)
(add-hook 'yaml-mode-hook 'subword-mode)
(add-hook 'yaml-mode-hook
(lambda () (add-hook 'before-save-hook 'prelude-cleanup-maybe nil t)))
(provide 'prelude-yaml)
;;; prelude-yaml.el ends here