extracted non-essential modules to a separate project

This commit is contained in:
Bozhidar Batsov 2012-04-17 17:35:21 +03:00
parent 66bc6f0809
commit 23f3853a95
35 changed files with 30 additions and 1586 deletions

View file

@ -1,42 +0,0 @@
;;; prelude-ack.el --- Emacs Prelude: ack support
;;
;; Copyright (c) 2011 Bozhidar Batsov
;;
;; Author: Bozhidar Batsov <bozhidar.batsov@gmail.com>
;; URL: http://www.emacswiki.org/cgi-bin/wiki/Prelude
;; Version: 1.0.0
;; Keywords: convenience
;; This file is not part of GNU Emacs.
;;; Commentary:
;; Some basic configuration for ack-and-a-half.el.
;;; 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:
;; create shorter aliases
(defalias 'ack 'ack-and-a-half)
(defalias 'ack-same 'ack-and-a-half-same)
(defalias 'ack-find-file 'ack-and-a-half-find-file)
(defalias 'ack-find-file-same 'ack-and-a-half-find-file-same)
(provide 'prelude-ack)
;;; prelude-ack.el ends here

View file

@ -1,54 +0,0 @@
;;; prelude-c.el --- Emacs Prelude: cc-mode configuration.
;;
;; Copyright (c) 2011 Bozhidar Batsov
;;
;; Author: Bozhidar Batsov <bozhidar.batsov@gmail.com>
;; URL: http://www.emacswiki.org/cgi-bin/wiki/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:
(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

View file

@ -1,53 +0,0 @@
;;; prelude-clojure.el --- Emacs Prelude: Clojure programming configuration.
;;
;; Copyright (c) 2011 Bozhidar Batsov
;;
;; Author: Bozhidar Batsov <bozhidar.batsov@gmail.com>
;; URL: http://www.emacswiki.org/cgi-bin/wiki/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)
;; To start SLIME in your Clojure project:
;; 1. lein plugin install swank-clojure 1.3.1 (or newer)
;; 2. Invoke M-x clojure-jack-in from a project
(eval-after-load 'clojure-mode
'(progn
(defun prelude-clojure-mode-defaults ()
(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)))))
(provide 'prelude-clojure)
;;; prelude-clojure.el ends here

View file

@ -1,74 +0,0 @@
;;; prelude-coffee.el --- Emacs Prelude: CoffeeScript programming support.
;;
;; Copyright (c) 2011 Bozhidar Batsov
;;
;; Author: Bozhidar Batsov <bozhidar.batsov@gmail.com>
;; URL: http://www.emacswiki.org/cgi-bin/wiki/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:
(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

View file

@ -1,97 +0,0 @@
;;; prelude-common-lisp.el --- Emacs Prelude: lisp-mode and SLIME config.
;;
;; Copyright (c) 2011 Bozhidar Batsov
;;
;; Author: Bozhidar Batsov <bozhidar.batsov@gmail.com>
;; URL: http://www.emacswiki.org/cgi-bin/wiki/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)
;; the SBCL configuration file is in Common Lisp
(add-to-list 'auto-mode-alist '("\\.sbclrc$" . lisp-mode))
;; Use SLIME from Quicklisp
(defun prelude-load-common-lisp-slime ()
(interactive)
;; 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

View file

@ -1,388 +0,0 @@
;;; prelude-core.el --- Emacs Prelude: core Prelude defuns.
;;
;; Copyright (c) 2011 Bozhidar Batsov
;;
;; Author: Bozhidar Batsov <bozhidar.batsov@gmail.com>
;; URL: http://www.emacswiki.org/cgi-bin/wiki/Prelude
;; Version: 1.0.0
;; Keywords: convenience
;; This file is not part of GNU Emacs.
;;; Commentary:
;; Here are the definitions of most of the functions added by Prelude.
;;; License:
;; This program is free software; you can redistribute it and/or
;; modify it under the terms of the GNU General Public License
;; as published by the Free Software Foundation; either version 3
;; of the License, or (at your option) any later version.
;;
;; This program is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;; GNU General Public License for more details.
;;
;; You should have received a copy of the GNU General Public License
;; along with GNU Emacs; see the file COPYING. If not, write to the
;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
;; Boston, MA 02110-1301, USA.
;;; Code:
(require 'cl)
(require 'thingatpt)
(defun prelude-add-subfolders-to-load-path (parent-dir)
"Adds all first level `parent-dir' subdirs to the
Emacs load path."
(dolist (f (directory-files parent-dir))
(let ((name (concat parent-dir f)))
(when (and (file-directory-p name)
(not (equal f ".."))
(not (equal f ".")))
(add-to-list 'load-path name)))))
;; add the first level subfolders of vendor automatically
(prelude-add-subfolders-to-load-path prelude-vendor-dir)
(defun prelude-open-with ()
"Simple function that allows us to open the underlying
file of a buffer in an external program."
(interactive)
(when buffer-file-name
(shell-command (concat
(if (eq system-type 'darwin)
"open"
(read-shell-command "Open current file with: "))
" "
buffer-file-name))))
(defun prelude-buffer-mode (buffer-or-name)
(with-current-buffer buffer-or-name major-mode))
(defun prelude-visit-term-buffer ()
(interactive)
(if (not (get-buffer "*ansi-term*"))
(ansi-term "/bin/bash")
(switch-to-buffer "*ansi-term*")))
(defun prelude-google ()
"Googles a query or region if any."
(interactive)
(browse-url
(concat
"http://www.google.com/search?ie=utf-8&oe=utf-8&q="
(url-hexify-string (if mark-active
(buffer-substring (region-beginning) (region-end))
(read-string "Google: "))))))
(defun prelude-indent-rigidly-and-copy-to-clipboard (begin end indent)
"Copy the selected code region to the clipboard, indented according
to Markdown blockquote rules."
(let ((buffer (current-buffer)))
(with-temp-buffer
(insert-buffer-substring-no-properties buffer begin end)
(indent-rigidly (point-min) (point-max) indent)
(clipboard-kill-ring-save (point-min) (point-max)))))
(defun prelude-indent-blockquote-and-copy-to-clipboard (begin end)
"Copy the selected code region to the clipboard, indented according
to markdown blockquote rules (useful to copy snippets to StackOverflow, Assembla, Github."
(interactive "r")
(prelude-indent-rigidly-and-copy-to-clipboard begin end 4))
(defun prelude-indent-nested-blockquote-and-copy-to-clipboard (begin end)
"Copy the selected code region to the clipboard, indented according
to markdown blockquote rules. Useful to add snippets under bullet points."
(interactive "r")
(prelude-indent-rigidly-and-copy-to-clipboard begin end 6))
(defun prelude-insert-empty-line ()
"Insert an empty line after the current line and positon
the curson at its beginning, according to the current mode."
(interactive)
(move-end-of-line nil)
(open-line 1)
(next-line 1)
(indent-according-to-mode))
(defun prelude-move-line-up ()
"Move up the current line."
(interactive)
(transpose-lines 1)
(previous-line 2))
(defun prelude-move-line-down ()
"Move down the current line."
(interactive)
(next-line 1)
(transpose-lines 1)
(previous-line 1))
;; add the ability to copy and cut the current line, without marking it
(defadvice kill-ring-save (before slick-copy activate compile)
"When called interactively with no active region, copy a single line instead."
(interactive
(if mark-active (list (region-beginning) (region-end))
(message "Copied line")
(list (line-beginning-position)
(line-beginning-position 2)))))
(defadvice kill-region (before slick-cut activate compile)
"When called interactively with no active region, kill a single line instead."
(interactive
(if mark-active (list (region-beginning) (region-end))
(list (line-beginning-position)
(line-beginning-position 2)))))
(defun prelude-indent-buffer ()
"Indents the entire buffer."
(interactive)
(indent-region (point-min) (point-max)))
(defun prelude-indent-region-or-buffer ()
"Indents a region if selected, otherwise the whole buffer."
(interactive)
(save-excursion
(if (region-active-p)
(progn
(indent-region (region-beginning) (region-end))
(message "Indented selected region."))
(progn
(prelude-indent-buffer)
(message "Indented buffer.")))))
(defun prelude-annotate-todo ()
"Put fringe marker on TODO: lines in the curent buffer."
(interactive)
(save-excursion
(goto-char (point-min))
(while (re-search-forward "TODO:" nil t)
(let ((overlay (make-overlay (- (point) 5) (point))))
(overlay-put overlay
'before-string
(propertize (format "A")
'display '(left-fringe right-triangle)))))))
(defun prelude-copy-file-name-to-clipboard ()
"Copy the current buffer file name to the clipboard."
(interactive)
(let ((filename (if (equal major-mode 'dired-mode)
default-directory
(buffer-file-name))))
(when filename
(kill-new filename)
(message "Copied buffer file name '%s' to the clipboard." filename))))
(defun prelude-duplicate-current-line-or-region (arg)
"Duplicates the current line or region ARG times.
If there's no region, the current line will be duplicated. However, if
there's a region, all lines that region covers will be duplicated."
(interactive "p")
(let (beg end (origin (point)))
(if (and mark-active (> (point) (mark)))
(exchange-point-and-mark))
(setq beg (line-beginning-position))
(if mark-active
(exchange-point-and-mark))
(setq end (line-end-position))
(let ((region (buffer-substring-no-properties beg end)))
(dotimes (i arg)
(goto-char end)
(newline)
(insert region)
(setq end (point)))
(goto-char (+ origin (* (length region) arg) arg)))))
;; TODO doesn't work with uniquify
(defun prelude-rename-file-and-buffer ()
"Renames current buffer and file it is visiting."
(interactive)
(let ((name (buffer-name))
(filename (buffer-file-name)))
(if (not (and filename (file-exists-p filename)))
(message "Buffer '%s' is not visiting a file!" name)
(let ((new-name (read-file-name "New name: " filename)))
(cond ((get-buffer new-name)
(message "A buffer named '%s' already exists!" new-name))
(t
(rename-file name new-name 1)
(rename-buffer new-name)
(set-visited-file-name new-name)
(set-buffer-modified-p nil)))))))
(defun prelude-delete-file-and-buffer ()
"Kills the current buffer and deletes the file it is visiting"
(interactive)
(let ((filename (buffer-file-name)))
(when filename
(delete-file filename)
(message "Deleted file %s" filename)))
(kill-buffer))
(defun prelude-view-url ()
"Open a new buffer containing the contents of URL."
(interactive)
(let* ((default (thing-at-point-url-at-point))
(url (read-from-minibuffer "URL: " default)))
(switch-to-buffer (url-retrieve-synchronously url))
(rename-buffer url t)
;; TODO: switch to nxml/nxhtml mode
(cond ((search-forward "<?xml" nil t) (xml-mode))
((search-forward "<html" nil t) (html-mode)))))
;; We have a number of turn-on-* functions since it's advised that lambda
;; functions not go in hooks. Repeatedly evaluating an add-to-list with a
;; hook value will repeatedly add it since there's no way to ensure
;; that a lambda doesn't already exist in the list.
(defun prelude-turn-on-whitespace ()
(whitespace-mode +1))
(defun prelude-turn-off-whitespace ()
(whitespace-mode -1))
(defun prelude-turn-on-abbrev ()
(abbrev-mode +1))
(defun prelude-turn-off-abbrev ()
(abbrev-mode -1))
(defun prelude-untabify-buffer ()
(interactive)
(untabify (point-min) (point-max)))
(defun prelude-cleanup-buffer ()
"Perform a bunch of operations on the whitespace content of a buffer."
(interactive)
(prelude-indent-buffer)
(prelude-untabify-buffer)
(whitespace-cleanup))
(defun prelude-eval-and-replace ()
"Replace the preceding sexp with its value."
(interactive)
(backward-kill-sexp)
(condition-case nil
(prin1 (eval (read (current-kill 0)))
(current-buffer))
(error (message "Invalid expression")
(insert (current-kill 0)))))
(defun prelude-recompile-init ()
"Byte-compile all your dotfiles again."
(interactive)
(byte-recompile-directory prelude-dir 0)
(byte-recompile-directory prelude-vendor-dir 0))
(defun prelude-regen-autoloads (&optional force-regen)
"Regenerate the autoload definitions file if necessary and load it."
(interactive "P")
(let ((autoload-dir prelude-vendor-dir)
(generated-autoload-file autoload-file))
(when (or force-regen
(not (file-exists-p autoload-file))
(some (lambda (f) (file-newer-than-file-p f autoload-file))
(directory-files autoload-dir t "\\.el$")))
(message "Updating autoloads...")
(let (emacs-lisp-mode-hook)
(update-directory-autoloads autoload-dir))))
(load autoload-file))
(defun prelude-sudo-edit (&optional arg)
(interactive "p")
(if (or arg (not buffer-file-name))
(find-file (concat "/sudo:root@localhost:" (ido-read-file-name "File: ")))
(find-alternate-file (concat "/sudo:root@localhost:" buffer-file-name))))
(defun prelude-switch-or-start (function buffer)
"If the buffer is current, bury it, otherwise invoke the function."
(if (equal (buffer-name (current-buffer)) buffer)
(bury-buffer)
(if (get-buffer buffer)
(switch-to-buffer buffer)
(funcall function))))
(defun prelude-insert-date ()
"Insert a time-stamp according to locale's date and time format."
(interactive)
(insert (format-time-string "%c" (current-time))))
(defun prelude-conditionally-enable-paredit-mode ()
"Enable paredit-mode in the minibuffer, during eval-expression."
(if (eq this-command 'eval-expression)
(paredit-mode 1)))
(add-hook 'minibuffer-setup-hook 'prelude-conditionally-enable-paredit-mode)
(defun prelude-recentf-ido-find-file ()
"Find a recent file using ido."
(interactive)
(let ((file (ido-completing-read "Choose recent file: " recentf-list nil t)))
(when file
(find-file file))))
(defun prelude-swap-windows ()
"If you have 2 windows, it swaps them."
(interactive)
(if (/= (count-windows) 2)
(message "You need exactly 2 windows to do this.")
(let* ((w1 (first (window-list)))
(w2 (second (window-list)))
(b1 (window-buffer w1))
(b2 (window-buffer w2))
(s1 (window-start w1))
(s2 (window-start w2)))
(set-window-buffer w1 b2)
(set-window-buffer w2 b1)
(set-window-start w1 s2)
(set-window-start w2 s1)))
(other-window 1))
(defun prelude-kill-other-buffers ()
"Kill all buffers but the current one. Doesn't mess with special buffers."
(interactive)
(dolist (buffer (buffer-list))
(unless (or (eql buffer (current-buffer)) (not (buffer-file-name buffer)))
(kill-buffer buffer))))
(defun prelude-restore-arrow-keys ()
"Restores arrow keys navigation in buffers."
(interactive)
(global-set-key [up] 'previous-line)
(global-set-key [down] 'next-line)
(global-set-key [left] 'backward-char)
(global-set-key [right] 'forward-char)
(global-set-key [M-right] 'right-word)
(global-set-key [M-left] 'left-word)
(message "Arrow keys navigation in buffers in now allowed."))
(require 'repeat)
(defun make-repeatable-command (cmd)
"Returns a new command that is a repeatable version of CMD.
The new command is named CMD-repeat. CMD should be a quoted
command.
This allows you to bind the command to a compound keystroke and
repeat it with just the final key. For example:
(global-set-key (kbd \"C-c a\") (make-repeatable-command 'foo))
will create a new command called foo-repeat. Typing C-c a will
just invoke foo. Typing C-c a a a will invoke foo three times,
and so on."
(fset (intern (concat (symbol-name cmd) "-repeat"))
`(lambda ,(help-function-arglist cmd) ;; arg list
,(format "A repeatable version of `%s'." (symbol-name cmd)) ;; doc string
,(interactive-form cmd) ;; interactive form
;; see also repeat-message-function
(setq last-repeatable-command ',cmd)
(repeat nil)))
(intern (concat (symbol-name cmd) "-repeat")))
(provide 'prelude-core)
;;; prelude-core.el ends here

View file

@ -1,11 +0,0 @@
(eval-after-load 'css-mode
'(progn
(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)

View file

@ -1,4 +0,0 @@
(autoload 'feature-mode "feature-mode" "Feature mode." t)
(add-to-list 'auto-mode-alist '("\\.feature$" . feature-mode))
(provide 'prelude-cucumber)

View file

@ -1,288 +0,0 @@
;;; prelude-editor.el --- Emacs Prelude: enhanced core editing experience.
;;
;; Copyright (c) 2011 Bozhidar Batsov
;;
;; Author: Bozhidar Batsov <bozhidar.batsov@gmail.com>
;; URL: http://www.emacswiki.org/cgi-bin/wiki/Prelude
;; Version: 1.0.0
;; Keywords: convenience
;; This file is not part of GNU Emacs.
;;; Commentary:
;; Refinements of the core editing experience in Emacs.
;;; License:
;; This program is free software; you can redistribute it and/or
;; modify it under the terms of the GNU General Public License
;; as published by the Free Software Foundation; either version 3
;; of the License, or (at your option) any later version.
;;
;; This program is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;; GNU General Public License for more details.
;;
;; You should have received a copy of the GNU General Public License
;; along with GNU Emacs; see the file COPYING. If not, write to the
;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
;; Boston, MA 02110-1301, USA.
;;; Code:
;; customize
(defgroup editor nil
"Emacs Prelude Editor enhancements"
:group 'prelude)
;; Emacs users obviously have little need for Command and Option keys,
;; but they do need Meta and Super
(when (eq system-type 'darwin)
(setq mac-command-modifier 'super)
(setq mac-option-modifier 'meta))
;; Death to the tabs! However, tabs historically indent to the next
;; 8-character offset; specifying anything else will cause *mass*
;; confusion, as it will change the appearance of every existing file.
;; In some cases (python), even worse -- it will change the semantics
;; (meaning) of the program.
;;
;; Emacs modes typically provide a standard means to change the
;; indentation width -- eg. c-basic-offset: use that to adjust your
;; personal indentation width, while maintaining the style (and
;; meaning) of any files you load.
(setq-default indent-tabs-mode nil) ;; don't use tabs to indent
(setq-default tab-width 8) ;; but maintain correct appearance
;; delete the selection with a keypress
(delete-selection-mode t)
;; store all backup and autosave files in the tmp dir
(setq backup-directory-alist
`((".*" . ,temporary-file-directory)))
(setq auto-save-file-name-transforms
`((".*" ,temporary-file-directory t)))
;; revert buffers automatically when underlying files are changed externally
(global-auto-revert-mode t)
;; hippie expand is dabbrev expand on steroids
(setq hippie-expand-try-functions-list '(try-expand-dabbrev
try-expand-dabbrev-all-buffers
try-expand-dabbrev-from-kill
try-complete-file-name-partially
try-complete-file-name
try-expand-all-abbrevs
try-expand-list
try-expand-line
try-complete-lisp-symbol-partially
try-complete-lisp-symbol))
;; smart indenting and pairing for all
(electric-pair-mode t)
(electric-indent-mode t)
(electric-layout-mode t)
;; meaningful names for buffers with the same name
(require 'uniquify)
(setq uniquify-buffer-name-style 'forward)
(setq uniquify-separator "/")
(setq uniquify-after-kill-buffer-p t) ; rename after killing uniquified
(setq uniquify-ignore-buffers-re "^\\*") ; don't muck with special buffers
;; saveplace remembers your location in a file when saving files
(setq save-place-file (concat user-emacs-directory "saveplace"))
;; activate it for all buffers
(setq-default save-place t)
(require 'saveplace)
;; savehist keeps track of some history
(setq savehist-additional-variables
;; search entries
'(search ring regexp-search-ring)
;; save every minute
savehist-autosave-interval 60
;; keep the home clean
savehist-file (concat user-emacs-directory "savehist"))
(savehist-mode t)
;; save recent files
(setq recentf-save-file (concat user-emacs-directory "recentf")
recentf-max-saved-items 200
recentf-max-menu-items 15)
(recentf-mode t)
;; time-stamps
;; when there's "Time-stamp: <>" in the first 10 lines of the file
(setq time-stamp-active t
;; check first 10 buffer lines for Time-stamp: <>
time-stamp-line-limit 10
time-stamp-format "%04y-%02m-%02d %02H:%02M:%02S (%u)") ; date format
(add-hook 'write-file-hooks 'time-stamp) ; update when saving
;; use shift + arrow keys to switch between visible buffers
(require 'windmove)
(windmove-default-keybindings 'super)
;; automatically save buffers associated with files on buffer switch
;; and on windows switch
(defadvice switch-to-buffer (before save-buffer-now activate)
(when buffer-file-name (save-buffer)))
(defadvice other-window (before other-window-now activate)
(when buffer-file-name (save-buffer)))
(defadvice windmove-up (before other-window-now activate)
(when buffer-file-name (save-buffer)))
(defadvice windmove-down (before other-window-now activate)
(when buffer-file-name (save-buffer)))
(defadvice windmove-left (before other-window-now activate)
(when buffer-file-name (save-buffer)))
(defadvice windmove-right (before other-window-now activate)
(when buffer-file-name (save-buffer)))
;; show-paren-mode: subtle highlighting of matching parens
(show-paren-mode t)
(setq show-paren-style 'parenthesis)
;; highlight the current line
(global-hl-line-mode +1)
(require 'volatile-highlights)
(volatile-highlights-mode t)
;; tramp, for sudo access
(require 'tramp)
;; keep in mind known issues with zsh - see emacs wiki
(setq tramp-default-method "ssh")
;; ido-mode
(ido-mode t)
(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-default-file-method 'selected-window)
;; auto-completion in minibuffer
(icomplete-mode +1)
(set-default 'imenu-auto-rescan t)
;; flyspell-mode does spell-checking on the fly as you type
(setq ispell-program-name "aspell" ; use aspell instead of ispell
ispell-extra-args '("--sug-mode=ultra"))
(autoload 'flyspell-mode "flyspell" "On-the-fly spelling checker." t)
(defun prelude-turn-on-flyspell ()
"Force flyspell-mode on using a positive argument. For use in hooks."
(interactive)
(flyspell-mode +1))
(add-hook 'message-mode-hook 'prelude-turn-on-flyspell)
(add-hook 'text-mode-hook 'prelude-turn-on-flyspell)
;; enable narrowing commands
(put 'narrow-to-region 'disabled nil)
(put 'narrow-to-page 'disabled nil)
(put 'narrow-to-defun 'disabled nil)
;; enabled change region case commands
(put 'upcase-region 'disabled nil)
(put 'downcase-region 'disabled nil)
(require 'expand-region)
;; bookmarks
(setq bookmark-default-file (concat user-emacs-directory "bookmarks")
bookmark-save-flag 1)
;; enabled auto-fill mode in text-mode and all related modes
(add-hook 'text-mode-hook 'turn-on-auto-fill)
;; load yasnippet
(require 'yasnippet)
(add-to-list 'yas/snippet-dirs prelude-snippets-dir)
(add-to-list 'yas/snippet-dirs prelude-personal-snippets-dir)
(yas/global-mode 1)
;; projectile is a project management mode
(require 'projectile)
(projectile-global-mode t)
(require 'helm-misc)
(require 'helm-projectile)
(defun helm-prelude ()
"Preconfigured `helm'."
(interactive)
(if (projectile-get-project-root)
;; add project files and buffers when in project
(helm-other-buffer '(helm-c-source-projectile-files-list
helm-c-source-projectile-buffers-list
helm-c-source-buffers-list
helm-c-source-recentf
helm-c-source-buffer-not-found)
"*helm prelude*")
;; otherwise fallback to helm-mini
(helm-mini)))
;; dired - reuse current buffer by pressing 'a'
(put 'dired-find-alternate-file 'disabled nil)
;; ediff - don't start another frame
(setq ediff-window-setup-function 'ediff-setup-windows-plain)
;; clean up obsolete buffers automatically
(require 'midnight)
;; automatically indenting yanked text if in programming-modes
(defvar yank-indent-modes '(python-mode LaTeX-mode TeX-mode)
"Modes in which to indent regions that are yanked (or yank-popped). Only
modes that don't derive from `prog-mode' should be listed here.")
(defvar yank-advised-indent-threshold 1000
"Threshold (# chars) over which indentation does not automatically occur.")
(defun yank-advised-indent-function (beg end)
"Do indentation, as long as the region isn't too large."
(if (<= (- end beg) yank-advised-indent-threshold)
(indent-region beg end nil)))
(defadvice yank (after yank-indent activate)
"If current mode is one of 'yank-indent-modes,
indent yanked text (with prefix arg don't indent)."
(if (and (not (ad-get-arg 0))
(or (derived-mode-p 'prog-mode)
(member major-mode yank-indent-modes)))
(let ((transient-mark-mode nil))
(yank-advised-indent-function (region-beginning) (region-end)))))
(defadvice yank-pop (after yank-pop-indent activate)
"If current mode is one of 'yank-indent-modes,
indent yanked text (with prefix arg don't indent)."
(if (and (not (ad-get-arg 0))
(or (derived-mode-p 'prog-mode)
(member major-mode yank-indent-modes)))
(let ((transient-mark-mode nil))
(yank-advised-indent-function (region-beginning) (region-end)))))
;; abbrev config
(add-hook 'text-mode-hook 'prelude-turn-on-abbrev)
;; make a shell script executable automatically on save
(add-hook 'after-save-hook
'executable-make-buffer-file-executable-if-script-p)
;; saner regex syntax
(require 're-builder)
(setq reb-re-syntax 'string)
;; enable Prelude's keybindings
(prelude-global-mode t)
(provide 'prelude-editor)
;;; prelude-editor.el ends here

View file

@ -1,68 +0,0 @@
;;; prelude-emacs-lisp.el --- Emacs Prelude: Nice config for Elisp programming.
;;
;; Copyright (c) 2011 Bozhidar Batsov
;;
;; Author: Bozhidar Batsov <bozhidar.batsov@gmail.com>
;; URL: http://www.emacswiki.org/cgi-bin/wiki/Prelude
;; Version: 1.0.0
;; Keywords: convenience
;; 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

View file

@ -1,162 +0,0 @@
;;; prelude-erc.el --- Emacs Prelude: ERC mode configuration.
;;
;; Copyright (c) 2011 Bozhidar Batsov
;;
;; Author: Bozhidar Batsov <bozhidar.batsov@gmail.com>
;; URL: http://www.emacswiki.org/cgi-bin/wiki/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

View file

@ -1,71 +0,0 @@
;;; prelude-erlang.el --- Emacs Prelude: Erlang programming support.
;;
;; Copyright (c) 2011 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:
(defcustom wrangler-path nil
"*The location of wrangler elisp directory"
:group 'prelude-erlang
:type 'string
:safe 'stringp)
(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)))
(defun erlang-rebar-compile ()
(interactive)
(let* ((dir (or (projectile-get-project-root)
(file-name-directory (buffer-file-name))))
(pref (concat "cd " dir " && "))
(cmd (cond ((file-exists-p (expand-file-name "rebar" dir)) "./rebar compile")
((executable-find "rebar") "rebar compile")
((file-exists-p (expand-file-name "Makefile" dir)) "Makefile")
(t nil))))
(if cmd
(compilation-start (concat pref cmd))
(call-interactively 'inferior-erlang-compile))
))
(add-hook 'erlang-mode-hook (lambda ()
(make-variable-buffer-local 'projectile-project-root-files)
(setq projectile-project-root-files '("rebar.config" ".git" ".hg" ".bzr" ".projectile"))
(setq erlang-compile-function 'erlang-rebar-compile)))
(provide 'prelude-erlang)
;;; prelude-erlang.el ends here

View file

@ -1,105 +0,0 @@
;;; prelude-global-keybindings.el --- Emacs Prelude: some useful keybindings.
;;
;; Copyright (c) 2011 Bozhidar Batsov
;;
;; Author: Bozhidar Batsov <bozhidar.batsov@gmail.com>
;; URL: http://www.emacswiki.org/cgi-bin/wiki/Prelude
;; Version: 1.0.0
;; Keywords: convenience
;; This file is not part of GNU Emacs.
;;; Commentary:
;; Lots of useful keybindings.
;;; License:
;; This program is free software; you can redistribute it and/or
;; modify it under the terms of the GNU General Public License
;; as published by the Free Software Foundation; either version 3
;; of the License, or (at your option) any later version.
;;
;; This program is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;; GNU General Public License for more details.
;;
;; You should have received a copy of the GNU General Public License
;; along with GNU Emacs; see the file COPYING. If not, write to the
;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
;; Boston, MA 02110-1301, USA.
;;; Code:
;; You know, like Readline.
(global-set-key (kbd "C-M-h") 'backward-kill-word)
;; Align your code in a pretty way.
(global-set-key (kbd "C-x \\") 'align-regexp)
;; Font size
(define-key global-map (kbd "C-+") 'text-scale-increase)
(define-key global-map (kbd "C--") 'text-scale-decrease)
;; Window switching. (C-x o goes to the next window)
(global-set-key (kbd "C-x O") (lambda ()
(interactive)
(other-window -1))) ;; back one
;; Indentation help
(global-set-key (kbd "C-x ^") 'join-line)
;; Start proced in a similar manner to dired
(global-set-key (kbd "C-x p") 'proced)
;; Start eshell or switch to it if it's active.
(global-set-key (kbd "C-x m") 'eshell)
;; Start a new eshell even if one is active.
(global-set-key (kbd "C-x M") (lambda () (interactive) (eshell t)))
;; Start a regular shell if you prefer that.
(global-set-key (kbd "C-x M-m") 'shell)
;; If you want to be able to M-x without meta
(global-set-key (kbd "C-x C-m") 'execute-extended-command)
;; A complementary binding to the apropos-command(C-h a)
(global-set-key (kbd "C-h A") 'apropos)
;; Activate occur easily inside isearch
(define-key isearch-mode-map (kbd "C-o")
(lambda () (interactive)
(let ((case-fold-search isearch-case-fold-search))
(occur (if isearch-regexp
isearch-string
(regexp-quote isearch-string))))))
;; use hippie-expand instead of dabbrev
(global-set-key (kbd "M-/") 'hippie-expand)
;; replace buffer-menu with ibuffer
(global-set-key (kbd "C-x C-b") 'ibuffer)
;; toggle menu-bar visibility
(global-set-key (kbd "<f12>") 'menu-bar-mode)
;; real Emacs hackers don't use the arrow keys
(global-unset-key [up])
(global-unset-key [down])
(global-unset-key [left])
(global-unset-key [right])
;; use M-f and M-b instead
(global-unset-key [M-left])
(global-unset-key [M-right])
(global-set-key (kbd "C-x g") 'magit-status)
(global-set-key (kbd "C-=") 'er/expand-region)
(global-set-key (kbd "C-c w") (make-repeatable-command 'er/expand-region))
(provide 'prelude-global-keybindings)
;;; prelude-global-keybindings.el ends here

View file

@ -1,6 +0,0 @@
;;; use groovy-mode when file ends in .groovy or has #!/bin/groovy at start
(autoload 'groovy-mode "groovy-mode" "Major mode for editing Groovy code." t)
(add-to-list 'auto-mode-alist '("\.groovy$" . groovy-mode))
(add-to-list 'interpreter-mode-alist '("groovy" . groovy-mode))
(provide 'prelude-groovy)

View file

@ -1,3 +0,0 @@
(add-to-list 'auto-mode-alist '("\\.haml$" . haml-mode))
(provide 'prelude-haml)

View file

@ -1,51 +0,0 @@
;;; prelude-haskell.el --- Emacs Prelude: Nice config for Haskell programming.
;;
;; Copyright (c) 2011 Bozhidar Batsov
;;
;; Author: Bozhidar Batsov <bozhidar.batsov@gmail.com>
;; URL: http://www.emacswiki.org/cgi-bin/wiki/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:
(eval-after-load 'haskell-mode
'(progn
(defun prelude-haskell-mode-defaults ()
;; run manually since haskell-mode is not derived from prog-mode
(run-hooks 'prelude-prog-mode-hook)
(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

View file

@ -1,47 +0,0 @@
;;; prelude-js.el --- Emacs Prelude: js-mode configuration.
;;
;; Copyright (c) 2011 Bozhidar Batsov
;;
;; Author: Bozhidar Batsov <bozhidar.batsov@gmail.com>
;; URL: http://www.emacswiki.org/cgi-bin/wiki/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:
(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

View file

@ -1,65 +0,0 @@
;;; prelude-latex.el --- Emacs Prelude: Sane setup for LaTeX writers.
;;
;; Copyright (c) 2011 Bozhidar Batsov
;;
;; Author: Bozhidar Batsov <bozhidar.batsov@gmail.com>
;; URL: http://www.emacswiki.org/cgi-bin/wiki/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:
;; 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

View file

@ -1,53 +0,0 @@
;;; prelude-lisp.el --- Emacs Prelude: Configuration common to all lisp modes.
;;
;; Copyright (c) 2011 Bozhidar Batsov
;;
;; Author: Bozhidar Batsov <bozhidar.batsov@gmail.com>
;; URL: http://www.emacswiki.org/cgi-bin/wiki/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:
;; 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))
(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)
(prelude-turn-off-whitespace))
(setq prelude-interactive-lisp-coding-hook 'prelude-interactive-lisp-coding-defaults)
(provide 'prelude-lisp)
;;; prelude-lisp.el ends here

View file

@ -1,40 +0,0 @@
;;; prelude-markdown.el --- Emacs Prelude: markdown-mode configuration.
;;
;; Copyright (c) 2011 Bozhidar Batsov
;;
;; Author: Bozhidar Batsov <bozhidar.batsov@gmail.com>
;; URL: http://www.emacswiki.org/cgi-bin/wiki/Prelude
;; Version: 1.0.0
;; Keywords: convenience
;; This file is not part of GNU Emacs.
;;; Commentary:
;; A simple configuration for markdown-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 '("\\.md$" . markdown-mode))
(add-to-list 'auto-mode-alist '("\\.markdown$" . markdown-mode))
(provide 'prelude-markdown)
;;; prelude-markdown.el ends here

View file

@ -1,45 +0,0 @@
;;; prelude-mediawiki.el --- Emacs Prelude: mediawiki editing config
;;
;; Copyright (c) 2011 Bozhidar Batsov
;;
;; Author: Bozhidar Batsov <bozhidar.batsov@gmail.com>
;; URL: http://www.emacswiki.org/cgi-bin/wiki/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:
(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

@ -1,116 +0,0 @@
;;; prelude-mode.el --- Emacs Prelude: minor mode
;;
;; Copyright (c) 2011 Bozhidar Batsov
;;
;; Author: Bozhidar Batsov <bozhidar.batsov@gmail.com>
;; URL: http://www.emacswiki.org/cgi-bin/wiki/Prelude
;; Version: 1.0.0
;; Keywords: convenience
;; This file is not part of GNU Emacs.
;;; Commentary:
;; A minor mode defining a local keymap, plus a menu.
;;; License:
;; This program is free software; you can redistribute it and/or
;; modify it under the terms of the GNU General Public License
;; as published by the Free Software Foundation; either version 3
;; of the License, or (at your option) any later version.
;;
;; This program is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;; GNU General Public License for more details.
;;
;; You should have received a copy of the GNU General Public License
;; along with GNU Emacs; see the file COPYING. If not, write to the
;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
;; Boston, MA 02110-1301, USA.
;;; Code:
(defvar prelude-mode-map
(let ((map (make-sparse-keymap)))
(define-key map (kbd "C-c o") 'prelude-open-with)
(define-key map (kbd "C-c g") 'prelude-google)
;; mimic popular IDEs binding, note that it doesn't work in a terminal session
(define-key map [(shift return)] 'prelude-insert-empty-line)
(define-key map [(control shift up)] 'prelude-move-line-up)
(define-key map [(control shift down)] 'prelude-move-line-down)
(define-key map (kbd "C-c n") 'prelude-cleanup-buffer)
(define-key map (kbd "C-c f") 'prelude-recentf-ido-find-file)
(define-key map (kbd "C-c i") 'prelude-ido-goto-symbol)
(define-key map (kbd "C-M-\\") 'prelude-indent-region-or-buffer)
(define-key map (kbd "C-c u") 'prelude-view-url)
(define-key map (kbd "C-c e") 'prelude-eval-and-replace)
(define-key map (kbd "C-c s") 'prelude-swap-windows)
(define-key map (kbd "C-c d") 'prelude-duplicate-current-line-or-region)
(define-key map (kbd "C-c r") 'prelude-rename-file-and-buffer)
(define-key map (kbd "C-c t") 'prelude-visit-term-buffer)
(define-key map (kbd "C-c k") 'prelude-kill-other-buffers)
(define-key map (kbd "C-c h") 'helm-prelude)
map)
"Keymap for Prelude mode.")
(easy-menu-define prelude-mode-menu prelude-mode-map
"Menu for Prelude mode"
'("Prelude"
("Files"
["Open with..." prelude-open-with]
["Delete file and buffer" prelude-delete-file-and-buffer]
["Rename file and buffer" prelude-rename-file-and-buffer]
["Copy file name to clipboard" prelude-copy-file-name-to-clipboard])
("Buffers"
["Clean up buffer" prelude-cleanup-buffer]
["Kill other buffers" prelude-kill-other-buffers])
("Editing"
["Insert empty line" prelude-insert-empty-line]
["Move line up" prelude-move-line-up]
["Move line down" prelude-move-line-down]
["Indent buffer" prelude-indent-buffer]
["Indent buffer or region" prelude-indent-buffer-or-region]
["Duplicate line or region" prelude-duplicate-current-line-or-region]
["Copy to clipboard as blockquote" prelude-indent-blockquote-and-copy-to-clipboard]
["Copy to clipboard as nested blockqoute" prelude-indent-nested-blockquote-and-copy-to-clipboard]
["Insert date" prelude-insert-date]
["Eval and replace" prelude-eval-and-replace])
("Navigation"
["Enable arrow keys" prelude-restore-arrow-keys]
["Go to symbol" prelude-ido-goto-symbol]
["Helm" helm-prelude])
("Windows"
["Swap windows" prelude-swap-windows])
("General"
["Visit term buffer" prelude-visit-term-buffer]
["Search in Google" prelude-google]
["View URL" prelude-view-url])))
;; define minor mode
(define-globalized-minor-mode prelude-global-mode prelude-mode prelude-on)
(defun prelude-on ()
(prelude-mode t))
(defun prelude-off ()
(easy-menu-remove))
(define-minor-mode prelude-mode
"Minor mode to consolidate Emacs Prelude extensions."
:lighter "Prelude"
:keymap prelude-mode-map
(if prelude-mode
;; on start
(easy-menu-add prelude-mode-menu prelude-mode-map)
;; on stop
(prelude-off)))
(provide 'prelude-mode)
;;; prelude-mode.el ends here

View file

@ -1,50 +0,0 @@
;;; prelude-org.el --- Emacs Prelude: org-mode configuration.
;;
;; Copyright (c) 2011 Bozhidar Batsov
;;
;; Author: Bozhidar Batsov <bozhidar.batsov@gmail.com>
;; URL: http://www.emacswiki.org/cgi-bin/wiki/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

View file

@ -1,68 +0,0 @@
;;; prelude-packages.el --- Emacs Prelude: default package selection.
;;
;; Copyright (c) 2011 Bozhidar Batsov
;;
;; Author: Bozhidar Batsov <bozhidar.batsov@gmail.com>
;; URL: http://www.emacswiki.org/cgi-bin/wiki/Prelude
;; Version: 1.0.0
;; Keywords: convenience
;; This file is not part of GNU Emacs.
;;; Commentary:
;; Takes care of the automatic installation of all the packages required by
;; Emacs Prelude.
;;; License:
;; This program is free software; you can redistribute it and/or
;; modify it under the terms of the GNU General Public License
;; as published by the Free Software Foundation; either version 3
;; of the License, or (at your option) any later version.
;;
;; This program is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;; GNU General Public License for more details.
;;
;; You should have received a copy of the GNU General Public License
;; along with GNU Emacs; see the file COPYING. If not, write to the
;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
;; Boston, MA 02110-1301, USA.
;;; Code:
(require 'package)
(require 'melpa)
(add-to-list 'package-archives
'("melpa" . "http://melpa.milkbox.net/packages/") t)
(package-initialize)
(setq url-http-attempt-keepalives nil)
(defvar prelude-packages
'(ack-and-a-half auctex clojure-mode coffee-mode deft expand-region
gist groovy-mode haml-mode haskell-mode helm helm-projectile inf-ruby
magit magithub markdown-mode mediawiki paredit projectile
python sass-mode rainbow-mode scss-mode solarized-theme
volatile-highlights yaml-mode yari yasnippet zenburn-theme)
"A list of packages to ensure are installed at launch.")
(defun prelude-packages-installed-p ()
(loop for p in prelude-packages
when (not (package-installed-p p)) do (return nil)
finally (return t)))
(unless (prelude-packages-installed-p)
;; check for new packages (package versions)
(message "%s" "Emacs Prelude is now refreshing its package database...")
(package-refresh-contents)
(message "%s" " done.")
;; install the missing packages
(dolist (p prelude-packages)
(when (not (package-installed-p p))
(package-install p))))
(provide 'prelude-packages)
;;; prelude-packages.el ends here

View file

@ -1,65 +0,0 @@
;;; prelude-perl.el --- Emacs Prelude: decent Perl coding settings.
;;
;; Copyright (c) 2011 Bozhidar Batsov
;;
;; Author: Bozhidar Batsov <bozhidar.batsov@gmail.com>
;; URL: http://www.emacswiki.org/cgi-bin/wiki/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)
(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

@ -1,123 +0,0 @@
;;; prelude-programming.el --- Emacs Prelude: prog-mode configuration
;;
;; Copyright (c) 2011 Bozhidar Batsov
;;
;; Author: Bozhidar Batsov <bozhidar.batsov@gmail.com>
;; URL: http://www.emacswiki.org/cgi-bin/wiki/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:
(require 'imenu)
(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))))))))
(defun prelude-local-comment-auto-fill ()
(set (make-local-variable 'comment-auto-fill-only-comments) t)
(auto-fill-mode 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-func-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."
(flyspell-prog-mode)
(prelude-local-comment-auto-fill)
(prelude-turn-on-whitespace)
(prelude-turn-on-abbrev)
(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

View file

@ -1,48 +0,0 @@
;;; prelude-python.el --- Emacs Prelude: python.el configuration.
;;
;; Copyright (c) 2011 Bozhidar Batsov
;;
;; Author: Bozhidar Batsov <bozhidar.batsov@gmail.com>
;; URL: http://www.emacswiki.org/cgi-bin/wiki/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:
(require '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

View file

@ -1,69 +0,0 @@
;;; prelude-ruby.el --- Emacs Prelude: A nice setup for Ruby (and Rails) devs.
;;
;; Copyright (c) 2011 Bozhidar Batsov
;;
;; Author: Bozhidar Batsov <bozhidar.batsov@gmail.com>
;; URL: http://www.emacswiki.org/cgi-bin/wiki/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:
;; 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))
;; We never want to edit Rubinius bytecode
(add-to-list 'completion-ignored-extensions ".rbc")
(autoload 'run-ruby "inf-ruby"
"Run an inferior Ruby process")
(autoload 'inf-ruby-keys "inf-ruby"
"Set local key defs for inf-ruby in ruby-mode")
(autoload 'ruby-block-mode "ruby-block")
(require 'ruby-end)
(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)
;; bind yari in the local keymap
(local-set-key (kbd "C-h r") 'yari))
(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

@ -1,39 +0,0 @@
;;; prelude-scheme.el --- Emacs Prelude: Some defaults for Scheme.
;;
;; Copyright (c) 2011 Bozhidar Batsov
;;
;; Author: Bozhidar Batsov <bozhidar.batsov@gmail.com>
;; URL: http://www.emacswiki.org/cgi-bin/wiki/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:
(add-hook 'scheme-mode-hook (lambda () (run-hooks 'prelude-lisp-coding-hook)))
(provide 'prelude-scheme)
;;; prelude-scheme.el ends here

View file

@ -1,12 +0,0 @@
(require 'prelude-css)
(defun prelude-scss-mode-defaults ()
(prelude-css-mode-hook)
;; 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)

View file

@ -1,95 +0,0 @@
;;; prelude-ui.el --- Emacs Prelude: UI optimizations and tweaks.
;;
;; Copyright (c) 2011 Bozhidar Batsov
;;
;; Author: Bozhidar Batsov <bozhidar.batsov@gmail.com>
;; URL: http://www.emacswiki.org/cgi-bin/wiki/Prelude
;; Version: 1.0.0
;; Keywords: convenience
;; This file is not part of GNU Emacs.
;;; Commentary:
;; We dispense with most of the point and click UI, reduce the startup noise,
;; configure smooth scolling and a nice theme that's easy on the eyes (zenburn).
;;; License:
;; This program is free software; you can redistribute it and/or
;; modify it under the terms of the GNU General Public License
;; as published by the Free Software Foundation; either version 3
;; of the License, or (at your option) any later version.
;;
;; This program is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;; GNU General Public License for more details.
;;
;; You should have received a copy of the GNU General Public License
;; along with GNU Emacs; see the file COPYING. If not, write to the
;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
;; Boston, MA 02110-1301, USA.
;;; Code:
;; the toolbar is just a waste of valuable screen estate
;; in a tty tool-bar-mode does not properly auto-load, and is
;; already disabled anyway
(when (fboundp 'tool-bar-mode)
(tool-bar-mode -1))
;; the menu bar is mostly useless as well
;; but removing it under OS X doesn't make much sense
(defun prelude-frame-config (frame)
"Custom behaviours for new frames."
(if (eq system-type 'darwin)
(with-selected-frame frame
(if (display-graphic-p)
(modify-frame-parameters frame '((menu-bar-lines . 1)))
(modify-frame-parameters frame '((menu-bar-lines . 0)))))
(menu-bar-mode -1)))
;; run now
(prelude-frame-config (selected-frame))
;; and later
(add-hook 'after-make-frame-functions 'prelude-frame-config)
;; the blinking cursor is nothing, but an annoyance
(blink-cursor-mode -1)
;; disable startup screen
(setq inhibit-startup-screen t)
;; nice scrolling
(setq scroll-margin 0
scroll-conservatively 100000
scroll-preserve-screen-position 1)
;; mode line settings
(line-number-mode t)
(column-number-mode t)
(size-indication-mode t)
;; make the fringe (gutter) smaller
;; the argument is a width in pixels (the default is 8)
(if (fboundp 'fringe-mode)
(fringe-mode 4))
;; enable y/n answers
(fset 'yes-or-no-p 'y-or-n-p)
;; more useful frame title, that show either a file or a
;; buffer name (if the buffer isn't visiting a file)
(setq frame-title-format
'("" invocation-name " Prelude - " (:eval (if (buffer-file-name)
(abbreviate-file-name (buffer-file-name))
"%b"))))
;; custom Emacs 24 color themes support
(add-to-list 'custom-theme-load-path (concat prelude-dir "themes/"))
;; use zenburn as the default theme
(load-theme 'zenburn t)
(provide 'prelude-ui)
;;; prelude-ui.el ends here

View file

@ -1,48 +0,0 @@
;;; prelude-xml.el --- Emacs Prelude: XML editing configuration.
;;
;; Copyright (c) 2011 Bozhidar Batsov
;;
;; Author: Bozhidar Batsov <bozhidar.batsov@gmail.com>
;; URL: http://www.emacswiki.org/cgi-bin/wiki/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

View file

@ -1,4 +0,0 @@
;; yaml-mode
(add-to-list 'auto-mode-alist '("\\.yml$" . yaml-mode))
(provide 'prelude-yaml)