Technology

Moldable Emacs: Vega-Lite, Nyxt and Emacs In direction of Sustainable Style

Let’s strive to produce correct that (or an instance of that at the least)! The
ask is: what notes attract my attention most? Let me quantify
this ask by announcing: which notes personal the most Org Dawdle relief links?
That is great to me because alongside with a one-way link is an effort.
Encourage-links command how unparalleled I care a pair of state. So the view is to utilize (a
half of — I bought too many notes–) my notes, gain how many relief links
they’ve, and repair this to gaze which state wins. Additionally I want to click
the attach to open the state in Emacs (and command its relief links). It sounds
advanced, but here it’s miles!

Time to existing! First of the total instruments I needed for this workflow.

We delivery from a moldable-emacs Playground that takes the predominant 100
notes and transforms them exact into a plist. The list incorporates the quantity
of relief links, the size of the file and a :show which tells what
to produce whenever you happen to click on a Vega-Lite node.

(--> (org-dawdle-node-list)
     (-utilize 100 it)
     (--filter (> (dimension (org-dawdle-relief links-gain it)) 0) it)
     (--intention
      (list :file (org-dawdle-node-file it)
            :relief links (dimension (org-dawdle-relief links-gain it))
            :dimension (file-attribute-dimension (file-attributes (org-dawdle-node-file it)))
            :show (concat "file:///"
                             (scandalous64-encode-string
                              (concat
                               "(progn (score-file ""
                               (org-dawdle-node-file it)
                               "")
                               (org-dawdle-buffer-toggle))"))
                             ".ag91"))
      it)
     )

Vega-Lite does utilize recordsdata in JSON format. So we translate that plist
into JSON with one other moldable-emacs mold. The Vega-Lite schema is a
hack of the scatterplot with href instance. The dimensions I mediate
are relief links and dimension of file (I became once unheard of if there became once correlation
between dimension and relief links).

Anyway, we now gain into the comparatively frosty stuff. Vega-Lite helps
hyperlinks to permit you click a node of the attach and navigate the get.
I want to bustle an Emacs motion as a change (i.e., open the state and open
the Org Dawdle buffer with relief links)! What to produce? Hack the hyperlink!

Nyxt comes with a neat-frosty function: it enables you to justify how to handle
links. Now no longer too prolonged up to now I modified my Nyxt configuration to open mails with
Emacs
. You should maybe per chance per chance furthermore command how to handle file extensions of an hyperlnk.
So I made my salvage file extension and an handler.

(justify-configuration buffer
  ((demand-resource-hook (decrease #'hooks:add-hook
                                  (list
                                        (url-dispatching-handler
                                         'emacs-mail
                                         (match-diagram "mailto")
                                         "/usr/bin/emacsclient --eval '(browse-url-mail "~a")'"
                                         )
                                        (url-dispatching-handler
                                         'decode-elisp-with-emacs
                                         (match-file-extension "ag91")
                                         "/usr/bin/emacsclient --eval '(emacs-with-nyxt-decode-show "~a")'"
                                         ))
                                  :preliminary-label %slot-default%))))

Level to that once I score that extension, I carry out Emacs name
emacs-with-nyxt-decode-show. The rationale is into the Playground we noticed sooner than.

:show (concat "file:///"
                             (scandalous64-encode-string
                              (concat
                               "(progn (score-file ""
                               (org-dawdle-node-file it)
                               "")
                               (org-dawdle-buffer-toggle))"))
                             ".ag91")

I place Elisp into my file title!!! I encode my Elisp program in scandalous64
and then add an .ag91 exention.

That’s why I desire a decode function.

(defun emacs-with-nyxt-decode-show (a)
  (--> a
       (s-split "/" it t)
       reverse
       car
       (s-split "\." it t)
       car
       scandalous64-decode-string
       read
       eval))

This could maybe per chance very properly be crazy, but it opens humongous potentialities! You should maybe per chance per chance
bustle Elisp from the browser. And also you might maybe per chance embed actions as hyperlinks!! I
must gain a much less hacky methodology to make utilize of this, after which I will add it
to moldable-emacs and emacs-with-nyxt.

And with this, I feel closer to personal a moldable interface to
designate better the sphere spherical me.

(Level to, this integration is quite advanced because Emacs doesn’t personal a
wonderful UX list. Otherwise, lets doubtlessly personal an Emacs Vega-Lite
and a easy methodology to hook actions to nodes. Nyxt embraces HTML and
makes that first-class. I judge GlamorousToolkit has a unparalleled better
list for the reason that UX is a most well-known class citizen of the IDE: this procedure I
would now no longer must soar from Emacs to Nyxt and relief. In GT you might maybe per chance correct
program the substances of the UX (which are Pharo objects) from within
your instrument. I’m hoping Emacs will gain inspired by that at some level!)

Related Articles

Back to top button
%d bloggers like this: