From a6382bdca03066f521dc351a9534e40804bcf6de Mon Sep 17 00:00:00 2001 From: plugd Date: Sat, 10 Jul 2021 13:15:35 +0200 Subject: [PATCH] Added zoom status to header. --- lurk.el | 56 ++++++++++++++++++++++++++++++++------------------------ 1 file changed, 32 insertions(+), 24 deletions(-) diff --git a/lurk.el b/lurk.el index e2d175e..9ef2fbb 100644 --- a/lurk.el +++ b/lurk.el @@ -107,6 +107,19 @@ (defvar lurk-debug nil "If non-nil, enable debug mode.") + +;;; Utility procedures +;; + +(defun lurk--filtered-join (&rest args) + (string-join (seq-filter (lambda (el) el) args) " ")) + +(defun lurk--as-string (obj) + (if obj + (with-output-to-string (princ obj)) + nil)) + + ;;; Network process ;; @@ -182,11 +195,6 @@ ;;; Server messages ;; -(defun lurk--as-string (obj) - (if obj - (with-output-to-string (princ obj)) - nil)) - (defun lurk-msg (tags src cmd &rest params) (list (lurk--as-string tags) (lurk--as-string src) @@ -235,9 +243,6 @@ portion of the source component of the message, as LURK doesn't use this.") (apply #'lurk-msg (append (list tags src cmd) params))) (error "Failed to parse string " string))) -(defun lurk--filtered-join (&rest args) - (string-join (seq-filter (lambda (el) el) args) " ")) - (defun lurk-msg->string (msg) (let ((tags (lurk-msg-tags msg)) (src (lurk-msg-src msg)) @@ -368,22 +373,25 @@ portion of the source component of the message, as LURK doesn't use this.") "Marker for prompt position in LURK buffer.") (defun lurk-setup-header () - (setq-local header-line-format - '(:eval - (let ((proc (get-process "lurk"))) - (if proc - (concat - "Host: " (car (process-contact proc)) - ", Context: " - (if lurk-current-context - (concat - lurk-current-context - " (" - (number-to-string - (length (lurk-get-context-users lurk-current-context))) - " users)") - "Server")) - "No connection"))))) + (with-current-buffer "*lurk*" + (setq-local header-line-format + '((:eval + (let ((proc (get-process "lurk"))) + (if proc + (concat + "Host: " (car (process-contact proc)) + ", Context: " + (if lurk-current-context + (concat + lurk-current-context + " (" + (number-to-string + (length (lurk-get-context-users lurk-current-context))) + " users)") + "Server")) + "No connection"))) + (:eval + (if lurk-zoomed " [ZOOMED]" "")))))) (defun lurk-setup-buffer () (with-current-buffer (get-buffer-create "*lurk*") -- 2.20.1