From c75739c4065de8a12fa307fe895bed7ef44417d3 Mon Sep 17 00:00:00 2001 From: Tom Willemse Date: Fri, 18 Dec 2015 20:29:53 +0100 Subject: [PATCH] Add jabber library --- emacs/.emacs.d/init.el | 23 +++++--------- emacs/.emacs.d/site-lisp/oni-jabber.el | 43 ++++++++++++++++++++++++++ 2 files changed, 51 insertions(+), 15 deletions(-) create mode 100644 emacs/.emacs.d/site-lisp/oni-jabber.el diff --git a/emacs/.emacs.d/init.el b/emacs/.emacs.d/init.el index 258acb1..bf1088c 100644 --- a/emacs/.emacs.d/init.el +++ b/emacs/.emacs.d/init.el @@ -141,10 +141,6 @@ MODE1 is enabled and vice-versa." "Set the `disabled' property for each item in FUNCTIONS to nil." (mapc #'(lambda (f) (put f 'disabled nil)) functions)) -(defun oni:set-keys-for-jabber-chat () - "Set certain keys for `jabber-chat-mode'." - (local-set-key (kbd "M-!") #'shell-command-with-command)) - (defun oni:set-keys-for-tagedit () "Set some keybindings for `tagedit-mode'." (local-set-key (kbd "M-k") #'tagedit-kill-attribute)) @@ -205,14 +201,6 @@ For `python-mode' I prefer `python-imenu-create-flat-index'." (oni:set-theme frame)))) (oni:eval-after-init (oni:set-theme nil))) -(defun oni:shell-command-with-command (command &optional output-buffer) - "Print both COMMAND and the output into OUTPUT-BUFFER." - (interactive (list (read-shell-command "Shell command: " nil nil) - current-prefix-arg)) - (when output-buffer - (insert "`" command "':\n")) - (shell-command command output-buffer)) - (defun oni:show-buffer-position () "Show the position in the current buffer." (interactive) @@ -761,9 +749,14 @@ If no direction is given, don't split." (oni:add-hooks 'ielm-mode-hook #'paredit-mode #'eldoc-mode 'oni:set-emacs-lisp-keys) -(oni:add-hooks 'jabber-chat-mode-hook - #'oni:set-keys-for-jabber-chat 'oni:make-readable - 'oni:reset-default-directory) +;; Bind Jabber chat-specific keys +(add-hook 'jabber-chat-mode-hook 'oni:set-keys-for-jabber-chat) + +;; Make jabber chat buffers a little bit more readable +(add-hook 'jabber-chat-mode-hook 'oni:make-readable) + +;; Reset the `default-directory' to my $HOME in jabber chat buffers. +(add-hook 'jabber-chat-mode-hook 'oni:reset-default-directory) (oni:add-hooks 'js2-mode-hook #'tern-mode #'moz-minor-mode) 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..f0550f9 --- /dev/null +++ b/emacs/.emacs.d/site-lisp/oni-jabber.el @@ -0,0 +1,43 @@ +;;; oni-jabber.el --- Extra commands and functions for Jabber -*- lexical-binding: t; -*- + +;; Copyright (C) 2015 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: + +;; Here are some extra commands and functions for jabber. + +;;; Code: + +(require 'jabber-chatbuffer) + +;;;###autoload +(defun oni:set-keys-for-jabber-chat () + "Set certain keys for `jabber-chat-mode'." + (define-key jabber-chat-mode-map (kbd "M-!") #'oni:shell-command-with-command)) + +(defun oni:shell-command-with-command (command &optional output-buffer) + "Print both COMMAND and the output into OUTPUT-BUFFER." + (interactive (list (read-shell-command "Shell command: " nil nil) + current-prefix-arg)) + (when output-buffer + (insert "`" command "':\n")) + (shell-command command output-buffer)) + +(provide 'oni-jabber) +;;; oni-jabber.el ends here