riece-update-short-channel-indicator
riece-update-channel-list-indicator))
-(defvar riece-redisplay-buffer nil
- "Non-nil means the buffer needs to be updated.
-Local to the buffers.")
+(defvar riece-channel-list-changed nil)
(defun riece-update-user-list-buffer ()
(save-excursion
(set-buffer riece-user-list-buffer)
- (when (and riece-redisplay-buffer
- riece-current-channel
+ (when (and riece-current-channel
(riece-channel-p (riece-identity-prefix riece-current-channel)))
(let (users operators speakers)
(with-current-buffer (process-buffer (riece-server-process
(if (member (car users) speakers)
(insert "+" (car users) "\n")
(insert " " (car users) "\n")))
- (setq users (cdr users)))))
- (setq riece-redisplay-buffer nil))))
+ (setq users (cdr users))))))))
(defun riece-update-channel-list-buffer ()
- (save-excursion
- (set-buffer riece-channel-list-buffer)
- (when riece-redisplay-buffer
- (let ((inhibit-read-only t)
- buffer-read-only
- (index 1)
- (channels riece-current-channels))
- (erase-buffer)
- (while channels
- (if (car channels)
- (let ((point (point)))
- (insert (format "%2d: %s\n" index
- (riece-format-identity (car channels))))
- (put-text-property point (point) 'riece-identity
- (car channels))))
- (setq index (1+ index)
- channels (cdr channels))))
- (setq riece-redisplay-buffer nil))))
+ (if riece-channel-list-changed
+ (save-excursion
+ (set-buffer riece-channel-list-buffer)
+ (let ((inhibit-read-only t)
+ buffer-read-only
+ (index 1)
+ (channels riece-current-channels))
+ (erase-buffer)
+ (while channels
+ (if (car channels)
+ (let ((point (point)))
+ (insert (format "%2d: " index)
+ (riece-format-identity (car channels))
+ "\n")))
+ (setq index (1+ index)
+ channels (cdr channels)))))))
(defun riece-update-channel-indicator ()
(setq riece-channel-indicator
"None")))
(defun riece-update-channel-list-indicator ()
- (if (and riece-current-channels
- ;; There is at least one channel.
- (delq nil (copy-sequence riece-current-channels)))
- (let ((index 1))
- (setq riece-channel-list-indicator
- (mapconcat
- #'identity
- (delq nil
- (mapcar
- (lambda (channel)
- (prog1 (if channel
- (format "%d:%s" index
- (riece-format-identity channel)))
- (setq index (1+ index))))
- riece-current-channels))
- ",")))
- (setq riece-channel-list-indicator "No channel")))
+ (if riece-channel-list-changed
+ (if (and riece-current-channels
+ ;; There is at least one channel.
+ (delq nil (copy-sequence riece-current-channels)))
+ (let ((index 1))
+ (setq riece-channel-list-indicator
+ (mapconcat
+ #'identity
+ (delq nil
+ (mapcar
+ (lambda (channel)
+ (prog1
+ (if channel
+ (format "%d:%s" index
+ (riece-format-identity channel)))
+ (setq index (1+ index))))
+ riece-current-channels))
+ ",")))
+ (setq riece-channel-list-indicator "No channel"))))
(defun riece-update-status-indicators ()
(if riece-current-channel
(setq riece-channel-buffer (get-buffer (riece-channel-buffer-name
riece-current-channel))))
(run-hooks 'riece-update-buffer-functions)
+ (setq riece-channel-list-changed nil)
(force-mode-line-update t))
(defun riece-channel-buffer-name (identity)
- (format riece-channel-buffer-format (riece-format-identity identity)))
+ (let ((channels (riece-identity-member identity riece-current-channels)))
+ (if channels
+ (setq identity (car channels))
+ (if riece-debug
+ (message "%S is not a member of riece-current-channels" identity)))
+ (format riece-channel-buffer-format (riece-format-identity identity))))
(eval-when-compile
(autoload 'riece-channel-mode "riece"))
(current-buffer)))
(defun riece-switch-to-channel (identity)
- (setq riece-last-channel riece-current-channel
- riece-current-channel identity)
- (with-current-buffer riece-user-list-buffer
- (setq riece-redisplay-buffer t))
- (run-hooks 'riece-channel-switch-hook))
+ (let ((last riece-current-channel))
+ (setq riece-current-channel identity)
+ (run-hook-with-args 'riece-after-switch-to-channel-functions last)))
(defun riece-join-channel (identity)
(unless (riece-identity-member identity riece-current-channels)
(setq riece-current-channels
- (riece-identity-assign-binding identity riece-current-channels
- riece-default-channel-binding))
+ (riece-identity-assign-binding
+ identity riece-current-channels
+ (mapcar
+ (lambda (channel)
+ (if channel
+ (riece-parse-identity channel)))
+ riece-default-channel-binding)))
(riece-channel-buffer-create identity)
- (with-current-buffer riece-channel-list-buffer
- (setq riece-redisplay-buffer t))))
+ (setq riece-channel-list-changed t)))
(defun riece-switch-to-nearest-channel (pointer)
(let ((start riece-current-channels)
(setq identity (car pointer)))
(if identity
(riece-switch-to-channel identity)
- (setq riece-last-channel riece-current-channel
- riece-current-channel nil))))
+ (let ((last riece-current-channel))
+ (run-hook-with-args 'riece-after-switch-to-channel-functions last)
+ (setq riece-current-channel nil)))))
(defun riece-part-channel (identity)
(let ((pointer (riece-identity-member identity riece-current-channels)))
(setcar pointer nil))
(if (riece-identity-equal identity riece-current-channel)
(riece-switch-to-nearest-channel pointer))
- (with-current-buffer riece-channel-list-buffer
- (setq riece-redisplay-buffer t))))
+ (setq riece-channel-list-changed t)))
(defun riece-redisplay-buffers (&optional force)
(riece-update-buffers)