Emacs Hacking Projects

Table of Contents

REMINDER Some projects may have, some utility although that's mostly a secondary concern :) Fun is a number one concern!

Please feel free to open Pull Request with your projects idea!

1 Beginner projects a.k.a learn elisp

1.2 Projects/exercises

2 Org Projects

2.1 Ability to jump to an org link (e.g. footnotes) in another buffer/window

PROBLEM When buffer is narrowed can't preview the footnotes (for reference) HOW

  • using clone-indirect-buffer functionality

2.2 Xanadu

PROBLEM I find myself writing more and more stuff in org. With that comes the need of having a way to make and show the interconnections between those writings. DESCRIPTION In other words I'm finding myslef in need of a more powerful reference mechanism. Every now and then when I'm looking for answers on-line or try to sketch some solutions myself I'm going back to Ted Nelson and Xanadu and keep thinking that I'm just would like to re-implement some of his ideas in Emacs :) When I've realised that and started to look around myself I found that some people already did some of that. Nevertheless I think that this would make for a great elisp exercise and I would love to see how far we can go. I believe some of the results may prove to be practical (I know I want some of that) but I want to do it mainly for the fun of it!

2.2.1 Sharing fragments

Sharing writing done in org mode There are two main options here

  • collaboration
    • two way mechanism with syncing etc.
    • this is solved through github
  • publishing
    • this only requires one way mechanis
    • can this be solved by e.g. gists?

There are questions pertinent to both

  • format
    • for collaboration it stays in org
    • I think export is necesserry for other ppl to consume
  • permissions
    • collaboration: full permission mechanics of GH
    • secret gists
      • can be only accessed by those with the URL
  • sharing fragments
    • for collaboration this is the difficult question
    • for sharing this just needs a subtree export
  • live/realtime update?
    • this is too hard and an overkill for now

Workflow

  • Two stage workflow for publishing
    • this will work because is unidirectional flow
      • so there can be modifications to published versoin because they will never have to be incorporated back into the original
  • review the original note: to make sure that base changes are there
  • review the copy for publishing: this should be subtractive and slight changes to presentations not to the core. Essential changes should go into phase one
  • those changes and exports should be recorded with timestamps maybe message
    • use property drawer for this?

Gists

  • seems to already be there
  • can share files and folders
  • could use markdown, so potentially ppl could edit it and it could take life of it's own

Dropbox html sharing folder?

  • I don't think that exists anymore

Publish to blog, straight away!

  • would be nice at some point, don't thing I have to guts to do it now

Export to HTML and push to git repo with gh pages enabled

  • this is a bit manual, but could be automated ofc
  • would edit the note as is in the original org file
  • press keybinding to trigger publishing
  • would open a capture type window for edits to the final draft
  • after confirmed with C-c C-c would export to html in the background, stage changes, and bring up to commit window (and automatically push if not run with prefix argument)
  • would generate url and copy it to clipboard

2.2.2 References

3 General Emacs Projects

3.1 Easier way to have multiple narrow views of one file

I sometimes want to work on multiple things at a time that are in the same buffer. I can always clone-indirect-buffer but that's kinda hard ;)

  • provides no semantics for manipulation/switching etc.

3.2 Window navigation aware of system windows (kinda)

