Add Emacs config
This commit is contained in:
parent
05415b9b2c
commit
c2778f0f71
50 changed files with 4265 additions and 0 deletions
46
emacs/.emacs.d/.gitignore
vendored
Normal file
46
emacs/.emacs.d/.gitignore
vendored
Normal file
|
@ -0,0 +1,46 @@
|
||||||
|
*.dat
|
||||||
|
*.elc
|
||||||
|
*~
|
||||||
|
|
||||||
|
.mc-lists.el
|
||||||
|
.org-id-locations
|
||||||
|
.yas-compiled-snippets.el
|
||||||
|
|
||||||
|
abbrev_defs
|
||||||
|
bookmarks
|
||||||
|
custom.el*
|
||||||
|
emms-streams
|
||||||
|
eww-bookmarks
|
||||||
|
flycheck[-_]*
|
||||||
|
flymake.log
|
||||||
|
geiser-history.guile
|
||||||
|
history
|
||||||
|
ido.last
|
||||||
|
init2.el
|
||||||
|
places
|
||||||
|
smex-items
|
||||||
|
sqliinput
|
||||||
|
srecode-map.el
|
||||||
|
todo-*
|
||||||
|
tramp
|
||||||
|
type-break
|
||||||
|
|
||||||
|
.*/
|
||||||
|
.cask/
|
||||||
|
_publish/
|
||||||
|
elfeed/
|
||||||
|
elnode/
|
||||||
|
elpa/
|
||||||
|
emms/
|
||||||
|
image-dired/
|
||||||
|
jabber-hist/
|
||||||
|
jabber/
|
||||||
|
newsticker/
|
||||||
|
packages/
|
||||||
|
perso/
|
||||||
|
request/
|
||||||
|
semanticdb/
|
||||||
|
templates/
|
||||||
|
themes/
|
||||||
|
url/
|
||||||
|
vendor-lisp/
|
86
emacs/.emacs.d/Cask
Normal file
86
emacs/.emacs.d/Cask
Normal file
|
@ -0,0 +1,86 @@
|
||||||
|
;; -*- mode: emacs-lisp; -*-
|
||||||
|
(source gnu)
|
||||||
|
(source marmalade)
|
||||||
|
(source melpa)
|
||||||
|
(source org)
|
||||||
|
|
||||||
|
(depends-on "slime")
|
||||||
|
|
||||||
|
(depends-on "ac-geiser")
|
||||||
|
(depends-on "ac-slime")
|
||||||
|
(depends-on "auto-complete")
|
||||||
|
(depends-on "boxquote")
|
||||||
|
(depends-on "c-eldoc")
|
||||||
|
(depends-on "cedit")
|
||||||
|
(depends-on "clojure-mode")
|
||||||
|
(depends-on "closure-template-html-mode")
|
||||||
|
(depends-on "coffee-mode")
|
||||||
|
(depends-on "colemak-evil" :git "git://github.com/ryuslash/colemak-evil.git")
|
||||||
|
(depends-on "csharp-mode")
|
||||||
|
(depends-on "css-eldoc")
|
||||||
|
(depends-on "deferred")
|
||||||
|
(depends-on "desktop-registry")
|
||||||
|
(depends-on "diff-hl")
|
||||||
|
(depends-on "discover")
|
||||||
|
(depends-on "dispass")
|
||||||
|
(depends-on "dockerfile-mode")
|
||||||
|
(depends-on "e2wm")
|
||||||
|
(depends-on "elnode")
|
||||||
|
(depends-on "emms")
|
||||||
|
(depends-on "eshell-fringe-status")
|
||||||
|
(depends-on "esxml")
|
||||||
|
(depends-on "evil")
|
||||||
|
(depends-on "eww-lnum")
|
||||||
|
(depends-on "expand-region")
|
||||||
|
(depends-on "fill-column-indicator")
|
||||||
|
(depends-on "fiplr")
|
||||||
|
(depends-on "flx")
|
||||||
|
(depends-on "flycheck")
|
||||||
|
(depends-on "flycheck-commit-check" :git "git://github.com/ryuslash/flycheck-commit-check.git")
|
||||||
|
(depends-on "flycheck-pos-tip")
|
||||||
|
(depends-on "fuel")
|
||||||
|
(depends-on "geiser")
|
||||||
|
(depends-on "git-auto-commit-mode")
|
||||||
|
(depends-on "git-commit-mode")
|
||||||
|
(depends-on "git-rebase-mode")
|
||||||
|
(depends-on "gitignore-mode")
|
||||||
|
(depends-on "go-mode")
|
||||||
|
(depends-on "graphviz-dot-mode")
|
||||||
|
(depends-on "gtags")
|
||||||
|
(depends-on "haml-mode")
|
||||||
|
(depends-on "haskell-mode")
|
||||||
|
(depends-on "hl-sexp")
|
||||||
|
(depends-on "htmlize")
|
||||||
|
(depends-on "hy-mode")
|
||||||
|
(depends-on "hypo" :git "git://github.com/ryuslash/hypo-emacs.git")
|
||||||
|
(depends-on "ido-ubiquitous")
|
||||||
|
(depends-on "idomenu")
|
||||||
|
(depends-on "jabber")
|
||||||
|
(depends-on "jedi")
|
||||||
|
(depends-on "js2-mode")
|
||||||
|
(depends-on "magit")
|
||||||
|
(depends-on "markdown-mode")
|
||||||
|
(depends-on "mode-icons")
|
||||||
|
(depends-on "monokai-theme")
|
||||||
|
(depends-on "multiple-cursors")
|
||||||
|
(depends-on "noflet")
|
||||||
|
(depends-on "org2blog")
|
||||||
|
(depends-on "paredit")
|
||||||
|
(depends-on "persistent-outline" :git "git://ryuslash.org/persistent-outline.git")
|
||||||
|
(depends-on "php-mode")
|
||||||
|
(depends-on "pony-mode")
|
||||||
|
(depends-on "popwin")
|
||||||
|
(depends-on "prodigy")
|
||||||
|
(depends-on "rainbow-delimiters")
|
||||||
|
(depends-on "rainbow-mode")
|
||||||
|
(depends-on "request")
|
||||||
|
(depends-on "rust-mode")
|
||||||
|
(depends-on "slime-js")
|
||||||
|
(depends-on "smex")
|
||||||
|
(depends-on "svg-mode-line-themes")
|
||||||
|
(depends-on "tagedit")
|
||||||
|
(depends-on "upcase-mode" :git "git://github.com/ryuslash/upcase-mode.git")
|
||||||
|
(depends-on "writegood-mode")
|
||||||
|
(depends-on "yaml-mode")
|
||||||
|
(depends-on "yasnippet")
|
||||||
|
(depends-on "yoshi-theme" :git "git://github.com/ryuslash/yoshi-theme.git")
|
29
emacs/.emacs.d/Makefile
Normal file
29
emacs/.emacs.d/Makefile
Normal file
|
@ -0,0 +1,29 @@
|
||||||
|
.PHONY: all site-lisp
|
||||||
|
all: init2.elc init.elc site-lisp/
|
||||||
|
|
||||||
|
%.elc: %.el
|
||||||
|
emacs -Q -batch -eval "(byte-compile-file \"$<\")"
|
||||||
|
|
||||||
|
init.el: init2.el
|
||||||
|
init2.el: init.org
|
||||||
|
emacs -Q -batch -l "ob-tangle" -eval "(org-babel-tangle-file \"init.org\")"
|
||||||
|
|
||||||
|
%/: %
|
||||||
|
$(MAKE) -C "$(CURDIR)/$*"
|
||||||
|
|
||||||
|
rudel:
|
||||||
|
git clone git://github.com/scymtym/rudel.git packages/rudel
|
||||||
|
emacs -Q --batch --visit packages/rudel/rudel-compile.el \
|
||||||
|
--eval "(eval-buffel)"
|
||||||
|
|
||||||
|
clean:
|
||||||
|
rm -rf _publish/*.*
|
||||||
|
|
||||||
|
export: clean
|
||||||
|
emacs -L $(CURDIR) -L ~/.emacs.d/vendor-lisp/org/lisp \
|
||||||
|
-L ~/.emacs.d/vendor-lisp/org/contrib/lisp -batch -l project.el \
|
||||||
|
-f org-publish-all
|
||||||
|
|
||||||
|
publish: export
|
||||||
|
rsync -avuz --exclude=*~ --delete _publish/ \
|
||||||
|
ryuslash.org:public_html/orgweb/dotfiles/emacs
|
3
emacs/.emacs.d/eshell/.gitignore
vendored
Normal file
3
emacs/.emacs.d/eshell/.gitignore
vendored
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
history
|
||||||
|
lastdir
|
||||||
|
login
|
9
emacs/.emacs.d/eshell/alias
Normal file
9
emacs/.emacs.d/eshell/alias
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
alias hgit hgit --no-pager $*
|
||||||
|
alias newsbeuter ansi-term newsbeuter newsbeuter
|
||||||
|
alias d dired $1
|
||||||
|
alias o find-file $1
|
||||||
|
alias listen eshell-exec-visual mplayer http://usa7-vn.mixstream.net/listen/8248.pls
|
||||||
|
alias ncmpcpp ansi-term ncmpcpp ncmpcpp
|
||||||
|
alias sudo *sudo $*
|
||||||
|
alias rm rm -v $*
|
||||||
|
alias git git --no-pager $*
|
19
emacs/.emacs.d/gtkrc
Normal file
19
emacs/.emacs.d/gtkrc
Normal file
|
@ -0,0 +1,19 @@
|
||||||
|
gtk-font-name = "Envy Code R 12"
|
||||||
|
|
||||||
|
style "yoshi"
|
||||||
|
{
|
||||||
|
bg[NORMAL] = "#111113"
|
||||||
|
bg[SELECTED] = "#111113"
|
||||||
|
bg[INSENSITIVE] = "#111113"
|
||||||
|
bg[ACTIVE] = "#111113"
|
||||||
|
bg[PRELIGHT] = "#4a5b73"
|
||||||
|
|
||||||
|
fg[NORMAL] = "#eeeeec"
|
||||||
|
fg[SELECTED] = "#eeeeec"
|
||||||
|
fg[INSENSITIVE] = "#a5a5a4"
|
||||||
|
fg[ACTIVE] = "#eeeeec"
|
||||||
|
fg[PRELIGHT] = "#eeeeec"
|
||||||
|
}
|
||||||
|
|
||||||
|
widget "Emacs.*" style "yoshi"
|
||||||
|
widget_class "*Menu*" style "yoshi"
|
1492
emacs/.emacs.d/init.el
Normal file
1492
emacs/.emacs.d/init.el
Normal file
File diff suppressed because it is too large
Load diff
960
emacs/.emacs.d/init.org
Normal file
960
emacs/.emacs.d/init.org
Normal file
|
@ -0,0 +1,960 @@
|
||||||
|
#+TITLE: Emacs init
|
||||||
|
#+PROPERTY: tangle init2.el
|
||||||
|
#+STARTUP: showall
|
||||||
|
#+OPTIONS: author:nil num:nil toc:nil
|
||||||
|
#+MACRO: key @@html:<kbd>$1</kbd>@@@@ascii:`$1'@@
|
||||||
|
#+HTML_HEAD: <link href="https://ryuslash.org/org.css" rel="stylesheet" type="text/css">
|
||||||
|
|
||||||
|
* About this file
|
||||||
|
|
||||||
|
Inspired by such other projects as the literal Emacs init from [[http://sachac.github.io/.emacs.d/Sacha.html][Sacha
|
||||||
|
Chua]] and also from [[http://www.wisdomandwonder.com/wordpress/wp-content/uploads/2014/03/C3F.html][Grant Rettke]], here is my Emacs initialization
|
||||||
|
file.
|
||||||
|
|
||||||
|
*Note:* This is not my entire Emacs initialization file. It's a
|
||||||
|
work-in-progress. To keep on top of any changes to this file, or any
|
||||||
|
other part of my Emacs init, I recommend you follow [[http://code.ryuslash.org/dot/tom/emacs/][This project]]
|
||||||
|
([[http://code.ryuslash.org/dot/tom/emacs/atom/?h=master][Atom feed]]), which is where I keep my configuration.
|
||||||
|
|
||||||
|
** Preparation
|
||||||
|
|
||||||
|
I could use org-babel to load this file, but I don't like my
|
||||||
|
initialization file being dependent on too many things, especially
|
||||||
|
big things, and org is a big thing. It may be strange for you to
|
||||||
|
read this, as I have placed my entire Emacs configuration in an
|
||||||
|
org-mode file, but here are the make targets I use to tangle and
|
||||||
|
subsequently byte-compile my init file:
|
||||||
|
|
||||||
|
#+BEGIN_SRC makefile :tangle no
|
||||||
|
%.elc: %.el
|
||||||
|
emacs -Q -batch -eval "(byte-compile-file \"$<\")"
|
||||||
|
|
||||||
|
init.el: init.org
|
||||||
|
emacs -Q -batch -l "ob-tangle" -eval "(org-babel-tangle-file \"init.org\")
|
||||||
|
#+END_SRC
|
||||||
|
|
||||||
|
Executing the second target (either through make, or manually) will
|
||||||
|
get you my Emacs initialization file in plain Emacs Lisp.
|
||||||
|
|
||||||
|
*Note:* If you look at this file in it's org-mode form you will
|
||||||
|
notice that I actually tangle ~init.org~ into ~init2.el~. This is a
|
||||||
|
temporary measure so that I can gradually move my configuration
|
||||||
|
from my existing ~init.el~ file into ~init.org~ without much trouble.
|
||||||
|
Once I've emptied out my ~init.el~ I will instruct babel to tangle
|
||||||
|
into ~init.el~, this code already reflects that.
|
||||||
|
|
||||||
|
** The ~oni:~ prefix
|
||||||
|
|
||||||
|
To keep my functions and variables from ever accidentally
|
||||||
|
interfering with other packages or Emacs internal variables I
|
||||||
|
prefix all the functions I write and variables I declare with ~oni:~.
|
||||||
|
You don't have to copy it if you copy anything from this file, as
|
||||||
|
long as you do it consistently.
|
||||||
|
|
||||||
|
* Use lexical binding
|
||||||
|
|
||||||
|
For some of these functions, and general coolness, lexical binding
|
||||||
|
is a must. Without it, closures cannot be made.
|
||||||
|
|
||||||
|
#+BEGIN_SRC emacs-lisp :padline no
|
||||||
|
;; -*- lexical-binding: t -*-
|
||||||
|
#+END_SRC
|
||||||
|
|
||||||
|
* Set some personal information
|
||||||
|
|
||||||
|
This information is used by some emacs commands and modules to make
|
||||||
|
your life easier.
|
||||||
|
|
||||||
|
#+BEGIN_SRC emacs-lisp
|
||||||
|
(setq user-full-name "Tom Willemse"
|
||||||
|
user-mail-address "tom@ryuslash.org")
|
||||||
|
#+END_SRC
|
||||||
|
|
||||||
|
* Clean up some UI elements
|
||||||
|
|
||||||
|
Some elements are only really useful if you use the mouse. Which I
|
||||||
|
don't, not if I can help it. Only when browsing the web or using the
|
||||||
|
odd graphical application do I touch the mouse, and even then as
|
||||||
|
little as I can.
|
||||||
|
|
||||||
|
** Menu bar
|
||||||
|
|
||||||
|
The menu bar is one of the UI elements which work best with mouses.
|
||||||
|
Sure you can change your toolkit's key bindings to allow you to
|
||||||
|
more easily navigate, but {{{key(M-x)}}} or {{{key(M-`)}}}[fn:1]
|
||||||
|
are easier if you don't use the mouse. Long story short: It has got
|
||||||
|
to go.
|
||||||
|
|
||||||
|
#+BEGIN_SRC emacs-lisp
|
||||||
|
(menu-bar-mode -1)
|
||||||
|
#+END_SRC
|
||||||
|
|
||||||
|
** Tool bar
|
||||||
|
|
||||||
|
The toolbar is another such thing, and it takes up quite a bit more
|
||||||
|
space too. Icons can look pretty cool, but in the end if you're not
|
||||||
|
going to click them they don't really server much of a purpose.
|
||||||
|
Again: It has got to go.
|
||||||
|
|
||||||
|
#+BEGIN_SRC emacs-lisp
|
||||||
|
(tool-bar-mode -1)
|
||||||
|
#+END_SRC
|
||||||
|
|
||||||
|
** Blinking cursor
|
||||||
|
|
||||||
|
I suppose a blinking cursor doesn't get lost very easily. But on
|
||||||
|
the other hand, it can induce quite a few more headaches.
|
||||||
|
|
||||||
|
I've noticed that I don't really lose my cursor position all that
|
||||||
|
much, really, so there doesn't seem to be any point in making it
|
||||||
|
blink. Here we go again: It has got to go.
|
||||||
|
|
||||||
|
#+BEGIN_SRC emacs-lisp
|
||||||
|
(blink-cursor-mode -1)
|
||||||
|
#+END_SRC
|
||||||
|
|
||||||
|
** Line numbers
|
||||||
|
|
||||||
|
As I'm currently using svg-mode-line-themes[fn:2] for my ~mode-line~ I
|
||||||
|
don't need to show these. Also I didn't really use them much, I
|
||||||
|
don't often need to know what line I'm on.
|
||||||
|
|
||||||
|
#+BEGIN_SRC emacs-lisp
|
||||||
|
(line-number-mode -1)
|
||||||
|
#+END_SRC
|
||||||
|
|
||||||
|
** Tooltips
|
||||||
|
|
||||||
|
Tooltips are another one of those UI elements that aren't quite
|
||||||
|
keyboard-friendly. As usually this information is shown just as well
|
||||||
|
in the echo area, this is not necessary.
|
||||||
|
|
||||||
|
#+BEGIN_SRC emacs-lisp
|
||||||
|
(tooltip-mode -1)
|
||||||
|
#+END_SRC
|
||||||
|
|
||||||
|
** Cursor type
|
||||||
|
|
||||||
|
I prefer using a bar as a cursor, as opposed to a box. Using a bar
|
||||||
|
is a better way of representing the location of the cursor, in my
|
||||||
|
opinion.
|
||||||
|
|
||||||
|
#+BEGIN_SRC emacs-lisp
|
||||||
|
(setq-default cursor-type 'bar)
|
||||||
|
#+END_SRC
|
||||||
|
|
||||||
|
** Cursors in inactive windows
|
||||||
|
|
||||||
|
I use a bar cursor that's already pretty thin, so having an even
|
||||||
|
thinner one in inactive windows is not very clear. Even when I
|
||||||
|
was using a box cursor I didn't like seeing a hollow box everywhere
|
||||||
|
my focus /wasn't/.
|
||||||
|
|
||||||
|
#+BEGIN_SRC emacs-lisp
|
||||||
|
(setq-default cursor-in-non-selected-windows nil)
|
||||||
|
#+END_SRC
|
||||||
|
|
||||||
|
** Long lines
|
||||||
|
|
||||||
|
Sometimes, very long lines can't help but show up in code. The
|
||||||
|
default of wrapping lines around to the next line and showing an
|
||||||
|
image in the fringe is very visually disturbing to me when looking
|
||||||
|
at code[fn:3]. So I prefer to have it just run off the screen.
|
||||||
|
|
||||||
|
#+BEGIN_SRC emacs-lisp
|
||||||
|
(setq-default truncate-lines t)
|
||||||
|
#+END_SRC
|
||||||
|
|
||||||
|
** The default frame
|
||||||
|
|
||||||
|
Usually, most of these settings would be done with functions like
|
||||||
|
=set-frame-font= or =scroll-bar-mode=, but working with the Emacs
|
||||||
|
Daemon sometimes creates extra complications, because you might
|
||||||
|
start a graphical environment at some point (I usually do
|
||||||
|
immediately), but the startup process isn't.
|
||||||
|
|
||||||
|
*** Internal border
|
||||||
|
|
||||||
|
Set the internal border width to 0. This makes a small difference,
|
||||||
|
with my current setup it causes my window's width to increase from
|
||||||
|
120 to 121. Small, I know, but I'm very greedy when it comes to
|
||||||
|
screen space.
|
||||||
|
|
||||||
|
#+NAME: default-frame-internal-border
|
||||||
|
#+BEGIN_SRC emacs-lisp :tangle no
|
||||||
|
(internal-border-width . 0)
|
||||||
|
#+END_SRC
|
||||||
|
|
||||||
|
*** A fantastic font
|
||||||
|
|
||||||
|
I've tried several fonts, and all of them were nice, but came up
|
||||||
|
short on some way. Some didn't have italic variants, some had
|
||||||
|
dotted zeroes instead of dashed zeroes, some even had entirely
|
||||||
|
clear zeroes which make them look like ~O~'s, others had
|
||||||
|
boring-looking parentheses[fn:4]. Not Fantasque Sans
|
||||||
|
Mono[fn:5][fn:6], it is awesome. If your web browser supports web
|
||||||
|
fonts you should also see it used in the code blocks here.
|
||||||
|
|
||||||
|
For normal Emacs setups you might use the =set-frame-font= function
|
||||||
|
like so:
|
||||||
|
|
||||||
|
#+BEGIN_SRC emacs-lisp :tangle no
|
||||||
|
(set-frame-font "Fantasque Sans Mono 13" nil t)
|
||||||
|
#+END_SRC
|
||||||
|
|
||||||
|
However, this doesn't work when running Emacs as a Daemon. You
|
||||||
|
could (especially with lexical binding) add an
|
||||||
|
=after-make-frame-functions= hook or something similar, but I find
|
||||||
|
it easier to just specify the font in the =default-frame-alist=.
|
||||||
|
|
||||||
|
#+NAME: default-frame-font
|
||||||
|
#+BEGIN_SRC emacs-lisp :tangle no
|
||||||
|
(font . "Fantasque Sans Mono:pixelsize=17")
|
||||||
|
#+END_SRC
|
||||||
|
|
||||||
|
*** Scroll bar
|
||||||
|
|
||||||
|
The scroll-bar is almost just as informative as the current line
|
||||||
|
number and buffer position information shown in the (my) mode
|
||||||
|
line. As I don't usually need to know where I am, other than the
|
||||||
|
current line number occasionally, and I don't use the mouse, the
|
||||||
|
scroll bar doesn't add anything and only takes up space. Once
|
||||||
|
more: It has got to go.
|
||||||
|
|
||||||
|
Normally you would use something along the lines of:
|
||||||
|
|
||||||
|
#+BEGIN_SRC emacs-lisp :tangle no
|
||||||
|
(scroll-bar-mode -1)
|
||||||
|
#+END_SRC
|
||||||
|
|
||||||
|
However, this doesn't work when running Emacs as a Daemon. So
|
||||||
|
instead I specify it in the =default-frame-alist=.
|
||||||
|
|
||||||
|
#+NAME: default-frame-scroll-bar
|
||||||
|
#+BEGIN_SRC emacs-lisp :tangle no
|
||||||
|
(vertical-scroll-bars . nil)
|
||||||
|
#+END_SRC
|
||||||
|
|
||||||
|
*** Setting the option
|
||||||
|
|
||||||
|
So I've explained the reasons for each individual setting, but to
|
||||||
|
get them to work they have to be put in the =default-frame-alist=.
|
||||||
|
Here is the final setting:
|
||||||
|
|
||||||
|
#+BEGIN_SRC emacs-lisp :noweb yes
|
||||||
|
(setq default-frame-alist
|
||||||
|
`(<<default-frame-internal-border>>
|
||||||
|
<<default-frame-font>>
|
||||||
|
<<default-frame-scroll-bar>>))
|
||||||
|
#+END_SRC
|
||||||
|
|
||||||
|
** Frame title
|
||||||
|
|
||||||
|
Show the buffer name in the frame title to make multiple frames
|
||||||
|
identifiable by the buffer they're showing.
|
||||||
|
|
||||||
|
#+BEGIN_SRC emacs-lisp
|
||||||
|
(setq frame-title-format '(:eval (concat "GNU Emacs: " (buffer-name))))
|
||||||
|
#+END_SRC
|
||||||
|
|
||||||
|
** Don't show dialog boxes
|
||||||
|
|
||||||
|
Unfortunately this doesn't remove /all/ dialog boxes, but at least it
|
||||||
|
keeps some of them from popping up. According to the docstring it
|
||||||
|
should only change anything for when the mouse is used, which I
|
||||||
|
don't ever do, but I still feel safer keeping this in my
|
||||||
|
configuration.
|
||||||
|
|
||||||
|
#+BEGIN_SRC emacs-lisp
|
||||||
|
(setq use-dialog-box nil)
|
||||||
|
#+END_SRC
|
||||||
|
|
||||||
|
** Split windows equally
|
||||||
|
|
||||||
|
When splitting windows, give them all an equal amount of space. For
|
||||||
|
those very few time that I have more than two windows in my Emacs
|
||||||
|
frame it is much nicer to have each of them get ~33% space instead
|
||||||
|
of 50%, 25% and 25%. The way I have my desktop set-up I don't ever
|
||||||
|
split my windows horizontally.
|
||||||
|
|
||||||
|
#+BEGIN_SRC emacs-lisp
|
||||||
|
(setq window-combination-resize t)
|
||||||
|
#+END_SRC
|
||||||
|
|
||||||
|
** Keep the cursor steady when scrolling
|
||||||
|
|
||||||
|
When scrolling through the buffer with, for example, {{{key(C-v)}}}
|
||||||
|
or {{{key(M-v)}}}, I find it much more intuitive to have the cursor
|
||||||
|
stay in the relative screen position from before. Otherwise I get
|
||||||
|
confused every time.
|
||||||
|
|
||||||
|
#+BEGIN_SRC emacs-lisp
|
||||||
|
(setq scroll-preserve-screen-position t)
|
||||||
|
#+END_SRC
|
||||||
|
|
||||||
|
** Don't show a mode line for completions
|
||||||
|
|
||||||
|
One of the things I dislike about Emacs is its rigidity concerning
|
||||||
|
windows and other UI elements. One very simple way to make it
|
||||||
|
/feel/ less so is to show less of it where possible. A mode line for
|
||||||
|
completion buffers creates more separation than necessary, and I
|
||||||
|
can't recall a single time where I've used the completion's mode
|
||||||
|
line for anything.
|
||||||
|
|
||||||
|
#+BEGIN_SRC emacs-lisp
|
||||||
|
(add-hook 'completion-list-mode-hook
|
||||||
|
(lambda () (setq mode-line-format nil)))
|
||||||
|
#+END_SRC
|
||||||
|
|
||||||
|
* Add org-mode appointments to the diary
|
||||||
|
|
||||||
|
Diary offers reminders, which can be useful when scheduling
|
||||||
|
appointments.
|
||||||
|
|
||||||
|
#+BEGIN_SRC emacs-lisp
|
||||||
|
(defadvice org-agenda-redo (after ext:org-agenda-redo-add-appts)
|
||||||
|
"Pressing `r' on the agenda will also add appointments."
|
||||||
|
(setq appt-time-msg-list nil)
|
||||||
|
(org-agenda-to-appt))
|
||||||
|
#+END_SRC
|
||||||
|
|
||||||
|
* Close ansi-term buffer after exit
|
||||||
|
|
||||||
|
After the ansi-term process ends it leaves a buffer. I don't use
|
||||||
|
ansi term in such a way that this has ever been useful, so just kill
|
||||||
|
the ansi-term buffer after the process quits, no matter the exit
|
||||||
|
status. Usually this comes about when I press {{{kbd(C-d)}}} at the
|
||||||
|
command prompt.
|
||||||
|
|
||||||
|
#+BEGIN_SRC emacs-lisp
|
||||||
|
(defadvice term-handle-exit (after oni:kill-buffer-after-exit activate)
|
||||||
|
"Kill the term buffer if the process finished."
|
||||||
|
(kill-buffer (current-buffer)))
|
||||||
|
#+END_SRC
|
||||||
|
|
||||||
|
* Stumpwm integration
|
||||||
|
|
||||||
|
This variable, macro and function help with integrating Emacs and
|
||||||
|
Stumpwm. They are used by some other functions to make the two seem
|
||||||
|
extra connected.
|
||||||
|
|
||||||
|
#+BEGIN_SRC emacs-lisp
|
||||||
|
(defvar oni:stumpish-program
|
||||||
|
(expand-file-name
|
||||||
|
"~/.local/share/quicklisp/local-projects/stumpwm/contrib/util/stumpish/stumpish")
|
||||||
|
"The location of the stumpish executable.")
|
||||||
|
|
||||||
|
(defmacro oni:stumpwm (&rest body)
|
||||||
|
"Execute BODY in stumpwm."
|
||||||
|
(declare (indent 0))
|
||||||
|
`(call-process oni:stumpish-program nil nil nil
|
||||||
|
,(format "eval '%S'" `(progn ,@body))))
|
||||||
|
|
||||||
|
(defun oni:stumpwm-command (cmd)
|
||||||
|
"Execute CMD in stumpwm."
|
||||||
|
(call-process oni:stumpish-program nil nil nil cmd))
|
||||||
|
|
||||||
|
(defun oni:stumpwm-echo (message)
|
||||||
|
(call-process oni:stumpish-program nil nil nil (format "echo %s" message)))
|
||||||
|
#+END_SRC
|
||||||
|
|
||||||
|
** Fall back on stumpwm when moving around
|
||||||
|
|
||||||
|
Using the function specified in [[Stumpwm integration]] wrap the
|
||||||
|
=windmove-do-window-select= function and catch any error produced,
|
||||||
|
hoping it's the error that there's no more window to move to and
|
||||||
|
then request that stumpwm move the focus in the same direction as
|
||||||
|
windmove would have.
|
||||||
|
|
||||||
|
#+BEGIN_SRC emacs-lisp
|
||||||
|
(defadvice windmove-do-window-select
|
||||||
|
(around oni:windmove-stumpwm activate)
|
||||||
|
"If no window can be moved to, move stumpwm."
|
||||||
|
(condition-case err
|
||||||
|
ad-do-it
|
||||||
|
(error (oni:stumpwm-command
|
||||||
|
(format "move-focus %s" (ad-get-arg 0))))))
|
||||||
|
#+END_SRC
|
||||||
|
|
||||||
|
* Don't just quit Emacs with {{{key(C-x C-c)}}} in the daemon
|
||||||
|
|
||||||
|
When working with Emacs as a daemon, which I do almost all of the
|
||||||
|
time, I prefer using {{{key(C-x C-c)}}} to close the current frame
|
||||||
|
instead of the entire session. Before this change I would
|
||||||
|
occasionally close my session by mistake.
|
||||||
|
|
||||||
|
#+BEGIN_SRC emacs-lisp
|
||||||
|
(defun oni:close-client-window ()
|
||||||
|
"Close a client's frames."
|
||||||
|
(interactive)
|
||||||
|
(server-save-buffers-kill-terminal nil))
|
||||||
|
|
||||||
|
(when (daemonp)
|
||||||
|
(global-set-key (kbd "C-x C-c") 'oni:close-client-window))
|
||||||
|
#+END_SRC
|
||||||
|
|
||||||
|
* Don't minimize the frame with {{{key(C-z)}}}
|
||||||
|
|
||||||
|
One of the more annoying things that can happen is accidentally
|
||||||
|
minimizing the frame you're working with. This doesn't really matter
|
||||||
|
if you're working on a normal stacking window manager, but with a
|
||||||
|
tiling window manager and no task bar this just causes the Emacs
|
||||||
|
frame to hang until it is refocused or disappear with no way to get
|
||||||
|
it back.
|
||||||
|
|
||||||
|
#+BEGIN_SRC emacs-lisp
|
||||||
|
(when (or window-system (daemonp))
|
||||||
|
(global-unset-key (kbd "C-z")))
|
||||||
|
#+END_SRC
|
||||||
|
|
||||||
|
* Use the right dictionary
|
||||||
|
|
||||||
|
One of the caveats of using two (or more) languages in a single
|
||||||
|
installation of Gnus is that ispell sometimes gets confused. Having
|
||||||
|
come across a stackoverflow question[fn:7] about just this subject
|
||||||
|
it was easy to modify the source code posted there to come up with
|
||||||
|
this.
|
||||||
|
|
||||||
|
*Note:* See my [[Function declarations][note]] on function declarations about the use of
|
||||||
|
=declare-function=.
|
||||||
|
|
||||||
|
#+BEGIN_SRC emacs-lisp
|
||||||
|
(declare-function message-narrow-to-headers-or-head "message")
|
||||||
|
(declare-function message-fetch-field "message")
|
||||||
|
|
||||||
|
(defun oni:switch-ispell-dictionary ()
|
||||||
|
(save-excursion
|
||||||
|
(message-narrow-to-headers-or-head)
|
||||||
|
(let ((from (message-fetch-field "From")))
|
||||||
|
(ispell-change-dictionary
|
||||||
|
(if (string-match (rx "@aethon.nl>" eol) from) "nl" "en")))))
|
||||||
|
|
||||||
|
(add-hook 'message-setup-hook 'oni:switch-ispell-dictionary)
|
||||||
|
#+END_SRC
|
||||||
|
|
||||||
|
* Don't let shr use background color
|
||||||
|
|
||||||
|
Reading mail in Gnus is very nice, but shr has become a little too
|
||||||
|
good at its job. Add to this the many occasions when a background is
|
||||||
|
specified without specifying a foreground, plus a color theme that
|
||||||
|
is the inverse of what is usually expected, and you can get
|
||||||
|
hard-to-read HTML messages, gray foreground and gray background.
|
||||||
|
|
||||||
|
I've looked at the other possible renderers, but they don't look
|
||||||
|
very nice compared to shr. So just remove its ability to add
|
||||||
|
background colors.
|
||||||
|
|
||||||
|
*Note:* See my [[Function declarations][note]] on function declarations about the use of
|
||||||
|
=declare-function=.
|
||||||
|
|
||||||
|
#+BEGIN_SRC emacs-lisp
|
||||||
|
(declare-function shr-colorize-region "shr")
|
||||||
|
|
||||||
|
(defun oni:shr-colorize-remove-last-arg (args)
|
||||||
|
"If ARGS has more than 3 items, remove the last one."
|
||||||
|
(if (> (length args) 3)
|
||||||
|
(butlast args)
|
||||||
|
args))
|
||||||
|
|
||||||
|
(with-eval-after-load 'shr
|
||||||
|
(advice-add #'shr-colorize-region :filter-args
|
||||||
|
#'oni:shr-colorize-remove-last-arg))
|
||||||
|
#+END_SRC
|
||||||
|
|
||||||
|
* Optimized ~with-eval-after-load~
|
||||||
|
|
||||||
|
First offered [[http://www.lunaryorn.com/2013/05/01/byte-compiling-eval-after-load.html][here]] and then later updated [[http://www.lunaryorn.com/2013/06/25/introducing-with-eval-after-load.html][here]] (when
|
||||||
|
~with-eval-after-load~ was added). Makes for very nice on-demand
|
||||||
|
settings loading.
|
||||||
|
|
||||||
|
#+BEGIN_SRC emacs-lisp
|
||||||
|
;; http://www.lunaryorn.com/2013/06/25/introducing-with-eval-after-load/
|
||||||
|
(defmacro stante-after (feature &rest forms)
|
||||||
|
"After FEATURE is loaded, evaluate FORMS.
|
||||||
|
|
||||||
|
FEATURE may be an unquoted feature symbol or a file name, see
|
||||||
|
`eval-after-load'."
|
||||||
|
(declare (indent 1) (debug t))
|
||||||
|
`(,(if (or (not byte-compile-current-file)
|
||||||
|
(if (symbolp feature)
|
||||||
|
(require feature nil :noerror)
|
||||||
|
(load feature :no-message :no-error)))
|
||||||
|
`progn
|
||||||
|
(message "stante-after: cannot find %s" feature)
|
||||||
|
'with-no-warnings)
|
||||||
|
(with-eval-after-load ',feature ,@forms)))
|
||||||
|
#+END_SRC
|
||||||
|
|
||||||
|
* Remember SQL input
|
||||||
|
|
||||||
|
Remembering input between sessions is a good thing.
|
||||||
|
|
||||||
|
#+BEGIN_SRC emacs-lisp
|
||||||
|
(stante-after sql
|
||||||
|
(setf sql-input-ring-file-name
|
||||||
|
(expand-file-name "~/.emacs.d/sqliinput")))
|
||||||
|
#+END_SRC
|
||||||
|
|
||||||
|
* Lazily load some buffers
|
||||||
|
|
||||||
|
Don't load all buffers right away. Having a lot of buffers and
|
||||||
|
switching between projects a lot can take up quite a bit of time.
|
||||||
|
|
||||||
|
*Note:* See my [[Vacuous defvar][note]] on vacuous defvar for this use of =defvar=.
|
||||||
|
|
||||||
|
#+BEGIN_SRC emacs-lisp
|
||||||
|
(defvar desktop-restore-eager)
|
||||||
|
(setq desktop-restore-eager 5)
|
||||||
|
#+END_SRC
|
||||||
|
|
||||||
|
* Fix some term keybindings
|
||||||
|
|
||||||
|
=ansi-term= passes along a lot of characters correctly, but things
|
||||||
|
like =forward-delete-word= are not, by default. This is confusing when
|
||||||
|
you see one thing and another is sent. Passing the correct keys
|
||||||
|
directly to the terminal fixes this problem.
|
||||||
|
|
||||||
|
*Note:* See my [[Vacuous defvar][note]] on vacuous defvar for this use of =defvar=.
|
||||||
|
|
||||||
|
*Note:* See my [[Function declarations][note]] on function declarations about the use of
|
||||||
|
=declare-function=.
|
||||||
|
|
||||||
|
#+BEGIN_SRC emacs-lisp
|
||||||
|
(defvar term-raw-map)
|
||||||
|
(declare-function term-send-raw-string "term")
|
||||||
|
|
||||||
|
(defun oni:set-term-keys ()
|
||||||
|
(cl-flet ((zcommand (key)
|
||||||
|
(lambda ()
|
||||||
|
(interactive) (term-send-raw-string key))))
|
||||||
|
(define-key term-raw-map
|
||||||
|
(kbd "C-<backspace>") (zcommand "\C-H"))))
|
||||||
|
|
||||||
|
(add-hook 'term-mode-hook #'oni:set-term-keys)
|
||||||
|
#+END_SRC
|
||||||
|
|
||||||
|
* Ask for a ~y~ or ~n~, not ~yes~ or ~no~.
|
||||||
|
|
||||||
|
Emacs starts out asking for you to type ~yes~ or ~no~ with most
|
||||||
|
important questions. It is possible that this is used for such
|
||||||
|
important questions where accidentally saying ~yes~ when you meant ~no~
|
||||||
|
would be catastrophic (or at least could be). However, I've never
|
||||||
|
(so far) had this problem, and I find it quite tedious to have to
|
||||||
|
write out ~yes~ or ~no~ and then press {{{kbd(RET)}}}, give me a simple
|
||||||
|
~y~ or ~n~ with no {{{kdb(RET)}}} required and I'm quite happy.
|
||||||
|
|
||||||
|
#+BEGIN_SRC emacs-lisp
|
||||||
|
(defalias 'yes-or-no-p 'y-or-n-p)
|
||||||
|
#+END_SRC
|
||||||
|
|
||||||
|
* Use =hippie-expand=, not =dabbrev-expand=
|
||||||
|
|
||||||
|
I've never actually used =dabbrev-expand=, and only rarely use
|
||||||
|
=hippie-expand= really, but since =hippie-expand= also includes a
|
||||||
|
=dabbrev= expander and a lot more than just that, it seems alright to
|
||||||
|
do this.
|
||||||
|
|
||||||
|
#+BEGIN_SRC emacs-lisp
|
||||||
|
(defalias 'dabbrev-expand 'hippie-expand)
|
||||||
|
#+END_SRC
|
||||||
|
|
||||||
|
* Setting up =load-path=
|
||||||
|
|
||||||
|
First, to help, I create a function that takes a path, adds it to
|
||||||
|
=load-path= and then checks to see if there is a file named
|
||||||
|
~loaddefs.el~ in the given path. If there is, it loads it. This
|
||||||
|
~loaddefs.el~ file is something that is created from autoload cookies
|
||||||
|
in the files in some of these paths.
|
||||||
|
|
||||||
|
Since the =load-path= is also important during byte-compilation, this
|
||||||
|
function should be defined both at run-time and compile-time.
|
||||||
|
|
||||||
|
#+BEGIN_SRC emacs-lisp
|
||||||
|
(eval-and-compile
|
||||||
|
(defun oni:loadpath-add-and-autoload (path)
|
||||||
|
"Add PATH to `load-path' and load a `loaddefs.el' if it exists."
|
||||||
|
(add-to-list 'load-path path)
|
||||||
|
(let ((loaddefs (concat path "/loaddefs.el")))
|
||||||
|
(when (file-exists-p loaddefs)
|
||||||
|
(load loaddefs)))))
|
||||||
|
#+END_SRC
|
||||||
|
|
||||||
|
After that I add some directories to my =load-path= so I can use these
|
||||||
|
libraries when wanted. One of these is the ~site-lisp~ directory in my
|
||||||
|
~.emacs.d~ directory, which is where I keep most of my personal
|
||||||
|
non-ELPA modules (like module-specific initialization files). There
|
||||||
|
are also some directories I include in ~vendor-lisp~, which is where I
|
||||||
|
keep modules that I didn't write myself and, for some reason, can't
|
||||||
|
or don't want to use ELPA for. Again it is important to realize that
|
||||||
|
this information is relevant both at run-time and compile-time, so
|
||||||
|
we wrap it with an =eval-and-compile=.
|
||||||
|
|
||||||
|
#+BEGIN_SRC emacs-lisp
|
||||||
|
(eval-and-compile
|
||||||
|
(mapc #'oni:loadpath-add-and-autoload
|
||||||
|
'("~/.emacs.d/site-lisp"
|
||||||
|
"~/.emacs.d/vendor-lisp/mozrepl"
|
||||||
|
"~/.emacs.d/vendor-lisp/eap" "/usr/share/emacs/site-lisp"
|
||||||
|
"/usr/lib/node_modules/tern/emacs/"
|
||||||
|
"~/.emacs.d/vendor-lisp/habitrpg.el")))
|
||||||
|
#+END_SRC
|
||||||
|
|
||||||
|
* Some unconditional settings
|
||||||
|
|
||||||
|
Here are some settings that either need to be changed before certain
|
||||||
|
modules load, or that don't belong in any specific module.
|
||||||
|
|
||||||
|
** Gnus init file
|
||||||
|
|
||||||
|
I put my gnus initialization file right where I put all my
|
||||||
|
module-specific initialization files. Gnus is special, though: It
|
||||||
|
loads the file every time you start it. That keeps it from using a
|
||||||
|
simple =(eval-after-load 'gnus '(load "gnus-init"))=.
|
||||||
|
|
||||||
|
*Note:* See my [[Vacuous defvar][note]] on vacuous defvar for this use of =defvar=.
|
||||||
|
|
||||||
|
#+BEGIN_SRC emacs-lisp
|
||||||
|
(defvar gnus-init-file)
|
||||||
|
(setq gnus-init-file "~/.emacs.d/site-lisp/gnus-init")
|
||||||
|
#+END_SRC
|
||||||
|
|
||||||
|
** Turn off bidirectional text
|
||||||
|
|
||||||
|
To speed things up a little, and because I have no contacts at all
|
||||||
|
(so far) who use right-to-left text, there is no reason for me to
|
||||||
|
use bidirectional text. For this reason I tell Emacs to always use
|
||||||
|
left-to-right by default, instead of checking each paragraph.
|
||||||
|
|
||||||
|
#+BEGIN_SRC emacs-lisp
|
||||||
|
(setq-default bidi-paragraph-direction 'left-to-right)
|
||||||
|
#+END_SRC
|
||||||
|
|
||||||
|
** Don't use tabs
|
||||||
|
|
||||||
|
There is a war going on out there. Actually there are several, but
|
||||||
|
the one I'm talking about here is the one about tabs vs. spaces. I
|
||||||
|
have been deeply entrenched in the spaces camp for quite a while.
|
||||||
|
Indentation always gets screwy for me if I don't use the exact same
|
||||||
|
=tab-width= everyone else uses. I just like the consistency of using
|
||||||
|
spaces.
|
||||||
|
|
||||||
|
#+BEGIN_SRC emacs-lisp
|
||||||
|
(setq-default indent-tabs-mode nil)
|
||||||
|
#+END_SRC
|
||||||
|
|
||||||
|
** Use four spaces for indentation
|
||||||
|
|
||||||
|
I once, long ago, started out with using eight spaces for each
|
||||||
|
level of indentation. Although I think, technically, I was using
|
||||||
|
tabs. This means that even just 3 levels of indentation take up a
|
||||||
|
/huge/ amount of space that can't be used for anything else. Since I
|
||||||
|
also try to limit the length of the lines in my code, this can make
|
||||||
|
for very little code per line.
|
||||||
|
|
||||||
|
I also tried (and enjoyed) two spaces, but after a while, looking
|
||||||
|
at bigger files, I noticed that it all becomes a blur. Two spaces
|
||||||
|
is not a big-enough visual difference to make code read nicely, in
|
||||||
|
my opinion.
|
||||||
|
|
||||||
|
So far, I have quite enjoyed four spaces for most code[fn:8].
|
||||||
|
|
||||||
|
#+BEGIN_SRC emacs-lisp
|
||||||
|
(setq-default tab-width 4)
|
||||||
|
#+END_SRC
|
||||||
|
|
||||||
|
** Keep the message buffer from growing too large
|
||||||
|
|
||||||
|
Keep at most one-thousand messages in the ~*Messages*~ buffer. I can
|
||||||
|
leave my Emacs session running for quite long times, sometimes
|
||||||
|
days, at a time. If there are a lot of messages it can get a little
|
||||||
|
tricky to manage/search.
|
||||||
|
|
||||||
|
#+BEGIN_SRC emacs-lisp
|
||||||
|
(setq message-log-max 1000)
|
||||||
|
#+END_SRC
|
||||||
|
|
||||||
|
** Don't start =elnode= when Emacs starts
|
||||||
|
|
||||||
|
Elnode is an awesome project and I'm still looking for a moment
|
||||||
|
where I have the inspiration and time to actually do something with
|
||||||
|
it. I started at some point, but then I couldn't get the cookies to
|
||||||
|
work and I switched over to using Common Lisp, only to eventually
|
||||||
|
stop developing the project because there was not chance of it
|
||||||
|
seeing any use in the foreseeable future.
|
||||||
|
|
||||||
|
There is one little annoyance, though, and that is the fact that
|
||||||
|
elnode will start itself up when Emacs starts. I don't want that.
|
||||||
|
|
||||||
|
This bit of code can't be put in an =eval-after-load= or anything
|
||||||
|
like that because by the time it would be evaluated, elnode would
|
||||||
|
already have started.
|
||||||
|
|
||||||
|
*Note:* See my [[Vacuous defvar][note]] on vacuous defvar for this use of =defvar=.
|
||||||
|
|
||||||
|
#+BEGIN_SRC emacs-lisp
|
||||||
|
(defvar elnode-do-init)
|
||||||
|
(setq elnode-do-init nil)
|
||||||
|
#+END_SRC
|
||||||
|
|
||||||
|
* Show python package name instead of file name
|
||||||
|
|
||||||
|
When working with python, knowing which package I'm in usually tells
|
||||||
|
me more about what I'm doing than the file name, especially when
|
||||||
|
working with django where almost every app will have a ~tests.py~ and
|
||||||
|
a ~models.py~. Of course =uniquify= fixes this pretty well too, though
|
||||||
|
in this case, it's less cool (imo).
|
||||||
|
|
||||||
|
First we define two functions that help us determine the package
|
||||||
|
name of the current file and the parent package name of the current
|
||||||
|
file. Finally we define a third function which determines the full
|
||||||
|
package name of the current buffer.
|
||||||
|
|
||||||
|
#+BEGIN_SRC emacs-lisp
|
||||||
|
(defun oni:python--get-current-module-name ()
|
||||||
|
"Get the name of the current python module.
|
||||||
|
|
||||||
|
This is very simply just the filename of the current buffer with
|
||||||
|
the extension and pyath removed."
|
||||||
|
(file-name-sans-extension
|
||||||
|
(file-name-nondirectory (buffer-file-name))))
|
||||||
|
|
||||||
|
(defun oni:python--get-parent-module-name (&optional dir)
|
||||||
|
"This gets the currend file's parent module.
|
||||||
|
|
||||||
|
This function recursively gathers the parent package name of
|
||||||
|
either DIR or the current buffer's file name. Any directory where
|
||||||
|
an `__init__.py' file is found is considered to be a package.
|
||||||
|
|
||||||
|
This function returns either the parent package, with its
|
||||||
|
parents, or nil if the current directory isn't a python
|
||||||
|
package.."
|
||||||
|
(let* ((base (directory-file-name
|
||||||
|
(file-name-directory (or dir (buffer-file-name)))))
|
||||||
|
(package (file-name-nondirectory base)))
|
||||||
|
(if (file-exists-p (concat base "/__init__.py"))
|
||||||
|
(let ((parent (oni:python--get-parent-module-name base)))
|
||||||
|
(if parent
|
||||||
|
(concat parent "." package)
|
||||||
|
package))
|
||||||
|
nil)))
|
||||||
|
|
||||||
|
(defun oni:python-package-name ()
|
||||||
|
(let ((current-module (oni:python--get-current-module-name)))
|
||||||
|
(if (file-exists-p "__init__.py")
|
||||||
|
(concat (oni:python--get-parent-module-name)
|
||||||
|
"." current-module)
|
||||||
|
current-module)))
|
||||||
|
#+END_SRC
|
||||||
|
|
||||||
|
After all this we make Emacs show the package name rather than the
|
||||||
|
file name in the mode-line.
|
||||||
|
|
||||||
|
#+BEGIN_SRC emacs-lisp
|
||||||
|
(defun oni:python-package-buffer-identification ()
|
||||||
|
"Have `mode-line-buffer-identification' show the python package name."
|
||||||
|
(setq mode-line-buffer-identification
|
||||||
|
'(:eval (oni:python-package-name))))
|
||||||
|
|
||||||
|
(add-hook 'python-mode-hook #'oni:python-package-buffer-identification)
|
||||||
|
#+END_SRC
|
||||||
|
|
||||||
|
* Add some known symbols for .conkerorrc/init.js to js2-mode
|
||||||
|
|
||||||
|
Conkeror has a lot of functions, and I don't like seeing them all as
|
||||||
|
unknowns. So add them to known symbols.
|
||||||
|
|
||||||
|
*Note:* See my [[Vacuous defvar][note]] on vacuous defvar for this use of =defvar=.
|
||||||
|
|
||||||
|
#+BEGIN_SRC emacs-lisp
|
||||||
|
(defvar js2-additional-externs)
|
||||||
|
|
||||||
|
(defun oni:js2-add-conkeror-symbols ()
|
||||||
|
"Add known/used conkeror symbols to additional externs."
|
||||||
|
(when (string-suffix-p ".conkerorrc/init.js" (buffer-file-name))
|
||||||
|
(setq js2-additional-externs
|
||||||
|
'( ;; Functions
|
||||||
|
"add_hook" "check_buffer" "co_return" "content_buffer"
|
||||||
|
"define_browser_object_class" "define_key" "define_webjump"
|
||||||
|
"dumpln" "get_current_profile" "get_home_directory"
|
||||||
|
"get_recent_conkeror_window"
|
||||||
|
"hints_minibuffer_annotation_mode" "interactive" "load_spec"
|
||||||
|
"load_spec_uri_string" "load_url_in_new_buffer" "make_file"
|
||||||
|
"make_uri" "mode_line_adder"
|
||||||
|
"open_download_buffer_automatically" "prefix_completer"
|
||||||
|
"read_browser_object" "register_user_stylesheet"
|
||||||
|
"remove_hook" "require" "send_http_request" "session_pref"
|
||||||
|
"shell_command_blind" "theme_load"
|
||||||
|
;; Variables
|
||||||
|
"Cc" "Ci" "browser_object_history_url" "browser_object_links"
|
||||||
|
"buffer_count_widget" "buffer_icon_widget" "content_buffer"
|
||||||
|
"content_buffer_form_keymap" "content_buffer_normal_keymap"
|
||||||
|
"content_buffer_text_keymap" "content_policy_accept"
|
||||||
|
"content_policy_bytype" "content_policy_reject" "cwd"
|
||||||
|
"default_base_keymap" "default_global_keymap"
|
||||||
|
"downloads_status_widget" "external_content_handlers"
|
||||||
|
"hint_digits" "load_paths" "read_buffer_show_icons"
|
||||||
|
"read_url_handler_list" "session_auto_save_auto_load"
|
||||||
|
"theme_load_paths" "title_format_fn" "url_remoting_fn"
|
||||||
|
;; Keyword argument
|
||||||
|
"$alternative" "$browser_object" "$completer" "$completions"
|
||||||
|
"$initial_value" "$options" "$prompt" "$sort_order"
|
||||||
|
"$use_bookmarks" "$use_history" "$use_webjumps"))))
|
||||||
|
|
||||||
|
(add-hook 'js2-init-hook #'oni:js2-add-conkeror-symbols)
|
||||||
|
#+END_SRC
|
||||||
|
|
||||||
|
* Teach eww about <code> tags
|
||||||
|
|
||||||
|
Strangely enough, ~eww~ doesn't seem to be aware of =<code>= HTML tags.
|
||||||
|
Luckily it's trivial to teach it. It does know about =<pre>= HTML
|
||||||
|
tags, and basically I just want =<code>= tags to be treated almost as
|
||||||
|
=<pre>= tags, so to do that we just have to define a =shr-tag-code=
|
||||||
|
function. I've copied the =shr-tag-pre= function and removed the calls
|
||||||
|
to =ensure-newline=, because =<code>= tags are inline tags.
|
||||||
|
|
||||||
|
In order to remain a little future-proof, it should only be done if
|
||||||
|
it doesn't already exist.
|
||||||
|
|
||||||
|
*Note:* See my [[Vacuous defvar][note]] on vacuous defvar for this use of =defvar=.
|
||||||
|
|
||||||
|
*Note:* See my [[Function declarations][note]] on function declarations about the use of
|
||||||
|
=declare-function=.
|
||||||
|
|
||||||
|
#+BEGIN_SRC emacs-lisp
|
||||||
|
(defvar shr-folding-mode)
|
||||||
|
(declare-function shr-indent "shr")
|
||||||
|
(declare-function shr-generic "shr")
|
||||||
|
|
||||||
|
(with-eval-after-load 'shr
|
||||||
|
(unless (fboundp 'shr-tag-code)
|
||||||
|
(defun shr-tag-code (cont)
|
||||||
|
(let ((shr-folding-mode 'none))
|
||||||
|
(shr-indent)
|
||||||
|
(shr-generic cont)))))
|
||||||
|
#+END_SRC
|
||||||
|
|
||||||
|
* Use scheme-mode for scsh interpreted files
|
||||||
|
|
||||||
|
Set the major mode for files interpreted by scsh (for example, by
|
||||||
|
having ~#!/usr/local/bin/scsh~ at the top) to use =scheme-mode=.
|
||||||
|
|
||||||
|
#+BEGIN_SRC emacs-lisp
|
||||||
|
(add-to-list 'interpreter-mode-alist '("scsh" . scheme-mode))
|
||||||
|
#+END_SRC
|
||||||
|
|
||||||
|
* Set default scheme implementation
|
||||||
|
|
||||||
|
Set the default implementation for geiser to guile so it doesn't ask
|
||||||
|
which implementation to use every time.
|
||||||
|
|
||||||
|
#+BEGIN_SRC emacs-lisp
|
||||||
|
(defvar geiser-default-implementation)
|
||||||
|
|
||||||
|
(with-eval-after-load 'geiser
|
||||||
|
(setq geiser-default-implementation 'guile))
|
||||||
|
#+END_SRC
|
||||||
|
|
||||||
|
* Setup eww-lnum
|
||||||
|
|
||||||
|
As recommended in the [[https://github.com/m00natic/eww-lnum][README]], set the keys in the =eww-mode-map=.
|
||||||
|
|
||||||
|
#+BEGIN_SRC emacs-lisp
|
||||||
|
(defvar eww-mode-map)
|
||||||
|
|
||||||
|
(with-eval-after-load 'eww
|
||||||
|
(define-key eww-mode-map "f" 'eww-lnum-follow)
|
||||||
|
(define-key eww-mode-map "F" 'eww-lnum-universal))
|
||||||
|
#+END_SRC
|
||||||
|
|
||||||
|
* Don't compile scss files
|
||||||
|
|
||||||
|
By default =scss-mode= tries compiling a file each time it's saved. I
|
||||||
|
don't have SCSS properly installed globally so this always fails,
|
||||||
|
highly annoying.
|
||||||
|
|
||||||
|
#+BEGIN_SRC emacs-lisp
|
||||||
|
(defvar scss-compile-at-save)
|
||||||
|
|
||||||
|
(with-eval-after-load 'scss-mode
|
||||||
|
(setq scss-compile-at-save nil))
|
||||||
|
#+END_SRC
|
||||||
|
|
||||||
|
* Change listings in dired
|
||||||
|
|
||||||
|
The number of bytes a file is doesn't usually tell me much when it's
|
||||||
|
something like ~292837~. I prefer seeing just how many Kb or Mb a
|
||||||
|
certain file is. I also don't need to see the ~.~ and ~..~ directories
|
||||||
|
when I insert directories into the current dired buffer, as there is
|
||||||
|
a great chance that the current and parent directory are already
|
||||||
|
shown in the buffer.
|
||||||
|
|
||||||
|
#+BEGIN_SRC emacs-lisp
|
||||||
|
(defvar dired-subdir-switches)
|
||||||
|
|
||||||
|
(with-eval-after-load 'dired
|
||||||
|
(setq dired-listing-switches "-alh"
|
||||||
|
dired-subdir-switches "-Alh"))
|
||||||
|
#+END_SRC
|
||||||
|
|
||||||
|
* Load custom file
|
||||||
|
|
||||||
|
I don't really use the Emacs customization interface much, but I
|
||||||
|
have used it as a kind-of persistent datastore, specifically for
|
||||||
|
desktop-registry[fn:9]. I do very much like the idea of it, it's a
|
||||||
|
very cool thing to have. I also use ~custom.el~ for storing some
|
||||||
|
things that I really can't store in a public viewing location like
|
||||||
|
this file or the git repository it lives in.
|
||||||
|
|
||||||
|
#+BEGIN_SRC emacs-lisp
|
||||||
|
(setq custom-file "~/.emacs.d/custom.el")
|
||||||
|
(load custom-file)
|
||||||
|
#+END_SRC
|
||||||
|
|
||||||
|
* Notes
|
||||||
|
|
||||||
|
Here are some random or somewhat general notes about things you may
|
||||||
|
run into when looking through my Emacs init.
|
||||||
|
|
||||||
|
** Vacuous defvar
|
||||||
|
|
||||||
|
A =defvar= without a value like =(defvar some-variable)= tells the
|
||||||
|
byte-compiler that the variable will appear, but doesn't give it a
|
||||||
|
value. It should only count for the file where it is used and once
|
||||||
|
the file with the /actual/ =defvar= is loaded it will be populated with
|
||||||
|
its value, contrary to what would happen if you'd given it a value
|
||||||
|
before loading its original file.
|
||||||
|
|
||||||
|
** Function declarations
|
||||||
|
|
||||||
|
The function =declare-function= tells the byte-compiler where to find
|
||||||
|
a certain function. This keeps the byte-compiler from complaining
|
||||||
|
about certain functions possibly not being defined at run-time.
|
||||||
|
|
||||||
|
* Footnotes
|
||||||
|
|
||||||
|
[fn:1] This runs =tmm-menubar=, which lets you navigate the menubar in a
|
||||||
|
text-driven way. I don't ever use it because I know what all my
|
||||||
|
favorite functions are called, but it seems a great deal more
|
||||||
|
efficient than having to click on everything.
|
||||||
|
|
||||||
|
[fn:2] https://github.com/sabof/svg-mode-line-themes
|
||||||
|
|
||||||
|
[fn:3] It works fine for me with something like jabber chats and the
|
||||||
|
like.
|
||||||
|
|
||||||
|
[fn:4] I like to program in Lisp, parentheses are important to me!
|
||||||
|
Parentheses should be nice and round, not almost like bars!
|
||||||
|
|
||||||
|
[fn:5] https://github.com/belluzj/fantasque-sans
|
||||||
|
|
||||||
|
[fn:6] Used to be Cosmic Sans Neue Mono, the name changed because
|
||||||
|
people misread it as "Comic" (me included, which was the original
|
||||||
|
reason I checked it out, for laughs) and hate Comic Sans, and also
|
||||||
|
because there was already a Cosmic Sans font as well, which could
|
||||||
|
cause confusion.
|
||||||
|
|
||||||
|
[fn:7] http://stackoverflow.com/questions/22175214/automatically-switch-language-in-gnus-depending-on-recipient
|
||||||
|
|
||||||
|
[fn:8] I still use 2 spaces for some languages, like HTML.
|
||||||
|
|
||||||
|
[fn:9] http://code.ryuslash.org/desktop-registry/about/
|
13
emacs/.emacs.d/project.el
Normal file
13
emacs/.emacs.d/project.el
Normal file
|
@ -0,0 +1,13 @@
|
||||||
|
(require 'ox-publish)
|
||||||
|
|
||||||
|
(setq org-publish-use-timestamps-flag nil
|
||||||
|
org-html-htmlize-output-type 'css
|
||||||
|
org-publish-project-alist
|
||||||
|
'(("org"
|
||||||
|
:base-directory "./"
|
||||||
|
:publishing-directory "_publish/"
|
||||||
|
:recursive nil
|
||||||
|
:base-extension "org"
|
||||||
|
:publishing-function org-html-publish-to-html
|
||||||
|
:html-doctype "<!DOCTYPE html>"
|
||||||
|
:html-link-home "https://ryuslash.org")))
|
1
emacs/.emacs.d/site-lisp/.gitignore
vendored
Normal file
1
emacs/.emacs.d/site-lisp/.gitignore
vendored
Normal file
|
@ -0,0 +1 @@
|
||||||
|
rudel/
|
5
emacs/.emacs.d/site-lisp/Makefile
Normal file
5
emacs/.emacs.d/site-lisp/Makefile
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
.PHONY: all
|
||||||
|
all: appt-init.elc jabber-init.elc org-init.elc gnus-init.elc
|
||||||
|
|
||||||
|
%.elc: %.el
|
||||||
|
emacs -Q -batch -eval "(byte-compile-file \"$<\")"
|
46
emacs/.emacs.d/site-lisp/appt-init.el
Normal file
46
emacs/.emacs.d/site-lisp/appt-init.el
Normal file
|
@ -0,0 +1,46 @@
|
||||||
|
;;; appt-init.el --- Initialization for appt -*- lexical-binding: t; -*-
|
||||||
|
|
||||||
|
;; Copyright (C) 2014 Tom Willemse
|
||||||
|
|
||||||
|
;; Author: Tom Willemse <tom@ryuslash.org>
|
||||||
|
;; Keywords:
|
||||||
|
|
||||||
|
;; 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 this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
;;; Commentary:
|
||||||
|
|
||||||
|
;; Initialization code for the `appt' library, should get loaded when
|
||||||
|
;; `appt' is.
|
||||||
|
|
||||||
|
;;; Code:
|
||||||
|
|
||||||
|
(require 'appt)
|
||||||
|
|
||||||
|
(autoload 'jabber-send-message "jabber-chat")
|
||||||
|
(defvar jabber-connections)
|
||||||
|
|
||||||
|
(defun oni:appt-display-window-and-jabber (min-to-app new-time appt-msg)
|
||||||
|
"Send a message to my phone jabber account."
|
||||||
|
(let ((fmt "%s%s (in %s minutes)"))
|
||||||
|
(jabber-send-message
|
||||||
|
(car jabber-connections) "phone@ryuslash.org" nil
|
||||||
|
(format fmt new-time appt-msg min-to-app) nil))
|
||||||
|
(appt-disp-window min-to-app new-time appt-msg))
|
||||||
|
|
||||||
|
(setq appt-disp-window-function #'oni:appt-display-window-and-jabber
|
||||||
|
appt-display-diary nil)
|
||||||
|
|
||||||
|
|
||||||
|
(provide 'appt-init)
|
||||||
|
;;; appt-init.el ends here
|
35
emacs/.emacs.d/site-lisp/avandu-init.el
Normal file
35
emacs/.emacs.d/site-lisp/avandu-init.el
Normal file
|
@ -0,0 +1,35 @@
|
||||||
|
;;; avandu-init.el --- Initialization for avandu -*- lexical-binding: t; -*-
|
||||||
|
|
||||||
|
;; Copyright (C) 2014 Tom Willemse
|
||||||
|
|
||||||
|
;; Author: Tom Willemse <tom@ryuslash.org>
|
||||||
|
;; Keywords:
|
||||||
|
|
||||||
|
;; 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 this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
;;; Commentary:
|
||||||
|
|
||||||
|
;; Initialization code for the `avandu' library, should get loaded
|
||||||
|
;; when `avandu' is.
|
||||||
|
|
||||||
|
;;; Code:
|
||||||
|
|
||||||
|
(require 'avandu)
|
||||||
|
|
||||||
|
(setq avandu-user "admin"
|
||||||
|
avandu-tt-rss-api-url "https://ryuslash.org/tt-rss/api/"
|
||||||
|
avandu-html2text-command #'shr-render-region)
|
||||||
|
|
||||||
|
(provide 'avandu-init)
|
||||||
|
;;; avandu-init.el ends here
|
8
emacs/.emacs.d/site-lisp/drd.el
Normal file
8
emacs/.emacs.d/site-lisp/drd.el
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
(let ((quicklisp-slime-directory
|
||||||
|
"~/.local/share/quicklisp/local-projects/slime/"))
|
||||||
|
(add-to-list 'load-path quicklisp-slime-directory)
|
||||||
|
(require 'slime-autoloads)
|
||||||
|
(setq slime-backend (expand-file-name "swank-loader.lisp"
|
||||||
|
quicklisp-slime-directory)
|
||||||
|
slime-path quicklisp-slime-directory)
|
||||||
|
(slime-setup '(slime-fancy)))
|
86
emacs/.emacs.d/site-lisp/dzen.el
Normal file
86
emacs/.emacs.d/site-lisp/dzen.el
Normal file
|
@ -0,0 +1,86 @@
|
||||||
|
;;; dzen.el --- Control DZEN2 from emacs
|
||||||
|
|
||||||
|
;; Copyright (C) 2012 Tom Willemse
|
||||||
|
|
||||||
|
;; Author: Tom Willemse <slash@drd>
|
||||||
|
;; Keywords: convenience
|
||||||
|
|
||||||
|
;; 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 this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
;;; Commentary:
|
||||||
|
|
||||||
|
;;
|
||||||
|
|
||||||
|
;;; Code:
|
||||||
|
|
||||||
|
(require 'newst-backend)
|
||||||
|
(require 'sawfish)
|
||||||
|
|
||||||
|
(defvar dzen-process nil
|
||||||
|
"Dzen2's process.")
|
||||||
|
|
||||||
|
(defvar dzen-timer nil
|
||||||
|
"Timer used to update the dzen line.")
|
||||||
|
|
||||||
|
(defun get-mail-count (account)
|
||||||
|
(length (directory-files (concat "/home/slash/documents/mail/"
|
||||||
|
account "/inbox/new") nil "^[^.]")))
|
||||||
|
|
||||||
|
(defun dzen-update ()
|
||||||
|
(let ((strl "")
|
||||||
|
(strc (if (boundp 'metal-express-radio-currently-playing)
|
||||||
|
metal-express-radio-currently-playing
|
||||||
|
""))
|
||||||
|
(strr (format
|
||||||
|
"jabber: %s ryu: %d gm: %d aet: %d 9n: %d rss: %d\n"
|
||||||
|
(oni:current-jabber-status)
|
||||||
|
(get-mail-count "ryuslash.org")
|
||||||
|
(get-mail-count "gmail")
|
||||||
|
(get-mail-count "aethon")
|
||||||
|
(get-mail-count "ninthfloor")
|
||||||
|
(newsticker--stat-num-items-total 'new))))
|
||||||
|
(process-send-string
|
||||||
|
"dzen2" (format "%s^p(_CENTER)^p(-%d)%s^p(_RIGHT)^p(-%d)%s"
|
||||||
|
strl
|
||||||
|
(* (floor (/ (length strc) 2)) 8) strc
|
||||||
|
(+ 8 (* 8 (length strr))) strr))))
|
||||||
|
|
||||||
|
(defun dzen-start ()
|
||||||
|
(interactive)
|
||||||
|
(if (or (null dzen-process) (not (process-live-p dzen-process)))
|
||||||
|
(progn
|
||||||
|
(setq dzen-process
|
||||||
|
(start-process "dzen2" "*dzen2*" "dzen2"
|
||||||
|
"-w" "1920"
|
||||||
|
"-fn" "Monaco-10"
|
||||||
|
"-bg" "#222224"
|
||||||
|
"-fg" "#eeeeec"
|
||||||
|
"-y" "1060"))
|
||||||
|
(dzen-update)
|
||||||
|
(setq dzen-timer (run-with-timer 1 1 #'dzen-update)))
|
||||||
|
(message "Dzen2 already running")))
|
||||||
|
|
||||||
|
(defun dzen-stop ()
|
||||||
|
(interactive)
|
||||||
|
(if (and dzen-process (process-live-p dzen-process))
|
||||||
|
(progn
|
||||||
|
(when dzen-timer
|
||||||
|
(cancel-timer dzen-timer))
|
||||||
|
(kill-process "dzen2"))
|
||||||
|
(message "Dzen2 is not running"))
|
||||||
|
(setq dzen-process nil
|
||||||
|
dzen-timer nil))
|
||||||
|
|
||||||
|
(provide 'dzen)
|
||||||
|
;;; dzen.el ends here
|
266
emacs/.emacs.d/site-lisp/eltuki.el
Normal file
266
emacs/.emacs.d/site-lisp/eltuki.el
Normal file
|
@ -0,0 +1,266 @@
|
||||||
|
;;; eltuki.el --- Tekuti functions
|
||||||
|
|
||||||
|
;; Copyright (C) 2012 Tom Willemse
|
||||||
|
|
||||||
|
;; Author: Tom Willemse <slash@drd>
|
||||||
|
;; Keywords: convenience
|
||||||
|
|
||||||
|
;; 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 this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
;;; Commentary:
|
||||||
|
|
||||||
|
;; Tekuti functions.
|
||||||
|
|
||||||
|
;;; Code:
|
||||||
|
|
||||||
|
(require 'org)
|
||||||
|
|
||||||
|
(defgroup eltuki
|
||||||
|
nil
|
||||||
|
"tekuti functions in Emacs."
|
||||||
|
:group 'external)
|
||||||
|
|
||||||
|
(defcustom eltuki-blog-dir "~/blog"
|
||||||
|
"Plain blog post directory, not the git repository."
|
||||||
|
:group 'eltuki
|
||||||
|
:type 'string)
|
||||||
|
|
||||||
|
(defcustom eltuki-default-status "publish"
|
||||||
|
"Default status to use when status is unknown."
|
||||||
|
:group 'eltuki
|
||||||
|
:type 'string)
|
||||||
|
|
||||||
|
(defcustom eltuki-default-comment-status "open"
|
||||||
|
"Default status for comments."
|
||||||
|
:group 'eltuki
|
||||||
|
:type 'string)
|
||||||
|
|
||||||
|
(define-skeleton eltuki-post
|
||||||
|
"Create a post template for eltuki."
|
||||||
|
""
|
||||||
|
"#+TITLE: " (skeleton-read "Title: ") "\n"
|
||||||
|
"#+TIMESTAMP: \n"
|
||||||
|
"#+TAGS: " (skeleton-read "Tags (comma separated): ") "\n"
|
||||||
|
"\n"
|
||||||
|
_)
|
||||||
|
|
||||||
|
(defun eltuki-new-post ()
|
||||||
|
(interactive)
|
||||||
|
(switch-to-buffer (get-buffer-create "*eltuki*"))
|
||||||
|
(org-mode)
|
||||||
|
(eltuki-post))
|
||||||
|
|
||||||
|
(defun eltuki-get-title ()
|
||||||
|
(save-excursion
|
||||||
|
(goto-char (point-min))
|
||||||
|
(if (re-search-forward "^#\\+TITLE: \\(.*\\)$" nil t)
|
||||||
|
(buffer-substring-no-properties
|
||||||
|
(match-beginning 1) (match-end 1))
|
||||||
|
(error "Post has no title."))))
|
||||||
|
|
||||||
|
(defun eltuki-set-title (title)
|
||||||
|
(interactive "MTitle: ")
|
||||||
|
(setq title (concat " " title))
|
||||||
|
(save-excursion
|
||||||
|
(goto-char (point-min))
|
||||||
|
(if (re-search-forward "^#\\+TITLE:\\(.*\\)$" nil t)
|
||||||
|
(replace-match title t t nil 1)
|
||||||
|
(insert "#+TITLE:" title "\n")
|
||||||
|
(unless (= (char-after) ?\n)
|
||||||
|
(insert-char ?\n)))))
|
||||||
|
|
||||||
|
(defun eltuki-get-timestamp ()
|
||||||
|
(save-excursion
|
||||||
|
(goto-char (point-min))
|
||||||
|
(if (re-search-forward "^#\\+TIMESTAMP: \\([[:digit:]]+\\)$" nil t)
|
||||||
|
(match-string 1)
|
||||||
|
(format-time-string "%s"))))
|
||||||
|
|
||||||
|
(defun eltuki-set-timestamp ()
|
||||||
|
(interactive)
|
||||||
|
(save-excursion
|
||||||
|
(goto-char (point-min))
|
||||||
|
(let ((newtime (format-time-string " %s")))
|
||||||
|
(if (re-search-forward "^#\\+TIMESTAMP:\\(.*\\)$" nil t)
|
||||||
|
(replace-match newtime nil t nil 1)
|
||||||
|
(when (search-forward "\n\n" nil t)
|
||||||
|
(backward-char))
|
||||||
|
(insert "#+TIMESTAMP:" newtime "\n")))))
|
||||||
|
|
||||||
|
(defun eltuki-get-tags ()
|
||||||
|
(save-excursion
|
||||||
|
(goto-char (point-min))
|
||||||
|
(when (re-search-forward "^#\\+TAGS: \\(.*\\)$" nil t)
|
||||||
|
(buffer-substring-no-properties
|
||||||
|
(match-beginning 1) (match-end 1)))))
|
||||||
|
|
||||||
|
(defun eltuki-set-tags (tags)
|
||||||
|
(interactive "MTags: ")
|
||||||
|
(setq tags (concat " " tags))
|
||||||
|
(save-excursion
|
||||||
|
(goto-char (point-min))
|
||||||
|
(if (re-search-forward "^#\\+TAGS:\\(.*\\)$" nil t)
|
||||||
|
(replace-match tags t t nil 1)
|
||||||
|
(when (search-forward "\n\n" nil t)
|
||||||
|
(backward-char))
|
||||||
|
(insert "#+TAGS:" tags "\n"))))
|
||||||
|
|
||||||
|
(defun eltuki-get-status ()
|
||||||
|
(save-excursion
|
||||||
|
(goto-char (point-min))
|
||||||
|
(if (re-search-forward "^#\\+STATUS: \\(draft\\|publish\\)$" nil t)
|
||||||
|
(buffer-substring-no-properties
|
||||||
|
(match-beginning 1) (match-end 1))
|
||||||
|
eltuki-default-status)))
|
||||||
|
|
||||||
|
(defun eltuki-toggle-status ()
|
||||||
|
(interactive)
|
||||||
|
(save-excursion
|
||||||
|
(goto-char (point-min))
|
||||||
|
(let ((newstatus (if (string= (eltuki-get-status) "draft")
|
||||||
|
" publish"
|
||||||
|
" draft")))
|
||||||
|
(if (re-search-forward "^#\\+STATUS:\\(.*\\)$" nil t)
|
||||||
|
(replace-match newstatus t t nil 1)
|
||||||
|
(when (search-forward "\n\n" nil t)
|
||||||
|
(backward-char))
|
||||||
|
(insert "#+STATUS:" newstatus "\n")))))
|
||||||
|
|
||||||
|
(defun eltuki-get-comment-status ()
|
||||||
|
(save-excursion
|
||||||
|
(goto-char (point-min))
|
||||||
|
(if (re-search-forward
|
||||||
|
"^#\\+COMMENTSTATUS: \\(open\\|closed\\)$" nil t)
|
||||||
|
(buffer-substring-no-properties
|
||||||
|
(match-beginning 1) (match-end 1))
|
||||||
|
eltuki-default-comment-status)))
|
||||||
|
|
||||||
|
(defun eltuki-toggle-comment-status ()
|
||||||
|
(interactive)
|
||||||
|
(save-excursion
|
||||||
|
(goto-char (point-min))
|
||||||
|
(let ((newstatus (if (string= (eltuki-get-comment-status) "closed")
|
||||||
|
" open"
|
||||||
|
" closed")))
|
||||||
|
(if (re-search-forward "^#\\+COMMENTSTATUS:\\(.*\\)$" nil t)
|
||||||
|
(replace-match newstatus t t nil 1)
|
||||||
|
(when (search-forward "\n\n" nil t)
|
||||||
|
(backward-char))
|
||||||
|
(insert "#+COMMENTSTATUS:" newstatus "\n")))))
|
||||||
|
|
||||||
|
(defun eltuki-slugify-string (str)
|
||||||
|
(while (string-match "[^a-zA-Z0-9 ]+" str)
|
||||||
|
(setq str (replace-match "" nil t str)))
|
||||||
|
(while (string-match " +" str)
|
||||||
|
(setq str (replace-match "-" nil t str)))
|
||||||
|
(downcase str))
|
||||||
|
|
||||||
|
(defun eltuki-get-directory ()
|
||||||
|
(concat
|
||||||
|
eltuki-blog-dir "/"
|
||||||
|
(format-time-string "%Y%%2f%m%%2f%d%%2f")
|
||||||
|
(eltuki-slugify-string (eltuki-get-title))))
|
||||||
|
|
||||||
|
(defun eltuki-write-content (dir)
|
||||||
|
(let ((org-export-with-toc nil)
|
||||||
|
(org-export-with-section-numbers nil)
|
||||||
|
(filename (concat dir "/content"))
|
||||||
|
(org-export-show-temporary-export-buffer nil))
|
||||||
|
(org-html-export-as-html nil nil nil t)
|
||||||
|
(with-current-buffer "*Org HTML Export*"
|
||||||
|
(write-region (point-min) (point-max) filename)
|
||||||
|
(kill-buffer))
|
||||||
|
filename))
|
||||||
|
|
||||||
|
(defun eltuki-write-metadata (dir)
|
||||||
|
(let ((timestamp (eltuki-get-timestamp))
|
||||||
|
(tags (eltuki-get-tags))
|
||||||
|
(status (eltuki-get-status))
|
||||||
|
(title (eltuki-get-title))
|
||||||
|
(name (eltuki-slugify-string (eltuki-get-title)))
|
||||||
|
(commentstatus (eltuki-get-comment-status))
|
||||||
|
(filename (concat dir "/metadata")))
|
||||||
|
(with-temp-buffer
|
||||||
|
(insert "timestamp: " timestamp "\n"
|
||||||
|
"tags: " tags "\n"
|
||||||
|
"status: " status "\n"
|
||||||
|
"title: " title "\n"
|
||||||
|
"name: " name "\n"
|
||||||
|
"comment_status: " commentstatus)
|
||||||
|
(write-region (point-min) (point-max) filename))
|
||||||
|
filename))
|
||||||
|
|
||||||
|
(defun eltuki-save-org (buffer dir)
|
||||||
|
(let ((filename (concat dir "/post.org")))
|
||||||
|
(with-current-buffer buffer
|
||||||
|
(write-file filename))
|
||||||
|
filename))
|
||||||
|
|
||||||
|
(defun eltuki-git-add (file)
|
||||||
|
(shell-command (concat "cd " eltuki-blog-dir "; git add '" (expand-file-name file) "'")))
|
||||||
|
|
||||||
|
(defun eltuki-commit ()
|
||||||
|
(shell-command (concat "cd " eltuki-blog-dir "; git commit -m \"new post: \\\"" (eltuki-get-title)
|
||||||
|
"\\\"\"")))
|
||||||
|
|
||||||
|
(defun eltuki-finish ()
|
||||||
|
(interactive)
|
||||||
|
(let ((buffer (or (get-buffer "*eltuki*")
|
||||||
|
(current-buffer)))
|
||||||
|
(dest (eltuki-get-directory)))
|
||||||
|
(unless (file-exists-p dest)
|
||||||
|
(mkdir dest))
|
||||||
|
|
||||||
|
(mapc #'eltuki-git-add
|
||||||
|
(list (eltuki-write-content dest)
|
||||||
|
(eltuki-write-metadata dest)
|
||||||
|
(eltuki-save-org buffer dest)))
|
||||||
|
|
||||||
|
(eltuki-commit)
|
||||||
|
(kill-buffer buffer)))
|
||||||
|
|
||||||
|
(defun eltuki-process-sentinel (proc status)
|
||||||
|
"Print PROC's STATUS."
|
||||||
|
(message "git %s" (substring status 0 -1)))
|
||||||
|
|
||||||
|
(defun eltuki--passwd-prompt (string)
|
||||||
|
"Decide on what to prompt based on STRING."
|
||||||
|
(cond
|
||||||
|
((or
|
||||||
|
(string-match "^Enter passphrase for key '\\\(.*\\\)': $" string)
|
||||||
|
(string-match "^\\\(.*\\\)'s password:" string))
|
||||||
|
(format "Password for '%s': " (match-string 1 string)))
|
||||||
|
((string-match "^[pP]assword:" string)
|
||||||
|
"Password:")))
|
||||||
|
|
||||||
|
(defun eltuki-process-filter (proc string)
|
||||||
|
"Check if PROC is asking for a password in STRING."
|
||||||
|
(with-current-buffer (process-buffer proc)
|
||||||
|
(let ((inhibit-read-only t)
|
||||||
|
(ask (eltuki--passwd-prompt string)))
|
||||||
|
(if ask
|
||||||
|
(process-send-string proc (concat (read-passwd ask nil) "\n"))
|
||||||
|
(insert string)))))
|
||||||
|
|
||||||
|
(defun eltuki-publish ()
|
||||||
|
"Publish posts."
|
||||||
|
(interactive)
|
||||||
|
(let* ((default-directory (concat eltuki-blog-dir "/"))
|
||||||
|
(proc (start-process "eltuki-publish" "*eltuki-publish*"
|
||||||
|
"git" "push")))
|
||||||
|
(set-process-sentinel proc 'eltuki-process-sentinel)
|
||||||
|
(set-process-filter proc 'eltuki-process-filter)))
|
||||||
|
|
||||||
|
(provide 'eltuki)
|
||||||
|
;;; eltuki.el ends here
|
82
emacs/.emacs.d/site-lisp/gnus-init.el
Normal file
82
emacs/.emacs.d/site-lisp/gnus-init.el
Normal file
|
@ -0,0 +1,82 @@
|
||||||
|
(eval-when-compile
|
||||||
|
(require 'gnus)
|
||||||
|
(require 'gnus-start)
|
||||||
|
(require 'gnus-sum)
|
||||||
|
(require 'gnus-art)
|
||||||
|
(require 'gnus-msg))
|
||||||
|
|
||||||
|
(defvar gnus-tmp-from)
|
||||||
|
|
||||||
|
(defvar oni:mail-adresses
|
||||||
|
(rx (or "tom@ryuslash.org" "ryuslash@ninthfloor.org"
|
||||||
|
"ryuslash@gmail.com")))
|
||||||
|
|
||||||
|
(defun gnus-user-format-function-a (headers)
|
||||||
|
(let ((to (gnus-extra-header 'To headers)))
|
||||||
|
(if (string-match oni:mail-adresses to)
|
||||||
|
(if (string-match "," to) "~" "»")
|
||||||
|
(if (or (string-match oni:mail-adresses
|
||||||
|
(gnus-extra-header 'Cc headers))
|
||||||
|
(string-match oni:mail-adresses
|
||||||
|
(gnus-extra-header 'BCc headers)))
|
||||||
|
"~"
|
||||||
|
" "))))
|
||||||
|
|
||||||
|
(setq gnus-ignored-from-addresses oni:mail-adresses)
|
||||||
|
(setq message-alternative-emails oni:mail-adresses)
|
||||||
|
(setq message-dont-reply-to-names oni:mail-adresses)
|
||||||
|
|
||||||
|
(defvar gnus-face-5 'font-lock-variable-name-face)
|
||||||
|
(defvar gnus-face-6 'font-lock-constant-face)
|
||||||
|
|
||||||
|
(setq gnus-group-line-format "%P %(%C%) %B%60=%4y%-2M%S\n")
|
||||||
|
(setq gnus-summary-line-format "%U%R%z%ua%I%(%*%[%5{%-23,23f%}%]%) %s\n")
|
||||||
|
(setq gnus-summary-mode-line-format "Gnus: %G %Z")
|
||||||
|
(setq gnus-select-method '(nntp "news.gmane.org"))
|
||||||
|
(setq gnus-secondary-select-methods
|
||||||
|
'((nnmaildir "gmail"
|
||||||
|
(directory "~/documents/mail/gmail/"))
|
||||||
|
(nnmaildir "ninthfloor"
|
||||||
|
(directory "~/documents/mail/ninthfloor/"))
|
||||||
|
;; (nnmaildir "aethon"
|
||||||
|
;; (directory "~/documents/mail/aethon/"))
|
||||||
|
(nnmaildir "ryuslash"
|
||||||
|
(directory "~/documents/mail/ryuslash.org/"))
|
||||||
|
(nntp "news.gwene.org")))
|
||||||
|
(setq gnus-auto-subscribed-groups nil)
|
||||||
|
(setq gnus-save-newsrc-file nil)
|
||||||
|
(setq gnus-read-newsrc-file nil)
|
||||||
|
(setq gnus-article-truncate-lines nil)
|
||||||
|
(setq gnus-permanently-visible-groups
|
||||||
|
(rx (and (or "gmail" "aethon" "ninthfloor" "ryuslash")
|
||||||
|
":inbox")))
|
||||||
|
(setq gnus-check-new-newsgroups nil)
|
||||||
|
(setq gnus-novice-user nil)
|
||||||
|
(setq gnus-posting-styles
|
||||||
|
'((".*"
|
||||||
|
(address "tom@ryuslash.org")
|
||||||
|
(eval (setq message-sendmail-extra-arguments '("-a" "ryuslash"))))
|
||||||
|
("gmail:"
|
||||||
|
(address "ryuslash@gmail.com")
|
||||||
|
(eval (setq message-sendmail-extra-arguments '("-a" "gmail"))))
|
||||||
|
("ninthfloor:"
|
||||||
|
(address "ryuslash@ninthfloor.org")
|
||||||
|
(eval (setq message-sendmail-extra-arguments '("-a" "ninthfloor"))))
|
||||||
|
("arch:"
|
||||||
|
(address "tom.willemsen@archlinux.us")
|
||||||
|
(eval (setq message-sendmail-extra-arguments '("-a" "arch"))))
|
||||||
|
("aethon:"
|
||||||
|
(name "Tom Willemsen")
|
||||||
|
(address "thomas@aethon.nl")
|
||||||
|
(signature-file "~/documents/work/aethon/signature_20131209.txt")
|
||||||
|
(eval (setq message-sendmail-extra-arguments '("-a" "aethon"))))))
|
||||||
|
(add-hook 'gnus-select-group-hook
|
||||||
|
(lambda ()
|
||||||
|
(cond
|
||||||
|
((string-match "aethon"
|
||||||
|
(gnus-group-real-name gnus-newsgroup-name))
|
||||||
|
(ispell-change-dictionary "nl"))
|
||||||
|
(t (ispell-change-dictionary "en")))))
|
||||||
|
(add-hook 'gnus-group-mode-hook 'gnus-topic-mode)
|
||||||
|
|
||||||
|
(setq message-kill-buffer-on-exit t)
|
200
emacs/.emacs.d/site-lisp/jabber-init.el
Normal file
200
emacs/.emacs.d/site-lisp/jabber-init.el
Normal file
|
@ -0,0 +1,200 @@
|
||||||
|
;;; jabber-initel --- Jabber.el initialization
|
||||||
|
;;; Commentary:
|
||||||
|
;;; Code:
|
||||||
|
|
||||||
|
(require 'init (locate-user-emacs-file "init.elc" "init.el"))
|
||||||
|
(require 'jabber)
|
||||||
|
|
||||||
|
;; (autoload 'jabber-message-libnotify "jabber-libnotify")
|
||||||
|
;; (autoload 'jabber-muc-libnotify "jabber-libnotify")
|
||||||
|
|
||||||
|
(defun jabber-init-roster-mode-func ()
|
||||||
|
"Function for `jabber-roster-mode-hook'."
|
||||||
|
(setq mode-line-format
|
||||||
|
(list (propertize " %m" 'face 'mode-line-buffer-id))))
|
||||||
|
|
||||||
|
(defun jabber-init-show-status-in-buffer (who oldstatus newstatus
|
||||||
|
statustext proposed-alert)
|
||||||
|
"Check to see if WHO has a buffer and if so print his new status.
|
||||||
|
|
||||||
|
OLDSTATUS, NEWSTATUS and STATUSTEXT are ignored.
|
||||||
|
|
||||||
|
Insert PROPOSED-ALERT in the buffer if it is non-nil."
|
||||||
|
(let ((buffer (get-buffer (jabber-chat-get-buffer (symbol-name who)))))
|
||||||
|
(when (and buffer proposed-alert)
|
||||||
|
(with-current-buffer buffer
|
||||||
|
(ewoc-enter-last jabber-chat-ewoc (list :notice proposed-alert
|
||||||
|
:time (current-time)))))))
|
||||||
|
|
||||||
|
(defun jabber-init-stumpwm-echo (from buffer text title)
|
||||||
|
"Use stumpwm to echo a message has arrived."
|
||||||
|
(oni:stumpwm-echo title))
|
||||||
|
|
||||||
|
(defun jabber-init-stumpwm-echo-muc (nick group buffer text title)
|
||||||
|
"Use stumpwm to echo a message has arrived."
|
||||||
|
(oni:stumpwm-echo title))
|
||||||
|
|
||||||
|
(setq jabber-account-list
|
||||||
|
(append (mapcar (lambda (str) (list (concat str "/" system-name)))
|
||||||
|
'("tom@ryuslash.org" "ryuslash@ninthfloor.org"))
|
||||||
|
'("ryuslash@gmail.com"
|
||||||
|
(:network-server . "talk.google.com")
|
||||||
|
(:port . 443)
|
||||||
|
(:connection-type . ssl)))
|
||||||
|
|
||||||
|
jabber-avatar-cache-directory "~/.emacs.d/jabber-avatars/"
|
||||||
|
jabber-chat-buffer-format "+%n"
|
||||||
|
jabber-chat-foreign-prompt-format "%t %u"
|
||||||
|
jabber-chat-local-prompt-format "%t %u"
|
||||||
|
jabber-chat-buffer-show-avatar nil
|
||||||
|
jabber-chat-fill-long-lines nil
|
||||||
|
jabber-chat-delayed-time-format "%H:%M"
|
||||||
|
|
||||||
|
jabber-chatstates-confirm nil
|
||||||
|
|
||||||
|
jabber-muc-colorize-local t
|
||||||
|
jabber-muc-colorize-foreign t
|
||||||
|
|
||||||
|
jabber-history-enabled t
|
||||||
|
jabber-use-global-history nil
|
||||||
|
jabber-history-dir "~/.emacs.d/jabber-hist"
|
||||||
|
|
||||||
|
jabber-groupchat-buffer-format "++%n"
|
||||||
|
jabber-groupchat-prompt-format "%t %u"
|
||||||
|
|
||||||
|
jabber-roster-show-bindings nil
|
||||||
|
jabber-show-offline-contacts nil
|
||||||
|
|
||||||
|
jabber-vcard-avatars-publish nil
|
||||||
|
jabber-vcard-avatars-retrieve nil)
|
||||||
|
(add-to-list 'jabber-account-list
|
||||||
|
`(,(concat "thomas@aethon.nl/" system-name)
|
||||||
|
(:network-server . "talk.google.com")
|
||||||
|
(:connection-type . ssl)))
|
||||||
|
|
||||||
|
;; (add-hook 'jabber-alert-message-hooks #'jabber-message-libnotify)
|
||||||
|
;; (add-hook 'jabber-alert-muc-hooks #'jabber-muc-libnotify)
|
||||||
|
;; (add-hook 'jabber-alert-message-hooks #'jabber-init-stumpwm-echo)
|
||||||
|
;; (add-hook 'jabber-alert-muc-hooks #'jabber-init-stumpwm-echo)
|
||||||
|
(add-hook 'jabber-chat-mode-hook #'visual-line-mode)
|
||||||
|
(add-hook 'jabber-roster-mode-hook #'jabber-init-roster-mode-func)
|
||||||
|
(add-hook 'jabber-alert-presence-hooks
|
||||||
|
#'jabber-init-show-status-in-buffer)
|
||||||
|
|
||||||
|
(remove-hook 'jabber-alert-presence-hooks #'jabber-presence-echo)
|
||||||
|
|
||||||
|
(global-set-key (kbd "<f6>") 'jabber-switch-to-roster-buffer)
|
||||||
|
|
||||||
|
|
||||||
|
;;; Ugly, but works
|
||||||
|
|
||||||
|
(defvar *longest-prompt* 0)
|
||||||
|
(make-variable-buffer-local '*longest-prompt*)
|
||||||
|
|
||||||
|
(defun update-margins (prompt-length)
|
||||||
|
(when (> prompt-length *longest-prompt*)
|
||||||
|
(let ((window (get-buffer-window (current-buffer))))
|
||||||
|
(when (equal window (selected-window))
|
||||||
|
(set-window-margins window prompt-length))
|
||||||
|
(setq left-margin-width prompt-length
|
||||||
|
*longest-prompt* prompt-length))))
|
||||||
|
|
||||||
|
|
||||||
|
(defun jabber-chat-self-prompt (timestamp delayed dont-print-nick-p)
|
||||||
|
"Print prompt for sent message.
|
||||||
|
TIMESTAMP is the timestamp to print, or nil for now.
|
||||||
|
If DELAYED is true, print long timestamp
|
||||||
|
\(`jabber-chat-delayed-time-format' as opposed to
|
||||||
|
`jabber-chat-time-format').
|
||||||
|
If DONT-PRINT-NICK-P is true, don't include nickname."
|
||||||
|
(let* ((state-data (fsm-get-state-data jabber-buffer-connection))
|
||||||
|
(username (plist-get state-data :username))
|
||||||
|
(server (plist-get state-data :server))
|
||||||
|
(resource (plist-get state-data :resource))
|
||||||
|
(nickname username)
|
||||||
|
(prompt (format-spec jabber-chat-local-prompt-format
|
||||||
|
(list
|
||||||
|
(cons ?t (format-time-string
|
||||||
|
(if delayed
|
||||||
|
jabber-chat-delayed-time-format
|
||||||
|
jabber-chat-time-format)
|
||||||
|
timestamp))
|
||||||
|
(cons ?n (if dont-print-nick-p "" nickname))
|
||||||
|
(cons ?u username)
|
||||||
|
(cons ?r resource)
|
||||||
|
(cons ?j (concat username "@" server))))))
|
||||||
|
(insert (jabber-propertize
|
||||||
|
" "
|
||||||
|
'display (list '(margin left-margin) prompt)
|
||||||
|
'face 'jabber-chat-prompt-local
|
||||||
|
'help-echo
|
||||||
|
(concat (format-time-string "On %Y-%m-%d %H:%M:%S" timestamp) " from you")))
|
||||||
|
(update-margins (length prompt))))
|
||||||
|
|
||||||
|
(defun jabber-chat-print-prompt (xml-data timestamp delayed dont-print-nick-p)
|
||||||
|
"Print prompt for received message in XML-DATA.
|
||||||
|
TIMESTAMP is the timestamp to print, or nil to get it
|
||||||
|
from a jabber:x:delay element.
|
||||||
|
If DELAYED is true, print long timestamp
|
||||||
|
\(`jabber-chat-delayed-time-format' as opposed to
|
||||||
|
`jabber-chat-time-format').
|
||||||
|
If DONT-PRINT-NICK-P is true, don't include nickname."
|
||||||
|
(let* ((from (jabber-xml-get-attribute xml-data 'from))
|
||||||
|
(timestamp (or timestamp
|
||||||
|
(car (delq nil (mapcar 'jabber-x-delay (jabber-xml-get-children xml-data 'x))))))
|
||||||
|
(prompt (format-spec jabber-chat-foreign-prompt-format
|
||||||
|
(list
|
||||||
|
(cons ?t (format-time-string
|
||||||
|
(if delayed
|
||||||
|
jabber-chat-delayed-time-format
|
||||||
|
jabber-chat-time-format)
|
||||||
|
timestamp))
|
||||||
|
(cons ?n (if dont-print-nick-p "" (jabber-jid-displayname from)))
|
||||||
|
(cons ?u (or (jabber-jid-username from) from))
|
||||||
|
(cons ?r (jabber-jid-resource from))
|
||||||
|
(cons ?j (jabber-jid-user from))))))
|
||||||
|
(insert (jabber-propertize
|
||||||
|
" "
|
||||||
|
'display (list '(margin left-margin) prompt)
|
||||||
|
'face 'jabber-chat-prompt-foreign
|
||||||
|
'help-echo
|
||||||
|
(concat (format-time-string "On %Y-%m-%d %H:%M:%S" timestamp) " from " from)))
|
||||||
|
(update-margins (length prompt))))
|
||||||
|
|
||||||
|
(defun jabber-muc-print-prompt (xml-data &optional local dont-print-nick-p)
|
||||||
|
"Print MUC prompt for message in XML-DATA."
|
||||||
|
(let* ((nick (jabber-jid-resource (jabber-xml-get-attribute xml-data 'from)))
|
||||||
|
(timestamp (car (delq nil (mapcar 'jabber-x-delay (jabber-xml-get-children xml-data 'x)))))
|
||||||
|
(prompt (format-spec jabber-groupchat-prompt-format
|
||||||
|
(list
|
||||||
|
(cons ?t (format-time-string
|
||||||
|
(if timestamp
|
||||||
|
jabber-chat-delayed-time-format
|
||||||
|
jabber-chat-time-format)
|
||||||
|
timestamp))
|
||||||
|
(cons ?n (if dont-print-nick-p "" nick))
|
||||||
|
(cons ?u nick)
|
||||||
|
(cons ?r nick)
|
||||||
|
(cons ?j (concat jabber-group "/" nick))))))
|
||||||
|
(if (stringp nick)
|
||||||
|
(insert (jabber-propertize
|
||||||
|
" "
|
||||||
|
'display (list '(margin left-margin) prompt)
|
||||||
|
'face (if local ;Message from you.
|
||||||
|
(if jabber-muc-colorize-local ;; If colorization enable...
|
||||||
|
;; ...colorize nick
|
||||||
|
(list ':foreground (jabber-muc-nick-get-color nick))
|
||||||
|
;; otherwise, use default face.
|
||||||
|
'jabber-chat-prompt-local)
|
||||||
|
;; Message from other participant.
|
||||||
|
(if jabber-muc-colorize-foreign ;If colorization enable...
|
||||||
|
;; ... colorize nick
|
||||||
|
(list ':foreground (jabber-muc-nick-get-color nick))
|
||||||
|
;; otherwise, use default face.
|
||||||
|
'jabber-chat-prompt-foreign))
|
||||||
|
'help-echo (concat (format-time-string "On %Y-%m-%d %H:%M:%S" timestamp) " from " nick " in " jabber-group)))
|
||||||
|
(jabber-muc-system-prompt))
|
||||||
|
(update-margins (length prompt))))
|
||||||
|
|
||||||
|
(provide 'jabber-init)
|
||||||
|
;;; jabber-init.el ends here
|
80
emacs/.emacs.d/site-lisp/metalexpress.el
Normal file
80
emacs/.emacs.d/site-lisp/metalexpress.el
Normal file
|
@ -0,0 +1,80 @@
|
||||||
|
;;; metalexpress.el --- Listen to Metal Express Radio
|
||||||
|
|
||||||
|
;; Copyright (C) 2012 Tom Willemse
|
||||||
|
|
||||||
|
;; Author: Tom Willemse <thomas@aethon.nl>
|
||||||
|
;; Keywords: multimedia
|
||||||
|
|
||||||
|
;; 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 this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
;;; Commentary:
|
||||||
|
|
||||||
|
;; Functions for easily listening to Metal Express Radio.
|
||||||
|
|
||||||
|
;;; Code:
|
||||||
|
|
||||||
|
(defgroup metal-express-radio nil
|
||||||
|
"Group for the Metal Express Radio listening functions."
|
||||||
|
:group 'multimedia)
|
||||||
|
|
||||||
|
(defcustom metal-express-radio-playlist-url
|
||||||
|
"http://usa7-vn.mixstream.net/listen/8248.m3u"
|
||||||
|
"The URL of the Metal Express Radio stream."
|
||||||
|
:group 'metal-express-radio
|
||||||
|
:type 'string)
|
||||||
|
|
||||||
|
(defcustom metal-express-radio-song-changed-hook nil
|
||||||
|
"Hook run when the currently playing song changes."
|
||||||
|
:type 'hook
|
||||||
|
:group 'metal-express-radio)
|
||||||
|
|
||||||
|
(defvar metal-express-radio-currently-playing nil
|
||||||
|
"The currently playing song.")
|
||||||
|
|
||||||
|
(defun mer-proc-filter (proc string)
|
||||||
|
(when (string-match "^ICY Info: StreamTitle='\\(.*\\)';StreamUrl='';"
|
||||||
|
string)
|
||||||
|
(setq metal-express-radio-currently-playing (match-string 1 string))
|
||||||
|
(run-hooks 'metal-express-radio-song-changed-hook)))
|
||||||
|
|
||||||
|
(defun metal-express-radio-echo-currently-playing ()
|
||||||
|
(interactive)
|
||||||
|
(message metal-express-radio-currently-playing))
|
||||||
|
|
||||||
|
(defun metal-express-radio-notify ()
|
||||||
|
(interactive)
|
||||||
|
(notifications-notify :title "Now playing:"
|
||||||
|
:body metal-express-radio-currently-playing))
|
||||||
|
|
||||||
|
;;;###autoload
|
||||||
|
(defun metal-express-radio-start ()
|
||||||
|
"Start listening to Metal Express Radio."
|
||||||
|
(interactive)
|
||||||
|
(let ((proc (start-process "metalexpress" "*Metal Express Radio*"
|
||||||
|
"mplayer" metal-express-radio-playlist-url)))
|
||||||
|
(set-process-filter proc #'mer-proc-filter)))
|
||||||
|
|
||||||
|
(defun metal-express-radio-stop ()
|
||||||
|
"Stop listening to Metal Express Radio."
|
||||||
|
(interactive)
|
||||||
|
(kill-process (get-buffer-process "*Metal Express Radio*"))
|
||||||
|
(setq metal-express-radio-currently-playing nil))
|
||||||
|
|
||||||
|
(add-hook 'metal-express-radio-song-changed-hook
|
||||||
|
'metal-express-radio-echo-currently-playing)
|
||||||
|
(add-hook 'metal-express-radio-song-changed-hook
|
||||||
|
'metal-express-radio-notify)
|
||||||
|
|
||||||
|
(provide 'metalexpress)
|
||||||
|
;;; metalexpress.el ends here
|
54
emacs/.emacs.d/site-lisp/mu4e-init.el
Normal file
54
emacs/.emacs.d/site-lisp/mu4e-init.el
Normal file
|
@ -0,0 +1,54 @@
|
||||||
|
;;; mu4e-init.el --- mu4e initialization
|
||||||
|
|
||||||
|
;; Copyright (C) 2012 Tom Willemse
|
||||||
|
|
||||||
|
;; Author: Tom Willemse <slash@drd>
|
||||||
|
;; Keywords:
|
||||||
|
|
||||||
|
;; 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 this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
;;; Commentary:
|
||||||
|
|
||||||
|
;;
|
||||||
|
|
||||||
|
;;; Code:
|
||||||
|
|
||||||
|
(require 'oni)
|
||||||
|
|
||||||
|
(oni:define-mailbox "aethon"
|
||||||
|
(oni:email thomas at aethon dot nl)
|
||||||
|
(expand-file-name "~/documents/work/aethon/signature.txt"))
|
||||||
|
(oni:define-mailbox "gmail" (oni:email ryuslash at gmail dot com))
|
||||||
|
(oni:define-mailbox "ninthfloor"
|
||||||
|
(oni:email ryuslash at ninthfloor dot org))
|
||||||
|
(oni:define-mailbox "ryuslash" (oni:email tom at ryuslash dot org)
|
||||||
|
nil "ryuslash.org")
|
||||||
|
|
||||||
|
(setq mu4e-headers-date-format "%d-%m %H:%M")
|
||||||
|
(setq mu4e-headers-fields '((:date . 11)
|
||||||
|
(:flags . 6)
|
||||||
|
(:to . 22)
|
||||||
|
(:from . 22)
|
||||||
|
(:subject)))
|
||||||
|
(setq mu4e-headers-show-threads nil)
|
||||||
|
(setq mu4e-headers-sort-revert nil)
|
||||||
|
(setq mu4e-html2text-command "w3m -dump -T text/HTML -cols 72")
|
||||||
|
(setq mu4e-my-email-addresses (list
|
||||||
|
(oni:email tom at ryuslash dot org)
|
||||||
|
(oni:email ryuslash at gmail dot com)
|
||||||
|
(oni:email ryuslash at ninthfloor dot org)
|
||||||
|
(oni:email thomas at aethon dot nl)))
|
||||||
|
|
||||||
|
(provide 'mu4e-init)
|
||||||
|
;;; mu4e-init.el ends here
|
123
emacs/.emacs.d/site-lisp/my-smt.el
Normal file
123
emacs/.emacs.d/site-lisp/my-smt.el
Normal file
|
@ -0,0 +1,123 @@
|
||||||
|
;;; my-smt.el --- My SVG mode-line theme -*- lexical-binding: t; -*-
|
||||||
|
|
||||||
|
;; Copyright (C) 2014 Tom Willemse
|
||||||
|
|
||||||
|
;; Author: Tom Willemse <tom@ryuslash.org>
|
||||||
|
;; Keywords: faces
|
||||||
|
|
||||||
|
;; 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 this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
;;; Commentary:
|
||||||
|
|
||||||
|
;;
|
||||||
|
|
||||||
|
;;; Code:
|
||||||
|
|
||||||
|
(smt/defwidget my-smt-flycheck-errors
|
||||||
|
:text (lambda (widget)
|
||||||
|
(ignore widget)
|
||||||
|
(when flycheck-mode
|
||||||
|
(let ((counts (flycheck-count-errors
|
||||||
|
flycheck-current-errors)))
|
||||||
|
`(tspan " " (tspan :fill ,(if (smt/window-active-p)
|
||||||
|
"#a85454"
|
||||||
|
"#969696") ,(or (cdr (assoc 'error counts)) 0))
|
||||||
|
"/" (tspan :fill ,(if (smt/window-active-p)
|
||||||
|
"#a88654"
|
||||||
|
"#969696") ,(or (cdr (assoc 'warning counts)) 0)))))))
|
||||||
|
|
||||||
|
(smt/defwidget my-smt-jabber-activity
|
||||||
|
:text (lambda (widget)
|
||||||
|
(ignore widget)
|
||||||
|
(if (and (smt/window-active-p)
|
||||||
|
(boundp 'jabber-activity-mode-string)
|
||||||
|
(not (equal jabber-activity-mode-string "")))
|
||||||
|
(concat jabber-activity-mode-string " "))))
|
||||||
|
|
||||||
|
(defun my-smt-yoshi-title-style (widget)
|
||||||
|
"Fill color for either active or inactive windows.
|
||||||
|
|
||||||
|
WIDGET is ignored."
|
||||||
|
(ignore widget)
|
||||||
|
(list :fill (if (smt/window-active-p)
|
||||||
|
"#a85454"
|
||||||
|
"#969696")))
|
||||||
|
|
||||||
|
(smt/defwidget my-smt-po-counters
|
||||||
|
:text (lambda (widget)
|
||||||
|
(ignore widget)
|
||||||
|
(when (eql major-mode 'po-mode)
|
||||||
|
(format " %dt+%df+%du+%do" po-translated-counter
|
||||||
|
po-fuzzy-counter po-untranslated-counter
|
||||||
|
po-obsolete-counter))))
|
||||||
|
|
||||||
|
(smt/defwidget my-smt-buffer-identification
|
||||||
|
:style 'my-smt-yoshi-title-style
|
||||||
|
:text (lambda (widget)
|
||||||
|
(ignore widget)
|
||||||
|
(concat
|
||||||
|
(s-trim
|
||||||
|
(substring-no-properties
|
||||||
|
(format-mode-line mode-line-buffer-identification)))
|
||||||
|
(when (and (or buffer-file-name
|
||||||
|
buffer-offer-save)
|
||||||
|
(buffer-modified-p))
|
||||||
|
"*"))))
|
||||||
|
|
||||||
|
(smt/defwidget my-smt-current-dictionary
|
||||||
|
:text (lambda (widget)
|
||||||
|
(ignore widget)
|
||||||
|
(if flyspell-mode
|
||||||
|
(concat " " (or ispell-current-dictionary
|
||||||
|
ispell-local-dictionary
|
||||||
|
flyspell-default-dictionary)))))
|
||||||
|
|
||||||
|
(smt/defwidget my-smt-position
|
||||||
|
:text (lambda (widget)
|
||||||
|
(ignore widget)
|
||||||
|
(format-mode-line "%l/%c:%p")))
|
||||||
|
|
||||||
|
(smt/defrow my-smt-right
|
||||||
|
:prototype 'default-right
|
||||||
|
:widgets '(my-smt-jabber-activity
|
||||||
|
major-mode
|
||||||
|
my-smt-current-dictionary
|
||||||
|
my-smt-flycheck-errors
|
||||||
|
version-control minor-modes)
|
||||||
|
:margin 16)
|
||||||
|
|
||||||
|
(smt/defrow my-smt-left
|
||||||
|
:prototype 'default-left
|
||||||
|
:widgets '(buffer-info my-smt-buffer-identification my-smt-po-counters
|
||||||
|
which-function))
|
||||||
|
|
||||||
|
(smt/defrow my-smt-position
|
||||||
|
:prototype 'default-position
|
||||||
|
:widgets '(my-smt-position))
|
||||||
|
|
||||||
|
(defun my-smt-major-mode-style (widget)
|
||||||
|
(ignore widget)
|
||||||
|
'(:fill "#ccc" :font-family "Fantasque Sans" :filter nil
|
||||||
|
:font-weight "bold" :font-style "italic"))
|
||||||
|
|
||||||
|
(smt/deftheme my-smt
|
||||||
|
:prototype 'black-crystal
|
||||||
|
:local-widgets (list (cons 'major-mode
|
||||||
|
(smt/make-widget
|
||||||
|
:prototype 'major-mode
|
||||||
|
:style 'my-smt-major-mode-style)))
|
||||||
|
:rows '(my-smt-left my-smt-position my-smt-right))
|
||||||
|
|
||||||
|
(provide 'my-smt)
|
||||||
|
;;; my-smt.el ends here
|
192
emacs/.emacs.d/site-lisp/org-init.el
Normal file
192
emacs/.emacs.d/site-lisp/org-init.el
Normal file
|
@ -0,0 +1,192 @@
|
||||||
|
;;; org-init.el --- Org initialization
|
||||||
|
|
||||||
|
;; Copyright (C) 2012 Tom Willemse
|
||||||
|
|
||||||
|
;; Author: Tom Willemse <slash@drd>
|
||||||
|
;; Keywords:
|
||||||
|
|
||||||
|
;; 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 this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
;;; Commentary:
|
||||||
|
|
||||||
|
;;
|
||||||
|
|
||||||
|
;;; Code:
|
||||||
|
|
||||||
|
(require 'appt)
|
||||||
|
(require 'org-habit)
|
||||||
|
(require 'org-protocol)
|
||||||
|
|
||||||
|
(eval-after-load "org"
|
||||||
|
'(require 'org-contacts nil :noerror))
|
||||||
|
|
||||||
|
(eval-when-compile
|
||||||
|
(require 'desktop)
|
||||||
|
(require 'org-capture))
|
||||||
|
|
||||||
|
(autoload 'org-clocking-p "org-clock")
|
||||||
|
|
||||||
|
(with-eval-after-load 'org-crypt
|
||||||
|
(org-crypt-use-before-save-magic))
|
||||||
|
|
||||||
|
(eval-and-compile
|
||||||
|
(add-to-list 'load-path "~/.emacs.d/vendor-lisp/habitrpg.el"))
|
||||||
|
|
||||||
|
(defun tagify (str)
|
||||||
|
"Remove dots, replace - with _ in STR."
|
||||||
|
(replace-regexp-in-string
|
||||||
|
"-" "_" (replace-regexp-in-string "\\." "" (downcase str))))
|
||||||
|
|
||||||
|
(defun oni:color-for (object)
|
||||||
|
"Generate a hex color by taking the first 6 characters of OBJECT's MD5 sum."
|
||||||
|
(format "#%s" (substring (md5 object) 0 6)))
|
||||||
|
|
||||||
|
(defun oni:org-colors-for (names)
|
||||||
|
"Create an alist for NAMES with corresponding colors."
|
||||||
|
(mapcar (lambda (name) (cons name (oni:color-for name))) names))
|
||||||
|
|
||||||
|
(defun oni:note-template ()
|
||||||
|
(concat
|
||||||
|
"* %<%c>\n"
|
||||||
|
" :DIRECTORY: =" default-directory "=\n"
|
||||||
|
(when (buffer-file-name) " :FILE: [[file:%F][%F]]\n")
|
||||||
|
(when (org-clocking-p) " :TASK: %K\n")
|
||||||
|
"\n %?"))
|
||||||
|
|
||||||
|
(defun oni:org-maybe-outline-path ()
|
||||||
|
(let ((outline-path (org-format-outline-path (org-get-outline-path))))
|
||||||
|
(unless (string= outline-path "")
|
||||||
|
(setq outline-path (concat "[ " outline-path " ] ")))
|
||||||
|
outline-path))
|
||||||
|
|
||||||
|
(defun org-init-filter-by-desktop ()
|
||||||
|
"Filter agenda by current label."
|
||||||
|
(when desktop-dirname
|
||||||
|
(let ((label (tagify (file-name-nondirectory
|
||||||
|
(directory-file-name
|
||||||
|
(expand-file-name desktop-dirname))))))
|
||||||
|
(org-agenda-filter-apply (cons label nil) 'tag))))
|
||||||
|
|
||||||
|
(defun org-init-skip-tags ()
|
||||||
|
"Skip the \"ex\" and \"unconfirmed\" tags."
|
||||||
|
(let ((tags (org-get-tags-at (point))))
|
||||||
|
(when (or (member "ex" tags)
|
||||||
|
(member "unconfirmed" tags))
|
||||||
|
(save-excursion
|
||||||
|
(or
|
||||||
|
(ignore-errors (org-forward-element)
|
||||||
|
(point))
|
||||||
|
(point-max))))))
|
||||||
|
|
||||||
|
(defun org-init-get-tag-name ()
|
||||||
|
"Get the name for a new tag for the currently loaded desktop."
|
||||||
|
(let ((dname (desktop-registry-current-desktop)))
|
||||||
|
(if dname
|
||||||
|
(let ((tag (read-string "Tag(s): " (tagify dname))))
|
||||||
|
(if (not (string= tag ""))
|
||||||
|
(format ":%s:" tag)
|
||||||
|
""))
|
||||||
|
"")))
|
||||||
|
|
||||||
|
(setq org-agenda-cmp-user-defined (lambda (a b) 1))
|
||||||
|
(setq org-agenda-prefix-format
|
||||||
|
'((agenda . " %i %-12:c%?-12t% s")
|
||||||
|
(timeline . " % s")
|
||||||
|
(todo . " %i %-12:c %(oni:org-maybe-outline-path)")
|
||||||
|
(tags . " %i %-12:c %(oni:org-maybe-outline-path)")
|
||||||
|
(search . " %i %-12:c")))
|
||||||
|
(setq org-agenda-sorting-strategy
|
||||||
|
'((agenda habit-down time-up priority-down category-keep)
|
||||||
|
(todo priority-down user-defined-down)
|
||||||
|
(tags priority-down category-keep)
|
||||||
|
(search category-keep)))
|
||||||
|
(setq org-agenda-tags-column (1+ (- (window-width))))
|
||||||
|
(setq org-directory (expand-file-name "~/documents/org"))
|
||||||
|
(setq org-default-notes-file (concat org-directory "/org"))
|
||||||
|
(setq org-capture-templates
|
||||||
|
`(("t" "Task" entry (file+headline "~/documents/org/tasks" "Task Queue")
|
||||||
|
"* TODO %? %(org-init-get-tag-name)"
|
||||||
|
:empty-lines-before 1)
|
||||||
|
("T" "Linked task" entry (file "~/documents/org/tasks")
|
||||||
|
"* TODO %? %(org-init-get-tag-name)\n\n %a"
|
||||||
|
:empty-lines-before 1)
|
||||||
|
("a" "Appointment" entry (file "~/documents/org/tasks")
|
||||||
|
"* %?\n %^T\n\n %a"
|
||||||
|
:empty-lines-before 1)
|
||||||
|
("n" "General note" entry (file ,org-default-notes-file)
|
||||||
|
(function oni:note-template)
|
||||||
|
:empty-lines-before 1)
|
||||||
|
("l" "Log entry" entry (file+datetree "~/documents/org/log.org")
|
||||||
|
"* %<%c>\n <%<%Y-%m-%d %H:%M>>\n\n %?"
|
||||||
|
:empty-lines-before 1)))
|
||||||
|
(setq org-contacts-files '("~/documents/org/misc/contacts.org"))
|
||||||
|
(setq org-agenda-show-outline-path nil)
|
||||||
|
(setq org-agenda-todo-ignore-deadlines 'far)
|
||||||
|
(setq org-agenda-todo-ignore-scheduled t)
|
||||||
|
(setq org-export-htmlize-output-type 'css)
|
||||||
|
(setq org-feed-alist
|
||||||
|
'(("MyEpisodes"
|
||||||
|
"http://www.myepisodes.com/rss.php?feed=mylist&uid=Slash&pwdmd5=04028968e1f0b7ee678b748a4320ac17"
|
||||||
|
"~/documents/org/tasks" "MyEpisodes"
|
||||||
|
:formatter oni:myepisodes-formatter)))
|
||||||
|
(setq org-fontify-done-headline t)
|
||||||
|
(setq org-hide-emphasis-markers t)
|
||||||
|
(setq org-outline-path-complete-in-steps t)
|
||||||
|
(setq org-refile-allow-creating-parent-nodes t)
|
||||||
|
(setq org-refile-use-outline-path 'file)
|
||||||
|
(setq org-return-follows-link t)
|
||||||
|
(setq org-src-fontify-natively t)
|
||||||
|
(setq org-tags-column (- 70))
|
||||||
|
(setq org-tags-exclude-from-inheritance '("crypt"))
|
||||||
|
(setq org-todo-keyword-faces
|
||||||
|
(oni:org-colors-for '("TODO" "WIP" "DONE" "CANCELLED" "FAILED"
|
||||||
|
"ACQUIRE" "IGNORED" "COMMENT" "GOT")))
|
||||||
|
(setq org-tag-faces
|
||||||
|
(oni:org-colors-for '("aethon" "noexport" "tv" "myaethon2"
|
||||||
|
"dailies" "ex" "maintenance" "housework"
|
||||||
|
"cdispass" "clark" "emacsd" "eye_on_manga"
|
||||||
|
"kaarvok" "silbot" "myaethon" "hypo"
|
||||||
|
"unconfirmed" "gitto" "urxvt_modeline"
|
||||||
|
"scrumli" "clark_conkeror"
|
||||||
|
"git_auto_commit_mode" "mode_icons"
|
||||||
|
"dispassel" "hypo_emacs" "hypo_cli"
|
||||||
|
"conkeror" "transient_navigation" "pkgbuilds"
|
||||||
|
"edocs" "cask" "fiplr" "avandu"
|
||||||
|
"gitolite_admin" "yoshi_theme" "dvdroid"
|
||||||
|
"commit_check" "imsleepy" "indent_shift"
|
||||||
|
"work" "picturefix")))
|
||||||
|
(setq org-use-fast-todo-selection t)
|
||||||
|
(setq org-agenda-skip-function-global 'org-init-skip-tags)
|
||||||
|
(setq org-use-property-inheritance '("slug"))
|
||||||
|
(setq org-M-RET-may-split-line '((default . t)
|
||||||
|
(headline)))
|
||||||
|
(setq org-insert-heading-respect-content t)
|
||||||
|
(setf (cdar org-blank-before-new-entry) t)
|
||||||
|
|
||||||
|
(add-hook 'org-agenda-mode-hook 'org-agenda-to-appt)
|
||||||
|
(add-hook 'org-agenda-finalize-hook 'org-init-filter-by-desktop)
|
||||||
|
|
||||||
|
(add-to-list 'org-modules 'habit)
|
||||||
|
|
||||||
|
(org-agenda-to-appt)
|
||||||
|
(ad-activate 'org-agenda-redo)
|
||||||
|
|
||||||
|
(require 'habitrpg)
|
||||||
|
(add-hook 'org-after-todo-state-change-hook 'habitrpg-add 'append)
|
||||||
|
|
||||||
|
(setq org-mobile-directory "~/ownCloud/MobileOrg"
|
||||||
|
org-mobile-inbox-for-pull "~/documents/org/inbox.org")
|
||||||
|
|
||||||
|
(provide 'org-init)
|
||||||
|
;;; org-init.el ends here
|
70
emacs/.emacs.d/site-lisp/pivot.el
Normal file
70
emacs/.emacs.d/site-lisp/pivot.el
Normal file
|
@ -0,0 +1,70 @@
|
||||||
|
;;; pivot.el --- Elisp library for the Pivotal Tracker API -*- lexical-binding: t; -*-
|
||||||
|
|
||||||
|
;; Copyright (C) 2014 Tom Willemse
|
||||||
|
|
||||||
|
;; Author: Tom Willemse <tom@ryuslash.org>
|
||||||
|
;; Keywords: comm, hypermedia
|
||||||
|
|
||||||
|
;; 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 this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
;;; Commentary:
|
||||||
|
|
||||||
|
;;
|
||||||
|
|
||||||
|
;;; Code:
|
||||||
|
|
||||||
|
(require 'url)
|
||||||
|
|
||||||
|
(defgroup pivotel nil
|
||||||
|
"Communicate with Pivotal Tracker."
|
||||||
|
:group 'external)
|
||||||
|
|
||||||
|
(defcustom pivotel-api-token nil
|
||||||
|
"API token from Pivotal Tracker.
|
||||||
|
|
||||||
|
From Pivotal Tracker: Your token enables access to your project
|
||||||
|
and story data via the API, and needs to be kept private."
|
||||||
|
:group 'pivotel)
|
||||||
|
|
||||||
|
(defvar pivotel-api-url
|
||||||
|
"https://www.pivotaltracker.com/services/v5"
|
||||||
|
"Base URL of the Pivotal Tracker API.
|
||||||
|
|
||||||
|
Does not need a final `/'.")
|
||||||
|
|
||||||
|
(defun pivotel-get-story (project story)
|
||||||
|
"Get data from PROJECT for STORY."
|
||||||
|
(let ((url-request-extra-headers
|
||||||
|
`(("X-TrackerToken" . ,pivotel-api-token))))
|
||||||
|
(with-current-buffer
|
||||||
|
(url-retrieve-synchronously
|
||||||
|
(format "%s/projects/%d/stories/%d"
|
||||||
|
pivotel-api-url project story))
|
||||||
|
(goto-char (point-min))
|
||||||
|
(search-forward "\n\n")
|
||||||
|
(json-read))))
|
||||||
|
|
||||||
|
(defun pivotel-get-projects ()
|
||||||
|
"Get a list of all projects."
|
||||||
|
(let ((url-request-extra-headers
|
||||||
|
`(("X-TrackerTocken" . ,pivotel-api-token))))
|
||||||
|
(with-current-buffer
|
||||||
|
(url-retrieve-synchronously
|
||||||
|
(format "%s/projects" pivotel-api-url))
|
||||||
|
(goto-char (point-min))
|
||||||
|
(search-forward "\n\n")
|
||||||
|
(json-read))))
|
||||||
|
|
||||||
|
(provide 'pivot)
|
||||||
|
;;; pivot.el ends here
|
57
emacs/.emacs.d/site-lisp/pkgbuild.el
Normal file
57
emacs/.emacs.d/site-lisp/pkgbuild.el
Normal file
|
@ -0,0 +1,57 @@
|
||||||
|
;;; pkgbuild.el --- PKGBUILD utility functions -*- lexical-binding: t; -*-
|
||||||
|
|
||||||
|
;; Copyright (C) 2014 Tom Willemse
|
||||||
|
|
||||||
|
;; Author: Tom Willemse <tom@ryuslash.org>
|
||||||
|
;; Keywords: convenience
|
||||||
|
|
||||||
|
;; 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 this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
;;; Commentary:
|
||||||
|
|
||||||
|
;;
|
||||||
|
|
||||||
|
;;; Code:
|
||||||
|
|
||||||
|
(defun pkgbuild-find-checksums-boundaries ()
|
||||||
|
"Look in the current buffer for the start and end of the checksums."
|
||||||
|
(save-excursion
|
||||||
|
(goto-char (point-min))
|
||||||
|
(re-search-forward (rx (or "md5" "sha1" "sha256") "sums"))
|
||||||
|
(let ((start (match-beginning 0)))
|
||||||
|
(search-forward "(")
|
||||||
|
(backward-char)
|
||||||
|
(forward-sexp)
|
||||||
|
(list start (point)))))
|
||||||
|
|
||||||
|
(defun pkgbuild-get-updated-checksums ()
|
||||||
|
"Call `makepkg -g' to get the updated checksums."
|
||||||
|
(with-temp-buffer
|
||||||
|
(insert (shell-command-to-string "makepkg -g"))
|
||||||
|
(apply #'buffer-substring-no-properties
|
||||||
|
(pkgbuild-find-checksums-boundaries))))
|
||||||
|
|
||||||
|
;;;###autoload
|
||||||
|
(defun pkgbuild-update-checksums ()
|
||||||
|
"Find and update the checksums for the current buffer."
|
||||||
|
(interactive)
|
||||||
|
(let ((updated (pkgbuild-get-updated-checksums)))
|
||||||
|
(if updated
|
||||||
|
(progn
|
||||||
|
(apply #'delete-region (pkgbuild-find-checksums-boundaries))
|
||||||
|
(insert updated))
|
||||||
|
(error "No new checksums found"))))
|
||||||
|
|
||||||
|
(provide 'pkgbuild)
|
||||||
|
;;; pkgbuild.el ends here
|
74
emacs/.emacs.d/site-lisp/quick-edit-mode.el
Normal file
74
emacs/.emacs.d/site-lisp/quick-edit-mode.el
Normal file
|
@ -0,0 +1,74 @@
|
||||||
|
;;; quick-edit-mode.el --- Quickly edit stuff
|
||||||
|
|
||||||
|
;; Copyright (C) 2012 Tom Willemse
|
||||||
|
|
||||||
|
;; Author: Tom Willemse <slash@drd>
|
||||||
|
;; Keywords: convenience
|
||||||
|
|
||||||
|
;; 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 this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
;;; Commentary:
|
||||||
|
|
||||||
|
;; Quickly edit stuff
|
||||||
|
|
||||||
|
;;; Code:
|
||||||
|
|
||||||
|
(defvar quick-edit-map
|
||||||
|
(let ((map (make-sparse-keymap)))
|
||||||
|
(define-key map "/" 'undo)
|
||||||
|
(define-key map "0" 'delete-window)
|
||||||
|
(define-key map "1" 'delete-other-windows)
|
||||||
|
(define-key map "2" 'split-window-below)
|
||||||
|
(define-key map "3" 'split-window-right)
|
||||||
|
(define-key map "K" 'kill-whole-line)
|
||||||
|
(define-key map "V" 'scroll-down-command)
|
||||||
|
(define-key map "a" 'oni:move-beginning-of-dwim)
|
||||||
|
(define-key map "b" 'backward-char)
|
||||||
|
(define-key map "d" 'oni:kill-region-or-forward-char)
|
||||||
|
(define-key map "e" 'oni:move-end-of-dwim)
|
||||||
|
(define-key map "f" 'forward-char)
|
||||||
|
(define-key map "j" 'newline-and-indent)
|
||||||
|
(define-key map "k" 'oni:kill-region-or-line)
|
||||||
|
(define-key map "n" 'next-line)
|
||||||
|
(define-key map "o" 'other-window)
|
||||||
|
(define-key map "p" 'previous-line)
|
||||||
|
(define-key map "v" 'scroll-up-command)
|
||||||
|
(define-key map "w" 'oni:kill-region-or-backward-char)
|
||||||
|
(define-key map (kbd "C-b") 'electric-buffer-list)
|
||||||
|
(define-key map (kbd "C-g") 'quick-edit-mode)
|
||||||
|
(define-key map (kbd "RET") 'quick-edit-mode)
|
||||||
|
map)
|
||||||
|
"Keymap for quick-edit-mode.")
|
||||||
|
|
||||||
|
(defun qe-locally-disable ()
|
||||||
|
"Disable quick-edit mode in the minibuffer"
|
||||||
|
(when (eq overriding-local-map quick-edit-map)
|
||||||
|
(setq-local overriding-local-map nil)))
|
||||||
|
|
||||||
|
;;;###autoload
|
||||||
|
(define-minor-mode quick-edit-mode
|
||||||
|
"Quickly edit stuff."
|
||||||
|
:lighter " qe"
|
||||||
|
:global t
|
||||||
|
(if quick-edit-mode
|
||||||
|
(progn
|
||||||
|
(setq overriding-local-map quick-edit-map)
|
||||||
|
(add-hook 'minibuffer-setup-hook 'qe-locally-disable)
|
||||||
|
(add-hook 'special-mode-hook 'qe-locally-disable))
|
||||||
|
(setq overriding-local-map nil)
|
||||||
|
(remove-hook 'minibuffer-setup-hook 'qe-locally-disable)
|
||||||
|
(remove-hook 'special-mode-hook 'qe-locally-disable)))
|
||||||
|
|
||||||
|
(provide 'quick-edit-mode)
|
||||||
|
;;; quick-edit-mode.el ends here
|
3
emacs/.emacs.d/site-lisp/wm-init.el
Normal file
3
emacs/.emacs.d/site-lisp/wm-init.el
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
(async-shell-command "herbstluftwm" " herbstluftwm")
|
||||||
|
(async-shell-command "dunst" " dunst")
|
||||||
|
(async-shell-command "xbindkeys" " xbindkeys")
|
8
emacs/.emacs.d/snippets/conf-mode/section
Normal file
8
emacs/.emacs.d/snippets/conf-mode/section
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
# -*- mode: snippet; require-final-newline: nil -*-
|
||||||
|
# name: Xorg Section
|
||||||
|
# key: Section
|
||||||
|
# --
|
||||||
|
Section "$1"
|
||||||
|
Identifier "$2"
|
||||||
|
$0
|
||||||
|
EndSection
|
5
emacs/.emacs.d/snippets/emacs-lisp/face
Normal file
5
emacs/.emacs.d/snippets/emacs-lisp/face
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
# -*- mode: snippet; require-final-newline: nil -*-
|
||||||
|
# name: face
|
||||||
|
# key: f
|
||||||
|
# --
|
||||||
|
`($1 ((t (${2::foreground} $0))))
|
7
emacs/.emacs.d/snippets/html-mode/block
Normal file
7
emacs/.emacs.d/snippets/html-mode/block
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
# -*- mode: snippet; require-final-newline: nil -*-
|
||||||
|
# name: block
|
||||||
|
# key: block
|
||||||
|
# --
|
||||||
|
{% block $1 %}
|
||||||
|
$0
|
||||||
|
{% endblock %}
|
8
emacs/.emacs.d/snippets/html-mode/for
Normal file
8
emacs/.emacs.d/snippets/html-mode/for
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
# -*- mode: snippet -*-
|
||||||
|
# name: for
|
||||||
|
# key: for
|
||||||
|
# condition: pony-tpl-minor-mode
|
||||||
|
# --
|
||||||
|
{% for $1 in $2 %}
|
||||||
|
$0
|
||||||
|
{% endfor %}
|
8
emacs/.emacs.d/snippets/html-mode/generic-block
Normal file
8
emacs/.emacs.d/snippets/html-mode/generic-block
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
# -*- mode: snippet -*-
|
||||||
|
# name: Template Block
|
||||||
|
# key: %
|
||||||
|
# condition: pony-tpl-minor-mode
|
||||||
|
# --
|
||||||
|
{% $1 %}
|
||||||
|
$0
|
||||||
|
{% end$1 %}
|
5
emacs/.emacs.d/snippets/html-mode/script
Normal file
5
emacs/.emacs.d/snippets/html-mode/script
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
# -*- mode: snippet -*-
|
||||||
|
# name: script
|
||||||
|
# key: script
|
||||||
|
# --
|
||||||
|
<script src="$1" type="${2:text/javascript}" language="${3:javascript}"></script>
|
6
emacs/.emacs.d/snippets/html-mode/trans-with-cap
Normal file
6
emacs/.emacs.d/snippets/html-mode/trans-with-cap
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
# -*- mode: snippet -*-
|
||||||
|
# name: trans with cap
|
||||||
|
# key: trans
|
||||||
|
# condition: pony-tpl-minor-mode
|
||||||
|
# --
|
||||||
|
{% trans "$1"|capfirst %}
|
7
emacs/.emacs.d/snippets/org-mode/codeblock
Normal file
7
emacs/.emacs.d/snippets/org-mode/codeblock
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
# -*- mode: snippet -*-
|
||||||
|
# name: codeblock
|
||||||
|
# key: code
|
||||||
|
# --
|
||||||
|
#+begin_src $1
|
||||||
|
$0
|
||||||
|
#+end_src
|
9
emacs/.emacs.d/snippets/org-mode/heading
Normal file
9
emacs/.emacs.d/snippets/org-mode/heading
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
# -*- mode: snippet -*-
|
||||||
|
# name: Heading
|
||||||
|
# key: *
|
||||||
|
# --
|
||||||
|
${1:*} ${2:TODO} $3
|
||||||
|
${1:$(make-string (length text) ?\ )} :PROPERTIES:
|
||||||
|
${1:$(make-string (length text) ?\ )} :CATEGORY: $4
|
||||||
|
${1:$(make-string (length text) ?\ )} :END:
|
||||||
|
${1:$(make-string (length text) ?\ )} $0
|
51
emacs/.emacs.d/snippets/org-mode/project
Normal file
51
emacs/.emacs.d/snippets/org-mode/project
Normal file
|
@ -0,0 +1,51 @@
|
||||||
|
# -*- mode: snippet -*-
|
||||||
|
# name: project
|
||||||
|
# key: project
|
||||||
|
# --
|
||||||
|
#+TITLE: ${1:project_name}
|
||||||
|
#+LINK: src ${2:http://code.ryuslash.org/cgit.cgi/$3$1/}
|
||||||
|
#+LINK: tar_gz $2${4:snapshot/$1-master}.tar.gz
|
||||||
|
#+LINK: zip $2$4.zip
|
||||||
|
#+STARTUP: showall
|
||||||
|
|
||||||
|
#+begin_html
|
||||||
|
<script src="/keyjs.js" type="text/javascript"></script>
|
||||||
|
<script type="text/javascript">
|
||||||
|
keyjs_initialize({ "u": [ "keyjs_goto", "../index.html" ],
|
||||||
|
"h": [ "keyjs_goto", "http://ryuslash.org" ] });
|
||||||
|
</script>
|
||||||
|
#+end_html
|
||||||
|
|
||||||
|
#+INCLUDE: "dlmenu.inc"
|
||||||
|
|
||||||
|
* About
|
||||||
|
|
||||||
|
${5:A short description about $1}
|
||||||
|
|
||||||
|
| $0Status | $6 |
|
||||||
|
| Language | $7 |
|
||||||
|
| License | ${8:GPLv3} |
|
||||||
|
|
||||||
|
* Why?
|
||||||
|
|
||||||
|
${9:Why did you even think of writing $1?}
|
||||||
|
|
||||||
|
* Features
|
||||||
|
|
||||||
|
${10:$1 does...}
|
||||||
|
|
||||||
|
* Dependencies
|
||||||
|
|
||||||
|
${11:$1 needs to have...}
|
||||||
|
|
||||||
|
* Download
|
||||||
|
|
||||||
|
${12:To download $1...}
|
||||||
|
|
||||||
|
* Install
|
||||||
|
|
||||||
|
${13:To install $1...}
|
||||||
|
|
||||||
|
* Usage
|
||||||
|
|
||||||
|
${14:Using $1...}
|
14
emacs/.emacs.d/snippets/org-mode/snippet
Normal file
14
emacs/.emacs.d/snippets/org-mode/snippet
Normal file
|
@ -0,0 +1,14 @@
|
||||||
|
# -*- mode: snippet -*-
|
||||||
|
# name: snippet
|
||||||
|
# key: snippet
|
||||||
|
# --
|
||||||
|
#+TITLE: ${1:snippet-name}
|
||||||
|
#+OPTIONS: toc:nil
|
||||||
|
|
||||||
|
* $1
|
||||||
|
|
||||||
|
${2:A short description abount $1}
|
||||||
|
|
||||||
|
#+BEGIN_SRC $3 :tangle yes
|
||||||
|
$0
|
||||||
|
#+END_SRC
|
8
emacs/.emacs.d/snippets/php-mode/function
Normal file
8
emacs/.emacs.d/snippets/php-mode/function
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
# -*- mode: snippet; require-final-newline: nil -*-
|
||||||
|
# name: function
|
||||||
|
# key: function
|
||||||
|
# --
|
||||||
|
function $1($2)
|
||||||
|
{
|
||||||
|
$0
|
||||||
|
}
|
13
emacs/.emacs.d/snippets/php-mode/wpheader.php
Normal file
13
emacs/.emacs.d/snippets/php-mode/wpheader.php
Normal file
|
@ -0,0 +1,13 @@
|
||||||
|
# -*- mode: snippet; require-final-newline: nil -*-
|
||||||
|
# name: WP Plugin Header
|
||||||
|
# key: header
|
||||||
|
# --
|
||||||
|
/*
|
||||||
|
* Plugin Name: $1
|
||||||
|
* Plugin URI: $2
|
||||||
|
* Description: $3
|
||||||
|
* Version: ${4:1.0}
|
||||||
|
* Author: ${5:Tom Willemse}
|
||||||
|
* Author URI: ${6:https://ryuslash.org}
|
||||||
|
* License: ${7:GPLv2}
|
||||||
|
*/
|
7
emacs/.emacs.d/snippets/python-mode/defm_empty
Normal file
7
emacs/.emacs.d/snippets/python-mode/defm_empty
Normal file
|
@ -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)
|
9
emacs/.emacs.d/snippets/python-mode/form
Normal file
9
emacs/.emacs.d/snippets/python-mode/form
Normal file
|
@ -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
|
8
emacs/.emacs.d/snippets/python-mode/form_valid
Normal file
8
emacs/.emacs.d/snippets/python-mode/form_valid
Normal file
|
@ -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)
|
|
@ -0,0 +1,8 @@
|
||||||
|
# -*- mode: snippet -*-
|
||||||
|
# name: form_valid with return
|
||||||
|
# key: formvalid
|
||||||
|
# --
|
||||||
|
def form_valid(self, form):
|
||||||
|
rv = super(`(let ((name (python-info-current-defun))) (substring name 0 (cl-position ?. name)))`, self).form_valid(form)
|
||||||
|
$0
|
||||||
|
return rv
|
6
emacs/.emacs.d/snippets/python-mode/import_from
Normal file
6
emacs/.emacs.d/snippets/python-mode/import_from
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
# name: from ... import ...
|
||||||
|
# contributor: Tom Willemse
|
||||||
|
# key: from
|
||||||
|
# --
|
||||||
|
from ${1:module} import ${2:class_or_module}
|
7
emacs/.emacs.d/snippets/python-mode/method
Normal file
7
emacs/.emacs.d/snippets/python-mode/method
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
# -*- mode: snippet -*-
|
||||||
|
# name: method
|
||||||
|
# key: defm
|
||||||
|
# --
|
||||||
|
def $1(self$2):
|
||||||
|
'''$3'''
|
||||||
|
$0
|
9
emacs/.emacs.d/snippets/python-mode/permission_guard
Normal file
9
emacs/.emacs.d/snippets/python-mode/permission_guard
Normal file
|
@ -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)
|
5
emacs/.emacs.d/snippets/python-mode/url
Normal file
5
emacs/.emacs.d/snippets/python-mode/url
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
# -*- mode: snippet -*-
|
||||||
|
# name: url
|
||||||
|
# key: url
|
||||||
|
# --
|
||||||
|
url(r'^$1', $2, name='$3'),
|
5
emacs/.emacs.d/snippets/ruby-mode/ProductSeed
Normal file
5
emacs/.emacs.d/snippets/ruby-mode/ProductSeed
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
# -*- mode: snippet; require-final-newline: nil -*-
|
||||||
|
# name: ProductSeed
|
||||||
|
# key: pseed
|
||||||
|
# --
|
||||||
|
Product.find_or_create_by_name(parent_id: $1, name: '$2', description: '$3', price: '$4')
|
5
emacs/.emacs.d/snippets/ruby-mode/ProductSeedHW
Normal file
5
emacs/.emacs.d/snippets/ruby-mode/ProductSeedHW
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
# -*- mode: snippet; require-final-newline: nil -*-
|
||||||
|
# name: ProductSeedWithHW
|
||||||
|
# key: pseed
|
||||||
|
# --
|
||||||
|
Product.find_or_create_by_name(parent_id: $1, name: '$2', description: '$3', price: '$4', width_in_cm: '$5', height_in_cm: '$6', width_in_mm: '${5:$(round (* 10 (string-to-int yas-text)))}', height_in_mm: '${6:$(round (* 10 (string-to-int yas-text)))}')
|
8
emacs/.emacs.d/snippets/ruby-mode/ProductSeedHWGroup
Normal file
8
emacs/.emacs.d/snippets/ruby-mode/ProductSeedHWGroup
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
# -*- mode: snippet; require-final-newline: nil -*-
|
||||||
|
# name: ProductSeedWithHWGroup
|
||||||
|
# key: pseed
|
||||||
|
# --
|
||||||
|
Product.find_or_create_by_name(parent_id: $1, name: '$2', description: 'Small', price: '20.00', width_in_cm: '25.00', height_in_cm: '21.00', width_in_mm: '250', height_in_mm: '210')
|
||||||
|
Product.find_or_create_by_name(parent_id: $1, name: '$2', description: 'Medium', price: '20.00', width_in_cm: '30.00', height_in_cm: '25.80', width_in_mm: '300', height_in_mm: '258')
|
||||||
|
Product.find_or_create_by_name(parent_id: $1, name: '$2', description: 'Large', price: '20.00', width_in_cm: '35.00', height_in_cm: '30.00', width_in_mm: '350', height_in_mm: '300')
|
||||||
|
Product.find_or_create_by_name(parent_id: $1, name: '$2', description: 'Extra large', price: '20.00', width_in_cm: '40.00', height_in_cm: '34.00', width_in_mm: '400', height_in_mm: '340')
|
Loading…
Reference in a new issue