X-Git-Url: https://thelambdalab.xyz/gitweb/index.cgi?a=blobdiff_plain;f=lurk.el;h=085a8ed77c993b1680292fbc53961944068d696b;hb=b6f2df4110c9ffe83bd3a3c4b3aa378682f8d626;hp=72d18cf28dd25d71e4124decf2d780ccac46b556;hpb=6c4686b0d2dd90142811ff7e1d2aa1898ecbd146;p=lurk.git diff --git a/lurk.el b/lurk.el index 72d18cf..085a8ed 100644 --- a/lurk.el +++ b/lurk.el @@ -45,11 +45,7 @@ "Default quit message when none supplied.") (defcustom lurk-networks - '(("libera" "irc.libera.chat" 6697) - ("freenode" "chat.freenode.net" 6697) - ("tilde" "tilde.chat" 6697) - ("mbr" "mbrserver.com" 6667 :notls) - ("local" "localhost" 6697)) + '(("libera" "irc.libera.chat" 6697)) "IRC networks.") (defcustom lurk-allow-ipv6 nil @@ -961,16 +957,31 @@ in which case they match anything.") (lurk-zoom-in lurk-current-context)) (setq lurk-zoomed (not lurk-zoomed))) -(defun lurk-complete-nick () +(defun lurk-complete-input () (interactive) - (when (and (>= (point) lurk-input-marker) lurk-current-context) - (let* ((end (max lurk-input-marker (point))) - (space-idx (save-excursion - (re-search-backward " " lurk-input-marker t))) - (start (if space-idx (+ 1 space-idx) lurk-input-marker)) - (completion-ignore-case t)) - (unless (string-prefix-p "/" (buffer-substring start end)) - (completion-in-region start end (lurk-get-context-users lurk-current-context)))))) + (when (and (>= (point) lurk-input-marker)) + (pcase (buffer-substring lurk-input-marker (point)) + ((rx (: "/connect" (+ " ") (* (not whitespace)) string-end)) + (let ((space-idx (save-excursion + (re-search-backward " " lurk-input-marker t)))) + (completion-in-region (+ 1 space-idx) + (point) + (mapcar (lambda (row) (car row)) lurk-networks)))) + ((rx (: "/" (* (not whitespace)) string-end)) + (message (buffer-substring lurk-input-marker (point))) + (completion-in-region lurk-input-marker (point) + '("/connect" + "/join" + "/part" + "/quit"))) + (_ + (let* ((end (max lurk-input-marker (point))) + (space-idx (save-excursion + (re-search-backward " " lurk-input-marker t))) + (start (if space-idx (+ 1 space-idx) lurk-input-marker)) + (completion-ignore-case t)) + (unless (string-prefix-p "/" (buffer-substring start end)) + (completion-in-region start end (lurk-get-context-users lurk-current-context)))))))) ;;; Mode @@ -979,7 +990,7 @@ in which case they match anything.") (defvar lurk-mode-map (let ((map (make-sparse-keymap))) (define-key map (kbd "RET") 'lurk-enter) - (define-key map (kbd "") 'lurk-complete-nick) + (define-key map (kbd "") 'lurk-complete-input) (define-key map (kbd "C-c C-z") 'lurk-toggle-zoom) (define-key map (kbd "") 'lurk-cycle-contexts-forward) (define-key map (kbd "") 'lurk-cycle-contexts-reverse)