💾 Archived View for jan.bio › glog › 20200725-re-emacs-everything.gmi captured on 2023-09-08 at 16:07:15. Gemini links have been rewritten to link to archived content

View Raw

More Information

⬅️ Previous capture (2020-09-24)

-=-=-=-=-=-=-

An answer to kensanata's post "Emacs everything"

Kensanata posted about his use of emacs "for everything". I thought this was a great idea, so here is a summary of what I use emacs for and how.

First of all, I use evil mode. As a former vim user, I was never able to get my head around emacs navigation, and evil mode solved this problem for me. For some modes, however, I've deactivated evil mode to be able to access the original keyboard shortcuts (e.g. for EMMS, mu4e, elfeed, etc. See below).

Mail

For email I use mu4e. Mu4e comes with a command line utility called "mu" which is used for indexing and searching mails. Fetching mails is not part of mu, it just expects a maildir directory. So I use offlineimap to fetch mails from my fastmail account. The configuration is a bit more complicated, so refer to [1] for details.

Newsreader

For reading news, I use elfeed [2]. The configuration is quite simple, I just set up a list over feeds I want to follow, including some tags:

(setq elfeed-feeds
  '(("http://nullprogram.com/feed/" blog emacs)
    ("http://endlessparentheses.com/atom.xml" blog emacs)
    ...)
(global-set-key (kbd "C-x w") 'elfeed)
(add-to-list 'evil-emacs-state-modes 'elfeed-search-mode)
(add-to-list 'evil-emacs-state-modes 'elfeed-show-mode)

Gopher/Gemini

Occasionally, I use elpher for this, but I'm a bit biased, so most gopher and gemini browsing is done with ncgopher [3], a client I wrote in Rust.

Ace-Jump

The past years I had some (read: a lot) of trouble with repetitive strain injury. Ace mode lets me navigate quickly within the visible text. I've set up two simple shortcuts for ace:

(autoload 'ace-jump-mode "ace-jump-mode"
 "Emacs quick move minor mode" t)
(define-key global-map (kbd "C-c SPC") 'ace-jump-line-mode)
(define-key evil-normal-state-map (kbd "SPC") 'ace-jump-mode)

Tramp

At work, I do a lot of remote editing. Tramp provides an easy solution for this, and lets me edit my files in my local emacs instance. I also like the combination with eshell, which lets me open a shell on the remote server.

(require 'tramp)
(setenv "SHELL" "/bin/bash")
(setq tramp-default-user "jans")

External documentation

Whenever I want to look up something in external documentation, for like pyhton, php, rust or whatever, I use zeal. zeal-at-point [4] provides an easy way to find the documentation for a function under the cursor:

(autoload 'zeal-at-point "zeal-at-point"
 "Search the word at point with Zeal." t nil)
(global-set-key "\C-cd" 'zeal-at-point)
(global-set-key "\C-ce" 'zeal-at-point-with-docset)

Working from the command line

Sometimes I'd like to open a file from my shell in emacs. A collegue showed me a simple alias to do this:

alias e='emacsclient --no-wait'

This lets me open a file in emacs with `e FILENAME` from the command line.

Org-mode

Org mode, for me, is the killer feature of emacs. Without it, I'd probably switch back to vim. I can easily take notes, create todos, meeting summaries, journal entries or make phone call notes by hitting C-c c, and return to what I was doing before. I also keep a wiki-like collection of notes in org-mode. My home page is also written in org-mode. These files are converted to markdown with ox-hugo, which, again, calls zola [5], a static site generator written in Rust.

My complete org-mode configuration is too long to post here, but refer to [1] for the full configuration.

EMMS

Kensanata's post made me reconsider emms for playing music. Before that, I used mostly cmus [6] to play music, but I switched to MPD [7], which provides several clients. EMMS is one of them, and I have to say that I like it quite a lot so far. It's easy to browse my music collection and select albums to play.

(require 'emms)
(require 'emms-setup)
(require 'emms-player-mpd)
(require 'emms-librefm-scrobbler)
(require 'emms-info-libtag)
(require 'emms-lyrics)
(require 'emms-volume)

(setq emms-info-functions '(emms-info-libtag))
(emms-lyrics 1)
(emms-librefm-scrobbler-enable)
(setq emms-volume-change-function 'emms-volume-mpd-change)

(emms-all) ; don't change this to values you see on stackoverflow questions if you expect emms to work
(setq emms-seek-seconds 5)
(setq emms-player-list '(emms-player-mpd))
(setq emms-info-functions '(emms-info-mpd))
(setq emms-player-mpd-server-name "localhost")
(setq emms-player-mpd-server-port "6600")
(global-set-key (kbd "s-m p") 'emms)
(global-set-key (kbd "s-m b") 'emms-smart-browse)
(global-set-key (kbd "s-m r") 'emms-player-mpd-update-all-reset-cache)
(global-set-key (kbd "C-c +") 'emms-volume-mode-plus)
(global-set-key (kbd "C-c -") 'emms-volume-mode-minus)
(define-key mode-specific-map (kbd "e s") 'emms-smart-browse)

(add-to-list 'evil-emacs-state-modes 'emms-browser-mode)
(add-to-list 'evil-emacs-state-modes 'emms-playlist-mode)

[1] https://github.com/jansc/dotfiles

[2] https://github.com/skeeto/elfeed

[3] https://github.com/jansc/ncgopher

[4] https://github.com/jinzhu/zeal-at-point

[5] https://getzola.com

[6] https://cmus.github.io

[7] https://www.musicpd.org