riece-update-short-channel-indicator
riece-update-channel-list-indicator))
+(defvar riece-channel-list-changed nil)
+
(defun riece-update-user-list-buffer ()
(save-excursion
(set-buffer riece-user-list-buffer)
(setq users (cdr users))))))))
(defun riece-update-channel-list-buffer ()
- (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:%c%s\n" index
- (if (riece-identity-equal
- (car channels)
- riece-current-channel)
- ?*
- ?\ )
- (riece-format-identity (car channels))))
- (put-text-property point (point) 'riece-identity
- (car channels))))
- (setq index (1+ index)
- channels (cdr channels))))))
+ (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: %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-channel-list-changed nil))))
(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
(if channel
(riece-parse-identity channel)))
riece-default-channel-binding)))
- (riece-channel-buffer-create identity)))
+ (riece-channel-buffer-create identity)
+ (setq riece-channel-list-changed t)))
(defun riece-switch-to-nearest-channel (pointer)
(let ((start riece-current-channels)
(if pointer
(setcar pointer nil))
(if (riece-identity-equal identity riece-current-channel)
- (riece-switch-to-nearest-channel pointer))))
+ (riece-switch-to-nearest-channel pointer))
+ (setq riece-channel-list-changed t)))
(defun riece-redisplay-buffers (&optional force)
(riece-update-buffers)
(if (looking-at riece-prefix-regexp)
(put-text-property (match-beginning 1) (match-end 1) 'invisible t))))
+(defun riece-channel-list-mark-current-channel ()
+ (if (and riece-channel-list-buffer-mode
+ riece-current-channel)
+ (save-excursion
+ (set-buffer riece-channel-list-buffer)
+ (let ((inhibit-read-only t)
+ buffer-read-only)
+ (goto-char (point-min))
+ (if (re-search-forward "^\\( ?[0-9]+:\\)\\*" nil t)
+ (replace-match "\\1 "))
+ (goto-char (point-min))
+ (if (re-search-forward
+ (concat
+ "^\\( ?[0-9]+:\\).\\("
+ (regexp-quote (riece-format-identity riece-current-channel))
+ "\\)$") nil t)
+ (replace-match "\\1*\\2"))))))
+
(defun riece-channel-list-turn-on-font-lock ()
(make-local-variable 'font-lock-defaults)
(setq font-lock-defaults '(riece-channel-list-font-lock-keywords t))
'riece-dialogue-schedule-turn-on-font-lock)
(put 'riece-channel-list-mode 'font-lock-defaults
'(riece-channel-list-font-lock-keywords t))
+ (add-hook 'riece-channel-switch-hook
+ 'riece-channel-list-mark-current-channel)
(add-hook 'riece-after-load-startup-hook
'riece-channel-list-schedule-turn-on-font-lock))