X-Git-Url: https://cgit.sxemacs.org/?p=riece;a=blobdiff_plain;f=lisp%2Friece-misc.el;h=eb0de2079ee87cf85d843ae440cd7ffd469253c1;hp=ded59d1f8293722c83aa5ed6fff374859b644285;hb=a0b576c2225bad55b58b7646314c0194172a4742;hpb=ce31ecd481aadab99d158271dc360dc4d33d8af8 diff --git a/lisp/riece-misc.el b/lisp/riece-misc.el index ded59d1..eb0de20 100644 --- a/lisp/riece-misc.el +++ b/lisp/riece-misc.el @@ -69,12 +69,20 @@ (set-buffer (car buffers)) (let ((inhibit-read-only t) buffer-read-only - (start (goto-char (point-max)))) + (start (goto-char (point-max))) + window + point) (insert (format-time-string "%H:%M") " " string) + (setq point (point)) (if (and (not (riece-frozen (current-buffer))) - (get-buffer-window (current-buffer))) - (set-window-point (get-buffer-window (current-buffer)) - (point))) + (setq window (get-buffer-window (current-buffer))) + (not (pos-visible-in-window-p point window))) + (save-excursion ;save-selected-window changes + ;current buffer + (save-selected-window + (select-window window) + (goto-char point) ;select-window changes current point + (recenter riece-window-center-line)))) (run-hook-with-args 'riece-after-insert-functions start (point)))) (setq buffers (cdr buffers)))) @@ -125,11 +133,12 @@ (while (string-match "^\\([^ ]+\\) +" string) (setq parameters (nconc parameters (list (match-string 1 string))) string (substring string (match-end 0))) - (and (not (equal "" string)) (eq ?: (aref string 0)) - (setq string (substring string 1)) - (throw 'done nil)))) - (or (equal "" string) - (setq parameters (nconc parameters (list string)))) + (when (and (not (equal "" string)) (eq ?: (aref string 0))) + (setq string (substring string 1) + parameters (nconc parameters (list string))) + (throw 'done nil))) + (or (equal "" string) + (setq parameters (nconc parameters (list string))))) parameters))) (defun riece-concat-channel-topic (target string) @@ -165,7 +174,11 @@ (defun riece-concat-server-name (string) (if (equal riece-server-name "") string - (concat string " (from " riece-server-name ")"))) + (let ((server-name (concat " (from " riece-server-name ")"))) + (put-text-property 0 (length server-name) + 'riece-server-name riece-server-name + server-name) + (concat string server-name)))) (defun riece-concat-user-status (status string) (if status @@ -201,22 +214,31 @@ user-at-host)) (defun riece-get-users-on-server (server-name) - (delq nil (mapcar (lambda (identity) - (if (riece-user-p (riece-identity-prefix identity)) - identity)) - (riece-get-identities-on-server server-name)))) + (riece-with-server-buffer server-name + (let (identities) + (mapatoms + (lambda (user) + (setq identities + (cons (riece-make-identity (symbol-name user) server-name) + identities))) + riece-user-obarray) + identities))) -(defun riece-get-identities-on-server (server-name) +(defun riece-get-channels-on-server (server-name) (riece-with-server-buffer server-name (let (identities) (mapatoms - (lambda (atom) + (lambda (channel) (setq identities - (cons (riece-make-identity (symbol-name atom) server-name) + (cons (riece-make-identity (symbol-name channel) server-name) identities))) - riece-obarray) + riece-channel-obarray) identities))) +(defun riece-get-identities-on-server (server-name) + (nconc (riece-get-channels-on-server server-name) + (riece-get-users-on-server server-name))) + (defun riece-check-channel-commands-are-usable (&optional channel) (unless riece-current-channel (error (substitute-command-keys