branch: elpa/casual
commit 6e706eb0cc94a53a4b576cbdca56962dc1542c34
Merge: 766d6152a0 5fcbee8515
Author: Charles Choi <[email protected]>
Commit: GitHub <[email protected]>

    Merge pull request #353 from kickingvegas/cc/fix-html-autoloading
    
    Fix autoload for casual-html-tags-tmenu
---
 lisp/casual-html-utils.el       | 64 ------------------------------
 lisp/casual-html.el             | 62 +++++++++++++++++++++++++++++
 tests/test-casual-html-utils.el | 86 -----------------------------------------
 tests/test-casual-html.el       | 84 ++++++++++++++++++++++++++++++++++++++++
 4 files changed, 146 insertions(+), 150 deletions(-)

diff --git a/lisp/casual-html-utils.el b/lisp/casual-html-utils.el
index a3671701b5..89be020da5 100644
--- a/lisp/casual-html-utils.el
+++ b/lisp/casual-html-utils.el
@@ -44,69 +44,5 @@ plain ASCII-range string."
   "Open Info for Emacs HTML mode."
   (interactive) (info "(emacs) HTML Mode"))
 
-
-;; -------------------------------------------------------------------
-;; Transients
-;; TODO: move to support autoload
-(transient-define-prefix casual-html-tags-tmenu ()
-  "Transient menu for HTML tags.
-
-This menu provides an interface to HTML-specific commands provided by
-`html-mode' and `mhtml-mode' (see Info node `(emacs) HTML Mode')."
-  :refresh-suffixes t
-  ["Casual HTML Tags"
-   :inapt-if (lambda () (if buffer-read-only t nil))
-   ["Content"
-    :pad-keys t
-    ("p" "Paragraph" html-paragraph)
-    ("i" "Image…" html-image)
-    ("b" "Line Break" html-line)
-    ("hr" "Horizontal Rule" html-horizontal-rule)
-    ("d" "div" html-div)]
-
-   ["Anchor"
-    ("aa" "Anchor…" html-href-anchor)
-    ("af" "File…" html-href-anchor-file)
-    ("ai" "ID…" html-id-anchor)
-    ("an" "Name…" html-name-anchor)]
-
-   ["Format"
-    ("fb" "Bold" facemenu-set-bold)
-    ("fi" "Italic" facemenu-set-italic)
-    ("fl" "Bold Italic" facemenu-set-bold-italic)
-    ("fu" "Underline" facemenu-set-underline)
-    ("fd" "Default" facemenu-set-default)
-    ("ff" "Face…" facemenu-set-face)]
-
-   ["List"
-    ("u" "Unordered" html-unordered-list)
-    ("o" "Ordered" html-ordered-list)
-    ("l" "List Item" html-list-item)
-    ("r" "Radio Buttons…" html-radio-buttons)
-    ("c" "Checkboxes…" html-checkboxes)]
-
-   ["Navigation"
-    ("[" "|< >" sgml-skip-tag-backward :transient t)
-    ("]" " </>|" sgml-skip-tag-forward :transient t)
-    ("C-b" "←" backward-char :transient t)
-    ("C-f" "→" forward-char :transient t)
-    ("C-p" "↑" previous-line :transient t)
-    ("C-n" "↓" next-line :transient t)]]
-
-  ["Headline"
-   :inapt-if (lambda () (if buffer-read-only t nil))
-   :class transient-row
-   ("h1" "1" html-headline-1)
-   ("h2" "2" html-headline-2)
-   ("h3" "3" html-headline-3)
-   ("h4" "4" html-headline-4)
-   ("h5" "5" html-headline-5)
-   ("h6" "6" html-headline-6)]
-
-  [:class transient-row
-   (casual-lib-quit-one)
-   ("RET" "Dismiss" transient-quit-all)
-   (casual-lib-quit-all)])
-
 (provide 'casual-html-utils)
 ;;; casual-html-utils.el ends here
diff --git a/lisp/casual-html.el b/lisp/casual-html.el
index 0e4b468875..c43624d5ee 100644
--- a/lisp/casual-html.el
+++ b/lisp/casual-html.el
@@ -107,5 +107,67 @@ For more documentation, refer to the following links:
    ("RET" "Dismiss" transient-quit-all)
    (casual-lib-quit-all)])
 
