[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/hyperbole 992870d 12/53: Speeded up search for and addi
From: |
Robert Weiner |
Subject: |
[elpa] externals/hyperbole 992870d 12/53: Speeded up search for and addition of a single git project to the dir cache. |
Date: |
Wed, 15 Nov 2017 22:47:00 -0500 (EST) |
branch: externals/hyperbole
commit 992870d70b84355c6b059b0952cbc79ac5ce963f
Author: Bob Weiner <address@hidden>
Commit: Bob Weiner <address@hidden>
Speeded up search for and addition of a single git project to the dir cache.
* hib-social.el (hibtypes-git-add-project-to-repos-cache)
(hibtypes-git-build-or-add-to-repos-cache): Added to allow
for adding a single new project to the cache.
---
Changes | 6 ++++--
hib-social.el | 39 +++++++++++++++++++++++++++++++++++----
2 files changed, 39 insertions(+), 6 deletions(-)
diff --git a/Changes b/Changes
index f960dd4..ada158e 100644
--- a/Changes
+++ b/Changes
@@ -1,5 +1,9 @@
2017-09-22 Bob Weiner <address@hidden>
+* hib-social.el (hibtypes-git-add-project-to-repos-cache)
+ (hibtypes-git-build-or-add-to-repos-cache): Added to allow
+ for adding a single new project to the cache.
+
* hact.el (actype:act): Expand arguments as pathnames only in functions
defined with defact (actions may be regular defuns as well).
@@ -24,8 +28,6 @@
* hib-social.el: Added full Commentary with implicit link examples.
-----
-
2017-09-20 Bob Weiner <address@hidden>
* DEMO (Git References): Added.
diff --git a/hib-social.el b/hib-social.el
index ee095bf..1255818 100644
--- a/hib-social.el
+++ b/hib-social.el
@@ -361,6 +361,36 @@ Return t if built, nil otherwise."
(message "Please wait while all local git repositories are found...Done")
t))
+(defun hibtypes-git-add-project-to-repos-cache (project)
+ "Locate PROJECT directory and add to the cache of local git repo directories
in `hibtypes-git-repos-cache'.
+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))))
+ (message "")
+ (when (and (> (length project-dir) 0) (= ?/ (aref project-dir 0)))
+ ;; project-dir a directory, prepend it to the cache file...
+ (shell-command-to-string (format "echo -e \"%s\n$(cat %s)\" > %s"
+ project-dir hibtypes-git-repos-cache
+ hibtypes-git-repos-cache))
+ ;; ...and return it.
+ project-dir)))
+
+(defun hibtypes-git-build-or-add-to-repos-cache (project &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.
+Return t if built, nil otherwise."
+ (if (and (file-readable-p hibtypes-git-repos-cache)
+ ;; Non-zero file size
+ (not (zerop (nth 7 (file-attributes hibtypes-git-repos-cache)))))
+ (hibtypes-git-add-project-to-repos-cache project)
+ (hibtypes-git-build-repos-cache t)))
+
(defun hibtypes-git-project-directory (project)
"Given git PROJECT name, return local git repository directory or nil if
none found."
(if (or (and (file-readable-p hibtypes-git-repos-cache)
@@ -368,7 +398,7 @@ Return t if built, nil otherwise."
(not (zerop (nth 7 (file-attributes hibtypes-git-repos-cache)))))
(hibtypes-git-build-repos-cache t))
;; echo -n deletes trailing newline
- (shell-command-to-string (format "echo -n `grep -m1 '/%s$' %s`" project
hibtypes-git-repos-cache))
+ (shell-command-to-string (format "grep -m1 '/%s$' %s | tr -d '\n'"
project hibtypes-git-repos-cache))
(message "")
nil))
@@ -456,9 +486,10 @@ PROJECT value is provided, it defaults to the value of
(if (or (null project-dir) (equal project-dir ""))
(if (and project
;; Maybe the Hyperbole git project cache is
- ;; out-of-date and needs to be rebuilt. Prompt
- ;; user and if rebuilt, continue.
- (hibtypes-git-build-repos-cache t))
+ ;; out-of-date and needs to be rebuilt or added
+ ;; to. Prompt user and if rebuilt or added to,
+ ;; continue.
+ (hibtypes-git-build-or-add-to-repos-cache project t))
(setq project-dir (and project
(hibtypes-git-project-directory project)))
(error "(git-reference): No git directory found for project
`%s'" project)))
(if (equal project-dir "") (setq project-dir nil))
- [elpa] externals/hyperbole updated (0539520 -> 9b2d75a), Robert Weiner, 2017/11/15
- [elpa] externals/hyperbole 4fdcb7d 02/53: 2016-08-17 Bob Weiner <address@hidden>, Robert Weiner, 2017/11/15
- [elpa] externals/hyperbole 3aea4ee 07/53: Changes to hui-window.el had not been saved in prior commit., Robert Weiner, 2017/11/15
- [elpa] externals/hyperbole a2e2dc3 08/53: Made smart-helm ignore helm candidate separator lines., Robert Weiner, 2017/11/15
- [elpa] externals/hyperbole a6acb39 04/53: 2016-09-08 Bob Weiner <address@hidden>, Robert Weiner, 2017/11/15
- [elpa] externals/hyperbole 488bb31 13/53: hib-debbugs.el: Removed dependency on package.el which some people don't want/need loaded., Robert Weiner, 2017/11/15
- [elpa] externals/hyperbole 992870d 12/53: Speeded up search for and addition of a single git project to the dir cache.,
Robert Weiner <=
- [elpa] externals/hyperbole 1b40c4e 14/53: hib-social.el: When a git-reference is activated, trigger an error if `locate' command is not found., Robert Weiner, 2017/11/15
- [elpa] externals/hyperbole ddd114d 01/53: 2016-08-12 Bob Weiner <address@hidden>, Robert Weiner, 2017/11/15
- [elpa] externals/hyperbole 4ace769 17/53: Added brief pulsing/flashing from source line to line in destination buffer., Robert Weiner, 2017/11/15
- [elpa] externals/hyperbole 632789b 18/53: Made Action Key display selected buffer menu item in the same window as the buffer menu., Robert Weiner, 2017/11/15
- [elpa] externals/hyperbole fed1547 09/53: * hib-social.el (hibtypes-social-default-service): Changed to use a radio, Robert Weiner, 2017/11/15
- [elpa] externals/hyperbole a933051 19/53: Supported Emacs button mouse action; improved Lisp outlining support; improved load library links, Robert Weiner, 2017/11/15
- [elpa] externals/hyperbole 06d6cf1 16/53: V6.0.2a; Action Key drag from buffer, file and helm buffer item menus to another window to display., Robert Weiner, 2017/11/15
- [elpa] externals/hyperbole 9457b27 03/53: * hmouse-drv.el (hkey-help-show): Modified to invoke help-mode only if buffer name includes 'Help' to, Robert Weiner, 2017/11/15
- [elpa] externals/hyperbole 2b9d47e 33/53: Merge branch 'master' of git.sv.gnu.org:/srv/git/hyperbole with Mats assist-flag fix., Robert Weiner, 2017/11/15
- [elpa] externals/hyperbole 943dba1 28/53: Added 'topwin' Python script to determine topmost app window at a screen position under macOS., Robert Weiner, 2017/11/15