about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorCase Duckworth2022-01-03 17:05:03 -0600
committerCase Duckworth2022-01-03 17:05:03 -0600
commit8c712dc9f0adbfb02da35a2379a739e114939e89 (patch)
tree21200ba8968663948c9b087dce0f87f07608dc4c
parentFix typos (diff)
downloademacs-8c712dc9f0adbfb02da35a2379a739e114939e89.tar.gz
emacs-8c712dc9f0adbfb02da35a2379a739e114939e89.zip
Format circe messages better
-rw-r--r--init.el98
-rw-r--r--lisp/+circe.el18
2 files changed, 91 insertions, 25 deletions
diff --git a/init.el b/init.el index 7cc4e43..066741a 100644 --- a/init.el +++ b/init.el
@@ -549,28 +549,82 @@
549 (:also-load circe-chanop) 549 (:also-load circe-chanop)
550 550
551 ;; Formatting options 551 ;; Formatting options
552 (:option circe-format-action (format (format "%%%ds* {nick} {body}" 552 (:option
553 (- +circe-left-margin 2)) 553 ;; Messages between users
554 " ") 554 circe-format-action (format (format "%%%ds* {nick} {body}"
555 circe-format-say (format "{nick:%1$d.%1$ds} | {body}" 555 (- +circe-left-margin 2))
556 (- +circe-left-margin 3)) 556 " ")
557 circe-format-self-action circe-format-action 557 circe-format-say (format "{nick:%1$d.%1$ds} | {body}"
558 circe-format-self-say (replace-regexp-in-string "|" ">" 558 (- +circe-left-margin 3))
559 circe-format-say) 559 circe-format-self-action circe-format-action
560 circe-format-server-part (+circe-format-meta 560 circe-format-self-say (replace-regexp-in-string "|" ">" circe-format-say)
561 "PART {channel}: {reason}") 561 circe-format-notice (format "-{nick:%1$d.%1$ds}---{body}"
562 circe-format-server-quit (+circe-format-meta "QUIT: {reason}") 562 (- +circe-left-margin 4))
563 circe-format-server-quit-channel (+circe-format-meta 563 circe-format-message (format (format "%%%ds@ *{nick}* {body}"
564 "QUIT {channel}: {reason}") 564 (- +circe-left-margin 2))
565 circe-format-server-join (+circe-format-meta "JOIN: {userinfo}") 565 " ")
566 circe-format-server-rejoin (+circe-format-meta 566 circe-format-message-action (replace-regexp-in-string "@" "*"
567 (concat "REJOIN: {userinfo} " 567 circe-format-message)
568 "after {departuredelta}")) 568 circe-format-self-message (format (format "%%%ds> *{chattarget}* {body}"
569 circe-format-server-topic (+circe-format-meta 569 (- +circe-left-margin 2))
570 "TOPIC: {new-topic}") 570 " ")
571 circe-prompt-string (format (format "%%%ds> " 571 ;; Meta messages
572 (- +circe-left-margin 2)) 572 circe-format-server-channel-creation-time (+circe-format-meta
573 " ")) 573 (concat "Channel {channel}"
574 " created on {date}") t)
575 circe-format-server-ctcp (+circe-format-meta
576 (concat "CTCP PING request to {target} from"
577 " {userhost}: {body}"))
578 circe-format-server-ctcp-ping-reply (+circe-format-meta
579 (concat
580 "CTCP PING reply to {target} from"
581 " {userhost}: {body}"))
582 circe-format-server-part (+circe-format-meta "PART {channel}: {reason}")
583 circe-format-server-quit (+circe-format-meta "QUIT: {reason}")
584 circe-format-server-quit-channel (+circe-format-meta
585 "QUIT {channel}: {reason}")
586 circe-format-server-join (+circe-format-meta "JOIN: {userinfo}")
587 circe-format-server-join-in-channel (+circe-format-meta
588 "JOIN {channel}: {userinfo}")
589 circe-format-server-lurker-activity (+circe-format-meta
590 "(JOINED {joindelta} ago)")
591 circe-format-server-message (+circe-format-meta "{body}" t)
592 circe-fromat-server-mode-change (+circe-format-meta
593 (concat "MODE: {target} {change}"
594 " by {setter} ({userhost})") t)
595 circe-format-server-netmerge (+circe-format-meta
596 (concat "NETMERGE: {split} at {date}"
597 " (/WL to see who's still missing)") t)
598 circe-format-server-netsplit (+circe-format-meta
599 (concat "NETSPLIT: {split}"
600 " (/WL to see who left)") t)
601 circe-format-server-nick-change (+circe-format-meta
602 "NICK WAS {old-nick} ({userhost})"
603 "new-nick")
604 circe-format-server-nick-regain (+circe-format-meta
605 "NICK REGAINED: {old-nick} ({userhost})"
606 "new-nick")
607 circe-format-server-notice (+circe-format-meta "-SERVER NOTICE- {body}" t)
608 circe-format-server-topic-time (+circe-format-meta
609 "TOPIC SET BY {setter} on {topic-date}")
610 circe-format-server-topic-time-for-channel (+circe-format-meta
611 (concat
612 "TOPIC ({channel}) SET BY"
613 " {setter} on {topic-date}"))
614 circe-format-server-whois-idle (+circe-format-meta "IDLE FOR {idle-duration}"
615 "whois-nick")
616 circe-format-server-whois-idle-with-signon (+circe-format-meta
617 (concat
618 "IDLE FOR {idle-duration}"
619 " (signon: {signon-date})")
620 "whois-nick")
621 circe-format-server-rejoin (+circe-format-meta
622 (concat "REJOIN: {userinfo} "
623 "after {departuredelta}"))
624 circe-format-server-topic (+circe-format-meta "TOPIC: {new-topic}")
625 circe-prompt-string (format (format "%%%ds> "
626 (- +circe-left-margin 2))
627 " "))
574 628
575 (:option +circe-server-buffer-action (lambda (buf) 629 (:option +circe-server-buffer-action (lambda (buf)
576 (message "Connected to %s" buf)) 630 (message "Connected to %s" buf))
diff --git a/lisp/+circe.el b/lisp/+circe.el index 9078907..501bd21 100644 --- a/lisp/+circe.el +++ b/lisp/+circe.el
@@ -66,9 +66,21 @@ message the current topic."
66 66
67;;; Formatting messages 67;;; Formatting messages
68 68
69(defun +circe-format-meta (string) 69(defun +circe-format-meta (string &optional no-nick)
70 "Return a format string for `lui-format' for metadata messages." 70 "Return a format string for `lui-format' for metadata messages.
71 (format "{nick:%1$d.%1$ds} *** %s" (- +circe-left-margin 3) string)) 71Include nick unless NO-NICK is non-nil. If NO-NICK is a string,
72replace {nick} in the string with {NO-NICK}."
73 (cond
74 ((stringp no-nick)
75 (format "{%1$s:%2$d.%2$ds} *** %3$s"
76 no-nick (- +circe-left-margin 3) string))
77 (no-nick
78 (format (format "%%%ds *** %s" (- +circe-left-margin 3) string) " "))
79 (t
80 (format "{nick:%1$d.%1$ds} *** %s" (- +circe-left-margin 3) string))))
81
82(defun +circe-format-meta* (string)
83 "Return a format string for `lui-format' for metadata messages, /without/ ")
72 84
73(defmacro +lui-make-formatting-list-rx (char) 85(defmacro +lui-make-formatting-list-rx (char)
74 "Make a formatting regex for CHAR delimiters. 86 "Make a formatting regex for CHAR delimiters.