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

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

[elpa] externals/hyperbole d0dd9202d8 06/19: HyRolo search org-directory


From: ELPA Syncer
Subject: [elpa] externals/hyperbole d0dd9202d8 06/19: HyRolo search org-directory, org-roam files or with helm-org-rifle
Date: Sun, 24 Jul 2022 16:57:37 -0400 (EDT)

branch: externals/hyperbole
commit d0dd9202d89fb753e92ddfef6688c3d8c3039c6b
Author: Bob Weiner <rsw@gnu.org>
Commit: Bob Weiner <rsw@gnu.org>

    HyRolo search org-directory, org-roam files or with helm-org-rifle
---
 ChangeLog |  6 ++++++
 hyrolo.el | 53 ++++++++++++++++++++++++++++++++++++++++++++++++++++-
 2 files changed, 58 insertions(+), 1 deletion(-)

diff --git a/ChangeLog b/ChangeLog
index f7af3a5ec2..3c97134d18 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -85,6 +85,12 @@
   MANIFEST: Added above file.
 
 2022-07-06  Bob Weiner  <rsw@gnu.org>
+2022-07-02  Bob Weiner  <rsw@gnu.org>
+
+* hyrolo.el (hyrolo-org, hyrolo-helm-org-rifle, hyrolo-org-roam): Add HyRolo-
+    based searching of Org files, helm-based searching of HyRolo files and
+    Hyrolo-based searching of Org Roam files.
+
 * hsys-org.el (hsys-org-link-at-p, hsys-org-heading-at-p): Update to use
     'smart-eolp' and 'smart-eobp'.
 
diff --git a/hyrolo.el b/hyrolo.el
index f9863e4b90..1d50f59063 100644
--- a/hyrolo.el
+++ b/hyrolo.el
@@ -3,7 +3,7 @@
 ;; Author:       Bob Weiner
 ;;
 ;; Orig-Date:     7-Jun-89 at 22:08:29
-;; Last-Mod:     18-Jun-22 at 21:53:51 by Mats Lidell
+;; Last-Mod:      3-Jul-22 at 09:46:59 by Bob Weiner
 ;;
 ;; Copyright (C) 1991-2022  Free Software Foundation, Inc.
 ;; See the "HY-COPY" file for license information.
@@ -279,6 +279,8 @@ entry which begins with the parent string."
                 (setq again nil match t)))))
       (setq buffer-read-only nil)
       (unless match
+       (unless (zerop (current-column))
+         (insert "\n"))
        (insert (concat level "*")
                (if (string-equal entry-spc "") "   " entry-spc)
                name "\n")
@@ -1097,6 +1099,55 @@ otherwise just use the cdr of the item."
                         'entry)
        token "* "))))
 
+;;; ************************************************************************
+;;; Org Package Integrations
+;;; ************************************************************************
+
+;;;###autoload
+(defun hyrolo-helm-org-rifle ()
+  "Prompt for a search pattern with helm and interactively show all matches 
from `hyrolo-file-list'."
+  (interactive)
+  (unless (package-installed-p 'helm-org-rifle)
+    (package-install 'helm-org-rifle))
+  (require 'helm-org-rifle)
+  (let ((files (seq-filter #'file-readable-p hyrolo-file-list)))
+    (save-excursion
+      (mapc (lambda (file)
+             (set-buffer (find-file-noselect file))
+             (org-mode))
+           files))
+    (helm-org-rifle-files files)))
+
+;;;###autoload
+(defun hyrolo-org ()
+  "Prompt for patterns and search Org directory files for string or 
logic-based matches."
+  (interactive "sFind Org directory string (or logical expression): \nP")
+  (require 'org)
+  (unless (file-readable-p org-directory)
+    (make-directory org-directory))
+  (if (file-readable-p org-directory)
+      (if (fboundp #'helm-org-rifle-org-directory)
+         (helm-org-rifle-org-directory)
+       (let ((hyrolo-file-list (cddr (directory-files org-directory t 
"\\.org$"))))
+         (hyrolo-fgrep string max-matches)))
+    (error "(hyrolo-org): `org-directory', \"%s\", does not exist" 
org-directory)))
+
+;;;###autoload
+(defun hyrolo-org-roam (string &optional max-matches)
+  "Search Org Roam directory files for string or logic-based matches."
+  (interactive "sFind Org Roam directory string (or logical expression): \nP")
+  (unless (package-installed-p 'org-roam)
+    (package-install #'org-roam))
+  (require 'org-roam)
+  (unless (file-readable-p org-roam-directory)
+    (make-directory org-roam-directory))
+  (unless org-roam-db-autosync-mode
+    (org-roam-db-autosync-mode))
+  (if (file-readable-p org-roam-directory)
+      (let ((hyrolo-file-list (cddr (directory-files org-roam-directory t 
"\\.org$"))))
+       (hyrolo-fgrep string max-matches))
+    (error "(hyrolo-org-roam): `org-roam-directory', \"%s\", does not exist" 
org-roam-directory)))
+
 ;;; ************************************************************************
 ;;; Public functions
 ;;; ************************************************************************



reply via email to

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