"Face used for Lurk text.")
(defface lurk-prompt
- '((t :inherit org-priority))
+ '((t :inherit font-lock-keyword-face))
"Face used for the prompt.")
(defface lurk-context
- '((t :inherit org-tag))
+ '((t :inherit lurk-context))
"Face used for the context name in the prompt.")
(defface lurk-faded
- '((t :inherit org-agenda-dimmed-todo-face))
+ '((t :inherit shadow))
"Face used for faded Lurk text.")
(defface lurk-timestamp
- '((t :inherit org-agenda-dimmed-todo-face))
+ '((t :inherit shadow))
"Face used for timestamps.")
(defface lurk-error
- '((t :inherit font-lock-regexp-grouping-construct))
+ '((t :inherit error))
"Face used for Lurk error text.")
(defface lurk-notice
- '((t :inherit org-upcoming-deadline))
+ '((t :inherit warning))
"Face used for Lurk notice text.")
;;; Global variables
(defun lurk-get-context-users (name)
(gethash name lurk-contexts))
+(defun lurk-context-known-p (name)
+ (not (eq (gethash name lurk-contexts 0) 0)))
+
(defun lurk-add-context-users (context users)
(puthash context
- (append users
- (gethash context lurk-contexts))
+ (cl-union users
+ (gethash context lurk-contexts))
lurk-contexts))
(defun lurk-del-context-user (context user)
(fill-region (point-min) (point-max) nil t)
(buffer-string))))
+(defun lurk--start-of-final-line ()
+ (with-current-buffer "*lurk*"
+ (save-excursion
+ (goto-char (point-max))
+ (line-beginning-position))))
+
(defun lurk-display-string (context prefix &rest strings)
- (with-current-buffer (get-buffer-create "*lurk*")
+ (with-current-buffer "*lurk*"
(save-excursion
(goto-char lurk-prompt-marker)
(let* ((inhibit-read-only t)
'face (lurk-get-context-facelist context)
'read-only t
'context context
- 'invisible context-atom))))))))
+ 'invisible context-atom))))))
+ (dolist (window (get-buffer-window-list))
+ (if (>= (window-point window) (lurk--start-of-final-line))
+ (with-selected-window window
+ (recenter -1))))))
(defun lurk-display-message (from to text)
(let ((context (if (eq 'channel (lurk-get-context-type to))
(let* ((params (lurk-msg-params msg))
(channel (elt params 2))
(names (split-string (elt params 3))))
- (lurk-add-context-users channel names)))
+ (if (lurk-context-known-p channel)
+ (lurk-add-context-users channel names)
+ (lurk-display-notice nil "Users in " channel ": " (string-join names " ")))))
("366" ; ENDOFNAMES
(let* ((params (lurk-msg-params msg))
(channel (elt params 1)))
- (lurk-display-notice
- channel
- (lurk--as-string (length (lurk-get-context-users channel)))
- " users in " channel)))
+ (if (lurk-context-known-p channel)
+ (lurk-display-notice
+ channel
+ (lurk--as-string (length (lurk-get-context-users channel)))
+ " users in " channel)
+ (lurk-display-notice nil "End of " channel " names list."))))
("331"
(let* ((params (lurk-msg-params msg))
" " (number-to-string port) "]")))
(lurk-display-notice nil "(Modify the `lurk-networks' variable to add more.)"))
-(defun lurk-command-quit (params)
- (let ((quit-msg (if params (string-join params " ") nil)))
- (lurk-send-msg (lurk-msg nil nil "QUIT" quit-msg))))
-
(defun lurk-command-part (params)
(let ((channel (if params (car params) lurk-current-context)))
(if channel
(lurk-display-notice nil "Usage: /version <nick>")))
(defun lurk-command-quit (params)
- (let ((quit-msg (if params (string-join parms " ") lurk-default-quit-msg)))
+ (let ((quit-msg (if params (string-join params " ") lurk-default-quit-msg)))
(lurk-send-msg (lurk-msg nil nil "QUIT" quit-msg))))
(defun lurk-command-nick (params)
(defvar lurk-mode-map
(let ((map (make-sparse-keymap)))
(define-key map (kbd "RET") 'lurk-enter)
- (define-key map (kbd "<tab>") 'lurk-complete-input)
+ (define-key map (kbd "TAB") 'lurk-complete-input)
(define-key map (kbd "C-c C-z") 'lurk-toggle-zoom)
(define-key map (kbd "<C-tab>") 'lurk-cycle-contexts-forward)
(define-key map (kbd "<C-S-tab>") 'lurk-cycle-contexts-reverse)
(define-key map (kbd "<C-up>") 'lurk-history-prev)
(define-key map (kbd "<C-down>") 'lurk-history-next)
+ (when (fboundp 'evil-define-key*)
+ (evil-define-key* 'motion map
+ (kbd "TAB") 'lurk-complete-input))
map))
(defvar lurk-mode-map)