#+TITLE: Code Vault Here we have some code snippets that I no longer (intend to) use, but might still need (to look at) at some point in time. * Jabber urgency and libnotify This piece of code sends a message through ~libnotify~ and sets a window urgency hint when a new message is received. #+BEGIN_SRC emacs-lisp (defvar jabber-activity-jids-count 0) (defun jabber-urgency-hint () (let ((count (length jabber-activity-jids))) (unless (= jabber-activity-jids-count count) (if (zerop count) (x-urgency-hint (selected-frame) nil) (x-urgency-hint (selected-frame) t)) (setq jabber-activity-jids-count count)))) (defun libnotify-jabber-notify (from buf text proposed-alert) "(jabber.el hook) Notify of new Jabber chat messages via libnotify" (when (or jabber-message-alert-same-buffer (not (memq (selected-window) (get-buffer-window-list buf)))) (if (jabber-muc-sender-p from) (notify-send (format "(PM) %s" (jabber-jid-displayname (jabber-jid-user from))) (format "%s: %s" (jabber-jid-resource from) text))) (notify-send (format "%s: " (jabber-jid-displayname from)) (format "%.20s" text)))) (add-hook 'jabber-activity-update-hook 'jabber-urgency-hint) (add-hook 'jabber-alert-message-hooks 'libnotify-jabber-notify) #+END_SRC * Show symbol instead of ~lambda~ #+BEGIN_SRC emacs-lisp (defun oni:pretty-lambdas () "Show a lambda sign where the world `lambda' is found." (font-lock-add-keywords nil `(("(?\\(\\\\)[ :]" (0 (progn (compose-region (match-beginning 1) (match-end 1) ?λ))))))) #+END_SRC