Add jabber library

This commit is contained in:
Tom Willemse 2015-12-18 20:29:53 +01:00
parent aff5b83554
commit c75739c406
2 changed files with 51 additions and 15 deletions

View file

@ -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)

View file

@ -0,0 +1,43 @@
;;; oni-jabber.el --- Extra commands and functions for Jabber -*- lexical-binding: t; -*-
;; Copyright (C) 2015 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-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