From bcabd7921bacffd54296f38fcbaea6dcacafd529 Mon Sep 17 00:00:00 2001 From: Miquel Sabaté Solà Date: Fri, 19 May 2017 09:27:05 +0200 Subject: emacs: fixed logging in ERC MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Miquel Sabaté Solà --- emacs/init.html | 259 ++++++++++++++++++++++++++++++++++++-------------------- 1 file changed, 169 insertions(+), 90 deletions(-) (limited to 'emacs/init.html') diff --git a/emacs/init.html b/emacs/init.html index 5f6fb91..c0b52b3 100644 --- a/emacs/init.html +++ b/emacs/init.html @@ -4,7 +4,7 @@ mssola's GNU Emacs configuration - + @@ -278,6 +278,7 @@ on each change, the following function is provided: +

Introduction

@@ -392,6 +393,41 @@ Use UTF-8 always. (set-language-environment 'utf-8)
+ +

+Some editing tweaks like tabs vs spaces, maximum column width, etc. +

+ +
+ +
;; Emacs modes typically provide a standard means to change the indentation
+;; width (e.g. c-basic-offset). Moreover, even though I prefer tabs over space,
+;; for most coding conventions this is not the case (e.g. ruby). For this
+;; reason, I will disable them by default and enabled them back for each
+;; specific case (e.g. C). I'm also using the smart-tabs-mode package, see
+;; below in the languages section.
+(setq-default indent-tabs-mode nil)
+(setq-default tab-width 4)
+
+;; Maximum 80 columns.
+(setq-default fill-column 80)
+(setq-default auto-fill-function 'do-auto-fill)
+
+;; Do not break lines
+(set-default 'truncate-lines t)
+
+;; Delete the selection with a keypress.
+(delete-selection-mode t)
+
+;; Remove whitespaces at the end of line
+(add-hook 'before-save-hook 'delete-trailing-whitespace)
+
+;; Cursor
+(blink-cursor-mode 0)
+(global-hl-line-mode -1)
+(show-paren-mode 1)
+
+
@@ -778,7 +814,7 @@ require it here on the very top.
-
(use-package diminish
+
(use-package diminish
   :ensure t)
 
@@ -796,7 +832,7 @@ Ayo silver!
-
(use-package ag
+
(use-package ag
   :ensure t
   :config
 
@@ -818,12 +854,12 @@ Then, for keeping up with my projects I use the Projectile + Helm combination.
 
 
-
(use-package projectile
+
(use-package projectile
   :ensure t
   :config
   (projectile-mode 1))
 
-(use-package helm
+(use-package helm
   :ensure t
   :config
   (setq projectile-completion-system 'helm)
@@ -855,10 +891,10 @@ Then, for keeping up with my projects I use the Projectile + Helm combination.
   (define-key helm-map (kbd "C-j") 'helm-next-line)
   (define-key helm-map (kbd "C-k") 'helm-previous-line)
 
-  (use-package helm-ag
+  (use-package helm-ag
     :ensure t))
 
-(use-package helm-projectile
+(use-package helm-projectile
   :ensure t
   :config
   (helm-projectile-on)
@@ -971,10 +1007,10 @@ extension. This works with lots of languages with proper glue code.
 
 
-
(use-package let-alist
+
(use-package let-alist
   :ensure t)
 
-(use-package flycheck
+(use-package flycheck
   :ensure t
   :diminish
   :config
@@ -997,7 +1033,7 @@ with your editor, you have to increase/decrease the fonts. I use the
 
 
-
(use-package default-text-scale
+
(use-package default-text-scale
   :ensure t
   :config
   (global-set-key (kbd "C-+") 'default-text-scale-increase)
@@ -1014,7 +1050,7 @@ supports it).
 
 
-
(use-package rainbow-delimiters
+
(use-package rainbow-delimiters
   :ensure t)
 
@@ -1025,7 +1061,7 @@ I never use the mouse.
-
(use-package disable-mouse
+
(use-package disable-mouse
   :ensure t
   :config
   (global-disable-mouse-mode)
@@ -1041,7 +1077,7 @@ commands for the current chord as a list.
 
 
-
(use-package which-key
+
(use-package which-key
   :ensure t
   :diminish which-key-mode
   :config
@@ -1056,7 +1092,7 @@ this, we have wc-mode.
 
 
-
(use-package wc-mode
+
(use-package wc-mode
   :ensure t)
 
@@ -1068,7 +1104,7 @@ that often, but it's cool to have a distraction-free screen from time to time.
-
(use-package writeroom-mode
+
(use-package writeroom-mode
   :ensure t)
 
@@ -1081,7 +1117,7 @@ most of my uses, it's convenient to have this tool anyways.
-
(use-package expand-region
+
(use-package expand-region
   :ensure t
   :config
 
@@ -1133,7 +1169,7 @@ remember some of these snippets, I've mapped , h to
 
 
-
(use-package yasnippet
+
(use-package yasnippet
   :ensure t
   :diminish yas-minor-mode
   :init (yas-global-mode)
@@ -1293,7 +1329,7 @@ Now make sure that Evil is installed, and call the relevant configuration functi
 
 
-
(use-package evil
+
(use-package evil
   :ensure t
   :config
 
@@ -1323,7 +1359,7 @@ Vim into Evil.
 
 
-
(use-package evil-leader
+
(use-package evil-leader
   :ensure t
   :config
   (global-evil-leader-mode)
@@ -1350,7 +1386,7 @@ having double quotes with single quotes in a single command).
 
 
-
(use-package evil-surround
+
(use-package evil-surround
   :ensure t
   :config
   (global-evil-surround-mode 1))
@@ -1366,7 +1402,7 @@ the current line, regardless of the programming language.
 
 
-
(use-package evil-commentary
+
(use-package evil-commentary
   :ensure t
   :config
   (evil-commentary-mode t))
@@ -1382,7 +1418,7 @@ respectively.
 
 
-
(use-package evil-args
+
(use-package evil-args
   :ensure t
   :config
   ; Configuration taken from the documentation of evil-args.
@@ -1408,7 +1444,7 @@ into Evil: C-a for increasing a number, and
 
 
-
(use-package evil-numbers
+
(use-package evil-numbers
   :ensure t
   :config
   (define-key evil-normal-state-map (kbd "C-a") 'evil-numbers/inc-at-pt)
@@ -1428,7 +1464,7 @@ certainly useful for some common tasks (I guess that I still need some learning)
 
 
-
(use-package magit
+
(use-package magit
   :ensure t
   :config
 
@@ -1482,7 +1518,7 @@ And repair some key bindings from Evil mode.
(with-eval-after-load 'evil-leader
   (evil-leader/set-key "s" 'magit-status)
 
-  (use-package evil-magit
+  (use-package evil-magit
     :ensure t
     :config
 
@@ -1830,7 +1866,7 @@ I want desktop notifications when receiving email.
 
 
-
(use-package mu4e-alert
+
(use-package mu4e-alert
   :ensure t
   :config
 
@@ -1846,7 +1882,7 @@ I want desktop notifications when receiving email.
 
 ; Evil mode in mu4e
 (with-eval-after-load 'evil
-  (use-package evil-mu4e
+  (use-package evil-mu4e
     :ensure t
     :config
 
@@ -1990,7 +2026,7 @@ blocks to be converted into HTML as well, so we can properly colorize it).
 
 
-
(use-package htmlize
+
(use-package htmlize
   :ensure t)
 
@@ -2192,45 +2228,84 @@ Insert a <kbd></kbd> value in org mode. See this IRC

-I'm giving ERC a chance. First of all, I'm setting up basic stuff. +I'm using ERC for IRC.

-
(use-package erc
+
(use-package erc
   :config
+
+
+ +

+First of all, let's add some basic modules. +

+ +
+ +
(dolist (mod '(autojoin track truncate))
+  (add-to-list 'erc-modules mod))
+
+
+ +

+Setting up basic stuff. +

+ +
+ +
(setq erc-hide-list '("PART")
+      erc-prompt (lambda () (concat (buffer-name) ">"))
+      erc-track-exclude-types '("JOIN" "NICK" "PART" "QUIT" "MODE")
+      erc-server-coding-system '(utf-8 . utf-8)
+      erc-kill-buffer-on-part t
+      erc-kill-queries-on-quit t
+      erc-kill-server-buffer-on-quit t
+      erc-fill-column 100
+      erc-fill-prefix ""
+      erc-timestamp-format "[%H:%M] "
+      erc-insert-timestamp-function 'erc-insert-timestamp-left
+      erc-insert-away-timestamp-function 'erc-insert-timestamp-left
+      erc-hide-timestamps nil
+      erc-whowas-on-nosuchnick t
+      erc-public-away-p nil
+      erc-echo-notice-always-hook '(erc-echo-notice-in-minibuffer)
+      erc-auto-set-away nil
+      erc-autoaway-message "%i seconds out..."
+      erc-away-nickname "msabate"
+      erc-enable-logging t
+      erc-query-on-unjoined-chan-privmsg t)
+
+
+ +

+Let's log messages whenever I receive/send them. The other option is to only do +that on /quit or /part, but it's better to be safe than sorry. +

+ +
+ +
(require 'erc-log)
+(erc-log-enable)
+
+(setq erc-log-channels-directory "~/.emacs.d/erc"
+      erc-save-buffer-on-part nil
+      erc-save-queries-on-quit nil
+      erc-log-write-after-send t
+      erc-log-write-after-insert t)
+
+
+ +

+Servers and channels to auto-join. +

+ +
- (erc-track-mode t) - - (setq erc-hide-list '("PART") - erc-prompt (lambda () (concat (buffer-name) ">")) - erc-track-exclude-types '("JOIN" "NICK" "PART" "QUIT" "MODE") - erc-server-coding-system '(utf-8 . utf-8) - erc-kill-buffer-on-part t - erc-kill-queries-on-quit t - erc-kill-server-buffer-on-quit t - erc-fill-column 100 - erc-fill-prefix "" - erc-log-channels t - erc-log-write-after-insert t - erc-log-insert-log-on-open nil - erc-log-channels-directory "~/.emacs.d/erc/" - erc-timestamp-format "[%H:%M] " - erc-insert-timestamp-function 'erc-insert-timestamp-left - erc-insert-away-timestamp-function 'erc-insert-timestamp-left - erc-hide-timestamps nil - erc-whowas-on-nosuchnick t - erc-public-away-p nil - erc-echo-notice-always-hook '(erc-echo-notice-in-minibuffer) - erc-auto-set-away nil - erc-autoaway-message "%i seconds out..." - erc-away-nickname "msabate" - erc-enable-logging t - erc-query-on-unjoined-chan-privmsg t) - - (setq erc-autojoin-channels-alist - '(("irc.freenode.net" "#gnu" "#emacs") - ("irc.suse.de" "#suse" "#docker"))) +
(setq erc-autojoin-channels-alist
+      '(("irc.freenode.net" "#gnu" "#emacs")
+        ("irc.suse.de" "#suse" "#docker")))
 
@@ -2240,7 +2315,7 @@ Use the erc-hl-nicks package, so highlight support for nicknames is
-
(use-package erc-hl-nicks
+
(use-package erc-hl-nicks
   :ensure t
   :init
   (with-eval-after-load 'erc
@@ -2278,14 +2353,18 @@ At this point, we can safely update all the loaded ERC modules.
 

-According to the wiki, auto-fill-mode should be disabled if I'm using -erc-fill-mode. +Start some modules which won't do it by default. Moreover, according to the wiki +auto-fill-mode should be disabled if I'm using erc-fill-mode.

(add-hook 'erc-mode-hook
-          (lambda () (auto-fill-mode 0)))
+          '(lambda ()
+             (erc-track-mode t)
+             (auto-fill-mode -1)
+             (erc-log-mode 1)
+             (erc-autojoin-mode 1)))
 
@@ -2400,7 +2479,7 @@ CMake for y'all.
-
(use-package cmake-mode
+
(use-package cmake-mode
   :ensure t
   :config
 
@@ -2410,7 +2489,7 @@ CMake for y'all.
          '(("\\.cmake\\'" . cmake-mode))
          auto-mode-alist))
 
-  (use-package cmake-font-lock
+  (use-package cmake-font-lock
     :ensure t
     :config
 
@@ -2467,18 +2546,18 @@ And now my Go configuration. This includes stuff like the usage of goimpor
   (flyspell-prog-mode)
 
   ; eldoc support
-  (use-package go-eldoc
+  (use-package go-eldoc
     :ensure t
     :config
     (require 'go-eldoc))
 
-  (use-package go-add-tags
+  (use-package go-add-tags
     :ensure t
     :config
     (evil-leader/set-key "t" 'go-add-tags)))
 
 ;; Go
-(use-package go-mode
+(use-package go-mode
   :ensure t
   :pin melpa-stable
   :config
@@ -2500,7 +2579,7 @@ Install rust-mode and add some hooks to make it friendlier.
 
 
-
(use-package rust-mode
+
(use-package rust-mode
   :ensure t
   :config
 
@@ -2509,7 +2588,7 @@ Install rust-mode and add some hooks to make it friendlier.
                 (when (eq major-mode 'rust-mode)
                   (rust-format-buffer))))
 
-  (use-package flycheck-rust
+  (use-package flycheck-rust
     :ensure t
     :config
 
@@ -2530,7 +2609,7 @@ usings tabs for indentation (C, C++ and Go).
 
 
-
(use-package smart-tabs-mode
+
(use-package smart-tabs-mode
   :ensure t
   :config
   (smart-tabs-add-language-support golang go-mode-hook
@@ -2548,7 +2627,7 @@ usings tabs for indentation (C, C++ and Go).
 
;; Markdown mode with preview mode in the browser.
-(use-package markdown-mode
+(use-package markdown-mode
   :ensure t
   :config
 
@@ -2558,14 +2637,14 @@ usings tabs for indentation (C, C++ and Go).
 
   ; Preview mode does its things through websockets, so it's a requirement.
   ; After that, we can safely require it.
-  (use-package websocket
+  (use-package websocket
     :ensure t
     :config
-    (use-package markdown-preview-mode
+    (use-package markdown-preview-mode
       :ensure t)))
 
 ; YAML
-(use-package yaml-mode
+(use-package yaml-mode
   :ensure t
   :config
 
@@ -2584,17 +2663,17 @@ Slim and SCSS.
 
 
-
(use-package slim-mode
+
(use-package slim-mode
   :ensure t)
 
-(use-package scss-mode
+(use-package scss-mode
   :ensure t
   :config
 
   (setq scss-compile-at-save nil)
   (add-hook 'yaml-mode-hook 'warnings-mode-hook))
 
-(use-package coffee-mode
+(use-package coffee-mode
   :ensure t)
 
@@ -2606,10 +2685,10 @@ bundle of features which are interesting for web-related stuff.
-
(use-package php-mode
+
(use-package php-mode
   :ensure t)
 
-(use-package web-mode
+(use-package web-mode
   :ensure t
   :config
 
@@ -2628,7 +2707,7 @@ bundle of features which are interesting for web-related stuff.
               (setq js-indent-level 2)
               (rainbow-delimiters-mode 1)))
 
-  (use-package vue-mode
+  (use-package vue-mode
     :ensure t
     :config
     (setq mmm-submode-decoration-level 0))
@@ -2655,7 +2734,7 @@ can be frustrating without proper formatting.
 
 
-
(use-package json-reformat
+
(use-package json-reformat
   :ensure t)
 
@@ -2671,7 +2750,7 @@ Highlighting for Dockerfiles.
-
(use-package dockerfile-mode
+
(use-package dockerfile-mode
   :ensure t
   :config
 
@@ -2685,20 +2764,20 @@ Stuff from Hashicorp like terraform and HCL.
 
 
-
(use-package terraform-mode
+
(use-package terraform-mode
   :ensure t
   :config
 
   (terraform-format-on-save-mode))
 
-(use-package hcl-mode
+(use-package hcl-mode
   :ensure t)
 
-
(use-package salt-mode
+
(use-package salt-mode
   :ensure t)
 
@@ -2774,7 +2853,7 @@ too many things into my leader and these shortcuts look sensible to me).
-
(use-package crux
+
(use-package crux
   :ensure t
   :config
 
@@ -2839,7 +2918,7 @@ along with this program.  If not, see <
 
-- cgit v1.2.3