X-Git-Url: https://thelambdalab.xyz/gitweb/index.cgi?a=blobdiff_plain;f=lurk.el;h=675ec0ee5d95d8633949032638964e3857856227;hb=943a2fbb17df9da6a47389e77082a889a552f588;hp=68fff0d07821fa1482324039c5b3d4931628f3fb;hpb=26875ae30c72b8471716530e9c5bfcf5da02e71a;p=lurk.git diff --git a/lurk.el b/lurk.el index 68fff0d..675ec0e 100644 --- a/lurk.el +++ b/lurk.el @@ -351,8 +351,10 @@ portion of the source component of the message, as LURK doesn't use this.") "") 'face 'lurk-context 'read-only t) - (propertize (concat lurk-prompt-string " ") + (propertize lurk-prompt-string 'face 'lurk-prompt + 'read-only t) + (propertize " " ; Need this to be separate to mark it as rear-nonsticky 'read-only t 'rear-nonsticky t))) (set-marker-insertion-type lurk-input-marker nil)) @@ -831,7 +833,8 @@ in which case they match anything.") ("QUIT" "Disconnect from current network." lurk-command-quit) ("NICK" "Change nick." lurk-command-nick) ("LIST" "Display details of one or more channels." lurk-command-list) - ("MSG" "Send private message to user." lurk-command-msg lurk-nick-completions)) + ("MSG" "Send private message to user." lurk-command-msg lurk-nick-completions) + ("HELP" "Display help on client commands." lurk-command-help lurk-help-completions)) "Table of commands explicitly supported by Lurk.") (defun lurk-boolean-completions () @@ -846,6 +849,22 @@ in which case they match anything.") (defun lurk-context-completions () (lurk-get-context-list)) +(defun lurk-help-completions () + (mapcar (lambda (row) (car row)) lurk-command-table)) + +(defun lurk-command-help (params) + (if params + (let* ((cmd-str (upcase (car params))) + (row (assoc cmd-str lurk-command-table #'equal))) + (if row + (progn + (lurk-display-notice nil "Help for \x02" cmd-str "\x02:") + (lurk-display-notice nil " " (elt row 1))) + (lurk-display-notice nil "No such (client-interpreted) command."))) + (lurk-display-notice nil "Client-interpreted commands:") + (dolist (row lurk-command-table) + (lurk-display-notice nil " \x02" (elt row 0) "\x02: " (elt row 1))) + (lurk-display-notice nil "Use /HELP COMMAND to display information about a specific command."))) ;;; Command entering ;; @@ -959,7 +978,7 @@ in which case they match anything.") (lurk-display-notice nil "No current channel."))) (defun lurk-command-msg (params) - (if (and params (>= 2 (length params))) + (if (and params (>= (length params) 2)) (let ((to (car params)) (text (string-join (cdr params) " "))) (lurk-send-msg (lurk-msg nil nil "PRIVMSG" to text)) @@ -1039,12 +1058,13 @@ in which case they match anything.") (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 (funcall (elt table-row 3)))) + (let* ((completions-nospace (funcall (elt table-row 3))) + (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))) (completion-in-region lurk-input-marker (point) - (mapcar (lambda (row) (string-join (list "/" (car row)))) + (mapcar (lambda (row) (concat "/" (car row) " ")) lurk-command-table))) (_ (let* ((end (max lurk-input-marker (point)))