From 0ebfbb43cecc38fa2518c0510be7212e62ea3a5c Mon Sep 17 00:00:00 2001 From: Debanjum Singh Solanky Date: Mon, 1 Aug 2022 03:54:35 +0300 Subject: [PATCH] Nest org, md results at level 2 on Emacs interface. Improve readability - Makes it easier to fold/unfold, traverse and read results - This 2 level nesting is already being used on the web interface - Previously we were using the original nesting depth of the entry. This was aimed at providing more of the orginal context of the results. But currently this additional information does not provide as much, for the decreased legibility of the results --- src/interface/emacs/khoj.el | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/interface/emacs/khoj.el b/src/interface/emacs/khoj.el index dbd87c35..85b0ee28 100644 --- a/src/interface/emacs/khoj.el +++ b/src/interface/emacs/khoj.el @@ -78,7 +78,10 @@ (format "# %s\n%s" query (mapcar - (lambda (args) (format "%s" (cdr (assoc 'entry args)))) + (lambda (args) + (replace-regexp-in-string + "^\#+" "##" + (format "%s" (cdr (assoc 'entry args))))) json-response)))) (defun khoj--extract-entries-as-org (json-response query) @@ -90,8 +93,11 @@ (format "* %s\n%s" query (mapcar - (lambda (args) (format "%s" (cdr (assoc 'entry args)))) - json-response)))) + (lambda (args) + (replace-regexp-in-string + "^\*+" "**" + (format "%s" (cdr (assoc 'entry args))))) + json-response)))) (defun khoj--extract-entries-as-images (json-response query) "Convert json response from API to html with images"