Posts tagged "emacs":
eww to org
Here's a quick'n'dirty command to generate an org-mode
rendering of an eww
page, taking into account not only links (as the built-in
org-eww-copy-for-org-mode
does), but also headings, italic and bold faces.
inline snippets and grouping in consult-recoll
I've just released a new version of consult-recoll, which implements a couple of features that i am really liking, namely, grouping of search results by mime type:
and inline snippets:
Happy searches!
consult recoll with live preview
Lately, i've gravitated towards recoll as a unified search engine for all my local data, including org and text notes, documents in PDF or similar formats, HTML files, and local email. As a result, my little consult-recoll package has gone up a few notches up in my list. i've just released version 0.5, featuring live previews.
more ...simple note taking
I was just watching Prot's explanation of his new package denote, a very elegant note-taking system with a stress on simplicity and, as the author puts it, low-tech requirements. Now, those are excellent qualities in my book, and i think i'd quickly become a denote user if it weren't for the fact that i already have a homegrown set of utilities following a similar philosophy. Inevitably, they differ in some details, as is to be expected from software that has grown with me, as Prot's with him, during more than a decade, but they are similar in important ways.
I've had in mind writing a brief note on my notes utilities for a while, so i guess this is a good time for it: i can, after showing you mine, point you to a polished package following a similar philosophy and sidestep any temptation of doing anything similar with my little functions :)
more ...slimmer emacs with kitty
A problem of using Emacs as my operating system is that any otherwise minor friction with its interface quickly becomes an irritant, and i thus find myself needed a truly smooth emacs-human interaction; or, to be more precise emacs-jao interaction: my must needs are going to be, sometimes, triffles to you, and the other way round.
During the last year, a perceived sluggishness in Emacs's X11 display performance, together with a very noticeably increased RAM consumption have become one of those irritants, and i decided that enough is enough, and moved (for the time being at least) from exwm to, essentially, using xmonad and kitty as my Emacs's display engine.
more ...a high signal to noise emacs command
Over the years, i've written perhaps hundreds of little emacs commands. Most of them looked useful at the time (why, i absolutely needed them!), but just faded away after a few weeks. There are a handful though that i use all the time, and i specially like it when their signal (features, usefulness) to noise (lines of code) ratio is above average. Here's one with a surprisingly high one:
(defun jao-buffer-same-mode (&rest modes) "Pop to a buffer with a mode among MODES, or the current one if not given." (interactive) (let* ((modes (or modes (list major-mode))) (pred (lambda (b) (let ((b (get-buffer (if (consp b) (car b) b)))) (member (buffer-local-value 'major-mode b) modes))))) (pop-to-buffer (read-buffer "Buffer: " nil t pred))))
apropos library
A gem introduced in emacs 23 that i've overlooked all these years:
M-x apropos-library
notmuch threads folding in emacs
In the last couple of months, i've been moving from Gnus (after more than twenty years using it!) to notmuch, as part of a simplification journey (simpler code means a more hackable (emacs) environment) and also because tagging finally clicked-in (but don't believe anyone telling you that notmuch is only about tagging, it allows search and folder-based workflows just as nicely). Naturally, i've found several things i liked in Gnus's interface missing in notmuch's, but the simplicity of the latter has made possible implementing most of them, sometimes with remarkably little code. One of them is thread folding.
more ...fun with dependent types
more ...reading and searching gmane with gnus, fast
Reading mailing lists via Gnus by pointing it to the usenet service news.gmane.io is a well-known trick among emacsers. It has a couple of drawbacks, though: network latency and no search. The two problems have, as almost always with almost any problem in Emacs land, a cure. The names of the game are, in this case, leafnode and notmuch.
more ...reading source code is fun
From a recent checkout of the Emacs source code:
;;; desktop.el --- save partial status of Emacs when killed -*- lexical-binding: t -*- ;; Copyright (C) 1993-1995, 1997, 2000-2021 Free Software Foundation, ;; Inc. ;; Author: Morten Welinder <terra@diku.dk> ;; Keywords: convenience ;; Favorite-brand-of-beer: None, I hate beer. ;; This file is part of GNU Emacs.
Mine is Guinness :)
notmuch queries via consult
This package provides notmuch queries in emacs using consult. It offers interactive functions to launch search processes using the notmuch executable and present their results in a completion minibuffer and, after selection of a candidate, single message and tree views.
more ...simplicity pays off
i've been using Bastian Bechtold's org-static-blog for this blog for more than a year now. Back in the day, i mentioned how well it integrated with my emacs workflow and how its simplicity was a big asset1.
more ...consulting hunks
I use Dmitry Gutov's diff-hl to highlight (with fringe marks) modified
hunks in my files under git revision control. The package comes with
a command, diff-hl-next-hunk
, that one can use to navigate them. So,
taking a peek at consult-lines
, it was straightforward to put together
a consult function to navigate, with completion and preview (although
i disable the latter) the hunks in the current file:
consulting spotify in a better way
After my latest adventures writing a small spotify library and learning in the process a bit more about consult, its author, Daniel Mendler, was kind enough to comment on how i had implemented the asynchronous search using consult's API, showing me better ways.
more ...an emacs packages hat trick
i've found these last days a handful of really useful little emacs packages:
more ...an even better video wharf
A couple of days ago, i was writing about embark and my first experiment defining a new embarking to play remote video streams. Omar AntolĂn Camarena, embark's author, has been kind enough to not only read it, but comment on a couple of significant improvements that i think well deserve this follow-up.
more ...embarking videos
Inspired by Prot's musings on completion, i've, ahem, embarked in a reconsideration of my completions setup (as you might have intuited from my recent experiments with the spotify API and consult). As it happens, i'm starting to feel quite at home with a combination of selectrum, prescient and consult, and the ideas to augment what i have with contextual actions using embark seem really natural to me.
more ...consulting spotify
Note: you can tangle this file (e.g., with C-c C-v t
inside Emacs)
into three elisp packages, namely espotify.el, consult-spotify.el, and
ivy-spotify.el.
what's not to like
I've just discovered Codeberg, a code hosting site that, finally, has let me create a user with plain emacs-w3m, shows me content reasonably well there, with a refreshingly uncluttered layout, handles graciously org files (why, it's even generating a table of contents for me), has a good privacy policy, it's not under the wings of any corporation and had my preferred username free for grabs.
more ...the mode lines i have not seen
i don't dislike emacs' mode line, i just wish (possibly out of a fetish for simplicity and minimalistic user interfaces) sometimes it wasn't there.
more ...unlearn
For years, i've been using C-x p
, C-x o
and C-c <n>
to move to other
windows, but with ace window i am substituting all of them with M-o
.
Problem is, muscle memory interferes and i find myself clumsily moving
around (and often lost) with the former ones. Or i did, before i
followed an advice from Stefan Monnier in emacs-devel: unbind those
keys you want to forget, and you'll get an error when you relapse.
ace window
As i've mentioned in a previous post, i organise my emacs sessions in
workspaces, a.k.a. frames, a.k.a. a thematic tiling of windows. It is
therefore important to have quick ways of jumping from a window to
another. Until very recently, i used a home-cooked collection of
shortcuts (C-c 1
, C-c 2
… C-c n
) that would move my point to the nth
window in the workspace (i trained myself to count them quick enough,
i suppose), and used that together with the stock C-x o
and with C-x p
bound to (other-window -1)
, for something similar to "previous
window", to move around. But i've discovered a better way.
a gnus enters a side-bar
i typically organize my computing sessions around workspaces, which in emacs are simply glorified default window configurations, sometimes in a one-to-one relationship with emacs frames1. That's specially natural if you use exwm, where there's a concept of workspace essentially equivalent to emacs frame. So here too i'll have a "coding" workspace with programming buffers, a "browsing" one inhabited by emacs-w3m buffers in a two-pane layout, an "X" for the few non-emacs applications i use, and one devoted to "email/calendar/agenda", where Gnus plays a central role.
more ...transient
Emacs being, essentially, my operating system and window manager, i've had since i remember a set of keybinding maps grouped by functionality (sleep and related operations, media player control, network access, and so on), whereby every group of commands starts with the same prefix. E.g., all my commands controlling media have a keybinding starting with `C-c m`. Nothing earthshaking, and pretty common. Recently, the transient library has made my life easier in this department.
more ...literate programming
I got started with literate programming many years ago, out of admiration for almost everything else i knew done by Donal Knuth, and tried my hand at it in some toyish projects in OCaml and Scheme. So it wasn't without lack of enthusiasm that i plunged into the literate world.
more ...signel, a barebones signal chat on top of signal-cli
Unlike most chat systems in common use, Signal lacks a decent emacs client. All i could find was signal-msg, which is able only to send messages and has a readme that explicitly warns that its is not a chat application. Skimming over signal-msg's code i learnt about signal-cli, a java-based daemon that knows how to send and receive signal messages, and how to link to a nearby phone, or register new users. And playing with it i saw that it can output its activities formatted as JSON, and that offers (when run in daemon mode) a DBUS service that can be used to send messages.
more ...simplicity
I like simple things. As simple as possible, but not simpler: they should live well in my little emacs universe. Bastian Bechtold's org-static-blog, a static site generator using org-mode, is the latest star in that virtual world.
more ...emacs tip: tweeting from emacs-w3m
To follow twitter, i connect to a local Bitlbee server via emacs, using the Circe IRC client, and i browse the web using emacs-w3m.
more ...record, play, re-play in emacs
Gentle reader Marc Donner has sent me an email sharing one of his favorite emacs hacks:
more ...eval and replace anywhere
Being a living Elisp virtual machine, Emacs naturally provides the
ability to evaluate any Elisp expression anywhere. Just put the cursor
right after the expression to be evaluated and press C-xC-e
: the
result appears in the mini-buffer. I use this continuously, for
instance while reading about a variable to know its value. For
instance, imagine i see this line in one of my files:
editing your file names
In my experience, dired is one of the most underused modes of Emacs. Just C-xC-f to any directory in your hard disk and you'll be presented with a list of its files and directories. One can browse this list, and execute all kinds of commands and transformations on them. If you've never done that before, just give it a try, and look at the menubar for a list of nifty things you can do inside dired. There're several ways to mark files and operate on them afterwards: for instance, just type A to find inside the selected files any regexp, or Q to search and substitute.
more ...the ghost in the lisp machine
A friend of mine uses to say that Emacs fills our yearning for a Lisp Machine. I tend to agree with him: Emacs is not just an editor, but a full integrated environment where you can perform virtually any imaginable task; and, most importantly, the inner workings of the system are open to you to explore and extend. Using, for extra fun, Lisp. No, i don't think that Elisp is the nicest Lisp incarnation around, but is far better than, say, C, and i still prefer it to other scripting languages. Moreover, the awesome range of libraries at your disposal makes up for many of the deficiencies in the language.
more ...