From a2823598fbac280ab23ea14324fde2c0dae71cd8 Mon Sep 17 00:00:00 2001 From: Case Duckworth Date: Sun, 6 Jun 2021 23:27:50 -0500 Subject: Add acdw-erc/prompt --- lisp/acdw-erc.el | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/lisp/acdw-erc.el b/lisp/acdw-erc.el index 7517d0e..6e06325 100644 --- a/lisp/acdw-erc.el +++ b/lisp/acdw-erc.el @@ -81,6 +81,23 @@ If USE-TLS is non-nil, use TLS." (with-message (format "Killing server buffer: %s" (buffer-name buffer)) (with-current-buffer buffer (erc-quit-server erc/bye-message))))) +(defun acdw-erc/prompt () + "The prompt to show for ERC." + ;; Rewrite s-truncate to avoid dependency. + (let ((name (buffer-name)) + (ellipsis "...") + (len erc-fill-static-center)) + (if (and len (> (length name) (- len 2))) + (format "%s%s>" + (substring name 0 (- len 2 (length ellipsis))) + ellipsis) + (format "%s%s>" (let ((ss) ; Rewrite s-repeat to avoid dependency. + (num (- len 2 (length name)))) + (while (> num 0) + (setq ss (cons " " ss)) + (setq num (1- num))) + (apply #'concat ss)) + name)))) (provide 'acdw-erc) ;;; acdw-erc.el ends here -- cgit 1.4.1-21-gabe81