branch: externals/hyperbole commit f7830a1a6b4be07e57923609c9d0a6217355b811 Merge: 1c222405e5 87dd8ce59f Author: Robert Weiner <r...@gnu.org> Commit: Robert Weiner <r...@gnu.org>
Merge branch 'master' with Mats updates from hyperbole --- ChangeLog | 26 ++++++++++++++++++ hgnus.el | 2 +- hmh.el | 6 ++-- hrmail.el | 2 +- hsmail.el | 2 +- hui-em-but.el | 6 ++-- hui-menu.el | 2 +- kotl/kotl-mode.el | 2 +- test/hmouse-info-tests.el | 47 +++++++++++++++++++++++++++++++ test/hyrolo-tests.el | 31 +++++++++++++++++++++ test/kotl-mode-tests.el | 70 +++++++++++++++++++++++++++++++++++++++++++++++ 11 files changed, 185 insertions(+), 11 deletions(-) diff --git a/ChangeLog b/ChangeLog index 27119e84a2..36cadfed0b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -46,6 +46,32 @@ variables are utilized for absolute expansions. (hpath:find): Add loose test that hpath:display-path-function successfully displayed link in a buffer. +2021-12-30 Mats Lidell <ma...@gnu.org> + +* hui-menu.el: +* hui-em-but.el: +* hsmail.el: +* hrmail.el: +* hmh.el: +* hgnus.el: Use lexical-binding + +* test/hyrolo-tests.el (hyrolo-sort-test): Add hyrolo sort test. + +2021-12-29 Mats Lidell <ma...@gnu.org> + +* test/hmouse-info-tests.el (hmouse-info-read-index-with-completion) + (hmouse-info-build-completions-no-match) + (hmouse-info-build-completions-multiple-matches): + hmouse-info tests. + +2021-12-28 Mats Lidell <ma...@gnu.org> + +* kotl/kotl-mode.el (kotl-mode:exchange-cells): Use cl-copy-list. + +* test/kotl-mode-tests.el (kotl-mode-transpose-cell) +(kotl-mode-transpose-cell-with-mark) +(kotl-mode-transpose-cell-past-multiple-cells): Add test for kotl-mode:transpose-cells. + 2021-12-26 Bob Weiner <r...@gnu.org> * kotl/kotl-mode.el (kotl-mode:exchange-cells): Signal error if invalid type or value diff --git a/hgnus.el b/hgnus.el index 48efdd26c9..7aad0e06d6 100644 --- a/hgnus.el +++ b/hgnus.el @@ -1,4 +1,4 @@ -;;; hgnus.el --- GNU Hyperbole buttons in news reader/poster: GNUS +;;; hgnus.el --- GNU Hyperbole buttons in news reader/poster: GNUS -*- lexical-binding: t; -*- ;; ;; Author: Bob Weiner ;; diff --git a/hmh.el b/hmh.el index bca7905a4a..2a44c72bb1 100644 --- a/hmh.el +++ b/hmh.el @@ -1,4 +1,4 @@ -;;; hmh.el --- GNU Hyperbole buttons in mail reader: Mh +;;; hmh.el --- GNU Hyperbole buttons in mail reader: Mh -*- lexical-binding: t; -*- ;; ;; Author: Bob Weiner ;; @@ -67,7 +67,7 @@ "Highlight any Hyperbole buttons in buffer for which display support exists." (if (fboundp 'hproperty:but-create) (hproperty:but-create))) -(defun Mh-msg-hdrs-full (toggled) +(defun Mh-msg-hdrs-full (_toggled) "If TOGGLED is non-nil, toggle full/hidden headers, else show full headers. For now, a no-op.") @@ -85,7 +85,7 @@ This includes Hyperbole button data." (defun Mh-msg-prev () (mh-previous-undeleted-msg 1)) -(defun Mh-msg-to-p (mail-msg-id mail-file) +(defun Mh-msg-to-p (_mail-msg-id mail-file) "Set current buffer to start of msg with MAIL-MSG-ID in MAIL-FILE. Returns t if successful, else nil." (if (not (file-readable-p mail-file)) diff --git a/hrmail.el b/hrmail.el index 1ba890bf67..5a6c0045fa 100644 --- a/hrmail.el +++ b/hrmail.el @@ -1,4 +1,4 @@ -;;; hrmail.el --- GNU Hyperbole buttons in mail reader: Rmail +;;; hrmail.el --- GNU Hyperbole buttons in mail reader: Rmail -*- lexical-binding: t; -*- ;; ;; Author: Bob Weiner ;; diff --git a/hsmail.el b/hsmail.el index c25c60ea25..eeed0b1b17 100644 --- a/hsmail.el +++ b/hsmail.el @@ -1,4 +1,4 @@ -;;; hsmail.el --- GNU Hyperbole buttons in mail composer: mail and mh-letter +;;; hsmail.el --- GNU Hyperbole buttons in mail composer: mail and mh-letter -*- lexical-binding: t; -*- ;; ;; Author: Bob Weiner ;; diff --git a/hui-em-but.el b/hui-em-but.el index e68508ee38..b41c417144 100644 --- a/hui-em-but.el +++ b/hui-em-but.el @@ -1,4 +1,4 @@ -;;; hui-em-but.el --- GNU Emacs button highlighting and flashing support +;;; hui-em-but.el --- GNU Emacs button highlighting and flashing support -*- lexical-binding: t; -*- ;; ;; Author: Bob Weiner ;; @@ -166,11 +166,11 @@ expression which matches an entire button string. If REGEXP-MATCH is non-nil, only buttons matching this argument are highlighted." (when hproperty:but-highlight-flag - (hbut:map (lambda (lbl start end) + (hbut:map (lambda (_lbl start end) (hproperty:but-add start end hproperty:but-face)) start-delim end-delim regexp-match 'include-delims))) -(defun hproperty:but-create-on-yank (prop-value start end) +(defun hproperty:but-create-on-yank (_prop-value start end) (save-restriction (narrow-to-region start end) (hproperty:but-create-all))) diff --git a/hui-menu.el b/hui-menu.el index 62740de056..3d3c6cca78 100644 --- a/hui-menu.el +++ b/hui-menu.el @@ -1,4 +1,4 @@ -;;; hui-menu.el --- Menubar menu of GNU Hyperbole commands +;;; hui-menu.el --- Menubar menu of GNU Hyperbole commands -*- lexical-binding: t; -*- ;; ;; Author: Bob Weiner ;; diff --git a/kotl/kotl-mode.el b/kotl/kotl-mode.el index ae3268cedf..3aa6674be8 100644 --- a/kotl/kotl-mode.el +++ b/kotl/kotl-mode.el @@ -2328,7 +2328,7 @@ to one level and kotl-mode:refill-flag is treated as true." ;; ;; Save cell-2 attributes (kotl-mode:goto-cell cell-ref-2 t) - (setq kcell-2 (copy-list (kcell-view:cell)) + (setq kcell-2 (cl-copy-list (kcell-view:cell)) idstamp-2 (kcell-view:idstamp) contents-2 (kcell-view:contents)) diff --git a/test/hmouse-info-tests.el b/test/hmouse-info-tests.el new file mode 100644 index 0000000000..5cd602b468 --- /dev/null +++ b/test/hmouse-info-tests.el @@ -0,0 +1,47 @@ +;;; hmouse-info-tests.el --- hmouse-info unit tests -*- lexical-binding: t; -*- + +;; Author: Mats Lidell <ma...@gnu.org> +;; +;; Orig-Date: 29-Dec-21 at 09:02:00 +;; +;; Copyright (C) 2021 Free Software Foundation, Inc. +;; See the "HY-COPY" file for license information. +;; +;; This file is part of GNU Hyperbole. + +;;; Commentary: + +;; See "../hmouse-info.el" + +;;; Code: + +(require 'ert) +(require 'hmouse-info) +(require 'with-simulated-input) + +(ert-deftest hmouse-info-read-index-with-completion () + "Read a completion that completes." + (with-simulated-input "(emacs)regex TAB RET" + (should (string= "(emacs)regexp" (Info-read-index-item-name "Prompt: "))))) + +(ert-deftest hmouse-info-build-completions-no-match () + "Build completions." + (unwind-protect + (progn + (info "(emacs)") + (setq Info-complete-menu-buffer (clone-buffer)) + (should (eq '() (Info-build-menu-item-completions "nothinglikethis" nil t))) + (kill-buffer "*info*")))) + +(ert-deftest hmouse-info-build-completions-multiple-matches () + "Build completions." + (unwind-protect + (progn + (info "(emacs)") + (setq Info-complete-menu-buffer (clone-buffer)) + (dolist (m (Info-build-menu-item-completions "regexp" nil t)) + (should (string-prefix-p "regexp" m t)))) + (kill-buffer "*info*"))) + +(provide 'hmouse-info-tests) +;;; hmouse-info-tests.el ends here diff --git a/test/hyrolo-tests.el b/test/hyrolo-tests.el index 35d31816f0..915ca71a07 100644 --- a/test/hyrolo-tests.el +++ b/test/hyrolo-tests.el @@ -181,5 +181,36 @@ (should (string-match "No following same-level heading" (cadr err))))))) (hyrolo-demo-quit))) +(ert-deftest hyrolo-sort-test () + "Rolo files can be sorted." + (let ((hyrolo-file (make-temp-file "hypb" nil ".otl"))) + (unwind-protect + (let ((hyrolo-file-list (list hyrolo-file))) + (find-file hyrolo-file) + (insert "===\nHdr\n===\n") + (goto-char (point-min)) + (should (looking-at "===")) + (hyrolo-add "c") + (hyrolo-add "b") + (hyrolo-add "a") + (hyrolo-add "b/d") + + ; Verify insertion order and following date on separate line + (goto-char (point-min)) + (should (looking-at "===")) + (dolist (insertion-order '("c" "b" "d" "a")) + (goto-char (1+ (should (search-forward insertion-order)))) + (should (looking-at-p "^\t[0-9/]+$"))) + + (hyrolo-sort) + + ; Verify sorted order and following date on separate line + (goto-char (point-min)) + (should (looking-at "===")) + (dolist (sorted-order '("a" "b" "d" "c")) + (goto-char (1+ (should (search-forward sorted-order)))) + (should (looking-at-p "^\t[0-9/]+$")))) + (delete-file hyrolo-file)))) + (provide 'hyrolo-tests) ;;; hyrolo-tests.el ends here diff --git a/test/kotl-mode-tests.el b/test/kotl-mode-tests.el index ea27e5d539..d1d71d8c5f 100644 --- a/test/kotl-mode-tests.el +++ b/test/kotl-mode-tests.el @@ -393,5 +393,75 @@ (should (string= (kcell-view:label (point)) "1a"))) (delete-file kotl-file)))) +(ert-deftest kotl-mode-transpose-cell () + "Transpose cells and leave point in cell." + (let ((kotl-file (make-temp-file "hypb" nil ".kotl"))) + (unwind-protect + (progn + (find-file kotl-file) + (insert "first") + (kotl-mode:add-cell) + (insert "second") + (kotl-mode:beginning-of-cell) + (should (string= (kcell-view:idstamp) "02")) + (should (looking-at-p "second")) + + (kotl-mode:transpose-cells 1) + + (should (string= (kcell-view:idstamp) "01")) + (should (looking-at-p "first")))) + (delete-file kotl-file))) + +(ert-deftest kotl-mode-transpose-cell-with-mark () + "Transpose cell with cell with mark and change point to mark." + (let ((kotl-file (make-temp-file "hypb" nil ".kotl"))) + (unwind-protect + (progn + (find-file kotl-file) + (insert "first") + (push-mark) + (kotl-mode:add-cell) + (insert "second") + (kotl-mode:add-cell) + (insert "third") + (kotl-mode:beginning-of-cell) + (should (string= (kcell-view:idstamp) "03")) + (should (looking-at-p "third")) + + (kotl-mode:transpose-cells 0) + + (should (string= (kcell-view:idstamp) "03")) + (should (looking-at-p "third")) + (should (kotl-mode:first-cell-p))) + (delete-file kotl-file)))) + +(ert-deftest kotl-mode-transpose-cell-past-multiple-cells () + "Transpose cell past multiple cells." + (let ((kotl-file (make-temp-file "hypb" nil ".kotl"))) + (unwind-protect + (progn + (find-file kotl-file) + (insert "first") + (kotl-mode:add-cell) + (insert "second") + (kotl-mode:add-cell) + (insert "third") + (kotl-mode:beginning-of-buffer) + (should (string= (kcell-view:idstamp) "01")) + (should (looking-at-p "first")) + + (kotl-mode:transpose-cells 2) + + ; Point moves to cell two + (should (string= (kcell-view:idstamp) "03")) + (should (looking-at-p "third")) + + ; Verify first cells was moved last + (kotl-mode:end-of-buffer) + (should (string= (kcell-view:idstamp) "01")) + (kotl-mode:beginning-of-cell) + (should (looking-at-p "first"))) + (delete-file kotl-file)))) + (provide 'kotl-mode-tests) ;;; kotl-mode-tests.el ends here