GOAL set-up: More than one emacs frame SPC w h/l should be aware of existence of additional frames (system windows) FIRST APPROXIMATION e.g. navigating to window 'on the left' on Mac

  • if there's an emacs window
    • switch to that window
    • else: use s-` to switch to other emacs frame
  • caveats
    • makes some sense for two frames (also not quite, cause it's not aware of direction, but still usefull)
    • very little sense for more

3.3 "Freeze view" for helm/which key

GOAL Get output of helm/which key commands into a buffer.

Helm: Say I've got an api to explore e.g. some elisp library would be nice to do that through helm and have full emacs editing power at the same time

Which key: Example approach https://github.com/justbur/emacs-which-key/commit/77586e62b6d306bae07e4e3e093ba488724f4131

;; original--inserts into buffer, swithches the window
(defun which-key-dump-bindings (prefix buffer-name)
  "Dump bindings from PREFIX into buffer named BUFFER-NAME.
PREFIX should be a string suitable for `kbd'."
  (interactive "sPrefix: \nB")
  (let* ((buffer (get-buffer-create buffer-name))
         (keys (which-key--get-bindings (kbd prefix))))
    (with-current-buffer buffer
      (point-max)
      (save-excursion
        (dolist (key keys)
          (insert (apply #'format "%s%s%s\n" key)))))
    (switch-to-buffer-other-window buffer)))


;; edited--returns values
(defun which-key-dump-bindings (prefix buffer-name)
  "Dump bindings from PREFIX into buffer named BUFFER-NAME.
     PREFIX should be a string suitable for `kbd'."
  (interactive "sPrefix: \nB")
  (let* ((buffer (get-buffer-create buffer-name))
         (keys (which-key--get-bindings (kbd prefix))))
    (with-current-buffer buffer
      (point-max)
      (save-excursion
        (mapcar (lambda (x) (apply #'format "%s%s%s\n" x)) keys)))
    ))

(which-key-dump-bindings "SPC f" "emacs.org")

3.4 Persistent undo and jump to last change history

Vim has that ;P I'm pretty used to being able to use jump/edit history after coming back to a file after a while. Not even sure how vim implements that?

3.5 Hypothes.is for emacs!

  • interface hypothes.is
    • viewing annotations tree in Emacs
  • highlights/annotations in org files
    • this would need them to be version controlled (so links work)
    • need to be public

3.6 Parse git diff's for org headlines that changed

Effectively an org-specific/automatic change log

3.6.1 Example approach

  • Clean git diff into org document
  • Save filename
  • Parse headlines
  • Join them into links like: file:projects.org::*task
    • to refer back to those changes
    • difficulty: this would have to be a (ma)git reference to when the change was introduced??
      • or just current, yeah!

Could this be integrated somehow into a magit function? Taking the commit under point as a starting point for calculating diff

3.7 look and feel

3.7.1 Playing with font-locks

MOTIVATION I've had this thing where I wanted: nice way to display inline src block OFC there is a way to do this…

  • Inline code clone-indirect-buffer

Full syntax:

An inline code block conforms to this structure:

src_<language>{<body>}
or

src_<language>[<header arguments>]{<body>}

There seems to even be a way to fontify that

(font-lock-add-keywords 'org-mode
                 '(("\\(src_\\)\\([^[{]+\\)\\(\\[:.*\\]\\){\\([^}]*\\)}"
                    (1 '(:foreground "black" :weight 'normal :height 5)) ; src_ part
                    (2 '(:foreground "cyan" :weight 'bold :height 75 :underline "red")) ; "lang" part.
                    (3 '(:foreground "#555555" :height 5)) ; [:header arguments] part.
                    (4 'org-code) ; "code..." part.
                    )))

Example challenge: regex/matcher used here could to modify to allow for the brackets to be optional Diving into that would be quite cool Experimenting with some wild font-locks ;P

3.7.2 Explore limits of emacs display capabilities

How to design more modern, clean interfaces in emacs E.g. solarized theme uses variable width font for org headlines Customize is a pretty interesting form like interface I've seen some ppl with cool doom emacs configs I think path for exploration would be to try to copy interfaces in other medium

  • try to make something that looks like web form
  • try to make a more 'native' look
  • distraction free emacs
  • emacs for writers

3.8 Emacs synth

There's this meme of playing emacs like an instrument…

GOAL Write a synth (a music related thing) in elisp?

Inspiration:

  • There is of course Sam Arons Emacs Live (mainly for Overtone – Clojure)
  • But maybe the most complete exploration is in Emacs as a Musical Instrument
    • first goal could be recreating and/or reverse engineering the above

3.9 Find some elisp to read

There a list of packages on emacs wiki : https://www.emacswiki.org/emacs/WikifiedEmacsLispList

GOAL find the shortest packages by LOC!

That seems to be a good starting point to reading other peoples code :)

4 Spacemacs/Evil Specific Projects

4.1 Evil-search improvements: n/N to be consistent

n always go down in search N always go up in search

5 Clojure Related Projects

5.1 Automatic matching against "clojure error message catalogue"

5.2 Clojure file buffers and repl buffer interactions

Better interaction between REPL buffer and source file buffers

5.3 Org to handle links to project namesapces

eg. com.foobar.books Custom link type? Is there a way to delegate this to clojure-mode jump handler?

5.4 Emacs clojure dev plugin

have a state like the lisp state then single letter commmands from most commpon operations

some-stuff ; 1
(first some-stuff) ; m
(map | (first some-stuff)) ; t
(take | ((map :some-key (first some-stuff)))) ; f
(filter | ...) ; m
(map | ...) ; c



first : 1
map : m
reduce : r
filter : f
and : a
or : o
take : t
count : c
etc.

5.5 Auto-save cider repl interactions

This would be pretty useful cider-repl-history-save The format is then elisp, would be nice to just get text file with clojure forms

  • human readable
  • reusable

'(("en" "<p class=\"author\">Author: %a (%e)</p> <p class=\"date\">Date: %d</p> <p class=\"creator\">%c</p> <p class=\"validation\">%v</p>"))

Author: Emacs London

Created: 2019-07-29 Mon 13:09

Validate