summaryrefslogtreecommitdiff
path: root/tissue
diff options
context:
space:
mode:
authorArun Isaac2023-01-22 22:30:13 +0000
committerArun Isaac2023-01-23 00:28:11 +0000
commitbdc092231eaf6dd1cd226d0bd6c6f429e21057e6 (patch)
treecdbcaa525d7f1ee589b1694eb288dc910bacd67a /tissue
parent02a366bd9718005defa4bf3e22e2848f02ef9682 (diff)
downloadtissue-bdc092231eaf6dd1cd226d0bd6c6f429e21057e6.tar.gz
tissue-bdc092231eaf6dd1cd226d0bd6c6f429e21057e6.tar.lz
tissue-bdc092231eaf6dd1cd226d0bd6c6f429e21057e6.zip
web: Deprecate add-methods.
Functionally setting generic functions (like add-methods does) doesn't work since methods can still refer to the old generic function. The future of generic functions in the theming system is in doubt. It must be rethought out carefully. * tissue/web/themes.scm (add-methods): Delete function. * tissue/web/themes/default.scm (default-theme): Replace add-methods! with add-method.
Diffstat (limited to 'tissue')
-rw-r--r--tissue/web/themes.scm14
-rw-r--r--tissue/web/themes/default.scm7
2 files changed, 6 insertions, 15 deletions
diff --git a/tissue/web/themes.scm b/tissue/web/themes.scm
index 21de09b..648d4d5 100644
--- a/tissue/web/themes.scm
+++ b/tissue/web/themes.scm
@@ -1,5 +1,5 @@
;;; tissue --- Text based issue tracker
-;;; Copyright © 2022 Arun Isaac <arunisaac@systemreboot.net>
+;;; Copyright © 2022, 2023 Arun Isaac <arunisaac@systemreboot.net>
;;;
;;; This file is part of tissue.
;;;
@@ -28,8 +28,7 @@
search-page-matched-open-issues
search-page-matched-closed-issues
search-page-matched-documents
- search-page-matched-commits
- add-methods))
+ search-page-matched-commits))
(define-class <search-page> ()
(uri #:getter search-page-uri #:init-keyword #:uri)
@@ -41,12 +40,3 @@
(matched-closed-issues #:getter search-page-matched-closed-issues #:init-keyword #:matched-closed-issues)
(matched-documents #:getter search-page-matched-documents #:init-keyword #:matched-documents)
(matched-commits #:getter search-page-matched-commits #:init-keyword #:matched-commits))
-
-(define (add-methods generic . methods)
- "Add @var{methods} to @var{generic} function. This is purely
-functional and operates on a copy of @var{generic}. It does not mutate
-@var{generic}."
- (let ((clone (shallow-clone generic)))
- (for-each (cut add-method! generic <>)
- methods)
- clone))
diff --git a/tissue/web/themes/default.scm b/tissue/web/themes/default.scm
index 7ab8c89..10732ee 100644
--- a/tissue/web/themes/default.scm
+++ b/tissue/web/themes/default.scm
@@ -1,5 +1,5 @@
;;; tissue --- Text based issue tracker
-;;; Copyright © 2022 Arun Isaac <arunisaac@systemreboot.net>
+;;; Copyright © 2022, 2023 Arun Isaac <arunisaac@systemreboot.net>
;;;
;;; This file is part of tissue.
;;;
@@ -113,10 +113,11 @@ theme.
@var{title} is the title to use in the head of the HTML. @var{css} is
a URI to a CSS stylesheet to link to. If it is @code{#f}, no
stylesheet is linked to."
- (add-methods render-sxml
+ (add-method! render-sxml
(make <method>
#:specializers (list <search-page-head> <search-page>)
- #:procedure (make-head-renderer title css))))
+ #:procedure (make-head-renderer title css)))
+ render-sxml)
(define-method (render-sxml (page <search-page>))
"Return SXML for @var{page}, a @code{<search-page>}."