safe-load does not break emacs initialization, should a file be
unreadable while emacs boots up.
-#+BEGIN_SRC emacs-lisp tangle:yes
+#+BEGIN_SRC emacs-lisp :tangle yes
(defvar safe-load-error-list ""
"*List of files that reported errors when loaded via safe-load")
I have some stuff put away in my local dir. I don't want to load it all
at startup time, so it is using the autoload feature. For that to work
load the loaddefs, so autoload knows where to grab stuff
-#+BEGIN_SRC emacs-lisp tangle:yes
+#+BEGIN_SRC emacs-lisp :tangle yes
(safe-load (concat jj-elisp-dir "/tiny/loaddefs.el"))
(safe-load (concat jj-elisp-local-dir "/loaddefs.el"))
#+END_SRC
Always ensure to have a scratch buffer around.
-#+BEGIN_SRC emacs-lisp tangle:yes
+#+BEGIN_SRC emacs-lisp :tangle yes
(with-current-buffer (get-buffer-create "*scratch*")
(lisp-interaction-mode)
(make-local-variable 'kill-buffer-query-functions)
#+END_SRC
Handier way to add modes to auto-mode-alist
-#+BEGIN_SRC emacs-lisp tangle:yes
+#+BEGIN_SRC emacs-lisp :tangle yes
(defun add-auto-mode (mode &rest patterns)
"Add entries to `auto-mode-alist' to use `MODE' for all given file `PATTERNS'."
(dolist (pattern patterns)
#+END_SRC
Helpers for the config
-#+BEGIN_SRC emacs-lisp tangle:yes
+#+BEGIN_SRC emacs-lisp :tangle yes
(require 'use-package)
(require 'bind-key)
#+END_SRC
I also disliked the repeated /add-to-list/ lines, so I now just have
one variable and go over that in a loop.
-#+BEGIN_SRC emacs-lisp tangle:yes
+#+BEGIN_SRC emacs-lisp :tangle yes
(defvar jj-elisp-subdirs '(local gnus icicle org/contrib tiny mo-git-blame cedet
cedet/eieio ecb jdee/lisp sunrise multiple-cursors
- auto-complete yasnippet magit mmm emms/lisp)
+ auto-complete yasnippet magit mmm emms/lisp
+ elpy find-file-in-project fuzzy idomenu nose
+ popup pyenv)
"List of subdirectories in jj-elisp-dir to add to load-path")
(let (dirval)
*** Info path
Help emacs to find the info files
-#+BEGIN_SRC emacs-lisp tangle:yes
+#+BEGIN_SRC emacs-lisp :tangle yes
(setq Info-directory-list '("~/emacs/info"
"/usr/local/share/info/"
"/usr/local/info/"
:ID: 0a1560d9-7e55-47ab-be52-b3a8b8eea4aa
:END:
I dislike the startup message
-#+BEGIN_SRC emacs-lisp tangle:yes
+#+BEGIN_SRC emacs-lisp :tangle yes
(setq inhibit-splash-screen t)
(setq inhibit-startup-message t)
#+END_SRC
Usually I want the lines to break at 72 characters.
-#+BEGIN_SRC emacs-lisp tangle:yes
+#+BEGIN_SRC emacs-lisp :tangle yes
(if (version<= emacs-version "22")
(setq default-fill-column 72)
(setq fill-column 72))
#+END_SRC
And it is nice to have a final newline in files.
-#+BEGIN_SRC emacs-lisp tangle:yes
+#+BEGIN_SRC emacs-lisp :tangle yes
(setq require-final-newline t)
#+END_SRC
After I typed 300 characters or took a break for more than a minute it
would be nice of emacs to save whatever I am on in one of its auto-save
backups. See [[info:emacs#Auto%20Save%20Control][info:emacs#Auto Save Control]] for more details.
-#+BEGIN_SRC emacs-lisp tangle:yes
+#+BEGIN_SRC emacs-lisp :tangle yes
(setq auto-save-interval 300)
(setq auto-save-timeout 60)
#+END_SRC
Set my full name and my default mail address - for whatever wants to use
it later. Also, I am using gnus.
-#+BEGIN_SRC emacs-lisp tangle:yes
+#+BEGIN_SRC emacs-lisp :tangle yes
(setq user-full-name "Joerg Jaspert")
(setq user-mail-address "joerg@ganneff.de")
(setq mail-user-agent (quote gnus-user-agent))
My default mail server. Well, simply a localhost, I have a forwarder that
puts mail off the right way, no need for emacs to have any further
knowledge here.
-#+BEGIN_SRC emacs-lisp tangle:yes
+#+BEGIN_SRC emacs-lisp :tangle yes
(setq smtpmail-default-smtp-server "localhost")
(setq smtpmail-smtp-server "localhost")
#+END_SRC
Enable automatic handling of compressed files.
-#+BEGIN_SRC emacs-lisp tangle:yes
+#+BEGIN_SRC emacs-lisp :tangle yes
(auto-compression-mode 1)
#+END_SRC
Emacs forbids a certain set of commands, as they can be very confusing
for new users. Enable them.
-#+BEGIN_SRC emacs-lisp tangle:yes
+#+BEGIN_SRC emacs-lisp :tangle yes
(put 'narrow-to-region 'disabled nil)
(put 'narrow-to-page 'disabled nil)
(put 'narrow-to-defun 'disabled nil)
*** Look / Theme
I've tried various different fonts and while I like the Terminus font
most for my shells, in Emacs Inconsolata clearly wins.
-#+BEGIN_SRC emacs-lisp tangle:yes
+#+BEGIN_SRC emacs-lisp :tangle yes
(if (version<= emacs-version "22")
(set-default-font "Inconsolata-14")
(set-frame-font "Inconsolata-14"))
I always use dark backgrounds, so tell Emacs about it. No need to
guess around.
-#+BEGIN_SRC emacs-lisp tangle:yes
+#+BEGIN_SRC emacs-lisp :tangle yes
(setq-default frame-background-mode jj-color-style)
#+END_SRC
entirely liked it. Until I found solarized, which is now not only my
emacs theme, but also for most of my other software too, especially my
shell. Consistent look is great.
-#+BEGIN_SRC emacs-lisp tangle:yes
+#+BEGIN_SRC emacs-lisp :tangle yes
(if (or (> emacs-major-version 23) (boundp 'custom-theme-load-path))
(progn
(defun jj-init-theme ()
#+END_SRC
Make the fringe (gutter) smaller, the argument is a width in pixels (the default is 8)
-#+BEGIN_SRC emacs-lisp tangle:yes
+#+BEGIN_SRC emacs-lisp :tangle yes
(if (fboundp 'fringe-mode)
(fringe-mode 4))
#+END_SRC
A bit more spacing between buffer lines
-#+BEGIN_SRC emacs-lisp tangle:yes
+#+BEGIN_SRC emacs-lisp :tangle yes
(setq-default line-spacing 0.1)
#+END_SRC
*** Cursor changes
[2013-04-21 So 20:54]
I do not want my cursor to blink.
-#+BEGIN_SRC emacs-lisp tangle:yes
+#+BEGIN_SRC emacs-lisp :tangle yes
(blink-cursor-mode -1)
#+END_SRC
*** Menu, Tool and Scrollbar
I don't want to see the menu-bar, tool-bar or scrollbar.
-#+BEGIN_SRC emacs-lisp tangle:yes
+#+BEGIN_SRC emacs-lisp :tangle yes
(when window-system
(menu-bar-mode -1)
(tool-bar-mode -1)
For them to work even then, we have to do two things.
1. We have to set the frame alist. We simple set both,
=initial-frame-alist= and =default-frame-alist= to the same value here.
- #+BEGIN_SRC emacs-lisp tangle:yes
+ #+BEGIN_SRC emacs-lisp :tangle yes
(setq initial-frame-alist '(
(horizontal-scroll-bars . nil)
(vertical-scroll-bars . nil)
*** Hilight current line in buffer
As it says, it does a hilight of the current line.
-#+BEGIN_SRC emacs-lisp tangle:yes
+#+BEGIN_SRC emacs-lisp :tangle yes
(global-hl-line-mode +1)
#+END_SRC
*** Allow recursive minibuffers
This allows (additional) minibuffer commands while in the minibuffer.
-#+BEGIN_SRC emacs-lisp tangle:yes
+#+BEGIN_SRC emacs-lisp :tangle yes
(setq enable-recursive-minibuffers 't)
#+END_SRC
And modeline-posn is great. It will hilight the column number in the
modeline in red as soon as you are over the defined limit.
-#+BEGIN_SRC emacs-lisp tangle:yes
+#+BEGIN_SRC emacs-lisp :tangle yes
(line-number-mode 1)
(column-number-mode 1)
(size-indication-mode 1)
to get entirely rid of some modes, the other is a function taken from
"Mastering Emacs" which replaces the modes text with an own (set of)
character(s).
-#+BEGIN_SRC emacs-lisp tangle:yes
+#+BEGIN_SRC emacs-lisp :tangle yes
(require 'diminish)
(diminish 'auto-fill-function)
(defvar mode-line-cleaner-alist
be org-mode - it is just so much better to use. And does sensible things
with many README files out there, and various other "crap" you get to
read in emacs.
-#+BEGIN_SRC emacs-lisp tangle:yes
+#+BEGIN_SRC emacs-lisp :tangle yes
(if (> emacs-major-version 22)
(setq major-mode 'org-mode)
(setq default-major-mode 'org-mode))
*** Shell
[2013-04-23 Tue 16:43]
Shell. zsh in my case.
-#+BEGIN_SRC emacs-lisp tangle:yes
+#+BEGIN_SRC emacs-lisp :tangle yes
(setq shell-file-name "zsh")
(setq shell-command-switch "-c")
(setq explicit-shell-file-name shell-file-name)
*** Emacs shell
Basic settings for emacs integrated shell
-#+BEGIN_SRC emacs-lisp tangle:yes
+#+BEGIN_SRC emacs-lisp :tangle yes
(setq eshell-cmpl-cycle-completions nil
eshell-save-history-on-exit t
eshell-cmpl-dir-ignore "\\`\\(\\.\\.?\\|CVS\\|\\.svn\\|\\.git\\)/\\'")
occurence of what is at your cursor position use the following.
*C-x* will insert the current word while *M-up* and *M-down* will just
jump to the next/previous occurence of it.
-#+BEGIN_SRC emacs-lisp tangle:yes
+#+BEGIN_SRC emacs-lisp :tangle yes
(define-key isearch-mode-map (kbd "C-x") 'sacha/isearch-yank-current-word)
(global-set-key '[M-up] 'sacha/search-word-backward)
(global-set-key '[M-down] 'sacha/search-word-forward)
*** Frame configuration
I want to see the buffername and its size, not the host I am on in my
frame title.
-#+BEGIN_SRC emacs-lisp tangle:yes
+#+BEGIN_SRC emacs-lisp :tangle yes
(setq frame-title-format "%b (%i)")
#+END_SRC
I don't want some buffers to be killed, **scratch** for example.
In the past I had a long function that just recreated them, but the
=keep-buffers= package is easier.
-#+BEGIN_SRC emacs-lisp tangle:yes
+#+BEGIN_SRC emacs-lisp :tangle yes
(require 'keep-buffers)
(keep-buffers-mode 1)
(push '("\\`*scratch" . erase) keep-buffers-protected-alist)
*** yes-or-no-p
Emas usually wants you to type /yes/ or /no/ fully. What a mess, I am
lazy.
-#+BEGIN_SRC emacs-lisp tangle:yes
+#+BEGIN_SRC emacs-lisp :tangle yes
(defalias 'yes-or-no-p 'y-or-n-p)
#+END_SRC
*** Language/i18n stuff
In this day and age, UTF-8 is the way to go.
-#+BEGIN_SRC emacs-lisp tangle:yes
+#+BEGIN_SRC emacs-lisp :tangle yes
(set-language-environment 'utf-8)
(set-default-coding-systems 'utf-8)
(set-terminal-coding-system 'utf-8)
*** Hilight matching parentheses
While I do have the nifty shortcut to jump to the other parentheses,
hilighting them makes it obvious where they are.
-#+BEGIN_SRC emacs-lisp tangle:yes
+#+BEGIN_SRC emacs-lisp :tangle yes
(require 'paren)
(setq show-paren-style 'parenthesis)
(show-paren-mode +1)
*** Kill other buffers
While many editors allow you to close "all the other files, not the one
you are in", emacs doesn't have this... Except, now it will.
-#+BEGIN_SRC emacs-lisp tangle:yes
+#+BEGIN_SRC emacs-lisp :tangle yes
(global-set-key (kbd "C-c k") 'prelude-kill-other-buffers)
#+END_SRC
*** Scrolling
Default scrolling behaviour in emacs is a bit annoying, who wants to
jump half-windows?
-#+BEGIN_SRC emacs-lisp tangle:yes
+#+BEGIN_SRC emacs-lisp :tangle yes
(setq scroll-margin 0)
(setq scroll-conservatively 100000)
(setq scroll-up-aggressively 0.0)
[2013-04-09 Di 23:31]
The default how emacs handles cutting/pasting with the primary selection
changed in emacs24. I am used to the old way, so get it back.
-#+BEGIN_SRC emacs-lisp tangle:yes
+#+BEGIN_SRC emacs-lisp :tangle yes
(setq x-select-enable-primary t)
(setq x-select-enable-clipboard t ;; copy-paste should work ...
interprogram-paste-function ;; ...with...
*** Global keyboard changes not directly related to a mode
Disable /suspend_frame/ function, I dislike it.
-#+BEGIN_SRC emacs-lisp tangle:yes
+#+BEGIN_SRC emacs-lisp :tangle yes
(global-unset-key [(control z)])
(global-unset-key [(control x) (control z)])
#+END_SRC
set, including newline. But to kill the entire line, one still needs a
*C-a* in front of it. So I change it, by defining a function to do just this for
me. Lazyness++.
-#+BEGIN_SRC emacs-lisp tangle:yes
+#+BEGIN_SRC emacs-lisp :tangle yes
(defun kill-entire-line ()
"Kill this entire line (including newline), regardless of where point is within the line."
(interactive)
And the same is true when I'm in org-mode, which has an own kill function...
(the keybinding happens later, after org-mode is loaded fully)
-#+BEGIN_SRC emacs-lisp tangle:yes
+#+BEGIN_SRC emacs-lisp :tangle yes
(defun jj-org-kill-line (&optional arg)
"Kill the entire line, regardless of where point is within the line, org-mode-version"
(interactive "P")
I really hate tabs, so I don't want any indentation to try using them.
And in case a project really needs them, I can change it just for that
file/project, but luckily none of those I work in is as broken.
-#+BEGIN_SRC emacs-lisp tangle:yes
+#+BEGIN_SRC emacs-lisp :tangle yes
(setq-default indent-tabs-mode nil)
#+END_SRC
Make the % key jump to the matching {}[]() if on another, like vi, see [[id:b6e6cf73-9802-4a7b-bd65-fdb6f9745319][the function]]
-#+BEGIN_SRC emacs-lisp tangle:yes
+#+BEGIN_SRC emacs-lisp :tangle yes
(global-set-key "\M-5" 'match-paren)
#+END_SRC
Easy way to move a line up - or down. Simpler than dealing with C-x C-t
AKA transpose lines.
-#+BEGIN_SRC emacs-lisp tangle:yes
+#+BEGIN_SRC emacs-lisp :tangle yes
(global-set-key [(meta shift up)] 'move-line-up)
(global-set-key [(meta shift down)] 'move-line-down)
#+END_SRC
"Pull" lines up, join them
-#+BEGIN_SRC emacs-lisp tangle:yes
+#+BEGIN_SRC emacs-lisp :tangle yes
(global-set-key (kbd "M-j")
(lambda ()
(interactive)
#+END_SRC
When I press Enter I almost always want to go to the right indentation on the next line.
-#+BEGIN_SRC emacs-lisp tangle:yes
+#+BEGIN_SRC emacs-lisp :tangle yes
(global-set-key (kbd "RET") 'newline-and-indent)
#+END_SRC
Easier undo, and i don't need suspend-frame
-#+BEGIN_SRC emacs-lisp tangle:yes
+#+BEGIN_SRC emacs-lisp :tangle yes
(global-set-key (kbd "C-z") 'undo)
#+END_SRC
Window switching, go backwards. (C-x o goes to the next window)
-#+BEGIN_SRC emacs-lisp tangle:yes
+#+BEGIN_SRC emacs-lisp :tangle yes
(global-set-key (kbd "C-x O") (lambda ()
(interactive)
(other-window -1)))
#+END_SRC
Edit file as root
-#+BEGIN_SRC emacs-lisp tangle:yes
+#+BEGIN_SRC emacs-lisp :tangle yes
(global-set-key (kbd "C-x C-r") 'prelude-sudo-edit)
#+END_SRC
be really useful, it also should include newlines. It doesn’t do this by
default. Rather, you have to call it with a negative argument. Sure
not, bad Emacs.
-#+BEGIN_SRC emacs-lisp tangle:yes
+#+BEGIN_SRC emacs-lisp :tangle yes
(global-set-key (kbd "M-SPC") 'just-one-space-with-newline)
#+END_SRC
Count which commands I use how often.
-#+BEGIN_SRC emacs-lisp tangle:yes
+#+BEGIN_SRC emacs-lisp :tangle yes
(defvar keyfreq-file
(expand-file-name "keyfreq" jj-cache-dir)
"Keyfreq cache file")
#+END_SRC
Duplicate current line
-#+BEGIN_SRC emacs-lisp tangle:yes
+#+BEGIN_SRC emacs-lisp :tangle yes
(defun duplicate-line ()
"Insert a copy of the current line after the current line."
(interactive)
Smarter move to the beginning of the line. That is, it first moves to
the beginning of the line - and on second keypress it goes to the
first character on line.
-#+BEGIN_SRC emacs-lisp tangle:yes
+#+BEGIN_SRC emacs-lisp :tangle yes
(defun smarter-move-beginning-of-line (arg)
"Move point back to indentation of beginning of line.
Easily copy characters from the previous nonblank line, starting just
above point. With a prefix argument, only copy ARG characters (never
past EOL), no argument copies rest of line.
-#+BEGIN_SRC emacs-lisp tangle:yes
+#+BEGIN_SRC emacs-lisp :tangle yes
(require 'misc)
(global-set-key (kbd "H-y") 'copy-from-above-command)
#+END_SRC
Open a new X Terminal pointing to the directory of the current
buffers path.
-#+BEGIN_SRC emacs-lisp tangle:yes
+#+BEGIN_SRC emacs-lisp :tangle yes
(global-set-key (kbd "H-t") 'jj-open-shell)
#+END_SRC
**** ace-jump-mode
[2013-04-28 So 11:26]
Quickly move around in buffers.
-#+BEGIN_SRC emacs-lisp tangle:yes
+#+BEGIN_SRC emacs-lisp :tangle yes
(autoload 'ace-jump-mode "ace-jump-mode" "Emacs quick move minor mode" t)
(define-key global-map (kbd "H-SPC") 'ace-jump-mode)
;; enable a more powerful jump back function from ace jump mode
Usually you can press the *Ins*ert key, to get into overwrite mode. I
don't like that, have broken much with it and so just forbid it by
disabling that.
-#+BEGIN_SRC emacs-lisp tangle:yes
+#+BEGIN_SRC emacs-lisp :tangle yes
(global-unset-key [insert])
(global-unset-key [kp-insert])
#+END_SRC
to clutter up the filesystem everywhere. So I put them into one defined
place, backup-directory, which even contains my username (for systems
where =temporary-file-directory= is not inside my home).
-#+BEGIN_SRC emacs-lisp tangle:yes
+#+BEGIN_SRC emacs-lisp :tangle yes
(setq backup-directory-alist `(("." . ,jj-backup-directory)))
(setq auto-save-file-name-transforms `((".*" ,jj-backup-directory t)))
#+END_SRC
Weeks start on Monday, not sunday.
-#+BEGIN_SRC emacs-lisp tangle:yes
+#+BEGIN_SRC emacs-lisp :tangle yes
(setq calendar-week-start-day 1)
#+END_SRC
Searches and matches should ignore case.
-#+BEGIN_SRC emacs-lisp tangle:yes
+#+BEGIN_SRC emacs-lisp :tangle yes
(setq-default case-fold-search t)
#+END_SRC
Which buffers to get rid off at midnight.
-#+BEGIN_SRC emacs-lisp tangle:yes
+#+BEGIN_SRC emacs-lisp :tangle yes
(setq clean-buffer-list-kill-buffer-names (quote ("*Help*" "*Apropos*"
"*Man " "*Buffer List*"
"*Compile-Log*"
#+END_SRC
Don't display a cursor in non-selected windows.
-#+BEGIN_SRC emacs-lisp tangle:yes
+#+BEGIN_SRC emacs-lisp :tangle yes
(setq-default cursor-in-non-selected-windows nil)
#+END_SRC
What should be displayed in the mode-line for files with those types
of line endings.
-#+BEGIN_SRC emacs-lisp tangle:yes
+#+BEGIN_SRC emacs-lisp :tangle yes
(setq eol-mnemonic-dos "(DOS)")
(setq eol-mnemonic-mac "(Mac)")
#+END_SRC
Much larger threshold for garbage collection prevents it to run too often.
-#+BEGIN_SRC emacs-lisp tangle:yes
+#+BEGIN_SRC emacs-lisp :tangle yes
(setq gc-cons-threshold 48000000)
#+END_SRC
-#+BEGIN_SRC emacs-lisp tangle:yes
+#+BEGIN_SRC emacs-lisp :tangle yes
(setq max-lisp-eval-depth 1000)
(setq max-specpdl-size 3000)
#+END_SRC
Unfill paragraph
From https://raw.github.com/qdot/conf_emacs/master/emacs_conf.org
-#+BEGIN_SRC emacs-lisp tangle:yes
+#+BEGIN_SRC emacs-lisp :tangle yes
(defun unfill-paragraph ()
"Takes a multi-line paragraph and makes it into a single line of text."
(interactive)
(fill-paragraph nil)))
#+END_SRC
-#+BEGIN_SRC emacs-lisp tangle:yes
+#+BEGIN_SRC emacs-lisp :tangle yes
(setq-default indicate-empty-lines t)
#+END_SRC
Hilight annotations in comments, like FIXME/TODO/...
-#+BEGIN_SRC emacs-lisp tangle:yes
+#+BEGIN_SRC emacs-lisp :tangle yes
(add-hook 'prog-mode-hook 'font-lock-comment-annotations)
#+END_SRC
*** Browser
-#+BEGIN_SRC emacs-lisp tangle:yes
+#+BEGIN_SRC emacs-lisp :tangle yes
(setq browse-url-browser-function (quote browse-url-generic))
(setq browse-url-generic-program "/usr/bin/x-www-browser")
#+END_SRC
*** When saving a script - make it executable
-#+BEGIN_SRC emacs-lisp tangle:yes
+#+BEGIN_SRC emacs-lisp :tangle yes
(add-hook 'after-save-hook 'executable-make-buffer-file-executable-if-script-p)
#+END_SRC
*** Emacs Server
-#+BEGIN_SRC emacs-lisp tangle:yes
+#+BEGIN_SRC emacs-lisp :tangle yes
(require 'server)
(unless (server-running-p)
(server-start))
The following contains a set of variables i may reasonably want to
change on other systems - which don't affect the init file loading
process. So I *can* use the customization interface for it...
-#+BEGIN_SRC emacs-lisp tangle:yes
+#+BEGIN_SRC emacs-lisp :tangle yes
(defgroup ganneff nil
"Modify ganneffs settings"
:group 'environment)
** Compatibility
[2013-05-21 Tue 23:22]
Restore removed var alias, used by ruby-electric-brace and others
-#+BEGIN_SRC emacs-lisp tangle:yes
+#+BEGIN_SRC emacs-lisp :tangle yes
(unless (boundp 'last-command-char)
(defvaralias 'last-command-char 'last-command-event))
#+END_SRC
things I keep for a long while into statements somewhere else, not just
custom-set here, but we need it anyways.
-#+BEGIN_SRC emacs-lisp tangle:yes
+#+BEGIN_SRC emacs-lisp :tangle yes
(setq custom-file jj-custom-file)
(safe-load custom-file)
#+END_SRC
configuration.
- Markdown syntax
-#+BEGIN_SRC emacs-lisp tangle:yes
+#+BEGIN_SRC emacs-lisp :tangle yes
(add-auto-mode 'markdown-mode "\\.mdwn$")
#+END_SRC
- diff
-#+BEGIN_SRC emacs-lisp tangle:yes
+#+BEGIN_SRC emacs-lisp :tangle yes
(add-auto-mode 'diff-mode "COMMIT_EDITMSG$")
#+END_SRC
This mode allows to have keybindings that are only alive when the
region is active. Helpful for things that only do any useful action
then, like for example the [[*multiple%20cursors][multiple cursors]] mode I load later.
-#+BEGIN_SRC emacs-lisp tangle:yes
+#+BEGIN_SRC emacs-lisp :tangle yes
(require 'region-bindings-mode)
(region-bindings-mode-enable)
#+END_SRC
** tramp
Transparent Remote (file) Access, Multiple Protocol, remote file editing.
-#+BEGIN_SRC emacs-lisp tangle:yes
+#+BEGIN_SRC emacs-lisp :tangle yes
(require 'tramp)
(setq tramp-default-method "ssh")
(setq tramp-persistency-file-name (expand-file-name "tramp" jj-cache-dir))
We configure only a bit of the tiny-tools to load when I should need
them. I don't need much actually, but these things are nice to have.
-#+BEGIN_SRC emacs-lisp tangle:yes
+#+BEGIN_SRC emacs-lisp :tangle yes
(autoload 'turn-on-tinyperl-mode "tinyperl" "" t)
(add-hook 'perl-mode-hook 'turn-on-tinyperl-mode)
(add-hook 'cperl-mode-hook 'turn-on-tinyperl-mode)
(autoload 'tinyeat-kill-buffer-lines-point-min "tinyeat" "" t)
#+END_SRC
*** Keyboard changes for tiny-tools
-#+BEGIN_SRC emacs-lisp tangle:yes
+#+BEGIN_SRC emacs-lisp :tangle yes
(global-set-key "\M-;" 'tinycomment-indent-for-comment)
(global-set-key (kbd "ESC C-k") 'tinyeat-kill-line-backward)
I like dired and work a lot with it, but it tends to leave lots of
windows around.
dired-single to the rescue.
-#+BEGIN_SRC emacs-lisp tangle:yes
+#+BEGIN_SRC emacs-lisp :tangle yes
(autoload 'dired-single-buffer "dired-single" "" t)
(autoload 'dired-single-buffer-mouse "dired-single" "" t)
(autoload 'dired-single-magic-buffer "dired-single" "" t)
We want some extra key bindings loaded. In case we haven't loaded dired
yet, there won't be a keymap to add to, so add our setup function to the
load hook only. Otherwise just bind the keys.
-#+BEGIN_SRC emacs-lisp tangle:yes
+#+BEGIN_SRC emacs-lisp :tangle yes
(if (boundp 'dired-mode-map)
;; we're good to go; just add our bindings
(my-dired-init)
#+END_SRC
A few settings
-#+BEGIN_SRC emacs-lisp tangle:yes
+#+BEGIN_SRC emacs-lisp :tangle yes
(setq dired-auto-revert-buffer (quote dired-directory-changed-p))
(setq dired-dwim-target t)
(setq dired-listing-switches "-alh")
#+END_SRC
wdired
-#+BEGIN_SRC emacs-lisp tangle:yes
+#+BEGIN_SRC emacs-lisp :tangle yes
(setq wdired-allow-to-change-permissions t)
#+END_SRC
** filladapt
[2013-05-02 Thu 00:04]
-#+BEGIN_SRC emacs-lisp tangle:yes
+#+BEGIN_SRC emacs-lisp :tangle yes
(require 'filladapt)
(eval-after-load "filladapt" '(diminish 'filladapt-mode))
(setq-default filladapt-mode t)
[2013-05-03 Fri 16:09]
Replace default find-file with find-file-at-point, which tries to
guess the default file/URL from text around the point.
-#+BEGIN_SRC emacs-lisp tangle:yes
+#+BEGIN_SRC emacs-lisp :tangle yes
(ffap-bindings)
#+END_SRC
** icicles
[[http://article.gmane.org/gmane.emacs.orgmode/4574/match%3Dicicles]["In case you never heard of it, Icicles is to ‘TAB’ completion what
‘TAB’ completion is to typing things manually every time.”]]
-#+BEGIN_SRC emacs-lisp tangle:yes
+#+BEGIN_SRC emacs-lisp :tangle yes
(require 'icicles)
(icy-mode 1)
#+END_SRC
** uniquify
Always have unique buffernames. See [[http://www.gnu.org/software/emacs/manual/html_node/emacs/Uniquify.html][Uniquify - GNU Emacs Manual]]
-#+BEGIN_SRC emacs-lisp tangle:yes
+#+BEGIN_SRC emacs-lisp :tangle yes
(require 'uniquify)
(setq uniquify-buffer-name-style 'post-forward)
(setq uniquify-after-kill-buffer-p t)
A defined abbrev is a word which expands, if you insert it, into some
different text. Abbrevs are defined by the user to expand in specific
ways.
-#+BEGIN_SRC emacs-lisp tangle:yes
+#+BEGIN_SRC emacs-lisp :tangle yes
(setq save-abbrevs 'silently)
(setq abbrev-file-name (expand-file-name "abbrev_defs" jj-cache-dir))
(if (file-exists-p abbrev-file-name)
Obviously emacs can do syntax hilighting. For more things than you ever
heard about.
And I want to have it everywhere.
-#+BEGIN_SRC emacs-lisp tangle:yes
+#+BEGIN_SRC emacs-lisp :tangle yes
(require 'font-lock)
(global-font-lock-mode 1)
(setq font-lock-maximum-decoration t)
#+END_SRC
** miniedit
Edit minibuffer in a full (text-mode) buffer by pressing *M-C-e*.
-#+BEGIN_SRC emacs-lisp tangle:yes
+#+BEGIN_SRC emacs-lisp :tangle yes
(require 'miniedit)
(miniedit-install)
#+END_SRC
formats if one exists in the first 8 lines of the file.
- Time-stamp: <>
- Time-stamp: " "
-#+BEGIN_SRC emacs-lisp tangle:yes
+#+BEGIN_SRC emacs-lisp :tangle yes
(require 'time-stamp)
(setq time-stamp-active t)
(setq time-stamp-format "%02H:%02M:%02S (%z) - %02d.%02m.%:y from %u (%U) on %s")
** perl / cperl
I like /cperl-mode/ a bit more than the default /perl-mode/, so set it
up here to be used.
-#+BEGIN_SRC emacs-lisp tangle:yes
+#+BEGIN_SRC emacs-lisp :tangle yes
(autoload 'cperl-mode "cperl-mode" )
(defalias 'perl-mode 'cperl-mode)
(add-auto-mode 'cperl-mode "\\.\\([pP][Llm]\\|al\\)\\'")
(eldoc-mode))))
#+END_SRC
-** python
-#+BEGIN_SRC emacs-lisp tangle:yes
-(autoload 'python-mode "python-mode" "Python Mode." t)
-(add-auto-mode 'python-mode "\\.py\\'")
-(add-auto-mode 'python-mode "\\.py$")
-(add-auto-mode 'python-mode "SConstruct\\'")
-(add-auto-mode 'python-mode "SConscript\\'")
-(add-to-list 'interpreter-mode-alist '("python" . python-mode))
-
-(after 'python-mode
- (set-variable 'py-indent-offset 4)
- (set-variable 'py-smart-indentation nil)
- (set-variable 'indent-tabs-mode nil)
- (define-key python-mode-map "\C-m" 'newline-and-indent)
- (turn-on-eldoc-mode)
- (defun python-auto-fill-comments-only ()
- (auto-fill-mode 1)
- (set (make-local-variable 'fill-nobreak-predicate)
- (lambda ()
- (not (python-in-string/comment)))))
- (add-hook 'python-mode-hook
- (lambda ()
- (python-auto-fill-comments-only)))
- ;; pymacs
- (autoload 'pymacs-apply "pymacs")
- (autoload 'pymacs-call "pymacs")
- (autoload 'pymacs-eval "pymacs" nil t)
- (autoload 'pymacs-exec "pymacs" nil t)
- (autoload 'pymacs-load "pymacs" nil t))
-#+END_SRC
-
-If an =ipython= executable is on the path, then assume that IPython is
-the preferred method python evaluation.
-#+BEGIN_SRC emacs-lisp tangle:yes
-(when (executable-find "ipython")
- (require 'ipython)
- (setq org-babel-python-mode 'python-mode))
-
-(setq python-shell-interpreter "ipython")
-(setq python-shell-interpreter-args "")
-(setq python-shell-prompt-regexp "In \\[[0-9]+\\]: ")
-(setq python-shell-prompt-output-regexp "Out\\[[0-9]+\\]: ")
-(setq python-shell-completion-setup-code
- "from IPython.core.completerlib import module_completion")
-(setq python-shell-completion-module-string-code
- "';'.join(module_completion('''%s'''))\n")
-(setq python-shell-completion-string-code
- "';'.join(get_ipython().Completer.all_completions('''%s'''))\n")
-#+END_SRC
-
** sh
I prefer comments to be indented too
-#+BEGIN_SRC emacs-lisp tangle:yes
+#+BEGIN_SRC emacs-lisp :tangle yes
(setq sh-indent-comment t)
#+END_SRC
** auto-revert
When files change outside emacs for whatever reason I want emacs to deal
with it. Not to have to revert buffers myself
-#+BEGIN_SRC emacs-lisp tangle:yes
+#+BEGIN_SRC emacs-lisp :tangle yes
(require 'autorevert)
(setq global-auto-revert-mode t)
(global-auto-revert-mode)
But then there are some where it would just be deadly - like org-mode,
gnus, so we have a list of modes where we don't want to see it.
-#+BEGIN_SRC emacs-lisp tangle:yes
+#+BEGIN_SRC emacs-lisp :tangle yes
(require 'linum)
(setq linum-format "%3d ")
(setq linum-mode-inhibit-modes-list '(org-mode
#+END_SRC
** css
-#+BEGIN_SRC emacs-lisp tangle:yes
+#+BEGIN_SRC emacs-lisp :tangle yes
(autoload 'css-mode "css-mode")
(add-auto-mode 'css-mode "\\.css")
[2013-05-21 Tue 23:39]
MMM Mode is a minor mode for Emacs that allows Multiple Major Modes to
coexist in one buffer.
-#+BEGIN_SRC emacs-lisp tangle:yes
+#+BEGIN_SRC emacs-lisp :tangle yes
(require 'mmm-auto)
(setq mmm-global-mode 'buffers-with-submode-classes)
(setq mmm-submode-decoration-level 2)
** html-helper
Instead of default /html-mode/ I use /html-helper-mode/.
-#+BEGIN_SRC emacs-lisp tangle:yes
+#+BEGIN_SRC emacs-lisp :tangle yes
(autoload 'html-helper-mode "html-helper-mode" "Yay HTML" t)
(add-auto-mode 'html-helper-mode "\\.html$")
(add-auto-mode 'html-helper-mode "\\.asp$")
#+END_SRC
** auctex
-#+BEGIN_SRC emacs-lisp tangle:yes
+#+BEGIN_SRC emacs-lisp :tangle yes
(setq auto-mode-alist (cons '("\\.tex\\'" . latex-mode) auto-mode-alist))
(setq TeX-auto-save t)
(setq TeX-parse-self t)
#+END_SRC
** Debian related
-#+BEGIN_SRC emacs-lisp tangle:yes
+#+BEGIN_SRC emacs-lisp :tangle yes
(require 'dpkg-dev-el-loaddefs nil 'noerror)
(require 'debian-el-loaddefs nil 'noerror)
I use org-mode a lot and, having my config for this based on [[*Bernt%20Hansen][the config of Bernt Hansen]],
it is quite extensive. Nevertheless, it starts out small, loading it.
-#+BEGIN_SRC emacs-lisp tangle:yes tangle:yes
+#+BEGIN_SRC emacs-lisp :tangle yes :tangle yes
(require 'org)
#+END_SRC
My browsers (Conkeror, Iceweasel) can store links in org-mode. For
that we need org-protocol.
-#+BEGIN_SRC emacs-lisp tangle:yes tangle:yes
+#+BEGIN_SRC emacs-lisp :tangle yes :tangle yes
(require 'org-protocol)
#+END_SRC
My current =org-agenda-files= variable only includes a set of
directories.
-#+BEGIN_SRC emacs-lisp tangle:yes tangle:yes
+#+BEGIN_SRC emacs-lisp :tangle yes :tangle yes
(setq org-agenda-files (quote ("~/org/"
"~/org/debian"
"~/org/debconf"
the list of directories in =org-agenda-files= happens very rarely
since new files in existing directories are automatically picked up.
-#+BEGIN_SRC emacs-lisp tangle:yes tangle:yes
+#+BEGIN_SRC emacs-lisp :tangle yes :tangle yes
;; Keep tasks with dates on the global todo lists
(setq org-agenda-todo-ignore-with-date nil)
'append)
#+END_SRC
-#+BEGIN_SRC emacs-lisp tangle:yes tangle:yes
+#+BEGIN_SRC emacs-lisp :tangle yes :tangle yes
(setq org-agenda-persistent-filter t)
(add-hook 'org-agenda-mode-hook
'(lambda () (org-defkey org-agenda-mode-map "W" 'bh/widen))
Well, first we remove =C-c [= and =C-c ]=, as all agenda directories are
setup manually, not by org-mode. Also turn off =C-c ;=, which
comments headlines - a function never used.
-#+BEGIN_SRC emacs-lisp tangle:yes tangle:yes
+#+BEGIN_SRC emacs-lisp :tangle yes :tangle yes
(add-hook 'org-mode-hook
(lambda ()
(org-defkey org-mode-map "\C-c[" 'undefined)
#+END_SRC
And now a largish set of keybindings...
-#+BEGIN_SRC emacs-lisp tangle:yes tangle:yes
+#+BEGIN_SRC emacs-lisp :tangle yes :tangle yes
(global-set-key "\C-cl" 'org-store-link)
(global-set-key "\C-ca" 'org-agenda)
(global-set-key "\C-cb" 'org-iswitchb)
*** Tasks, States, Todo fun
First we define the global todo keywords.
-#+BEGIN_SRC emacs-lisp tangle:yes tangle:yes
+#+BEGIN_SRC emacs-lisp :tangle yes :tangle yes
(setq org-todo-keywords
(quote ((sequence "TODO(t)" "NEXT(n)" "|" "DONE(d@/!)")
(sequence "WAITING(w@/!)" "HOLD(h@/!)" "DELEGATED(g@/!)" "|" "CANCELLED(c@/!)" "PHONE"))))