From c8b34bbdad15a4153f87d4b6df324fe34b1c8a37 Mon Sep 17 00:00:00 2001 From: Tom Willemsen Date: Mon, 17 Dec 2012 12:11:03 +0100 Subject: Remove oni:load-hippie-exp Placing `yas/hippie-try-expand' at the end of the `hippie-expand-try-functions-list' doesn't seem to work very well and putting it in the front might cause situations where I want to expand a variable name or something and yas might take over, so don't use yas with hippie-expand. Instead bind `yas-expand' to `C-\' and set `yas-fallback-behavior' to nil so it doesn't start acting crazy when there's no snippet to expand. --- .emacs.d/init.el | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) (limited to '.emacs.d/init.el') diff --git a/.emacs.d/init.el b/.emacs.d/init.el index 61f14d7..3e74568 100644 --- a/.emacs.d/init.el +++ b/.emacs.d/init.el @@ -104,9 +104,6 @@ 'flymake-allowed-file-name-masks ; flymaking 'easy'. '("\\.go$" flymake-simple-make-init)))) -(eval-after-load "hippie-exp" - '(oni:load-hippie-exp 'yasnippet)) - (eval-after-load "ido" '(setq ido-ignore-buffers `(,@ido-ignore-buffers "^\\*.*\\*$" "^irc\\." "^\\#"))) @@ -125,9 +122,6 @@ (global-set-key (kbd "M-x") 'smex) (global-set-key (kbd "C-M-x") 'smex-major-mode-commands))) -(eval-after-load "yasnippet" - '(oni:load-hippie-exp 'hippie-exp)) - (put 'upcase-region 'disabled nil) (put 'downcase-region 'disabled nil) (put 'narrow-to-region 'disabled nil) @@ -298,6 +292,7 @@ (setq user-mail-address "tom@ryuslash.org") (setq w3m-fill-column 72) (setq window-combination-resize t) +(setq yas-fallback-behavior nil) (setq yas-prompt-functions '(yas-ido-prompt)) (add-hook 'after-change-major-mode-hook 'set-current-mode-icon) -- cgit v1.2.3-54-g00ecf From 25adcab0c33d332f5379b46fde5530f0b714a749 Mon Sep 17 00:00:00 2001 From: Tom Willemsen Date: Wed, 19 Dec 2012 11:43:00 +0100 Subject: Set the fci-rule-column to 101 for lisps --- .emacs.d/init.el | 3 +++ .emacs.d/site-lisp/oni.el | 5 +++++ 2 files changed, 8 insertions(+) (limited to '.emacs.d/init.el') diff --git a/.emacs.d/init.el b/.emacs.d/init.el index 3e74568..6b78465 100644 --- a/.emacs.d/init.el +++ b/.emacs.d/init.el @@ -302,6 +302,7 @@ (add-hook 'css-mode-hook 'oni:css-mode-func) (add-hook 'diary-display-hook 'oni:diary-display-func) (add-hook 'emacs-lisp-mode-hook 'oni:emacs-lisp-mode-func) +(add-hook 'emacs-lisp-mode-hook 'oni:generic-lisp-mode-hook) (add-hook 'erc-mode-hook 'oni:erc-mode-func) (add-hook 'eshell-mode-hook 'oni:eshell-mode-func) (add-hook 'flymake-mode-hook 'oni:flymake-mode-func) @@ -314,6 +315,7 @@ (add-hook 'java-mode-hook 'oni:java-mode-func) (add-hook 'js-mode-hook 'oni:js-mode-func) (add-hook 'js2-mode-hook 'oni:js2-mode-func) +(add-hook 'lisp-mode-hook 'oni:generic-lisp-mode-hook) (add-hook 'lua-mode-hook 'oni:lua-mode-func) (add-hook 'magit-log-edit-mode-hook 'oni:magit-log-edit-mode-func) (add-hook 'markdown-mode-hook 'oni:markdown-mode-func) @@ -323,6 +325,7 @@ (add-hook 'prog-mode-hook 'oni:prog-mode-func) (add-hook 'python-mode-hook 'oni:python-mode-func) (add-hook 'rst-mode-hook 'oni:rst-mode-func) +(add-hook 'scheme-mode-hook 'oni:generic-lisp-mode-hook) (add-hook 'term-mode-hook 'oni:term-mode-func) (add-hook 'texinfo-mode-hook 'oni:texinfo-mode-func) (add-hook 'write-file-hooks 'oni:write-file-func) diff --git a/.emacs.d/site-lisp/oni.el b/.emacs.d/site-lisp/oni.el index 46c87fb..f652069 100644 --- a/.emacs.d/site-lisp/oni.el +++ b/.emacs.d/site-lisp/oni.el @@ -179,6 +179,11 @@ DOT are intentionally being skipped." (local-set-key [M-P] 'flymake-goto-prev-error) (local-set-key [M-N] 'flymake-goto-next-error)) +(defun oni:generic-lisp-mode-hook () + "Function for `emacs-lisp-mode-hook', `lisp-mode-hook' and +`scheme-mode-hook'." + (setq fci-column 101)) + (defun oni:go-mode-func () "Function for `go-mode-hook'." (setq indent-tabs-mode nil) -- cgit v1.2.3-54-g00ecf From adf44fafaeeb7b0347c02183ce3fca0b2025f222 Mon Sep 17 00:00:00 2001 From: Tom Willemsen Date: Wed, 19 Dec 2012 23:55:48 +0100 Subject: Add diminish --- .emacs.d/init.el | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to '.emacs.d/init.el') diff --git a/.emacs.d/init.el b/.emacs.d/init.el index 6b78465..43c49eb 100644 --- a/.emacs.d/init.el +++ b/.emacs.d/init.el @@ -70,6 +70,9 @@ "Face for the supposedly empty line in commit messages." :group 'local) +(eval-after-load "eldoc" + '(diminish 'eldoc-mode)) + (eval-after-load "em-term" '(add-to-list 'eshell-visual-commands "unison")) @@ -117,6 +120,12 @@ (eval-after-load "org" '(require 'org-init)) +(eval-after-load "pretty-symbols-mode" + '(diminish 'pretty-symbols-mode)) + +(eval-after-load "rainbow-mode" + '(diminish 'rainbmow-mode)) + (eval-after-load "smex" '(progn (global-set-key (kbd "M-x") 'smex) @@ -437,6 +446,8 @@ (unless (server-running-p) (server-start)) +(diminish 'auto-fill-function "_") + (provide 'init) ;;; init.el ends here -- cgit v1.2.3-54-g00ecf From 43382b4e453ce9ca37f04c29daa5284dab986b3b Mon Sep 17 00:00:00 2001 From: Tom Willemsen Date: Thu, 20 Dec 2012 00:01:55 +0100 Subject: Emacs: diminish yasnippet --- .emacs.d/init.el | 3 +++ 1 file changed, 3 insertions(+) (limited to '.emacs.d/init.el') diff --git a/.emacs.d/init.el b/.emacs.d/init.el index 43c49eb..c3b4b59 100644 --- a/.emacs.d/init.el +++ b/.emacs.d/init.el @@ -131,6 +131,9 @@ (global-set-key (kbd "M-x") 'smex) (global-set-key (kbd "C-M-x") 'smex-major-mode-commands))) +(eval-after-load "yasnippet" + '(diminish 'yas-minor-mode)) + (put 'upcase-region 'disabled nil) (put 'downcase-region 'disabled nil) (put 'narrow-to-region 'disabled nil) -- cgit v1.2.3-54-g00ecf From e6036a3382ce259681ff47bb8795d8c8421c64d0 Mon Sep 17 00:00:00 2001 From: Tom Willemsen Date: Thu, 20 Dec 2012 00:15:28 +0100 Subject: Show buffer position again --- .emacs.d/init.el | 1 - 1 file changed, 1 deletion(-) (limited to '.emacs.d/init.el') diff --git a/.emacs.d/init.el b/.emacs.d/init.el index c3b4b59..1e3088f 100644 --- a/.emacs.d/init.el +++ b/.emacs.d/init.el @@ -272,7 +272,6 @@ (setq message-log-max 1000) (setq message-send-mail-function 'message-send-mail-with-sendmail) (setq message-sendmail-extra-arguments '("-a" "ryuslash")) -(setq mode-line-position nil) (setq package-archives '(("melpa" . "http://melpa.milkbox.net/packages/") ("ELPA" . "http://tromey.com/elpa/") -- cgit v1.2.3-54-g00ecf From 172fcfe9303b9e85d10721cac69aa31abaa0e515 Mon Sep 17 00:00:00 2001 From: Tom Willemsen Date: Thu, 27 Dec 2012 02:25:29 +0100 Subject: Emacs: Meh, stop messing around with the mode-line --- .emacs.d/init.el | 2 -- 1 file changed, 2 deletions(-) (limited to '.emacs.d/init.el') diff --git a/.emacs.d/init.el b/.emacs.d/init.el index 1e3088f..ea12ee7 100644 --- a/.emacs.d/init.el +++ b/.emacs.d/init.el @@ -406,8 +406,6 @@ 'display-buffer-alist '("^\\*git-project-list\\*$" . ((git-project-show-window . nil)))) -(delete " " mode-line-format) - (unless (oni:required-packages-installed-p) (message "%s" "Refreshing package database...") (package-refresh-contents) -- cgit v1.2.3-54-g00ecf From 5d781782167a2746c6a31a6e3a4c1f76396bea08 Mon Sep 17 00:00:00 2001 From: Tom Willemsen Date: Thu, 27 Dec 2012 02:26:02 +0100 Subject: Emacs: Throw away unneeded imports and sort --- .emacs.d/init.el | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) (limited to '.emacs.d/init.el') diff --git a/.emacs.d/init.el b/.emacs.d/init.el index ea12ee7..061a29b 100644 --- a/.emacs.d/init.el +++ b/.emacs.d/init.el @@ -25,19 +25,16 @@ (add-to-list 'custom-theme-load-path dir)) '("~/var/src/emacs/yoshi-theme"))) +(require 'auto-complete-config) +(require 'ext) (require 'geiser-install) -(require 'iso-transl) -(require 'newcomment) +(require 'oni) (require 'uniquify) (require 'w3m-load) -(require 'ext) -(require 'oni) (autoload 'define-slime-contrib "slime") (autoload 'gtags-mode "gtags" nil t) -(autoload 'identica-mode "identica-mode" nil t) (autoload 'jabber-connect "jabber" nil t) -(autoload 'mu4e "mu4e" nil t) (autoload 'php-mode "php-mode" nil t) (autoload 'po-mode "po-mode" nil t) (autoload 'pony-mode "pony-mode" nil t) -- cgit v1.2.3-54-g00ecf From 62ea1086e9ec844c5357bcb86f09333a0ea5638a Mon Sep 17 00:00:00 2001 From: Tom Willemsen Date: Fri, 28 Dec 2012 01:56:58 +0100 Subject: Emacs: Manually set-up w3m Only `w3m-goto-url' and `w3m-bookmark-view' are ever really used to start w3m, no need to load `w3m-load' for that. --- .emacs.d/init.el | 3 ++- .emacs.d/snippets/python-mode/Makefile | 4 ++++ .emacs.d/snippets/python-mode/defm_empty | 7 +++++++ .emacs.d/snippets/python-mode/form | 9 +++++++++ .emacs.d/snippets/python-mode/form_valid | 8 ++++++++ .emacs.d/snippets/python-mode/import_from | 6 ++++++ .emacs.d/snippets/python-mode/permission_guard | 9 +++++++++ .emacs.d/snippets/python-mode/url | 5 +++++ 8 files changed, 50 insertions(+), 1 deletion(-) create mode 100644 .emacs.d/snippets/python-mode/Makefile create mode 100644 .emacs.d/snippets/python-mode/defm_empty create mode 100644 .emacs.d/snippets/python-mode/form create mode 100644 .emacs.d/snippets/python-mode/form_valid create mode 100644 .emacs.d/snippets/python-mode/import_from create mode 100644 .emacs.d/snippets/python-mode/permission_guard create mode 100644 .emacs.d/snippets/python-mode/url (limited to '.emacs.d/init.el') diff --git a/.emacs.d/init.el b/.emacs.d/init.el index 061a29b..dd679c9 100644 --- a/.emacs.d/init.el +++ b/.emacs.d/init.el @@ -30,7 +30,6 @@ (require 'geiser-install) (require 'oni) (require 'uniquify) -(require 'w3m-load) (autoload 'define-slime-contrib "slime") (autoload 'gtags-mode "gtags" nil t) @@ -42,6 +41,8 @@ (autoload 'server-running-p "server") (autoload 'slime-js-minor-mode "slime-js" nil t) (autoload 'xmodmap-mode "xmodmap-mode" nil t) +(autoload 'w3m-bookmark-view "w3m" nil t) +(autoload 'w3m-goto-url "w3m" nil t) (load (expand-file-name "~/.emacs.d/site-lisp/loaddefs.el")) diff --git a/.emacs.d/snippets/python-mode/Makefile b/.emacs.d/snippets/python-mode/Makefile new file mode 100644 index 0000000..192657b --- /dev/null +++ b/.emacs.d/snippets/python-mode/Makefile @@ -0,0 +1,4 @@ +DESTDIR:=$(DESTDIR)/python-mode +objects=defm_empty form form_valid import_from permission_guard url + +include ../../../dotfiles.mk diff --git a/.emacs.d/snippets/python-mode/defm_empty b/.emacs.d/snippets/python-mode/defm_empty new file mode 100644 index 0000000..baa976e --- /dev/null +++ b/.emacs.d/snippets/python-mode/defm_empty @@ -0,0 +1,7 @@ +# -*- coding: utf-8 -*- +# name: Empty Defmethod +# key: defm +# -- +def ${1:name}(self, *args, **kwargs): + '''$2''' + return super(${3:`(progn (re-search-backward "^[ \t]*class \\(.+\\)(") (match-string 1)))`}, self).$1(*args, **kwargs) \ No newline at end of file diff --git a/.emacs.d/snippets/python-mode/form b/.emacs.d/snippets/python-mode/form new file mode 100644 index 0000000..225d5e4 --- /dev/null +++ b/.emacs.d/snippets/python-mode/form @@ -0,0 +1,9 @@ +# -*- mode: snippet -*- +# name: Model Form +# key: form +# -- +class ${1:Model}Form(forms.ModelForm): + '''Form for the $1 model.''' + + class Meta: + model = $1 \ No newline at end of file diff --git a/.emacs.d/snippets/python-mode/form_valid b/.emacs.d/snippets/python-mode/form_valid new file mode 100644 index 0000000..c5a7e58 --- /dev/null +++ b/.emacs.d/snippets/python-mode/form_valid @@ -0,0 +1,8 @@ +# -*- mode: snippet -*- +# name: Record form +# key: defm +# -- +@record_activity(model=${1:`(progn (re-search-backward "^[ \t]*model = \\([a-zA-Z_].*\\)$") (match-string 1))`}) +def form_valid(self, form): + '''Make sure any changes to the $1 model get logged.''' + return super(${2:`(progn (re-search-backward "^[ \t]*class \\(.+\\)(") (match-string 1)))`}, self).form_valid(form) \ No newline at end of file diff --git a/.emacs.d/snippets/python-mode/import_from b/.emacs.d/snippets/python-mode/import_from new file mode 100644 index 0000000..5c23b8e --- /dev/null +++ b/.emacs.d/snippets/python-mode/import_from @@ -0,0 +1,6 @@ +# -*- coding: utf-8 -*- +# name: from ... import ... +# contributor: Tom Willemsen +# key: from +# -- +from ${1:module} import ${2:class_or_module} \ No newline at end of file diff --git a/.emacs.d/snippets/python-mode/permission_guard b/.emacs.d/snippets/python-mode/permission_guard new file mode 100644 index 0000000..ab53895 --- /dev/null +++ b/.emacs.d/snippets/python-mode/permission_guard @@ -0,0 +1,9 @@ +# -*- mode: snippet -*- +# name: Permission guard +# key: defm +# -- +@method_decorator(permission_required('$1', + raise_exception=True)) +def dispatch(self, *args, **kwargs): + '''Make sure the user has the $1 permission.''' + return super(${3:`(progn (re-search-backward "^[ \t]*class \\(.+\\)(") (match-string 1)))`}, self).dispatch(*args, **kwargs) \ No newline at end of file diff --git a/.emacs.d/snippets/python-mode/url b/.emacs.d/snippets/python-mode/url new file mode 100644 index 0000000..00ade72 --- /dev/null +++ b/.emacs.d/snippets/python-mode/url @@ -0,0 +1,5 @@ +# -*- mode: snippet -*- +# name: url +# key: url +# -- +url(r'^$1', $2, name='$3'), \ No newline at end of file -- cgit v1.2.3-54-g00ecf From 71eaad34461d26c7f108096028c6ed86d9675518 Mon Sep 17 00:00:00 2001 From: Tom Willemsen Date: Fri, 28 Dec 2012 01:58:05 +0100 Subject: Emacs: Reset buffer display Having everything show up in the same buffer is unpleasant, the correct situation should be determined per-buffer. --- .emacs.d/init.el | 3 --- 1 file changed, 3 deletions(-) (limited to '.emacs.d/init.el') diff --git a/.emacs.d/init.el b/.emacs.d/init.el index dd679c9..9a60b81 100644 --- a/.emacs.d/init.el +++ b/.emacs.d/init.el @@ -397,9 +397,6 @@ (add-to-list 'debug-ignored-errors "^Can't shift all lines enough") -(add-to-list - 'display-buffer-alist - '(".*" . ((display-buffer-same-window . nil)))) (add-to-list 'display-buffer-alist '("^\\*git-project-list\\*$" . ((git-project-show-window . nil)))) -- cgit v1.2.3-54-g00ecf From d29d60a99835ca3f705ac12d0bcfa40df530ddc2 Mon Sep 17 00:00:00 2001 From: Tom Willemsen Date: Fri, 28 Dec 2012 01:58:23 +0100 Subject: Emacs: set-up auto-complete default config --- .emacs.d/init.el | 1 + 1 file changed, 1 insertion(+) (limited to '.emacs.d/init.el') diff --git a/.emacs.d/init.el b/.emacs.d/init.el index 9a60b81..1e5b60b 100644 --- a/.emacs.d/init.el +++ b/.emacs.d/init.el @@ -442,6 +442,7 @@ (server-start)) (diminish 'auto-fill-function "_") +(ac-config-default) (provide 'init) -- cgit v1.2.3-54-g00ecf From eda4b0c1ef424a8929e287d717e9cd76496f56ad Mon Sep 17 00:00:00 2001 From: Tom Willemsen Date: Fri, 28 Dec 2012 11:24:28 +0100 Subject: Emacs: Show magit main window in current window --- .emacs.d/init.el | 3 +++ 1 file changed, 3 insertions(+) (limited to '.emacs.d/init.el') diff --git a/.emacs.d/init.el b/.emacs.d/init.el index 1e5b60b..fb7e975 100644 --- a/.emacs.d/init.el +++ b/.emacs.d/init.el @@ -400,6 +400,9 @@ (add-to-list 'display-buffer-alist '("^\\*git-project-list\\*$" . ((git-project-show-window . nil)))) +(add-to-list + 'display-buffer-alist + '("^\\*magit: .*\\*$" . ((display-buffer-same-window . nil)))) (unless (oni:required-packages-installed-p) (message "%s" "Refreshing package database...") -- cgit v1.2.3-54-g00ecf From 0cceaba810bd354c46902f0b9a7da021a6c89e10 Mon Sep 17 00:00:00 2001 From: Tom Willemsen Date: Sun, 30 Dec 2012 02:29:08 +0100 Subject: Emacs: Stop using ido-ubiquitous It was starting to get in the way too much, try icomplete-mode instead. --- .emacs.d/init.el | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to '.emacs.d/init.el') diff --git a/.emacs.d/init.el b/.emacs.d/init.el index fb7e975..d1e8c50 100644 --- a/.emacs.d/init.el +++ b/.emacs.d/init.el @@ -247,7 +247,6 @@ (setq ido-default-buffer-method 'selected-window) (setq ido-max-window-height 1) (setq ido-save-directory-list-file nil) -(setq ido-ubiquitous-command-exceptions '(oni:view-mail tmm-menubar)) (setq inferior-lisp-program "sbcl") (setq inhibit-default-init t) (setq inhibit-local-menu-bar-menus t) @@ -425,9 +424,9 @@ (electric-indent-mode) (electric-pair-mode) (ido-mode) -(ido-ubiquitous-mode) (savehist-mode) (show-paren-mode) +(icomplete-mode) (smex-initialize) (help-at-pt-set-timer) -- cgit v1.2.3-54-g00ecf From 5b4684f3356b0394925b2f783e5e98f0632012c1 Mon Sep 17 00:00:00 2001 From: Tom Willemsen Date: Thu, 3 Jan 2013 23:55:57 +0100 Subject: Emacs: Start with literate configuration again --- .emacs.d/init.el | 40 +------ .emacs.d/init.org | 315 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 316 insertions(+), 39 deletions(-) create mode 100644 .emacs.d/init.org (limited to '.emacs.d/init.el') diff --git a/.emacs.d/init.el b/.emacs.d/init.el index d1e8c50..e0e73f1 100644 --- a/.emacs.d/init.el +++ b/.emacs.d/init.el @@ -6,45 +6,7 @@ ;;; Code: -(eval-and-compile - (package-initialize) - - (mapc #'(lambda (directory) - (add-to-list 'load-path directory) - (let ((default-directory directory)) - (normal-top-level-add-subdirs-to-load-path))) - '("/usr/share/emacs/site-lisp" "~/.emacs.d/site-lisp" - "/usr/local/emacs/share/emacs/site-lisp")) - (mapc #'(lambda (directory) - (add-to-list 'load-path directory) - (let ((loaddefs (concat directory "/loaddefs.el"))) - (when (file-exists-p loaddefs) - (load loaddefs)))) - '("~/var/src/emacs/dispass.el" "~/var/src/emacs/mode-icons")) - (mapc #'(lambda (dir) - (add-to-list 'custom-theme-load-path dir)) - '("~/var/src/emacs/yoshi-theme"))) - -(require 'auto-complete-config) -(require 'ext) -(require 'geiser-install) -(require 'oni) -(require 'uniquify) - -(autoload 'define-slime-contrib "slime") -(autoload 'gtags-mode "gtags" nil t) -(autoload 'jabber-connect "jabber" nil t) -(autoload 'php-mode "php-mode" nil t) -(autoload 'po-mode "po-mode" nil t) -(autoload 'pony-mode "pony-mode" nil t) -(autoload 'sawfish-mode "sawfish" nil t) -(autoload 'server-running-p "server") -(autoload 'slime-js-minor-mode "slime-js" nil t) -(autoload 'xmodmap-mode "xmodmap-mode" nil t) -(autoload 'w3m-bookmark-view "w3m" nil t) -(autoload 'w3m-goto-url "w3m" nil t) - -(load (expand-file-name "~/.emacs.d/site-lisp/loaddefs.el")) +(load (concat user-emacs-directory "init2")) (define-key key-translation-map (kbd "C-j") (kbd "C-l")) (define-key key-translation-map (kbd "C-l") (kbd "C-j")) diff --git a/.emacs.d/init.org b/.emacs.d/init.org new file mode 100644 index 0000000..2041f5a --- /dev/null +++ b/.emacs.d/init.org @@ -0,0 +1,315 @@ +#+TITLE: Emacs init +#+STYLE: +#+OPTIONS: author:nil + +* Startup + + Startup requires a bit of customization to handle all my + customizations. + +** Load paths + + I have two versions of Emacs installed on my main computer. I have + a daily build of Emacs's ~trunk~ (or currently ~emacs-24~) branch from + bazaar and I have the official ~emacs~ package from archlinux + installed. I keep that second one around so that the occasional + emacs package that I install using ~pacman~ will recognize it as a + dependency and so that if there has been some horrible mistake in + the ~trunk~ branch I still have a stable version to fall back + on[fn:1]. + +*** Package initialization + + In order for packages installed through ELPA to be included + without having to mess with load paths and such, use: + + #+NAME: package-initialize + #+BEGIN_SRC emacs-lisp + (package-initialize) + #+END_SRC + +*** site-lisp + + Because of the setup I wrote about I need to have both the + self-built ~site-lisp~ directory in my load path *and* the "official" + one. + + #+NAME: load-site-lisps + #+BEGIN_SRC emacs-lisp + (mapc #'oni:add-all-to-load-path + '("/usr/share/emacs/site-lisp" + "/usr/local/emacs/share/emacs/site-lisp")) + #+END_SRC + + The =oni:add-all-to-load-path= function just binds =default-directory= + to the given directory and calls + =normal-top-level-add-subdirs-to-load-path= to add it and all its + subdirectories to the load path. + + #+NAME: add-all + #+BEGIN_SRC emacs-lisp + (defun oni:add-all-to-load-path (dir) + (add-to-list 'load-path dir) + (let ((default-directory dir)) + (normal-top-level-add-subdirs-to-load-path))) + #+END_SRC + +**** TODO Add load paths in different order depending on version + + The officially installed version should load + =/usr/share/emacs/site-lisp= before + =/usr/local/emacs/share/emacs/sit-lisp= and the bzr version should + do the reversed. + +*** Projects + + Then there are some projects I'm working on, which I use on a + daily basis, these should also be added so I don't have to + constantly remove and re-install them through ~package.el~ when + working on them. And there is the ~load-defs.el~ in my personal + ~site-lisp~ directory of course. + + #+NAME: load-projects + #+BEGIN_SRC emacs-lisp + (mapc #'oni:add-to-load-path-maybe-load-defs + '("~/projects/emacs/dispass.el" "~/var/src/emacs/mode-icons" + "~/.emacs.d/site-lisp")) + #+END_SRC + + The =oni:add-to-load-path-maybe-load-defs= function just adds the + given directory to the load path and then looks for a file named + ~loaddefs.el~ within that directory, if it exists it loads it. + + #+NAME: add-with-loaddefs + #+BEGIN_SRC emacs-lisp + (defun oni:add-to-load-path-maybe-load-defs (dir) + (add-to-list 'load-path dir) + (let ((loaddefs (concat dir "/loaddefs.el"))) + (when (file-exists-p loaddefs) + (load loaddefs)))) + #+END_SRC + +*** Themes + + And, finally, I'm also working on a color theme for emacs, this + should be added to ~custom-theme-load-path~. By using =mapc= here as + well I'm keeping in mind that this isn't the first theme I've + worked on and it might not be the last either. + + #+NAME: load-themes + #+BEGIN_SRC emacs-lisp + (mapc #'oni:add-to-custom-theme-load-path + '("~/projects/emacs/yoshi-theme")) + #+END_SRC + + The =oni:add-to-custom-theme-load-path= just adds the given + directory to the cutom theme load path. + + #+NAME: add-themes + #+BEGIN_SRC emacs-lisp + (defun oni:add-to-custom-theme-load-path (dir) + (add-to-list 'custom-theme-load-path dir)) + #+END_SRC + +*** Evaluation + + Because during byte-compilation certain parts loaded so far might + also be required I put it in an =eval-and-compile= form, so that all + components are loaded with ~emacs -Q~ as well. Without this + compilation might fail at certain points. + + #+BEGIN_SRC emacs-lisp :tangle init2.el :noweb yes + (eval-and-compile + <> + + <> + + <> + + <> + <> + <> + <>) + #+END_SRC + +** Modules + + While I try to use =eval-after-load= and =autoload= as much as + possible, some things require direct =require='ing to be of use. + +*** Require + + - ~auto-complete-config~ :: This sets up some default settings to + make ~auto-complete~ work for most[fn:2] of the modes it + supports. + + #+BEGIN_SRC emacs-lisp :tangle init2.el + (require 'auto-complete-config) + #+END_SRC + + - ~geiser-install~ :: Sets up geiser autoloads and such. + + #+BEGIN_SRC emacs-lisp :tangle init2.el + (require 'geiser-install) + #+END_SRC + + - ~uniquify~ :: Provides more helpful buffer name uniquification. + The default of using ~buffer-name<2>~ is boring and + uninformative, ~uniquify~ fixes this. + + #+BEGIN_SRC emacs-lisp :tangle init2.el + (require 'uniquify) + #+END_SRC + + - ~ext~ :: Functions from external sources. + - ~oni~ :: Functions written personally. + + #+BEGIN_SRC emacs-lisp :tangle init2.el + (require 'ext) + (require 'oni) + #+END_SRC + +*** Autoload + + These might not be used at all in a session, so they should only + be loaded when necessary. + + =define-slime-contrib= was used by some module that didn't autoload + or require it[fn:3]. But since I don't use whichever model it + was every day, it is of no use to load it every single time. + + #+BEGIN_SRC emacs-lisp :tangle init2.el + (autoload 'define-slime-contrib "slime") + #+END_SRC + + I installed ~global~ with ~pacman~, but this doesn't add anything to + any =loaddefs.el=, so doesn't create any autoloads. + + #+BEGIN_SRC emacs-lisp :tangle init2.el + (autoload 'gtags-mode "gtags" nil t) + #+END_SRC + + ~jabber.el~ does create ~jabber-autoloads.el~, but I only ever start + using it through ~jabber-connect~, so anything else isn't really + necessary. + + #+BEGIN_SRC emacs-lisp :tangle init2.el + (autoload 'jabber-connect "jabber" nil t) + #+END_SRC + + I used to work a bit on ~php-mode~, but that was a while ago, so + it's still in my ~site-lisp~ directory. + + #+BEGIN_SRC emacs-lisp :tangle init2.el + (autoload 'php-mode "php-mode" nil t) + #+END_SRC + + The same that goes for ~gtags.el~ also goes for ~po-mode.el~. + + #+BEGIN_SRC emacs-lisp :tangle init2.el + (autoload 'po-mode "po-mode" nil t) + #+END_SRC + + And the same that went for ~php-mode~ also goes for ~pony-mode~, + except I'm still working on it and I was too lazy to put it with + my other projects. I should still do that. + + #+BEGIN_SRC emacs-lisp :tangle init2.el + (autoload 'pony-mode "pony-mode" nil t) + #+END_SRC + + ~sawfish.el~ has the same problem that ~gtags.el~ and ~po-mode.el~ have. + + #+BEGIN_SRC emacs-lisp :tangle init2.el + (autoload 'sawfish-mode "sawfish" nil t) + #+END_SRC + + I use =server-running-p= to check whether or not I should start a + new server, but this function isn't autoloaded by default. + + #+BEGIN_SRC emacs-lisp :tangle init2.el + (autoload 'server-running-p "server") + #+END_SRC + + I was starting to try ~slime-js~ to make JavaScript programming + more interesting, but I haven't gotten around to trying it out + fully, yet. It shares issues with ~gtags.el~, ~po-mode.el~ and + ~sawfish.el~. + + #+BEGIN_SRC emacs-lisp :tangle init2.el + (autoload 'slime-js-minor-mode "slime-js" nil t) + #+END_SRC + + I found ~xmodmap-mode~ on the [[http://emacswiki.org][EmacsWiki]] some time ago, it was + simple and a good example of how to use ~define-generic-mode~, but + since it's not really my project and it's really small it just + sits in my ~site-lisp~ directory. + + #+BEGIN_SRC emacs-lisp :tangle init2.el + (autoload 'xmodmap-mode "xmodmap-mode" nil t) + #+END_SRC + + ~w3m~ also has a setup module like ~geiser-install~, but since I only + ever use these two functions to start it, there is no real need + for anything else. + + #+BEGIN_SRC emacs-lisp :tangle init2.el + (autoload 'w3m-bookmark-view "w3m" nil t) + (autoload 'w3m-goto-url "w3m" nil t) + #+END_SRC + +* Aliases + + There are some functions that are just better than others, no + matter how politically incorrect it might be to admit. + + #+BEGIN_SRC emacs-lisp :tangle init2.el + (defalias 'yes-or-no-p 'y-or-n-p) + (defalias 'list-buffers 'ibuffer) + (defalias 'dabbrev-expand 'hippie-expand) + #+END_SRC + +* Faces + + Define faces for use with ~magit~ log edit mode. + + #+BEGIN_SRC emacs-lisp :tangle init2.el + (defface git-commit-summary-face + '((t (:inherit org-level-1))) + "Face for the git title line." + :group 'local) + + (defface git-commit-overlong-summary-face + '((t (:background "#873732"))) + "Face for commit titles that are too long." + :group 'local) + + (defface git-commit-nonempty-second-line-face + '((t (:inherit git-commit-overlong-summary-face))) + "Face for the supposedly empty line in commit messages." + :group 'local) + #+END_SRC + +* Keys + + With the awesome power of Emacs comes the need for lots of + keybindings. + +** Translation + + Since the ~C-l~ combination is so much easier than ~C-j~ when using + the [[http://colemak.com][colemak]] keyboard layout and ~C-j~ is used so much more, switch + them. + + #+BEGIN_SRC emacs-lisp tangle init2.el + (define-key key-translation-map (kbd "C-j") (kbd "C-l")) + (define-key key-translation-map (kbd "C-l") (kbd "C-j")) + #+END_SRC +* Footnotes + +[fn:1] Though it doesn't happen often that ~trunk~ is so messed up that +I can't use it. + +[fn:2] Or perhaps all. + +[fn:3] I think it was ~slime-js-minor-mode~, but I'm not sure. -- cgit v1.2.3-54-g00ecf From 8e738db1faaa291b277e9cb84727ead4d51f3828 Mon Sep 17 00:00:00 2001 From: Tom Willemsen Date: Thu, 3 Jan 2013 23:59:26 +0100 Subject: Emacs: Some mode changes * .emacs.d/init.el: Reorder modes. Start using `winner-mode' again and once more prefer `ido-ubiquitous' over `icomplete-mode'. `icomplete-mode' tends to get messy. --- .emacs.d/init.el | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to '.emacs.d/init.el') diff --git a/.emacs.d/init.el b/.emacs.d/init.el index e0e73f1..44731de 100644 --- a/.emacs.d/init.el +++ b/.emacs.d/init.el @@ -375,20 +375,21 @@ oni:required-packages)) (blink-cursor-mode -1) +(column-number-mode -1) +(line-number-mode -1) (menu-bar-mode -1) (scroll-bar-mode -1) (tool-bar-mode -1) (tooltip-mode -1) -(line-number-mode -1) -(column-number-mode -1) (auto-insert-mode) (electric-indent-mode) (electric-pair-mode) (ido-mode) +(ido-ubiquitous-mode) (savehist-mode) (show-paren-mode) -(icomplete-mode) +(winner-mode) (smex-initialize) (help-at-pt-set-timer) -- cgit v1.2.3-54-g00ecf From 241374103f698eaa75220647753cf48792adf7f3 Mon Sep 17 00:00:00 2001 From: Tom Willemsen Date: Fri, 4 Jan 2013 00:00:08 +0100 Subject: Emacs: don't use ido for `org-refile' It doesn't work... --- .emacs.d/init.el | 1 + 1 file changed, 1 insertion(+) (limited to '.emacs.d/init.el') diff --git a/.emacs.d/init.el b/.emacs.d/init.el index 44731de..f8c32bb 100644 --- a/.emacs.d/init.el +++ b/.emacs.d/init.el @@ -209,6 +209,7 @@ (setq ido-default-buffer-method 'selected-window) (setq ido-max-window-height 1) (setq ido-save-directory-list-file nil) +(setq ido-ubiquitous-command-exceptions '(org-refile)) (setq inferior-lisp-program "sbcl") (setq inhibit-default-init t) (setq inhibit-local-menu-bar-menus t) -- cgit v1.2.3-54-g00ecf From 4cf76b65c14060b60804ac119cbf91f779bc2e55 Mon Sep 17 00:00:00 2001 From: Tom Willemsen Date: Fri, 4 Jan 2013 00:00:37 +0100 Subject: Emacs: Stay true to 80 columns, even with lisp --- .emacs.d/init.el | 3 --- .emacs.d/site-lisp/oni.el | 5 ----- 2 files changed, 8 deletions(-) (limited to '.emacs.d/init.el') diff --git a/.emacs.d/init.el b/.emacs.d/init.el index f8c32bb..2b32682 100644 --- a/.emacs.d/init.el +++ b/.emacs.d/init.el @@ -273,7 +273,6 @@ (add-hook 'css-mode-hook 'oni:css-mode-func) (add-hook 'diary-display-hook 'oni:diary-display-func) (add-hook 'emacs-lisp-mode-hook 'oni:emacs-lisp-mode-func) -(add-hook 'emacs-lisp-mode-hook 'oni:generic-lisp-mode-hook) (add-hook 'erc-mode-hook 'oni:erc-mode-func) (add-hook 'eshell-mode-hook 'oni:eshell-mode-func) (add-hook 'flymake-mode-hook 'oni:flymake-mode-func) @@ -286,7 +285,6 @@ (add-hook 'java-mode-hook 'oni:java-mode-func) (add-hook 'js-mode-hook 'oni:js-mode-func) (add-hook 'js2-mode-hook 'oni:js2-mode-func) -(add-hook 'lisp-mode-hook 'oni:generic-lisp-mode-hook) (add-hook 'lua-mode-hook 'oni:lua-mode-func) (add-hook 'magit-log-edit-mode-hook 'oni:magit-log-edit-mode-func) (add-hook 'markdown-mode-hook 'oni:markdown-mode-func) @@ -296,7 +294,6 @@ (add-hook 'prog-mode-hook 'oni:prog-mode-func) (add-hook 'python-mode-hook 'oni:python-mode-func) (add-hook 'rst-mode-hook 'oni:rst-mode-func) -(add-hook 'scheme-mode-hook 'oni:generic-lisp-mode-hook) (add-hook 'term-mode-hook 'oni:term-mode-func) (add-hook 'texinfo-mode-hook 'oni:texinfo-mode-func) (add-hook 'write-file-hooks 'oni:write-file-func) diff --git a/.emacs.d/site-lisp/oni.el b/.emacs.d/site-lisp/oni.el index f461bab..79b5f6e 100644 --- a/.emacs.d/site-lisp/oni.el +++ b/.emacs.d/site-lisp/oni.el @@ -179,11 +179,6 @@ DOT are intentionally being skipped." (local-set-key [M-P] 'flymake-goto-prev-error) (local-set-key [M-N] 'flymake-goto-next-error)) -(defun oni:generic-lisp-mode-hook () - "Function for `emacs-lisp-mode-hook', `lisp-mode-hook' and -`scheme-mode-hook'." - (setq fci-rule-column 101)) - (defun oni:go-mode-func () "Function for `go-mode-hook'." (setq indent-tabs-mode nil) -- cgit v1.2.3-54-g00ecf From 454f5cd77ebdd321e47af602a55828d5962986a2 Mon Sep 17 00:00:00 2001 From: Tom Willemsen Date: Fri, 4 Jan 2013 00:01:08 +0100 Subject: Emacs: Show any scratch buffers in current window --- .emacs.d/init.el | 3 +++ 1 file changed, 3 insertions(+) (limited to '.emacs.d/init.el') diff --git a/.emacs.d/init.el b/.emacs.d/init.el index 2b32682..f49748f 100644 --- a/.emacs.d/init.el +++ b/.emacs.d/init.el @@ -356,6 +356,9 @@ (add-to-list 'debug-ignored-errors "^Can't shift all lines enough") +(add-to-list + 'display-buffer-alist + '("^\\*\\(?:.+-\\)?scratch\\*$" . ((display-buffer-same-window . nil)))) (add-to-list 'display-buffer-alist '("^\\*git-project-list\\*$" . ((git-project-show-window . nil)))) -- cgit v1.2.3-54-g00ecf From a13dbcec8da7e9b06e0ca3a1d3ee6760686e38e6 Mon Sep 17 00:00:00 2001 From: Tom Willemsen Date: Fri, 4 Jan 2013 00:01:29 +0100 Subject: Emacs: Don't load rudel for now I haven't used it in a while anyway... --- .emacs.d/init.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to '.emacs.d/init.el') diff --git a/.emacs.d/init.el b/.emacs.d/init.el index f49748f..cd9c9b5 100644 --- a/.emacs.d/init.el +++ b/.emacs.d/init.el @@ -398,7 +398,7 @@ (load-theme 'yoshi t) (load custom-file) -(load "rudel-loaddefs.el") +;; (load "rudel-loaddefs.el") (load (expand-file-name "~/quicklisp/slime-helper.el")) (load "quick-edit-mode") -- cgit v1.2.3-54-g00ecf