diff options
author | Case Duckworth | 2021-06-06 23:27:50 -0500 |
---|---|---|
committer | Case Duckworth | 2021-06-06 23:27:50 -0500 |
commit | a2823598fbac280ab23ea14324fde2c0dae71cd8 (patch) | |
tree | 3f4d26a2395728f648df00a53d8f9f6ef83c4958 | |
parent | Require erc on connect (diff) | |
download | emacs-a2823598fbac280ab23ea14324fde2c0dae71cd8.tar.gz emacs-a2823598fbac280ab23ea14324fde2c0dae71cd8.zip |
Add acdw-erc/prompt
-rw-r--r-- | lisp/acdw-erc.el | 17 |
1 files changed, 17 insertions, 0 deletions
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." | |||
81 | (with-message (format "Killing server buffer: %s" (buffer-name buffer)) | 81 | (with-message (format "Killing server buffer: %s" (buffer-name buffer)) |
82 | (with-current-buffer buffer | 82 | (with-current-buffer buffer |
83 | (erc-quit-server erc/bye-message))))) | 83 | (erc-quit-server erc/bye-message))))) |
84 | (defun acdw-erc/prompt () | ||
85 | "The prompt to show for ERC." | ||
86 | ;; Rewrite s-truncate to avoid dependency. | ||
87 | (let ((name (buffer-name)) | ||
88 | (ellipsis "...") | ||
89 | (len erc-fill-static-center)) | ||
90 | (if (and len (> (length name) (- len 2))) | ||
91 | (format "%s%s>" | ||
92 | (substring name 0 (- len 2 (length ellipsis))) | ||
93 | ellipsis) | ||
94 | (format "%s%s>" (let ((ss) ; Rewrite s-repeat to avoid dependency. | ||
95 | (num (- len 2 (length name)))) | ||
96 | (while (> num 0) | ||
97 | (setq ss (cons " " ss)) | ||
98 | (setq num (1- num))) | ||
99 | (apply #'concat ss)) | ||
100 | name)))) | ||
84 | 101 | ||
85 | (provide 'acdw-erc) | 102 | (provide 'acdw-erc) |
86 | ;;; acdw-erc.el ends here | 103 | ;;; acdw-erc.el ends here |