From: plugd Date: Sun, 19 May 2024 14:11:54 +0000 (+0200) Subject: Added header. X-Git-Url: https://thelambdalab.xyz/gitweb/index.cgi?a=commitdiff_plain;h=14e7306e9457469d704d364ccc753189244adff4;p=lurk.git Added header. --- diff --git a/murk.el b/murk.el index 652b3c2..fb79061 100644 --- a/murk.el +++ b/murk.el @@ -300,6 +300,7 @@ The head of this list is always the current context.") (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) @@ -366,8 +367,24 @@ The head of this list is always the current context.") "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*") @@ -626,6 +643,17 @@ The head of this list is always the current context.") (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)