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

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

[elpa] externals/hyperbole 1b40c4e 14/53: hib-social.el: When a git-refe


From: Robert Weiner
Subject: [elpa] externals/hyperbole 1b40c4e 14/53: hib-social.el: When a git-reference is activated, trigger an error if `locate' command is not found.
Date: Wed, 15 Nov 2017 22:47:00 -0500 (EST)

branch: externals/hyperbole
commit 1b40c4eace8c33b180742124e9cd8a8e1a5f58de
Author: Bob Weiner <address@hidden>
Commit: Bob Weiner <address@hidden>

    hib-social.el: When a git-reference is activated, trigger an error if 
`locate' command is not found.
---
 .hypb         | Bin 2681 -> 2645 bytes
 Changes       |   8 ++++++--
 hib-social.el |  18 ++++++++++--------
 3 files changed, 16 insertions(+), 10 deletions(-)

diff --git a/.hypb b/.hypb
index d5ddee3..38dedb9 100644
Binary files a/.hypb and b/.hypb differ
diff --git a/Changes b/Changes
index 1e3796d..3a1f450 100644
--- a/Changes
+++ b/Changes
@@ -1,10 +1,14 @@
+2017-09-24  Bob Weiner  <address@hidden>
+
+* hib-social.el (hibtypes-git-get-locate-command): Added this function to 
trigger an
+    error if locate command is not available when a git-reference is 
activated.  So
+    user knows what happened.
+
 2017-09-23  Bob Weiner  <address@hidden>
 
 * hib-debbugs.el (debbugs-version-sufficient-p): Added to eliminate use of 
version testing
     function from package.el which some people prefer not to load.
 
-----
-
 2017-09-22  Bob Weiner  <address@hidden>
 
 * hib-social.el (hibtypes-git-add-project-to-repos-cache)
diff --git a/hib-social.el b/hib-social.el
index 1255818..fa9f4e4 100644
--- a/hib-social.el
+++ b/hib-social.el
@@ -345,6 +345,13 @@ PROJECT value is provided, it defaults to the value of
   (expand-file-name "Local-Git-Repos" hbmap:dir-user)
   "Filename of cache of local git repository directories found by 
`locate-command'.")
 
+(defun hibtypes-git-get-locate-command ()
+  (require 'locate)
+  (let ((cmd (if (string-match "locate" locate-command) locate-command 
"locate")))
+    (if (executable-find cmd)
+       cmd
+      (error "(git-reference): \"locate\" command required but not found; see 
its man page for setup instructions"))))
+
 (defun hibtypes-git-build-repos-cache (&optional prompt-flag)
   "Store cache of local git repo directories in `hibtypes-git-repos-cache'.
 With optional prompt-flag non-nil, prompt user whether to build the cache 
before building.
@@ -353,9 +360,7 @@ Return t if built, nil otherwise."
            (y-or-n-p "Find all local git repositories (will take some time)?"))
     (message "Please wait while all local git repositories are found...")
     (unless (zerop (shell-command (format "%s -r \.git$ | sed -e 's+/.git$++' 
> %s"
-                                         (if (and (boundp 'locate-command) 
(string-match "locate" locate-command))
-                                             locate-command
-                                           "locate")
+                                         (hibtypes-git-get-locate-command)
                                          hibtypes-git-repos-cache)))
       (error "(hibtypes-git-build-repos-cache): Cache build failed; 
`locate-command' must accept `-r' argument for regexp matching"))
     (message "Please wait while all local git repositories are found...Done")
@@ -367,11 +372,8 @@ Return the project directory found or nil if none."
   (message "Please wait while %s's local git repository is found..." project)
   (let ((project-dir (shell-command-to-string
                      (format "%s -l1 /%s/.git | sed -e 's+/.git++' | tr -d 
'\n'"
-                             (if (and (boundp 'locate-command) (string-match 
"locate" locate-command))
-                                 locate-command
-                               "locate")
-                             project
-                             hibtypes-git-repos-cache))))
+                             (hibtypes-git-get-locate-command)
+                             project))))
     (message "")
     (when (and (> (length project-dir) 0) (= ?/ (aref project-dir 0)))
       ;; project-dir a directory, prepend it to the cache file...



reply via email to

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