diff options
author | Thomas White <taw@physics.org> | 2023-04-29 18:38:44 +0200 |
---|---|---|
committer | Thomas White <taw@physics.org> | 2023-04-29 18:38:44 +0200 |
commit | befc9feebf514736f140b50e46f7076ececd3d88 (patch) | |
tree | e29d8ca3c834b8a127d55d8f0fa29b8bf0277e0a /guile/starlet/selection.scm | |
parent | 55a076a607b5e65f90f98e4e5e9bac5852df1d3e (diff) |
Add add-sel and toggle-sel
Diffstat (limited to 'guile/starlet/selection.scm')
-rw-r--r-- | guile/starlet/selection.scm | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/guile/starlet/selection.scm b/guile/starlet/selection.scm index 32be41a..d0f2c1d 100644 --- a/guile/starlet/selection.scm +++ b/guile/starlet/selection.scm @@ -22,6 +22,8 @@ #:use-module (starlet utils) #:use-module (srfi srfi-1) #:export (sel + add-sel + toggle-sel desel selection-hook get-selection @@ -46,6 +48,21 @@ (run-hook selection-hook selection)) +(define (toggle-sel . fixture-list) + (if (selected? fixture-list) + (desel fixture-list) + (add-sel fixture-list))) + + +(define (add-sel . fixture-list) + (set! selection + (append selection + (filter (lambda (fix) + (not (selected? fix))) + (flatten-sublists fixture-list)))) + (run-hook selection-hook selection)) + + (define (selected? . fixture-list) (every (lambda (fix) (memq fix selection)) |