Skip to content

Emacs configuration with sane defaults and a modular approach

License

Notifications You must be signed in to change notification settings

Qkessler/qk-emacs

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

qk-emacs

qk-emacs is a pre-configured, evil-like, and modular configuration with sane defaults, and a preference for built-in packages in nature.

images/gruvbox-config.png

Keybinding scheme

With the intention of keeping the user experience as consistent as possible, qk-emacs follows different principles across the modules, with the intention that irrespectively of the mode the user is in, the same keybindings will perform DWIM-like behaviours.

SPC has been chosen as leader key, and some of the Spacemacs keybindings have been migrated or adapted to a more ergonomic (to me) alternative. Nevertheless, qk-emacs has been built with customizability and extensibility on its core: feel free to jump to the modules and modify them out!

Major-mode and minor-mode definers

Even though each of the modules may include personalized keybindings which are discussed under each of the modules, the bulk of the keybindings are stored inside the qk-general module. The module uses the general.el package and the binding across the modules are configured with it. A major-mode and a minor-mode definers have been defined with general. Each of them configure the prefix SPC m for a specific major-mode or minor-mode respectively. The minor-mode definer has preference over the major-mode one. Let’s see an example on the qk-org module.

(major-mode-definer
  :major-modes '(org-mode)
  :keymaps '(org-mode-map)
  "c" '(org-edit-special :which-key "open source block")
  "r" 'org-refile
  ...)
(minor-mode-definer
  :keymaps 'org-capture-mode
  "f" 'org-capture-finalize
  "c" '(org-capture-kill :which-key "org-capture cancel")
  "r" 'org-capture-refile)

The above snippet defines conflicting keybindings for the org-mode major-mode, and the org-capture-mode minor-mode.

  • If on an org-capture-mode buffer, the SPC m c keybinding will invoke the org-capture-kill function, thus cancelling the org-capture process.
  • On the other hand, if on any other non-org-capture org-mode buffer, the SPC m c binding will open a source block at point, invoking the org-edit-special function.

Note the properties passed to the definers: when using the minor-mode-definer, we pass the :keymaps property, but this represents the minor-mode that will be affected. For major-modes, we pass the major-mode(s) affected and the keymaps that are gonna define those keybindings.

Finalize or Abort

In Emacs, there are lots of situations for actions to be finalized or aborted. An example of this is the org-capture snippet shown above. When invoking the org-capture function, one has the ability to finalize the org-capture note and therefore create the file/heading or abort it, returning to the starting state.

Since this happens in different situations, we use a standarized binding across all of them in qk-emacs.

  • SPC m f: Finalizes and confirms the action.
  • SPC m c: Cancels or aborts the action.

Examples:

  • Confirm or Abort changes in an org source block.
  • Confirm or Abort capturing with org-capture.
  • Confirm or Abort composing an email.
  • Confirm or Abort a commit message in git-commit-mode.
  • Confirm or Abort a temporary emacs-everywhere-mode buffer.

Example workflow

In this section, I explain my productivity and organization workflow that I have with qk-emacs. This section is meant to be orientative, in case you pick-up Emacs and don’t have a workflow yet. This works great for me, and I assume it would work great for you.

Daily org-agenda, Standup agenda and Monthly Review agenda

Every morning, and at different points of the day, I press SPC o a, which opens up an org-agenda (you can see how it looks like if you zoom on the example image at the top of this README file) view with:

  1. Today’s schedule, with tasks that have been scheduled for today. Note: DONE tasks won’t be on this section (or this agenda view for that matter). Whenever we set an org item as DONE (t d on the org-agenda-mode or SPC m t d in org-mode), it gets refiled to the daily file for that day. We can then either search through the files in the qk-notes-dailies-directory with SPC n d.
  2. Project list, where all of the org items with the PROJECT todo state reside. For a project to be turned to DONE, you need to mark all the tasks have have been refiled to it as DONE.
  3. Tasks to Refile. Here, you’ll find all the tasks that you have captured, but haven’t refiled (r in org-agenda-mode or SPC m r in org-mode) yet to the correct project. You can capture an idea, todo or note with SPC o c (Org Capture). I normally do it whenever something comes to mind, and it takes more than 2 mins to resolve.
  4. Unscheduled Tasks, contains all the tasks that have been refiled to the correct project, but haven’t been scheduled to execute.
  5. Waiting/Someday Tasks has all the tasks that are blocked (external input or myself) and that will be solved someday. If I don’t have anything on the Unscheduled Tasks section nor today, I’ll pick up a task on the SOMEDAY state.
  6. Notes: this section has items that I want to keep in mind throughout my day, or feedback to keep in mind and revisit multiple times in a day.
  7. Upcoming: my week at a glance.

Each day, we have a standup meeting, where we share the progress of the day, and the previous day, we communicate what we are blocked on and what we plan to work on for the day.

For those meetings, I set up my qk-denote-open-weekly-standup-agenda function, bound to SPC o s (Org agenda standup). It shows all the DONE tasks (from the dailies files) in the past week, so I can have some context on the week.

Finally, whenever I’m ready to do a Monthly review, I use the qk-denote-open-monthly-agenda function (not bound to any key, though you could bind it) and it shows all the DONE tasks in the past month.