Re: Emacs everything | |
juli 25th, 2020 | |
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). | |
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. | |
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) | |
``` | |
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. | |
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) | |
``` | |
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) | |
(eval-after-load 'tramp '(setenv "SHELL" "/bin/bash")) | |
(setq tramp-default-user "jans") | |
``` | |
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) | |
``` | |
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, 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. | |
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) | |
(setq emms-seek-seconds 5) | |
(setq emms-player-list '(emms-player-mpd)) | |
h: cannot create [2]: Permission denied | |
h: cannot create [3]: Permission denied | |
h: cannot create [4]: Permission denied | |
h: cannot create [5]: Permission denied | |
h: cannot create [6]: Permission denied | |
h: cannot create [7]: Permission denied | |
(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) | |
``` | |
Back | |
______________________________________________________________________________ | |
Gophered by Gophernicus/3.0.1 on FreeBSD/arm64 14.2 |