Merge branch 'master' of github.com:bbatsov/prelude

Conflicts:
	README.md
This commit is contained in:
Bozhidar Batsov 2012-05-05 16:20:54 +03:00
commit cc2b8ee7d8
6 changed files with 91 additions and 40 deletions

View file

@ -1,13 +1,11 @@
``` ```
_____ ____ _ _ ____ _ _
| ____|_ __ ___ __ _ ___ ___ | _ \ _ __ ___| |_ _ __| | ___ | _ \ _ __ ___| |_ _ __| | ___
| _| | '_ ` _ \ / _` |/ __/ __| | |_) | '__/ _ \ | | | |/ _` |/ _ \ | |_) | '__/ _ \ | | | |/ _` |/ _ \
| |___| | | | | | (_| | (__\__ \ | __/| | | __/ | |_| | (_| | __/ | __/| | | __/ | |_| | (_| | __/
|_____|_| |_| |_|\__,_|\___|___/ |_| |_| \___|_|\__,_|\__,_|\___| |_| |_| \___|_|\__,_|\__,_|\___|
``` ```
## Prelude
Emacs is probably the best text editor in the world. However, the Emacs is probably the best text editor in the world. However, the
process of coming up with a useful Emacs configuration is long and process of coming up with a useful Emacs configuration is long and
difficult. It's this process that separates you from truly taking difficult. It's this process that separates you from truly taking
@ -38,7 +36,18 @@ You can now power up your Emacs, sit back and enjoy Prelude.
## Would you like to know more? ## Would you like to know more?
Check out the [Prelude's project page](http://batsov.com/prelude). Check out the [Prelude's project page](http://batsov.com/prelude) for
all the gory details.
If you're looking for more info on Emacs in general - consult
[WikEmacs](http://wikemacs.org).
## More goodies
The [Prelude Modules](https://github.com/bbatsov/prelude-modules)
project contains a lot of additional packages for Prelude
(install-able via the `package-list-packages` command) - enhanced programming
mode configs, latex config, erc config, etc.
## Known issues ## Known issues
@ -55,11 +64,7 @@ development of Emacs Prelude.
## Bugs & Improvements ## Bugs & Improvements
Bug reports and suggestions for improvements are always Bug reports and suggestions for improvements are always
welcome. github pull requests are even better! :-) welcome. GitHub pull requests are even better! :-)
I'd like to include a nice variety of Emacs 24 themes into Prelude -
so if you've developed (or simply found) one - give me a shout and
I'll take a look at it.
Cheers,<br> Cheers,<br>
Bozhidar Bozhidar

20
init.el
View file

@ -1,9 +1,9 @@
;;; init.el --- Emacs Prelude: configuration entry point. ;;; init.el --- Prelude's configuration entry point.
;; ;;
;; Copyright (c) 2011 Bozhidar Batsov ;; Copyright (c) 2011 Bozhidar Batsov
;; ;;
;; Author: Bozhidar Batsov <bozhidar.batsov@gmail.com> ;; Author: Bozhidar Batsov <bozhidar@batsov.com>
;; URL: http://batsov.com/emacs-prelude ;; URL: http://batsov.com/prelude
;; Version: 1.0.0 ;; Version: 1.0.0
;; Keywords: convenience ;; Keywords: convenience
@ -32,8 +32,8 @@
;; Boston, MA 02110-1301, USA. ;; Boston, MA 02110-1301, USA.
;;; Code: ;;; Code:
(message "Emacs Prelude is powering up... Be patient, Master %s!"
(getenv "USER")) (message "Prelude is powering up... Be patient, Master %s!" (getenv "USER"))
(defvar prelude-dir (file-name-directory load-file-name) (defvar prelude-dir (file-name-directory load-file-name)
"The root dir of the Emacs Prelude distribution.") "The root dir of the Emacs Prelude distribution.")
@ -44,9 +44,15 @@ avoid modifying the configuration there.")
"Users of Emacs Prelude are encouraged to keep their personal configuration "Users of Emacs Prelude are encouraged to keep their personal configuration
changes in this directory. All Emacs Lisp files there are loaded automatically changes in this directory. All Emacs Lisp files there are loaded automatically
by Prelude.") by Prelude.")
(defvar prelude-vendor-dir (concat prelude-dir "vendor/")
"This directory house Emacs Lisp packages that are not yet available in
ELPA (or MELPA).")
(defvar prelude-snippets-dir (concat prelude-dir "snippets/")
"This folder houses addition yasnippet bundles distributed with Prelude.")
;; add Prelude's directories to Emacs's `load-path' ;; add Prelude's directories to Emacs's `load-path'
(add-to-list 'load-path prelude-modules-dir) (add-to-list 'load-path prelude-modules-dir)
(add-to-list 'load-path prelude-vendor-dir)
;; the core stuff ;; the core stuff
(require 'prelude-packages) (require 'prelude-packages)
@ -56,6 +62,7 @@ by Prelude.")
(require 'prelude-editor) (require 'prelude-editor)
(require 'prelude-global-keybindings) (require 'prelude-global-keybindings)
;; OSX specific settings
(when (eq system-type 'darwin) (when (eq system-type 'darwin)
(require 'prelude-osx)) (require 'prelude-osx))
@ -66,7 +73,6 @@ by Prelude.")
(when (file-exists-p prelude-personal-dir) (when (file-exists-p prelude-personal-dir)
(mapc 'load (directory-files prelude-personal-dir 't "^[^#].*el$"))) (mapc 'load (directory-files prelude-personal-dir 't "^[^#].*el$")))
(message "Emacs Prelude is ready to do thy bidding, Master %s!" (message "Prelude is ready to do thy bidding, Master %s!" (getenv "USER"))
(getenv "USER"))
;;; init.el ends here ;;; init.el ends here

View file

@ -74,10 +74,8 @@
try-complete-lisp-symbol-partially try-complete-lisp-symbol-partially
try-complete-lisp-symbol)) try-complete-lisp-symbol))
;; smart indenting and pairing for all ;; smart pairing for all
(electric-pair-mode t) (electric-pair-mode t)
(electric-indent-mode t)
(electric-layout-mode t)
;; meaningful names for buffers with the same name ;; meaningful names for buffers with the same name
(require 'uniquify) (require 'uniquify)
@ -118,7 +116,7 @@
;; use shift + arrow keys to switch between visible buffers ;; use shift + arrow keys to switch between visible buffers
(require 'windmove) (require 'windmove)
(windmove-default-keybindings 'super) (windmove-default-keybindings)
;; automatically save buffers associated with files on buffer switch ;; automatically save buffers associated with files on buffer switch
;; and on windows switch ;; and on windows switch
@ -135,8 +133,8 @@
(defadvice windmove-right (before other-window-now activate) (defadvice windmove-right (before other-window-now activate)
(when buffer-file-name (save-buffer))) (when buffer-file-name (save-buffer)))
;; show-paren-mode: subtle highlighting of matching parens ;; show-paren-mode: subtle highlighting of matching parens (global-mode)
(show-paren-mode t) (show-paren-mode +1)
(setq show-paren-style 'parenthesis) (setq show-paren-style 'parenthesis)
;; highlight the current line ;; highlight the current line
@ -197,6 +195,7 @@
;; load yasnippet ;; load yasnippet
(require 'yasnippet) (require 'yasnippet)
(add-to-list 'yas/snippet-dirs prelude-snippets-dir)
(yas/global-mode 1) (yas/global-mode 1)
;; projectile is a project management mode ;; projectile is a project management mode
@ -220,6 +219,11 @@
;; otherwise fallback to helm-mini ;; otherwise fallback to helm-mini
(helm-mini))) (helm-mini)))
;; shorter aliases for ack-and-a-half commands
(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)
;; dired - reuse current buffer by pressing 'a' ;; dired - reuse current buffer by pressing 'a'
(put 'dired-find-alternate-file 'disabled nil) (put 'dired-find-alternate-file 'disabled nil)

