From c2778f0f713cc885087d6302196e421596ff248e Mon Sep 17 00:00:00 2001 From: Tom Willemse Date: Thu, 21 Aug 2014 00:23:56 +0200 Subject: Add Emacs config --- emacs/.emacs.d/site-lisp/.gitignore | 1 + emacs/.emacs.d/site-lisp/Makefile | 5 + emacs/.emacs.d/site-lisp/appt-init.el | 46 +++++ emacs/.emacs.d/site-lisp/avandu-init.el | 35 ++++ emacs/.emacs.d/site-lisp/drd.el | 8 + emacs/.emacs.d/site-lisp/dzen.el | 86 +++++++++ emacs/.emacs.d/site-lisp/eltuki.el | 266 ++++++++++++++++++++++++++++ emacs/.emacs.d/site-lisp/gnus-init.el | 82 +++++++++ emacs/.emacs.d/site-lisp/jabber-init.el | 200 +++++++++++++++++++++ emacs/.emacs.d/site-lisp/metalexpress.el | 80 +++++++++ emacs/.emacs.d/site-lisp/mu4e-init.el | 54 ++++++ emacs/.emacs.d/site-lisp/my-smt.el | 123 +++++++++++++ emacs/.emacs.d/site-lisp/org-init.el | 192 ++++++++++++++++++++ emacs/.emacs.d/site-lisp/pivot.el | 70 ++++++++ emacs/.emacs.d/site-lisp/pkgbuild.el | 57 ++++++ emacs/.emacs.d/site-lisp/quick-edit-mode.el | 74 ++++++++ emacs/.emacs.d/site-lisp/wm-init.el | 3 + 17 files changed, 1382 insertions(+) create mode 100644 emacs/.emacs.d/site-lisp/.gitignore create mode 100644 emacs/.emacs.d/site-lisp/Makefile create mode 100644 emacs/.emacs.d/site-lisp/appt-init.el create mode 100644 emacs/.emacs.d/site-lisp/avandu-init.el create mode 100644 emacs/.emacs.d/site-lisp/drd.el create mode 100644 emacs/.emacs.d/site-lisp/dzen.el create mode 100644 emacs/.emacs.d/site-lisp/eltuki.el create mode 100644 emacs/.emacs.d/site-lisp/gnus-init.el create mode 100644 emacs/.emacs.d/site-lisp/jabber-init.el create mode 100644 emacs/.emacs.d/site-lisp/metalexpress.el create mode 100644 emacs/.emacs.d/site-lisp/mu4e-init.el create mode 100644 emacs/.emacs.d/site-lisp/my-smt.el create mode 100644 emacs/.emacs.d/site-lisp/org-init.el create mode 100644 emacs/.emacs.d/site-lisp/pivot.el create mode 100644 emacs/.emacs.d/site-lisp/pkgbuild.el create mode 100644 emacs/.emacs.d/site-lisp/quick-edit-mode.el create mode 100644 emacs/.emacs.d/site-lisp/wm-init.el (limited to 'emacs/.emacs.d/site-lisp') diff --git a/emacs/.emacs.d/site-lisp/.gitignore b/emacs/.emacs.d/site-lisp/.gitignore new file mode 100644 index 0000000..813048b --- /dev/null +++ b/emacs/.emacs.d/site-lisp/.gitignore @@ -0,0 +1 @@ +rudel/ diff --git a/emacs/.emacs.d/site-lisp/Makefile b/emacs/.emacs.d/site-lisp/Makefile new file mode 100644 index 0000000..ffa8ad7 --- /dev/null +++ b/emacs/.emacs.d/site-lisp/Makefile @@ -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 \"$<\")" diff --git a/emacs/.emacs.d/site-lisp/appt-init.el b/emacs/.emacs.d/site-lisp/appt-init.el new file mode 100644 index 0000000..95fcc41 --- /dev/null +++ b/emacs/.emacs.d/site-lisp/appt-init.el @@ -0,0 +1,46 @@ +;;; appt-init.el --- Initialization for appt -*- lexical-binding: t; -*- + +;; Copyright (C) 2014 Tom Willemse + +;; Author: Tom Willemse +;; 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 . + +;;; 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 diff --git a/emacs/.emacs.d/site-lisp/avandu-init.el b/emacs/.emacs.d/site-lisp/avandu-init.el new file mode 100644 index 0000000..3a80140 --- /dev/null +++ b/emacs/.emacs.d/site-lisp/avandu-init.el @@ -0,0 +1,35 @@ +;;; avandu-init.el --- Initialization for avandu -*- lexical-binding: t; -*- + +;; Copyright (C) 2014 Tom Willemse + +;; Author: Tom Willemse +;; 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 . + +;;; 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 diff --git a/emacs/.emacs.d/site-lisp/drd.el b/emacs/.emacs.d/site-lisp/drd.el new file mode 100644 index 0000000..6639232 --- /dev/null +++ b/emacs/.emacs.d/site-lisp/drd.el @@ -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))) diff --git a/emacs/.emacs.d/site-lisp/dzen.el b/emacs/.emacs.d/site-lisp/dzen.el new file mode 100644 index 0000000..da83099 --- /dev/null +++ b/emacs/.emacs.d/site-lisp/dzen.el @@ -0,0 +1,86 @@ +;;; dzen.el --- Control DZEN2 from emacs + +;; Copyright (C) 2012 Tom Willemse + +;; Author: Tom Willemse +;; 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 . + +;;; 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 diff --git a/emacs/.emacs.d/site-lisp/eltuki.el b/emacs/.emacs.d/site-lisp/eltuki.el new file mode 100644 index 0000000..b64f786 --- /dev/null +++ b/emacs/.emacs.d/site-lisp/eltuki.el @@ -0,0 +1,266 @@ +;;; eltuki.el --- Tekuti functions + +;; Copyright (C) 2012 Tom Willemse + +;; Author: Tom Willemse +;; 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 . + +;;; 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 diff --git a/emacs/.emacs.d/site-lisp/gnus-init.el b/emacs/.emacs.d/site-lisp/gnus-init.el new file mode 100644 index 0000000..60093c4 --- /dev/null +++ b/emacs/.emacs.d/site-lisp/gnus-init.el @@ -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) diff --git a/emacs/.emacs.d/site-lisp/jabber-init.el b/emacs/.emacs.d/site-lisp/jabber-init.el new file mode 100644 index 0000000..fd99a2d --- /dev/null +++ b/emacs/.emacs.d/site-lisp/jabber-init.el @@ -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 "") '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 diff --git a/emacs/.emacs.d/site-lisp/metalexpress.el b/emacs/.emacs.d/site-lisp/metalexpress.el new file mode 100644 index 0000000..619e4e3 --- /dev/null +++ b/emacs/.emacs.d/site-lisp/metalexpress.el @@ -0,0 +1,80 @@ +;;; metalexpress.el --- Listen to Metal Express Radio + +;; Copyright (C) 2012 Tom Willemse + +;; Author: Tom Willemse +;; 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 . + +;;; 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 diff --git a/emacs/.emacs.d/site-lisp/mu4e-init.el b/emacs/.emacs.d/site-lisp/mu4e-init.el new file mode 100644 index 0000000..e11baf5 --- /dev/null +++ b/emacs/.emacs.d/site-lisp/mu4e-init.el @@ -0,0 +1,54 @@ +;;; mu4e-init.el --- mu4e initialization + +;; Copyright (C) 2012 Tom Willemse + +;; Author: Tom Willemse +;; 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 . + +;;; 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 diff --git a/emacs/.emacs.d/site-lisp/my-smt.el b/emacs/.emacs.d/site-lisp/my-smt.el new file mode 100644 index 0000000..32009a2 --- /dev/null +++ b/emacs/.emacs.d/site-lisp/my-smt.el @@ -0,0 +1,123 @@ +;;; my-smt.el --- My SVG mode-line theme -*- lexical-binding: t; -*- + +;; Copyright (C) 2014 Tom Willemse + +;; Author: Tom Willemse +;; 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 . + +;;; 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 diff --git a/emacs/.emacs.d/site-lisp/org-init.el b/emacs/.emacs.d/site-lisp/org-init.el new file mode 100644 index 0000000..6a5c908 --- /dev/null +++ b/emacs/.emacs.d/site-lisp/org-init.el @@ -0,0 +1,192 @@ +;;; org-init.el --- Org initialization + +;; Copyright (C) 2012 Tom Willemse + +;; Author: Tom Willemse +;; 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 . + +;;; 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 diff --git a/emacs/.emacs.d/site-lisp/pivot.el b/emacs/.emacs.d/site-lisp/pivot.el new file mode 100644 index 0000000..63830ab --- /dev/null +++ b/emacs/.emacs.d/site-lisp/pivot.el @@ -0,0 +1,70 @@ +;;; pivot.el --- Elisp library for the Pivotal Tracker API -*- lexical-binding: t; -*- + +;; Copyright (C) 2014 Tom Willemse + +;; Author: Tom Willemse +;; 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 . + +;;; 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 diff --git a/emacs/.emacs.d/site-lisp/pkgbuild.el b/emacs/.emacs.d/site-lisp/pkgbuild.el new file mode 100644 index 0000000..9cfde12 --- /dev/null +++ b/emacs/.emacs.d/site-lisp/pkgbuild.el @@ -0,0 +1,57 @@ +;;; pkgbuild.el --- PKGBUILD utility functions -*- lexical-binding: t; -*- + +;; Copyright (C) 2014 Tom Willemse + +;; Author: Tom Willemse +;; 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 . + +;;; 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 diff --git a/emacs/.emacs.d/site-lisp/quick-edit-mode.el b/emacs/.emacs.d/site-lisp/quick-edit-mode.el new file mode 100644 index 0000000..898d7c2 --- /dev/null +++ b/emacs/.emacs.d/site-lisp/quick-edit-mode.el @@ -0,0 +1,74 @@ +;;; quick-edit-mode.el --- Quickly edit stuff + +;; Copyright (C) 2012 Tom Willemse + +;; Author: Tom Willemse +;; 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 . + +;;; 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 diff --git a/emacs/.emacs.d/site-lisp/wm-init.el b/emacs/.emacs.d/site-lisp/wm-init.el new file mode 100644 index 0000000..694acab --- /dev/null +++ b/emacs/.emacs.d/site-lisp/wm-init.el @@ -0,0 +1,3 @@ +(async-shell-command "herbstluftwm" " herbstluftwm") +(async-shell-command "dunst" " dunst") +(async-shell-command "xbindkeys" " xbindkeys") -- cgit v1.2.3-54-g00ecf