summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--tissue/web/themes.scm13
1 files changed, 12 insertions, 1 deletions
diff --git a/tissue/web/themes.scm b/tissue/web/themes.scm
index f1a107c..21de09b 100644
--- a/tissue/web/themes.scm
+++ b/tissue/web/themes.scm
@@ -17,6 +17,7 @@
;;; along with tissue. If not, see <https://www.gnu.org/licenses/>.
(define-module (tissue web themes)
+ #:use-module (srfi srfi-26)
#:use-module (oop goops)
#:export (<search-page>
search-page-uri
@@ -27,7 +28,8 @@
search-page-matched-open-issues
search-page-matched-closed-issues
search-page-matched-documents
- search-page-matched-commits))
+ search-page-matched-commits
+ add-methods))
(define-class <search-page> ()
(uri #:getter search-page-uri #:init-keyword #:uri)
@@ -39,3 +41,12 @@
(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))