Need to call this whenever RC is modified and to be updated.
RC file is not closed if it is the buffer of current window or it is modified."
(interactive)
- (save-excursion
- (let (no-killing-at-last)
- (setq emchat-world nil)
- (set-buffer (find-file-noselect emchat-world-rc-filename))
- ;; don't kill if rc file is buffer in current window
- (setq no-killing-at-last
- (or (buffer-modified-p)
- (eq (window-buffer) (current-buffer))))
- (goto-char (point-min))
- (while (search-forward-regexp emchat-world-rc-regexp nil t)
- (let* ((uin (match-string 1))
- (alias (replace-regexp-in-string
- emchat-world-ssi-id-regexp ""
- (match-string 2)))
- (group (replace-regexp-in-string
- emchat-world-ssi-id-regexp ""
- (or (match-string 3) "")))
- buddy)
-
- ;; idea from Erik Arneson <erik@starseed.com>
- (set-extent-properties
- ;; We may consider moving to emchat-uin-alias or somewhere else, if
- ;; we don't want to waste enourmous unused extents.
- (make-extent 0 (length alias) alias)
- `(highlight t duplicable t start-open t keymap ,emchat-alias-map))
-
- (setq buddy (list alias uin 'rc-index (point)))
-
- ;; group stuff not used yet
- (if group
- (setq buddy
- (append buddy (read (format "(group (%s))" group)))))
- (push buddy emchat-world)))
- (setq emchat-world (nreverse emchat-world))
- (unless no-killing-at-last
- (kill-buffer (current-buffer)))))
-
- (setq emchat-all-aliases (mapcar 'first emchat-world))
- (setq emchat-all-uin (mapcar 'second emchat-world))
- ;; Add history files to emchat-world if enabled
- (when emchat-history-enabled-flag
+ (let (avatars)
+ (mapcar
+ #'(lambda (a)
+ (let ((cface (emchat-world-getf a 'cface))
+ (xface (emchat-world-getf a 'xface)))
+ (and cface (push (cons (concat a "-c") cface) avatars))
+ (and xface (push (cons (concat a "-x") xface) avatars))))
+ emchat-all-aliases)
+ (save-excursion
+ (let (no-killing-at-last)
+ ;; Save the avatar images for later re-inclusion into emchat-world
+ (setq emchat-world nil)
+ (set-buffer (find-file-noselect emchat-world-rc-filename))
+ ;; don't kill if rc file is buffer in current window
+ (setq no-killing-at-last
+ (or (buffer-modified-p)
+ (eq (window-buffer) (current-buffer))))
+ (goto-char (point-min))
+ (while (search-forward-regexp emchat-world-rc-regexp nil t)
+ (let* ((uin (match-string 1))
+ (alias (replace-regexp-in-string
+ emchat-world-ssi-id-regexp ""
+ (match-string 2)))
+ (group (replace-regexp-in-string
+ emchat-world-ssi-id-regexp ""
+ (or (match-string 3) "")))
+ buddy)
+
+ ;; idea from Erik Arneson <erik@starseed.com>
+ (set-extent-properties
+ ;; We may consider moving to emchat-uin-alias or somewhere else, if
+ ;; we don't want to waste enourmous unused extents.
+ (make-extent 0 (length alias) alias)
+ `(highlight t duplicable t start-open t keymap ,emchat-alias-map))
+
+ (setq buddy (list alias uin 'rc-index (point)))
+
+ ;; group stuff not used yet
+ (if group
+ (setq buddy
+ (append buddy (read (format "(group (%s))" group)))))
+ (push buddy emchat-world)))
+ (setq emchat-world (nreverse emchat-world))
+ (unless no-killing-at-last
+ (kill-buffer (current-buffer)))))
+
+ (setq emchat-all-aliases (mapcar 'first emchat-world))
+ (setq emchat-all-uin (mapcar 'second emchat-world))
+ ;; Add history files to emchat-world if enabled
+ (when emchat-history-enabled-flag
+ (mapcar
+ #'(lambda (alias)
+ (emchat-world-putf alias 'history
+ (expand-file-name alias emchat-history-directory)))
+ emchat-all-aliases))
+ ;; Re-add avatars
(mapcar
- #'(lambda (alias)
- (emchat-world-putf alias 'history
- (expand-file-name alias emchat-history-directory)))
+ #'(lambda (a)
+ (let ((cface (cdr (assoc (concat a "-c") avatars)))
+ (xface (cdr (assoc (concat a "-x") avatars))))
+ (and cface (emchat-world-putf a 'cface cface))
+ (and xface (emchat-world-putf a 'xface xface))))
emchat-all-aliases)))
(defun emchat-world-info (alias)