aboutsummaryrefslogtreecommitdiffstats
path: root/emacs/.emacs.d
diff options
context:
space:
mode:
Diffstat (limited to 'emacs/.emacs.d')
-rw-r--r--emacs/.emacs.d/GNUmakefile17
-rw-r--r--emacs/.emacs.d/init.org111
-rw-r--r--emacs/.emacs.d/site-lisp/oni-jabber.el50
3 files changed, 176 insertions, 2 deletions
diff --git a/emacs/.emacs.d/GNUmakefile b/emacs/.emacs.d/GNUmakefile
index e6136b3..ea979f1 100644
--- a/emacs/.emacs.d/GNUmakefile
+++ b/emacs/.emacs.d/GNUmakefile
@@ -1,6 +1,10 @@
EMACS = /usr/bin/emacs
-init.elc:
+AUTOLOADS_FILE = site-lisp/site-autoloads.el
+UNWANTED = $(AUTOLOADS_FILE) site-lisp/flycheck_% site-lisp/flycheck-%
+SITE_LISPS = $(addsuffix c,$(filter-out $(UNWANTED),$(wildcard site-lisp/*.el)))
+
+all: init.elc $(AUTOLOADS_FILE) $(SITE_LISPS)
%.el: %.org
$(EMACS) -batch -eval "(progn \
@@ -9,4 +13,13 @@ init.elc:
(org-babel-tangle-file \"$<\" \"$@\" \"emacs-lisp\"))"
%.elc: %.el
- $(EMACS) -batch -eval "(byte-compile-file \"$<\")"
+ $(EMACS) -batch \
+ -eval "(package-initialize)" \
+ -eval "(byte-compile-file \"$<\")"
+
+### Site Lisp
+
+$(AUTOLOADS_FILE): $(SITE_LISPS)
+ $(EMACS) -batch \
+ -eval "(setq generated-autoload-file \"$(CURDIR)/$@\")" \
+ -eval "(update-directory-autoloads \"$(CURDIR)/site-lisp/\")"
diff --git a/emacs/.emacs.d/init.org b/emacs/.emacs.d/init.org
index 7f252ca..a802bba 100644
--- a/emacs/.emacs.d/init.org
+++ b/emacs/.emacs.d/init.org
@@ -86,6 +86,18 @@ To start off, first I need to enable lexical binding.
(require ,library-symbol)))))))
#+END_SRC
+* Site lisp
+
+ Setup everything so that any autoloads in ~site-lisp/~ get loaded
+ and can be used.
+
+ #+BEGIN_SRC emacs-lisp
+ (add-to-list 'load-path (locate-user-emacs-file "site-lisp/"))
+ (let ((loaddefs (locate-user-emacs-file "site-lisp/site-autoloads.el")))
+ (when (file-exists-p loaddefs)
+ (load loaddefs)))
+ #+END_SRC
+
* Helper functions
I have noticed that I refer to the combination of
@@ -862,6 +874,105 @@ To start off, first I need to enable lexical binding.
(add-hook 'org-mode-hook 'auto-fill-mode)
#+END_SRC
+** Jabber
+
+ I like using XMPP to talk to people, jabber.el is very good at
+ this.
+
+ #+BEGIN_SRC emacs-lisp
+ (ensure-library jabber)
+ (eval-when-compile (require 'jabber))
+ #+END_SRC
+
+ Add my account.
+
+ #+BEGIN_SRC emacs-lisp
+ (setq jabber-account-list
+ `((,(concat "ryuslash@dukgo.com/" (system-name)))
+ (:connection-type . starttls)))
+ #+END_SRC
+
+ Store any persistent data in the data directory.
+
+ #+BEGIN_SRC emacs-lisp
+ (setq jabber-avatar-cache-directory (oni:data-location "jabber/avatars/")
+ jabber-history-dir (oni:data-location "jabber/hist/"))
+ #+END_SRC
+
+ Change the default prompts.
+
+ #+BEGIN_SRC emacs-lisp
+ (setq jabber-chat-buffer-format "+%n"
+ jabber-chat-foreign-prompt-format "%t %u"
+ jabber-chat-local-prompt-format "%t %u"
+ jabber-chat-delayed-time-format "%H:%M"
+ jabber-groupchat-buffer-format "++%n"
+ jabber-groupchat-prompt-format "%t %u")
+ #+END_SRC
+
+ Don't show avatars, publish or retrieve avatars.
+
+ #+BEGIN_SRC emacs-lisp
+ (setq jabber-chat-buffer-show-avatar nil
+ jabber-vcard-avatars-publish nil
+ jabber-vcard-avatars-retrieve nil)
+ #+END_SRC
+
+ Don't fill long lines in jabber chat buffers, but use visual line
+ mode.
+
+ #+BEGIN_SRC emacs-lisp
+ (setq jabber-chat-fill-long-lines nil)
+
+ (add-hook 'jabber-chat-mode-hook 'visual-line-mode)
+ #+END_SRC
+
+ Don't send notifications about chat states.
+
+ #+BEGIN_SRC emacs-lisp
+ (setq jabber-chatstates-confirm nil)
+ #+END_SRC
+
+ Colorize text in multi-user chats.
+
+ #+BEGIN_SRC emacs-lisp
+ (setq jabber-muc-colorize-local t
+ jabber-muc-colorize-foreign t)
+ #+END_SRC
+
+ Enable recording history.
+
+ #+BEGIN_SRC emacs-lisp
+ (setq jabber-history-enabled t
+ jabber-use-global-history nil)
+ #+END_SRC
+
+ Clean up the default view of the roster buffer.
+
+ #+BEGIN_SRC emacs-lisp
+ (setq jabber-roster-show-bindings nil
+ jabber-show-offline-contacts nil)
+
+ (add-hook 'jabber-roster-mode-hook 'oni-jabber-set-roster-mode-line)
+ #+END_SRC
+
+ Use libnotify to send jabber notifications.
+
+ #+BEGIN_SRC emacs-lisp
+ (add-hook 'jabber-alert-message-hooks 'jabber-message-libnotify)
+ (add-hook 'jabber-alert-muc-hooks 'jabber-muc-libnotify)
+ #+END_SRC
+
+ Don't echo presence changes in the mode line, show them in the
+ relevant buffer instead.
+
+ #+BEGIN_SRC emacs-lisp
+ (with-eval-after-load 'jabber-alert
+ (remove-hook 'jabber-alert-presence-hooks 'jabber-presence-echo))
+
+ (add-hook 'jabber-alert-presence-hooks 'oni-jabber-show-status-in-buffer)
+ #+END_SRC
+
* Custom
Put the customize settings in a different file so that Emacs doesn't
diff --git a/emacs/.emacs.d/site-lisp/oni-jabber.el b/emacs/.emacs.d/site-lisp/oni-jabber.el
new file mode 100644
index 0000000..f498868
--- /dev/null
+++ b/emacs/.emacs.d/site-lisp/oni-jabber.el
@@ -0,0 +1,50 @@
+;;; oni-jabber.el --- Extra commands and functions for jabber -*- lexical-binding: t; -*-
+
+;; Copyright (C) 2016 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:
+
+;; Here are some extra commands and functions for jabber.
+
+;;; Code:
+
+(require 'jabber-chat)
+
+;;;###autoload
+(defun oni-jabber-set-roster-mode-line ()
+ "Change the mode-line to only show the buffer id."
+ (unless (eq major-mode 'jabber-roster-mode)
+ (error "Will not change mode-line, not in the jabber roster buffer"))
+ (setq mode-line-format
+ (list (propertize " %m" 'face 'mode-line-buffer-id))))
+
+;;;###autoload
+(defun oni-jabber-show-status-in-buffer
+ (who _oldstatus _newstatus _statustext proposed-alert)
+ "Check to see if WHO has a buffer and if so print their new status.
+
+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)))))))
+
+(provide 'oni-jabber)
+;;; oni-jabber.el ends here