Skip to content

Instantly share code, notes, and snippets.

@sergeyklay
Created August 9, 2024 17:44
Show Gist options
  • Save sergeyklay/49ff7a30b21bf44b68ee004ae3562e0c to your computer and use it in GitHub Desktop.
Save sergeyklay/49ff7a30b21bf44b68ee004ae3562e0c to your computer and use it in GitHub Desktop.
diff --git a/init.el b/init.el
index c431854..014d90c 100644
--- a/init.el
+++ b/init.el
@@ -284,7 +284,6 @@ Set DEBUG=1 in the command line or use --debug-init to enable this.")
;;;; Project management
(use-package project
- :defer t
:commands (project-find-file
project-switch-to-buffer
project-switch-project
@@ -331,6 +330,28 @@ buffers related to your current project."
(project-list-buffers t)
(pop-to-buffer "*Buffer List*")))
+;;;; Security
+(use-package epg
+ :custom
+ (epg-gpg-program "gpg"))
+
+(use-package epa
+ :after epg
+ :init
+ ;; For more see "man 1 gpg" for the option "--pinentry-mode"
+ (unless (eq (window-system) 'w32)
+ (custom-set-variables '(epg-pinentry-mode 'loopback)))
+ :config
+ ;; Enable automatic encryption/decryption of *.gpg files
+ (unless (memq epa-file-handler file-name-handler-alist)
+ (epa-file-enable)))
+
+(use-package auth-source
+ :custom
+ (auth-sources
+ `(,(concat user-emacs-directory ".authinfo.gpg")
+ "~/.authinfo" "~/.authinfo.gpg")))
+
;;;; VCS
(use-package git-modes
:ensure t
@@ -344,6 +365,69 @@ buffers related to your current project."
:commands (magit magit-status)
:bind (("C-x g" . magit-status)))
+;;;; IRC and other communication
+(use-package erc
+ :after auth-source
+ :commands (erc erc-tls)
+ :custom
+ (erc-autojoin-channels-alist
+ '(("irc.libera.chat" "#emacs")))
+ (erc-nick "serghei")
+ (erc-try-new-nick-p t)
+ (erc-nick-uniquifier "_")
+ (erc-autojoin-timing 'ident)
+ (erc-fill-function 'erc-fill-static)
+ (erc-fill-static-center 22)
+ (erc-track-exclude-types '("JOIN" "MODE" "NICK" "PART" "QUIT"
+ "324" "329" "332" "333" "353" "477"))
+ (erc-hide-list '("JOIN" "PART" "QUIT"))
+ (erc-lurker-hide-list '("JOIN" "PART" "QUIT"))
+ (erc-lurker-threshold-time 43200)
+ (erc-prompt-for-nickserv-password nil)
+ (erc-use-auth-source-for-nickserv-password t)
+ (erc-prompt-for-password nil)
+ (erc-server-reconnect-attempts 6)
+ (erc-server-reconnect-timeout 3)
+ :config
+ (dolist (module '(spelling log))
+ (add-to-list 'erc-modules module))
+
+ (defconst erc-logging-directory
+ (concat user-emacs-directory "logs/erc/"))
+
+ (defun my/erc-logging-hook ()
+ "Setting up channel logging for `erc'."
+ (eval-when-compile (require 'erc-log nil t))
+ (custom-set-variables
+ '(erc-log-channels-directory erc-logging-directory)
+ '(erc-log-insert-log-on-open t)
+ '(erc-save-buffer-on-part nil)
+ '(erc-save-queries-on-quit nil)
+ '(erc-log-write-after-insert t)
+ '(erc-log-write-after-send t))
+ (unless (file-exists-p erc-logging-directory)
+ (make-directory erc-logging-directory t)))
+ :hook
+ (erc-mode . my/erc-logging-hook))
+
+(use-package erc-hl-nicks
+ :ensure t
+ :after erc)
+
+(declare-function erc-track-switch-buffer (arg))
+(declare-function erc-update-modules ())
+
+(defun my/erc-start-or-switch ()
+ "Connects to ERC, or switch to last active buffer."
+ (interactive)
+ (if (get-buffer "irc.liberia.chat")
+ (erc-track-switch-buffer 1)
+ (when (y-or-n-p "Start ERC? ")
+ (progn
+ (erc-services-mode 1)
+ (erc-update-modules)
+ (erc :server "irc.libera.chat" :port 6667)))))
+
;;;; Programming Languages, Markup and Configurations
(use-package css-mode
:mode "\\.css$"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment