(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" (+ " ")
+ (opt (let network (* (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))))
+ (_
+ (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
(defvar lurk-mode-map
(let ((map (make-sparse-keymap)))
(define-key map (kbd "RET") 'lurk-enter)
- (define-key map (kbd "<tab>") 'lurk-complete-nick)
+ (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)