X-Git-Url: https://thelambdalab.xyz/gitweb/index.cgi?p=lurk.git;a=blobdiff_plain;f=lurk.el;h=edfb66fe7d6b79b90021d2d35b7a8c79ea85c7df;hp=535b990186bb5394044ca9cdfa878c3204871cba;hb=HEAD;hpb=056830a869c9320dc05ac53b223f546f243f68c6 diff --git a/lurk.el b/lurk.el index 535b990..52ee3b6 100644 --- a/lurk.el +++ b/lurk.el @@ -472,7 +472,10 @@ portion of the source component of the message, as LURK doesn't use this.") (buffer-string))) (defun lurk--context-button-action (button) - (lurk-set-current-context (button-get button 'context))) + (let ((context (button-get button 'context))) + (if (eq lurk-current-context context) + (lurk-toggle-zoom) + (lurk-set-current-context context)))) (defun lurk-display-string (context prefix &rest strings) (with-current-buffer "*lurk*" @@ -887,6 +890,7 @@ in which case they match anything.") ("NICK" "Change nick." lurk-command-nick) ("LIST" "Display details of one or more channels." lurk-command-list) ("WHOIS" "Ask server for details of nick." nil lurk-nick-completions) + ("USERS" "List nicks of users in current context." lurk-command-users) ("MSG" "Send private message to user." lurk-command-msg lurk-nick-completions) ("CLEAR" "Clear buffer text." lurk-command-clear lurk-context-completions) ("HELP" "Display help on client commands." lurk-command-help lurk-help-completions)) @@ -986,8 +990,8 @@ in which case they match anything.") (if new-nick (if (lurk-connected-p) (lurk-send-msg (lurk-msg nil nil "NICK" new-nick)) - (setq lurk-nick nick) - (lurk-display-notice nil "Set default nick to '" nick "'.")) + (setq lurk-nick new-nick) + (lurk-display-notice nil "Set default nick to '" lurk-nick "'.")) (lurk-display-notice nil "Current nick: " lurk-nick)))) (defun lurk-command-me (params) @@ -1029,6 +1033,15 @@ in which case they match anything.") (dolist (context params) (lurk-clear-context context)))) +(defun lurk-command-users (params) + (if lurk-current-context + (progn + (lurk-display-notice lurk-current-context "Users in " lurk-current-context ":") + (lurk-display-notice + lurk-current-context + (string-join (lurk-get-context-users lurk-current-context) " "))) + (lurk-display-notice nil "No current channel."))) + ;;; Command entering ;; @@ -1111,7 +1124,7 @@ in which case they match anything.") (defun lurk-complete-input () (interactive) (let ((completion-ignore-case t)) - (when (and (>= (point) lurk-input-marker)) + (when (>= (point) lurk-input-marker) (pcase (buffer-substring lurk-input-marker (point)) ((rx (: "/" (let cmd-str (+ (not whitespace))) (+ " ") (* (not whitespace)) string-end)) (let ((space-idx (save-excursion @@ -1132,7 +1145,11 @@ in which case they match anything.") (re-search-backward " " lurk-input-marker t))) (start (if space-idx (+ 1 space-idx) lurk-input-marker))) (unless (string-prefix-p "/" (buffer-substring start end)) - (completion-in-region start end (lurk-get-context-users lurk-current-context))))))))) + (let* ((users (lurk-get-context-users lurk-current-context)) + (users-no@ (mapcar + (lambda (u) (car (split-string u "@" t))) + users))) + (completion-in-region start end users-no@))))))))) (defun lurk-enter () "Enter current contents of line after prompt." @@ -1163,8 +1180,6 @@ in which case they match anything.") (kbd "TAB") 'lurk-complete-input)) map)) -(defvar lurk-mode-map) - (define-derived-mode lurk-mode text-mode "lurk" "Major mode for LURK.")