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

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

[elpa] externals/hyperbole 5643f73c1c 2/2: Merge branch 'master' of hype


From: ELPA Syncer
Subject: [elpa] externals/hyperbole 5643f73c1c 2/2: Merge branch 'master' of hyperbole
Date: Sat, 29 Jan 2022 15:57:42 -0500 (EST)

branch: externals/hyperbole
commit 5643f73c1cf9b61373157bd8293a53296ef85498
Merge: 1dc43364e3 fad08eedfb
Author: Robert Weiner <rsw@gnu.org>
Commit: Robert Weiner <rsw@gnu.org>

    Merge branch 'master' of hyperbole
---
 ChangeLog          |  9 +++++++++
 hypb.el            | 20 ++++++++++++++++++--
 test/hypb-tests.el | 32 ++++++++++++++++++++++++++++++--
 3 files changed, 57 insertions(+), 4 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 7825152f9e..83fd0fa6c3 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,8 @@
 2022-01-29  Bob Weiner  <rsw@gnu.org>
 
+* test/hypb-tests.el (hypb--installation-type-test): Comment out until decide
+    all contexts it should handle and when best to use it.
+
 * man/hyperbole.texi (Glossary): Add Klink and Kcell Ref definitions.
     Update idstamp definition to include 0 root cell.
 
@@ -7,8 +10,14 @@
     unless there is a kcell ref within the link.  Also, generalize so when in
     any programming major mode, klinks are recognized within comments only.
 
+2022-01-28  Mats Lidell  <matsl@gnu.org>
+
+* test/hypb-tests.el (hypb--installation-type-test): Add unit test.
+
 2022-01-25  Bob Weiner  <rsw@gnu.org>
 
+* hypb.el (hypb--installation-type, hypb:configuration): Add function to
+    provide installation type and version number and use it.
 
 * kotl/kotl-mode.el (kotl-mode:copy-region-to-buffer): Fix interactive args 
listed in wrong
     order.
diff --git a/hypb.el b/hypb.el
index 5d524bcbb6..ef55c7c775 100644
--- a/hypb.el
+++ b/hypb.el
@@ -3,9 +3,9 @@
 ;; Author:       Bob Weiner
 ;;
 ;; Orig-Date:     6-Oct-91 at 03:42:38
-;; Last-Mod:     24-Jan-22 at 00:21:55 by Bob Weiner
+;; Last-Mod:     28-Jan-22 at 23:49:07 by Mats Lidell
 ;;
-;; Copyright (C) 1991-2019  Free Software Foundation, Inc.
+;; Copyright (C) 1991-2022  Free Software Foundation, Inc.
 ;; See the "HY-COPY" file for license information.
 ;;
 ;; This file is part of GNU Hyperbole.
@@ -107,6 +107,19 @@ Global keymap is used unless optional KEYMAP is given."
                "}"))
     (error "(hypb:cmd-key-string): Invalid cmd-sym arg: %s" cmd-sym)))
 
+(defun hypb--installation-type ()
+  "Return type of Hyperbole installation."
+  (let ((hypb-dir-name (file-name-nondirectory (directory-file-name 
hyperb:dir))))
+    (cond
+     ;; elpa-devel install -- hyperbole-8.0.0pre0.20220126.1138
+     ((string-match "hyperbole-\\([.[:digit:]]+pre[.[:digit:]]+\\).*" 
hypb-dir-name)
+      (list "elpa-devel" (match-string 1 hypb-dir-name)))
+     ;; git
+     ((file-exists-p (expand-file-name ".git" hyperb:dir))
+      (ignore-errors
+        (let ((default-directory hyperb:dir))
+          (list "git" (shell-command-to-string "git rev-parse HEAD"))))))))
+
 ;;;###autoload
 (defun hypb:configuration (&optional out-buf)
   "Insert Emacs configuration information at the end of optional OUT-BUF or 
the current buffer."
@@ -147,6 +160,9 @@ Global keymap is used unless optional KEYMAP is given."
                                (concat "PIEmail " pm-version))))))
       (when (and (boundp 'hnews:reader) (boundp 'gnus-version) hnews:reader)
         (insert (format "\tNews Reader: %s\n" gnus-version)))
+      (let ((install-type (hypb--installation-type)))
+        (when install-type
+          (insert (format "\tInstall:     %s, %s" (car install-type) (cadr 
install-type)))))
       (insert "\n")
       ;; Insert recent Hyperbole debugging messages if any.
       (when (get-buffer "*Messages*")
diff --git a/test/hypb-tests.el b/test/hypb-tests.el
index fefff6a0bc..2e5382bfd9 100644
--- a/test/hypb-tests.el
+++ b/test/hypb-tests.el
@@ -3,9 +3,9 @@
 ;; Author:       Mats Lidell <matsl@gnu.org>
 ;;
 ;; Orig-Date:     5-Apr-21 at 18:53:10
-;; Last-Mod:     24-Jan-22 at 00:41:04 by Bob Weiner
+;; Last-Mod:     28-Jan-22 at 23:49:07 by Mats Lidell
 ;;
-;; Copyright (C) 2021  Free Software Foundation, Inc.
+;; Copyright (C) 2022  Free Software Foundation, Inc.
 ;; See the "HY-COPY" file for license information.
 ;;
 ;; This file is part of GNU Hyperbole.
@@ -19,6 +19,7 @@
 (require 'hypb)
 (require 'hbut)
 (require 'ert)
+(require 'el-mock)
 
 ;; Test for replace-regexp-in-string copied from emacs src
 (ert-deftest hypb:replace-match-string-test ()
@@ -91,5 +92,32 @@
     (should (equal (hypb:replace-match-string "\\`\\|x" "--xx--" "z")
                    "z--zz--"))))
 
+;; RSW 2022-01-29: Comment this out until Mats and I decide how it should work
+;; (ert-deftest hypb--installation-type-test ()
+;;   "Verify installation type alternatives."
+;;   (let ((hyperb:dir 
"/home/user/.emacs.d/elpa/hyperbole-8.0.0pre0.20220126.1138"))
+;;     (should (equal (hypb--installation-type) '("elpa-devel" 
"8.0.0pre0.20220126.1138"))))
+;;   (let ((hyperb:dir "/a_git_folder"))
+;;     (with-mock
+;;       (mock (file-exists-p "/a_git_folder/.git") => t)
+;;       (mock (shell-command-to-string "git rev-parse HEAD") => "abcdefg")
+;;       (should (equal (hypb--installation-type) '("git" "abcdefg")))))
+;;   (let ((hyperb:dir "/a_git_folder"))
+;;     (with-mock
+;;       (mock (file-exists-p "/a_git_folder/.git") => t)
+;;       (cl-letf (((symbol-function 'shell-command-to-string)
+;;                  (lambda (_cmd) (error "Something bad happend"))))
+;;         (should (equal (hypb--installation-type) '("git" "abcdefg"))))))
+;;   (let ((hyperb:dir "/a_git_folder"))
+;;     (with-mock
+;;       (mock (file-exists-p "/a_git_folder/.git") => nil)
+;;       (should-not (hypb--installation-type)))))
+
+;; This file can't be byte-compiled without the `el-mock' package (because of
+;; the use of the `with-mock' macro), which is not a dependency of Hyperbole.
+;;  Local Variables:
+;;  no-byte-compile: t
+;;  End:
+
 (provide 'hypb-tests)
 ;;; hypb-tests.el ends here



reply via email to

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