View file

@ -42,7 +42,6 @@
(define-key map [(control shift down)] 'prelude-move-line-down) (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 n") 'prelude-cleanup-buffer)
(define-key map (kbd "C-c f") 'prelude-recentf-ido-find-file) (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-M-\\") 'prelude-indent-region-or-buffer)
(define-key map (kbd "C-c u") 'prelude-view-url) (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 e") 'prelude-eval-and-replace)
@ -82,7 +81,6 @@
("Navigation" ("Navigation"
["Enable arrow keys" prelude-restore-arrow-keys] ["Enable arrow keys" prelude-restore-arrow-keys]
["Go to symbol" prelude-ido-goto-symbol]
["Helm" helm-prelude]) ["Helm" helm-prelude])
("Windows" ("Windows"

View file

@ -1,6 +1,7 @@
;; On OS X Emacs doesn't use the shell PATH if it's not started from ;; On OS X Emacs doesn't use the shell PATH if it's not started from
;; the shell. If you're using homebrew modifying the PATH is essential. ;; the shell. If you're using homebrew modifying the PATH is essential.
(push "/usr/local/bin" exec-path) (push "/usr/local/bin" exec-path)
(setenv "PATH" (concat "/usr/local/bin:" (getenv "PATH")))
;; Emacs users obviously have little need for Command and Option keys, ;; Emacs users obviously have little need for Command and Option keys,
;; but they do need Meta and Super ;; but they do need Meta and Super

View file

@ -41,7 +41,7 @@
(setq url-http-attempt-keepalives nil) (setq url-http-attempt-keepalives nil)
(defvar prelude-packages (defvar prelude-packages
'(melpa expand-region gist helm helm-projectile magit magithub '(ack-and-a-half expand-region gist helm helm-projectile magit magithub melpa
rainbow-mode volatile-highlights yasnippet zenburn-theme) rainbow-mode volatile-highlights yasnippet zenburn-theme)
"A list of packages to ensure are installed at launch.") "A list of packages to ensure are installed at launch.")
@ -50,6 +50,7 @@
when (not (package-installed-p p)) do (return nil) when (not (package-installed-p p)) do (return nil)
finally (return t))) finally (return t)))
(defun prelude-install-packages ()
(unless (prelude-packages-installed-p) (unless (prelude-packages-installed-p)
;; check for new packages (package versions) ;; check for new packages (package versions)
(message "%s" "Emacs Prelude is now refreshing its package database...") (message "%s" "Emacs Prelude is now refreshing its package database...")
@ -57,8 +58,44 @@
(message "%s" " done.") (message "%s" " done.")
;; install the missing packages ;; install the missing packages
(dolist (p prelude-packages) (dolist (p prelude-packages)
(when (not (package-installed-p p)) (unless (package-installed-p p)
(package-install p)))) (package-install p)))))
(prelude-install-packages)
(defmacro prelude-auto-install (ext mode)
`(add-to-list 'auto-mode-alist
`(,ext . (lambda ()
(package-install ',mode)
(,mode)))))
(defvar prelude-auto-install-alist
'(("\\.markdown\\'" . markdown-mode)
("\\.md\\'" . markdown-mode)
("\\.haml\\'" . haml-mode)
("\\.scss\\'" . scss-mode)
("\\.sass\\'" . sass-mode)
("\\.groovy\\'" . groovy-mode)
("\\.yml\\'" . yaml-mode)
("\\.php\\'" . php-mode)
("\\.hs\\'" . haskell-mode)
("\\.less\\'" . less-css-mode)
("\\.lua\\'" . lua-mode)
("\\.coffee\\'" . coffee-mode)
("\\.erl\\'" . erlang-mode)
("\\.feature\\'" . feature-mode)))
;; markdown-mode doesn't have autoloads for the auto-mode-alist
;; so we add them manually if it's already installed
(when (package-installed-p 'markdown-mode)
(add-to-list 'auto-mode-alist '("\\.markdown\\'" . markdown-mode))
(add-to-list 'auto-mode-alist '("\\.md\\'" . markdown-mode)))
(dolist (entry prelude-auto-install-alist)
(let ((ext (car entry))
(mode (cdr entry)))
(unless (package-installed-p mode)
(prelude-auto-install ext mode))))
(provide 'prelude-packages) (provide 'prelude-packages)
;;; prelude-packages.el ends here ;;; prelude-packages.el ends here