]> gitweb.factorcode.org Git - factor.git/commitdiff
help.markup: change related-words to notify definition observers for the affected...
authorJoe Groff <arcata@gmail.com>
Thu, 15 Sep 2011 21:40:37 +0000 (14:40 -0700)
committerJoe Groff <arcata@gmail.com>
Thu, 15 Sep 2011 22:55:54 +0000 (15:55 -0700)
basis/help/markup/markup.factor

index abc57118a35963d2ec2055972c18b331e38c33e9..38659efa8b80760e41ddac884842003df5862871 100644 (file)
@@ -1,12 +1,12 @@
 ! Copyright (C) 2005, 2009 Slava Pestov.
 ! See http://factorcode.org/license.txt for BSD license.
 USING: accessors arrays assocs classes colors colors.constants
-combinators combinators.smart definitions definitions.icons effects
-fry generic hashtables help.stylesheet help.topics io io.styles
-kernel make math namespaces parser present prettyprint
-prettyprint.stylesheet quotations see sequences sets slots
-sorting splitting strings urls vectors vocabs vocabs.loader
-words words.symbol ;
+combinators combinators.smart compiler.units definitions
+definitions.icons effects fry generic hashtables help.stylesheet
+help.topics io io.styles kernel locals make math namespaces
+parser present prettyprint prettyprint.stylesheet quotations
+see sequences sets slots sorting splitting strings urls vectors
+vocabs vocabs.loader words words.symbol ;
 FROM: prettyprint.sections => with-pprint ;
 FROM: namespaces => set ;
 IN: help.markup
@@ -277,8 +277,23 @@ PRIVATE>
 : $see-also ( topics -- )
     "See also" $heading $links ;
 
+<PRIVATE
+:: update-related-words ( words -- affected-words )
+    words words [| affected word |
+        word "related" [ affected union words ] change-word-prop
+    ] reduce ;
+
+:: clear-unrelated-words ( words affected-words -- )
+    affected-words words diff
+    [ "related" [ words diff ] change-word-prop ] each ;
+
+: notify-related-words ( affected-words -- )
+    [ dup associate notify-definition-observers ] each ;
+PRIVATE>
+
 : related-words ( seq -- )
-    dup '[ _ "related" set-word-prop ] each ;
+    dup update-related-words
+    [ clear-unrelated-words ] [ notify-related-words ] bi ;
 
 : $related ( element -- )
     first dup "related" word-prop remove