Consistency refactor
For consistency with other app modules: + Refactor out s.el dependency + Reorder variables (public then private) + Use add-hook! instead of add-hook+lambda + Optimization: replace mapcar+closure with cl-loop (reduces allocations) + Replace evil-set-initial-state with (set! :evil-state ...), which is ignored if :feature evil is disabled.
This commit is contained in:
parent
128fe0466c
commit
d2b514e1ba
2 changed files with 34 additions and 22 deletions
|
@ -12,7 +12,6 @@
|
||||||
(interactive)
|
(interactive)
|
||||||
;; force a library load for +irc--accounts
|
;; force a library load for +irc--accounts
|
||||||
(circe--version)
|
(circe--version)
|
||||||
(mapcar (lambda (network)
|
(cl-loop for network in +irc--accounts
|
||||||
(circe (car network)))
|
collect (circe (car network))))
|
||||||
+irc--accounts))
|
|
||||||
|
|
||||||
|
|
|
@ -4,7 +4,20 @@
|
||||||
;; Config
|
;; Config
|
||||||
;;
|
;;
|
||||||
|
|
||||||
(defvar +irc--accounts nil)
|
(defvar +irc-left-padding 13
|
||||||
|
"TODO")
|
||||||
|
|
||||||
|
(defvar +irc-disconnect-hook nil
|
||||||
|
"TODO")
|
||||||
|
|
||||||
|
(defvar +irc-bot-list '("fsbot" "rudybot")
|
||||||
|
"TODO")
|
||||||
|
|
||||||
|
(defvar +irc-time-stamp-format "%H:%M"
|
||||||
|
"TODO")
|
||||||
|
|
||||||
|
(defvar +irc-notifications-watch-strings nil
|
||||||
|
"TODO")
|
||||||
|
|
||||||
(def-setting! :irc (server letvars)
|
(def-setting! :irc (server letvars)
|
||||||
"Registers an irc server for circe."
|
"Registers an irc server for circe."
|
||||||
|
@ -12,15 +25,8 @@
|
||||||
(push ',(cons server letvars) +irc--accounts)
|
(push ',(cons server letvars) +irc--accounts)
|
||||||
(push ',(cons server letvars) circe-network-options)))
|
(push ',(cons server letvars) circe-network-options)))
|
||||||
|
|
||||||
(defvar +irc-left-padding 13)
|
(defvar +irc--accounts nil)
|
||||||
|
|
||||||
(defvar +irc-disconnect-hook nil)
|
|
||||||
|
|
||||||
(defvar +irc-bot-list '("fsbot" "rudybot"))
|
|
||||||
|
|
||||||
(defvar +irc-time-stamp-format "%H:%M")
|
|
||||||
|
|
||||||
(defvar +irc-notifications-watch-strings nil)
|
|
||||||
|
|
||||||
;;
|
;;
|
||||||
;; Plugins
|
;; Plugins
|
||||||
|
@ -32,9 +38,10 @@
|
||||||
:init
|
:init
|
||||||
(setq circe-network-defaults nil)
|
(setq circe-network-defaults nil)
|
||||||
:config
|
:config
|
||||||
(evil-set-initial-state 'circe-channel-mode 'emacs)
|
(set! :evil-state 'circe-channel-mode 'emacs)
|
||||||
|
|
||||||
(defun +irc|circe-format-padding (left right)
|
(defun +irc|circe-format-padding (left right)
|
||||||
(s-concat (s-pad-left +irc-left-padding " " left) " │ " right))
|
(format (format "%%%ds | %%s" +irc-left-padding) left right))
|
||||||
|
|
||||||
(setq circe-use-cycle-completion t
|
(setq circe-use-cycle-completion t
|
||||||
circe-reduce-lurker-spam t
|
circe-reduce-lurker-spam t
|
||||||
|
@ -98,7 +105,8 @@ to determine length."
|
||||||
(run-hooks '+irc-disconnect-hook))
|
(run-hooks '+irc-disconnect-hook))
|
||||||
(advice-add 'circe--irc-conn-disconnected :after #'+irc*circe-disconnect-hook)
|
(advice-add 'circe--irc-conn-disconnected :after #'+irc*circe-disconnect-hook)
|
||||||
|
|
||||||
(add-hook '+irc-disconnect-hook (λ! (run-at-time "5 minute" nil #'circe-reconnect-all)))
|
(add-hook! '+irc-disconnect-hook
|
||||||
|
(run-at-time "5 minute" nil #'circe-reconnect-all))
|
||||||
|
|
||||||
(defun +irc|circe-message-option-bot (nick &rest ignored)
|
(defun +irc|circe-message-option-bot (nick &rest ignored)
|
||||||
(when (member nick +irc-bot-list)
|
(when (member nick +irc-bot-list)
|
||||||
|
@ -107,12 +115,12 @@ to determine length."
|
||||||
(add-hook 'circe-message-option-functions #'+irc|circe-message-option-bot)
|
(add-hook 'circe-message-option-functions #'+irc|circe-message-option-bot)
|
||||||
|
|
||||||
(enable-circe-new-day-notifier)
|
(enable-circe-new-day-notifier)
|
||||||
(add-hook 'circe-server-connected-hook
|
(add-hook! 'circe-server-connected-hook
|
||||||
(λ! (run-at-time "5 minutes" nil #'enable-circe-notifications)))
|
(run-at-time "5 minutes" nil #'enable-circe-notifications))
|
||||||
|
|
||||||
|
(add-hook! 'circe-channel-mode-hook
|
||||||
|
#'(enable-circe-color-nicks enable-lui-autopaste turn-on-visual-line-mode)))
|
||||||
|
|
||||||
(add-hook! 'circe-channel-mode-hook '(enable-circe-color-nicks
|
|
||||||
enable-lui-autopaste
|
|
||||||
turn-on-visual-line-mode)))
|
|
||||||
|
|
||||||
(def-package! circe-color-nicks
|
(def-package! circe-color-nicks
|
||||||
:commands enable-circe-color-nicks
|
:commands enable-circe-color-nicks
|
||||||
|
@ -120,6 +128,7 @@ to determine length."
|
||||||
(setq circe-color-nicks-min-constrast-ratio 4.5
|
(setq circe-color-nicks-min-constrast-ratio 4.5
|
||||||
circe-color-nicks-everywhere t))
|
circe-color-nicks-everywhere t))
|
||||||
|
|
||||||
|
|
||||||
(def-package! circe-new-day-notifier
|
(def-package! circe-new-day-notifier
|
||||||
:commands enable-circe-new-day-notifier
|
:commands enable-circe-new-day-notifier
|
||||||
:config (setq circe-new-day-notifier-format-message
|
:config (setq circe-new-day-notifier-format-message
|
||||||
|
@ -127,16 +136,18 @@ to determine length."
|
||||||
"*** Day"
|
"*** Day"
|
||||||
"Date changed [{day}]")))
|
"Date changed [{day}]")))
|
||||||
|
|
||||||
|
|
||||||
(def-package! circe-notifications
|
(def-package! circe-notifications
|
||||||
:commands enable-circe-notifications
|
:commands enable-circe-notifications
|
||||||
:config (setq circe-notifications-watch-strings
|
:config (setq circe-notifications-watch-strings
|
||||||
+irc-notifications-watch-strings))
|
+irc-notifications-watch-strings))
|
||||||
|
|
||||||
|
|
||||||
(def-package! lui
|
(def-package! lui
|
||||||
:commands lui-mode
|
:commands lui-mode
|
||||||
:bind ((:lui-mode-map
|
|
||||||
("C-u" . lui-kill-to-beginning-of-line)))
|
|
||||||
:config
|
:config
|
||||||
|
(map! :map lua-mode-map "C-u" #'lui-kill-to-beginning-of-line)
|
||||||
|
|
||||||
(enable-lui-logging)
|
(enable-lui-logging)
|
||||||
(defun +irc|lui-setup-margin ()
|
(defun +irc|lui-setup-margin ()
|
||||||
(setq lui-time-stamp-position 'right-margin
|
(setq lui-time-stamp-position 'right-margin
|
||||||
|
@ -151,8 +162,10 @@ to determine length."
|
||||||
(setq lui-flyspell-p t
|
(setq lui-flyspell-p t
|
||||||
lui-fill-type nil)))
|
lui-fill-type nil)))
|
||||||
|
|
||||||
|
|
||||||
(def-package! lui-autopaste
|
(def-package! lui-autopaste
|
||||||
:commands enable-lui-autopaste)
|
:commands enable-lui-autopaste)
|
||||||
|
|
||||||
|
|
||||||
(def-package! lui-logging
|
(def-package! lui-logging
|
||||||
:commands enable-lui-logging)
|
:commands enable-lui-logging)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue