Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Provide customization to append chat messages at top or bottom

* rudel-chat.el (header): updated copyright
  (rudel-chat-handler-function): split "log into buffer" behavior into
  "append at bottom" and "appending at top"
  (rudel-chat-handle-buffer-top): renamed `rudel-chat-handle-buffer ->
  `rudel-chat-handle-buffer-top
  (rudel-chat-handle-buffer-bottom): new function; append chat
  messages at bottom of target buffer
  • Loading branch information...
commit 0f69e06d618e57b80933cd0b5033602a2719fc66 1 parent 498eb0d
Jan Moringen authored

Showing 1 changed file with 21 additions and 6 deletions. Show diff stats Hide diff stats

  1. +21 6 rudel-chat.el
27 rudel-chat.el
... ... @@ -1,6 +1,6 @@
1 1 ;;; rudel-chat.el --- Handling of chat messages
2 2 ;;
3   -;; Copyright (C) 2008, 2009 Jan Moringen
  3 +;; Copyright (C) 2008, 2009, 2010 Jan Moringen
4 4 ;;
5 5 ;; Author: Jan Moringen <scymtym@users.sourceforge.net>
6 6 ;; Keywords: Rudel, chat, message
@@ -42,13 +42,17 @@
42 42 ;;; Customization
43 43 ;;
44 44
45   -(defcustom rudel-chat-handler-function #'rudel-chat-handle-buffer
  45 +(defcustom rudel-chat-handler-function #'rudel-chat-handle-buffer-top
46 46 "A function that is called when chat messages arrive."
47 47 :group 'rudel
48 48 :type '(choice (const :tag "Display messages in the echo area"
49 49 rudel-chat-handle-message)
50   - (const :tag "Log messages into a buffer"
51   - rudel-chat-handle-buffer)
  50 + (const :tag "Log messages into a buffer, \
  51 +inserting at the top"
  52 + rudel-chat-handle-buffer-top)
  53 + (const :tag "Log messages into a buffer, \
  54 +inserting at the bottom"
  55 + rudel-chat-handle-buffer-bottom)
52 56 (function :tag "Other function"))
53 57 )
54 58
@@ -78,8 +82,8 @@ inserted.")
78 82 (rudel-chat-format-sender sender)
79 83 text))
80 84
81   -(defun rudel-chat-handle-buffer (sender text)
82   - "Insert SENDER and MESSAGE in a buffer."
  85 +(defun rudel-chat-handle-buffer-top (sender text)
  86 + "Insert SENDER and MESSAGE at the beginning a buffer."
83 87 (let ((buffer (or (get-buffer rudel-chat-buffer-name)
84 88 (pop-to-buffer rudel-chat-buffer-name))))
85 89 (with-current-buffer buffer
@@ -89,6 +93,17 @@ inserted.")
89 93 text))))
90 94 )
91 95
  96 +(defun rudel-chat-handle-buffer-bottom (sender text)
  97 + "Insert SENDER and MESSAGE at the end of a buffer."
  98 + (let ((buffer (or (get-buffer rudel-chat-buffer-name)
  99 + (pop-to-buffer rudel-chat-buffer-name))))
  100 + (with-current-buffer buffer
  101 + (goto-char (point-max))
  102 + (insert (format "\n%s: %s"
  103 + (rudel-chat-format-sender sender)
  104 + text))))
  105 + )
  106 +
92 107
93 108 ;;; Miscellaneous functions
94 109 ;;

0 comments on commit 0f69e06

Please sign in to comment.
Something went wrong with that request. Please try again.