Switched to font-lock and basic faces.
[lurk.git] / lurk.el
diff --git a/lurk.el b/lurk.el
index e9c089f..d969376 100644 (file)
--- a/lurk.el
+++ b/lurk.el
   "Face used for Lurk text.")
 
 (defface lurk-prompt
-  '((t :inherit org-priority))
+  '((t :inherit font-lock-keyword-face))
   "Face used for the prompt.")
 
 (defface lurk-context
-  '((t :inherit org-tag))
+  '((t :inherit lurk-context))
   "Face used for the context name in the prompt.")
 
 (defface lurk-faded
-  '((t :inherit org-agenda-dimmed-todo-face))
+  '((t :inherit shadow))
   "Face used for faded Lurk text.")
 
 (defface lurk-timestamp
-  '((t :inherit org-agenda-dimmed-todo-face))
+  '((t :inherit shadow))
   "Face used for timestamps.")
 
 (defface lurk-error
-  '((t :inherit font-lock-regexp-grouping-construct))
+  '((t :inherit error))
   "Face used for Lurk error text.")
 
 (defface lurk-notice
-  '((t :inherit org-upcoming-deadline))
+  '((t :inherit warning))
   "Face used for Lurk notice text.")
 
 ;;; Global variables
@@ -826,6 +826,7 @@ in which case they match anything.")
   '(("DEBUG" "Toggle debug mode on/off." lurk-command-debug lurk-boolean-completions)
     ("HEADER" "Toggle display of header." lurk-command-header lurk-boolean-completions)
     ("CONNECT" "Connect to an IRC network." lurk-command-connect lurk-network-completions)
+    ("NETWORKS" "List known IRC networks." lurk-command-networks)
     ("TOPIC" "Set topic for current channel." lurk-command-topic)
     ("ME" "Display action." lurk-command-me)
     ("VERSION" "Request version of another user's client via CTCP." lurk-command-version)
@@ -893,6 +894,15 @@ in which case they match anything.")
         (lurk-connect network))
     (lurk-display-notice nil "Usage: /connect <network>")))
 
+(defun lurk-command-networks (params)
+  (lurk-display-notice nil "Currently-known networks:")
+  (dolist (row lurk-networks)
+    (seq-let (network server port &rest others) row
+      (lurk-display-notice nil "\t" network
+                           " [" server
+                           " " (number-to-string port) "]")))
+  (lurk-display-notice nil "(Modify the `lurk-networks' variable to add more.)"))
+
 (defun lurk-command-quit (params)
   (let ((quit-msg (if params (string-join params " ") nil)))
     (lurk-send-msg (lurk-msg nil nil "QUIT" quit-msg))))
@@ -1075,19 +1085,21 @@ in which case they match anything.")
       (lurk-enter-string line))))
 
 
-
 ;;; Mode
 ;;
 
 (defvar lurk-mode-map
   (let ((map (make-sparse-keymap)))
     (define-key map (kbd "RET") 'lurk-enter)
-    (define-key map (kbd "<tab>") 'lurk-complete-input)
+    (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)
     (define-key map (kbd "<C-up>") 'lurk-history-prev)
     (define-key map (kbd "<C-down>") 'lurk-history-next)
+    (when (fboundp 'evil-define-key*)
+      (evil-define-key* 'motion map
+        (kbd "TAB") 'lurk-complete-input))
     map))
 
 (defvar lurk-mode-map)
@@ -1102,14 +1114,17 @@ in which case they match anything.")
 ;;; Main start procedure
 ;;
 
-(defun lurk ()
-  "Switch to *lurk* buffer."
+(defun lurk (&optional network)
+  "Start lurk or just switch to the lurk buffer if one already exists.
+Also connect to NETWORK if non-nil."
   (interactive)
   (if (get-buffer "*lurk*")
       (switch-to-buffer "*lurk*")
     (switch-to-buffer "*lurk*")
     (lurk-mode)
-    (lurk-setup-buffer))
+    (lurk-setup-buffer)
+    (if network
+        (lurk-command-connect (list network))))
   "Started LURK.")