From ec3f02ce0ff4e9fa24d924738a86a62a373394a9 Mon Sep 17 00:00:00 2001 From: Miquel Sabaté Solà Date: Thu, 2 Feb 2017 17:31:04 +0100 Subject: emacs: fixed some issues on ERC and added WoMan MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Miquel Sabaté Solà --- emacs/init.html | 141 ++++++++++++++++++++++++++++++++++++-------------------- 1 file changed, 92 insertions(+), 49 deletions(-) (limited to 'emacs/init.html') diff --git a/emacs/init.html b/emacs/init.html index 10cfed1..ee04228 100644 --- a/emacs/init.html +++ b/emacs/init.html @@ -4,7 +4,7 @@ mssola's GNU Emacs configuration - + @@ -183,9 +183,10 @@ for the JavaScript code in this tag.
  • IRC
  • Languages
  • -
  • Misc
  • -
  • Credits
  • -
  • License
  • +
  • WoMan
  • +
  • Misc
  • +
  • Credits
  • +
  • License
  • @@ -821,22 +822,21 @@ buffers.
    -
    (defun erc-helm-buffer-list ()
    +
    (defun mssola-erc-helm-buffer-list ()
       "Returns a list with the ERC buffers."
       (mapcar 'buffer-name (erc-buffer-list)))
     
    -(setq helm-source-erc-channel-list
    +(setq mssola-helm-source-erc-channel-list
           '((name . "ERC Channels")
    -        (candidates . erc-helm-buffer-list)
    -        (action . helm-switch-to-buffer)))
    +        (candidates . mssola-erc-helm-buffer-list)
    +        (action . switch-to-buffer)))
     
    -(defun erc-helm-switch-buffer ()
    -  "Use helm to select an active ERC buffer.  Replaces erc-iswitchb, which
    -doesn't work for me."
    +(defun mssola-erc-helm-switch-buffer ()
    +  "Use helm to select an active ERC buffer."
     
       (interactive)
     
    -  (helm :sources '(helm-source-erc-channel-list)
    +  (helm :sources '(mssola-helm-source-erc-channel-list)
             :buffer "*helm-erc-channels*"))
     
     (defun mssola-find-file ()
    @@ -845,7 +845,7 @@ buffers.
       (interactive)
     
       (if (string= major-mode "erc-mode")
    -      (erc-helm-switch-buffer)
    +      (mssola-erc-helm-switch-buffer)
         (condition-case nil
             (helm-projectile-find-file)
           (error
    @@ -2041,71 +2041,67 @@ I'm giving ERC a chance. First of all, I'm setting up basic stuff.
     
       (erc-track-mode t)
     
    -  (setq erc-hide-list '("PART" "QUIT" "JOIN")
    +  (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 130
    +        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-timestamp-format "%s "
    -        erc-hide-timestamps t
    +        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-log-channels-directory "~/.emacs.d/erc/"
             erc-enable-logging t
             erc-query-on-unjoined-chan-privmsg t)
     
       (setq erc-autojoin-channels-alist
    -        '(("*.freenode.net" "#gnu" "#emacs")
    -          ("*.suse.de" "#suse" "#docker")))
    +        '(("irc.freenode.net" "#gnu" "#emacs")
    +          ("irc.suse.de" "#suse" "#docker")))
     

    -I want to have a desktop notification whenever someone mentions my name. +Use the erc-hl-nicks package, so highlight support for nicknames is better.

    -
    (require 'notifications)
    -
    -(defun erc-global-notify (match-type nick message)
    -  "Notify when a message is recieved."
    -
    -  (when (eq match-type 'current-nick)
    -    (notifications-notify
    -     :title nick
    -     :body message
    -     :app-icon (concat
    -                "/usr/share/emacs/"
    -                (format "%s.%s" emacs-major-version emacs-minor-version)
    -                "/etc/images/icons/hicolor/24x24/apps/emacs.png")
    -     :urgency 'low)))
    -
    -(when (boundp 'dbus-compiled-version)
    -  (add-hook 'erc-text-matched-hook 'erc-global-notify))
    +
    (use-package erc-hl-nicks
    +  :ensure t
    +  :init
    +  (with-eval-after-load 'erc
    +    (add-to-list 'erc-modules 'hl-nicks)))
     

    -Use the erc-hl-nicks package, so highlight support for nicknames is better. +I want to have a desktop notification whenever someone mentions my name. For +this, I'm using the erc-notifications package which is built in ERC since +GNU Emacs 24.3.

    -
    (use-package erc-hl-nicks
    -  :ensure t)
    +
    (with-eval-after-load 'erc
    +  (setq erc-notifications-icon
    +        (concat
    +         "/usr/share/emacs/"
    +         (format "%s.%s" emacs-major-version emacs-minor-version)
    +         "/etc/images/icons/hicolor/24x24/apps/emacs.png"))
    +  (add-to-list 'erc-modules 'notifications))
     
    @@ -2140,6 +2136,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. +

    + +
    + +
    (add-hook 'erc-mode-hook
    +          (lambda () (auto-fill-mode 0)))
    +
    +
    +

    And now define a function to connect to both IRC servers.

    @@ -2449,9 +2457,44 @@ criteria really).
    -

    Misc

    +

    WoMan

    +WoMan is a package that is included inside of GNU Emacs by default, and that +takes care of visualizing man pages. Let's properly setup Evil mode for this: +

    + +
    + +
    (with-eval-after-load "evil"
    +  (evil-set-initial-state 'woman-mode 'normal)
    +  (evil-define-key 'normal woman-mode-map
    +    "J" 'Man-next-section
    +    "K" 'Man-previous-section
    +    "\C-h" 'evil-window-left
    +    "\C-l" 'evil-window-right
    +    "\C-j" 'evil-window-down
    +    "\C-k" 'evil-window-up
    +    "\C-u" 'evil-scroll-up))
    +
    +
    + +

    +Finally, I want man pages to fill all the frame: +

    + +
    + +
    (setq woman-fill-frame t)
    +
    +
    +
    +
    + +
    +

    Misc

    +
    +

    Install a set of useful functions from @bbatsov. The bindings are following Emacs style instead of being more Vim-like on purpose (I don't want to put too many things into my leader and these shortcuts look sensible to me). @@ -2468,9 +2511,9 @@ too many things into my leader and these shortcuts look sensible to me).

    -
    -

    Credits

    -
    +
    +

    Credits

    +

    I've built this file by simply scavenging from other people's emacs.d/dotfiles repositories. I have taken lots of pieces from here and there, but most notably: @@ -2495,9 +2538,9 @@ repositories. I have taken lots of pieces from here and there, but most notably:

    -
    -

    License

    -
    +
    +

    License

    +
    Copyright (C) 2014-2017 Miquel Sabaté Solà <mikisabate@gmail.com>
    @@ -2521,7 +2564,7 @@ along with this program.  If not, see <
     
    -- cgit v1.2.3