+
+;;;###autoload (autoload 'casual-html-tags-tmenu "casual-html" nil t)
+(transient-define-prefix casual-html-tags-tmenu ()
+  "Transient menu for HTML tags.
+
+This menu provides an interface to HTML-specific commands provided by
+`html-mode' and `mhtml-mode' (see Info node `(emacs) HTML Mode')."
+  :refresh-suffixes t
+  ["Casual HTML Tags"
+   :inapt-if (lambda () (if buffer-read-only t nil))
+   ["Content"
+    :pad-keys t
+    ("p" "Paragraph" html-paragraph)
+    ("i" "Image…" html-image)
+    ("b" "Line Break" html-line)
+    ("hr" "Horizontal Rule" html-horizontal-rule)
+    ("d" "div" html-div)]
+
+   ["Anchor"
+    ("aa" "Anchor…" html-href-anchor)
+    ("af" "File…" html-href-anchor-file)
+    ("ai" "ID…" html-id-anchor)
+    ("an" "Name…" html-name-anchor)]
+
+   ["Format"
+    ("fb" "Bold" facemenu-set-bold)
+    ("fi" "Italic" facemenu-set-italic)
+    ("fl" "Bold Italic" facemenu-set-bold-italic)
+    ("fu" "Underline" facemenu-set-underline)
+    ("fd" "Default" facemenu-set-default)
+    ("ff" "Face…" facemenu-set-face)]
+
+   ["List"
+    ("u" "Unordered" html-unordered-list)
+    ("o" "Ordered" html-ordered-list)
+    ("l" "List Item" html-list-item)
+    ("r" "Radio Buttons…" html-radio-buttons)
+    ("c" "Checkboxes…" html-checkboxes)]
+
+   ["Navigation"
+    ("[" "|< >" sgml-skip-tag-backward :transient t)
+    ("]" " </>|" sgml-skip-tag-forward :transient t)
+    ("C-b" "←" backward-char :transient t)
+    ("C-f" "→" forward-char :transient t)
+    ("C-p" "↑" previous-line :transient t)
+    ("C-n" "↓" next-line :transient t)]]
+
+  ["Headline"
+   :inapt-if (lambda () (if buffer-read-only t nil))
+   :class transient-row
+   ("h1" "1" html-headline-1)
+   ("h2" "2" html-headline-2)
+   ("h3" "3" html-headline-3)
+   ("h4" "4" html-headline-4)
+   ("h5" "5" html-headline-5)
+   ("h6" "6" html-headline-6)]
+
+  [:class transient-row
+   (casual-lib-quit-one)
+   ("RET" "Dismiss" transient-quit-all)
+   (casual-lib-quit-all)])
+
 (provide 'casual-html)
 ;;; casual-html.el ends here
diff --git a/tests/test-casual-html-utils.el b/tests/test-casual-html-utils.el
index a162791f75..e120d48e05 100644
--- a/tests/test-casual-html-utils.el
+++ b/tests/test-casual-html-utils.el
@@ -36,91 +36,5 @@
     (should (string-equal (casual-html-unicode-get :previous) "↑"))
     (should (string-equal (casual-html-unicode-get :next) "↓"))))
 
