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

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

[elpa] externals/consult-recoll 999c50fb3e: automatic jump to page numbe


From: ELPA Syncer
Subject: [elpa] externals/consult-recoll 999c50fb3e: automatic jump to page number if in doc-view or pdf-view mode
Date: Mon, 12 Sep 2022 16:57:25 -0400 (EDT)

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

    automatic jump to page number if in doc-view or pdf-view mode
---
 changelog.org     | 25 ++++++++++++++++---------
 consult-recoll.el | 12 +++++++++++-
 readme.org        |  4 +++-
 3 files changed, 30 insertions(+), 11 deletions(-)

diff --git a/changelog.org b/changelog.org
index 2482274306..f04ffef2bf 100644
--- a/changelog.org
+++ b/changelog.org
@@ -1,36 +1,43 @@
 #+title: Change log for consult-recoll
 
+* Version 0.8
+
+  - Fully customizable recollq flags, allowing for instance suppression of
+    snippets at the search level when performance is a problem.
+
+  - Automatic jump to result's page number if in doc-view or pdf-view mode.
+
 * Version 0.7 on 2022-08-20
 
-  + Search for snippet text when opening text or message files, since they
+  - Search for snippet text when opening text or message files, since they
     cannot be located by page number.  The search might fail if emacs refills
     the contents (for instance when rendering HTML), but it's better than
     nothing.
 
-  + Use ~eww-open-file~ as the default function to open =text/html= documents,
+  - Use ~eww-open-file~ as the default function to open =text/html= documents,
     rather than ~find-file~.
 
-  + New function ~consult-recoll-embark-setup~ for optional Embark integration,
+  - New function ~consult-recoll-embark-setup~ for optional Embark integration,
     so that one can use ~embark-collect~.
 
 * Version 0.6.2 on 2022-08-07
 
-  + First release in GNU ELPA, with FSF copyright.
+  - First release in GNU ELPA, with FSF copyright.
 
 * Version 0.6.1 on 2022-08-05
 
-  + Fixes for inline snippet display.
+  - Fixes for inline snippet display.
 
 * Version 0.6 on 2022-08-04
 
-  + Inline snippets in the completion buffer, as selectable search results.
+  - Inline snippets in the completion buffer, as selectable search results.
 
-  + Grouping of search results by MIME type.
+  - Grouping of search results by MIME type.
 
 * Version 0.5 on 2022-07-22
 
-  + Live previews of search results, including snippets when available.
+  - Live previews of search results, including snippets when available.
 
 * Versions 0.3 to 0.4
 
-  + Initial feature set stabilisation.
+  - Initial feature set stabilisation.
diff --git a/consult-recoll.el b/consult-recoll.el
index 3ec5e43c2d..f7424e921f 100644
--- a/consult-recoll.el
+++ b/consult-recoll.el
@@ -173,6 +173,16 @@ Set to nil to use the default 'title (path)' format."
         (goto-char (match-beginning 0))
         (when (derived-mode-p 'org-mode) (org-reveal))))))
 
+(declare-function 'doc-view-goto-page "doc-view")
+(declare-function 'pdf-view-goto-page "pdf-view")
+
+(defun consult-recoll--open-file (filename &optional page)
+  "Default function for opening result files."
+  (find-file filename)
+  (when page
+    (cond (derived-mode-p 'doc-view-mode) (doc-view-goto-page page)
+          (derived-mode-po 'pdf-view-mode) (pdf-view-goto-page page))))
+
 (defun consult-recoll--open (candidate)
   "Open file of corresponding completion CANDIDATE."
   (when candidate
@@ -182,7 +192,7 @@ Set to nil to use the default 'title (path)' format."
                        (consult-recoll-open-fn)
                        ((string= mime "text/html")
                         (lambda (f &optional _ignored) (eww-open-file f)))
-                       (t (lambda (f &optional _ignored) (find-file f))))))
+                       (t #'consult-recoll--open-file))))
       (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 7807f0bbdf..e37f8935c5 100644
--- a/readme.org
+++ b/readme.org
@@ -156,7 +156,9 @@ it directly via =M-x package-install RET consult-recoll 
RET=.
    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.  If the latter is not set,
-   ~eww-open-file~ is used for HTML files and ~find-file~ for the rest.
+   ~eww-open-file~ is used for HTML files and ~find-file~ for the rest, moving 
to
+   the result's page number if the major mode of the opened file is either
+   ~doc-view-mode~ or ~pdf-view-mode~.
 
    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]