(defun murk-context-server (ctx) (elt ctx 0))
(defun murk-context-name (ctx) (elt ctx 1))
+(defun murk-context-users (ctx) (seq-drop ctx 2))
(defun murk-server-context-p (ctx) (not (cdr ctx)))
(defun murk-add-context (ctx)
"Marker for prompt position in murk buffer.")
(defun murk-setup-header ()
- ;; To do
- )
+ (with-current-buffer "*murk*"
+ (setq-local header-line-format
+ '((:eval
+ (let* ((ctx (murk-current-context)))
+ (if ctx
+ (let ((server (murk-context-server ctx)))
+ (concat
+ "Network: " server ", "
+ (if (murk-server-context-p ctx)
+ "Server"
+ (concat
+ "Channel: "
+ (murk-context-name ctx)
+ " ("
+ (number-to-string
+ (length (murk-context-users ctx)))
+ ")"))))
+ "No connection")))))))
(defun murk-setup-buffer ()
(with-current-buffer (get-buffer-create "*murk*")
(not murk-debug)))
(murk-display-notice nil "Debug mode now " (if murk-debug "on" "off") "."))
+(defun murk-command-header (params)
+ (if
+ (if params
+ (equal (upcase (car params)) "ON")
+ (not header-line-format))
+ (progn
+ (murk-setup-header)
+ (murk-display-notice nil "Header enabled."))
+ (setq-local header-line-format nil)
+ (murk-display-notice nil "Header disabled.")))
+
(defun murk-command-clear (params)
(if (not params)
(murk-clear-buffer)