emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] externals/consult-recoll 80f1933d68 2/2: eww-open-file as default


From: ELPA Syncer
Subject: [elpa] externals/consult-recoll 80f1933d68 2/2: eww-open-file as default for opening text/html results
Date: Sun, 14 Aug 2022 15:57:24 -0400 (EDT)

branch: externals/consult-recoll
commit 80f1933d686bdeec09f2adb8cdf491ff849b3e9b
Author: jao <jao@gnu.org>
Commit: jao <jao@gnu.org>

    eww-open-file as default for opening text/html results
---
 consult-recoll.el | 10 +++++++---
 readme.org        |  3 ++-
 2 files changed, 9 insertions(+), 4 deletions(-)

diff --git a/consult-recoll.el b/consult-recoll.el
index 8797f321f3..1be7e00c60 100644
--- a/consult-recoll.el
+++ b/consult-recoll.el
@@ -42,6 +42,8 @@
 (require 'subr-x)
 (require 'consult)
 
+(declare-function 'eww-open-file "eww")
+
 (defgroup consult-recoll nil
   "Options for consult recoll."
   :group 'consult)
@@ -152,9 +154,11 @@ Set to nil to use the default 'title (path)' format."
   (when candidate
     (let* ((url (consult-recoll--candidate-url candidate))
            (mime (consult-recoll--candidate-mime candidate))
-           (open (or (cdr (assoc mime consult-recoll-open-fns))
-                     consult-recoll-open-fn
-                     (lambda (f &optional _ignored) (find-file f)))))
+           (open (cond ((cdr (assoc mime consult-recoll-open-fns)))
+                       (consult-recoll-open-fn)
+                       ((string= mime "text/html")
+                        (lambda (f &optional _ignored) (eww-open-file f)))
+                       (t (lambda (f &optional _ignored) (find-file f))))))
       (if (not consult-recoll-inline-snippets)
           (funcall open url)
         (funcall open url (consult-recoll--candidate-page candidate))
diff --git a/readme.org b/readme.org
index 54e67a7416..e8a6072ee0 100644
--- a/readme.org
+++ b/readme.org
@@ -155,7 +155,8 @@ it directly via =M-x package-install RET consult-recoll 
RET=.
    When a search result candidate is selected, its MIME type is used to look
    up a function to open its associated file in the customizable variable
    ~consult-recoll-open-fns~.  If no entry is found, consult-recoll uses the
-   value of ~consult-open-fn~ as a default.
+   value of ~consult-open-fn~ as a default.  If the latter is not set,
+   ~eww-open-file~ is used for HTML files and ~find-file~ for the rest.
 
    If ~consult-recoll-inline-snippets~ is set, the functions above take two
    arguments: the URL of the file to open and, if present, the snippet page



reply via email to

[Prev in Thread] Current Thread [Next in Thread]