-
- (ert-deftest test-casual-html-tags-tmenu ()
-  (let ((auto-insert-mode -1)
-        (temp-file-name "casual-html-tags-test.html"))
-    (casualt-html-setup temp-file-name)
-
-    (cl-letf ((casualt-mock #'html-paragraph)
-              (casualt-mock #'html-image)
-              (casualt-mock #'html-line)
-              (casualt-mock #'html-horizontal-rule)
-              (casualt-mock #'html-div)
-              (casualt-mock #'html-href-anchor)
-              (casualt-mock #'html-href-anchor-file)
-              (casualt-mock #'html-id-anchor)
-              (casualt-mock #'html-name-anchor)
-              (casualt-mock #'html-ordered-list)
-              (casualt-mock #'html-unordered-list)
-              (casualt-mock #'html-list-item)
-              (casualt-mock #'html-radio-buttons)
-              (casualt-mock #'html-checkboxes)
-              (casualt-mock #'html-headline-1)
-              (casualt-mock #'html-headline-2)
-              (casualt-mock #'html-headline-3)
-              (casualt-mock #'html-headline-4)
-              (casualt-mock #'html-headline-5)
-              (casualt-mock #'html-headline-6)
-
-              (casualt-mock #'facemenu-set-bold)
-              (casualt-mock #'facemenu-set-italic)
-              (casualt-mock #'facemenu-set-underline)
-              (casualt-mock #'facemenu-set-bold-italic)
-              (casualt-mock #'facemenu-set-default)
-              (casualt-mock #'facemenu-set-face)
-
-              (casualt-mock #'sgml-skip-tag-backward)
-              (casualt-mock #'sgml-skip-tag-forward)
-              (casualt-mock #'backward-char)
-              (casualt-mock #'forward-char)
-              (casualt-mock #'next-line)
-              (casualt-mock #'previous-line)
-
-              )
-
-      (let ((test-vectors
-             '(
-               (:binding "p" :command html-paragraph)
-               (:binding "i" :command html-image)
-               (:binding "b" :command html-line)
-               (:binding "hr" :command html-horizontal-rule)
-               (:binding "d" :command html-div)
-               (:binding "aa" :command html-href-anchor)
-               (:binding "af" :command html-href-anchor-file)
-               (:binding "ai" :command html-id-anchor)
-               (:binding "an" :command html-name-anchor)
-               (:binding "o" :command html-ordered-list)
-               (:binding "u" :command html-unordered-list)
-               (:binding "l" :command html-list-item)
-               (:binding "r" :command html-radio-buttons)
-               (:binding "c" :command html-checkboxes)
-               ;; (:binding "1" :command html-headline-1)
-               ;; (:binding "2" :command html-headline-2)
-               ;; (:binding "3" :command html-headline-3)
-               ;; (:binding "4" :command html-headline-4)
-               ;; (:binding "5" :command html-headline-5)
-               ;; (:binding "6" :command html-headline-6)
-
-               (:binding "fb" :command facemenu-set-bold)
-               (:binding "fi" :command facemenu-set-italic)
-               (:binding "fu" :command facemenu-set-underline)
-               (:binding "fl" :command facemenu-set-bold-italic)
-               (:binding "fd" :command facemenu-set-default)
-               (:binding "ff" :command facemenu-set-face)
-
-               (:binding "[" :command sgml-skip-tag-backward)
-               (:binding "]" :command sgml-skip-tag-forward)
-               (:binding "C-f" :command forward-char)
-               (:binding "C-b" :command backward-char)
-               (:binding "C-n" :command next-line)
-               (:binding "C-p" :command previous-line))))
-
-        (casualt-suffix-testcase-runner test-vectors
-                                        #'casual-html-tags-tmenu
-                                        '(lambda () (random 5000)))))
-    (casualt-html-breakdown temp-file-name)))
-
-
 (provide 'test-casual-html-utils)
 ;;; test-casual-html-utils.el ends here
diff --git a/tests/test-casual-html.el b/tests/test-casual-html.el
index 65789dc839..d66fa99087 100644
--- a/tests/test-casual-html.el
+++ b/tests/test-casual-html.el
@@ -76,5 +76,89 @@
                                         '(lambda () (random 5000)))))
     (casualt-html-breakdown temp-file-name)))
 
+(ert-deftest test-casual-html-tags-tmenu ()
+  (let ((auto-insert-mode -1)
+        (temp-file-name "casual-html-tags-test.html"))
+    (casualt-html-setup temp-file-name)
+
+    (cl-letf ((casualt-mock #'html-paragraph)
+              (casualt-mock #'html-image)
+              (casualt-mock #'html-line)
+              (casualt-mock #'html-horizontal-rule)
+              (casualt-mock #'html-div)
+              (casualt-mock #'html-href-anchor)
+              (casualt-mock #'html-href-anchor-file)
+              (casualt-mock #'html-id-anchor)
+              (casualt-mock #'html-name-anchor)
+              (casualt-mock #'html-ordered-list)
+              (casualt-mock #'html-unordered-list)
+              (casualt-mock #'html-list-item)
+              (casualt-mock #'html-radio-buttons)
+              (casualt-mock #'html-checkboxes)
+              (casualt-mock #'html-headline-1)
+              (casualt-mock #'html-headline-2)
+              (casualt-mock #'html-headline-3)
+              (casualt-mock #'html-headline-4)
+              (casualt-mock #'html-headline-5)
+              (casualt-mock #'html-headline-6)
+
+              (casualt-mock #'facemenu-set-bold)
+              (casualt-mock #'facemenu-set-italic)
+              (casualt-mock #'facemenu-set-underline)
+              (casualt-mock #'facemenu-set-bold-italic)
+              (casualt-mock #'facemenu-set-default)
+              (casualt-mock #'facemenu-set-face)
+
+              (casualt-mock #'sgml-skip-tag-backward)
+              (casualt-mock #'sgml-skip-tag-forward)
+              (casualt-mock #'backward-char)
+              (casualt-mock #'forward-char)
+              (casualt-mock #'next-line)
+              (casualt-mock #'previous-line)
+
+              )
+
+      (let ((test-vectors
+             '(
+               (:binding "p" :command html-paragraph)
+               (:binding "i" :command html-image)
+               (:binding "b" :command html-line)
+               (:binding "hr" :command html-horizontal-rule)
+               (:binding "d" :command html-div)
+               (:binding "aa" :command html-href-anchor)
+               (:binding "af" :command html-href-anchor-file)
+               (:binding "ai" :command html-id-anchor)
+               (:binding "an" :command html-name-anchor)
+               (:binding "o" :command html-ordered-list)
+               (:binding "u" :command html-unordered-list)
+               (:binding "l" :command html-list-item)
+               (:binding "r" :command html-radio-buttons)
+               (:binding "c" :command html-checkboxes)
+               ;; (:binding "1" :command html-headline-1)
+               ;; (:binding "2" :command html-headline-2)
+               ;; (:binding "3" :command html-headline-3)
+               ;; (:binding "4" :command html-headline-4)
+               ;; (:binding "5" :command html-headline-5)
+               ;; (:binding "6" :command html-headline-6)
+
+               (:binding "fb" :command facemenu-set-bold)
+               (:binding "fi" :command facemenu-set-italic)
+               (:binding "fu" :command facemenu-set-underline)
+               (:binding "fl" :command facemenu-set-bold-italic)
+               (:binding "fd" :command facemenu-set-default)
+               (:binding "ff" :command facemenu-set-face)
+
+               (:binding "[" :command sgml-skip-tag-backward)
+               (:binding "]" :command sgml-skip-tag-forward)
+               (:binding "C-f" :command forward-char)
+               (:binding "C-b" :command backward-char)
+               (:binding "C-n" :command next-line)
+               (:binding "C-p" :command previous-line))))
+
+        (casualt-suffix-testcase-runner test-vectors
+                                        #'casual-html-tags-tmenu
+                                        '(lambda () (random 5000)))))
+    (casualt-html-breakdown temp-file-name)))
+
 (provide 'test-casual-html)
 ;;; test-casual-html.el ends here

Reply via email to