(defun lurk-context-completions ()
(mapcar (lambda (ctx) (lurk-context->string ctx)) lurk-contexts))
+(defun lurk-nick-completions ()
+ (let* ((users (lurk-get-context-users (lurk-current-context))))
+ (mapcar (lambda (u) (car (split-string u "@" t)))
+ users)))
+
(defun lurk-command-help (params)
(if params
(let* ((cmd-str (upcase (car params)))
(let ((completion-ignore-case t))
(when (>= (point) lurk-input-marker)
(pcase (buffer-substring lurk-input-marker (point))
- ((rx (: "/" (let cmd-str (+ (not whitespace))) (+ " ") (* (not whitespace)) string-end))
+ ((rx (: "/" (let cmd-str (+ (not whitespace)))
+ (+ " ") (* (not whitespace)) string-end))
(let ((space-idx (save-excursion
(re-search-backward " " lurk-input-marker t)))
(table-row (assoc (upcase cmd-str) lurk-command-table #'equal)))
(if (and table-row (elt table-row 3))
- (let* ((completions-nospace (funcall (elt table-row 3)))
- (completions (mapcar (lambda (el) (concat el " ")) completions-nospace)))
+ (let* ((completion-fun (elt table-row 3))
+ (completions-nospace (funcall completion-fun))
+ (completions (mapcar (lambda (el) (concat el " "))
+ completions-nospace)))
(completion-in-region (+ 1 space-idx) (point) completions)))))
((rx (: "/" (* (not whitespace)) string-end))
(message (buffer-substring 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)))
- (unless (string-prefix-p "/" (buffer-substring start end))
- (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@)))))))))
+ (completion-in-region start end (lurk-nick-completions))))))))
;;; Mode
;;