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

This commit is contained in:
Bozhidar Batsov 2011-11-23 22:45:00 +02:00
commit 73bd5118fc
6 changed files with 290 additions and 3 deletions

View file

@ -76,11 +76,14 @@ by Prelude.")
(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)

178
modules/prelude-erc.el Normal file
View file

@ -0,0 +1,178 @@
;;; 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)
;; Join the a couple of interesting channels whenever connecting to Freenode.
(setq erc-autojoin-channels-alist '(("freenode.net"
"#emacs" "#ruby" "#lisp")))
;; 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)
(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)
;; share my real name
(setq erc-user-full-name "Bozhidar Batsov")
;; 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)
;; auto identify
(when (file-exists-p (expand-file-name "~/.ercpass"))
(load "~/.ercpass")
(require 'erc-services)
(erc-services-mode 1)
(setq erc-prompt-for-nickserv-password nil)
(setq erc-nickserv-passwords
`((freenode (("bozhidar" . ,bozhidar-pass)))))
)
;; 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 "bozhidar")))
(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

47
modules/prelude-org.el Normal file
View file

@ -0,0 +1,47 @@
;;; 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)
(defun prelude-org-mode-hook ()
(electric-indent-mode -1))
(add-hook 'org-mode-hook 'prelude-org-mode-hook)
(provide 'prelude-org)
;;; prelude-org.el ends here

View file

@ -45,7 +45,7 @@
(defvar prelude-packages
'(auctex clojure-mode coffee-mode deft gist haml-mode
haskell-mode magit markdown-mode paredit projectile
sass-mode scss-mode yaml-mode yari yasnippet)
python sass-mode scss-mode yaml-mode yari yasnippet)
"A list of packages to ensure are installed at launch.")
(dolist (p prelude-packages)

56
modules/prelude-python.el Normal file
View file

@ -0,0 +1,56 @@
;;; 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:
;; 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))
(provide 'prelude-python)
;;; prelude-python.el ends here

View file

@ -39,7 +39,7 @@
:group 'prelude)
(defcustom prelude-use-minimalistic-ui t
"If set to true Prelude will dispense of most the UI that's mouse related -
"If set to true Prelude will dispense of most the UI that's mouse related -
menu bar, tool bar, etc"
:type 'boolean
:group 'ui)
@ -63,7 +63,10 @@ instead of Emacs's default theme."
(when prelude-use-minimalistic-ui
;; the toolbar is just a waste of valuable screen estate
(tool-bar-mode -1)
;; 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)