From e5f7fe430d582c96b911b79dad03fad7c2d6aa9e Mon Sep 17 00:00:00 2001 From: Vincent Ambo Date: Tue, 29 Aug 2023 15:43:13 +0300 Subject: refactor(tazjin/gio-list-apps): refactor into dynamic Emacs module Instead of producing a binary that gets called by Emacs, with input/output serialisation, use a dynamic Emacs module that lets Emacs more-or-less directly call the relevant GTK functions. I'm doing this mostly as an experiment. Might be interesting to end up with a dynamic module that I can dump some experimental code into that improves my workflows. To do this, I've exposed the emacs binary used by my Emacs configuration in an additional `passthru` field. This ensures that the module is linked against the right version of Emacs. Change-Id: I1426994fe3455ed1b2a685c5a09705e29fa40950 Reviewed-on: https://cl.tvl.fyi/c/depot/+/9163 Tested-by: BuildkiteCI Reviewed-by: tazjin Autosubmit: tazjin --- users/tazjin/emacs/config/functions.el | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) (limited to 'users/tazjin/emacs/config') diff --git a/users/tazjin/emacs/config/functions.el b/users/tazjin/emacs/config/functions.el index df36c7eb882c..3739d25122ef 100644 --- a/users/tazjin/emacs/config/functions.el +++ b/users/tazjin/emacs/config/functions.el @@ -2,6 +2,8 @@ (require 'dash) (require 'map) +(require 'gio-list-apps) ;; native module! + (defun goto-line-with-feedback () "Show line numbers temporarily, while prompting for the line number input" (interactive) @@ -336,12 +338,7 @@ names, instead of only their names (which might change)." "Use `//users/tazjin/gio-list-apps' to retrieve a list of installed (and visible) XDG apps, and let users launch them." (interactive) - (let* ((apps-json (s-lines (s-trim (shell-command-to-string "gio-list-apps")))) - (apps (seq-map (lambda (app) - (let ((parsed (json-parse-string app :object-type 'alist))) - (cons (cdr (assoc 'name parsed)) - (cdr (assoc 'commandline parsed))))) - apps-json)) + (let* ((apps (taz-list-xdg-apps)) ;; Display the command that will be run as an annotation (completion-extra-properties -- cgit 1.4.1