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

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

[elpa] externals/hyperbole 493c5bb 4/6: Merge branch 'master' of hyperbo


From: ELPA Syncer
Subject: [elpa] externals/hyperbole 493c5bb 4/6: Merge branch 'master' of hyperbole
Date: Sun, 12 Sep 2021 11:57:13 -0400 (EDT)

branch: externals/hyperbole
commit 493c5bb877535637a34e08330c9b8a0cbf746138
Merge: b7b7793 b5ecd11
Author: Bob Weiner <rsw@gnu.org>
Commit: Bob Weiner <rsw@gnu.org>

    Merge branch 'master' of hyperbole
---
 ChangeLog            |   8 +++
 hui-select.el        | 140 +++++++++++++++++++++++++--------------------------
 hui-window.el        |   1 +
 test/hyrolo-tests.el | 112 ++++++++++++++++++++++++++++++++++++++++-
 4 files changed, 189 insertions(+), 72 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 7f7ff8d..e5ec21e 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -4,6 +4,14 @@
     allow only Koutline buffers and files.  Stop centering title since
     often places it too far right.
 
+2021-09-05  Mats Lidell  <matsl@gnu.org>
+
+* test/hyrolo-tests.el (hyrolo-demo-show-overview)
+    (hyrolo-demo-move-to-beginning-and-end-of-file)
+    (hyrolo-demo-move-between-entries-on-same-level)
+    (hyrolo-demo-no-following-same-level-heading): Add tests for rolo keys.
+    (hyrolo-demo-toggle-visibility): Update to test key 's'.
+
 2021-08-19  Mats Lidell  <matsl@gnu.org>
 
 * test/hbut-tests.el (hbut-tests:should-match-tmp-folder): Add check for
diff --git a/hui-select.el b/hui-select.el
index a565293..8bee86c 100644
--- a/hui-select.el
+++ b/hui-select.el
@@ -203,6 +203,76 @@
 (defvar hui-select-prior-buffer nil)
 
 ;;; ************************************************************************
