2013-01-03 23:55:57 +01:00
|
|
|
#+TITLE: Emacs init
|
2013-01-25 00:32:30 +01:00
|
|
|
#+LINK: yoshi-theme http://ryuslash.org/projects/yoshi-theme.html
|
2013-02-20 00:06:06 +01:00
|
|
|
#+OPTIONS: author:nil num:nil
|
2013-02-17 23:41:54 +01:00
|
|
|
#+PROPERTY: tangle init2.el
|
2013-02-20 00:06:06 +01:00
|
|
|
#+STARTUP: showall
|
2013-01-03 23:55:57 +01:00
|
|
|
|
2013-03-22 13:34:32 +01:00
|
|
|
Disable the ~menu-bar-mode~, ~tool-bar-mode~ and ~scroll-bar-mode~ early on
|
|
|
|
so the disappear quickly after emacs starts up.
|
|
|
|
|
|
|
|
#+BEGIN_SRC emacs-lisp
|
|
|
|
(menu-bar-mode -1)
|
|
|
|
(scroll-bar-mode -1)
|
|
|
|
(tool-bar-mode -1)
|
|
|
|
#+END_SRC
|
|
|
|
|
|
|
|
Define a macro for deferring code until after emacs has started up.
|
|
|
|
|
|
|
|
#+BEGIN_SRC emacs-lisp
|
|
|
|
(defmacro eval-after-init (&rest body)
|
|
|
|
"Defer execution of BODY until after Emacs init."
|
|
|
|
`(add-hook 'emacs-startup-hook #'(lambda () ,@body)))
|
|
|
|
#+END_SRC
|
|
|
|
|
|
|
|
Add ~/usr/share/emacs/site-lisp~ and
|
|
|
|
~/usr/local/emacs/share/emacs/site-lisp~ and all their sub-directories
|
|
|
|
to the ~load-path~ so I can use modules from both Emacs from the
|
|
|
|
official repository *and* the self-compiled one.
|
|
|
|
|
|
|
|
This should be done both when compiling the elisp file and when
|
|
|
|
loading it so it doesn't complain about missing modules and such.
|
|
|
|
|
|
|
|
#+BEGIN_SRC emacs-lisp
|
|
|
|
(eval-and-compile
|
|
|
|
(defun oni:path-init (dir)
|
|
|
|
"Add DIR to `load-path' and all its subdirectories, unless
|
|
|
|
DIR is already in `load-path'."
|
|
|
|
(unless (or (member dir load-path) (not (file-exists-p dir)))
|
|
|
|
(let ((default-directory dir))
|
|
|
|
(add-to-list 'load-path dir t)
|
|
|
|
(normal-top-level-add-subdirs-to-load-path))))
|
|
|
|
(oni:path-init "/usr/share/emacs/site-lisp")
|
|
|
|
(oni:path-init "/usr/local/emacs/share/emacs/site-lisp"))
|
|
|
|
#+END_SRC
|
|
|
|
|
|
|
|
Defer loading my theme until after emacs initialization. This is
|
|
|
|
because it has been installed with ~package.el~, and the packages aren't
|
|
|
|
added to the ~load-path~ until _after_ ~init.el~ has been run through.
|
|
|
|
|
|
|
|
#+BEGIN_SRC emacs-lisp
|
|
|
|
(eval-after-init (load-theme 'yoshi t))
|
|
|
|
#+END_SRC
|
|
|
|
|
|
|
|
Add some of my project directories and other important directories
|
|
|
|
into ~load-path~ so I can easily load libraries in them. Also, if it
|
|
|
|
exists, load ~loaddefs.el~ in each directory for autoloads.
|
|
|
|
|
|
|
|
#+BEGIN_SRC emacs-lisp
|
|
|
|
(mapc #'(lambda (dir)
|
|
|
|
(add-to-list 'load-path dir)
|
|
|
|
(let ((loaddefs (concat dir "/loaddefs.el")))
|
|
|
|
(when (file-exists-p loaddefs)
|
|
|
|
(load loaddefs))))
|
|
|
|
'("~/projects/emacs/mode-icons" "~/.emacs.d/site-lisp"
|
|
|
|
"~/projects/emacs/pony-mode/src" "~/projects/emacs/php-mode"
|
|
|
|
"/usr/local/org-mode/share/emacs/site-lisp/org"))
|
|
|
|
#+END_SRC
|
|
|
|
|
|
|
|
Replace the question of ~yes~ or ~no~ with just ~y~ or ~n~, I have never (yet)
|
|
|
|
accidentally typed a ~y~ or ~n~ when asked and typing ~yes~ or ~no~ is just
|
|
|
|
too much work.
|
|
|
|
|
|
|
|
#+BEGIN_SRC emacs-lisp
|
|
|
|
(defalias 'yes-or-no-p 'y-or-n-p)
|
|
|
|
#+END_SRC
|
|
|
|
|
|
|
|
Replace these functions with better alternatives. They offer the same
|
|
|
|
functionality, plus more.
|
|
|
|
|
|
|
|
#+BEGIN_SRC emacs-lisp
|
|
|
|
(defalias 'list-buffers 'ibuffer)
|
|
|
|
(defalias 'dabbrev-expand 'hippie-expand)
|
|
|
|
#+END_SRC
|
|
|
|
|
|
|
|
#+BEGIN_SRC emacs-lisp
|
|
|
|
(setq compilation-scroll-output t)
|
|
|
|
#+END_SRC
|
2013-02-02 00:56:15 +01:00
|
|
|
|
2013-02-17 22:53:36 +01:00
|
|
|
* flymake
|
|
|
|
|
2013-02-02 01:08:59 +01:00
|
|
|
Load ~flymake-cursor~ after loading ~flymake~, add Python and Go to
|
|
|
|
"allowed" files and add go error output to error patterns.
|
|
|
|
|
2013-02-17 23:41:54 +01:00
|
|
|
#+BEGIN_SRC emacs-lisp
|
2013-02-02 01:08:59 +01:00
|
|
|
(defun oni:flymake-init ()
|
|
|
|
"Initialization function for flymake."
|
|
|
|
(require 'flymake-cursor)
|
|
|
|
|
|
|
|
(add-to-list ; Make sure pyflakes is loaded
|
|
|
|
'flymake-allowed-file-name-masks ; for python files.
|
|
|
|
'("\\.py\\'" ext:flymake-pyflakes-init))
|
|
|
|
|
|
|
|
(add-to-list ; Error line repexp for go
|
|
|
|
'flymake-err-line-patterns ; compilation.
|
|
|
|
'("^\\([a-zA-Z0-9_]+\\.go\\):\\([0-9]+\\):\\(.*\\)$"
|
|
|
|
1 2 nil 3))
|
|
|
|
|
|
|
|
(add-to-list ; Go uses makefiles, makes
|
|
|
|
'flymake-allowed-file-name-masks ; flymaking 'easy'.
|
|
|
|
'("\\.go$" flymake-simple-make-init)))
|
|
|
|
|
|
|
|
(eval-after-load "flymake" '(oni:flymake-init))
|
|
|
|
#+END_SRC
|
|
|
|
|
2013-02-17 23:09:46 +01:00
|
|
|
Disable the GUI for flymake errors. This causes the flymake errors
|
|
|
|
to be shown in the minibuffer.
|
2013-02-02 01:08:59 +01:00
|
|
|
|
2013-02-17 23:41:54 +01:00
|
|
|
#+BEGIN_SRC emacs-lisp
|
2013-02-02 01:08:59 +01:00
|
|
|
(setq flymake-gui-warnings-enabled nil)
|
2013-02-17 23:09:46 +01:00
|
|
|
#+END_SRC
|
|
|
|
|
|
|
|
Add a bunch of pep8, flymake and pyflakes messages to warning and
|
|
|
|
info patterns, set the log file to somewhere in my home directory
|
|
|
|
and set logging level to 0.
|
|
|
|
|
2013-02-17 23:41:54 +01:00
|
|
|
#+BEGIN_SRC emacs-lisp
|
2013-02-02 01:08:59 +01:00
|
|
|
(setq flymake-info-line-regexp
|
|
|
|
(eval-when-compile
|
|
|
|
(regexp-opt
|
|
|
|
'("Invalid name"
|
|
|
|
"String statement has no effect"
|
|
|
|
"Missing docstring"
|
|
|
|
"Empty docstring"
|
|
|
|
"multiple imports on one line"
|
|
|
|
"expected 2 blank lines, found 1"
|
|
|
|
"expected 2 blank lines, found 0"
|
|
|
|
"TODO:"
|
|
|
|
"whitespace after '{'"
|
|
|
|
"whitespace before '}'"
|
|
|
|
"whitespace before ':'"
|
|
|
|
"whitespace after '('"
|
|
|
|
"whitespace before ')'"
|
|
|
|
"whitespace after '['"
|
|
|
|
"whitespace before ']'"
|
|
|
|
"the backslash is redundant between brackets"
|
|
|
|
"continuation line over-indented for visual indent"
|
|
|
|
"continuation line under-indented for visual indent"
|
|
|
|
"Too many statements"
|
|
|
|
"comparison to None should be"
|
|
|
|
"missing whitespace around operator"
|
|
|
|
"missing whitespace after ','"
|
|
|
|
"line too long"
|
|
|
|
"at least two spaces before inline comment"
|
|
|
|
"trailing whitespace"
|
|
|
|
"imported but unused"
|
|
|
|
"Unused import"
|
|
|
|
"too many blank lines"))))
|
|
|
|
(setq flymake-log-file-name (expand-file-name "~/.emacs.d/flymake.log"))
|
|
|
|
(setq flymake-log-level 0)
|
|
|
|
(setq flymake-warn-line-regexp
|
|
|
|
(eval-when-compile
|
|
|
|
(regexp-opt '("warning"
|
|
|
|
"Warning"
|
|
|
|
"redefinition of unused"
|
|
|
|
"Redefining built-in"
|
|
|
|
"Redefining name"
|
|
|
|
"Unused argument"
|
|
|
|
"Unused variable"
|
|
|
|
"Dangerous default value {} as argument"
|
|
|
|
"no newline at end of file"
|
|
|
|
"Access to a protected member"))))
|
|
|
|
#+END_SRC
|
|
|
|
|
2013-02-17 22:53:36 +01:00
|
|
|
* flycheck
|
|
|
|
|
2013-02-06 11:48:18 +01:00
|
|
|
After loading ~flycheck~ Remove the default python checkers and
|
|
|
|
replace them with my own, which tries both ~flake8~ and ~pylint~.
|
|
|
|
|
2013-02-17 23:41:54 +01:00
|
|
|
#+BEGIN_SRC emacs-lisp
|
2013-02-06 11:48:18 +01:00
|
|
|
(eval-after-load "flycheck"
|
|
|
|
'(progn
|
|
|
|
(mapc (lambda (c) (delete c flycheck-checkers))
|
2013-02-07 10:03:30 +01:00
|
|
|
'(python-pylint python-pyflakes))))
|
2013-02-06 11:48:18 +01:00
|
|
|
#+END_SRC
|
|
|
|
|
2013-02-17 22:22:55 +01:00
|
|
|
* pretty-control-l-mode
|
2013-01-28 00:43:57 +01:00
|
|
|
|
2013-02-17 22:22:55 +01:00
|
|
|
Make the ~C-l~ look like a line of ~-~ up to =fill-column= or
|
|
|
|
=fci-rule-column= and remove the string displayed before the ~C-l~.
|
2013-01-28 00:43:57 +01:00
|
|
|
|
2013-02-17 23:41:54 +01:00
|
|
|
#+BEGIN_SRC emacs-lisp
|
2013-02-17 22:22:55 +01:00
|
|
|
(defun oni:pretty-control-l-function (win)
|
|
|
|
"Just make a string of either `fci-rule-column' or
|
|
|
|
`fill-column' length -1. Use the `-' character. WIN is ignored."
|
|
|
|
(make-string
|
|
|
|
(1- (if (boundp 'fci-rule-column)
|
|
|
|
fci-rule-column fill-column)) ?-))
|
|
|
|
|
|
|
|
(setq pp^L-^L-string-function 'oni:pretty-control-l-function)
|
|
|
|
#+END_SRC
|
2013-01-28 00:43:57 +01:00
|
|
|
|
2013-02-17 22:22:55 +01:00
|
|
|
Remove the string displayed before the ~C-l~.
|
2013-01-28 00:43:57 +01:00
|
|
|
|
2013-02-17 23:41:54 +01:00
|
|
|
#+BEGIN_SRC emacs-lisp
|
2013-02-17 22:22:55 +01:00
|
|
|
(setq pp^L-^L-string-pre nil)
|
|
|
|
#+END_SRC
|
2013-01-28 00:43:57 +01:00
|
|
|
|
2013-02-17 22:22:55 +01:00
|
|
|
Enable =pretty-control-l-mode= at startup and whenever a new frame is
|
|
|
|
created.
|
2013-01-28 00:43:57 +01:00
|
|
|
|
2013-02-17 23:41:54 +01:00
|
|
|
#+BEGIN_SRC emacs-lisp
|
2013-02-17 22:22:55 +01:00
|
|
|
(add-hook 'emacs-startup-hook 'pretty-control-l-mode)
|
|
|
|
(add-hook 'after-make-frame-functions
|
|
|
|
'(lambda (arg) (pretty-control-l-mode)))
|
|
|
|
#+END_SRC
|
2013-01-28 00:43:57 +01:00
|
|
|
|
2013-02-17 22:53:36 +01:00
|
|
|
* erc
|
|
|
|
|
|
|
|
Automatically join some channels when connecting to freenode.net.
|
|
|
|
|
2013-02-17 23:41:54 +01:00
|
|
|
#+BEGIN_SRC emacs-lisp
|
2013-02-17 22:53:36 +01:00
|
|
|
(setq erc-autojoin-channels-alist
|
|
|
|
'(("freenode.net" "#ninthfloor" "#emacs")))
|
|
|
|
#+END_SRC
|
|
|
|
|
|
|
|
Don't show ~PART~ messages.
|
|
|
|
|
2013-02-17 23:41:54 +01:00
|
|
|
#+BEGIN_SRC emacs-lisp
|
2013-02-17 22:53:36 +01:00
|
|
|
(setq erc-hide-list '("PART"))
|
|
|
|
#+END_SRC
|
|
|
|
|
|
|
|
Insert a timestamp every time a message comes in, print it on the
|
|
|
|
left and print the hour and minute parts of the time.
|
|
|
|
|
2013-02-17 23:41:54 +01:00
|
|
|
#+BEGIN_SRC emacs-lisp
|
2013-02-17 22:53:36 +01:00
|
|
|
(setq erc-insert-timestamp-function 'erc-insert-timestamp-left)
|
|
|
|
(setq erc-timestamp-format "[%H:%M] ")
|
|
|
|
(setq erc-timestamp-only-if-changed-flag nil)
|
|
|
|
#+END_SRC
|
|
|
|
|
|
|
|
Set my nickname.
|
|
|
|
|
2013-02-17 23:41:54 +01:00
|
|
|
#+BEGIN_SRC emacs-lisp
|
2013-02-17 22:53:36 +01:00
|
|
|
(setq erc-nick "ryuslash")
|
|
|
|
#+END_SRC
|
|
|
|
|
|
|
|
When starting ERC disable truncating lines, don't let ERC fill each
|
|
|
|
line and enable =visual-line-mode=.
|
|
|
|
|
2013-02-17 23:41:54 +01:00
|
|
|
#+BEGIN_SRC emacs-lisp
|
2013-02-17 22:53:36 +01:00
|
|
|
(defun oni:erc-mode-func ()
|
|
|
|
"Function for `erc-mode-hook'."
|
|
|
|
(erc-fill-mode -1)
|
|
|
|
(visual-line-mode)
|
|
|
|
(setq truncate-lines nil))
|
|
|
|
|
|
|
|
(add-hook 'erc-mode-hook 'oni:erc-mode-func)
|
|
|
|
#+END_SRC
|
|
|
|
|
|
|
|
* eshell
|
2013-01-28 00:43:57 +01:00
|
|
|
|
2013-02-17 22:22:55 +01:00
|
|
|
Add ~unison~ to the list of =eshell-visual-commands= because it
|
|
|
|
expects unbuffered input and eshell just doesn't give that.
|
2013-01-28 00:43:57 +01:00
|
|
|
|
2013-02-17 23:41:54 +01:00
|
|
|
#+BEGIN_SRC emacs-lisp
|
2013-02-17 22:22:55 +01:00
|
|
|
(eval-after-load "em-term"
|
|
|
|
'(add-to-list 'eshell-visual-commands "unison"))
|
|
|
|
#+END_SRC
|
2013-01-28 00:43:57 +01:00
|
|
|
|
2013-02-17 22:22:55 +01:00
|
|
|
Don't let eshell highlight it's prompt, this way I can decide the
|
|
|
|
colors for it myself.
|
2013-01-28 00:43:57 +01:00
|
|
|
|
2013-02-17 23:41:54 +01:00
|
|
|
#+BEGIN_SRC emacs-lisp
|
2013-02-17 22:22:55 +01:00
|
|
|
(setq eshell-highlight-prompt nil)
|
|
|
|
#+END_SRC
|
2013-01-28 00:43:57 +01:00
|
|
|
|
2013-02-17 22:22:55 +01:00
|
|
|
In the prompt:
|
2013-01-28 00:43:57 +01:00
|
|
|
|
2013-02-17 22:22:55 +01:00
|
|
|
- Show the exit status of the last program/command run represented
|
|
|
|
by a green ~+~ and a red ~-~ sign.
|
|
|
|
- Show the current hostname with the =mode-line-buffer-id= face.
|
|
|
|
- Show an abbreviation of the current directory (as seen in ~fish~)
|
|
|
|
using the =font-lock-string-face= face.
|
|
|
|
- If we're in a git repository, show the current branch with the
|
|
|
|
=font-lock-function-name-face= face.
|
|
|
|
- Show the status of priviledges in blue.
|
|
|
|
|
|
|
|
And set the =eshell-prompt-regexp= to
|
|
|
|
|
2013-02-17 23:41:54 +01:00
|
|
|
#+BEGIN_SRC emacs-lisp
|
2013-02-17 22:22:55 +01:00
|
|
|
(defun oni:eshell-prompt-function ()
|
|
|
|
"Show a pretty shell prompt."
|
|
|
|
(let ((status (if (zerop eshell-last-command-status) ?+ ?-))
|
|
|
|
(hostname (shell-command-to-string "hostname"))
|
|
|
|
(dir (abbreviate-file-name (eshell/pwd)))
|
|
|
|
(branch
|
|
|
|
(shell-command-to-string
|
|
|
|
"git branch --contains HEAD 2>/dev/null | sed -e '/^[^*]/d'"))
|
|
|
|
(userstatus (if (zerop (user-uid)) ?# ?$)))
|
|
|
|
(concat
|
|
|
|
(propertize (char-to-string status)
|
|
|
|
'face `(:foreground ,(if (= status ?+)
|
|
|
|
"green"
|
|
|
|
"red")))
|
|
|
|
" "
|
|
|
|
(propertize (substring hostname 0 -1) 'face 'mode-line-buffer-id)
|
|
|
|
" "
|
|
|
|
(propertize (oni:shorten-dir dir) 'face 'font-lock-string-face)
|
|
|
|
" "
|
|
|
|
(when (not (string= branch ""))
|
|
|
|
(propertize
|
|
|
|
;; Cut off "* " and "\n"
|
|
|
|
(substring branch 2 -1)
|
|
|
|
'face 'font-lock-function-name-face))
|
|
|
|
" \n"
|
|
|
|
(propertize (char-to-string userstatus)
|
|
|
|
'face `(:foreground "blue"))
|
|
|
|
"> ")))
|
|
|
|
|
|
|
|
(setq eshell-prompt-function 'oni:eshell-prompt-function
|
|
|
|
eshell-prompt-regexp "^[#$]> ")
|
|
|
|
#+END_SRC
|
|
|
|
|
|
|
|
Don't truncate lines in eshell, wrap them.
|
|
|
|
|
2013-02-17 23:41:54 +01:00
|
|
|
#+BEGIN_SRC emacs-lisp
|
2013-02-17 22:22:55 +01:00
|
|
|
(defun oni:eshell-mode-func ()
|
|
|
|
"Function for `eshell-mode-hook'."
|
|
|
|
(setq truncate-lines nil))
|
|
|
|
|
|
|
|
(add-hook 'eshell-mode-hook 'oni:eshell-mode-func)
|
|
|
|
#+END_SRC
|
|
|
|
|
|
|
|
Bind the ~f8~ key to easily show eshell.
|
|
|
|
|
2013-02-17 23:41:54 +01:00
|
|
|
#+BEGIN_SRC emacs-lisp
|
2013-02-17 22:22:55 +01:00
|
|
|
(defun oni:raise-eshell ()
|
|
|
|
"Start or switch back to `eshell'.
|
|
|
|
Also change directories to current working directory."
|
|
|
|
(interactive)
|
|
|
|
(let ((dir (file-name-directory
|
|
|
|
(or (buffer-file-name) "~/")))
|
|
|
|
(hasfile (not (eq (buffer-file-name) nil))))
|
|
|
|
(eshell)
|
|
|
|
(if (and hasfile (eq eshell-process-list nil))
|
|
|
|
(progn
|
|
|
|
(eshell/cd dir)
|
|
|
|
(eshell-reset)))))
|
|
|
|
|
|
|
|
(global-set-key (kbd "<f8>") 'oni:raise-eshell)
|
|
|
|
#+END_SRC
|
2013-02-20 00:06:06 +01:00
|
|
|
|
|
|
|
* svg-mode-line-themes
|
|
|
|
|
|
|
|
After Emacs has initialized, enable =svg-mode-line-themes= and select
|
|
|
|
a theme.
|
|
|
|
|
|
|
|
#+BEGIN_SRC emacs-lisp
|
2013-03-11 00:33:42 +01:00
|
|
|
(defun oni:smt/minor-mode-indicator-text (widget)
|
|
|
|
(let ((text (concat
|
|
|
|
(when (bound-and-true-p auto-complete-mode) "C")
|
|
|
|
(when (bound-and-true-p auto-fill-mode) "F")
|
|
|
|
(when (bound-and-true-p eldoc-mode) "D"))))
|
|
|
|
(if (plusp (length text))
|
|
|
|
(concat " " text)
|
|
|
|
"")))
|
|
|
|
|
2013-03-22 13:34:56 +01:00
|
|
|
(defun oni:jabber-activity (widget)
|
|
|
|
(when (boundp 'jabber-activity-mode-string)
|
|
|
|
(concat jabber-activity-mode-string " ")))
|
|
|
|
|
|
|
|
(eval-after-load "svg-mode-line-themes"
|
|
|
|
'(progn
|
|
|
|
(smt/defwidget oni:jabber-activity-widget
|
|
|
|
:text 'oni:jabber-activity)
|
|
|
|
|
|
|
|
(smt/defrow oni:default-right
|
|
|
|
:widgets '(oni:jabber-activity-widget major-mode version-control
|
|
|
|
minor-modes)
|
|
|
|
:align "right"
|
|
|
|
:margin 14)
|
|
|
|
|
|
|
|
(smt/deftheme yoshi
|
|
|
|
:prototype 'black-crystal
|
|
|
|
:local-widgets
|
|
|
|
(lambda (theme)
|
|
|
|
(let ((parent-local-widgets
|
|
|
|
(smt/t-local-widgets (smt/t-prototype theme))))
|
|
|
|
(append
|
|
|
|
(list (cons 'minor-modes
|
|
|
|
(smt/make-widget
|
|
|
|
:prototye 'minor-modes
|
|
|
|
:text 'oni:smt/minor-mode-indicator-text)))
|
|
|
|
parent-local-widgets)))
|
|
|
|
:rows '(default-left default-position oni:default-right))))
|
2013-03-11 00:33:42 +01:00
|
|
|
|
2013-02-20 00:06:06 +01:00
|
|
|
(defun oni:enable-svg-mode-line-theme ()
|
|
|
|
"Enable `svg-mode-line-theme' and select a theme."
|
|
|
|
(smt/enable)
|
2013-03-11 00:33:42 +01:00
|
|
|
(smt/set-theme 'yoshi))
|
2013-02-20 00:06:06 +01:00
|
|
|
|
|
|
|
(add-hook 'emacs-startup-hook 'oni:enable-svg-mode-line-theme)
|
|
|
|
#+END_SRC
|
|
|
|
|
|
|
|
* bidi
|
|
|
|
|
|
|
|
Disable bi-directional text, since I don't write right-to-left
|
|
|
|
myself and I don't know anyone who does. I have read that it is a
|
|
|
|
bad idea to disable it completely, but forcing left-to-right should
|
|
|
|
help.
|
|
|
|
|
|
|
|
#+BEGIN_SRC emacs-lisp
|
|
|
|
(setq-default bidi-paragraph-direction 'left-to-right)
|
|
|
|
#+END_SRC
|
|
|
|
|
|
|
|
* disabled
|
|
|
|
|
|
|
|
There are some functions which get disabled by default because they
|
|
|
|
"confuse new users", but these I like using.
|
|
|
|
|
|
|
|
#+BEGIN_SRC emacs-lisp
|
|
|
|
(put 'upcase-region 'disabled nil)
|
|
|
|
(put 'downcase-region 'disabled nil)
|
|
|
|
(put 'narrow-to-region 'disabled nil)
|
|
|
|
(put 'scroll-left 'disabled nil)
|
|
|
|
#+END_SRC
|
2013-03-03 14:47:01 +01:00
|
|
|
|
|
|
|
* jabber
|
|
|
|
|
2013-03-22 13:33:59 +01:00
|
|
|
Don't echo presence updates in the message area.
|
|
|
|
|
|
|
|
#+BEGIN_SRC emacs-lisp
|
|
|
|
(defun oni:jabber-init ()
|
|
|
|
"Initialization function for jabber."
|
|
|
|
(remove-hook 'jabber-alert-presence-hooks 'jabber-presence-echo))
|
|
|
|
|
|
|
|
(eval-after-load "jabber" '(oni:jabber-init))
|
|
|
|
#+END_SRC
|
|
|
|
|
2013-03-03 14:47:01 +01:00
|
|
|
Require ~jabber-libnotify~ so we can use its alert functions.
|
|
|
|
|
|
|
|
#+BEGIN_SRC emacs-lisp
|
|
|
|
(require 'jabber-libnotify)
|
|
|
|
#+END_SRC
|
|
|
|
|
|
|
|
Enable libnotify alerts for regular and mutli-user chats, this is
|
|
|
|
preferable to seeing them in the echo area.
|
|
|
|
|
|
|
|
#+BEGIN_SRC emacs-lisp
|
|
|
|
(add-hook 'jabber-alert-message-hooks 'jabber-message-libnotify)
|
|
|
|
(add-hook 'jabber-alert-muc-hooks 'jabber-muc-libnotify)
|
|
|
|
#+END_SRC
|
|
|
|
|
|
|
|
Keep track of what was said to and by my contacts, both for
|
|
|
|
"personal" chats and muc chats.
|
|
|
|
|
|
|
|
#+BEGIN_SRC emacs-lisp
|
|
|
|
(setq jabber-history-enabled t
|
|
|
|
jabber-history-muc-enabled t)
|
|
|
|
#+END_SRC
|
|
|
|
|
|
|
|
Store history on a per-contact basis and keep these files in
|
|
|
|
~$HOME/.emacs.d/jabber-hist~.
|
|
|
|
|
|
|
|
#+BEGIN_SRC emacs-lisp
|
|
|
|
(setq jabber-use-global-history nil
|
|
|
|
jabber-history-dir "~/.emacs.d/jabber-hist")
|
|
|
|
#+END_SRC
|
2013-03-11 00:40:57 +01:00
|
|
|
|
2013-03-22 13:33:59 +01:00
|
|
|
Add some accounts.
|
|
|
|
|
|
|
|
#+BEGIN_SRC emacs-lisp
|
|
|
|
(setq jabber-account-list '(("ryuslash@jabber.org")
|
|
|
|
("tom@ryuslash.org/drd"
|
|
|
|
(:connection-type . ssl))))
|
|
|
|
#+END_SRC
|
|
|
|
|
2013-03-11 00:40:57 +01:00
|
|
|
* ido
|
|
|
|
|
|
|
|
Keep some buffers from showing up when using ido-mode. Either these
|
|
|
|
get used very rarely or they don't have any really useful
|
|
|
|
information in them.
|
|
|
|
|
|
|
|
#+BEGIN_SRC emacs-lisp
|
|
|
|
(defun oni:ido-init ()
|
|
|
|
"Initialization functionn for ido."
|
|
|
|
(setq ido-ignore-buffers
|
|
|
|
(list "^\\` " "^irc\\." "^\\#" "^\\*Customize Option:"
|
|
|
|
(eval-when-compile
|
|
|
|
(regexp-opt
|
|
|
|
'("*-jabber-roster-*"
|
|
|
|
"*Messages*"
|
|
|
|
"*fsm-debug*"
|
|
|
|
"*magit-process*"
|
|
|
|
"*magit-edit-log*"
|
2013-03-22 13:35:15 +01:00
|
|
|
"*Backtrace*"
|
|
|
|
"*Ibuffer*"))))))
|
2013-03-11 00:40:57 +01:00
|
|
|
|
|
|
|
(eval-after-load "ido" '(oni:ido-init))
|
|
|
|
#+END_SRC
|
|
|
|
|
|
|
|
Ido tries to be smart and find files in other directories, I don't
|
|
|
|
like that, stop doing that (or at least wait a long time).
|
|
|
|
|
|
|
|
#+BEGIN_SRC emacs-lisp
|
|
|
|
(setq ido-auto-merge-delay-time 1000000)
|
|
|
|
#+END_SRC
|
|
|
|
|
|
|
|
Open files in the selected window when switching between buffers.
|
|
|
|
|
|
|
|
#+BEGIN_SRC emacs-lisp
|
|
|
|
(setq ido-default-buffer-method 'selected-window)
|
|
|
|
#+END_SRC
|
|
|
|
|
|
|
|
Only ever show one line of possibilities when using ido. I hate it
|
|
|
|
when the minibuffer grows.
|
|
|
|
|
|
|
|
#+BEGIN_SRC emacs-lisp
|
|
|
|
(setq ido-max-window-height 1)
|
|
|
|
#+END_SRC
|
|
|
|
|
|
|
|
Don't save ido state between invocations.
|
|
|
|
|
|
|
|
#+BEGIN_SRC emacs-lisp
|
|
|
|
(setq ido-save-directory-list-file nil)
|
|
|
|
#+END_SRC
|
|
|
|
|
|
|
|
Enable =ido-mode=.
|
|
|
|
|
|
|
|
#+BEGIN_SRC emacs-lisp
|
|
|
|
(ido-mode)
|
|
|
|
#+END_SRC
|
|
|
|
|
|
|
|
** ido-ubiquitous
|
|
|
|
|
|
|
|
Don't use ido when calling =org-refile= or =org-capture-refile=.
|
|
|
|
|
|
|
|
#+BEGIN_SRC emacs-lisp
|
|
|
|
(setq ido-ubiquitous-command-exceptions
|
|
|
|
'(org-refile org-capture-refile))
|
|
|
|
#+END_SRC
|
|
|
|
|
|
|
|
Enable =ido-ubiquitous=.
|
|
|
|
|
|
|
|
#+BEGIN_SRC emacs-lisp
|
2013-03-22 13:35:31 +01:00
|
|
|
(add-hook 'emacs-startup-hook 'ido-ubiquitous-mode)
|
2013-03-11 00:40:57 +01:00
|
|
|
#+END_SRC
|
|
|
|
|
|
|
|
** idomenu
|
|
|
|
|
|
|
|
Call =idomenu= with ~M-n~.
|
|
|
|
|
|
|
|
#+BEGIN_SRC emacs-lisp
|
|
|
|
(global-set-key (kbd "M-n") 'idomenu)
|
|
|
|
#+END_SRC
|