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

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

[elpa] externals/hyperbole dc529b1e0f 1/4: Test load-path dir without fi


From: ELPA Syncer
Subject: [elpa] externals/hyperbole dc529b1e0f 1/4: Test load-path dir without final slash and unquoted .el file lookup
Date: Sun, 9 Jan 2022 15:57:39 -0500 (EST)

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

    Test load-path dir without final slash and unquoted .el file lookup
---
 ChangeLog           | 12 +++++++++++-
 Makefile            |  5 +++--
 hpath.el            | 10 +++++-----
 test/hpath-tests.el | 10 +++++-----
 topwin.py           |  6 +++---
 5 files changed, 27 insertions(+), 16 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index d4275e146c..288cb504dd 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,6 +1,16 @@
+2022-01-09  Bob Weiner  <rsw@gnu.org>
+
+* topwin.py: Update to Python 3.7 or greater.
+
+* Makefile (EL_TAGS): Add test functions to tags file.
+
+* test/hpath-tests.el (hpath:auto-variable-alist-load-path-test):
+    Ensure directories without final slashes and .el files without double
+    quotes  are handled properly.
+
 2022-01-08  Bob Weiner  <rsw@gnu.org>
 
-* hpath.el (hpath:return-one-value): Completely rewrote to handle complex
+* hpath.el (hpath:return-one-value): Complete rewrite to handle complex
     multi-variable paths like:  "${load-path}/../hyperbole/$DOT/hypb.el")
     where DOT = ".".
 
diff --git a/Makefile b/Makefile
index c3d955fd67..b97c7b652d 100644
--- a/Makefile
+++ b/Makefile
@@ -189,7 +189,9 @@ HYPERBOLE_FILES = dir info html $(EL_COMPILE) $(EL_KOTL) \
        topwin.py hyperbole-banner.png $(man_dir)/hkey-help.txt \
        $(man_dir)/hyperbole.texi $(man_dir)/hyperbole.css 
$(man_dir)/version.texi
 
-EL_TAGS = $(EL_COMPILE) $(EL_KOTL)
+TEST_ERT_FILES = $(wildcard test/*tests.el)
+
+EL_TAGS = $(EL_COMPILE) $(EL_KOTL) $(TEST_ERT_FILES)
 
 .SUFFIXES:            # Delete the default suffixes
 .SUFFIXES: .el .elc   # Define the list of file suffixes to match to rules
@@ -403,7 +405,6 @@ packageclean:
 tests: test
 test: test-ert
 
-TEST_ERT_FILES=$(wildcard test/*tests.el)
 LOAD_TEST_ERT_FILES=$(patsubst %,(load-file \"%\"),${TEST_ERT_FILES})
 
 test-ert:
diff --git a/hpath.el b/hpath.el
index 1f1d256901..c5330308c8 100644
--- a/hpath.el
+++ b/hpath.el
@@ -2186,9 +2186,9 @@ function to call with FILENAME as its single argument."
     cmd))
 
 (defun hpath:get-single-string-variable-value (var-name)
-  "Return VAR-NAME's value if is a string without any colon or semicolon; 
otherwise, return nil.
-Trigger an error if VAR-NAME is not a string, a valid existing variable, or 
its value is not a string or list."
-  (let (sym val)
+  "Return VAR-NAME's value if is a string without any colon or semicolon; 
otherwise, return nil."
+  (let (sym
+       val)
     (cond ((not (stringp var-name))
           ;; (error "(hpath:get-single-string-variable-value): var-name, `%s', 
must be a string" var-name)
           nil)
@@ -2209,8 +2209,8 @@ Trigger an error if VAR-NAME is not a string, a valid 
existing variable, or its
          ((listp val)
           (setq val nil))
          (t
-          (error "(hpath:get-single-string-variable-value): Value of var-name, 
\"%s\", must be a string or list" var-name)
-          nil))
+          ;; (error "(hpath:get-single-string-variable-value): Value of 
var-name, \"%s\", must be a string or list" var-name)
+          (setq val nil)))
     val))
 
 (defun hpath:substitute-dir (path-prefix var-name rest-of-path 
trailing-dir-sep-flag &optional return-path-flag)
diff --git a/test/hpath-tests.el b/test/hpath-tests.el
index febd8bda11..0431e91cf8 100644
--- a/test/hpath-tests.el
+++ b/test/hpath-tests.el
@@ -218,14 +218,14 @@
   (concat (when with-quotes "\"") str (when with-quotes "\"")))
 
 (ert-deftest hpath:auto-variable-alist-load-path-test ()
-  "An elisp file should be looked up in the load path."
-  (let ((load-path (list hyperb:dir))
-        (el-file "hyperbole.el"))
+ "An elisp file, even without double quotes, should be looked up in the load 
path."
+  (let ((load-path (list (expand-file-name "kotl" hyperb:dir)))
+        (el-file "kview.el"))
     (dolist (with-quotes '(nil t))
       (with-temp-buffer
-        (insert (hpath-tests--insert el-file with-quotes))
+        (insert (hpath-tests--insert el-file))
         (goto-char 4)
-        (hy-test-helpers:action-key-should-call-hpath:find (expand-file-name 
el-file hyperb:dir))))))
+        (hy-test-helpers:action-key-should-call-hpath:find (expand-file-name 
el-file (car load-path)))))))
 
 (ert-deftest hpath:auto-variable-alist-org-folder-test ()
   "An org file should be looked up in the org directory."
diff --git a/topwin.py b/topwin.py
index 2a3c9836f3..d90bc4d3c8 100644
--- a/topwin.py
+++ b/topwin.py
@@ -1,4 +1,4 @@
-#!python2
+#!python
 #
 # SUMMARY:      Outputs the [application name] of the topmost window at mouse 
screen position or nothing if none
 # USAGE:        <script> <x-screen-coordinate> <y-screen-coordinate>
@@ -18,7 +18,7 @@ import Quartz
 from sys import argv, exit
 
 if len(argv) < 3:
-    print "%s: ERROR - Call with 2 numeric arguments, X and Y representing an 
absolute screen position" % argv[0]
+    print(f"{argv[0]}: ERROR - Call with 2 numeric arguments, X and Y 
representing an absolute screen position") 
     exit(1)
 
 x = int(argv[1]); y = int(argv[2])
@@ -39,7 +39,7 @@ def filter_and_print_top_window(x, y):
         win_width = int(bounds_val('Width')); win_height = 
int(bounds_val('Height'))
 
         if win_x <= x and x < win_x + win_width and win_y <= y and y < win_y + 
win_height:
-            print ('[' + ((val('kCGWindowOwnerName') or '') + 
']')).encode('utf8')
+            print('[' + ((val('kCGWindowOwnerName') or '') + 
']')).encode('utf8')
             # Add this line back in if you need to see the specific window 
within the app at the given position.
             # + ('' if val('kCGWindowName') is None else (' ' + 
val('kCGWindowName') or '')) \
 



reply via email to

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