+;;; Private variables
+;;; ************************************************************************
+
+(defconst hui-select-syntax-table (make-syntax-table 
emacs-lisp-mode-syntax-table)
+  "Syntax table to use when selecting delimited things.")
+;; Make braces be thing delimiters, not punctuation.
+(modify-syntax-entry ?\{ "\(\}" hui-select-syntax-table)
+(modify-syntax-entry ?\} "\)\{" hui-select-syntax-table)
+
+(defvar hui-select-bigger-alist
+  '((char nil)
+    (whitespace hui-select-whitespace)
+    (word hui-select-word)
+    (symbol hui-select-symbol)
+    (punctuation nil)
+    (string hui-select-string)
+    (text nil)
+    (comment hui-select-comment)
+    (markup-pair nil)
+    (preprocessor-def nil)
+    (sexp hui-select-sexp)
+    (sexp-start nil)
+    (sexp-end nil)
+    (sexp-up hui-select-sexp-up)
+    (line hui-select-line)
+    (sentence hui-select-sentence)
+    (brace-def-or-declaration hui-select-brace-def-or-declaration)
+    (indent-def hui-select-indent-def)
+    (paragraph hui-select-paragraph)
+    (page hui-select-page)
+    (buffer hui-select-buffer)
+    )
+  "Unordered list of (<region-type-symbol> <region-selection-function>) pairs.
+Used to go from one thing to a bigger thing.  See `hui-select-bigger-thing'.
+Nil value for <region-selection-function> means that region type is skipped
+over when trying to grow the region and is only used when a selection is made
+with point on a character that triggers that type of selection.")
+
+(defvar hui-select-prior-buffer nil)
+(defvar hui-select-prior-point nil)
+
+(defvar hui-select-previous 'char
+  "Most recent type of selection.  Must be set by all hui-select functions.")
+
+(defvar hui-select-region (cons nil nil)
+  "Cons cell that contains a region (<beginning> . <end>).
+The function `hui-select-set-region' updates and returns it.")
+
+(defvar hui-select-old-region (cons nil nil)
+  "Cons cell that contains a region (<beginning> . <end>).")
+
+(defcustom hui-select-syntax-alist
+  '((?w  . hui-select-word)
+    (?_  . hui-select-symbol)
+    (?\" . hui-select-string)
+    (?\( . hui-select-sexp-start)
+    (?\$ . hui-select-sexp-start)
+    (?\' . hui-select-sexp-start)
+    (?\) . hui-select-sexp-end)
+    (?   . hui-select-whitespace)
+    (?\< . hui-select-comment)
+    (?\. . hui-select-punctuation))
+  "*Unordered list of pairs of the form (<syntax-char> <function>) used by the 
function `hui-select-syntactical-region'.
+Each <function> takes a single position argument and returns a
+region (start . end) defining the boundaries of the thing at that position."
+  :type '(repeat (cons (character :tag "Syntax-Char") function))
+  :group 'hyperbole-commands)
+
+
+;;; ************************************************************************
 ;;; Public functions
 ;;; ************************************************************************
 
@@ -1346,76 +1416,6 @@ list, hui-select-markup-modes."
   (setq hui-select-previous 'buffer)
   (hui-select-set-region (point-min) (point-max)))
 
-;;; ************************************************************************
-;;; Private variables
-;;; ************************************************************************
-
-(defconst hui-select-syntax-table (make-syntax-table 
emacs-lisp-mode-syntax-table)
-  "Syntax table to use when selecting delimited things.")
-;; Make braces be thing delimiters, not punctuation.
-(modify-syntax-entry ?\{ "\(\}" hui-select-syntax-table)
-(modify-syntax-entry ?\} "\)\{" hui-select-syntax-table)
-
-(defvar hui-select-bigger-alist
-  '((char nil)
-    (whitespace hui-select-whitespace)
-    (word hui-select-word)
-    (symbol hui-select-symbol)
-    (punctuation nil)
-    (string hui-select-string)
-    (text nil)
-    (comment hui-select-comment)
-    (markup-pair nil)
-    (preprocessor-def nil)
-    (sexp hui-select-sexp)
-    (sexp-start nil)
-    (sexp-end nil)
-    (sexp-up hui-select-sexp-up)
-    (line hui-select-line)
-    (sentence hui-select-sentence)
-    (brace-def-or-declaration hui-select-brace-def-or-declaration)
-    (indent-def hui-select-indent-def)
-    (paragraph hui-select-paragraph)
-    (page hui-select-page)
-    (buffer hui-select-buffer)
-    )
-  "Unordered list of (<region-type-symbol> <region-selection-function>) pairs.
-Used to go from one thing to a bigger thing.  See `hui-select-bigger-thing'.
-Nil value for <region-selection-function> means that region type is skipped
-over when trying to grow the region and is only used when a selection is made
-with point on a character that triggers that type of selection.")
-
-(defvar hui-select-prior-buffer nil)
-(defvar hui-select-prior-point nil)
-
-(defvar hui-select-previous 'char
-  "Most recent type of selection.  Must be set by all hui-select functions.")
-
-(defvar hui-select-region (cons nil nil)
-  "Cons cell that contains a region (<beginning> . <end>).
-The function `hui-select-set-region' updates and returns it.")
-
-(defvar hui-select-old-region (cons nil nil)
-  "Cons cell that contains a region (<beginning> . <end>).")
-
-(defcustom hui-select-syntax-alist
-  '((?w  . hui-select-word)
-    (?_  . hui-select-symbol)
-    (?\" . hui-select-string)
-    (?\( . hui-select-sexp-start)
-    (?\$ . hui-select-sexp-start)
-    (?\' . hui-select-sexp-start)
-    (?\) . hui-select-sexp-end)
-    (?   . hui-select-whitespace)
-    (?\< . hui-select-comment)
-    (?\. . hui-select-punctuation))
-  "*Unordered list of pairs of the form (<syntax-char> <function>) used by the 
function `hui-select-syntactical-region'.
-Each <function> takes a single position argument and returns a
-region (start . end) defining the boundaries of the thing at that position."
-  :type '(repeat (cons (character :tag "Syntax-Char") function))
-  :group 'hyperbole-commands)
-
-
 (provide 'hui-select)
 
 ;;; hui-select.el ends here
diff --git a/hui-window.el b/hui-window.el
index 34457fe..3324402 100644
--- a/hui-window.el
+++ b/hui-window.el
@@ -78,6 +78,7 @@
 (require 'hycontrol)
 ;; If installed, use pulse library for momentary highlighting of buffer/file 
item lines.
 (require 'pulse nil t)
+(require 'hui-select)
 
 ;;; ************************************************************************
 ;;; Public variables
diff --git a/test/hyrolo-tests.el b/test/hyrolo-tests.el
index 68ce444..35d3181 100644
--- a/test/hyrolo-tests.el
+++ b/test/hyrolo-tests.el
@@ -64,14 +64,122 @@
         (should (looking-at "Work"))
 
         (should (hact 'kbd-key "h"))
-        (hy-test-helpers:consume-input-events)
         (end-of-line)
         (should (get-char-property (point) 'invisible))
 
         (should (hact 'kbd-key "a"))
-        (hy-test-helpers:consume-input-events)
+        (should-not (get-char-property (point) 'invisible))
+
+        (should (hact 'kbd-key "h"))
+        (end-of-line)
+        (should (get-char-property (point) 'invisible))
+
+        (should (hact 'kbd-key "s"))
         (should-not (get-char-property (point) 'invisible)))
     (hyrolo-demo-quit)))
 
+(ert-deftest hyrolo-demo-show-overview ()
+  "Keys o shall show overview."
+  (skip-unless (not noninteractive))
+  (unwind-protect
+      (progn
+        (load "../hyrolo-demo")
+        (should (hact 'kbd-key "C-x 4r work RET TAB"))
+        (hy-test-helpers:consume-input-events)
+        (should (string= (buffer-name) "*Hyperbole Rolo*"))
+        (should (looking-at "Work"))
+
+        (should (hact 'kbd-key "o"))
+        (hy-test-helpers:consume-input-events)
+        (end-of-line)
+        (should-not (get-char-property (point) 'invisible))
+
+        ;; Check second line is an outline
+        (should (hact 'kbd-key "n"))
+        (end-of-line)
+        (should (get-char-property (point) 'invisible))
+
+        ;; Check third line is an outline
+        (should (hact 'kbd-key "n"))
+        (end-of-line)
+        (should (get-char-property (point) 'invisible))
+
+        ;; Check fourth line is end of buffer
+        (should (hact 'kbd-key "n"))
+        (should (equal (point) (point-max))))
+    (hyrolo-demo-quit)))
+
+(ert-deftest hyrolo-demo-move-to-beginning-and-end-of-file ()
+  "Keys '<', '.' and '>', ',' shall move to beginning and end of file 
respectively."
+  (skip-unless (not noninteractive))
+  (unwind-protect
+      (progn
+        (load "../hyrolo-demo")
+        (should (hact 'kbd-key "C-x 4r work RET TAB"))
+        (hy-test-helpers:consume-input-events)
+        (should (string= (buffer-name) "*Hyperbole Rolo*"))
+        (should (looking-at "Work"))
+
+        (should (hact 'kbd-key ">"))
+        (should (equal (point) (point-max)))
+
+        (should (hact 'kbd-key "<"))
+        (should (equal (point) (point-min)))
+
+        (should (hact 'kbd-key ","))
+        (should (equal (point) (point-max)))
+
+        (should (hact 'kbd-key "."))
+        (should (equal (point) (point-min))))
+    (hyrolo-demo-quit)))
+
+(ert-deftest hyrolo-demo-move-between-entries-on-same-level ()
+  "Keys '<', '.' and '>', ',' shall move to beginning and end of file 
respectively."
+  (skip-unless (not noninteractive))
+  (unwind-protect
+      (progn
+        (load "../hyrolo-demo")
+        (should (hact 'kbd-key "C-x 4r com RET TAB"))
+        (hy-test-helpers:consume-input-events)
+        (should (string= (buffer-name) "*Hyperbole Rolo*"))
+        (should (hact 'kbd-key "<"))
+        (should (equal (point) (point-min)))
+
+        (should (hact 'kbd-key "n"))
+        (should (looking-at "\\*\\*\\s-+Strong"))
+
+        (should (hact 'kbd-key "f"))
+        (should (looking-at "\\*\\*\\s-+Hansen"))
+
+        (should (hact 'kbd-key "b"))
+        (should (looking-at "\\*\\*\\s-+Strong")))
+    (hyrolo-demo-quit)))
+
+(ert-deftest hyrolo-demo-no-following-same-level-heading ()
+  "Error when trying to move to non existing next level heading."
+  (skip-unless (not noninteractive))
+  (unwind-protect
+      (progn
+        (load "../hyrolo-demo")
+        (should (hact 'kbd-key "C-x 4r com RET TAB"))
+        (hy-test-helpers:consume-input-events)
+        (should (string= (buffer-name) "*Hyperbole Rolo*"))
+        (should (hact 'kbd-key "<"))
+        (should (equal (point) (point-min)))
+
+        (should (hact 'kbd-key "n"))
+        (should (looking-at "\\*\\*\\s-+Strong"))
+
+        (should (hact 'kbd-key "n"))
+        (should (looking-at "\\*\\*\\*\\s-+Smith"))
+
+        (condition-case err
+            (should (hact 'kbd-key "f"))
+          (error
+           (progn
+             (should (equal (car err) 'error))
+             (should (string-match "No following same-level heading" (cadr 
err)))))))
+    (hyrolo-demo-quit)))
+
 (provide 'hyrolo-tests)
 ;;; hyrolo-tests.el ends here



reply via email to

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