diff --git a/README.md b/README.md index 8cf07f2..60a97cc 100644 --- a/README.md +++ b/README.md @@ -253,10 +253,6 @@ If you're not fond of spellchecking on the fly: (setq prelude-flyspell nil) ``` -### Prelude Modules - -Additional settings for various programming languages are available for installation via MELPA. You might take a look at the [Prelude Modules project](https://github.com/bbatsov/prelude-modules) for further info. - ## Caveats & Pitfalls ### Problems with flyspell-mode diff --git a/prelude/prelude-core.el b/core/prelude-core.el similarity index 100% rename from prelude/prelude-core.el rename to core/prelude-core.el diff --git a/prelude/prelude-editor.el b/core/prelude-editor.el similarity index 100% rename from prelude/prelude-editor.el rename to core/prelude-editor.el diff --git a/prelude/prelude-global-keybindings.el b/core/prelude-global-keybindings.el similarity index 100% rename from prelude/prelude-global-keybindings.el rename to core/prelude-global-keybindings.el diff --git a/prelude/prelude-mode.el b/core/prelude-mode.el similarity index 100% rename from prelude/prelude-mode.el rename to core/prelude-mode.el diff --git a/prelude/prelude-osx.el b/core/prelude-osx.el similarity index 100% rename from prelude/prelude-osx.el rename to core/prelude-osx.el diff --git a/prelude/prelude-packages.el b/core/prelude-packages.el similarity index 85% rename from prelude/prelude-packages.el rename to core/prelude-packages.el index 2a94569..19adc23 100644 --- a/prelude/prelude-packages.el +++ b/core/prelude-packages.el @@ -71,31 +71,24 @@ (,mode))))) (defvar prelude-auto-install-alist - '(("\\.clj\\'" prelude-clojure clojure-mode) - ("\\.coffee\\'" prelude-coffee coffee-mode) - ("\\.css\\'" prelude-css css-mode) - ("\\.el\\'" prelude-emacs-lisp emacs-lisp-mode) + '(("\\.clj\\'" clojure-mode clojure-mode) + ("\\.coffee\\'" coffee-mode coffee-mode) + ("\\.css\\'" css-mode css-mode) ("\\.erl\\'" erlang erlang-mode) ("\\.feature\\'" feature-mode feature-mode) ("\\.groovy\\'" groovy-mode groovy-mode) ("\\.haml\\'" haml-mode haml-mode) - ("\\.hs\\'" prelude-haskell haskell-mode) - ("\\.js\\'" prelude-js js-mode) - ("\\.latex\\'" prelude-latex LaTeX-mode) + ("\\.hs\\'" haskell-mode haskell-mode) + ("\\.latex\\'" auctex LaTeX-mode) ("\\.less\\'" less-css-mode less-css-mode) - ("\\.lisp\\'" prelude-common-lisp lisp-mode) ("\\.lua\\'" lua-mode lua-mode) ("\\.markdown\\'" markdown-mode markdown-mode) ("\\.md\\'" markdown-mode markdown-mode) ("\\.php\\'" php-mode php-mode) - ("\\.pl\\'" prelude-perl cperl-mode) ("\\.py\\'" python python-mode) - ("\\.rb\\'" prelude-ruby ruby-mode) ("\\.sass\\'" sass-mode sass-mode) - ("\\.scala\\'" prelude-scala scala-mode) - ("\\.scm\\'" prelude-scheme scheme-mode) - ("\\.scss\\'" prelude-scss scss-mode) - ("\\.xml\\'" prelude-xml nxml-mode) + ("\\.scala\\'" scala-mode scala-mode) + ("\\.scss\\'" scss-mode scss-mode) ("\\.yml\\'" yaml-mode yaml-mode))) ;; markdown-mode doesn't have autoloads for the auto-mode-alist @@ -112,5 +105,8 @@ (unless (package-installed-p package) (prelude-auto-install extension package mode))))) +(defun prelude-ensure-module-deps (packages) + (-each (-remove #'package-installed-p packages) #'package-install)) + (provide 'prelude-packages) ;;; prelude-packages.el ends here diff --git a/prelude/prelude-ui.el b/core/prelude-ui.el similarity index 100% rename from prelude/prelude-ui.el rename to core/prelude-ui.el diff --git a/init.el b/init.el index 94b50fa..21a7c1f 100644 --- a/init.el +++ b/init.el @@ -37,9 +37,10 @@ (defvar prelude-dir (file-name-directory load-file-name) "The root dir of the Emacs Prelude distribution.") -(defvar prelude-modules-dir (expand-file-name "prelude" prelude-dir) - "This directory houses all of the built-in Prelude module. You should -avoid modifying the configuration there.") +(defvar prelude-core-dir (expand-file-name "core" prelude-dir) + "The home of Prelude's core functionality.") +(defvar prelude-modules-dir (expand-file-name "modules" prelude-dir) + "This directory houses all of the built-in Prelude modules.") (defvar prelude-personal-dir (expand-file-name "personal" prelude-dir) "Users of Emacs Prelude are encouraged to keep their personal configuration changes in this directory. All Emacs Lisp files there are loaded automatically @@ -58,6 +59,7 @@ ELPA (or MELPA).") (make-directory prelude-savefile-dir)) ;; add Prelude's directories to Emacs's `load-path' +(add-to-list 'load-path prelude-core-dir) (add-to-list 'load-path prelude-modules-dir) (add-to-list 'load-path prelude-vendor-dir) @@ -76,6 +78,30 @@ ELPA (or MELPA).") (when (eq system-type 'darwin) (require 'prelude-osx)) +;; the modules +(require 'prelude-programming) +(require 'prelude-c) +(require 'prelude-clojure) +(require 'prelude-coffee) +(require 'prelude-common-lisp) +(require 'prelude-css) +(require 'prelude-emacs-lisp) +(require 'prelude-erc) +(require 'prelude-erlang) +(require 'prelude-haskell) +(require 'prelude-js) +(require 'prelude-latex) +(require 'prelude-lisp) +(require 'prelude-mediawiki) +(require 'prelude-org) +(require 'prelude-perl) +(require 'prelude-python) +(require 'prelude-ruby) +(require 'prelude-scala) +(require 'prelude-scheme) +(require 'prelude-scss) +(require 'prelude-xml) + ;; config changes made through the customize UI will be store here (setq custom-file (expand-file-name "custom.el" prelude-personal-dir)) diff --git a/modules/prelude-c.el b/modules/prelude-c.el new file mode 100644 index 0000000..6839c1c --- /dev/null +++ b/modules/prelude-c.el @@ -0,0 +1,58 @@ +;;; prelude-c.el --- Emacs Prelude: cc-mode configuration. +;; +;; Copyright (c) 2011-2012 Bozhidar Batsov +;; +;; Author: Bozhidar Batsov +;; URL: http://batsov.com/emacs-prelude +;; Version: 1.0.0 +;; Keywords: convenience +;; Package-Requires: ((prelude-programming "1.0.0")) + +;; 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 indent-tabs-mode t) + (setq c-basic-offset 4)) + +(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 () + (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 diff --git a/modules/prelude-clojure.el b/modules/prelude-clojure.el new file mode 100644 index 0000000..881b4ca --- /dev/null +++ b/modules/prelude-clojure.el @@ -0,0 +1,65 @@ +;;; prelude-clojure.el --- Emacs Prelude: Clojure programming configuration. +;; +;; Copyright (c) 2011-2012 Bozhidar Batsov +;; +;; Author: Bozhidar Batsov +;; URL: http://batsov.com/prelude +;; Version: 1.0.0 +;; Keywords: convenience +;; Package-Requires: ((prelude-lisp "1.0.0") (clojure-mode "1.11.5") (nrepl "0.1.4")) + +;; 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-ensure-module-deps '(clojure-mode nrepl)) + +(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 'nrepl + '(progn + (add-hook 'nrepl-interaction-mode-hook 'nrepl-turn-on-eldoc-mode) + + (defun prelude-nrepl-mode-defaults () + (subword-mode +1) + (run-hooks 'prelude-interactive-lisp-coding-hook)) + + (setq prelude-nrepl-mode-hook 'prelude-nrepl-mode-defaults) + + (add-hook 'nrepl-mode-hook (lambda () + (run-hooks 'prelude-nrepl-mode-hook))))) + +(provide 'prelude-clojure) + +;;; prelude-clojure.el ends here diff --git a/modules/prelude-coffee.el b/modules/prelude-coffee.el new file mode 100644 index 0000000..4fedec0 --- /dev/null +++ b/modules/prelude-coffee.el @@ -0,0 +1,76 @@ +;;; prelude-coffee.el --- Emacs Prelude: CoffeeScript programming support. +;; +;; Copyright (c) 2011-2012 Bozhidar Batsov +;; +;; Author: Bozhidar Batsov +;; URL: http://batsov.com/emacs-prelude +;; Version: 1.0.0 +;; Keywords: convenience +;; Package-Requires: ((coffee-mode "0.4.0")) + +;; 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) + +(eval-after-load 'coffee-mode + '(progn + (defun prelude-coffee-mode-defaults () + "coffee-mode-defaults" + + ;; CoffeeScript uses two spaces. + (set (make-local-variable 'tab-width) 2) + + ;; If you don't have js2-mode + (setq coffee-js-mode 'javascript-mode) + + ;; If you don't want your compiled files to be wrapped + (setq coffee-args-compile '("-c" "--bare")) + + ;; *Messages* spam + (setq coffee-debug-mode t) + + ;; electric-indent doesn't play nice with coffee-mode's "smart" + ;; indent + (electric-indent-mode -1) + + ;; Emacs key binding + (define-key coffee-mode-map [(meta r)] 'coffee-compile-buffer) + + ;; Riding edge. + (setq coffee-command "~/dev/coffee") + + ;; Compile '.coffee' files on every save + (and (file-exists-p (buffer-file-name)) + (file-exists-p (coffee-compiled-file-name)) + (coffee-cos-mode t))) + + (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 diff --git a/modules/prelude-common-lisp.el b/modules/prelude-common-lisp.el new file mode 100644 index 0000000..4cfd1f5 --- /dev/null +++ b/modules/prelude-common-lisp.el @@ -0,0 +1,95 @@ +;;; prelude-common-lisp.el --- Emacs Prelude: lisp-mode and SLIME config. +;; +;; Copyright (c) 2011-2012 Bozhidar Batsov +;; +;; Author: Bozhidar Batsov +;; URL: http://batsov.com/emacs-prelude +;; Version: 1.0.0 +;; Keywords: convenience +;; Package-Requires: ((prelude-lisp "1.0.0")) + +;; 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) + +;; the SBCL configuration file is in Common Lisp +(add-to-list 'auto-mode-alist '("\\.sbclrc$" . lisp-mode)) + +;; Common Lisp support depends on SLIME being installed with Quicklisp +(if (file-exists-p (expand-file-name "~/quicklisp/slime-helper.el")) + (load (expand-file-name "~/quicklisp/slime-helper.el")) + (message "%s" "SLIME is not installed. Use Quicklisp to install it.")) + +;; 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 (eq system-type 'darwin) + ;; 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-hook 'lisp-mode-hook (lambda () (run-hooks 'prelude-lisp-coding-hook))) +(add-hook 'slime-repl-mode-hook (lambda () (run-hooks 'prelude-interactive-lisp-coding-hook))) + +;; start slime automatically when we open a lisp file +(defun prelude-start-slime () + (unless (slime-connected-p) + (save-excursion (slime)))) + +(add-hook 'slime-mode-hook 'prelude-start-slime) + +;; Stop SLIME's REPL from grabbing DEL, +;; which is annoying when backspacing over a '(' +(defun prelude-override-slime-repl-bindings-with-paredit () + (define-key slime-repl-mode-map + (read-kbd-macro paredit-backward-delete-key) nil)) + +(add-hook 'slime-repl-mode-hook 'prelude-override-slime-repl-bindings-with-paredit) + +(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) + + (define-key slime-mode-map (kbd "TAB") 'slime-indent-and-complete-symbol) + (define-key slime-mode-map (kbd "C-c i") 'slime-inspect) + (define-key slime-mode-map (kbd "C-c C-s") 'slime-selector))) + +(provide 'prelude-common-lisp) + +;;; prelude-common-lisp.el ends here diff --git a/modules/prelude-css.el b/modules/prelude-css.el new file mode 100644 index 0000000..64c6ad8 --- /dev/null +++ b/modules/prelude-css.el @@ -0,0 +1,50 @@ +;;; prelude-css.el --- Emacs Prelude: css support +;; +;; Copyright (c) 2011-2012 Bozhidar Batsov +;; +;; Author: Bozhidar Batsov +;; URL: http://www.batsov.com/emacs-prelude +;; Version: 1.0.0 +;; Keywords: convenience +;; Package-Requires: ((rainbow-mode "0.2")) + +;; 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-ensure-module-deps '(rainbow-mode)) + + (defun prelude-css-mode-defaults () + (setq css-indent-offset 2) + (rainbow-mode +1)) + + (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 diff --git a/modules/prelude-emacs-lisp.el b/modules/prelude-emacs-lisp.el new file mode 100644 index 0000000..26eb999 --- /dev/null +++ b/modules/prelude-emacs-lisp.el @@ -0,0 +1,68 @@ +;;; prelude-emacs-lisp.el --- Emacs Prelude: Nice config for Elisp programming. +;; +;; Copyright (c) 2011-2012 Bozhidar Batsov +;; +;; Author: Bozhidar Batsov +;; URL: http://batsov.com/emacs-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) + +(defun prelude-remove-elc-on-save () + "If you're saving an elisp file, likely the .elc is no longer valid." + (make-local-variable 'after-save-hook) + (add-hook 'after-save-hook + (lambda () + (if (file-exists-p (concat buffer-file-name "c")) + (delete-file (concat buffer-file-name "c")))))) + +(defun prelude-emacs-lisp-mode-defaults () + (run-hooks 'prelude-lisp-coding-hook) + (turn-on-eldoc-mode) + (prelude-remove-elc-on-save) + (rainbow-mode +1)) + +(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))) + +;; ielm is an interactive Emacs Lisp shell +(defun prelude-ielm-mode-defaults () + (run-hooks 'prelude-interactive-lisp-coding-hook) + (turn-on-eldoc-mode)) + +(setq prelude-ielm-mode-hook 'prelude-ielm-mode-defaults) + +(add-hook 'ielm-mode-hook (lambda () (run-hooks 'prelude-ielm-mode-hook))) + +(define-key emacs-lisp-mode-map (kbd "M-.") 'find-function-at-point) +(provide 'prelude-emacs-lisp) + +;;; prelude-emacs-lisp.el ends here diff --git a/modules/prelude-erc.el b/modules/prelude-erc.el new file mode 100644 index 0000000..a85490b --- /dev/null +++ b/modules/prelude-erc.el @@ -0,0 +1,162 @@ +;;; prelude-erc.el --- Emacs Prelude: ERC mode configuration. +;; +;; Copyright (c) 2011-2012 Bozhidar Batsov +;; +;; Author: Bozhidar Batsov +;; URL: http://batsov.com/emacs-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 +(erc-spelling-mode 1) +;; set different dictionaries by different servers/channels +;;(setq erc-spelling-dictionaries '(("#emacs" "american"))) + +;; TODO - replace this with use of notify.el +;; Notify my when someone mentions my nick. +(defun call-libnotify (matched-type nick msg) + (let* ((cmsg (split-string (clean-message msg))) + (nick (first (split-string nick "!"))) + (msg (mapconcat 'identity (rest cmsg) " "))) + (shell-command-to-string + (format "notify-send -u critical '%s says:' '%s'" nick msg)))) + +(when (eq system-type 'linux) + (add-hook 'erc-text-matched-hook 'call-libnotify)) + +(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))) + +;; private message notification +(defun erc-notify-on-private-msg (proc parsed) + (let ((nick (car (erc-parse-user (erc-response.sender parsed)))) + (target (car (erc-response.command-args parsed))) + (msg (erc-response.contents parsed))) + (when (and (erc-current-nick-p target) + (not (erc-is-message-ctcp-and-not-action-p msg)) + (erc-notify-allowed-p nick)) + (shell-command-to-string + (format "notify-send -u critical '%s says:' '%s'" nick msg)) + nil))) + +(add-hook 'erc-server-PRIVMSG-functions 'erc-notify-on-private-msg) + +;; 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)) + +(defun start-irc () + "Connect to IRC." + (interactive) + (when (y-or-n-p "Do you want to start IRC? ") + (erc :server "irc.freenode.net" :port 6667 :nick erc-nick))) + +(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) + (dolist (buffer (filter-server-buffers)) + (message "Server buffer: %s" (buffer-name buffer)) + (with-current-buffer buffer + (erc-quit-server "Asta la vista")))) + +(provide 'prelude-erc) + +;;; prelude-erc.el ends here diff --git a/modules/prelude-erlang.el b/modules/prelude-erlang.el new file mode 100644 index 0000000..0ef8764 --- /dev/null +++ b/modules/prelude-erlang.el @@ -0,0 +1,61 @@ +;;; prelude-erlang.el --- Emacs Prelude: Erlang programming support. +;; +;; Copyright (c) 2011-2012 Gleb Peregud +;; +;; Author: Gleb Peregud +;; Version: 1.0.0 +;; Keywords: convenience erlang +;; Package-Requires: ((erlang "2.4.1") (projectile "0.7")) + +;; 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-ensure-module-deps '(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 diff --git a/modules/prelude-haskell.el b/modules/prelude-haskell.el new file mode 100644 index 0000000..e420c27 --- /dev/null +++ b/modules/prelude-haskell.el @@ -0,0 +1,52 @@ +;;; prelude-haskell.el --- Emacs Prelude: Nice config for Haskell programming. +;; +;; Copyright (c) 2011-2012 Bozhidar Batsov +;; +;; Author: Bozhidar Batsov +;; URL: http://batsov.com/emacs-prelude +;; Version: 1.0.0 +;; Keywords: convenience +;; Package-Requires: ((haskell-mode "2.8.0") (prelude-programming "1.0.0")) + +;; 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) + +(eval-after-load 'haskell-mode + '(progn + (defun prelude-haskell-mode-defaults () + (subword-mode +1) + (turn-on-haskell-doc-mode) + (turn-on-haskell-indentation)) + + (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 diff --git a/modules/prelude-js.el b/modules/prelude-js.el new file mode 100644 index 0000000..d0b8121 --- /dev/null +++ b/modules/prelude-js.el @@ -0,0 +1,50 @@ +;;; prelude-js.el --- Emacs Prelude: js-mode configuration. +;; +;; Copyright (c) 2011-2012 Bozhidar Batsov +;; +;; Author: Bozhidar Batsov +;; URL: http://batsov.com/emacs-prelude +;; Version: 1.0.0 +;; Keywords: convenience +;; Package-Requires: ((prelude-programming "1.0.0")) + +;; 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) + +(eval-after-load 'js-mode + '(progn + (defun prelude-js-mode-defaults () + ;; electric-layout-mode doesn't play nice with js-mode + (electric-layout-mode -1)) + + (setq prelude-js-mode-hook 'prelude-js-mode-defaults) + + (add-hook 'js-mode-hook (lambda () (run-hooks 'prelude-js-mode-hook))))) + +(provide 'prelude-js) + +;;; prelude-js.el ends here diff --git a/modules/prelude-latex.el b/modules/prelude-latex.el new file mode 100644 index 0000000..f4dde0d --- /dev/null +++ b/modules/prelude-latex.el @@ -0,0 +1,68 @@ +;;; prelude-latex.el --- Emacs Prelude: Sane setup for LaTeX writers. +;; +;; Copyright (c) 2011-2012 Bozhidar Batsov +;; +;; Author: Bozhidar Batsov +;; URL: http://batsov.com/emacs-prelude +;; Version: 1.0.0 +;; Keywords: convenience +;; Package-Requires: ((auctex "11.86")) + +;; 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: + +;; AUCTeX configuration +(setq TeX-auto-save t) +(setq TeX-parse-self t) + +(setq-default TeX-master nil) + +;; use pdflatex +(setq TeX-PDF-mode t) + +(setq TeX-view-program-selection + '((output-dvi "DVI Viewer") + (output-pdf "PDF Viewer") + (output-html "HTML Viewer"))) + +;; this section is good for OS X only +;; TODO add sensible defaults for Linux/Windows +(setq TeX-view-program-list + '(("DVI Viewer" "open %o") + ("PDF Viewer" "open %o") + ("HTML Viewer" "open %o"))) + +(defun prelude-latex-mode-defaults () + (turn-on-auto-fill) + (abbrev-mode +1)) + +(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 diff --git a/modules/prelude-lisp.el b/modules/prelude-lisp.el new file mode 100644 index 0000000..b2b440a --- /dev/null +++ b/modules/prelude-lisp.el @@ -0,0 +1,59 @@ +;;; prelude-lisp.el --- Emacs Prelude: Configuration common to all lisp modes. +;; +;; Copyright (c) 2011-2012 Bozhidar Batsov +;; +;; Author: Bozhidar Batsov +;; URL: http://batsov.com/emacs-prelude +;; Version: 1.0.0 +;; Keywords: convenience +;; Package-Requires: ((prelude-programming "1.0.0") (paredit "22") (rainbow-delimiters "1.3.4")) + +;; 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-ensure-module-deps '(paredit rainbow-delimiters)) + +;; Lisp configuration +(define-key read-expression-map (kbd "TAB") 'lisp-complete-symbol) + +;; a great lisp coding hook +(defun prelude-lisp-coding-defaults () + (paredit-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 () + (paredit-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 diff --git a/modules/prelude-mediawiki.el b/modules/prelude-mediawiki.el new file mode 100644 index 0000000..85ffe4d --- /dev/null +++ b/modules/prelude-mediawiki.el @@ -0,0 +1,46 @@ +;;; prelude-mediawiki.el --- Emacs Prelude: mediawiki editing config +;; +;; Copyright (c) 2011-2012 Bozhidar Batsov +;; +;; Author: Bozhidar Batsov +;; URL: http://batsov.com/emacs-prelude +;; Version: 1.0.0 +;; Keywords: convenience +;; Package-Requires: ((mediawiki "2.2.3")) + +;; 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: + +(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 diff --git a/modules/prelude-org.el b/modules/prelude-org.el new file mode 100644 index 0000000..8996e57 --- /dev/null +++ b/modules/prelude-org.el @@ -0,0 +1,50 @@ +;;; prelude-org.el --- Emacs Prelude: org-mode configuration. +;; +;; Copyright (c) 2011-2012 Bozhidar Batsov +;; +;; Author: Bozhidar Batsov +;; URL: http://batsov.com/emacs-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 () + (electric-indent-mode -1)) + +(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 diff --git a/modules/prelude-perl.el b/modules/prelude-perl.el new file mode 100644 index 0000000..e1e39b4 --- /dev/null +++ b/modules/prelude-perl.el @@ -0,0 +1,68 @@ +;;; prelude-perl.el --- Emacs Prelude: decent Perl coding settings. +;; +;; Copyright (c) 2011-2012 Bozhidar Batsov +;; +;; Author: Bozhidar Batsov +;; URL: http://batsov.com/emacs-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: + +;; 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 diff --git a/modules/prelude-programming.el b/modules/prelude-programming.el new file mode 100644 index 0000000..7b64c69 --- /dev/null +++ b/modules/prelude-programming.el @@ -0,0 +1,130 @@ +;;; prelude-programming.el --- Emacs Prelude: prog-mode configuration +;; +;; Copyright (c) 2011-2012 Bozhidar Batsov +;; +;; Author: Bozhidar Batsov +;; URL: http://batsov.com/emacs-prelude +;; Version: 1.0.0 +;; Keywords: convenience +;; Package-Requires: ((guru-mode "0.1")) + +;; 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-ido-goto-symbol (&optional symbol-list) + "Refresh imenu and jump to a place in the buffer using Ido." + (interactive) + (unless (featurep 'imenu) + (require 'imenu nil t)) + (cond + ((not symbol-list) + (let ((ido-mode ido-mode) + (ido-enable-flex-matching + (if (boundp 'ido-enable-flex-matching) + ido-enable-flex-matching t)) + name-and-pos symbol-names position) + (unless ido-mode + (ido-mode 1) + (setq ido-enable-flex-matching t)) + (while (progn + (imenu--cleanup) + (setq imenu--index-alist nil) + (prelude-ido-goto-symbol (imenu--make-index-alist)) + (setq selected-symbol + (ido-completing-read "Symbol? " symbol-names)) + (string= (car imenu--rescan-item) selected-symbol))) + (unless (and (boundp 'mark-active) mark-active) + (push-mark nil t nil)) + (setq position (cdr (assoc selected-symbol name-and-pos))) + (cond + ((overlayp position) + (goto-char (overlay-start position))) + (t + (goto-char position))))) + ((listp symbol-list) + (dolist (symbol symbol-list) + (let (name position) + (cond + ((and (listp symbol) (imenu--subalist-p symbol)) + (prelude-ido-goto-symbol symbol)) + ((listp symbol) + (setq name (car symbol)) + (setq position (cdr symbol))) + ((stringp symbol) + (setq name symbol) + (setq position + (get-text-property 1 'org-imenu-marker symbol)))) + (unless (or (null position) (null name) + (string= (car imenu--rescan-item) name)) + (add-to-list 'symbol-names name) + (add-to-list 'name-and-pos (cons name position)))))))) + +;; add a shortcut for prelude-ido-goto-symbol +(eval-after-load 'prelude-mode + '(define-key prelude-mode-map (kbd "C-c i") 'prelude-ido-goto-symbol)) + +(defun prelude-local-comment-auto-fill () + (set (make-local-variable 'comment-auto-fill-only-comments) t)) + +(defun prelude-add-watchwords () + (font-lock-add-keywords + nil '(("\\<\\(FIX\\|TODO\\|FIXME\\|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) + +(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)) + (when prelude-whitespace + (whitespace-mode +1)) + (prelude-local-comment-auto-fill) + (prelude-add-watchwords) + ;; keep the whitespace decent all the time (in this buffer) + (add-hook 'before-save-hook 'whitespace-cleanup nil t)) + +(setq prelude-prog-mode-hook 'prelude-prog-mode-defaults) + +(add-hook 'prog-mode-hook (lambda () + (run-hooks 'prelude-prog-mode-hook))) + +(provide 'prelude-programming) +;;; prelude-programming.el ends here diff --git a/modules/prelude-python.el b/modules/prelude-python.el new file mode 100644 index 0000000..7e2cffe --- /dev/null +++ b/modules/prelude-python.el @@ -0,0 +1,50 @@ +;;; prelude-python.el --- Emacs Prelude: python.el configuration. +;; +;; Copyright (c) 2011-2012 Bozhidar Batsov +;; +;; Author: Bozhidar Batsov +;; URL: http://batsov.com/emacs-prelude +;; Version: 1.0.0 +;; Keywords: convenience +;; Package-Requires: ((prelude-programming "1.0.0") (python "23.1")) + +;; 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: + +(require 'prelude-programming) +(prelude-ensure-module-deps '(python)) + +(defun prelude-python-mode-defaults () + (run-hooks 'prelude-prog-mode-hook) ;; run manually; not derived from prog-mode + (electric-indent-mode -1)) + +(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 diff --git a/modules/prelude-ruby.el b/modules/prelude-ruby.el new file mode 100644 index 0000000..2b0c0f8 --- /dev/null +++ b/modules/prelude-ruby.el @@ -0,0 +1,75 @@ +;;; prelude-ruby.el --- Emacs Prelude: A nice setup for Ruby (and Rails) devs. +;; +;; Copyright (c) 2011-2012 Bozhidar Batsov +;; +;; Author: Bozhidar Batsov +;; URL: http://batsov.com/emacs-prelude +;; Version: 1.0.0 +;; Keywords: convenience +;; Package-Requires: ((prelude-programming "1.0.0") (ruby-tools "0.0.1") (inf-ruby "2.2.3") (yari "0.5") (ruby-end "0.0.1") (ruby-block "0.0.11")) + +;; 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-ensure-module-deps '(ruby-tools inf-ruby yari ruby-end ruby-block)) + +(require 'ruby-block) +;; 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 '("\\.thor\\'" . ruby-mode)) +(add-to-list 'auto-mode-alist '("Thorfile\\'" . ruby-mode)) +(add-to-list 'auto-mode-alist '("Vagrantfile\\'" . 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-setup-keybindings) + ;; turn off the annoying input echo in irb + (setq comint-process-echoes t) + (ruby-block-mode t) + (ruby-end-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 diff --git a/modules/prelude-scala.el b/modules/prelude-scala.el new file mode 100644 index 0000000..9a04e30 --- /dev/null +++ b/modules/prelude-scala.el @@ -0,0 +1,51 @@ +;;; prelude-scala.el --- Emacs Prelude: scala-mode configuration. +;; +;; Copyright (c) 2011-2012 Bozhidar Batsov +;; +;; Author: Bozhidar Batsov +;; URL: http://batsov.com/emacs-prelude +;; Version: 1.0.0 +;; Keywords: convenience +;; Package-Requires: ((prelude-programming "1.0.0") (scala-mode "2.8.0")) + +;; 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-ensure-module-deps '(scala-mode)) + +(require 'scala-mode-auto) + +(defun prelude-scala-mode-defaults () + (run-hooks 'prelude-prog-mode-hook) ;; run manually; not derived from prog-mode + (subword-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 diff --git a/modules/prelude-scheme.el b/modules/prelude-scheme.el new file mode 100644 index 0000000..ef359d9 --- /dev/null +++ b/modules/prelude-scheme.el @@ -0,0 +1,42 @@ +;;; prelude-scheme.el --- Emacs Prelude: Some defaults for Scheme. +;; +;; Copyright (c) 2011-2012 Bozhidar Batsov +;; +;; Author: Bozhidar Batsov +;; URL: http://batsov.com/emacs-prelude +;; Version: 1.0.0 +;; Keywords: convenience +;; Package-Requires: ((prelude-lisp "1.0.0")) + +;; 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: + +(require 'prelude-lisp) + +(add-hook 'scheme-mode-hook (lambda () (run-hooks 'prelude-lisp-coding-hook))) + +(provide 'prelude-scheme) + +;;; prelude-scheme.el ends here diff --git a/modules/prelude-scss.el b/modules/prelude-scss.el new file mode 100644 index 0000000..e299715 --- /dev/null +++ b/modules/prelude-scss.el @@ -0,0 +1,48 @@ +;;; prelude-scss.el --- Emacs Prelude: scss support +;; +;; Copyright (c) 2011-2012 Bozhidar Batsov +;; +;; Author: Bozhidar Batsov +;; URL: http://www.batsov.com/emacs-prelude +;; Version: 1.0.0 +;; Keywords: convenience +;; Package-Requires: ((prelude-css "1.0.0") (scss-mode "0.5.0")) + +;; 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) + +(defun prelude-scss-mode-defaults () + (prelude-css-mode-defaults) + ;; turn off annoying auto-compile on save + (setq scss-compile-at-save nil)) + +(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 diff --git a/modules/prelude-xml.el b/modules/prelude-xml.el new file mode 100644 index 0000000..9f73199 --- /dev/null +++ b/modules/prelude-xml.el @@ -0,0 +1,48 @@ +;;; prelude-xml.el --- Emacs Prelude: XML editing configuration. +;; +;; Copyright (c) 2011-2012 Bozhidar Batsov +;; +;; Author: Bozhidar Batsov +;; URL: http://batsov.com/emacs-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: + +(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 diff --git a/utils/installer.sh b/utils/installer.sh index 76bf81d..702c271 100755 --- a/utils/installer.sh +++ b/utils/installer.sh @@ -139,7 +139,7 @@ then fi # If prelude is already installed -if [ -d $PRELUDE_INSTALL_DIR/prelude ] +if [ -d $PRELUDE_INSTALL_DIR/core/prelude-core.el ] then printf "\n\n$BRED" printf "You already have Prelude installed.$RESET\nYou'll need to remove $PRELUDE_INSTALL_DIR/prelude if you want to install Prelude again.\n"