Download
(require 'jabber)
(defvar jabber-chat-input-ring nil
"List of lastest messages sent.")
(defvar jabber-chat-input-ring-max 20
"*Maximun length of the input ring. If the ring reaches this
size old elements will be thrown away as new come.")
(defun jabber-chat-input-initialize()
(make-local-variable 'jabber-chat-input-ring))
(add-hook 'jabber-chat-mode-hook 'jabber-chat-input-initialize)
(defun jabber-chat-input-ring-new (string)
"Make STRING the latest input stored on the ring. "
(if (not (string-equal (car jabber-chat-input-ring) string))
(progn
(push string jabber-chat-input-ring)
(if (> (length jabber-chat-input-ring) jabber-chat-input-ring-max)
(setcdr (nthcdr (1- jabber-chat-input-ring-max) jabber-chat-input-ring) nil)))))
(defun jabber-chat-input-remember (body id)
(set-text-properties 0 (length body) nil body)
(jabber-chat-input-ring-new body)
nil)
(add-hook 'jabber-chat-send-hooks 'jabber-chat-input-remember)
(defun jabber-chat-input-cycle-input ()
"Inserts into the chat buffer previous sent messages."
(interactive)
(if (eq last-command 'jabber-chat-input-cycle-input)
(progn
(setq jabber-chat-input-current-position
(mod (1+ jabber-chat-input-current-position)
(length jabber-chat-input-ring)))
(jabber-chat-input-clean))
(setq jabber-chat-input-current-position 0))
(insert (car (nthcdr jabber-chat-input-current-position
jabber-chat-input-ring))))
(defun jabber-chat-input-clean ()
(save-excursion
(delete-region jabber-point-insert (point-max))))
(provide 'jabber-chatx)