Skip to content

Latest commit

 

History

History
262 lines (196 loc) · 11 KB

README.org

File metadata and controls

262 lines (196 loc) · 11 KB

d12frosted environment / Emacs

Emacs Status Badge

Personal frustration and the biggest time waster in my life (comparable to video games). Please, turn away and retain your sanity. Otherwise you might end up tracking all your tasks, notes, thoughts and wine in Emacs.

Aside from configuring Emacs for my personal needs, this project has several additional design goals in mind.

  1. Byte compilation must succeed without any warnings.
  2. Linter must be happy.
  3. Loading must be fast (less than a second).
  4. Ability to write applications that could be separate packages, but are too personal or too experimental to be worth the effort.
  5. Ability to write and run tests.

In order to achieve these goals, the following approach is used.

  1. All lisp files are divided into 3 categories.
    1. init files that configure built-in and external packages via use-package interface. They must not require (e.g. eagerly load) any packages that should be loaded lazily. All init files are required by main init.el.
    2. config files that contain configuration variables or constants. Safe to require from any place as they do not contribute much into loading time.
    3. lib files that should not be required directly from other files and should be loaded via autoloads file generated during build process. These files are fine to require any packages they need to make byte compiler happy.
  2. All the build process, consisting of bootstrapping, autoloads generation, byte complication, linting, testing and upgrading is managed by Eldev. See Eldev file details.
  3. Life cycle of configurations are install, upgrade and test. They are executed using eru script. Read further for details.
  4. straight.el is used as a package manager instead of package.el or any other system. While being pretty complex, in my opinion it is the most stable and reliable package manager when it comes to installing and upgrading packages.
  5. For better flycheck experience there is flycheck-eldev.
  6. elisp-lint is used for linting, some custom rules applied (for package-lint).
  7. Testing framework of choice is buttercup.

Interesting modules

Section is under construction. Please return in -2147483648 seconds.

Dynamic and fast agenda

At the moment of writing this, I already have more than 10k org files. Most of them do not contain any TODOs. When org-agenda is built, it needs to traverse all these files. So the idea is to build org-agenda-files dynamically before org-agenda is executed by marking files containing TODOs on file change and by using wonderfully fast query capabilities of org-roam. You can read more at d12frosted.io.

Points of interest:

  • lib-vulpea-agenda.el
    • vulpea-agenda-files-update - a function that updates org-agenda-files to contain only files marked with project tag (e.g. containing TODOs).
  • lib-vulpea.el
    • vulpea-project-files - a function to query the list of files marked with project tag (e.g. containing TODOs).
    • vulpea-ensure-filetag - a function that adds or removes project tag from current buffer depending on existence or absence of TODOs.
    • vulpea-setup-buffer and vulpea-pre-save-hook - functions that execute vulpea-ensure-filetag, used as hooks.
  • init-vulpea.el - module that sets up all hooks (e.g. org-agenda, before-save and window-buffer-change-functions).

Almost intelligent meeting capture flow

It is described in greater details at d12frosted.io, but in short, whenever a meeting starts, I want to select a person I have a meeting with and capture notes under Meetings outline in that persons file.

Points of interest:

  • lib-vulpea-capture-el
    • vulpea-capture-setup - a function that sets up capture templates.
    • vulpea-capture-meeting-template - a function that prompts to select a person and depending on the result returns different templates.
    • vulpea-capture-meeting-target - a function that picks a target for captured note depending on selection from vulpea-capture-meeting-template.

straight.el with retries

I have already covered this topic at d12frosted.io. In short, init-elpa.el file contains functionality to automatically retry raxod502/straight.el operations. Take a look at definition and usage of elpa-straight-with-retry.

Managing litnotes

Not so long ago (few years ago?) I’ve started to take notes while I am reading books, articles, listening to videos, or completing courses. Previously it was a scattered mess (mostly left in my e-reading application), but now I have it all under litnotes directory in my Org directory.

In order to list all my reading notes, I’ve built a solution based on publicimageltd/lister, vulpea and org-roam libraries. Take a look at lib-litnotes.el file, your entry point is litnotes function.

Right now this buffer has minimal functionality:

  • List all litnotes grouped by status (see litnotes-status-values).
  • Configurable faces for each element.
  • Tab expansion to hide or show specific group (e.g. status).
  • Visiting note (TAB visits litnote in other window, RETURN visits in current window).
  • Assign status to a note at point (by default, s).

More functionality to come:

  • Ability to change default grouping (e.g. by content type, author or no grouping at all).
  • Interactive sorting.
  • Interactive filtering.

This is a playground for building more complex solution to support something like vino.

vino

The vino library is far from having all the features I want it to have, but v0.3 is mature and rich enough to use it to keep record on wines. Things that are either not well designed (from user perspective) or are too tied to my personal usage find their place here, in my personal configurations.

There are several interesting functions.

Inventory

There is an option to tell vino library how to calculate availability of vino-entry. There is no solution out of box (yet), but vino-availability-fn (together with add and sub) allow to easily implement inventory solution on your own. And for that I am using hledger. You can grab the code from lib-invetory.el file, nothing overly fancy there.

Now, having vino, vulpea and lib-invetory it’s fairly easy to implement a function that displays wines in my cellar - vino-balance-display, you can find it in lib-vino.el.

vino-stats

I am not statistical expert, but I love to see numbers related to wine consumption. It’s amazing to see a bigger picture after I put so much effort into writing down most wines I taste. The ‘bigger picture’ is calculated on some period (custom or predefined) and includes (but not limited to):

  • General stats like wines consumption, rating data, price data and QPR data;
  • Per country stats;
  • Per vintage stats;
  • Per colour stats;
  • Per carbonation stats;
  • List of all ratings in the given period.

My plan is to provide functionality to export all this data (probably) with images and graphs.

I am using part of this library to generate reports on wine tastings I organise in Kyiv. You can find some stuff on my Dropbox (mostly in English, but some documents are in Ukrainian). Hopefully soon my Barberry Garden will get its own site.

Checkout vino-stats.el module for implementation.

How to run

Requirements

All requirements are installed by eru. But the full (and dramatically huge) list of dependencies is here:

  • Emacs 29 or higher - installed by eru install system.
  • Eldev - installed by eru install emacs.

Install Emacs

For OS X users I recommend to install emacs-plus (who would guess?) - GNU Emacs with some sane defaults, available via brew package manager, though in general I prefer (and highly recommend) using nix or macports instead of brew.

$ brew tap d12frosted/emacs-plus
$ brew install emacs-plus@29

You are free™ to use whatever Emacs variant you wish to use, though I don’t give any guarantees that it will work with these configurations. In case you wish to investigate more on this topic, please refer to this answer.

Install configurations

Using eru

$ eru install emacs

Manual

Install Eldev.

$ eldev_bin=$HOME/.local/bin/eldev
$ curl -fsSL https://raw.github.com/doublep/eldev/master/bin/eldev > "$eldev_bin"
$ chmod a+x "$eldev_bin"

Bootstrap Emacs configurations, compile them and lint.

$ cd "$XDG_CONFIG_HOME/emacs" && make bootstrap compile lint

Upgrade dependencies

Using eru

$ eru upgrade emacs

Manual

$ cd "$XDG_CONFIG_HOME/emacs" && make upgrade compile lint

Run tests

Using eru

$ eru test emacs

Manual

$ cd "$XDG_CONFIG_HOME/emacs" && make test