customizations are no more - they don't work particularly well for

something like Prelude
This commit is contained in:
Bozhidar Batsov 2011-11-27 13:47:34 +02:00
parent b3ffef226d
commit 4bc0350c47
13 changed files with 146 additions and 398 deletions

133
init.el
View file

@ -33,10 +33,6 @@
;;; Code:
(defgroup prelude nil
"Emacs Prelude"
:group 'convenience)
;; 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.
(if (eq system-type 'darwin)
@ -69,120 +65,23 @@ by Prelude.")
(require 'prelude-editor)
(require 'prelude-global-keybindings)
(defcustom prelude-c-module t
"Enable Prelude's C module."
:type 'boolean
:group 'prelude)
(defcustom prelude-clojure-module t
"Enable Prelude's Clojure module."
:type 'boolean
:group 'prelude)
(defcustom prelude-coffee-script-module t
"Enable Prelude's CoffeeScript module."
:type 'boolean
:group 'prelude)
(defcustom prelude-common-lisp-module t
"Enable Prelude's Common Lisp module."
:type 'boolean
:group 'prelude)
(defcustom prelude-emacs-lisp-module t
"Enable Prelude's Emacs Lisp module."
:type 'boolean
:group 'prelude)
(defcustom prelude-erc-module t
"Enable Prelude's ERC module."
:type 'boolean
:group 'prelude)
(defcustom prelude-haskell-module t
"Enable Prelude's Haskell module."
:type 'boolean
:group 'prelude)
(defcustom prelude-js-module t
"Enable Prelude's JavaScript module."
:type 'boolean
:group 'prelude)
(defcustom prelude-latex-module t
"Enable Prelude's LaTeX module."
:type 'boolean
:group 'prelude)
(defcustom prelude-markdown-module t
"Enable Prelude's Markdown module."
:type 'boolean
:group 'prelude)
(defcustom prelude-org-module t
"Enable Prelude's org-mode module."
:type 'boolean
:group 'prelude)
(defcustom prelude-perl-module t
"Enable Prelude's Perl module."
:type 'boolean
:group 'prelude)
(defcustom prelude-python-module t
"Enable Prelude's Python module."
:type 'boolean
:group 'prelude)
(defcustom prelude-ruby-module t
"Enable Prelude's Ruby module."
:type 'boolean
:group 'prelude)
(defcustom prelude-scheme-module t
"Enable Prelude's Scheme module."
:type 'boolean
:group 'prelude)
(defcustom prelude-xml-module t
"Enable Prelude's XML module."
:type 'boolean
:group 'prelude)
;; programming & markup languages support
(when prelude-c-module
(require 'prelude-c))
(when prelude-clojure-module
(require 'prelude-clojure))
(when prelude-coffee-script-module
(require 'prelude-coffee))
(when prelude-common-lisp-module
(require 'prelude-common-lisp))
(when prelude-emacs-lisp-module
(require 'prelude-emacs-lisp))
(when prelude-erc-module
(require 'prelude-erc))
(when prelude-haskell-module
(require 'prelude-haskell))
(when prelude-js-module
(require 'prelude-js))
(when prelude-latex-module
(require 'prelude-latex))
(when prelude-markdown-module
(require 'prelude-markdown))
(when prelude-org-module
(require 'prelude-org))
(when prelude-perl-module
(require 'prelude-perl))
(when prelude-perl-module
(require 'prelude-python))
(when prelude-ruby-module
(require 'prelude-ruby))
(when prelude-scheme-module
(require 'prelude-scheme))
(when prelude-xml-module
(require 'prelude-xml))
(require 'prelude-c)
(require 'prelude-clojure)
(require 'prelude-coffee)
(require 'prelude-common-lisp)
(require 'prelude-emacs-lisp)
(require 'prelude-erc)
(require 'prelude-haskell)
(require 'prelude-js)
(require 'prelude-latex)
(require 'prelude-markdown)
(require 'prelude-org)
(require 'prelude-perl)
(require 'prelude-python)
(require 'prelude-ruby)
(require 'prelude-scheme)
(require 'prelude-xml)
;; load the personal settings (this includes `custom-file')
(when (file-exists-p prelude-personal-dir)

View file

@ -32,24 +32,13 @@
;;; Code:
;; customize
(defgroup c nil
"Emacs Prelude C programming support"
:group 'prelude)
(defcustom prelude-enable-c-hook t
"Enable Prelude's default C hook."
:type 'boolean
:group 'c)
(defun prelude-c-coding-hook ()
(setq c-basic-offset 4)
(prelude-coding-hook))
(when prelude-enable-c-hook
;; this will affect all modes derived from cc-mode, like
;; java-mode, php-mode, etc
(add-hook 'c-mode-common-hook 'prelude-c-coding-hook))
;; this will affect all modes derived from cc-mode, like
;; java-mode, php-mode, etc
(add-hook 'c-mode-common-hook 'prelude-c-coding-hook)
(provide 'prelude-c)

View file

@ -32,16 +32,6 @@
;;; Code:
;; customize
(defgroup clojure nil
"Emacs Prelude Clojure programming support"
:group 'prelude)
(defcustom prelude-enable-clojure-hook t
"Enable Prelude's Clojure hook."
:type 'boolean
:group 'clojure)
(require 'prelude-lisp)
;; To start SLIME in your Clojure project:
@ -49,8 +39,7 @@
;; 2. Invoke M-x clojure-jack-in from a project
(require 'clojure-mode)
(when prelude-enable-clojure-hook
(add-hook 'clojure-mode-hook 'prelude-lisp-coding-hook))
(add-hook 'clojure-mode-hook 'prelude-lisp-coding-hook)
(provide 'prelude-clojure)

View file

@ -32,15 +32,6 @@
;;; Code:
(defgroup coffee nil
"Emacs Prelude CoffeeScript support"
:group 'prelude)
(defcustom prelude-enable-coffee-hook t
"Enable Prelude's CoffeeScript's hook"
:type 'boolean
:group 'coffee)
(require 'coffee-mode)
(defun prelude-coffee-mode-hook ()
@ -73,8 +64,7 @@
(file-exists-p (coffee-compiled-file-name))
(coffee-cos-mode t)))
(when prelude-enable-coffee-hook
(add-hook 'coffee-mode-hook 'prelude-coffee-mode-hook))
(add-hook 'coffee-mode-hook 'prelude-coffee-mode-hook)
(provide 'prelude-coffee)

View file

@ -32,27 +32,6 @@
;;; Code:
(defgroup common-lisp nil
"Prelude's Common Lisp support"
:group 'prelude)
(defcustom prelude-start-slime-automatically t
"Start SLIME automatically the first time a .list file is opened."
:type 'boolean
:group 'common-lisp)
(defcustom prelude-enable-common-lisp-hook t
"Enable Prelude's Common Lisp hook"
:type 'boolean
:group 'common-lisp)
(defcustom prelude-load-common-lisp-slime-automatically nil
"Load Common Lisp's SLIME by default. Setting this to `t' is not a
very good idea if you're programming on occasion in both Clojure and
Common Lisp."
:type 'boolean
:group 'common-lisp)
(require 'prelude-lisp)
;; the SBCL configuration file is in Common Lisp
@ -84,17 +63,15 @@ Common Lisp."
;; default to SBCL on Linux and Windows
(setq slime-default-lisp 'sbcl))
(when prelude-enable-common-lisp-hook
(add-hook 'lisp-mode-hook 'prelude-lisp-coding-hook)
(add-hook 'slime-repl-mode-hook 'prelude-interactive-lisp-coding-hook))
(add-hook 'lisp-mode-hook 'prelude-lisp-coding-hook)
(add-hook 'slime-repl-mode-hook '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))))
(when prelude-start-slime-automatically
(add-hook 'slime-mode-hook 'prelude-start-slime))
(add-hook 'slime-mode-hook 'prelude-start-slime)
;; Stop SLIME's REPL from grabbing DEL,
;; which is annoying when backspacing over a '('

View file

@ -36,11 +36,6 @@
(require 'thingatpt)
(require 'imenu)
;; customization
(defgroup core nil
"Emacs Prelude core"
:group 'prelude)
(defun prelude-add-subfolders-to-load-path (parent-dir)
"Adds all first level `parent-dir' subdirs to the
Emacs load path."

View file

@ -32,15 +32,6 @@
;;; Code:
(defgroup emacs-lisp nil
"Prelude support for Emacs Lisp"
:group 'prelude)
(defcustom prelude-enable-emacs-lisp-hook t
"Enable Prelude's Emacs Lisp hook"
:type 'boolean
:group 'emacs-lisp)
(require 'prelude-lisp)
(defun prelude-remove-elc-on-save ()
@ -51,14 +42,18 @@
(if (file-exists-p (concat buffer-file-name "c"))
(delete-file (concat buffer-file-name "c"))))))
(when prelude-enable-emacs-lisp-hook
(add-hook 'emacs-lisp-mode-hook 'turn-on-eldoc-mode)
(add-hook 'emacs-lisp-mode-hook 'prelude-remove-elc-on-save)
(defun prelude-emacs-lisp-mode-hook ()
(turn-on-eldoc-mode)
(prelude-remove-elc-on-save)
(prelude-lisp-coding-hook))
(add-hook 'emacs-lisp-mode-hook 'prelude-lisp-coding-hook)
(add-hook 'emacs-lisp-mode-hook 'prelude-emacs-lisp-mode-hook)
(add-hook 'ielm-mode-hook 'prelude-interactive-lisp-coding-hook)
(add-hook 'ielm-mode-hook 'turn-on-eldoc-mode))
(defun prelude-ielm-mode-hook ()
(prelude-interactive-lisp-coding-hook)
(turn-on-eldoc-mode))
(add-hook 'ielm-mode-hook 'prelude-ielm-mode-hook)
(define-key emacs-lisp-mode-map (kbd "M-.") 'find-function-at-point)

View file

@ -32,135 +32,123 @@
;;; Code:
(defcustom prelude-enable-additional-keybindings t
"Enable Prelude additional global keybindings"
:type 'boolean
:group 'prelude)
;; You know, like Readline.
(global-set-key (kbd "C-M-h") 'backward-kill-word)
(defcustom prelude-disable-arrow-navigation t
"Disable arrow navigation"
:type 'boolean
:group 'prelude)
;; Align your code in a pretty way.
(global-set-key (kbd "C-x \\") 'align-regexp)
(when prelude-enable-additional-keybindings
;; You know, like Readline.
(global-set-key (kbd "C-M-h") 'backward-kill-word)
;; Perform general cleanup.
(global-set-key (kbd "C-c n") 'prelude-cleanup-buffer)
;; 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)
;; Perform general cleanup.
(global-set-key (kbd "C-c n") 'prelude-cleanup-buffer)
;; Jump to a definition in the current file. (This is awesome.)
(global-set-key (kbd "M-i") 'prelude-ido-goto-symbol)
;; Font size
(define-key global-map (kbd "C-+") 'text-scale-increase)
(define-key global-map (kbd "C--") 'text-scale-decrease)
;; File finding
(global-set-key (kbd "C-x f") 'prelude-recentf-ido-find-file)
(global-set-key (kbd "C-c r") 'bury-buffer)
(global-set-key (kbd "M-`") 'file-cache-minibuffer-complete)
;; Jump to a definition in the current file. (This is awesome.)
(global-set-key (kbd "M-i") 'prelude-ido-goto-symbol)
;; File finding
(global-set-key (kbd "C-x f") 'prelude-recentf-ido-find-file)
(global-set-key (kbd "C-c r") 'bury-buffer)
(global-set-key (kbd "M-`") 'file-cache-minibuffer-complete)
;; Window switching. (C-x o goes to the next window)
(global-set-key (kbd "C-x O") (lambda ()
;; 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)
(global-set-key (kbd "C-M-\\") 'prelude-indent-region-or-buffer)
;; Indentation help
(global-set-key (kbd "C-x ^") 'join-line)
(global-set-key (kbd "C-M-\\") 'prelude-indent-region-or-buffer)
;; Start proced in a similar manner to dired
(global-set-key (kbd "C-x p") 'proced)
;; 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 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 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)
;; 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)
;; If you want to be able to M-x without meta
(global-set-key (kbd "C-x C-m") 'execute-extended-command)
;; Fetch the contents at a URL, display it raw.
(global-set-key (kbd "C-x C-h") 'prelude-view-url)
;; Fetch the contents at a URL, display it raw.
(global-set-key (kbd "C-x C-h") 'prelude-view-url)
;; A complementary binding to the apropos-command(C-h a)
(global-set-key (kbd "C-h A") 'apropos)
;; A complementary binding to the apropos-command(C-h a)
(global-set-key (kbd "C-h A") 'apropos)
;; Should be able to eval-and-replace anywhere.
(global-set-key (kbd "C-c e") 'prelude-eval-and-replace)
;; Should be able to eval-and-replace anywhere.
(global-set-key (kbd "C-c e") 'prelude-eval-and-replace)
;; Magit rules!
(global-set-key (kbd "C-x g") 'magit-status)
;; Magit rules!
(global-set-key (kbd "C-x g") 'magit-status)
;; Activate occur easily inside isearch
(define-key isearch-mode-map (kbd "C-o")
;; 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))))))
;; cycle through buffers
(global-set-key (kbd "<C-tab>") 'bury-buffer)
;; cycle through buffers
(global-set-key (kbd "<C-tab>") 'bury-buffer)
;; use hippie-expand instead of dabbrev
(global-set-key (kbd "M-/") 'hippie-expand)
;; use hippie-expand instead of dabbrev
(global-set-key (kbd "M-/") 'hippie-expand)
;; spell check Bulgarian text
(global-set-key (kbd "C-c B")
;; spell check Bulgarian text
(global-set-key (kbd "C-c B")
(lambda()(interactive)
(ispell-change-dictionary "bulgarian")
(flyspell-buffer)))
;; replace buffer-menu with ibuffer
(global-set-key (kbd "C-x C-b") 'ibuffer)
;; replace buffer-menu with ibuffer
(global-set-key (kbd "C-x C-b") 'ibuffer)
;; swap windows
(global-set-key (kbd "C-c s") 'prelude-swap-windows)
;; swap windows
(global-set-key (kbd "C-c s") 'prelude-swap-windows)
;; duplicate the current line or region
(global-set-key (kbd "C-c d") 'prelude-duplicate-current-line-or-region)
;; duplicate the current line or region
(global-set-key (kbd "C-c d") 'prelude-duplicate-current-line-or-region)
;; rename buffer & visited file
(global-set-key (kbd "C-c r") 'prelude-rename-file-and-buffer)
;; rename buffer & visited file
(global-set-key (kbd "C-c r") 'prelude-rename-file-and-buffer)
;; open an ansi-term buffer
(global-set-key (kbd "C-x t") 'prelude-visit-term-buffer)
;; open an ansi-term buffer
(global-set-key (kbd "C-x t") 'prelude-visit-term-buffer)
;; toggle input method
(global-set-key (kbd "C-\\") 'prelude-toggle-bulgarian-input-method)
;; toggle input method
(global-set-key (kbd "C-\\") 'prelude-toggle-bulgarian-input-method)
;; search with google
(global-set-key (kbd "C-c g") 'prelude-google)
;; search with google
(global-set-key (kbd "C-c g") 'prelude-google)
;; open in external application
(global-set-key (kbd "C-c o") 'prelude-open-with)
;; open in external application
(global-set-key (kbd "C-c o") 'prelude-open-with)
;; toggle menu-bar visibility
(global-set-key (kbd "<f12>") 'menu-bar-mode))
;; toggle menu-bar visibility
(global-set-key (kbd "<f12>") 'menu-bar-mode)
(when prelude-disable-arrow-navigation
;; real Emacs hackers don't use the arrow keys
(global-set-key (kbd "<up>") (lambda ()
;; real Emacs hackers don't use the arrow keys
(global-set-key (kbd "<up>") (lambda ()
(interactive)
(message "Arrow key navigation is disabled. Use C-p instead.")))
(global-set-key (kbd "<down>") (lambda ()
(global-set-key (kbd "<down>") (lambda ()
(interactive)
(message "Arrow key navigation is disabled. Use C-n instead.")))
(global-set-key (kbd "<left>") (lambda ()
(global-set-key (kbd "<left>") (lambda ()
(interactive)
(message "Arrow key navigation is disabled. Use C-b instead.")))
(global-set-key (kbd "<right>") (lambda ()
(global-set-key (kbd "<right>") (lambda ()
(interactive)
(message "Arrow key navigation is disabled. Use C-f instead."))))
(message "Arrow key navigation is disabled. Use C-f instead.")))
(provide 'prelude-global-keybindings)

View file

@ -32,23 +32,12 @@
;;; Code:
;; customize
(defgroup javascript nil
"Emacs Prelude JavaScript programming support"
:group 'prelude)
(defcustom prelude-enable-js-hook t
"Enable Prelude's default JavaScript hook."
:type 'boolean
:group 'javascript)
(defun prelude-js-coding-hook ()
(prelude-coding-hook)
;; electric-layout-mode doesn't play nice with js-mode
(electric-layout-mode -1))
(when prelude-enable-js-hook
(add-hook 'js-mode-hook 'prelude-js-coding-hook))
(add-hook 'js-mode-hook 'prelude-js-coding-hook)
(provide 'prelude-js)

View file

@ -32,15 +32,6 @@
;;; Code:
(defgroup perl nil
"Emacs Prelude Perl support."
:group 'prelude)
(defcustom prelude-enable-perl-hook t
"Enable Prelude's Perl hook"
:type 'boolean
:group 'perl)
;; use cperl-mode instead of perl-mode
(defalias 'perl-mode 'cperl-mode)
@ -65,8 +56,7 @@
(set-face-background 'cperl-hash-face nil)
(setq cperl-invalid-face nil))
(when prelude-enable-perl-hook
(add-hook 'cperl-mode-hook 'prelude-cperl-mode-hook t))
(add-hook 'cperl-mode-hook 'prelude-cperl-mode-hook t)
(provide 'prelude-perl)

View file

@ -33,23 +33,12 @@
;;; Code:
;; customize
(defgroup python nil
"Emacs Prelude C programming support"
:group 'prelude)
(defcustom prelude-enable-python-hook t
"Enable Prelude's default Python hook."
:type 'boolean
:group 'python)
(require 'python)
(defun prelude-python-coding-hook ()
(electric-indent-mode -1))
(when prelude-enable-python-hook
(add-hook 'python-mode-hook 'prelude-python-coding-hook))
(add-hook 'python-mode-hook 'prelude-python-coding-hook)
(provide 'prelude-python)

View file

@ -32,15 +32,6 @@
;;; Code:
(defgroup ruby nil
"Emacs Prelude Ruby support"
:group 'prelude)
(defcustom prelude-enable-ruby-hook t
"Enable Prelude's Ruby hook"
:type 'boolean
:group 'ruby)
;; 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))
@ -76,8 +67,7 @@
(ruby-block-mode t)
(local-set-key (kbd "C-h r") 'yari))
(when prelude-enable-ruby-hook
(add-hook 'ruby-mode-hook 'prelude-ruby-mode-hook))
(add-hook 'ruby-mode-hook 'prelude-ruby-mode-hook)
(require 'haml-mode)
(require 'scss-mode)

View file

@ -33,62 +33,30 @@
;;; Code:
;; customization
(defgroup ui nil
"Emacs Prelude UI"
:group 'prelude)
(defcustom prelude-use-minimalistic-ui t
"If set to true Prelude will dispense of most the UI that's mouse related -
menu bar, tool bar, etc"
:type 'boolean
:group 'ui)
(defcustom prelude-use-smooth-scrolling t
"Overrides the default scrolling behavior with a much more common one."
:type 'boolean
:group 'ui)
(defcustom prelude-use-default-prelude-theme t
"If set to true Prelude will load up its default theme (Zenburn),
instead of Emacs's default theme."
:type 'boolean
:group 'ui)
(defcustom prelude-enhance-modeline t
"If set to true Prelude will augment the default modeline settings."
:type 'boolean
:group 'ui)
(when prelude-use-minimalistic-ui
;; 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)
;; 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
(unless (eq system-type 'darwin)
;; the menu bar is mostly useless as well
;; but removing it under OS X doesn't make much sense
(unless (eq system-type 'darwin)
(menu-bar-mode -1))
;; the blinking cursor is nothing, but an annoyance
(blink-cursor-mode -1)
;; the blinking cursor is nothing, but an annoyance
(blink-cursor-mode -1)
;; disable startup screen
(setq inhibit-startup-screen t))
;; disable startup screen
(setq inhibit-startup-screen t)
(when prelude-use-smooth-scrolling
;; nice scrolling
(setq scroll-margin 0
;; nice scrolling
(setq scroll-margin 0
scroll-conservatively 100000
scroll-preserve-screen-position 1))
scroll-preserve-screen-position 1)
(when prelude-enhance-modeline
;; mode line settings
(line-number-mode t)
(column-number-mode t)
(size-indication-mode t))
;; mode line settings
(line-number-mode t)
(column-number-mode t)
(size-indication-mode t)
;; enable y/n answers
(fset 'yes-or-no-p 'y-or-n-p)
@ -96,8 +64,8 @@ instead of Emacs's default theme."
;; custom Emacs 24 color themes support
(add-to-list 'custom-theme-load-path (concat prelude-dir "themes/"))
(when prelude-use-default-prelude-theme
(load-theme 'zenburn t))
;; use zenburn as the default theme
(load-theme 'zenburn t)
(provide 'prelude-ui)
;;; prelude-ui.el ends here