1 %%% sbdm4cbpp.tex -- An advanced hypertext system for Emacs
3 %% Copyright (C) 2005 Joe Corneli <jcorneli@planetmath.org>
5 %% Time-stamp: <2006-06-08 14:29:13 jcorneli>
7 %% This program is free software: you can redistribute it and/or modify
8 %% it under the terms of the GNU Affero General Public License as published by
9 %% the Free Software Foundation, either version 3 of the License, or
10 %% (at your option) any later version.
12 %% This program is distributed in the hope that it will be useful,
13 %% but WITHOUT ANY WARRANTY; without even the implied warranty of
14 %% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 %% GNU Affero General Public License for more details.
17 %% You should have received a copy of the GNU Affero General Public License
18 %% along with this program. If not, see <http://www.gnu.org/licenses/>.
24 \documentclass[12pt
]{article
}
29 %\usepackage{hyperref}
33 %% Reformatting the index to be single column
36 \renewcommand{\theindex}{
37 \@restonecoltrue
\if@twocolumn\@restonecolfalse
\fi
39 \section*
{Index of Functions
}
41 \parskip\z@ plus
.3pt
\relax\let\item\@idxitem
42 \addcontentsline{toc
}{section
}{\numberline {}Index of Functions
}
46 %% Run this code to put all of the function definitions into the
47 %% index. (I'm not sure yet how to build an index of terms as well as
48 %% an index of functions.)
50 %% (while (re-search-forward "\\\\begin{lisp}\n(defun \\([^ ]+\\)")
51 %% (goto-char (match-beginning 0))
52 %% (insert (concat "\\index{" (match-string 1) "}\n"))
53 %% (search-forward "end{lisp}"))
55 % Use ``makeindex sbdm4cbpp'' to build the index & run latex multiple
56 % times to get everything settled.
60 \usepackage[round,authoryear,sort&compress
]{natbib
}
61 \bibliographystyle{plainnat
}
63 %% Does this mess up the ``works on a wholly free software system''
65 %%% \usepackage{simplemargins}
66 %% copying the below from simplemargins.sty, hopefully under fair use:
67 %% (this will save users from a dependency, whether free or non-free)
68 \newlength{\smpagewidth}
69 \newlength{\smpageheight}
71 \setlength{\smpagewidth}{8.5in
}
72 \setlength{\smpageheight}{11in
}
74 \addtolength{\textwidth}{\oddsidemargin}
75 \addtolength{\textwidth}{1in
}
76 \addtolength{\textwidth}{-
1in
}
77 \setlength{\oddsidemargin}{-
1in
}
78 \addtolength{\oddsidemargin}{1in
}
79 \setlength{\evensidemargin}{\oddsidemargin}
81 \setlength{\textwidth}{\smpagewidth}
82 \addtolength{\textwidth}{-
\oddsidemargin}
83 \addtolength{\textwidth}{-
1in
}
84 \addtolength{\textwidth}{-
1in
}
86 \addtolength{\textheight}{\topmargin}
87 \addtolength{\textheight}{1in
}
88 \addtolength{\textheight}{\headheight}
89 \addtolength{\textheight}{\headsep}
90 \addtolength{\textheight}{-
1.5in
}
91 \setlength{\topmargin}{-
1in
}
92 \addtolength{\topmargin}{-
\headheight}
93 \addtolength{\topmargin}{-
\headsep}
94 \addtolength{\topmargin}{1.5in
}
96 \setlength{\textheight}{\smpageheight}
97 \addtolength{\textheight}{-
\topmargin}
98 \addtolength{\textheight}{-
1in
}
99 \addtolength{\textheight}{-
\footskip}
100 \addtolength{\textheight}{-
.5in
}
101 %% end copied portion.
103 %% (And this is what it replaces.)
104 % \setleftmargin{1in}
105 % \setrightmargin{1in}
106 % \settopmargin{1.5in}
107 % \setbottommargin{.5in}
109 \usepackage[normalem
]{ulem
}
111 \usepackage[mathscr
]{euscript
}
112 \usepackage[T1]{fontenc}
120 \theoremstyle{definition
}
121 \newtheorem{prop
}{Proposition
}
122 \newtheorem{nota
}{Note
}[section
]
123 \newtheorem{rem
}{Editorial Remark
}[section
]
124 \newtheorem{lem
}{Lemma
}
125 \newtheorem{thm
}{Theorem
}
126 \newtheorem{cor
}{Corollary
}
127 \newtheorem{con
}{Conjecture
}
129 \usepackage{verbatim
}
131 \newenvironment{lisp
}
132 {\let\ORGverbatim@font
\verbatim@font
133 \def\verbatim@font
{\ttfamily\scshape}%
136 \let\verbatim@font
\ORGverbatim@font
}
140 \newenvironment{idea
}
141 {\let\ORGverbatim@font
\verbatim@font
143 \def\verbatim@font
{\ttfamily\slshape}%
146 \let\verbatim@font
\ORGverbatim@font
}
149 \newenvironment{notate
}[1]
150 {\begin{nota
}[{\bf {\em #1}}]}%
153 \newenvironment{note
}[1]
154 {\begin{nota
}[{\bf {\em #1}}]}%
157 \newenvironment{edit
}[1]
158 {\begin{rem
}[{\bf {\em #1}}]\sl}%
159 {\normalfont\end{rem
}}
161 \newcommand{\comm}[1]{
162 \sf \fbox{\begin{minipage
}{.75\textwidth}#1\end{minipage
}} \normalfont}
164 \newcommand{\inp}[1]{\sl#1\normalfont}
166 \newcommand{\xref}[1]{\ref{#1}}
168 %% Geh! $\chi$ with a subscript is typeset badly if you
169 %% don't put in a fake superscript, what's up with that?
170 %% Of course, if you use a function with a fake superscript,
171 %% you can't very well add another superscipt to it, can you!
174 %% But, maybe I could make one required argument and
175 %% a second optional argument and solve the problem that
176 %% way? -- Well, LaTeX lets you have one optional argument
177 %% alright, but it wants the optional argument to be the first
178 %% argument, and I don't see any easy way around that. I
179 %% guess I could ask an expert sometime, but it doesn't quite
180 %% seem worth it. OTOH, this issue of typesetting chi's is
181 %% a bit of a bug, I think, so maybe it should be reported.
182 \newcommand{\indicator}[1]{\chi_{#1}^
{}}
186 \title{\emph{Arxana
}}
188 \author{Joseph Corneli
\thanks{The content of this file is available
189 under your choice of the GNU Free Documentation License (FDL) and
190 the GNU General Public License (GPL). If the FDL is selected, be
191 advised that this
document has no Invariant Sections, no
192 Front-Cover Texts, and and no Back-Cover Texts.
}}
194 \date{\today\ (draft)
}
198 %% The system's design draws on ideas from Ted Nelson's ``Project
199 %% Xanadu'', combining them with the ``semantic network'' strategy
200 %% from artificial intelligence.
202 \abstract{A scholia-based
document model for commons-based peer
203 production informs an advanced Emacs-based hypertext system.
}
205 %% 1. Revise links and backlinks.
207 %% 2. Put together an appendix with simple specs. (Done for the
208 %% basic objects; not necessarily with all of the operations that
209 %% effect these objects.)
211 %% 3. After that, there are many user-friendly features that one could
212 %% tackle. Additional history lists for multi-dimensional browsing,
213 %% various useful consistency-maintaining features (not unlike
214 %% mascons!), versioning support, and so on. Presumably many of these
215 %% items can be left for other people to work on after the release.
217 %% 4. I still haven't completely worked out the theory of
218 %% "transclusion" (live-updating quotes) to my satisfaction, and this
219 %% (and its bi-directional variant, "identification") is the "killer
220 %% ap" I'd like to get into the software before I release it.
228 This
document may look like a paper, but it is also runable code.
229 The code implements a hypertext system. You can use this
230 hypertext system to browse and edit the code and documentation
231 that describes the system itself.
233 To do that, when viewing the
document's source code with Emacs,
234 evaluate this form (in place):
239 (let ((beg (search-forward "\
\begin{verbatim
}"))
240 (end (progn (search-forward "\
\end{verbatim
}")
241 (match-beginning
0))))
242 (eval-region beg end)
244 (browse-scholium-system))))
247 \section{Prelude
} \label{prelude
}
249 \begin{notate
}{The philosophy
} \label{the-philosophy
}
250 The main concern here is to model systems for collaborative
251 authorship. What freedoms and limitations are embodied in such
252 systems? Working to understand how to empower users will hopefully
253 enable us to build a powerful and agile system; indeed, our goals here
254 extend beyond ``authorship'', to ``readership'' and query-answering;
255 that is, from hypertext to artificial intelligence.
258 \begin{notate
}{SBDM and CBPP
}
259 The idea of a
\emph{scholia-based
document model
} (
\emph{SBDM
}) for
260 \emph{commons-based peer production
} (
\emph{CBPP
}) is thematic for the
261 work. Definitions for these terms suitable to the usage made within
262 this
document are approximately as follows:
264 \item \emph{CBPP
}: the processes by which shared information resources
265 are produced by multiple co-authors.
266 \item \emph{SBDM
}: a framework for understanding the ways in which
267 documents are put together out of smaller inter-referential
272 \begin{notate
}{Bits and pieces
} \label{bits-and-pieces
}
273 Scholia-based documents tend to be comprised of small pieces whose
274 semantic content has been illuminated through an ongoing process of
275 annotation. This helps with refactoring, and with the process of
276 producing new, meaningful, derivative works. Rich annotation also
277 opens the way to increasingly powerful computer-based inference about
278 the content of the
document. This
document should be a good example.
282 % \includegraphics[width=5in]{bw}
284 \caption{Author and summarizing example (
\emph{apr\`es
} L. Weiner).
\label{author-as-scholium
}}
288 \section{Introduction
} \label{introduction
}
290 \begin{notate
}{A scholia-based
document model for commons-based peer production
} \label{sbdm4cbpp
}
291 The fundamental data structure used in this
report is a simple
292 database made up of
\emph{articles
}, each of which has several
293 freeform components. An article's
\inp{name
} is an arbitrary LISP
294 object, typically a string (two articles with the same name are
295 considered to be the same). The articles can contain
\inp{text
} from
296 a string, buffer, or file (as well as from other sources). An article
297 is supplied with
\inp{about
} and
\inp{type
} metadata which say,
298 respectively, what other pieces of the
document the articles are
299 about, and generally how they are to be treated by the system. A
300 collection of articles can be viewed as a semantic network, with links
301 from which
\inp{about
} data is constituted comprising the edges
302 between nodes (Note
\ref{links
}). (There are other sorts of links in
303 the system as well, cf. Note
\ref{clusions
}.) Linking is how scholia
304 are attached to other articles; the collection of all articles is
305 ``the commons''; and the rules for interacting with this collection
306 defines the commons's regulatory system.
309 \begin{notate
}{Inspirations
} \label{inspirations
}
310 One of the first things that got me thinking about this stuff was the
311 question of how to combine the contents of two digital libraries in a
312 useful and non-disruptive way
\footnote{{\tt
313 http://planetx.cc.vt.edu/AsteroidMeta/one
\_week\_in\_october}}.
314 From here, the more technical question of how to do bidirectional
315 updating between two digital libraries which share content and are
316 changing in real time arose (see Section
\ref{bidi
}). But probably
317 the most basic motivation comes from thinking about knowledge
318 representation and human interface for the Hyperreal Dictionary of
319 Mathematics project. The aim of this project is to get the wolrd's
320 mathematical knowledge into a coherent machine-readable and
321 humanly-useful form. I anticipate that the first major applications
322 of Arxana will be those directed towards building the HDM (see Section
325 After thinking about these things for a while, I wrote up a few pages
326 that expressed some ideas I later learned to be the central notions in
327 Ted Nelson's Project Xanadu (see Note
\ref{relationship-to-xanadu
}).
328 My interest in AI explains some of the differences between the two
329 designs; but the fact that I've chosen to use Emacs for development
330 probably explains even more.
332 Certainly the powerful text processing tools available in Emacs
333 (ranging from text properties and overlays to self-modifying code)
334 make it a great place to develop a next-generation hypertext system.
335 Existing Emacs-based hypertext systems, including the emacs-wiki
336 family of projects, and of course the built-in info and help
337 subsystems, give some sense of how useful Emacs-based hypertext can
340 Much of the attitude towards AI developed here inherits from Minsky's
341 ``Society of Mind''. In addition, a certain amount of experience
342 working with contemporary AI systems (Cyc and KM) both got me to think
343 about what an AI system is and what I would like to see ``AI work''
346 The style of writing is inspired by Knuth's ``
\TeX: the program''.
347 Here, instead of a typesetting program that can be used to typeset a
348 description of itself, we have a hypertext system that can be used to
349 browse and edit a description of itself. (Emacs had in fact pulled
350 that one off previously, and to great effect, but in a rather
353 User freedom is probably the premier philosophical concern underlying
354 this endeavor. My ideas about online freedom have something to do
355 with what I know about MUDs (which isn't a whole lot; mainly that they
356 are sometimes user-hackable and that they resemble the text-based
357 single-user games with which I am more familiar) and with my
358 experience as a participant in various CBPP environments.
360 Section
\ref{philosophy
} delves further into these matters.
363 \begin{notate
}{Straightforward applications
} \label{straightforward-applications
}
364 Although I am envisioning the system being used to work on projects of
365 grand scope and vision, it can also be used in some down-to-earth ways
366 that are relevant to many people: for instance, the system can be used
367 by
document co-authors to annotate and comment on successive drafts of
368 an evolving paper. Features to aid in this process have been present
369 in MS Word for some time, to the best of my knowledge. (And in ASCII
370 you can do it with brackets
[ins: like this :ins
], OR WITH CAPS.)
372 (Getting things set up to make quick and easy side-comments on a
373 given text would be nice.)
376 \begin{notate
}{Acknowledgements
} \label{acknowledgements
}
377 Aaron Krowne both helped inspire the initial design (through a series
378 of discussions about PlanetMath, the HDM project, and bi-directional
379 updating between digital libraries) and helped to give it a coherent
380 initial expression
\footnote{\label{corneli-krowne
}Joseph A. Corneli
381 and Aaron P. Krowne, A scholia-based
document model for commons-based
382 peer production.
\emph{Proceedings of the Emory University Symposium
383 on Free Culture and the Digital Library
},
2005.
}.
385 Ray Puzio helped to put the project on a sound theoretical and
386 philosophical foundation as it developed.
389 \subsection{Overview of the system
} \label{overview
}
391 \begin{notate
}{Scholia
} \label{scholia
}
392 A ``scholium'' (plural ``scholia'') is a comment on something else.
393 We speak of a
\emph{scholia-based
document model
} (or SBDM for short)
394 because speech is typically
\emph{about
} something. We also refer to
395 elements of the larger
document as ``articles''. If an article isn't
396 \inp{about
} anything (in the technical sense described in Note
397 \ref{definition-of-scholium
}) then then it is considered to be
398 degenerate as a scholium. We will also talk about ``an article and
399 its attached scholia'' (regardless of whether or not the article is
400 itself a scholium attached to some other article). Scholia need not
401 be pieces of text: they can also be code or markup telling the reader
402 (or the computer) how to process the article(s) they are written
406 \begin{notate
}{Generalized links
} \label{generalized-links
}
407 The
\inp{about
} features described in Note
\ref{scholia
} naturally
408 associate documents or parts of documents with one another. This
409 generalizes the notion of
\emph{link
} familiar from the web (and other
410 places). These familiar links are pieces of text with special markup
411 which say that are about some other piece of text:
413 <a href="
document this link is about">text</a>
415 In the scholium system, links can overlap and can point at more
416 different kinds of targets than in typical hypertext systems. Links
417 can also be given rich semantic properties by pairing them with
418 additional
\inp{type
} data and appropriately responsive procedures.
420 It is important to understand the fact that, in our system, markup and
421 metadata are typically stored as scholia linked to appropriate
425 \begin{notate
}{Modeling the commons
} \label{modeling-the-commons
}
426 In addition to being capable of modeling many different kinds of
427 documents, the system developed here should be capable of modeling
428 and/or supporting the relevant features of the CBPP processes that
429 create these documents. The SBDM is actually intended as a sort of
430 meta-model: a model for modeling models, including models of
431 documents, commonses, social contracts, culture building, and culture
432 change. Cf. Section
\ref{experiments
} and Note
\ref{the-system
}.
435 \begin{notate
}{Relationship to Xanadu
} \label{relationship-to-xanadu
}
436 The system presented here isn't meant to be an implementation of the
437 Xanadu idea, per se, although it provides some of the features one
438 would expect from a ``Xanadu implementation.''
440 I should probably mention that I haven't read all of Nelson's stuff
441 extra-closely, although I've looked through his books and enjoyed what
442 I saw there. As the system here moves towards greater usability, I
443 assume I'll find the time to review the details from Nelson's writing
444 more closely and flesh out this comparison. And I hope to have a
445 chance to review other systems that follow in the Xanadu lineage, e.g.
446 {\tt token
\_word}\footnote{{\tt
447 http://hypertext.sourceforge.net/token
\_word/
}} (which supposedly
448 implements ``almost every core feature of Xanadu''). I guess it's the
449 hacker in me that makes me want to write the code first; and
450 certainly, the nature of the code I've produced thus far lends itself
451 to being helpful with literature review tasks
452 (cf. Note
\ref{literature-review
}). I'm pretty sure that this work
453 represents an advance, or at least steps in a new direction, for
454 Emacs-based hypertext.
456 One clear difference between this system and the Xanadu system is that
457 here articles are not supposed to be presented in a pay-to-access
458 fashion. The idea of working on complicated systems for royalties or
459 license maintenance doesn't strike me as particularly compelling.
460 Also, in this system, articles can be deleted (see Note
461 \ref{deleting-articles
}), which as I understand it, is discouraged in
462 Xanadu (more investigation is warranted and the system for deletion
463 here needs finishing!).
465 To sum up, my overall sense is that Arxana, combined with simple
466 internet protocols could, very nicely, facilitate something
467 Xanadu-like, suitable for the current age.
470 \begin{notate
}{When implementing something new
}
471 It is good to have an illustration of why the system is special and
472 different, and why it is also compatible with existing ways of
473 working. This is true whether the system is based on code or mores
474 (e.g. why are principles of freedom important online?). I'll be
475 devoting more time to making these illustrations in the future. I
476 expect that such illustrations will do a lot to underscore the value
477 of the framework developed in this
document (and, indeed, value is
478 often most obvious in the more concrete manifestations and examples of
479 a more general system). Cf. Note
\ref{principle-of-orthogonality
}.
482 \begin{notate
}{What doesn't work or needs debugging
} \label{doesn't
}
483 Here are some more details on things that we're planning to provide
484 at some point but haven't finished yet.
486 \item We should support threaded followups and make other improvements
487 to the display (see Note
\ref{threading
}).
488 \item ``Labels'' work but ``namespaces'' haven't been implemented yet
489 (see Note
\ref{labels-and-namespaces
}).
490 \item We don't yet have support for ``actionable'' articles (see
491 Note
\ref{interactive-and-actionable-scholia
}).
492 \item Various browsing features could be improved and extended
493 (e.g. to enable deletion or editing of some subset of articles en
494 masse), and probably debugged (especially the code from Section
495 \ref{temporal
}). The history mechanism could probably be debugged
497 \item We haven't fully finished the code for deleting (Section
499 \item Committing could stand to be beefed up with versioning (see Note
500 \ref{we-adopt-a-versioned-model
}).
501 \item We don't yet have support for saving articles selectively. In
502 particular, we hope to add support for saving only new or modified
503 articles soon (but of course also for other predicates).
504 \item Support for derivative articles is somewhat lacking (Section
505 \ref{derivative
}); in particular, I've done some work and sketching
506 for transclusion and identification (Sections
\ref{transclusion
} and
507 \ref{identification
}) but I'm not yet happy with the results and
508 have instead had to seek a temporary work-around . These are some
509 of the trickest technical problems tackled in this
document (see
510 Note
\ref{difficulties-with-text-properties
}). However, they should
511 also be some of the ``killer aps'' when they are finished.
512 \item Support for working in a distributed environment is lacking.
513 I plan to add ``native'' support for CVS and/or GNU Arch
514 soon
\footnote{{\tt http://www.gnuarch.org/arch/how-arch-works.html
}}.
515 \item Several of the experiments we describe haven't been attempted
517 \item Increased standardization and various other improvements should
518 be effected throughout.
519 \item We need to check and expand support for buffers and files within
520 the scholium system; see
\ref{principle-of-orthogonality
}. The
521 question of scholia attached to the Scholia Display buffer may prove
522 to be an especially annoying case; where will these be displayed?
523 More generally and less confusingly, what should be done with
524 scholia attached to buffers that have frequently-changing content?
525 Perhaps these scholia can somehow be associated with those changes,
526 and swapped in and out programmatically whenever the changes occur.
527 We should debug the `display-scholia-about-current-buffer' function.
528 See Note
\ref{killed-buffers
} for an example of the sort of problem
529 we have to deal with here. (By keeping articles and buffers
530 separate, we've made the first step towards insuring orthogonality,
531 but we want to be sure of usefulness, too, e.g. by improving default
532 loading of scholia for buffers.)
533 \item We need to check how this loads against a plain-vanilla Emacs,
534 and probably provide some easier means of getting started.
535 \item Make it so that `sch-plain-text' (Note
\ref{sch-plain-text
}) can
536 display links. In fact, we might want to always have it take in
537 links, or the unlistified contents of links. See Note
539 \item We should finish the functions for browsing parents; cf. Note
540 \ref{forward-in-parent
}.
541 \item Has the problem with committing a
document that has a links at
542 the start of its display been resolved?
543 \item The system should be documented with use cases for all of its
544 features; at least the basic ones.
546 Given that the basic system does work and hopefully provides an
547 exciting glimpse of what is possible here, now seems to be a
548 reasonable time to invite other people to help with some of these
552 \begin{notate
}{Streamlined versions of this
document}
553 As mentioned in Note
\ref{bits-and-pieces
}, the system makes it easy
554 to produce certain kinds of derivative versions of a
document. Two
555 examples that may be helpful particularly helpful to readers are a
556 version that focuses on code (see Note
\ref{with-code
}), and a version
557 that steers clear of code (see Note
\ref{without-code
}). Compare
558 ``weave'' and ``tangle''. (Of course, I do suggest reading everything
559 at some point; see Note
\ref{motto
}.)
562 \begin{notate
}{A motto
} \label{motto
}
563 Certain issues cannot be resolved without writing code.
566 \subsection{Design issues
} \label{design
}
568 \begin{notate
}{Introduction to design issues
}
569 Some of the key
\emph{development issues
} have been sketched in the
570 previous section. Here we discuss the issues that come in at the
571 level of
\emph{design
}.
574 \subsubsection{Design principles
}
576 \begin{notate
}{Principle of minimality
} \label{principle-of-minimality
}
577 This system could be infinitely complex. At each turn, we try to
578 stick to minimal implementations first and then work out from there.
581 \begin{notate
}{Principle of order
} \label{principle-of-order
}
582 Functions and variables should not be used before they are defined.
583 (There is a related principle of context that is harder to express:
584 the idea there is that things should be defined in places that make
585 sense.) Any exceptions to this rule should be carefully considered.
588 \begin{notate
}{Principle of transparency
} \label{principle-of-transparency
}
589 It would be nice not to have features that disrupt the easy and
590 completely general flow of the code, but this seems very hard
591 to accomplish. We can at least try to be aware of the places where such
592 losses of generality appear, and make some assessment of the
593 consequences (and possible future remedies), and certainly try
594 to avoid losses of generality whenever possible.
597 \begin{notate
}{Principle of orthogonality
} \label{principle-of-orthogonality
}
598 In order to make this system work well with the rest of Emacs, it
599 should be roughly orthogonal to the rest of Emacs. It should not
600 require you to go off into your own little world, nor should it
601 require redefining basic functions, or otherwise change what people
602 are used to in terribly significant ways.
605 \subsubsection{System architecture
}
607 \begin{notate
}{The principles of the architecture
}
608 The system is built on the principle of a
\emph{semantic network
}.
609 Articles correspond roughly to the
\emph{nodes
} of a graph, and
610 link-backlink pairs to the
\emph{edges
}. Both of these types of
611 objects can bear labels with certain structured information on them.
612 (Actually, labels on links are sub-frames of the labels on articles;
613 and labels on backlinks are derived from data about the linking
614 article (I guess you could call that an ``induced subframe'' or
615 ``derivative subframe'' -- the issues having to do with where the
616 knowledge is stored, e.g., where you might store the query that tells
617 you which thing is a derivative, or one particular sort of derivative,
618 are in my opinion a philosophical issue beyond the scope of what we
619 wish to get involved with in this paragraph) and anyway, all
620 information
\emph{in
} the system is stored on articles. But we don't
621 really need to go there now either.) We could just say ``frame'' and
622 ``subframe'' and keep it simple. But note that these are the
623 \emph{internal
} frameworks of the system, not the content frameworks
624 or whatever you want to call that. That really just about sums up the
625 architecture of the system itself.
628 \begin{notate
}{Metaprinciples of the architecture
}
629 Eventually we want to get things like code that defines the system to
630 be ``understood'' by the system in some way. These are semantic
631 networks, so saying that they can understand something is moderately
632 appropriate. Right now, the code is just imported into the system in
633 a bulk fashion. But eventually the functions could go into the
634 article table. Really, the fact of the matter is that later we want
635 to put the fundamental object arrays for Emacs into the article table
636 too, so that the whole computation that is Emacs becomes a massive and
637 somewhat complicated scholium based
document evolving in time. So,
638 now we get a sense of what it means to be self-documenting to the
639 extreme. (Now, per usual, we just modeling something that is already
640 there, and is already documented to a certain extent by itself, maybe
641 to a richer extent then you might think.) Getting Emacs embedded in
642 the scholium system is the next step after getting the system somewhat
643 roughly embedded in itself. (So, this might be an interesting thing
644 for the LISP crowd to think about; and indeed, it provides a sort of
645 metaphor for the structure of the HDM itself.)
647 To sum that up, and to conclude! We want to make the system
648 increasingly cognisant of itself. If it doesn't make sense to look at
649 all of the processes going on inside of Emacs, for example, then we
650 don't look at all of these processes. But to the extent that it is
651 useful to look at the details of a given process, it would be helpful
652 to track that process in the scholium system. (One question we might
653 ask ourselves is when exactly is it useful to track a given process,
654 noting that we are often tracking the process through time, if it is a
655 computation, and then most likely examining the trace later. However,
656 you could also set things up so that you could look at the trace from
657 different parts of it that are evolving. Of course, you can't look
658 into the future, you can only look at nodes that have already been
659 computed. But you could get a look-ahead effect going within your
660 computation that would know where to look ahead of time, so that its
661 journey to retrieve the answer begins before the answer has actually
662 been recieved, and the query process meets up with the answer just in
663 time. And that would be fairly tricky!
666 \begin{notate
}{Architectural implementation
}
667 The system is currently implemented as a hash table of articles; the
668 format for these is explained later on in this
document, mainly in
669 Section
\ref{definition-of-scholium
}.
672 \subsubsection{Stylistic considerations
} \label{stylistic-considerations
}
674 \begin{notate
}{Backend and frontend
}
675 To the extent that it is possible, we should distinguish between the
676 backend and the frontend of the system. We could rewrite the backend
677 in scheme, for example, and rewrite the frontend in various
678 web-programming languages to make a system that is easy to use over
682 \begin{notate
}{Abstracting access
} \label{abstract-access
}
683 Since we may eventually support both lists and hash tables (and
684 perhaps other things), we presumably should have an abstract means of
685 accessing articles. (Unless we were to decide to just do things with
686 hash tables; however, it seems likely to me that even if we use a hash
687 table as the main library, people may want to use lists for
688 sublibraries; if the same functions for access are supposed to be used
689 in both full and sub library scenarios, we'll want the abstract access
690 regardless of how the full library is set up.) A theoretical
691 discussion of the benefits of hash tables can be found on
692 PlanetMath
\footnote{{\tt http://planetmath.org/encyclopedia/Hashing.html
}}.
695 \begin{notate
}{The Emacs Way
} \label{the-emacs-way
}
696 Scholia about files and about buffers are probably most of what would
697 make this system useful to people who are collaborating on papers or
698 coding projects. See Note
\ref{bias-towards-buffers
}, Note,
702 \begin{notate
}{Intuitive interface
}
703 The bread and butter of the system's user interface is a set-up with
704 side by side buffers (see Note
\ref{side-by-side-buffers
}). Other
705 display styles (e.g. as described in Note
\ref{references
}, or
706 threading, as in Note
\ref{threading
}, or a display spread across
707 several frames, etc.) should be straightforward to add.
710 \begin{notate
}{Text properties and overlays
} \label{text-properties-and-overlays
}
711 We essentially need to have scholia encoded locally as text
712 properties, because we need to be able to cut and paste the elements
713 and have the metadata transfered along. However, at least one aspect
714 of text properties is already ``owned'' by fontlock, namely faces. To
715 use faces in the scholium system, we have to hack an override in --
716 namely, we mark the buffer up using text properties and then mark them
717 up again with overlays. In general, text properties are used to track
718 text, and overlays are just used as a visual aide. See section
719 \ref{marking-things-up
}, also Note
\ref{reparsing-after-editing
}.
722 \begin{notate
}{Managing text properties in buffers
} \label{managing-properties-in-buffers
}
723 We store information about
\emph{all
} attached scholia on text
724 property lists. We should also be storing the name of the article on
725 all of the text throughout the buffer, so that if the contents of that
726 buffer are cut and pasted, the text can be tracked. This requires a
727 somewhat complex data structure, and makes markup with overlays (as
728 well as some other details, e.g. text marked up with references which
729 is subsequently cut in half) tricky either in practice or
730 conceptually. See Note
\ref{reparsing-after-editing
}.
731 %% (These issues are rather different from the topic of managing
732 %% properties associated with articles \emph{themselves}, which is
733 %% discussed in Section \ref{managing-properties}.)
736 \begin{notate
}{Selection methods
} \label{selection-methods
}
737 Various selection facilities need to be implemented. A little
738 predicate matching thing would make things extensible! (See also Note
739 \ref{selective-displays
} and Note
740 \ref{predicate-support-for-listing
}.)
743 \begin{notate
}{Local navigation
}
744 It is important to have convenient ways to move around from scholium
745 to marked region and back, from marked region to marked region, and so
746 on. See Section
\ref{local
}.
749 \begin{notate
}{Color and style of display
} \label{color-and-style
}
750 We could offer the user a choice between
\inp{type
}-based coloration
751 (indicating what sort of scholium is being marked up),
752 owner-coloration (who created the scholium) and connected-coloration
753 (which what I've initially coded up). We could use some combination
754 of
color and other visual indicators (see Note
\ref{monochrome
}) to
755 provide more information.
757 Similarly, text written by a given author in a shared file could have
758 a special
color. Another type of display would indicate how many
759 scholia had been created about a given region (like a rainfall chart).
760 Different styles can be generated essentially indefinitely. Another
761 user-friendly feature would be to be able to easily change the
color
762 associated with some particular set of data (rather than changing the
763 overall scheme whereby colors are associated with data).
766 \begin{notate
}{The monochrome lifestyle
} \label{monochrome
}
767 For the benefit of people working with and without fontlock, three
768 display modes to point to attached scholia from Window $A$ will be
769 available: one that uses font lock; one that uses intangible tokens
770 {\tt [N:
]} and
{\tt [:N
]} where
{\tt N
} is a number to demarcate the
771 beginning and end of the $N$th scholium (or some other customizable
772 pattern, e.g. based on the bookkeeping information); and a third
773 ``relaxed'' mode uses no markup at all. A number of intuitive ideas
774 for inserting indicators (e.g. in the fringe) could be tried. See
775 \ref{blinking
} for another monochrome-friendly approach. Another
776 simple idea, similar to the one described above, would be to use
777 % Thanks /sw/share/texmf-dist/source/plain/impatient/
778 symbols (e.g. $*$, $\#$,
\S) to associate scholia with the
779 beginning(s) of the passage(s) they are attached to, and use narrowing
780 to screen out other material.
783 \begin{notate
}{User-crafted semantics
} \label{user-crafted-semantics
}
784 As a generalization of Note
\ref{color-and-style
}, we will eventually
785 want some essentially completely different styles of rendering. In
786 every case we should also move to support
\emph{user-crafted
787 semantics
}. See also Note
\ref{types-of-text
}.
790 \begin{notate
}{Contextual display
} \label{contextual-display
}
791 An interesting feature would be to restrict to showing only the
792 scholia that are attached to the current portion of the main article
793 that is currently displayed, or only those associated with the
794 character position of point. In order to pull this off, we will need
795 to look some into page and cursor motion in Emacs
\footnote{Thanks to Stephen Monnier and Eli Zaretskii for
796 telling me what to look for, on the emacs-devel list,
2006-
04-
04. The relevant tips were to look at:
797 `window-scroll-functions' (when a window's starting pos changes);
798 `fontification-functions' (when a piece of text needs to be displayed);
799 `before-' and `after-change-functions' (when a piece of text is modified);
800 `window-start' and `window-end';
801 `pre-' and `post-command-hook' (to run before/after each command, so you can
802 detect cursor motion).
}.
804 Alternatively, we could write a new motion function, something like
805 `move-to-next-region-with-scholium' (cf. Note
806 \ref{move-to-next-or-previous-region-with-scholium
}), and combine this
807 with a selective scholia display that will show whatever scholia are
808 found at the new point. The closest thing I could find in Emacs is
809 `calendar-move-hook'.
811 Yet another thought along these lines would be to have scholia appear
812 in the same buffer as the rendered main article, but, for example, in
813 columns beyond column
72 (or whatever the rightmost character in the
814 display of the main article is).
816 Compare Note
\ref{displaying-nearby-scholia
} for thoughts on automatic
817 \emph{contextualization
} of an article at display time.
820 \begin{notate
}{References
} \label{references
}
821 Traditional hypertext links are a useful specialization of the general
822 sort of links we're developing here (Note
\ref{generalized-links
}).
823 In an effort to reduce confusion, when we wish to be precise, we will
824 refer to the scholia that are used to make a piece of text point at
825 other piece of text as
\emph{references
}. This usage is consonant
826 with use in other hypertext systems, in which ``links'' are pieces of
827 text that are marked up with references to other texts.
829 Despite the time it may take to get used to the name, the familiar
830 \emph{feel
} of references should make it easy for people familiar with
831 other hypertext systems to transition to this system.
833 References are an example of a type of scholium that appears as markup
834 instead of appearing ``alongside'' the article they are attached to
835 (which is what will typically happen with other scholia). References
836 may have special semantics associated with them, see Note
837 \ref{special-reference-types
} and Note
\ref{fancy-references
}.
839 It may be convenient to offer allow switching between our overlayed
840 references and the more familiar inline, wiki-like, references, or at
841 the very least, some other way to easily edit reference targets (and
842 similarly for other sorts of links). See Section
\ref{wiki
} for
843 various information on simulating a wiki with the scholium system.
846 \begin{notate
}{Threading
} \label{threading
}
847 We can also provide facilities for showing all attached scholia
848 together with
\emph{their
} attachments, and so on, within some fixed
849 graph distance, beyond which we just include links to lower levels (as
850 yet
\emph{unimplemented
} - but a good idea). This is essentially
851 what's done on Slashdot, and we would want to use a similar indenting
852 (and, ergo, threading) mechanism. (We could be even more
853 Slashdot-like and do scoring and the whole bit.) The thing to bear in
854 mind is that we dont' have to be constrained to follow threads along
855 one ``follow-up-to'' axis; we can choose arbitrary conditions to
856 constrain the way we view a local hierarchy (cf. Note
857 \ref{hierarchy
}). The simplest one to state is the one already
858 mentioned, namely, viewing all attached scholia to some depth.
861 \begin{notate
}{Ancestors
} \label{ancestors
}
862 We typically think about showing a article together with articles that
863 are about it (its scholia) but we can just as well show it together
864 with articles that it is about (its referents). Indeed, views that
865 take into consideration the article's parents and grandparents have
866 obvious applications, e.g., when attempting to follow a conversation.
867 Particularly if an article has no children itself, it may be handiest
868 to display it together with its parent (multiple parents could
869 potentially complicate the matter). These issues have been taken up
870 to some degree in various places in this
document, including
871 Note
\ref{more-than-one-parent
} and Note
872 \ref{add-visible-parent-and-sibling-links
}.
875 \begin{notate
}{Expand and collapse backlink context
}
876 We typically show an article together with the text of its scholia,
877 but we could optionally simply say that such-and-such an article links
878 here. Compare Note
\ref{contextual-display
} and Note
\ref{ancestors
}.
880 We may also want to provide a hierarchy of additional scholia, mapping
881 along the links-to and the linked-to directions, see Note
885 \begin{notate
}{Labels and namespaces
} \label{labels-and-namespaces
}
886 A
\emph{label
} is a predicate extent that has (typically) been
887 maintained on the fly (or otherwise made concrete). A
888 \emph{namespace
} is a place to put articles; articles in different
889 namespaces can have the same names but not be the same. An object can
890 have many labels but can only live in one namespace. (See Section
891 \ref{subcollections
}, and Note
\ref{cost-of-maintaining-labels
} in
895 \begin{notate
}{Filtering
} \label{filtering
}
896 Filtering is closely related to the topic of subcollections mentioned
897 in Note
\ref{labels-and-namespaces
} (and it also relates to the issue
898 of predicate mapping; see Note
\ref{mapping-across-a-subcollection
}
899 and Note
\ref{search-engine-interface
}). The point to keep in mind
900 is that different people are going to want to see different things
901 when looking at a
document.
904 \begin{notate
}{Transcluding and outline views
} \label{transcluding-and-outlines
}
905 Note that instead of text stating where the URL is, we could have an
906 ``transclude'' scholium; this would cause the latest, current, version
907 of the target
document to appear in the current
document when the
908 latter is rendered. One should be able to look at the current
909 document as an outline (hierarchy) showing these ``transclusion''
910 relationships explicitly. Similarly, one should be able to collapse
911 and expand different parts of the
document (i.e., in the collapsed
912 view, only the title of the transcluded
document would appear, but in
913 the expanded view all of the content would appear). These sorts of
914 ideas are handy whenever thinking about container documents (Note
915 \ref{container
}; oppose Note
\ref{thread
}). When examining an
916 outline, one should be able to jump to the article in its place inside
917 of the
document that is being outlined, or as a stand-alone item.
920 \begin{notate
}{Rendered and source views
} \label{rendered-and-source-views
}
921 A more mainstream example than the expanded and collapsed views from
922 Note
\ref{transcluding-and-outlines
} are rendered and source views.
923 These could be relevant when working with
\LaTeX\ or HTML (e.g., when
924 browsing this
document, it would be nice to have things detexed).
925 Presumably edits would take place in the source view (though not
926 necessarily; compare the Emacs Muse
\footnote{{\tt
927 http://www.mwolson.org/projects/MuseMode.html
}}). Switching in
928 and out of rendered views would be an extra step when initiating edits
929 (see Section
\ref{initiating-edits
}).
931 One simple feature that would be a nice part of a reasonable rendering
932 would be to keep the text within a certain width by filling at render
933 time (this would be both for articles and for the scholia display).
934 Presumably exported text would also have to be filled if it is to
937 Much more generally, it would be nice to have a full-fledged
938 \LaTeX\ renderer (along the lines of
\LaTeX-to-HTML). A renderer is
939 in many ways similar to a parser, so a simple parser is a reasonable
940 first step. Some of the work related to
941 Emacspeak
\footnote{{\tt http://emacspeak.sourceforge.net/
}} is,
942 I think, relevant to this problem.
945 \begin{notate
}{Page numbers
}
946 If we could figure out how to do some
\emph{truly
} device-independent
947 rendering of
\LaTeX\ documents, one particular thing we'd presumably
948 have come up with be a correspondence between
\emph{page numbers
} in
949 the printed version of a
document and in the electronic version. In
950 the mean time, maybe we can come up with some easy way to solve this
951 using some specially logging when
\LaTeX\ processes ``notate''
952 environments? (E.g., it wouldn't be hard to use special commands to
953 make an index of the notate environments in the
document; and
954 presumably Emacs could read the source of that index.)
957 \begin{notate
}{Alternate names for buffers
}
958 Should buffers have special names stored in buffer-local variables, or
959 should we search the library for buffers and check to see if they are
960 the same (regardless of what name they go by)? Or some other approach
961 to deal with named buffers? See section
\ref{display-interface
}.
964 \begin{notate
}{Saving and reading
}
965 The user can save and read back a given collection of scholia. As an
966 example, arbitrary files can be opened in `scholia-mode' so that all
967 scholia stored in the same directory as the file will appear
968 automatically as annotations.
971 \begin{notate
}{Versioning
} \label{versioning
}
972 In order to edit and stay kosher, we should provide support for
973 versioning. This version information will be stored on the
974 \inp{bookkeeping
} slot (or, alternatively, we should store sufficient
975 information to recover the versions; if such information isn't already
976 available elsewhere in the system). Note that we could just go ahead
977 and make functions for editing the text and then add functions for
978 saving the previous version later, in a hook. (This relates to the
979 slightly more general problem of making editing work in general, see
980 Section
\ref{editing
}.)
982 In order to deal with
\inp{about
} data that terminates on a given
983 article version instead of on the latest version, we will want to have
984 an additional optional column available in links that is reserved for
987 (Note that some objects may not need to have versions stored about
991 \begin{notate
}{CVS/Arch/filesytem support
} \label{vc-and-filesystem-support
}
992 We need to figure out how to integrate external information resources
993 into the system. One issue with CVS and Arch is that we (sometimes)
994 will want to only look at files that are new or have changed upon
995 reloading. This means that the version management software will
996 probably have to be integrated fairly closely into the system.
997 Another option would be to keep a record of the files in any directory
998 that is being used, and check this record against that file's listing
999 whenever the user wants to reload the content from that file. This
1000 may be the only option we really have for using the filesystem
1001 directly, but for the case of CVS, proper integration would probably
1004 Note that Arch has its own way of doing version management (as do
1005 all version control systems, of course). It might be best if
1006 we could swap different methods for version control in and out.
1007 Fundamentally, we need to know where to look for articles --
1008 they don't necessarily have to be in the filesystem (perhaps
1009 they could be assembled in real time in some buffer, for example;
1010 similarly, I think Arch builds various patched versions in real
1014 \begin{notate
}{Responsiveness to editing
} \label{responsiveness-to-editing
}
1015 As editing takes place, the information in the system needs to be kept
1016 up-to-date and coherent with itself. The main developments in this
1017 section are presented in Section
\ref{committing
}.
1020 \begin{notate
}{Unique identifiers for individual pieces of markup
}
1021 When committing edits, we reparse the buffer to find the places where
1022 the scholia are attached (Section
\ref{parsing
}). For things to
1023 work properly, each piece of markup should have a unique identifier
1024 (the article name and link number should suffice, see Note
1025 \ref{format-of-about-field
}). This will make it possible tell whether
1026 a piece of markup has been completely deleted, or swapped with another
1027 piece, or split into several pieces, or whatever (in theory, a region
1028 can even be moved between buffers, which would require an additional
1029 level of reparsing, we won't worry about that here for now; see Note
1030 \ref{aggressive-dop
}).
1033 \begin{notate
}{Manipulation of windows
}
1034 The somewhat aggressive manipulation of windows used in this program
1035 could get annoying, especially in the case of editing multiple
1036 articles at once. (Which is one possible reason for editing things
1037 inside one buffer, see Note
\ref{identification-use-case
}.)
1040 \begin{notate
}{Sorting scholia
}
1041 We want scholia to appear in some reasonable order relative to the
1042 order of marked regions. Section
\ref{sorting
} is supposed to do
1043 this. Note also that sorting should not be destructive; see Note
1044 \ref{order-of-about
}.
1047 \begin{notate
}{Complexity issues
}
1048 Some features simply would take too long to run when there are lots of
1049 scholia or articles involved. We need to be aware of these sorts of
1050 complexity issues. (It usually doesn't take much more than a simple
1051 test to make one fully aware of the problem, when dealing with
1052 terrible complexity scenarios!) Section
\ref{subcollections
} contains
1053 a few thoughts on how to limit complexity.
1056 \begin{notate
}{Ease of use
}
1057 In addition to being more featureful than the wiki medium, I hope that
1058 this system will be easier to use -- wikis as I know them are fairly
1059 laborious; lots of steps are needed to edit and save. The system
1060 should be designed in a way that requires few if any ``extra'' steps
1064 \begin{notate
}{Return to base representation
} \label{back-to-base
}
1065 It might be nice to have a way to return from a scholium to its
1066 ``actual'' base representation, i.e., if it is associated with a
1067 buffer, we should find that buffer, or if it is associated with a file
1068 we switch to a buffer visiting that file. Indeed, I think we have
1069 thing set up now so that an article stored in a buffer will always be
1070 attached to that buffer. We might want to be more flexible, allowing
1071 various different ways to attach and reattach (compare Note
1072 \ref{movable-scholia
}).
1075 \begin{notate
}{Code transparency
}
1076 It is good to have easy-to-understand names for functions that will
1077 appear over and over again; for example, we provide functions to
1078 access the bits and pieces of scholia (see Note
1079 \ref{access-functions
}). But we should try to do this all the time,
1080 for all of the data structures we build.
1082 See also Note
\ref{assimilating-data
} for further thoughts on why it
1083 is a good idea to do things this way.
1086 \begin{notate
}{Creating a scholium about several articles
}
1087 I'm not sure we have sufficiently strong mechanism for making scholia
1088 that apply to several other articles. That would be one potential use
1089 of the list browser from the previous section; we could mark articles
1090 and make a scholium about marked articles quickly, or mark articles
1091 and then make scholia about sections from other articles. Also, it
1092 would be good to have a way to break out of the region selection
1093 routine and start selecting regions from some article fluidly when
1094 working on making scholia
\emph{that
} way.
1096 This is useful as long as we are able to gather all of the articles we
1097 want to make a scholium about into one listing, or if we can find a
1098 way to use several listings together intelligently.
1101 \begin{notate
}{Space versus time tradeoffs
}
1102 We value time over space tradeoffs. If the data set becomes very
1103 large, this judgement may have to change (e.g. if the system gets
1104 popular, we won't be able to hold all of the available articles
1105 in memory, or on disk, and we'll have to get clever about
1106 swapping things around).
1109 \begin{notate
}{Support for systems in which passages have special meanings
} \label{systems-with-special-passages
}
1110 RMAIL, info, and EDB are just a few examples of Emacs subsystems whose
1111 most ``meaningful'' objects are smaller than the files in which these
1112 objects live. Support for these objects would be good to add to the
1113 scholium system, so that we can e.g. record mail messages or info
1114 pages that match some particular property.
1117 \begin{notate
}{Undoable editing
}
1118 It would be nice to be able to undo the editing actions that
1122 \begin{notate
}{Support for narrowing
}
1123 Frequently the function `point' is used here; I'm assuming that
1124 documents will be widened properly. But it would be good to be able
1125 to support narrowing (see Note
\ref{systems-with-special-passages
}).
1128 \begin{notate
}{Hooks and `cond' forms
} \label{transforming-cond
}
1129 At some earlier point, it seemed useful to think about transforming a
1130 `cond' form with an unquoted variable that contains extra cases (that
1131 are to be defined as needed). This seemed like a good opportunity to
1132 use LISP self-modifiability, and furthemore, it seemed like a good way
1133 write things in order (see Note
\ref{principle-of-order
}). However,
1134 typically the same thing can be achieved with hooks. The function
1135 `sch-plain-text' is a good example of this (Note
1136 \ref{sch-plain-text
}).
1139 \begin{notate
}{Multidimensional visual browsing
} \label{multidimensional-visual-browsing
}
1140 It might be handy to have a small control pannel at the bottom of the
1141 main article display that could be used to go backwards and forwards
1142 according to the layout of the
document \emph{and also
} according to
1143 the order in which things had been browsed so far (and anything else
1144 that the user might dream up to put there).
1147 \begin{notate
}{Using datatypes
} \label{datatypes
}
1148 In order to be able to pass different kinds of objects around and have
1149 them interpreted correctly, it might be advantageous to have our data
1150 structures typed; I'm not quite sure how types work in Emacs -- but I
1151 can say that datatypes are obviously scholia. For example, we might
1152 want there to be an article datatype (right now, there are only types
1153 \emph{of
} articles, like ``references'' for example). Another entity
1154 that could have a special datatype is the link.
1156 The question of datatypes for
\emph{forms
} seems interesting; it
1157 basically boils down to the question as to whether we add scholia to
1158 arbitrary lisp structures (see Note
\ref{functional
}).
1161 \begin{notate
}{Hooks as scholia
}
1162 Hooks are an easy-to-see example of scholia in the Lisp paradigm
1163 (compare Note
\ref{functional
},
1164 \ref{including-transcluding-and-lisp
}).
1167 \subsection{Elisp requirements
}
1169 \begin{notate
}{Packages
}
1170 I'm not sure we actually need align any more, but cl is
1171 of course very helpful.
1181 \subsection{Lisp preliminaries
}
1183 \begin{notate
}{On `add-or-replace'
}
1184 It seems that this function is no longer used.
1188 (defun add-or-replace (lis elt pred)
1192 (while (and (not found)
1194 (when (funcall pred (nth n lis))
1195 (setcar (nthcdr n lis) elt)
1200 (nconc lis (list elt))
1204 \begin{notate
}{On `add-to-or-start-list'
} \label{add-to-or-start-list
}
1205 This is is used to start store an
\inp{element
} on a
1206 ``
\inp{possible-list
}''; unlike `add-to-list', it works even when list
1207 is nil, or even (for now) when
\inp{possible-list
} is not a list at
1208 all. (Unlike with `add-to-list',
\inp{possible-list
} should not be
1209 the name of a list.)
1211 This function is used by `put-type-labels', `put-backlinks' and
1212 `label-article'. Note that you have to
\emph{save
} the result if you
1213 want to this function to have a lasting effect.
1215 Like `add-to-list', this function will only store
\emph{one
} copy of
1220 (defun add-to-or-start-list (possible-list element)
1221 (cond ((null possible-list)
1223 ((listp possible-list)
1224 (if (member element possible-list)
1226 (append possible-list (list element))))
1227 (t (list possible-list element))))
1230 \begin{notate
}{On `next-single-property-change+predicate'
}
1231 Like `next-single-property-change' except instead of automatically
1232 judging changes in the text property by the `eq' predicate, it allows
1233 the user to supply a
\inp{test
}.
1237 (defun next-single-property-change+predicate (pos prop &optional test)
1238 (let ((starting (get-text-property pos prop))
1243 (while (and (setq index (
1+ index))
1244 (< index (point-max))
1247 (get-text-property index prop)))))
1248 (when (< index (point-max))
1252 \begin{notate
}{On `delete-all-dups'
}
1253 This function differs from `delete-dups' in being
1254 non-destructive and in keeping none of several `equal'
1255 occurrences of an element in
\inp{list
} as opposed to one;
1256 otherwise, it manifests a similar idea.
1260 (defun delete-all-dups (list)
1264 (cond ((member (car tail) (cdr tail))
1265 (setq tail (delete (car tail) tail)))
1267 (setq ret (cons (car tail) ret)
1271 (defun set-difference (A B)
1272 (delete-all-dups (append A B)))
1275 (let ((ret (make-hash-table)))
1284 (defun flatten (list-structure)
1285 (apply 'concatenate 'list (list list-structure)))
1288 \section{Scholia-based documents
} \label{sbdm
}
1290 \subsection{The digital library
} \label{digital-library
}
1292 \begin{notate
}{On `article-table'
} \label{article-table
}
1293 We begin with an empty library.
1297 (defvar article-table
1298 (make-hash-table :test 'equal))
1301 \begin{notate
}{Structure of articles
} \label{structure-of-articles
}
1302 Every article has a
\inp{name
}, which can be any LISP object (but is
1303 most frequently a string). They also have various other standard
1304 sorts of data associated with them; see Note
1305 \ref{definition-of-scholium
} for the particulars. This data is
1306 referred to by `put-article' collectively as the article's
\inp{value
}
1307 (but this name is somewhat misleading, because the
\inp{name
} too is
1308 an important part of the article). One special sort of article is a
1309 ``library subcollection'' -- see Section
\ref{subcollections
} for more
1310 information on these things.
1313 \begin{notate
}{On `put-article'
} \label{put-article
}
1314 This destructively adjusts the values on the hash table (see
1315 documentation for `puthash'). To
\emph{intelligently manage
} the
1316 values in the table takes more work, so we typically `get-article'
1317 before to make various comparions and adjustments to existing values
1318 before making changes.
1322 (defun put-article (name value)
1323 (puthash name value article-table))
1326 \begin{notate
}{On `get-article'
}
1327 Basically just `gethash', but since the article table is indexed by
1328 \inp{name
} and we don't want to pass
\inp{name
} around all the time,
1329 we add it to the recalled value.
1333 (defun get-article (name)
1334 (let ((content (gethash name article-table)))
1336 (cons name content))))
1339 \begin{notate
}{On `name-of-current-article'
} \label{name-of-current-article
}
1340 The ``current article'' is of special importance for display (an
1341 article is made ``current'' when `display-article' displays it). The
1342 name of this article is stored in this variable.
1346 (defvar name-of-current-article nil)
1348 (defun current-article ()
1349 (get-article name-of-current-article))
1352 \begin{notate
}{What about using the file system?
}
1353 If the library is being updated by many people at different times, it
1354 may also make sense to read documents from a file system on the fly.
1355 Indeed, the program does support files and buffers. But the article
1356 table is still a decent
\emph{model
} -- similar in nature to a
1357 library's
\emph{catalog
}.
1360 \subsection{Creating scholia
} \label{scholium-function
}
1362 \begin{notate
}{Component pieces of scholia
} \label{definition-of-scholium
}
1363 The `scholium' function maintains a catalog of articles, indexed by
1364 name (Section
\ref{digital-library
}). Each article contains
1365 \inp{text
}, an indication of what the article is
\inp{about
}, its
1366 \inp{type
}, and
\inp{bookkeeping
} information which gives the
1367 article's edit history and ownership information. Articles must
1368 always follow this pattern.
1371 \begin{notate
}{Format of `name' field
}
1372 Any LISP object can be the
\inp{name
} of a scholium. Scholia are
1373 indexed by name: names are unique within namespaces (see section
1374 \ref{subcollections
}), and the combination of name and namespace is
1375 how an article is looked up. (At present, names are typically
1376 rendered as strings without any newlines, but this is a front-end
1377 matter and essentially arbitrary from the point of view of internal
1381 \begin{notate
}{Format of `text' field
}
1382 Just about anything can go into the
\inp{text
} field, but anything
1383 ``weird'' needs to be backed up by appropriate
\inp{type
} metadata
1384 and appropriate handlers (see Section
\ref{rendering
}).
1387 \begin{notate
}{Format of `about' field
} \label{format-of-about-field
}
1388 The
\inp{about
} field is a list of
\emph{links
} (in the sense of Note
1389 \ref{generalized-links
}). See Note
\ref{links
} for details.
1391 We could at some point investigate making
\inp{about
} data (and
1392 perhaps other sorts of data)
\emph{typed
} so that we can more easily
1393 the genesis of a given datum.
1396 \begin{notate
}{Links
} \label{links
}
1397 Each link is associated with precisely one article. Links can have
1398 additional link-type information stored about them. The general
1399 format of a link is:
1401 (<target article's name> &rest <link-types>)
1403 The design here maintains partial symmetry between the treatment of
1404 article types and link types; the cdr of a link can be processed
1405 by the same typedata processing functions as the
\inp{type
}
1408 For example, the link
1410 '(foo (passage
10 15) mistaken)
1412 indicates that the region from character position
10 to
15 in the
1413 article named ``foo'' is ``mistaken'', whereas the link
1417 indicates simply that the article
\emph{foo
} is mistaken.
1420 \begin{notate
}{Links indicate at most one passage
} \label{links-indicating-passages
}
1421 It seems reasonable to me to assert that each link will indicate at
1422 most
\emph{one
} passage. This is indeed an assumption made in the
1423 code, see the function `typedata-includes-passage' (Note
1424 \ref{typedata-includes-passage
})).
1427 \begin{notate
}{Format of `type' field
}
1428 The
\inp{type
} field is supposed to be a symbol or list of symbols.
1429 If it is nil, the article is assumed to be normal text.
1432 \begin{notate
}{Format of `bookkeeping' field
}
1433 The
\inp{bookkeeping
} field has a special format, very similar
1434 to the format of metadata articles (see Section
1435 \ref{metadata-articles
}); one might expect to see something like
1441 Remember that the
\inp{bookkeeping
} is
\emph{owned
}, so we probably
1442 shouldn't put anything there that can't be edited by the user, and so
1443 in particular, things that are needed for system consistency should go
1444 into metadata articles instead.
1446 Do notice that various schemes for access and ownership can be
1447 considered. (E.g. maybe anyone on the
\emph{access control list
}
1448 (ACL) can edit the text of the article, but only the owner is allowed
1449 to edit the ACL itself.)
1451 It would be worth looking at existing strategies (e.g. as found on
1452 PlanetMath) for handling complicated ownership and access
1453 arrangements. Actual implementation of useful bookkeeping features
1454 will have to come later (for a sort of silly placeholder for the
1455 meantime, see Note
\ref{sch-book
}).
1458 \begin{notate
}{Relationship of bookkeeping data and metadata article
}
1459 Bookkeeping data is
\emph{user editable
}, but metadata article
1460 generally isn't, or, when it is, it is typically treated as common
1461 property. This is important! See Note
1462 \ref{metadata-article-overview
}.
1465 \begin{notate
}{Access functions
} \label{access-functions
}
1466 A few simple functions to get pieces of (just aliases to help with
1467 coding; see Note
\ref{principle-of-transparency
}). Note
1468 \ref{link-accessors
} talks about something similar for links.
1472 (defalias 'scholium-name 'first)
1473 (defalias 'scholium-text 'second)
1474 (defalias 'scholium-about 'third)
1475 (defalias 'scholium-type 'fourth)
1476 (defalias 'scholium-bookkeeping 'fifth)
1479 \begin{notate
}{Order and interpretation of `about' field
} \label{order-of-about
}
1480 The order of links in the
\inp{about
} field is not arbitrary.
1482 The order of links determines link-ids, which are used for
1483 both backlinks (Section
\ref{backlinks-section
}) and markup
1484 (Section
\ref{marking-things-up
}).
1487 \begin{notate
}{Link accessors
} \label{link-accessors
}
1488 Links have exactly one linked-to-article together with any number of
1489 different link-types.
1493 (defalias 'linked-to-article 'first)
1494 (defalias 'link-type 'cdr)
1497 \begin{notate
}{Special link accessors
}
1498 First we need a function that will give us the type-element associated
1499 with a given type. Then, we have some important examples.
1501 The function `link-type-accessor' will produce the (first) specific
1502 type-element from
\inp{link
} that matches the given
\inp{type
}, if one
1505 Note that the format of
\emph{version
} access should follow the
1506 `link-version' function given here. (Passages don't have versions, so
1507 it doesn't make sense to put a version number as an additional element
1508 of a ``passage'' element.)
1512 (defun link-type-accessor (link type)
1513 (car (member-if (lambda (type-elt)
1514 (or (eq type-elt type)
1515 (and (listp type-elt)
1516 (eq (car type-elt) type))))
1519 (defun link-beginning (link)
1520 (second (link-type-accessor link 'passage)))
1522 (defun link-end (link)
1523 (third (link-type-accessor link 'passage)))
1525 (defun link-version (link)
1526 (second (link-type-accessor link 'version)))
1529 \begin{notate
}{Link creators
} \label{link-creators
}
1530 It might be nice to have a function that is in charge
1531 of link creation, so we can quickly identify the places
1532 where links are being created.
1535 \begin{notate
}{Link clusters
} \label{link-clusters
}
1536 In previous versions of this work, I grouped links into ``segments''
1537 by default. I subsequently realized that adding this extra default
1538 layer was ugly, and that it would limit the attractiveness of the
1539 system. Nevertheless, the initial intention was, I think, good. The
1540 idea with segments was to group certain links together semantically.
1541 For example, if the region that a reference was attached to got split
1542 in two after editing, one might want to maintain that one reference as
1543 being
\inp{about
} two regions ``in the first place'' while continuing
1544 to be about only the one target article ``in the second place''.
1545 (On references, see Note
\ref{references
}.)
1547 In the case of references, we can get away with making making the
1548 ``link text'' correspond to all of the links besides the
\emph{last
}
1549 one. And in many other cases, similarly, we will be able to specify
1550 semantics for
\inp{about
} data in the
\inp{type
} data. However, in
1551 some cases, we may need to put together link clusters that are
1552 separate from the article entirely -- in other words, we need to be
1553 able to attach scholia to
\inp{about
} data (as well as, e.g., to
1556 This flexibility assures us that there can be as many different kinds
1557 of clusters as we can come up with. By contrast, if we were using
1558 segments, the actual semantics would either have to be more limited,
1559 or would end up building extremely complex
\inp{about
} fields.
1561 More work on the subject of link clusters will follow in due course.
1562 Right now, I think they are just conceptually useful. (Which is
1563 another reason for getting rid of segments... thank goodness
1564 \emph{they
} never had a chance to become useful!)
1567 \begin{notate
}{Uses for `type' field
}
1568 One use of types is to maintain subcollections; see Note
1569 \ref{on-modified-type-labeler-etc
}. Articles of different types can
1570 be rendered or otherwise interpreted differently.
1573 \begin{notate
}{Hooks for new and modified scholia
} \label{hooks-for-new-and-modified-scholia
}
1574 If the scholium is new, run `new-scholium-hook', otherwise, run
1575 individual hooks depending on which pieces of the scholium were
1576 modified (if any). We use separate hooks in part because we need to
1577 be careful about what sorts of changes we make. If we adjusted the
1578 value of some scholium every time the value of a scholium was
1579 adjusted, we would expect to encounter infinite loops pretty quickly!
1581 The standard settings for these hooks will be given in the section
1582 \ref{subcollections
}; these settings facilitate e.g. the automatic
1583 creation of backlinks (Note
\ref{backlinks
}).
1587 (defvar new-scholium-hook nil)
1588 (defvar scholium-modified-text-hook nil)
1589 (defvar scholium-modified-about-hook nil)
1590 (defvar scholium-modified-type-hook nil)
1591 (defvar scholium-modified-book-hook nil)
1594 \begin{notate
}{The `scholium' function
} \label{the-scholium-function
}
1595 This function is foundational for the system. Lots of other functions
1596 will use it, but because it is destructive, users should typically not
1597 access it directly. Several interactive interfaces to this function
1598 appear in Section
\ref{creation
}. Note that the conditional structure
1599 here shouldn't be a `cond'; we really mean to run several hooks if
1600 several parts of the scholium have been modified.
1604 (defun scholium (name text &optional about type book)
1605 (let ((old-version (get-article name)))
1606 (put-article name (list text about type book))
1607 (when (not (metadata-override))
1608 (if (not old-version)
1609 (run-hooks 'new-scholium-hook)
1610 (when (not (equal (scholium-text old-version) text))
1611 (run-hooks 'scholium-modified-text-hook))
1612 (when (not (equal (scholium-about old-version) about))
1613 (run-hooks 'scholium-modified-about-hook))
1614 (when (not (equal (scholium-type old-version) type))
1615 (run-hooks 'scholium-modified-type-hook))
1616 (when (not (equal (scholium-bookkeeping old-version) book))
1617 (run-hooks 'scholium-modified-book-hook))))))
1620 \begin{notate
}{On `metadata-override'
} \label{metadata-override
}
1621 We don't want to run the usual hooks when the article being processed
1622 is a metadata article or a ``fake'' article. Fake articles appear
1623 when we create fake references that they don't show up in the scholia
1624 display and that aren't permanently attached to anything. See Note
1625 \ref{add-visible-back-temporal-link
}.
1627 (At least at one point I had some misgivings about this override, but
1628 it seems to get the job done. I don't see why we would want to have
1629 weird automatic thing happen after creating a metadata article or a
1630 ``fake'' article, so it may be that the design here is perfectly
1635 (defun metadata-override ()
1636 (when (or (typedata-includes type 'meta)
1637 (typedata-includes type 'fake))
1641 \subsubsection{Simple scholium derivatives
}
1643 \begin{notate
}{On `article-names-from-about-data'
}
1644 The idea here is to build a list with just the names of the articles
1645 that the
\inp{about
} data features. Names are uniquified.
1649 (defun article-names-from-about-data (about)
1650 (delete-dups (mapcar (lambda (elt) (car elt)) about)))
1653 \begin{notate
}{On `typedata-includes'
} \label{typedata-includes
}
1654 Read
\inp{typedata
} in the format used in scholia,
1655 and say whether it matches a
\inp{specific-type
}.
1656 Notice that when
\inp{typedata
} and
\inp{specific-type
} are
1657 both is `nil', we return a positive match.
1661 (defun typedata-includes (typedata specific-type)
1662 (cond ((eq typedata specific-type) t)
1663 ((and (listp typedata)
1664 (member specific-type typedata)) t)
1668 \begin{notate
}{On `typedata-includes-element-of-list'
}
1670 `typedata-includes' (Note
\ref{typedata-includes
}), but only
1671 requires one type out of those listed to match in order to return
1676 (defun typedata-includes-element-of-list (typedata list-of-types)
1678 (while (and list-of-types
1680 (when (typedata-includes typedata (car list-of-types))
1682 (setq list-of-types (cdr list-of-types)))
1686 \begin{notate
}{On `typedata-includes-passage'
} \label{typedata-includes-passage
}
1687 A specific test to see if typedata includes type ``passage'' (noting
1688 that the list element that indicates this type should come together
1689 with some suffix that tells you which passage is being indicated).
1691 As far as I can tell, this function will always apply to typedata
1692 coming from links (but who knows).
1696 (defun typedata-includes-passage (typedata)
1698 (when (listp typedata)
1699 (while (and typedata
1701 (when (eq (car (car typedata)) 'passage)
1702 (setq ret (car typedata)))))
1706 \subsubsection{Examples
} \label{examples
}
1708 \begin{notate
}{Examples of the `scholium' function in use
}
1709 As an example of how the `scholium' function might be applied, here is
1710 a scholium about the article I'm writing now.
1712 (scholium "Remark On Scholium Definition"
1713 "This is an Emacs Lisp function."
1714 '(((passage "sbdm4cbpp.tex"
49078 49738))))
1716 Actually, the article that I'm writing right now won't be in the
1717 article list unless we explicitly put it there. So the scholium
1718 that we added here is actually attached to a
\emph{fictitious
}
1719 article with the name ``sbdm4cbpp.tex''. That's OK, but for
1720 completeness, I'll add the current buffer as a scholium with the
1723 (scholium "sbdm4cbpp.tex"
1726 Notice that we've supplied a buffer instead of a string for the
1727 \inp{text
} field. We now add another scholium, attached to the
1728 previous two, communicating to the user a fact that the system already
1731 (scholium "This is a scholium about part of the SBDM
document"
1732 "This scholium is attached to this region."
1733 '(((article "Remark On Scholium Definition"))
1734 ((passage "sbdm4cbpp.tex"
31091 31744))))
1736 By setting the
\inp{type
} data appropriately, we might make this last
1737 example display when ``Remark On Scholium Definition'' is displayed,
1738 but not when ``sbdm4cbpp.tex'' is displayed. It might make sense to
1739 mark up the words ``this region'' with a reference to
1740 ``sbdm4cbpp.tex''. Tricky things like this will be coming in later
1744 \begin{notate
}{Mixed scholia
} \label{mixed-scholia
}
1745 Designing functions to build increasingly complicated
\inp{about
}
1746 structures easily seems to become increasingly challenging.
1749 \begin{notate
}{Types of text
} \label{types-of-text
}
1750 There could be other kinds of ``text'' that one might want to be able
1751 to use -- symbols, processes, web pages, etc.; basically, any sort of
1752 information-containing thing could be something that one would wish to
1753 add to the scholium system. In addition, plain-text scholia can be
1754 miniature database entries (in some label) if they are given a
1755 specific
\inp{type
}. For example, a function object might have a
1756 \emph{descriptive note
}, a
\emph{doc string
}, and a
\emph{definition
}.
1757 Lists are another example of a special plain-text article
1758 (see Note
\ref{semantics-of-lists
}).
1761 \subsubsection{Further notes on creating scholia
}
1763 \begin{notate
}{The division of scholia into pieces
}
1764 The division is somewhat arbitrary. Ownership could certainly be
1765 maintained separately from edit history; however, it makes some sense
1766 to set access controls when the article is first saved. Things can
1767 get complicated if different persons or groups have different
1768 permissions; e.g. some may be able to change the access control list
1772 \begin{notate
}{Completeness of the scholium function's arguments
}
1773 I think I've basically covered everything I'd be interested in with
1774 these freeform types. The idea is that you can put whatever you want
1775 into these fields, and then write whatever sort of accessor functions
1776 you like to use that information! However, if someone wanted to add
1777 some new fields, this would be easy; they would only have to change
1778 the scholium function and the add-props function.
1781 \begin{notate
}{How to assert that a relationship exists
}
1782 The
\emph{relationship between
} different articles presumably has to
1783 be added with scholia that point to both articles and say something
1784 special about them in the ``type'' field. On the other hand, it would
1785 be useful to have that particular
\inp{type
} be read both ways, so
1786 that scholia about both the high-level
document and lower-level
1787 document explain the relationship of the two documents to one another.
1788 (I think backlink registries would help with this.) We'll talk more
1789 about how to actually assert relationships between articles in Section
1793 \begin{notate
}{Freedom to create derivative versions
}
1794 In general, this can be specified in the bookkeeping information -
1795 i.e., the licensing terms (or royalty terms or whatever). For just
1796 about any article, it is important to be able to track derivatives!
1797 The insistance on tracking makes our system not so different from
1798 ``regular'' version management.
1801 \begin{notate
}{Types and modes
}
1802 Oftentimes, articles are not so different from buffers. Type data is
1803 a way of specifying things like filetype or editing mode. (Maybe a
1804 bit more general, because articles need not be very buffer-like.)
1807 \begin{notate
}{Extended access
}
1808 It might be a good idea to let
\inp{about
} be filled by a
1809 \emph{function
} that will select a sequence of character positions?
1810 Well, I suppose that even if the capability isn't explicitly coded
1811 into the system, people can write their own code that does the job
1812 (expands such functions before calling `scholium')?
1814 Alternatively, if we had sub-libraries in this library, such
1815 a function might be more complicated. It would be worth thinking
1816 about examples of how this sort of thing might be used, exactly.
1818 Of course, if the library contains heterogeneous materials, like the
1819 case that is being discussed in the ``superimposed information''
1820 articles; there, selecting a region may mean different things for
1821 different articles. It seems like the case of Word docs and PDFs is
1822 simpler than the case of whole libraries (e.g. filesets?) but I'd need
1823 to think more about the issues here to come up with good examples. In
1824 which case would one rather add a library than all of the documents?
1825 (Probably there are some cases.) Well, I guess the GCIDE example that
1826 I talked about could be relevant here, although the idea of this GCIDE
1827 thing isn't quite the same as the usual web-like ``scholium thing''
1828 we're considering elsewhere in this work. Also, one might think of
1829 Google or whatever as being a ``library'' that you have to interact
1830 with in a special way to get at the documents -- the reasons for not
1831 adding them are that they aren't free (for one thing) and there are
1832 just too many of them (for another!).
1834 Of course, scholia for really ``weirdly'' formatted documents --
1835 including very rich things, like pictures or videos -- may have very
1836 different sorts of semantics. Its nice of the people who are working
1837 on this ``superimposed information'' stuff to invest time and energy
1838 into this sort of thing, but my own feeling is that its important to
1839 get some good, working, deployments for text-based
document
1840 collections going asap!
1843 \begin{notate
}{Type creation
} \label{type-creation
}
1844 The AI issue relates to the issue of type creation. We should be
1845 talking about the relationship of semantic net ideas (an up-to-date
1846 reference on semantic nets would be helpful; maybe SNePs).
1849 \begin{notate
}{Formulaic scholia
} \label{formulaic
}
1850 One obvious sort of type is the
\emph{form
}, i.e., an object with
1851 certain fields to be filled in. Compare
1852 HyperCard
\footnote{{\tt http://en.wikipedia.org/wiki/Hypercard
}}; more
1853 interesting ideas can be gotten there too, I think.
1856 \begin{notate
}{Transformative scholia
} \label{transformative
}
1857 It is interesting to think of transformative scholia; attachments that
1858 change the way a given source looks. This is a topic that has
1859 recently been getting some play in the web browser community. Simply
1860 being able to annotate web pages would be swell, because then you
1861 could search through them as if they were part of your own local web,
1862 which, in fact, they probably would be.
1865 \begin{notate
}{Functional scholia
} \label{functional
}
1866 Functional scholia are similar to (and generalize) the transformative
1867 scholia of Note
\ref{transformative
}. Reimplementing LISP inside the
1868 scholium system would be an example of this sort of thing; functions
1869 and variables as nodes in a web, programs as clusters of nodes that
1870 have been linked together in certain ways. One way this might be done
1871 would be to use the ordered
\inp{about
} list as an argument list for a
1872 function and put the function itself on either the
\inp{type
} field
1873 or, more likely, the
\inp{text
} field (a specification of the expected
1874 arguments would go on the
\inp{type
} field). Perhaps something like
1875 this could be used to build documentation for LISP functions
1876 automatically; needless to say, anything we can do scholia-wise can be
1877 done LISP-wise (reasoning by set-inclusion, if nothing else), however
1878 there may be some advantages to thinking about code scholiumifically.
1879 (Functions and their subroutines can easily be regarded as forming a
1880 network, and so, code can easily be thought of as a scholium-based
1881 document under this arrangement.)
1884 \begin{notate
}{Interactive and actionable scholia
} \label{interactive-and-actionable-scholia
}
1885 One of the big goals for the system is to be able to write MUD-like
1886 programs and text-based games; to do this we need,
\emph{interactive
}
1887 scholia. More generally, scholia that do something e.g. when browsed
1888 or when encountered by a given process; we call elements of this
1889 broader category
\emph{actionable
} scholia.
1892 \begin{notate
}{Simulating features from single-buffer editing
}
1893 In Note
\ref{functional
}, we mentioned a certain feature that should be
1894 replicated in the scholium system to make it more useful
1895 (`get-function'); however, some systematic study of the features that
1896 are useful from single-buffer editing should be made, and those
1897 features re-implemented for the scholium system.
1900 \begin{notate
}{Handling functions
}
1901 A simple feature request somewhat related Note
\ref{functional
} is
1902 that we should be able to jump to the scholium associated with a
1903 certain function's name; the analogue of my `get-function' command.
1904 The text that documents a certain function should also show up as a
1905 docstring when one runs `describe-function' in Emacs.
1908 \subsection{Metadata
} \label{metadata
}
1910 \subsubsection{Metadata articles
} \label{metadata-articles
}
1912 \begin{notate
}{Metadata article overview
} \label{metadata-article-overview
}
1913 Metadata articles constitute a merger between ``local'' and
1914 ``holographic'' data storage (Note
\ref{holographic-data-storage
}).
1915 Metadata articles are essentially local, but they are used to maintain
1916 information about data drawn from all over (in particular, backlinks
1917 are recorded on metadata articles). A metadata article is always
1918 attached to some other article, and is used to record
\emph{common
}
1919 information about this article. They are updated automatically when
1920 certain editing events take place. When an article is rendered,
1921 certain fields in the metadata article can take precedence over
1922 corresponding information in the article itself (see Note
1923 \ref{updating-link-extent
}).
1926 \begin{notate
}{Metadata article design
} \label{metadata-article-design
}
1927 We exploit the facts that articles (a) have unique names, (b) any LISP
1928 object can be the name of an article, to produce the rule that any
1929 \emph{non
}-metadata article with
\inp{name
} \emph{name
} to which we
1930 need to associate a metadata article will have a metadata article
1931 named ``(meta
\emph{name
})''. The
\inp{text
} of this article is the
1932 metadata associated with the base article; its format is that of a
1933 list of lists, with each sub-list headed by a tag describing the
1934 contents of that sub-list (e.g.
\emph{backlinks
}). Metadata articles
1935 are not considered to be
\inp{about
} anything; we get the picture by
1936 looking at the article's
\inp{name
}. (They may however contain
1937 updated
\inp{about
} information for the article they are ``meta'' to;
1938 see Note
\ref{updating-link-extent
}.) Also, for now at least, we give
1939 them only very minimal
\inp{bookkeeping
} information.
1941 A ``metadata'' label is maintained that allows us to easily keep track
1942 of the collection of metadata articles (see Note
1943 \ref{on-modified-type-labeler-etc
},
\emph{et seq.
}).
1945 This design makes it easy to set metadata ``fields'' with `assoc' and
1946 `setcdr'; see Note
\ref{put-metadata-field
}.
1948 (It would be good to say a bit more about the different fields that
1949 are stored in metadata articles here.)
1952 \begin{notate
}{Maybe phasing out use of pseudo-namespace
}
1953 So far we've been able to ``afford'' the use of a pseudo-namespace for
1954 metadata articles. However, we may need to use a more legitimate
1955 approach at some point. We'll look at this issue again if it ever
1959 \begin{notate
}{On `metadata-article-name-p'
}
1960 So, like I said, we're losing some generality in the
1961 set of available names by doing things the way we've been doing it.
1965 (defun metadata-article-name-p (name)
1966 (when (and (listp name)
1967 (eq (car name) 'meta))
1970 (defun base-name-from-metadata-name (name)
1974 \begin{notate
}{On `metadata-article'
}
1975 This function retrieves the metadata article associated with the
1976 article named
\inp{name
}.
1980 (defun metadata-article (name)
1981 (get-article (list 'meta name)))
1984 \begin{notate
}{On `put-metadata-field'
} \label{put-metadata-field
}
1985 This can be can be used to fill a metadata
\inp{field
} with the given
1986 \inp{value
}, in the metadata article pertaining to the article named
1987 \inp{name
}. If the field has not yet been set, it is created anew
1988 with the appropriate
\inp{value
}.
1992 (defun put-metadata-field (field value name)
1993 (let* ((metadata (metadata-article name))
1994 (old-value (assoc field (scholium-text metadata)))
1997 (setq new-text (progn (setcdr old-value value)
1998 (scholium-text metadata)))
1999 (setq new-text `((,field . ,value))))
2000 (scholium (list 'meta name)
2007 \begin{notate
}{On `get-metadata-field'
}
2008 This can be used to retrieve any particular metadata
\inp{field
}
2009 pertaining to the article named
\inp{name
}.
2013 (defun get-metadata-field (field name)
2014 (cdr (assoc field (scholium-text (metadata-article name)))))
2017 \begin{notate
}{Similarity between metadata and text properties
}
2018 It makes some sense that metadata about articles and metadata
2019 about characters would be treated somewhat similarly. Anyway,
2020 the similar idioms seem to arise.
2023 \begin{notate
}{Updating link extent
} \label{updating-link-extent
}
2024 If an article $A$ is a scholium attached to some other article $B$,
2025 and $B$'s
\inp{text
} is edited, then $A$'s
\inp{about
} data, if taken
2026 literally, may be quite inaccurate. The solution to this problem is
2027 to examine the text properties indicating which regions of $B$ $A$ is
2028 \emph{supposed to be
} \inp{about
}, and store the updated information
2029 where it will be useful: $A$'s metadata article ``(meta $A$)''. The
2030 information stored in (meta $A$) ``masks'' individual links; see Note
2031 \ref{masks
} for more information.
2034 \begin{notate
}{Updated `about' fields in the distributed case
} \label{updating-link-extent--distributed-case
}
2035 In the distributed case, it would probably be best to use the metadata
2036 pertinent to the current checked-out instance. To facilitate this,
2037 contributed
\inp{about
} data should probably be stored together with
2038 the id of its source. We're not quite there yet, but hopefully soon
2039 will be! (See also Note
\ref{conflicts-in-a-distributed-environment
}
2042 \subsubsection{Backlinks (who links here?)
} \label{backlinks-section
}
2044 \begin{notate
}{Theory of backlinks
} \label{backlinks
}
2045 One particularly interesting sort of object is the ``backlink''.
2046 These complement the generalized links discussed in Note
2047 \ref{generalized-links
}, and they play a fundamental role in the
2048 system. Backlinks make some operations faster (compare Note
2049 \ref{name-or-access-buffered-articles
}).
2051 Unlike regular links, which live in articles, an article's backlinks
2052 live in its ``public'' metadata article. See
2053 \ref{overview-of-linking-process
} for further information on the
2054 lifecycle of a backlink.
2056 See Note
\ref{backlink-tricks
} for a description of tricks that can be
2057 done with backlinks. Its worth mentioning that backlinks not seen in
2058 the typical display, but they could be used in special displays (see
2059 Note
\ref{ancestors
}). Backlinks are going to be important for AI
2060 applications; they provide the information a given node needs to
2061 ``know'' its context within the broader semantic network.
2063 Note that Howm is an already existing Emacs package for both forward
2064 (``goto'') and backward (``come-from'') linking
\footnote{{\tt
2065 http://howm.sourceforge.jp/
}}. The behavior of Howm's come-from
2066 links is somewhat different from the backlinking features implemented
2067 in the scholium system, but it shouldn't be too hard to add Howm-like
2068 features (see Section
\ref{otf
} for some words on how we might
2071 (This note should probably just state the definition of backlinks;
2072 anyway, as it is it seems to vague and too long.)
2075 \begin{notate
}{Implementation of backlinks
} \label{implementation-of-backlinks
}
2076 Whereas links are typed (Note
\ref{links
}), backlinks are not.
2077 Insteady, backlinks indicate an article and a certain link in that
2078 article. The backlink data is useful because it allows us to easily
2079 figure out which articles link to a given article (without doing any
2080 mapping). The basic use of backlink data is to display an article
2081 together with its scholia.
2083 We had considered using typed backlinks (mirroring the type of the
2084 link that each backlink corresponds to), but this seemed excessive,
2085 since the corresponding information can easily be found by examining
2086 the link corresponding to a given backlink.
2089 \begin{notate
}{Overview of linking process
} \label{overview-of-linking-process
}
2090 When
\inp{about
} data is created or modified, `put-backlinks' is
2091 called to update the backlinks in the metadata articles associated
2092 with the
\emph{linked-to
} articles. A backlink points at the specific
2093 link that it corresponds to, by way of the
\emph{linking
} article and
2094 the unique
\emph{link number
} that identifies the corresponding link.
2097 \begin{notate
}{On `delete-backlink'
} \label{delete-backlink
}
2098 This function is called by `put-backlinks' to prune away an old
2101 Also notice that in this function, we know that some
2102 metadata and backlinks already exist, so in particular the
2103 `metafield' exists. Hence we don't need the complicated
2104 conditions found in the `add-backlink' function.
2106 (I don't suppose we actually need to delete the ``backlink'' field
2107 in the case in which we delete the last backlink.)
2111 (defun delete-backlink (linked-to-article link-number)
2112 (let* ((metaarticle (metadata-article linked-to-article))
2113 (metatext (scholium-text metaarticle))
2114 (metafield (assoc 'backlinks metatext))
2115 (backlinks (remove (list name link-number)
2117 (setcdr metafield backlinks)
2118 (scholium (list 'meta linked-to-article)
2125 \begin{notate
}{On `add-backlink'
} \label{add-backlink
}
2126 This function is called by `put-backlinks' to add a new backlink.
2128 Note that the relevant metadata article may not exist prior to the
2129 time this function runs and even if it exists, it may not contain any
2130 backlink data. So we have to run the relevant tests to deal with
2131 these cases. This accounts for differences between the implementation
2132 of `add-backlink' and `delete-backlink' (Note
\ref{delete-backlink
}).
2136 (defun add-backlink (linked-to-article link-number)
2137 (let* ((metaarticle (metadata-article linked-to-article))
2138 (metatext (scholium-text metaarticle))
2139 (metafield (assoc 'backlinks metatext))
2140 (backlinks (add-to-or-start-list
2142 (list name link-number))))
2145 (setcdr metafield backlinks))
2148 `(((backlinks . ,backlinks)))))
2151 `((backlinks . ,backlinks)))))
2152 (scholium (list 'meta linked-to-article)
2159 \begin{notate
}{On `put-backlinks'
} \label{put-backlinks
}
2160 The basic use for this function is to run it within the scope of the
2161 `scholium' function, to build and store new (or updated) backlink
2162 data. Backlinks are added to each of the metadata articles
2163 corresponding to articles that this article is
\inp{about
}.
2165 The algorithm used here (zap
\emph{all
} existing backlinks, then place
2166 \emph{all
} new backlinks) seems likely to be woefully inefficient! If
2167 so, this can be improved later.
2169 Notice that we don't take into account
\inp{name
} changes with this
2170 function (there is no relevant ``old-name'' variable, at least, not at
2175 (defun put-backlinks ()
2176 (let ((old-about (scholium-about old-version))
2178 (dolist (link old-about)
2179 (setq link-number (
1+ link-number))
2180 (delete-backlink (car link) link-number)))
2181 (let ((link-number
0))
2182 (dolist (link about)
2183 (setq link-number (
1+ link-number))
2184 (add-backlink (car link) link-number))))
2186 (add-hook 'new-scholium-hook 'put-backlinks)
2187 (add-hook 'scholium-modified-about-hook 'put-backlinks)
2190 \begin{notate
}{Generality of `put-backlinks'
} \label{generality-of-put-backlinks
}
2191 The function used to be written in a general way so that it can store
2192 backlinks in different fields. For example, I had set things up to
2193 add to a `derives-to' metadata field when the function
2194 `include-article' ran (see Note
\ref{include-article
}). However, it
2195 wasn't clear to me that this approach was really useful or necessary.
2197 Nevertheless, storing new or updated mask data has to be done at some
2198 point; and it may be that we'll want a generalized version of
2199 `put-backlinks' after all (perhaps with a better name, speaking to its
2200 new general purpose).
2203 \begin{notate
}{Turning backlinking off on demand sometimes?
}
2204 It might be nice to turn backlinking off in certain situations. A
2205 rather silly example is the situation in which you don't want the
2206 owner of a certain object to know that you are talking about it.
2207 There may be some more relevant situations. (Compare the use of fake
2208 links, as documented in Note
\ref{metadata-override
}).
2211 \subsection{Consistency conditions
} \label{consistency
}
2213 \begin{notate
}{Why we maintain consistency
} \label{consistency-why
}
2214 This discussion might go into Section
\ref{philosophy
} or Section
2215 \ref{mathematics
}, but given that it is fairly foundational for the
2216 system, it is worthwhile to at least include an overview early on.
2218 When something changes in the system -- whether it is the addition of
2219 an article, or the deletion of an article, or edits to an article --
2220 very often the effects are not purely local; or at least, they
2221 shouldn't be. Someone may want to know when a certain kind of article
2222 is created. Articles that referred to an article that gets deleted
2223 may want to refer to something else. If an article changes,
2224 references to specific regions of that article may have to be
2225 re-directed or, in some cases, eliminated.
2227 Many of these operations can be taken care of automatically by a
2228 sufficiently powerful hypertext system. Indeed, particularly in the
2229 case of multi-user editing, the consistency conditions (considered as
2230 a very general category) essentially constitute the
\emph{social
2231 contract
} associated with the work.
2234 \begin{notate
}{When we maintain consistency
} \label{consistency-when
}
2235 As we mentioned in Note
\ref{consistency-why
}, in the broadest sense,
2236 we're always maintaining some sort of consistency. But the three
2237 major categories,
\emph{adding
},
\emph{deleting
}, and
\emph{editing
},
2238 give a nice first-run division of the cases. (There may be some other
2239 situations that will come up, and will not fit immediately into any of
2240 these three groups, e.g. maintaining some state that isn't officially
2241 part of an article per se, but at least ideally, we can decompose the
2244 Sometimes users won't want certain ``weird'' things to happen to their
2245 articles automatically. For example, maybe someone really means to
2246 point at the region between character position
5 and character
2247 position
31 in some particular article, and not to the string that
2248 currently appears in this region at the time when the link is created.
2249 In this case, the person creating the link should say so -- and the
2250 system should be set up to adhere to the reasonable wishes of its
2251 users. In particular, it should be entirely possible for two users to
2252 have vastly different views of the
document's contents!
2254 (Notice that in the distributed case, it we may have to adopt somewhat
2255 different notions of consistency; see Section
\ref{distributed
}.)
2258 \begin{notate
}{Consistency conditions for adding
} \label{consistency-adding
}
2259 This is a fairly simple case, relatively speaking.
2260 It includes such things as automatic labeling
2261 (cf. Section
\ref{labels
}) as well as the automatic addition
2262 of backlinks to appropriate articles (Note
\ref{put-backlinks
}).
2265 \begin{notate
}{Consistency conditions for deleting
} \label{consistency-deleting
}
2266 The most important feature associated with deletion is to delete or
2267 redirect backlinks. See Section
\ref{deletion
} for details.
2270 \begin{notate
}{Consistency conditions for editing
} \label{consistency-editing
}
2271 This is by far the most complicated of the three cases. When an
2272 article is edited, links that point to its various components may have
2273 to be updated. In particular, when an article's
\inp{about
} data is
2274 edited, anything that pointed at this data must change -- this
2275 includes everything that uses link-id's (Note
\ref{link-ids
}), i.e.,
2276 backlinks in other articles, masks in the linking article, and markup.
2278 Changes to an article's
\inp{text
} can have repercussions of similar
2279 complexity, especially when derivative works are taken into account;
2280 see Section
\ref{derivative
} for details.
2283 \subsection{Subcollections
} \label{subcollections
}
2285 \subsubsection{Labels
} \label{labels
}
2287 \begin{notate
}{Cost of maintaining labels
} \label{cost-of-maintaining-labels
}
2288 To maintain a label, we have to do predicate testing as we go along.
2289 This is a way of amortizing the cost of lookup. (An example would be
2290 nice, I'm sure.) The thought is that some overall savings can be
2291 obtained this way -- but in general they don't come automatically; we
2292 have to be intelligent about limiting the tests we run (at least, I
2293 don't think we get savings for free by doing things this way). For
2294 example, we don't add backlinks to metadata articles -- but there
2295 should be other intelligent things to do too. Another idea in a
2296 similar theme is to have several functions for creating different
2297 kinds of articles; these functions can instructions for applying
2298 certain labels hard-coded into them.
2301 \begin{notate
}{Labels as made up of trivial clusions
}
2302 Given that the design of labels stores a list of link-like elements in
2303 the
\inp{text
} field of a article, and the fact that we would like to
2304 have backlinks from the labeled articles to the label itself (Note
2305 \ref{autobacklink-to-label
}), it would appear to me that labels are
2306 somewhat like trivial clusions (Note
\ref{clusions
}). Assuming that
2307 we are going to go ahead with the backlinking from labeled articles
2308 (which seems to be useful when we think about exploring or exporting a
2309 hierarchy), then we may want to treat labels in the same way we treat
2310 clusions, or alternatively, switch to putting their contents onto the
2311 \inp{about
} field instead.
2314 \begin{notate
}{Comparison with labels in other systems
} \label{comparison-with-other-label-systems
}
2315 Various folksonomy-oriented environments allow people to use labels.
2316 The usage in these systems is certainly similar to usage in Arxana,
2317 however, I'm not completely sure that the ideas are the same. This
2318 would bear further investigation.
2321 \begin{notate
}{Label terminology
}
2322 Following on Note
\ref{comparison-with-other-label-systems
}, it seems
2323 possible that the term ``label'' would be somewhat confusing if the
2324 label was thought of as a set, and not a list. So to be clear, what
2325 we really are doing is keeping track of various things on separate
2326 lists. (This is relevant e.g. for `label-article-insert-before', Note
2327 \ref{label-article-insert-before
}).
2330 \begin{notate
}{On `modified-type-labels'
} \label{on-modified-type-labeler-etc
}
2331 An alist of types to look for paired with the corresponding label to
2332 apply. Each new or modified article is tested to see if it matches
2333 any of the given types; if so, then the corresponding label(s) will be
2334 applied. (Note that the ``label'' label is not treated specially.)
2338 (defvar modified-type-labels '((nil . plain)
2342 (reference . reference)
2343 (section . section)))
2346 \begin{notate
}{On `label-article'
} \label{label-article
}
2347 This function is responsible for the mechanics of editing labels, and
2348 creates them as needed.
2352 (defun label-article (name article-label)
2353 (scholium article-label
2354 (add-to-or-start-list (scholium-text
2355 (get-article article-label))
2361 \begin{notate
}{On `label-article-insert-before'
} \label{label-article-insert-before
}
2362 Like `label-article' (Note
\ref{label-article
}), but takes an
2363 additional argument
\inp{before-this
} to say which entry the new name
2364 should be inserted just before.
2368 (defun label-article-insert-before (name before-this article-label)
2369 (let* ((contents (scholium-text (get-article article-label)))
2370 (before-this-headed (member before-this contents)))
2371 (when before-this-headed
2372 (let ((len (- (length contents)
2373 (length before-this-headed)
2376 (setcdr (nthcdr len contents)
2377 (cons name before-this-headed))
2378 (setq contents (cons name before-this-headed))))
2379 (scholium article-label
2385 \begin{notate
}{On `put-type-labels'
}
2386 This function runs within the scope of `scholium'. It might make more
2387 sense to be able to add lots of different labels for a new article;
2388 the `cond' function doesn't work that way however.
2392 (defun put-type-labels ()
2393 (dolist (type-label modified-type-labels)
2394 (when (typedata-includes type (car type-label))
2395 (label-article name (cdr type-label)))))
2397 (add-hook 'new-scholium-hook 'put-type-labels)
2398 (add-hook 'scholium-modified-type-hook 'put-type-labels)
2401 \begin{notate
}{Generalizations of the autolabeler
}
2402 At the basic level, what we want is a way to maintain a list of
2403 predicates, such that any scholium that satisfies a given predicate
2404 gets the corresponding label. We could maintain several such lists,
2405 but it is (theoretically) important to be general, and the design
2406 should be evaluated to determine how easy it is to add new predicates
2410 \begin{notate
}{Could take subcollection as optional argument
}
2411 In general, the functions that operate on all articles should probably
2412 take a subcollection as an optional argument. This might be a
2413 namespace, or a label, or a list that has been assembled by some novel
2414 means. Some of our functions already have something like this
2415 working, but it hasn't really been standardized in any way.
2418 \subsubsection{Namespaces
} \label{namespaces
}
2420 \begin{notate
}{Namespace implementation
}
2421 Namespaces have to be implemented in a nicely self-similar way.
2422 Whereas an article can bear any number of labels, it can be only in
2423 one namespace at a time. (Since namespaces can be nested, we might
2424 have $A
\sqsupset B
\ni a$, so that the article $a$ isn't a member of
2425 $A$, but
\emph{limiting
} a recursive search to $A$ would still help
2428 Actually, namespaces are a lot like the filesystem, so I can imagine
2429 that we might provide the ability to symlink elements from one
2430 namespace into another (similar to textual
\emph{identification
}, see
2431 Section
\ref{identification
}). So maybe best to take what I said
2432 about only being in one namespace at a time with a grain of salt.
2433 What is probably the case is that the object
\emph{will
} only be in
2434 one namespace at a time, but that it can have ``virtual copies'' in
2437 If we go this route then we have two things to implement, roughly
2438 self-similar namespaces themselves, and a method for doing
2439 identification between them. I hope we can follow (in one direction
2440 or another) the implementation of
\emph{labels
}; we'll check that out
2443 The first step will probably be to make a namespace article-type, with
2444 a specially formatted text field (a list or table), which is to be
2445 displayed in a special way. We'll most likely want a variant on
2446 `read-article-name' that recurs if the name that is read in names a
2449 Display and deletion will both have to have some work done on them to
2450 make them namespace-compatible.
2453 \begin{notate
}{Why namespaces
} \label{why-namespaces
}
2454 Frequently one will be working with a data structure which has some
2455 symmetries that you don't want to collapse. For example, you might
2456 have a
\emph{Note
} and a
\emph{Section
} with the same name in a given
2457 article. Or you might have several sections with the same name in
2458 several different articles. Or you might be working with a database
2459 like structure in which every item has a
\emph{foo
}-type attachment,
2460 and you want these to be represented as different scholia, not
2461 \emph{one
} scholium with type
\emph{foo
}. Furthermore even in cases
2462 where you aren't expecting overlap, it might be handy to keep
2463 different collections strongly separated from each other. (E.g. if
2464 you have a bunch of articles coming from one resource and a bunch of
2465 very different articles coming from another resource.) In this case,
2466 it is probably often just as good to use labels and keep the different
2467 collections only weakly separated -- indeed, when there isn't overlap
2468 in names, a sufficiently well-developed system for working with labels
2469 will probably give you everything that you would have wanted from a
2470 system with namespaces. Be that as it may, overlap is prevalent
2471 enough to make namespaces useful. (Another approach to overlap is
2472 \emph{disambiguation
}, which is what Wikipedia uses; but having to use
2473 different names all the time when disambiguating could get very
2477 \begin{notate
}{Using namespaces for importing
}
2478 In Note
\ref{why-namespaces
}, we mentioned that namespaces could be
2479 useful when working with several articles with similar structure.
2480 Underscoring that point, it seems we may typically want to use
2481 namespaces when importing any secondary documents into the scholium
2482 system (e.g. the HDM Manifesto or Noosphere's documentation). They
2483 may also be useful for articles that are stored remotely (e.g. we
2484 might maintain one or more ``web'' namespaces).
2489 \begin{notate
}{Maintain the `label' article as a namespace?
}
2490 As one example, it might be advantageous to maintain the `label'
2491 article as a namespace!
2494 \begin{notate
}{On `generalized-put-article'
} \label{generalized-put-article
}
2495 Like `put-article' (Note
\ref{put-article
}), but you specify
2496 a
\inp{path
} as well as a
\inp{name
}. The
\inp{path
}
2497 should specify the path to the namespace wherein
2498 the
\inp{name
},
\inp{value
} pair is to be stored.
2502 (defun generalized-put-article (path name value)
2503 (puthash name value (generalized-get-article path)))
2506 \begin{notate
}{On `generalized-get-article'
} \label{generalized-get-article
}
2507 Like `get-article' but takes a
\inp{path
}. The path specifies a list
2508 of nested namespaces, and possibly, a final non-namespace item to be
2509 found in the last namespace. Optional argument
\inp{current
} keeps
2510 track of the ``current'' namespace as the path is digested. If only
2511 one item appears in the path and
\inp{namespace
} isn't given, the path
2512 points to an item in the main article table, and we return the
2515 Be advised that there is a little bit of potentially destructive
2516 ambiguity here. But to make up for it, notice the doubly-clever use
2517 of `and' and `cond' (to deal with the case that we're generalizing).
2521 (defun generalized-get-article (path &optional current)
2522 (let ((first-step (get-article path)))
2524 ((and (not current) first-step)
2527 (if (typedata-includes (get-article (car path)) 'namespace)
2528 (generalized-get-article (cdr path) (car path))
2529 (error "Path element not a namespace")))
2530 ((and (car path) current)
2531 (gethash current (car path)))
2532 ((car path) (get-article (car path))))))
2535 \begin{notate
}{Self-symmetry
}
2536 If we're going to have a set-up where things look roughly the same on
2537 every level, for one thing, we may going to want to have a ``current
2538 path'' variable, so we can move from level to level and populate that
2541 We may want to have a different class of labels at every level in the
2542 hierarchy. Whether we could also have labels that reach across levels
2543 is another question. And as for metadata articles, should they be
2544 stored in the top level or should they be stored in the same namespace
2545 as the article that they apply to? Storing them in the same namespace
2546 \emph{sounds
} good (it seems ``more distributed''), however remember
2547 that it may not always be possible to access a given namespace to
2548 store metadata. Perhaps the best option is to mirror whatever
2549 distributed resources one draws upon in the local implementation; then
2550 storing metadata in the namespace local to the article being treated
2551 would make some sense. Or we could have one single namespace for
2552 metadata articles (I've considered this option before) which would
2553 take data coming from all other namespaces. Seems like an interesting
2554 approach, too. These matters will require more thought.
2556 Notice that with namespaces we're pretty likely to end up repeating
2557 some of the work people have done with file systems. On the other
2558 hand, it is probably possible to use a simplified approach, with a
2559 function to accomplish ``add article to namespace at the end of this
2560 path''; like working with the file system but always from the root
2561 directory. Eventually we can add the convenience functions (really
2562 not that complicated) to prepend a default path to the root. (We seem
2563 to already have the non-interactive elements of this arrangement with
2564 `generalized-put-article' (Note
\ref{generalized-put-article
}) and
2565 `generalized-get-article' (Note
\ref{generalized-get-article
}).)
2568 \subsection{Data access and conversion
}
2570 \begin{notate
}{Introduction to data access and conversion
}
2571 The functions in this section give easy access to things we're often
2572 interested in later on. The functions here are simple, but it is
2573 useful to have names for them anyway (Note
2574 \ref{principle-of-transparency
}).
2578 (defun label-to-list (label)
2579 (mapcar (lambda (name)
2581 (scholium-text (get-article label))))
2583 (defun label-to-propertized-list (label)
2584 (mapcar (lambda (name)
2585 (propertize (format "
%s" name) 'name name))
2586 (scholium-text (get-article label))))
2589 \begin{notate
}{On `get-backlinks'
} \label{get-backlinks
}
2590 This code produces the backlinks associated with
\inp{name
}. See Note
2591 \ref{implementation-of-backlinks
} for details. Notice that throughout
2592 the code I have been applying this idiom
2595 (get-article (car backlink)))
2597 to the element of the returned list in order to come up with the names
2598 of the backlinked articles. However, I recently converted the
2599 backlink format to be richer than it was before so that we knew
2600 \emph{which link
} was doing the linking, not just which article. So
2601 presumably we should be using this additional data at least some of
2606 (defun get-backlinks (name)
2607 (get-metadata-field 'backlinks name))
2609 (defun get-links (name)
2610 (cdr (assoc 'links (scholium-text (metadata-article name)))))
2613 \begin{notate
}{On `read-article-name'
}
2614 We frequently have to read the name of an article from a list. We may
2615 be able to do this in several different more intelligent ways than the
2616 one we have here! For one thing, we could use
2617 `turn-article-table-into-names' (which see). Another thing to do
2618 would be to allow some other source of input, for example, some
2619 particular namespace could be specified (this might be best handled
2620 with another function, `read-article-name-from-namespace', say). We
2621 could offer some recursion if a namespace is selected.
2625 (defun read-article-name ()
2626 (let* ((completion-ignore-case t)
2627 (strings (turn-article-table-into-list))
2628 (string-found (completing-read
2631 (place (- (length strings)
2632 (length (member string-found strings)))))
2633 (nth place (turn-article-table-into-names))))
2636 \begin{notate
}{On `read-article-path'
}
2637 Like `read-article-name' but reads a path to an article through
2638 namespaces (cf. `generalized-get-article', Note
2639 \ref{generalized-get-article
}).
2643 (defun read-article-path (&optional namespace path)
2644 (let* ((completion-ignore-case t)
2645 (strings (if namespace
2646 (turn-namespace-into-list namespace)
2647 (turn-article-table-into-list)))
2648 (string-found (completing-read
2651 (place (- (length strings)
2652 (length (member string-found strings))))
2653 (ret (nth place (if namespace
2654 (turn-namespace-into-names namespace)
2655 (turn-article-table-into-names)))))
2656 (setq path (append path (list ret)))
2657 (if (and (typedata-includes ret 'namespace)
2658 (y-or-n-p "Read further? "))
2659 (read-article-path namespace path))
2663 \begin{notate
}{Reading from non-default namespaces
} \label{read-from-non-default-namespace
}
2664 Perhaps there should be a ``read from this namespace'' variable that
2665 can be swapped for the default in `read-article-name'. This sort of
2666 overload system should probably be used whenever we are reading from a
2667 list of articles (just for example, see Note
2668 \ref{make-reference-in-current-article
}).
2670 An alternative perspective on this matter is that it depends on the
2671 behavior of `get-article'. That function is responsible for finding
2672 the article with the given name, regardless of where it resides. So,
2673 `get-article' needs to know where to look. Perhaps `name' will
2674 contain some instructions, or, more likely, perhaps this function
2675 should take an optional argument that would help it to limit the
2679 \begin{notate
}{On `link-about-article-p'
} \label{link-about-article-p
}
2680 This provides a quick way to tell whether one of the elements of an
2681 \inp{about
} list is actually about the article named
2686 (defun link-about-article-p (link article-name)
2687 (equal (linked-to-article link) article-name))
2690 \subsection{Further notes on scholia-based documents
}
2692 \begin{notate
}{Following the design of metadata articles to make namespaces?
} \label{metadata-design-for-namespaces
}
2693 Note that we could in theory follow a similar pattern with the meta
2694 prefix to make additional ``namespaces'', i.e., the article ``(foo
2695 \emph{bar
})'' would be the article named ``bar'' within the namespace
2696 ``foo''. We would maintain a label on these articles, as with the
2697 ``metadata'' label. But it seems more desirable to create a namespace
2698 \inp{type
}, elements of which would have the property that they could
2699 contain articles which aren't elements of the main article list.
2702 \begin{notate
}{Design of real namespaces
}
2703 We currently only have one real ``namespace'' (see Note
2704 \ref{metadata-design-for-namespaces
} for a way to create a fake
2705 namespace). A real namespace would probably have a list or a hash
2706 table in the
\inp{text
} field and a ``namespace'' token into the
2710 \begin{notate
}{Namespace narration
}
2711 Presumably a lot of verbose discussion of namespaces can be trimmed
2712 away when we actually have an implementation.
2715 \begin{notate
}{Finding namespaces by searching the namespace hierarchy
}
2716 We should sometimes be able to find namespaces, by searching through
2717 the namespace hierarchy for their name. (I think I may have recently
2718 seen an Emacs package posted to gnu.emacs.sources for doing something
2719 similar with directories or files.)
2722 \begin{notate
}{Versioned backlinks?
}
2723 Note that backlinks are outside of the editorial control of the person
2724 whose article is being linked to. Nonetheless, it may be handy to
2725 maintain versioned backlink repositories, possibly to correspond to
2726 different versions of linked-to and the linked-from articles (this
2727 could be very complicated).
2730 \begin{notate
}{Holographic data
} \label{holographic-data
}
2731 There are a number of different strategies for working with
2732 ``holographic data'', i.e., data that represents a
document but that
2733 contains different bits and pieces all over, which must be assembled
2734 to construct any particular view into the
document. Some of these
2735 strategies involve maintenance of datastructures and some involve
2736 search. (See Note
\ref{holographic-data-storage
} for some further
2737 comments.) For a pictoral illustration of something vaguely similar,
2738 check out `animate-string'.
2741 \begin{notate
}{Simulating a unified catalog using many namespaces
} \label{namespaces-vs-catalogs
}
2742 The argument for namespaces says that we could simulate a full catalog
2743 by having functions that trace through all of the namespaces and
2744 gather all of the articles that have been found there.
2747 \begin{notate
}{Are namespaces out-modded by labels?
} \label{namespaces-outmodded
}
2748 I'm not even sure if we should be using namespaces at all, but one
2749 category of cases that seems to motivate their use that in which you
2750 have objects that contain sub-objects. Namespaces seem like a natural
2751 model, even if we decide never to use them explicitly.
2754 \begin{notate
}{Remote subcollections
}
2755 We might want to have one subcolection for each source of articles in
2756 a distributed system. For a built-in web browser, we might also want
2757 to maintain directions for re-loading everything that's been
2758 \emph{downloaded
} from the internet, probably as its own subcollection
2759 (with instructions on where to find the articles on disc and
2763 \begin{notate
}{Holographic data storage
} \label{holographic-data-storage
}
2764 This is the idea of a
document in which data is stored ``all over'',
2765 and our views into the
document get different bits and pieces of this
2766 data. For example, in Table
\ref{the-quick-brown-fox
}, the string
2767 ``the quick brown fox'' is stored in a somewhat non-intuitive way,
2768 namely, indexed by letter of the alphabet rather than character
2769 position. If we look at a neighborhood of the letter ``o'' (in the
2770 natural metric coming from this index), we might see something like
2774 which gives us some idea of what the
document as a whole has to say.
2775 (As would any neighborhood of any element, hence the appellation
2778 Similarly, an article displayed together with its scholia gives a view
2779 into the
document it is a part of. In general, its scholia may come
2780 from ``all over''. We use backlinks (Note
\ref{backlinks
}) to speed
2781 the location of scholia necessary for presenting such views.
2783 (Perhaps something from the theory of labels or something similar can
2784 be used to speed things up too; e.g., I suppose that in addition to
2785 generating this table, we could generate a list of the words in the
2786 text too. Something to think about I guess.)
2790 \begin{tabular
}{l|l
}
2791 {\bf character
} &
{\bf positions
} \\
2810 \caption{\label{the-quick-brown-fox
}Lexicographic storage for ``the quick brown fox''
}
2814 \begin{notate
}{World-writable components versus metadata articles
} \label{metadata-article-permissions
}
2815 If we're going to maintain a collection of backlinks for each
2816 linked-to article (which seems to be an exceptionally good idea), we
2817 have to decide whether to maintain such a list as a part of the
2818 article itself or as part of some other article (presumably an article
2819 that contains nothing but metadata about the article that we're
2820 working with). This is an aesthetic consideration -- we're interested
2821 in maintaining
\emph{ownership
} over articles, so for this reason, we
2822 don't want them to contain world-editable components. However, it may
2823 not be so nice to have the article list filled up with system-owned
2824 metadata articles, either. Perhaps this is one case in which it would
2825 be good to use a separate namespace. (It is even conceivable that
2826 users would want different behavior in different circumstances; e.g.
2827 if all the articles are owned by one person, making portions of the
2828 articles ``world-editable'' may not be such a problem.)
2831 \begin{notate
}{Savings afforded by backlinks
}
2832 Here we assume that we use metadata articles of Note
2833 \ref{metadata-article-permissions
} and that we use a hash table to store the
2834 document. If we maintain a list of backlinks for each article, the
2835 added look-up cost of adding a link is $O(
1)$ per linked-to article
2836 (i.e. we need to find the appropriate place to store the backlink
2837 metadatum), and the cost to display an article is $O(
1)$ per
2838 linked-from article (i.e. we use the list of backlinks to find each
2839 scholium attached to the article being displayed). On the other hand,
2840 if we don't maintain backlinks, there is no look-up cost associated
2841 with adding a link, but there is a cost of $O(\#
\mathrm{Articles
})$
2842 associated with
document display, since we have to test every article
2843 to see if it is
\inp{about
} the article being displayed.
2846 \begin{notate
}{Private information
}
2847 This is one potential use of namespaces (we could have a public and a
2848 private namespace... though actually this sounds a bit more like
2849 something that we would want to use
\emph{labels
} for). Privacy is
2850 generally considered to be an important right.
2853 \begin{notate
}{Reading articles into a given namespace
}
2854 If a bunch of scholia have been saved to a file, it would be
2855 convenient to have a way to read them all into one specific namespace.
2858 \begin{notate
}{Intelligent search
} \label{intelligent-search
}
2859 One topic we must concern ourselves with from time to time is the
2860 \emph{scope of propagation
}. In a large system, we don't want to have
2861 to look at everything after any given change. Even if we maintain a
2862 list of backlinks (see Note
\ref{backlinks
}), we might well have to
2863 search through everything in order to find the articles that are
2864 backlinked to! (Which may not be such a bad thing if we use a hash
2865 table.) Another possible solution is to try to search intelligently,
2866 by using namespaces to guide the search. If each backlink tells you
2867 roughly where the corresponding linking article can be found, then you
2868 can recover that article much more efficiently. I'm pretty sure this
2869 relates to the system for IP addressses used on the web and also to
2870 the ``humber'' system used in Xanadu. (The Wikipedia page about the
2871 IP system probably contains important background). See also Note
2872 \ref{metadata-article-overview
} for related thoughts on using
2873 namespaces to limit search.
2876 \begin{notate
}{Possible relationship between labels and `type' data
}
2877 The
\inp{type
} field complements
\emph{labels
}; labels can be applied
2878 by anyone, but type data can only be changed by the object's owner.
2879 When you render an article, you look on its
\inp{type
} field first to
2880 get the basic type data specified by the author. Then you look at its
2881 metadata article to find backlinks; if any of these backlinks are to
2882 labels, you may find additional rendering information there.
2885 \begin{notate
}{Movable scholia
} \label{movable-scholia
}
2886 At various places in the lifecycle of a scholium, we'll want it to
2887 move around, either concretely (from one base of attachment to
2888 another) or ephemerally (appearing in some new place while continuing
2889 to be attached in its original location). We already have various
2890 features associated with some of these processes, for example,
2891 transclusion (Section
\ref{transclusion
}) is about viewing a given
2892 article through some new window. However, we'll want to do more,
2893 e.g., one thing that should be coming soon is the ability to pass
2894 scholia ``through'' a compilation (Section
\ref{quick-compilations
}).
2895 We'll eventually want to be able to do the reverse as well. In
2896 general, support for the various
\emph{concrete
} operations
2897 (e.g. passing a scholium through a reference and making it stick) are
2901 \section{Adding articles to the digital library
} \label{creation
}
2903 \begin{notate
}{Introduction to adding articles in the digital library
}
2904 The code in this section provides various wrappers for the `scholium'
2905 function, making it easy to create scholia. Section
\ref{bookkeeping
}
2906 details the process of adding appropriate
\inp{bookkeeping
}
2907 information to new articles; articles created using the functions in
2908 this section have standard
\inp{bookkeeping
} information added to them
2909 automatically. Section
\ref{adding-text
} concerns adding scholia
2910 based on already-existing sources of text. Section
\ref{interactive
}
2911 presents functions that the user would call to create articles in
2912 which the
\inp{text
} field is filled in by the user.
2914 For
\emph{editing
} articles that have already been added to the
2915 library, see Section
\ref{editing
}.
2918 \begin{notate
}{Setting `type' field at creation time
}
2919 The user might want to set the
\inp{type
} field at creation time, not
2920 just
\inp{text
} and
\inp{about
} (indeed, we could probably do a better
2921 with
\inp{about
} in a few places, e.g. throughout Section
2922 \ref{adding-text
}). But if it is not provided immediately,
\inp{type
}
2923 can still be edited in later.
2926 \subsection{Supplying initial bookkeeping information
} \label{bookkeeping
}
2928 \begin{notate
}{On `sch-book'
} \label{sch-book
}
2929 Interactive functions that call `scholium' should always provide
2930 \inp{bookkeeping
} information.
2932 The following definition can be extended to add any sort of initial
2933 bookkeeping information we might like to maintain. The
2934 \inp{bookkeeping
} field will be revised when the article is edited
2935 (see Section
\ref{editing
}).
2940 `((created ,user-login-name ,(current-time-string))))
2943 \subsection{Adding text from an existing source
} \label{adding-text
}
2945 \subsubsection{Adding text from buffers
} \label{adding-buffers
}
2947 \begin{notate
}{On `make-current-buffer-into-article'
}
2948 We store the object representing the buffer in the
\inp{text
} field.
2949 There is no particular reason to set the
\inp{type
} (at least, one has
2952 An alternative approach would be to make an article's
\inp{text
}
2953 reflect the current contents of the buffer (i.e., save the buffer as a
2954 string) -- but we currently don't do this. However, it would probably
2955 be nice to have that option, or even just the option to make a certain
2956 selection into an article.
2960 (defun make-buffer-into-article (&optional buffer name)
2961 (let* ((buffer (or buffer
2962 (get-buffer (read-buffer
2968 (read-string "Name: "
2971 (buffer-name buffer)))))
2972 (scholium name buffer nil nil (sch-book))))
2974 (defun make-current-buffer-into-article (name)
2975 (interactive (list (read-string
2976 (concat "Name (default "
2977 (buffer-name (current-buffer)) "): ")
2980 (buffer-name (current-buffer)))))
2981 (make-buffer-into-article (current-buffer) name))
2984 \begin{notate
}{Arbitrary buffer over current buffer?
}
2985 We could write `make-buffer-into-article' and
2986 `make-current-buffer-into-article' in such a way that the former
2987 calls the latter and uses `save-excursion'. Both approaches
2988 seem to have the same end result.
2991 \subsubsection{Adding text from files
} \label{adding-files
}
2993 \begin{notate
}{On `make-file-into-article'
}
2994 This function adds a file to the article list. Again, the
\inp{text
}
2995 field is not filled in with a string representing the text directly,
2996 but rather, with the name of the file that holds the text. A token is
2997 added to the
\inp{type
} field explaining that this is a file.
3001 (defun make-file-into-article (path name)
3003 (let* ((bufn (buffer-file-name))
3004 (pth (read-file-name
3006 (concat "File (default: " bufn "): ")
3011 (default-directory))))
3012 (dnme (file-name-nondirectory pth))
3013 (nme (read-string (concat "Name (default: " dnme "): ")
3018 (scholium name path nil '(file) (sch-book)))
3021 \subsection{Interactively supplying text
} \label{interactive
}
3023 \begin{notate
}{Global varibles describing new scholia
}
3024 The variables `new-scholium-name' and `new-scholium-about' are used to
3025 build new articles interactively. For now,
\inp{type
} is ignored by
3026 these functions. Also, we don't have a `new-scholium-text' field,
3027 since we get the text another way. It could be that an approach with
3028 a `new-scholium-text' variable would allow us to unify the treatment
3029 here with the one used in previous subsections.
3033 (defvar new-scholium-name nil "Name of our new scholium.")
3034 (defvar new-scholium-about nil "What the new scholium is about.")
3037 \begin{notate
}{On `new-scholium-mode'
}
3038 This mode is invoked by `make-scholium' in the buffer in which the new
3039 scholium's
\inp{text
} is to be supplied.
3043 (define-minor-mode new-scholium-mode
3044 "Mode for composing a new scholium.
3045 \\
{new-scholium-mode-map
}"
3047 :keymap '(("
\C-c
\C-c" . escape-scholium-creation)))
3050 \begin{notate
}{On `escape-scholium-creation'
}
3051 Once the new scholium's
\inp{text
} has been supplied, this function
3052 creates a scholium from that text and other data the user has
3053 supplied. It then restores the window configuration that was active
3054 before `make-scholium' ran. It also nullifies `new-scholium-name'
3055 and `new-scholium-about', since we're done with these things.
3059 (defun escape-scholium-creation ()
3061 (scholium new-scholium-name
3062 (buffer-substring-no-properties (point-min) (point-max))
3066 (kill-buffer (concat "Editing scholium: " new-scholium-name))
3067 (set-window-configuration sch-win-config)
3068 (setq new-scholium-name nil
3069 new-scholium-about nil))
3072 \begin{notate
}{On `make-scholium'
} \label{make-scholium
}
3073 This function is called every time the user makes a scholium with new
3074 text (i.e. text that is typed in on the fly). Functions for making
3075 scholia about articles, parts of articles, buffers, etc., are given in
3076 this
document and all use this function.
3080 (defun make-scholium ()
3081 (setq sch-win-config (current-window-configuration))
3082 ;; we allow this to be set elsewhere
3083 (unless new-scholium-name
3084 (setq new-scholium-name (read-string "Scholium name: ")))
3085 (set-buffer (get-buffer-create "Scholia Display"))
3087 (split-window-vertically)
3089 (switch-to-buffer (get-buffer-create (concat "Editing scholium: "
3090 new-scholium-name)))
3091 (new-scholium-mode))
3094 \begin{notate
}{Redisplay after running `make-scholium'
} \label{redisplay-after-running-make-scholium
}
3095 It would probably be fairly convenient to redisplay whatever object
3096 was being displayed after `make-scholium' has run. (It would be nice
3097 to have the configuration of windows be
100\% consistent!) In order
3098 to make this be efficient, we would probably want to a system for
3099 incremental markup, as described in Note
\ref{incremental-markup
}. Presumably this just means
3100 adding `redisplay-article' to an appropriate hook.
3103 \begin{notate
}{Add a `make-scholium-hook'?
}
3104 We could add a hook here if we wanted to make it easy to do
3105 interesting things after a scholium is added, like update the display.
3106 (We might want to make a section on default settings -- and we might
3107 want to make more hooks throughout the scholium system code.)
3110 \subsubsection{Scholia attached to the current article
} \label{attached-main
}
3112 \begin{notate
}{On `make-scholium-about-current-article'
}
3113 This function makes a scholium about the article as a whole.
3117 (defun make-scholium-about-current-article ()
3119 (when name-of-current-article
3120 (setq new-scholium-about `(((,name-of-current-article))))
3124 \begin{notate
}{On `make-scholium-about-part-of-current-article'
} \label{make-scholium-about-part-of-current-article
}
3125 This function makes a scholium about one specific portion of the
3128 This function makes the (somewhat unrealistic seeming) assumption that
3129 the current article and the current buffer are the same thing. This
3130 situation should be resolved.
3132 However, if no article is current yet, then perhaps we should
3133 offer to make a scholium about the current buffer?
3137 (defun make-scholium-about-part-of-current-article (beg end)
3139 (if name-of-current-article
3141 (setq new-scholium-about
3142 `((,name-of-current-article
3148 (message (concat (format "
%s--%s" beg end) " added.")))
3149 (message "Make some article current first.")))
3152 \begin{notate
}{The use of `deactivate-mark' in this code
}
3153 Since regions are being selected interactively, unless
3154 we `deactivate-mark', we will be left with a highlighted
3155 region after some of the scholium-creating function have
3156 run. This doesn't seem clean to me.
3159 \begin{notate
}{On `make-scholium-about-current-line'
}
3160 Here is a little convenience wrapper for working with lists.
3164 (defun make-scholium-about-current-line ()
3166 (make-scholium-about-part-of-current-article (line-beginning-position)
3167 (line-end-position)))
3169 (defun make-scholium-about-current-line-quickly ()
3171 (setq new-scholium-name (buffer-substring-no-properties
3172 (line-beginning-position)
3173 (line-end-position)))
3174 (make-scholium-about-part-of-current-article (line-beginning-position)
3175 (line-end-position)))
3177 (defun make-scholium-about-current-line-quickly-and-completely ()
3179 (scholium (buffer-substring-no-properties
3180 (line-beginning-position)
3181 (line-end-position))
3182 (buffer-substring-no-properties
3183 (line-beginning-position)
3184 (line-end-position))
3185 `((,name-of-current-article
3187 ,(line-beginning-position)
3188 ,(line-end-position))))
3192 (defun make-scholium-about-current-sentence ()
3194 (make-scholium-about-part-of-current-article (line-beginning-position)
3195 (line-end-position)))
3198 \begin{notate
}{Semantics of lists
} \label{semantics-of-lists
}
3199 Lists may benefit some special semantics. In particular, it might be
3200 useful to only display the scholia that are attached to
\emph{the
3201 current line
} (or item more generally). Also, an indicator to show
3202 the existence of scholia attached to other lines (when such scholia do
3206 \begin{notate
}{Scoring
}
3207 Maybe the way to go with scoring would be to make a change to the
3208 \inp{type
} field to indicate that the thing has type ``score
10'' or
3209 whatever. Or perhaps we would want to attach a scholium?
3212 \begin{notate
}{Locally-stored data versus indexed data
} \label{locally-stored-vs-indexed
}
3213 This reminds me of the different models of data storage. We could
3214 keep everything local (a score field for each scholium) or store
3215 things in an index (look-up each scholium to see if it has a score).
3216 The magic of hash tables says that lookup is ``linear'' but is the
3217 factor lower if the data is kept locally? Maybe on average.
3219 Of course, if you have to search a collection to find the extent of
3220 some predicate, that will take
\emph{some
} time; if everything
3221 matching a certain description has been stored on a certain list, then
3222 you already have the predicate's extent without search.
3224 There's really no reason not to store some things locally if we know
3225 that search is going to always be local (e.g. the score of a certain
3226 article is probably fine to store locally)
\emph{and
} we have
3227 permission to store that data locally. See Note
3228 \ref{holographic-data
} for more on this general topic -- the issues
3229 here have been pretty much resolved with in the design of metadata
3230 articles (Note
\ref{metadata-article-overview
}).
3233 \begin{notate
}{Local list of scholia
}
3234 One example of how local lists could come in handy (like we were
3235 talking about in Note
\ref{locally-stored-vs-indexed
}) would be to
3236 keep a local list of all the scholia that are attached to the current
3237 article. Then, if changes have to be propagated, we just look at the
3238 things on this list, rather than having to search through all of the
3239 articles again to figure out which scholia are attached to the current
3240 article. Of course, the local list could be kept updated as the set
3241 of scholia attached to the current article changes. This would (I
3242 think) be an optimization, and isn't essential for building a working
3246 \subsubsection{Creating a scholium that applies to several regions
}
3248 \begin{notate
}{On `reading-regions-mode'
}
3249 This mode is invoked by
3250 `make-scholium-about-several-parts-of-current-article', and
3251 adds an editing mode in the buffer containing the current
3252 article that enables the user to select regions that the
3253 scholium will be
\inp{about
}.
3257 (define-minor-mode reading-regions-mode
3258 "Mode for reading in regions.
3259 \\
{new-scholium-mode-map
}"
3261 :keymap '(("
\C-c
\C-c" . add-region)
3262 ("
\C-c
\C-g" . escape-reading-regions-mode))
3263 (message "C-c C-c to add regions; C-c C-g to make scholium."))
3266 \begin{notate
}{On `add-region'
}
3267 This function adds regions to `new-scholium-about'.
3271 (defun add-region (beg end)
3273 (setq new-scholium-about
3274 (cons `(,name-of-current-article
3278 new-scholium-about))
3280 (message (concat (format "
%s--%s" beg end) " added.")))
3283 \begin{notate
}{On `escape-reading-regions-mode'
}
3284 When all of the regions desired have been selected, this function
3285 calls `make-scholium' to finish things off.
3289 (defun escape-reading-regions-mode ()
3291 (reading-regions-mode -
1)
3295 \begin{notate
}{On `make-scholium-about-several-parts-of-current-article'
} \label{on-make-scholium-about-several-parts-of-current-article
}
3296 This function makes a scholium that applies to several portions of the
3297 article, using the mode and so on featured in this section.
3299 (Note, it doesn't seem that this is displayed quite right; I'm
3300 getting two copies of the scholium's text in the Scholia
3305 (defun make-scholium-about-several-parts-of-current-article ()
3307 (let ((article (get-article name-of-current-article)))
3308 (if (article-buffered article)
3309 (switch-to-buffer (get-buffer (scholium-text article)))
3310 (switch-to-buffer "Main Article Display"))
3311 (setq new-scholium-about nil)
3312 (reading-regions-mode
1)))
3315 \subsubsection{Scholia about the current buffer
} \label{about-buffer
}
3317 \begin{notate
}{Making scholia about the current buffer
}
3318 We present facilities for making new scholia about the current buffer
3319 or file that this buffer is visiting. Corresponding functions for
3320 displaying scholia that are attached to the current buffer appear in
3321 section
\ref{rendering
}. This function ensures that the buffer is
3322 associated with on article on the article list; otherwise, we can't
3323 make a scholium about it.
3326 \begin{notate
}{On `call-if-user-adds-current-buffer-to-article-list'
}
3327 This is used by functions that require the current buffer to
3328 be an article; typically they recall themselves after the
3329 buffer has been added. It is used by
3330 `make-scholium-about-current-buffer' and
3331 `display-scholia-about-current-buffer'.
3335 (defun call-if-user-adds-current-buffer-to-article-list (fct)
3336 (when (y-or-n-p "Buffer not an article, add to list? ")
3337 (make-current-buffer-into-article
3338 (read-string (concat "Name (default: "
3340 (current-buffer)) "): ")
3343 (buffer-name (current-buffer))))
3347 \begin{notate
}{On `make-scholium-about-current-buffer'
}
3348 This function makes a scholium about the current buffer,
3349 requiring that it be an article. (Maybe we should
3350 just add the current buffer to the article list
3351 transparently, rather than giving the prompt in
3352 `call-if-user-adds-current-buffer-to-article-list'.)
3356 (defun make-scholium-about-current-buffer ()
3358 (let ((article (get-article (buffer-name (current-buffer)))))
3360 (call-if-user-adds-current-buffer-to-article-list
3361 'make-scholium-about-current-buffer)
3362 (setq new-scholium-about
3363 `(((,(buffer-name (current-buffer))))))
3367 \begin{notate
}{Scholium creation modalities
} \label{scholium-creation-modalities
}
3368 We developed all sorts of creation facilities for generic articles,
3369 shouldn't we have them all over again for buffers? It seems only fair
3370 that there would be some symmetry between the way articles and buffers
3371 are handled. Maybe there is some way to reuse the work.
3373 On the other hand, maybe we don't need a lot of complex functions for
3374 specially handling buffers, since once the buffer has been made into
3375 an article, all of the functions for working with articles apply.
3376 (Contrast Note
\ref{bias-towards-buffers
}!)
3379 \begin{notate
}{Making a scholium about a file.
}
3380 Doing something like what `make-scholium-about-current-buffer' does
3381 that makes a scholium about the current buffer
\emph{as
} a file
3382 shouldn't be very different at all. I'll want to think a little more
3383 about the relevance of doing things this way: it may not really matter
3384 if we run the exporting and importing routines just right. (We could
3385 also write a function to make scholia about a file without displaying
3389 \subsubsection{Creating references
} \label{creating-references
}
3391 \begin{notate
}{Fancy references
} \label{fancy-references
}
3392 In Note
\ref{references
} it isn't made completely clear what the set
3393 of reference targets is comprised of. One might be led to assume that
3394 it is only possible to reference to an
\emph{article
}. In the current
3395 implementation, that assumption is correct; `follow-reference' calls
3396 `display-article', which in turn only knows how to display
3397 \emph{articles
}. However, in theory we could just as well reference
3398 any object that the system knows how to display; so, if
3399 `display-article' was overloaded to work with regions as well as
3400 articles, for example, there would be no problem with referencing
3401 regions (although the code for `make-reference-in-current-article'
3402 would have to be adjusted slightly). It would be nice to add this
3403 feature, since HTML already has targets that are approximately this
3404 general (well, more like ``go to a specific point within the given
3405 document''). It shouldn't be too much to ask to enable following a
3406 reference and then performing a given action (e.g. ``find the first
3407 occurance of
\emph{foo
} in the referenced
document'').
3409 Another relevant thing to point out is that we can have different
3410 kinds of references appear in different colors (Note
3411 \ref{color-and-style
}); this is true of other sorts of linking as
3412 well (Note
\ref{generalized-links
}). Compare Note
3413 \ref{thought-processes
}.
3416 \begin{notate
}{Abstract connections
}
3417 References have two
\inp{about
} fields, one comprising the reference's
3418 target, and the other, the region from which the reference originates.
3419 This shows how an abstract connection between two documents can be
3420 formed by a third element, rather than such connections being the
3421 exclusive domain of
\inp{about
} data itself. This is an important
3422 feature for semantic networks; larger-scale structures can be
3423 expressed using basic pieces.
3426 \begin{notate
}{On `genref'
} \label{genref
}
3427 Instead of using `gensym' (which causes problems) we do something
3428 similar to generate references with unique ids. Note that this might
3429 cause some problems when we go to the distributed way of doing things
3430 (or even just save and restore articles with references in them after
3431 making some intervening edits), since references with the same names
3432 might mean different things. But of course, this is true of all
3433 scholia with the same names, so I propose not to worry about it too
3436 It may turn out to be advantageous to use a reference counter that is
3437 local to each article.
3439 Actually, the scheme proposed here seems pretty weak; saving files and
3440 then reading them back in after Emacs has been shut down could cause
3441 problems. It might be much better to have a reference counter in each
3442 metadata article, so that the collection of references associated with
3443 a given article is always unique. Furthermore, references associated
3444 with a given article should possibly be recorded on that article's
3445 metadata explicitly
\emph{as references
}.
3449 (defvar *reference-counter*
0)
3452 (setq *reference-counter* (
1+ *reference-counter*)))
3455 \begin{notate
}{On `make-reference-in-current-article'
} \label{make-reference-in-current-article
}
3456 This function is similar to
3457 `make-scholium-about-part-of-current-article' (Note
3458 \ref{make-scholium-about-part-of-current-article
}) except that the
3459 \inp{type
} is set to ``reference''. References currently don't have any
3460 \inp{text
}, but we could later set things up to let them have a
3461 docstring or something like that.
3463 (Are backlinks working properly in an article that has several
3464 references associated with it?)
3468 (defun make-reference-in-current-article (beg end &optional target)
3470 (let ((target (or target
3471 (read-article-name))))
3472 (if name-of-current-article
3474 (scholium `(reference ,name-of-current-article ,(genref))
3476 `((,name-of-current-article
3483 ;; Maybe the message should instead be an offer to make
3484 ;; a scholium about the current buffer?
3485 (message "Make some article current first."))))
3488 \begin{notate
}{Speedy reference creation
}
3489 It would be handy to be able to make a reference to an article and
3490 automatically create and follow the reference, all at the same time.
3491 (Maybe also subsets of these actions, like create but don't follow.)
3492 Probably we could do something similar for generalized references.
3496 (defun create-follow-reference ()
3498 (let ((name (buffer-substring (point) (mark))))
3499 (unless (get-article name)
3501 (set-buffer (get-buffer-create name))
3502 (make-current-buffer-into-article name)))
3503 (make-reference-in-current-article (min (point) (mark))
3504 (max (point) (mark))
3506 (display-article name)))
3509 \begin{notate
}{Come-from references
} \label{come-from-references
}
3510 As weird as it might sound, it could be handy to have a function for
3511 adding references to the current article from some other article (or class
3512 of articles). See Note
\ref{backlinks
} for further comments. (It
3513 seems possible, though maybe not too likely, that we would be able to
3514 use the outline of `make-reference-in-current-article' to create a generic
3515 function for both ``come-from'' and ``goto'' references.)
3518 \begin{notate
}{Inspecting or changing reference target, deleting reference, changing ``alt text''
}
3519 Various operations that you might like to do with a reference need should
3520 to be supported. changing the ``alt text'' should be supported
3521 automatically -- just edit the text -- but there is the chance that
3522 the user could screw things up and accidentally delete the whole
3523 scholium if they do the wrong thing, so we may want to provide some
3527 \begin{notate
}{Reference component access
} \label{reference-access-functions
}
3528 These functions give easy access to information specifying the
3529 referenced article (the target), the region the reference applies to,
3530 and the name of the article the reference lies in. These functions
3531 rely on the formulaic nature of the
\inp{type
} data of references,
3532 namely, a link to the passage wherein the reference is made is given,
3533 followed by a link to the referenced article.
3535 Notice that these functions would have to change if we later
3536 allow multiple sources (presumably, regions) to be part of the
3541 (defun reference-source-link (reference)
3542 (first (scholium-about reference)))
3544 (defun reference-from-article (reference)
3545 (car (reference-source-link reference)))
3547 (defun reference-to-article (reference)
3548 (car (second (scholium-about reference))))
3551 \begin{notate
}{Justification of the representation of references
}
3552 It might seem excessive to have backlinks to a reference on the
3553 reference target and the reference source, but remember that we want
3554 to be able to display references as scholia. Now, one thing that
3555 might be the case is that instead of storing a standard backlink on
3556 the reference target, we might want to store a special
3557 ``referenceed-by'' backlink. But
\emph{that
} is probably excessive,
3558 at least, given our rendering scheme (see Note
\ref{mark-things-up
}).
3561 \subsubsection{New undirected articles
} \label{new-undirected
}
3563 \begin{notate
}{On `make-new-undirected-article'
}
3564 Although one could simply create a new buffer and add that buffer to
3565 the article list (as in Section
\ref{adding-buffers
}), sometimes it
3566 may be more intuitive to simply add a new undirected article directly
3567 to the article list.
3571 (defun make-new-undirected-article ()
3573 (setq new-scholium-about nil)
3577 \subsubsection{Followups
} \label{followups
}
3579 \begin{notate
}{Introduction to followups
}
3580 This section is about making scholia about other already-existing
3581 scholia. It relies on markup features from Section
\ref{rendering
},
3582 and its presence here is a bit ugly (Note
\ref{principle-of-order
}).
3583 Perhaps it will be moved somewhere else later.
3586 \begin{notate
}{Complex ``about'' features for scholia
}
3587 More complicated features like creating scholia directly about several
3588 regions of a given scholium or like creating a scholium that relates
3589 to several regions of several different scholia can be coded up soon,
3590 following the style of section
\ref{attached-main
}.
3593 \begin{notate
}{On `name-of-current-scholium'
}
3594 The function can be called from anywhere; ``current'' is defined
3595 relative to the position of `point' in the Scholia Display buffer.
3596 (It is natural to assume that there is only one current scholium,
3597 given the way the contents of this buffer have been put together.)
3599 Note that
\emph{scholia
} appear once in the Scholia Display buffer, so
3600 there is only one ``current scholium'' (with one name) when we look at
3601 things this way. If we were going to do something like this for the
3602 main article buffer, then we'd need to do a bit more. (In fact,
3603 various functions to associate marked regions with scholia need just
3604 this sort of special touch.)
3608 (defun name-of-current-scholium ()
3611 (set-buffer (get-buffer-create "Scholia Display"))
3612 (let ((ret (car (scholia-named-at-point))))
3614 (message (format "
%s" ret))
3615 (message "Position cursor on a scholium in Scholia Display."))
3618 (defun make-scholium-about-current-scholium ()
3620 (when (equal (buffer-name (current-buffer)) "Scholia Display")
3621 (let ((cur (name-of-current-scholium)))
3623 (progn (setq new-scholium-about `(((,cur))))
3624 (make-scholium))))))
3627 \subsection{Further notes on adding articles to the digital library
}
3629 \begin{notate
}{Forbid the creation of ``empty'' scholia?
}
3630 Perhaps `make-scholium' should disallow (or at least display an idiot
3631 box about) the creation of ``empty'' scholia -- they seem somewhat
3635 \begin{notate
}{Transcluded strings
}
3636 We'd should have some function to insert an auto-updating string (like
3637 the name for the buffer as an article). We would typically want such
3638 auto-updating portions to appear in a specially colored face.
3641 \begin{notate
}{Multi-reference creation?
}
3642 This section should probably cover: the event of interactively making
3643 a scholium that relates to several different pieces of text from
3644 several different articles. Note that you could probably do things
3645 like this by using the generic list, and marking things in different
3646 ways that show their relationship together, the create the new
3647 scholium from that list.
3650 \begin{notate
}{Anonymous scholia
}
3651 Creating ``anonymous'' scholia should probably be made possible; by
3652 which I mean, the names of these scholia would be filled in
3653 automatically but would be non-significant (compare `gensym'). Of
3654 course, if we could have automatic names that were significant that
3658 \begin{notate
}{Merging editorial comments
}
3659 It would be nice if there was an easy way to merge editorial comments
3660 into the main
document, corresponding to the ability to make such
3661 comments in the first place (Note
\ref{straightforward-applications
}).
3664 \section{Rendering articles
} \label{rendering
}
3666 \subsection{Formatting articles for display
} \label{formatting-articles
}
3668 \begin{notate
}{``Formatting'' versus ``display'' versus ``rendering''
} \label{why-we-say-rendering
}
3669 The term ``formatting'' seems to capture a specific notion of
3670 producing a user-visible version of an arbitrary article, that is then
3671 ``displayed''. ``Rendering'' is meant to capture a more general idea,
3672 which includes non-user-visable features (e.g. invisible text
3673 properties). Some sorts of articles will require further work to
3674 ``render'' (see Note
\ref{transformative
} and Note
3678 \begin{notate
}{Generality, or lack thereof, in the rendering system developed here
}
3679 It woulb be great to have all sorts of different kinds of rendering
3680 systems. (For one example additional to those mentioned in
3681 \ref{why-we-say-rendering
}, see Note
3682 \ref{interactive-and-actionable-scholia
}; we could supply other
3683 examples!) For now, we have limited ourselves to something pretty
3687 \begin{notate
}{Producing plain text
}
3688 The function `sch-plain-text' uses various criteria to render scholium
3689 system objects as a string (the collection of acceptable objects is
3690 the same as the collection of link targets, plus articles specified
3691 simply by name). Its behavior can be fine-tuned by changing the
3692 variable `sch-plain-text-hook'.
3695 \begin{notate
}{On `sch-plain-text-hook'
} \label{sch-plain-text-hook
}
3696 Alternative ways of setting the return value of `sch-plain-text'.
3700 (defvar sch-plain-text-hook nil)
3703 \begin{notate
}{On `sch-plain-text'
} \label{sch-plain-text
}
3704 This function is called by `mark-up-scholium' to render scholia that
3705 are to be displayed alongside the main article, and also by
3706 `transclude-article' (see Note
\ref{transclude-article
}) and other
3707 functions in Section
\ref{transclusion
}.
3709 Its goal is to turn arbitrary articles into strings. This will be
3710 done in different ways depending on the sort of article in question.
3711 (And could be done in other ways depending on other stuff.) Compare
3712 Note
\ref{user-crafted-semantics
}.
3714 Here's how it works: different kinds of ``objects'' are to be
3715 distinguished from one another by simple tests -- is the `car' equal
3716 to
\verb|passage|? Does looking up the object in the article table
3717 produce anything? Then act as appropriate, grabbing the text that is
3718 specified. Currently it works on input
\emph{article names
} or
3719 input
\emph{articles
}. (If input is both the name of an article
3720 and an article, it will be treated as a name.)
3722 Another thing that might be handy to be able to process is
3723 \emph{simple strings
}, which aren't article names, or articles
3726 Note that links are rendered differently depending on context.
3728 Links can't actually run from arbitrary object to arbitrary
3729 object within the current version of the system. That can
3730 probably be fixed easily.
3732 Converting the function to render scholium system objects in general
3733 is a step towards answering the request in Note
3734 \ref{name-of-current-article
} about extending the purview of
3735 `display-article'. At that point, it will take more than just a
3736 \inp{title
} as argument, certainly; and it will need a ``triage''
3737 phase in order to figure out what sort of object it has been applied
3738 to; various modifications will have to be made so that it can be
3739 applied to various sorts of objects.
3743 (defun sch-plain-text (title-or-article)
3744 ;; this overloading of the input & reliance upon `get-article' to
3745 ;; sort things out... could probably be revised into something
3747 (let* ((obj (or (get-article title-or-article)
3749 (text (scholium-text obj))
3750 (type (scholium-type obj))
3752 ;; This seems like the correct way to override a `cond' form.
3753 (run-hooks 'sch-plain-text-hook)
3757 (save-excursion (set-buffer (get-buffer text))
3758 (setq ret (buffer-string))))
3759 ((typedata-includes type 'file)
3760 (let ((bufs (buffer-list))
3762 (while (and bufs (not live))
3763 (when (equal (buffer-file-name (car bufs))
3764 (expand-file-name text))
3765 (setq live (car bufs)))
3766 (setq bufs (cdr bufs)))
3768 (progn (set-buffer live)
3769 (setq ret (buffer-string)))
3771 (setq ret (buffer-string))
3772 (kill-buffer (current-buffer)))))
3773 ;; these quoted things should presumably themselves be rendered
3774 ;; as links (and we probably don't need the crazy markup for
3775 ;; things about the whole buffer, ever)
3776 ((typedata-includes type 'reference)
3777 (if (equal (reference-to-article obj)
3778 name-of-current-article)
3780 ;; it might be kind of cool to at least include a
3781 ;; snippet of the context of this link, say
3 lines
3783 (format "\"
%s\" links here."
3784 (reference-from-article obj)))
3786 (format "This is a link from \"
%s\" to \"%s\"."
3787 (reference-from-article obj)
3788 (reference-to-article obj)
3793 (setq ret (format "
%S" text)))))
3797 \begin{notate
}{Turn list of ``links here'' items into listing
}
3798 It would be nice to be able to view all of the ``links here''
3799 articles in a listing (as in Section
\ref{catalog
}), and from
3800 there in a compilation (Note
\ref{making-a-compilation
}).
3803 \begin{notate
}{Rendering special list forms
}
3804 With a small loss of transparency (note
3805 \ref{principle-of-transparency
}), we can set up some specially-encoded
3806 \inp{text
} fields. See, e.g., Section
\ref{transclusion
}.
3809 \begin{notate
}{Strategy for `cond's
}
3810 Any time we see a `cond' in this code, we could wrap it in a backquote
3811 and unquote a variable that says how to deal with things that come up
3812 later in the code (see Note
\ref{principle-of-order
}).
3815 \begin{notate
}{Actionable references
} \label{actionable-references
}
3816 When displaying a reference as the main article, it would be nice to
3817 have the names of the articles (or other objects) themselves rendered
3818 as references to the articles (or other objects) in question. These
3819 wouldn't officially be ``references'' from the point of view of the
3820 system (unless they were temporary ones), but they would act like
3821 references for the user.
3823 Some examples of this sort of thing appear in Section
\ref{linear-browsing
},
3824 and are hooked in by `scholia-display-extras-hook'
3825 (Note
\ref{scholia-display-extras-hook
}).
3828 \begin{notate
}{Render the names of articles?
}
3829 Depending on the value of a variable like `sch-use-names' or something
3830 of that sort, this could print the names of the scholia above their
3831 text contents. We might also want to print a list of articles that
3832 this article is ``about'' (assuming there is more than one).
3835 \subsection{Managing windows and buffers
} \label{managing-windows-and-buffers
}
3837 \begin{notate
}{Side-by-side buffers
} \label{side-by-side-buffers
}
3838 The first display style shows the main article in one buffer and
3839 scholia about this article in another buffer. The scholia may be
3840 attached to specific regions of the main article, in which case, this
3841 connection is shown graphically. Other display styles
3842 (e.g. threading, see Note
\ref{threading
}) are in the works.
3845 \begin{notate
}{Special treatment of buffers and files
} \label{bias-towards-buffers
}
3846 Buffers and files need some special treatment for display, even if
3847 they don't need to be given much attention at scholium-creation time
3848 (Note
\ref{scholium-creation-modalities
}). For example, it would be
3849 nice to set up automatic display of scholia associated with a given
3850 file if some spceial variable is set. One class of buffers that
3851 requires special treatment are the
\emph{killed
} ones (see Note
3852 \ref{killed-buffers
}). This issue relates to Note
3853 \ref{the-emacs-way
}.
3856 \begin{notate
}{Simpler side-by-side annotation
}
3857 A simpler method for doing side-by-side editing has been discussed
3858 recently on the help-gnu-emacs mailing
3859 list
\footnote{{\tt http://lists.gnu.org/archive/html/help-gnu-emacs/
2005-
07/msg00276.html
}}.
3860 This gives local features similar to some of those provided by the scholium
3861 system, but none of the global features. (We should make sure that we
3862 actually
\emph{can
} simulate this behavior, I think it should be no problem.)
3865 \begin{notate
}{A physical scholium system
} \label{physical-scholium-system
}
3866 Working on this paper, I've taken to printing the
document out
3867 single-sided and binding the drafts along the margin, so that each
3868 page has a blank facing page that I then use for notes. Sounds
3869 familar, doesn't it? This approach is helping me understand how to
3870 use paper better. And it is giving me some ideas about useful
3871 features to work into the electronic version. See also Note
3875 \begin{notate
}{Working with large-form scholium systems
} \label{large-form
}
3876 With larger pieces of paper, or other media, it is possible to put
3877 together scholium-based documents with more content and more than two
3878 columns. With a couple of screens, or a larger screen, useful things
3879 along these lines could be accomplished with Emacs too. (As it is,
3880 two side-by-side windows is about all that can be managed on my
3883 Working with large format documents, I noticed some interesting
3884 effects. On the left, I might see a
document assembled out of several
3885 smaller articles (say, by identification), and on the right, I would
3886 see all of the comments that applied to any of these articles, while a
3887 third columns would give comments that applied to text in the other
3888 columns, or to the
document as a whole, or to any of the other
3889 articles that had gone into building previous columns.
3891 Even with just a couple of columns to work with, various complex
3892 things like this should be possible to do on the computer (e.g. with
3893 different colors or different levels of indentation).
3895 (The point is, eventually should be able to make more interesting sort
3896 compilations than those described in Section
3897 \ref{quick-compilations
}.)
3900 \begin{notate
}{Avoiding information overload
} \label{avoiding-information-overload
}
3901 A tricky option would be to just display the scholia that relate
3902 to portions of the
document that are on the current screen. The paper
3903 version of Note
\ref{physical-scholium-system
} does this by default.
3904 But I'm not sure how to make Emacs behave this way.
3907 \begin{notate
}{Context
} \label{context
}
3908 Context is important. This is one of the reasons that scholia
3909 themselves are important -- they get comments situated in a certain
3910 \emph{con
}text. The notion of context seems to be different for
3911 \emph{text
} and
\emph{hypertext
}. In text, everthing appears in
3912 context, whereas in hypertext, nearby things sometimes don't appear at
3913 all; they reside on the other side of a link, and may never be seen by
3914 a reader. But this duality is somewhat misleading, in particular, it
3915 is sometimes thecase that ``information overload'' would occur if
3916 everything appeared on the same page or in the same place. And
3917 sometimes the context of the page can be misleading; regular text
3918 frequently relies on global contextual features. (And of course,
3919 readers might not actually see everything that is on the page!) It is
3920 an interesting feature of reality and human psychology that contexts
3921 are often decipherable -- we can figure out how things fit together.
3922 A ``good'' hypertext model should presumably include features that
3923 reflect this aspect of our thinking, and allow users to explicitly
3924 recontextualize things as they see fit. For some technical
3925 suggestions on this matter, see Note
\ref{displaying-nearby-scholia
}.
3928 \begin{notate
}{Dot dot dot
}
3929 How should scholia in later generations be displayed? In the default
3930 mode, without threading, a ``dot dot dot'' would be useful. (And in
3931 the case of scholia that bridge the gap between two articles, the
3932 ``dot dot dot'' probably needs to have a special meaning.) Anyway,
3933 note that these dot-dot-dotted things could be found by a depth-first
3934 search through the
document collection. (Find anything
\inp{about
}
3935 the current article, then find anything
\inp{about
} that, etc., then
3936 find the next thing
\inp{about
} the current article,
3937 etc.)
\footnote{Compare the
2nd figure in Corneli and Krowne (
2005)
3938 (cf. Footnote
\ref{corneli-krowne
}, Page
\pageref{corneli-krowne
}).
}.
3939 % How to get page reference corresponding to a label?
3943 (defvar pre-sch-win-config nil "Saved window configuration.")
3944 (defvar sch-win-config nil "Saved window configuration.")
3946 (defvar buffer-associated-with-current-article nil)
3949 \begin{notate
}{On `article-buffered'
}
3950 Here's a little convenience function that tells you whether the
3951 article's text lives in a buffer or not.
3955 (defun article-buffered (article)
3956 (bufferp (scholium-text article)))
3959 \begin{notate
}{Make new buffered article
}
3960 We should provide some command to make a new article in a new
3961 buffer, all in one shot.
3964 \begin{notate
}{Detaching articles from buffers
}
3965 Perhaps it should be possible to detach a buffered article from the
3966 buffer that contains it.
3969 \begin{notate
}{On `scholia-overwhelm-display'
} \label{scholia-overwhelm-display
}
3970 This function displays scholium stuff. It is called by
3971 `display-article' (Note
\ref{display-article
}) and
3972 `display-scholia-about-current-buffer'
3973 (Note
\ref{display-scholia-about-current-buffer
}). If
3974 there is a main article buffer (i.e. the article to be displayed lives
3975 in its own buffer), we use that buffer to display the article;
3976 otherwise, we use the ``Main Article Display'' buffer. Scholia that
3977 match the appropriate set of conditions in `mark-things-up' will be
3978 rendered to the ``Scholia Display'' buffer.
3982 (defun scholia-overwhelm-display (text)
3983 (unless pre-sch-win-config
3984 (setq pre-sch-win-config (current-window-configuration)))
3985 (delete-other-windows)
3986 (split-window-horizontally)
3987 (if rendering-target-buffer
3988 (pop-to-buffer rendering-target-buffer t)
3989 (switch-to-buffer (get-buffer-create "Main Article Display") t))
3992 (goto-char (point-min))
3993 (setq buffer-associated-with-current-article (current-buffer))
3995 (switch-to-buffer (get-buffer-create "Scholia Display") t)
3999 \begin{notate
}{Switching between views
} \label{switching-between-views
}
4000 We offer a few convenient functions for switching between the
4001 article-plus-scholia browsing display and whatever came before. It
4002 would also be nice to offer a function for switching between the
4003 article display and the generic listing display.
4007 (defun back-to-normal ()
4009 (setq sch-win-config (current-window-configuration))
4010 (set-window-configuration pre-sch-win-config)
4011 (setq pre-sch-win-config nil))
4013 (defun back-to-other-view ()
4015 (setq pre-sch-win-config (current-window-configuration))
4016 (set-window-configuration sch-win-config)
4017 (setq sch-win-config nil))
4020 \subsection{Sorting scholia for markup purposes
} \label{sorting
}
4022 \begin{notate
}{Introduction to sorting scholia
}
4023 The main function in this section is `sort-scholia-by-beg-position',
4024 which is called by `mark-things-up'.
4026 The use for this function is to put scholia in the order in which they
4027 will be rendered; the order is given by sorting the scholia on their
4028 \inp{about
} data. Since there are several different kinds of
4029 \inp{about
} data, the sorting criteria are a little complicated. For
4030 one thing, each scholium may be about several different articles, but
4031 here we only want to sort relative to their relationship to one given
4034 The criterion we use when sorting is: scholia that are about the whole
4035 article go first; then, we rank any other scholia according to their
4036 \emph{first
} beginning position. (Thus, any scholia that are about
4037 several regions within the same article need to have a subsidiary sort
4038 done to order the indicated regions; this is accomplished, as
4039 needed, by the function `first-beginning-about-article', below.)
4042 \begin{notate
}{On `first-beginning-about-article'
}
4043 Return
0 if
\inp{about
} is about all of
\inp{article
}, i.e., otherwise
4044 return the character position of the first region within
\inp{article
}
4045 that
\inp{about
} is actually about. If there is none, return nil.
4046 (Actually, let me note that in the usage we have established so far,
4047 we would already know that in the case that
\inp{about
} is a string,
4048 it is about the article here, and in the case that
\inp{about
} is a
4049 one-layer list, similarly; so some of the tests we do here are as yet
4052 Here we're assuming that if there is
\emph{some
} link to the article
4053 that isn't a passage link, then we treat the link as about the article
4054 as a whole. The case in which the link is about the whole article
4055 \emph{and
} some part of the article might possibly be better treated
4056 some other way; but I'll leave that case for subsequent work.
4060 (defun first-beginning-about-article (about article)
4062 ;; condition for the scholium to be about the article as a whole.
4063 ;; The condition is that there is _some_ link to the article that
4064 ;; is NOT a ``passage''-type link. In this case, we just return
0.
4065 ((member-if (lambda (link)
4066 (and (equal (car link) article)
4067 (not (link-type-accessor link 'passage))))
4070 ;; else, collect the regions of `article' that `about' indicates,
4073 (let* ((marking-links
4077 (typedata-includes-passage (link-type elt))
4078 (equal (linked-to-article elt) article))
4079 (setq marked (cons elt marked))))
4085 (lambda (link1 link2)
4086 (< (link-beginning link1)
4087 (link-beginning link2)))))))
4088 (link-beginning earliest-link)))))
4091 \begin{notate
}{On `sort-scholia-by-beg-position'
} \label{sort-scholia-by-beg-position
}
4092 This function orders
\inp{scholia
} according to the magnitude of the
4093 smallest beginning a region of
\inp{article
} that the input scholia
4094 mark. All links are considered when finding the first marked region.
4098 (defun sort-scholia-by-beg-position (scholia article)
4102 (lambda (scholium1 scholium2)
4103 (let ((beg1 (first-beginning-about-article
4104 (scholium-about scholium1)
4106 (beg2 (first-beginning-about-article
4107 (scholium-about scholium2)
4114 \begin{notate
}{Incremental markup
} \label{incremental-markup
}
4115 Instead of sorting everything each time we display, it would be nice
4116 to handle things incrementally: just add new markup for the newly
4117 created scholium, and store things in their natural order after
4118 reparsing. I think that this approach should work, but it would
4119 involve making a number of changes to the code. (Note that
4120 in the setup we're using, updates to metadata may have to be
4121 wholesale, even if updates to text properties are incremental.)
4124 \subsection{Marking things up
} \label{marking-things-up
}
4126 \begin{notate
}{Introduction to marking things up
}
4127 As mentioned in the introduction (Note
4128 \ref{text-properties-and-overlays
}):
\emph{when articles are
4129 displayed, both overlays and text properties are used for markup
}.
4130 Overlays make it possible to put visible markup into font locked
4131 buffers. However, when text is cut and pasted or whatever, overlays
4132 disappear, so we use text properties too, to add a needed degree of
4133 permanence to the markup.
4136 \subsubsection{Faces for overlays
}
4138 \begin{notate
}{A more abstract face function
}
4139 Perhaps `new-simple-scholium-face' could take an argument -- say the
4140 scholium -- and provide a different face for each user, or a different
4141 face for each type, or whatever. Probably there should be a variable
4142 called `scholium-face-function' that points you to the
\emph{actual
}
4143 function that is going to be in use. Using this sort of abstraction
4144 throughout would certainly facilitate user customization, and so,
4145 would be a good thing.
4148 \begin{notate
}{On `new-simple-scholium-face'
}
4149 Adapted from ttn's
{\tt ricette-mode.el
}.
\emph{Nota bene
}: new faces
4150 are automatically customizable, so if you don't like the way they
4151 look, you can change them.
4155 (defmacro new-simple-scholium-face (num
color doc)
4156 (let ((prop (intern (concat "sch-face-" (int-to-string num)))))
4158 (defvar ,prop ',prop)
4160 '((t (:foreground ,(symbol-name
color)
4161 :underline ,(symbol-name
color)))) ,doc))))
4164 \begin{notate
}{Underlining versus foreground
} \label{underlining-versus-foreground
}
4165 It is worth considering using the underline attribute instead or in
4166 addition to the foreground attribute: underlining would be less
4167 obtrusive in documents that already use faces. We could have two
4168 variants; one with underlining for the main article, one foreground
4169 for the scholia display. We could also give users some
4170 immediately-customizable options. (Do the default colors I picked out
4175 (new-simple-scholium-face
1 maroon1 "First scholium face.")
4176 (new-simple-scholium-face
2 aquamarine1 "Second scholium face.")
4177 (new-simple-scholium-face
3 IndianRed1 "Third scholium face.")
4178 (new-simple-scholium-face
4 yellow1 "Fourth scholium face.")
4179 (new-simple-scholium-face
5 firebrick1 "Fifth scholium face.")
4180 (new-simple-scholium-face
6 plum1 "Sixth scholium face.")
4183 \begin{notate
}{Reference face
} \label{reference-face
}
4184 A special face for references. We don't currently have a special face
4185 for
\emph{visited
} references, but this can be added if/when we start
4186 keeping track of which references have been visited (see Note
4187 \ref{visited-references
}). We might also want to record and display
4188 information about visited articles in general.
4192 (defface sch-reference-face
4193 '((t (:foreground "red" :underline "red")))
4194 "Face for references in the scholium system.")
4197 \begin{notate
}{Special face for scholia about whole article?
}
4198 It might be good to have a special face (and perhaps other
4199 special treatment, like a special section of the scholia display
4200 buffer) for scholia that apply to the whole of the main article.
4203 \begin{notate
}{Special face for transclusions that have been collapsed
} \label{collapsed-face
}
4204 We're going to have to have a special face for transclusions that
4205 have been collapsed (see Note
\ref{transcluding-and-outlines
}).
4208 \subsubsection{Masks and miscellaneous markup mechanics
}
4210 \begin{notate
}{Color by number
} \label{color-by-number
}
4211 The `scholia-count' variable keeps track of how many scholia have been
4212 displayed. The `scholium-face' function selects a face to use when
4213 displaying the next scholium according to this count. This simple
4214 display mechanism seems sort of lame (hence, it is turned on with the
4215 `use-crazy-font-lock' variable); better things may come later, see,
4216 e.g. Note
\ref{color-and-style
}.
4218 Note that turning off ``crazy font lock'' makes it so that no text
4219 properties are added to the buffer, but of course it would be best if
4220 text properties were added and overlays omitted. On the other hand,
4221 we need to do some thinking to sort out the use of text properties
4222 versus the use of overlays. Cutting and pasting multiple copies of
4223 some markup in the same buffer may cause some trouble at commit time.
4224 See Section
\ref{transclusion
}; also, compare Note
4225 \ref{aggressive-dop
}.
4229 (defvar scholia-count
0 "Number of scholia about the article found.")
4231 (defun scholium-face ()
4232 (let ((short-count (mod scholia-count
6)))
4233 (cond ((eq short-count
0)
4246 (defvar use-crazy-font-lock t)
4247 (defvar main-article-overlays nil)
4248 (defvar scholia-overlays nil)
4251 \begin{notate
}{Overlays and text properties adjust when editing
}
4252 By default, overlays and text properties will move appropriately when
4253 text is added to the buffer. This is important!
4256 \begin{notate
}{Access to rendering target buffer
} \label{access-to-rendering-target-buffer
}
4257 The rendering target buffer is either ``Main Article Display'' if the
4258 current article isn't buffered, or whatever buffer the article lives
4259 in if it is buffered. (Well, actually, we can always redirect
4260 rendering to any buffer of our choice; but the preceding statement
4261 accurately describes the default operation.) We use
4262 `get-rendering-target-buffer' as a shorthand when we grab the
4263 rendering target buffer, and `set-buffer-to-rendering-target-buffer'
4264 to make that buffer current for editing. (Note that we
\emph{could
}
4265 go about this in a slightly different way, namely set the
4266 `rendering-target-buffer' variable to ``Main Article Display'' instead
4267 of `nil' when there is nothing to override the default -- but what
4268 would be the point?)
4272 (defun get-rendering-target-buffer ()
4273 (get-buffer (or rendering-target-buffer
4274 (get-buffer "Main Article Display"))))
4276 (defun set-buffer-to-rendering-target-buffer ()
4277 (set-buffer (get-rendering-target-buffer)))
4280 \begin{notate
}{The `scholia' property
} \label{the-scholia-property
}
4281 At render time, we use a text property (which we call
4282 \emph{`scholia'
}) to associate regions with the scholia that are
4283 attached to them. A region can be associated with more than one
4284 scholium,
\emph{so the `scholia' text property stores a list
}.
4285 Specifically, a list identifying the
\emph{links
} that associate
4286 various scholia with this region (see Note
\ref{link-ids
}).
4288 This information helps us restore order to shifted markup when
4289 committing edits (see Section
\ref{parsing
}).
4292 \begin{notate
}{Link-id's
} \label{link-ids
}
4293 The elements of stored in the `scholia' text property's list are
4294 ordered pairs (two-element lists), each containing information of the
4295 following form: (
1) the
\emph{name
} of a scholium associated with this
4296 buffer position; paired with, (
2), the link number corresponding to
4297 (one of) the link(s) through which said scholium came to be associated
4298 with the particular region being marked up.
4300 Lists of this form are a fairly common idiom in this work, and they
4301 get a special name, the
\emph{link-id
}.
4304 \begin{notate
}{Experiment with many `scholium' properties
} \label{many-scholium-properties
}
4305 All else equal, it might be advantageous to use independent `scholia'
4306 properties instead of just one `scholium' property (see Note
4307 \ref{inserting-text-in-middle-of-marked-up-region
}).
4309 Accordingly, I tried switching over to using one `scholium' property
4310 for each marked-up region. These properties were given somewhat
4311 complicated names -- namely, the link-ids that are currently stored as
4312 elements of the `scholia' property (Note
\ref{the-scholia-property
}).
4313 However, this doesn't work, as suggested by the following example.
4315 (progn (put-text-property (point) (
1+ (point)) '(foo
1) t)
4316 (put-text-property (point) (
1+ (point)) '(foo
1) nil)
4317 (text-properties-at (point)))
4319 This is because
\footnote{Thanks Andreas Schwab, help-gnu-emacs,
4320 2005/
12/
12.
\label{so-called-text-property-bug
}}
4322 (eq '(foo
1) '(foo
1)) ;=> nil
4325 The Emacs text property engine is uniformly `eq'-based instead of
4326 `equal'-based. (So, if we happened to have an association between
4327 link-id's and integers, this would have worked, but that seems like a
4330 Indeed, this `eq' preference is pretty much fatal to the utility of
4331 non-symbol text properties (unless we managed to hang directly onto
4332 the actual link-ids that would be used for the names of the text
4333 properties, which seems infeasible; or alternatively used some other
4334 sort of weird work-around, as above). A further difficulty is
4335 associated with the fact that these various `scholium' text properties
4336 would be indiscriminately mixed in with any other text properties that
4337 happened to be stored at point, requiring filtering for any useful en
4340 I have some ideas that could possibly improve the prospects for doing
4341 away with the `scholia' property and replacing it with several
4342 `scholium' properties, but it seems like anything realistic would
4343 hacking Emacs C. But since it seems that there are no immediate
4344 problems associated with using just one `scholia' property, we plunge
4348 \begin{notate
}{On `add-to-scholia-property-within-region'
} \label{add-to-scholia-property-within-region
}
4349 For each character in the region between
\inp{beg
} and
\inp{end
}, this
4350 function grabs the `scholia' property and replaces it with a version
4351 that has been modified to include the input
\inp{value
} (a link-id;
4352 see Note
\ref{the-scholia-property
}).
4354 The same property is used in the Scholia Display buffer, although that
4355 may be a bit of an abuse (cf. Note
4356 \ref{using-scholia-property-for-everything
}); something simpler would
4357 work for our needs there -- but the current way is expedient. Also,
4358 it seems to be suggestive -- perhaps in the future we'll be able to
4359 treat the Scholia Display buffer as a proper scholium-based article
4360 itself, presumably by using transclusion and identification, as
4361 appropriate (see Section
\ref{derivative
}).
4365 (defun add-to-scholia-property-within-region (start end value)
4366 (while (< start end)
4367 (put-text-property start (
1+ start) 'scholia
4368 (add-to-or-start-list
4369 (get-text-property start 'scholia)
4371 (setq start (
1+ start))))
4374 \begin{notate
}{On `current-markup'
} \label{current-markup
}
4375 This variable will be used to record the regions of the article being
4376 displayed which have scholia attached to them and are, consequently,
4377 marked up. This information will be stored at markup time by
4378 `mark-up-region' (Note
\ref{mark-up-region
}). It is important to have
4379 this information on record so that we have something to compare to
4380 after editing takes place (see Section
\ref{committing
}).
4382 Its format is a list of elements of the form
4384 ((<name> <link number>) <beg> <end>)
4386 where `beg' and `end' denote the beginning and end of the region
4387 marked up via the specified link (but see Note
4388 \ref{investigating-current-markup
}!).
4392 (defvar current-markup nil)
4395 \begin{notate
}{Investigating `current-markup' in the context of masks
} \label{investigating-current-markup
}
4396 If the link in question is being masked, then the format of
4397 `current-markup' changes from the form described in Note
4398 \ref{current-markup
} to the following:
4400 ((mask (<name> <link number>)) <beg> <end>)
4402 where `beg' and `end' denote the beginning and ending of
4403 one particular region coming from the mask for the indicated
4406 I'm not sure this is really sufficient information. Should we know
4407 \emph{which part
} of the mask we're dealing with? I.e., use something
4408 like a link-id, but for mask components?
4411 \begin{notate
}{On `mark-up-region'
} \label{mark-up-region
}
4412 Like `add-to-scholia-property-within-region', but also adds to
4413 `current-markup' (see Note
\ref{current-markup
}).
4417 (defun mark-up-region (start end value)
4418 (add-to-scholia-property-within-region start end value)
4419 (setq current-markup
4420 (add-to-or-start-list current-markup
4421 (list value start end))))
4424 \begin{notate
}{On `non-printing-types'
}
4425 This variable will record a list of the types of scholia that we
4426 typically don't want to print when displaying an article. The
4427 `derives-from' type is an example of a scholium that we typically
4428 don't want to print; see Note
\ref{include-article
}.
4430 User should temporarily set `non-printing-types' to `nil' before
4431 `mark-things-up' runs whenever they wish to display all scholia.
4435 (defvar non-printing-types nil)
4438 \begin{notate
}{Masking links
} \label{masking-links
}
4439 It is sometimes necessary to use links that point at something other
4440 than the thing that they were pointed at originally -- or more
4441 typically, the same thing, but found in a different place (Note
4442 \ref{updating-link-extent
}).
4444 For example, consider the common case of a link pointing at some
4445 region of text found in a given article. If the linked-to article
4446 gets edited, the link under consideration may have to be adjusted if
4447 it is going to continue to point at the ``correct'' region.
4449 Thus, when a linked-to article changes, it will typically have to
4450 communicate changes to back to the linking article; or rather, to the
4451 metadata article associated with the linking article (Note
4452 \ref{metadata-article-overview
}). These changes take the form of
4453 \emph{masks
}, which cover and re-route links.
4455 A given mask may continue to change as the linked-to article changes.
4456 The strategy for keeping masks up-to-date is as follows. When we
4457 discover (at commit time) that a link needs to be redirected, an entry
4458 in the ``masks'' metadata field of the article containing the link is
4459 created or adjusted. Specifically, the new link(s) designed to
4460 replace the old link are stored as an entry on the ``masks'' list, as
4461 an ordered pair consisting of: (
1) old link-id; followed by, (
2) the
4462 new link(s) replacing the old one. Subsequent changes in the
4463 linked-to article cause old masks to be deleted and new masks to be
4464 swapped in; we never do ``recursive masking''.
4466 Mask-bearing links are clearly distinguished as such (at markup time),
4467 so that we can easily identify them later (when parsing markup). The
4468 function that generates the mask-identifying tags is
4469 `compute-usable-about-data' (Note
\ref{compute-usable-about-data
}),
4470 and the function that picks these tags out from among the others at
4471 commit time is `store-link-masks' (Note
\ref{store-link-masks
}).
4472 Indeed, `store-link-masks' is responsible for creating new masks as
4475 At the other end of the process, the function
4476 `compute-usable-about-data' examines each link from the
\inp{about
}
4477 data of the linking article together with any corresponding masks, and
4478 replaces any link that is masked with the data coming from that mask
4479 (Note
\ref{compute-usable-about-data
}).
4481 (Changes to the linking article's
\inp{about
} data can change
4482 link-id's, or do away with the requirement for a particular mask
4483 altogether -- this will have to be dealt with when we have mechanisms
4484 for changing
\inp{about
} data!)
4487 \begin{notate
}{Masks
} \label{masks
}
4488 In light of the comments in Note
\ref{masking-links
}, it is possible
4489 to think of a mask as a map that takes a given link to to a region,
4490 and replaces it with a list of several regions.
4492 The format of a mask, then, is
4494 ((<name> <link number>) &rest regions)
4496 where the regions are pairs (two-element lists), each giving the
4497 beginning and end of a region that the link is being redirected to.
4499 This format lacks generality! Certainly a link that is pointing to
4500 something other than a region may need to be redirected, for example,
4501 a link pointing at a page, when the page gets deleted. For the time
4502 being, these interesting cases can be dealt with through
\emph{ad hoc
}
4503 measures. Eventually we'll want to make a study of all of the
4504 different redirection cases; but getting the platform working
4505 reasonably well takes priority. (See also Note
4506 \ref{generality-of-masks
}.)
4508 Finally, observe that the format used here is related to the format of
4509 the `current-markup' variable (Note
\ref{current-markup
}).
4511 For an interesting meditation on masking perceptions, see
4512 Lem
\footnote{Stanislaw Lem, The Futurological Congress
}.
4515 \begin{notate
}{Generality of masks
} \label{generality-of-masks
}
4516 Once we have more general sorts of masks (Note
\ref{masks
}), we'll
4517 have a host of new and interesting conditions to consider. Different
4518 types of links will presumably have to be masked in different ways,
4519 and under different conditions.
4521 Furthermore, we will eventually be masking
\inp{text
} data as well as
4525 \begin{notate
}{On `compute-usable-about-data'
} \label{compute-usable-about-data
}
4526 This function runs within the scope of `mark-things-up' (Note
4527 \ref{mark-things-up
}). Its role is to identify the regions to be
4528 marked up, based on the
\inp{about
} data expressed by attached
4529 scholia, and augmented by any masks associated with this data. In
4530 short, this is the mask-applying part of the algorithm described in
4531 Note
\ref{masking-links
}.
4533 The way it works is as follows. We look through all of the links
4534 (
\emph{although we really don't need to do this anymore, given that we
4535 have specifically identified the relevant links by using link-id'ed
4536 backlinks in the article being displayed; the change would have to
4537 come in at the level of `mark-things-up' or higher
}) -- and if the
4538 link is relevant, then it will be reflected in the value returned by
4539 `compute-usable-about-data'. However, if the link is masked, it will
4540 be the mask that is reflected, instead of the link itself.
4542 Recall that we can't `assoc' the link across the masks; we need
4543 to `assoc' the link-id instead.
4545 The format of the return value is kind of ugly; we could almost
4546 certainly do without the extra `list' layer.
4548 Note that in the return value, the name of the
\emph{scholium
} is
4549 supplied, not the name of the linked-to article -- we'll subsequently
4550 know (when applying markup) that all of the links apply to the
4551 linked-to article, whereas we won't know where these links are coming
4552 from unless we record that specially.
4556 (defun compute-usable-about-data ()
4558 (about (scholium-about scholium))
4559 (masks (get-metadata-field 'masks
4563 (dolist (link about)
4564 (setq link-number (
1+ link-number))
4565 (when (link-about-article-p link name-of-current-article)
4566 (let* ((link-id (list (scholium-name scholium) link-number))
4567 (mask (assoc link-id masks)))
4569 (dolist (reg (cdr mask))
4571 (add-to-or-start-list
4573 `((mask ,(car mask)) ,@reg))))
4575 (add-to-or-start-list
4577 (append (list (list (scholium-name scholium)
4579 (let ((beg (link-beginning link)))
4581 (list beg (link-end link))
4586 \begin{notate
}{On `mark-things-up-customizations'
} \label{mark-things-up-customizations
}
4587 This may not have to be used.
4591 (defvar mark-things-up-customizations nil)
4594 \begin{notate
}{On `scholia-display-pre-update-hook'
} \label{scholia-display-pre-update-hook
}
4595 This gives us a chance to do various customizations to the environment
4596 before the main part of `mark-things-up' runs.
4598 I imagine that the role that it will play will be similar to the one
4599 played by the functions that run right in `pre-mark-up', namely to zap
4600 variables and settings that we don't want to have around anymore.
4604 (defvar scholia-display-pre-update-hook nil)
4607 \begin{notate
}{On `pre-mark-up'
}
4608 This function generally zaps things, to prepare for markup.
4612 (defun pre-mark-up ()
4613 (setq current-markup nil)
4615 (set-buffer-to-rendering-target-buffer)
4616 (remove-list-of-text-properties (point-min)
4619 (mapcar #'delete-overlay main-article-overlays)
4620 (setq main-article-overlays nil)
4621 (setq scholia-count
0))
4624 \begin{notate
}{On `mark-things-up-hook'
} \label{mark-things-up-hook
}
4625 For unconditional customizations to `mark-things-up'.
4626 The functions added to this hook run after everything
4627 else `mark-things-up' does is done.
4631 (defvar mark-things-up-hook nil)
4634 \begin{notate
}{On `mark-things-up'
} \label{mark-things-up
}
4635 This function assembles text, text properties, and overlays: it is the
4636 main rendering engine, called by `display-article' to get
4637 scholia and appropriate markup onto the screen. It is important
4638 that `raw-scholia' be defined (and be a list of scholia)
4639 for this function to work properly.
4641 The first part of the plot is to delete the old markup; we call
4642 `pre-mark-up' to take care of this.
4644 A list of ``raw scholia'' is expected to be present in the context in
4645 which this function runs; typically this data is provided by
4646 `display-article' (see Note
\ref{display-article
}), but it can be
4647 supplied by any stand-in (e.g. `display-scholia-about-current-buffer'
4648 of Note
\ref{display-scholia-about-current-buffer
}).
4650 The raw scholia are first sorted using `sort-scholia-by-beg-position'
4651 (Note
\ref{sort-scholia-by-beg-position
}) and then translated into a
4652 usable form by `compute-usable-about-data' (Note
4653 \ref{compute-usable-about-data
}).
4655 The function `mark-things-up' can handle different sorts of scholia
4656 differently (e.g., references are marked up in the conventional way);
4657 see Note
\ref{ancillary-mark-things-up
}.
4659 In order to
\emph{selectively
} display scholia, the `raw-scholia'
4660 variable should be modified before this function runs.
4664 (defun mark-things-up ()
4666 (let ((scholia (sort-scholia-by-beg-position
4668 name-of-current-article)))
4669 (dolist (scholium scholia)
4670 (unless (typedata-includes-element-of-list
4671 (scholium-type scholium)
4673 (let ((usable-about-data (compute-usable-about-data))
4674 (current-position-in-scholia-display (point)))
4677 (typedata-includes (scholium-type scholium) 'reference)
4678 (equal (reference-from-article scholium)
4679 name-of-current-article))
4680 (mark-up-reference))
4682 (mark-up-scholium)))))))
4683 (run-hooks 'mark-things-up-hook))
4686 \begin{notate
}{Ancillary functions for `mark-things-up'
} \label{ancillary-mark-things-up
}
4687 The functions that assemble and apply the markup, and in particular
4688 the value stored on the `scholia' property, run within the scope of
4689 `mark-things-up'. The `scholia' property is built according to
4690 the description from Note
\ref{the-scholia-property
}.
4692 References are rendered by `mark-up-reference'; regular
4693 scholia are rendered by `mark-up-scholium'.
\emph{Note that there are
4694 only two different nontrivial kinds of markup at present.
}
4696 Some
\emph{very
} ancillary functions are described in Note
4697 \ref{functions-for-adding-overlays
}.
4700 \begin{notate
}{Functions for adding overlays
} \label{functions-for-adding-overlays
}
4701 These function run within the scope of `mark-up-scholium' to
4702 add overlays to the display.
4706 (defun add-overlays-in-scholia-display-buffer ()
4707 (setq scholia-overlays
4709 (make-overlay current-position-in-scholia-display
4711 (get-buffer "Scholia Display")
4714 (overlay-put (car scholia-overlays)
4715 'face (scholium-face)))
4717 (defun add-overlays-in-rendering-target-buffer ()
4718 (setq main-article-overlays
4720 (make-overlay (second elt)
4722 (get-rendering-target-buffer)
4724 main-article-overlays))
4725 (overlay-put (car main-article-overlays)
4726 'face (scholium-face)))
4729 \begin{notate
}{On `mark-up-reference'
} \label{mark-up-reference
}
4730 We call this function from `mark-things-up' (Note
4731 \ref{mark-things-up
}) to render a scholium if it has reference type
4732 and its
\inp{about
} data indicates that that the reference originates
4733 from (i.e., appears in) the current article. See Note
4734 \ref{reference-access-functions
} for a description of the format of
4735 the return value of the function `reference-source-link' used here.
4737 References should perhaps be rendered differently depending on their
4738 sub-type (in particular, a different face could be used for references
4739 with different sub-types).
4741 (Do we really want to loop through all of the elements of
4742 `usable-about-data'? Mightn't there be something there corresponding
4743 to the linked-to article?)
4747 (defun mark-up-reference ()
4749 (set-buffer-to-rendering-target-buffer)
4750 (dolist (elt usable-about-data)
4751 (mark-up-region (second elt)
4754 (when use-crazy-font-lock
4755 (setq main-article-overlays
4757 (make-overlay (second elt)
4759 (get-rendering-target-buffer)
4761 main-article-overlays))
4762 (overlay-put (car main-article-overlays)
4763 'face 'sch-reference-face)))))
4766 \begin{notate
}{Using the `scholia' property for everything!
} \label{using-scholia-property-for-everything
}
4767 Notice that we use the same `scholia' property for references, and not
4768 some special property. This seems to make reparsing easier (see
4769 Section
\ref{parsing
}) -- but we can also easily filter the
4770 references out of the collection of all scholia when needed (Note
4771 \ref{follow-reference
}).
4774 \begin{notate
}{Alternate reference display
}
4775 In Note
\ref{references
} we asserted that references will be displayed
4776 as markup. However, we could certainly set things up so that we could
4777 switch between the normal view and a view where references are
4778 displayed as ``proper scholia''.
4781 \begin{notate
}{On `mark-up-scholium'
}
4782 This inserts scholia and marks them up, together with the marked up
4783 regions (when these exist; the function does both whole-article
4784 scholia and region-specific scholia).
4786 The `scholia-count' variable is set for purposes of face selection;
4787 see Note
\ref{color-by-number
}.
4791 (defun mark-up-scholium ()
4792 ;; this part takes place in the scholia display buffer
4793 (insert (sch-plain-text (scholium-name scholium)))
4794 (add-to-scholia-property-within-region
4795 current-position-in-scholia-display
4797 ;; add a list to make it possible to reuse the scholium property
4798 (list (scholium-name scholium)))
4799 (when use-crazy-font-lock
4800 (add-overlays-in-scholia-display-buffer))
4802 ;; this part is relevant to the buffer containing the main article
4803 (dolist (elt usable-about-data)
4806 (set-buffer-to-rendering-target-buffer)
4807 (mark-up-region (second elt)
4810 (when use-crazy-font-lock
4811 (add-overlays-in-rendering-target-buffer)))))
4812 ;; adjust count once everything else is done here, so same count
4813 ;; applies in both buffers (useful for coloration purposes)
4814 (setq scholia-count (
1+ scholia-count)))
4817 \begin{notate
}{Markup in the Scholia Display buffer
} \label{markup-in-scholia-buffer
}
4818 There is no technical reason to use overlays here, because we assume
4819 that this buffer is not subject to font-lock (i.e. we could use text
4820 properties for everything). But, for the sake of uniformity, we
4821 always use overlays for fontification. Also, there's no particular
4822 reason to maintain the `scholia' property as a list in this buffer, but
4826 \begin{notate
}{Make ``Scholia Display'' read-only?
}
4827 Maybe `mark-things-up' should set and unset read-only status for the
4828 Scholia Display buffer. Some of the functions we've written so far do
4829 toggle read-only status. We should make a firm decision one way or
4832 At present, it seems to me that it is best to have it be editable and
4833 have code ready to propagate changes back to their sources. Indeed,
4834 this would make a good example of the power of this system. See Note
4835 \ref{precedent-for-identification
}.
4838 \subsubsection{Further notes on marking things up
}
4840 \begin{notate
}{Highlighting the current scholium
}
4841 Note that it may prove to be useful to highlight the
\emph{current
}
4842 scholium in some way, or current
\emph{scholia
} with some kind of
4843 color-coded depth showing how many scholia are about the current piece
4844 of text. (``Current'' here comes from where the point is in the main
4845 article display, but I suppose it might be reasonable to do something
4846 similar with the scholia display buffer.)
4849 \begin{notate
}{Semantics of
color}
4850 The actual markup behavior should depend on the semantics that are
4851 currently
\emph{en vogue
}, see Note
\ref{color-and-style
} and Note
4852 \ref{user-crafted-semantics
}. Maybe we should be using a hook or a
4853 redefinable function to handle the ``when use-crazy-font-lock'' case.
4856 \begin{notate
}{Lots of different overlay styles possible
} \label{overlay-styles
}
4857 In theory we could have a lot of different overlay styles.
4858 Implementing these styles seems a little tricky, but isn't too
4859 impossible. Note that some of the different overlay setups may
4860 benefit from having more information than just the name stored locally
4861 (assuming that it takes a lot of time to look things up by name to
4862 find more properties, which isn't necessarily a fair assumption in the
4863 case of hash tables).
4865 One example of something that would be nice would be to have nested
4866 scholia display well. (I'm sure they would even work consistently at
4867 present.) It may be that delimiters would be a more effective way of
4868 illustrating such relationships.
4871 \begin{notate
}{Sometimes we don't want overlays at all
}
4872 Another point is that sometimes we don't want overlays to show up at
4873 all -- they could be very distracting when attached to code, for
4874 example. Whether or not an overlay is shown in a given instance may
4875 depend on global state variables, properties of the article that is
4876 being marked up, or specific data that has been stored as part of a
4877 scholium. (We'll have to add more code to handle these sorts of
4881 \begin{notate
}{Emacs task: blinking?
} \label{blinking
}
4882 This is a pretty minor issue, but it would be cool to hack a
4883 \emph{display independent
} blink property into emacs. Blinking
4884 already works for cursors. So, how to do it for text? The point is
4885 that if there was a ``blink'' feature in Emacs, the ``move to region''
4886 things could make the text they find blink (this would work for
4887 monochrome displays of Note
\ref{monochrome
} just as well as any
4891 \begin{notate
}{Displaying nearby scholia
} \label{displaying-nearby-scholia
}
4892 A nice display system will put some of the scholia nearby the current
4893 document onscreen. The default operation of `mark-things-up'
4894 (performed through the offices of `sort-scholia-by-beg-position') is
4895 to show an article together with
\emph{its
} scholia in order; Note
4896 \ref{ancestors
} talks about going the other way. But we can do still
4897 more complicated things.
4899 People like having nearby things to look at. This is one reason that
4900 print dictionaries, for example, are kind of fun. You look at the
4901 dictionary, and you can see words that are nearby lexicographically;
4902 sometimes they are related and sometimes they aren't.
4904 In different contexts, different sorts of ``closeness'' may be
4905 relevant, and different sorts semantics would help make the contextual
4909 \subsection{Display interface
} \label{display-interface
}
4911 \begin{notate
}{Selective Displays
} \label{selective-displays
}
4912 More selective displays could be offered. For example, we might
4913 display only the articles that are ``about'' the current article
4914 \emph{and
} that are of some specified ``type''. We could also take
4915 bookkeeping information into account, or ``meta-level'' information
4916 like what subcollection (or namespace?) of the digital library the
4917 article is located in. Metalevel information (maybe by definition)
4918 comes from outside of the system itself, for example, we might display
4919 only scholia from a certain directory. These sorts of deployments are
4920 where the real power of this system lies. (See Note
4921 \ref{selection-methods
} for general comments along these lines, and
4922 Note
\ref{ancestors
} for somewhat similar thoughts along a diverging
4926 \subsubsection{Different treatment for buffered and non-buffered articles
}
4928 \begin{notate
}{On `rendering-target-buffer'
} \label{rendering-target-buffer
}
4929 If a given
\inp{name
} is associated with a buffered article, then that
4930 buffer will be where the article is displayed. If the article to be
4931 displayed is in a buffer, this variable will be set that buffer
4932 object. Otherwise it will be set to nil.
4936 (defvar rendering-target-buffer nil)
4939 \begin{notate
}{Dealing with killed buffers
} \label{killed-buffers
}
4940 For some reason, `rendering-target-buffer' gets set to the ``killed
4941 buffer'' object when the buffer containing the main article is killed.
4942 That isn't nice; presumably we'll need to add a function to the
4943 `kill-buffer-hook' that will ensure that if this buffer is killed,
4944 this variable will be set back to nil (or whatever it should in fact
4945 be set to). We will presumably also have to remove this function from
4946 the hook when the main article changes.
4949 \begin{notate
}{Better way to name (or access) buffered articles
} \label{name-or-access-buffered-articles
}
4950 Either we should search on the
\inp{text
} field for the current
4951 buffer, and ignore the name, or we should store the ``official'' name
4952 of the buffer as a buffer-local variable. (E.g. this buffer
4953 \emph{should
} be called ``SBDM for CBPP'' but
4954 `display-scholia-about-current-buffer' can, at present, only access
4955 the buffer by its `buffer-name'. I think that adding a buffer-local
4956 variable at creation time would probably be very straightforward, then
4957 we just need to look-up that variable instead of using `buffer-name'.
4958 (Of course, we could make `buffer-name' be the default for the
4959 ``buffer article name''.) Note that unless the article is created by
4960 the approved means, we won't have a chance to store the variable; this
4961 suggests that the display section should come after the creation
4962 section (which makes plenty of sense). Note that
\emph{everywhere
}
4963 `buffer-name' appears in this paper things will have to be modified if
4964 we make this sort of switch.
4967 \subsubsection{Display mechanics
}
4969 \begin{notate
}{What just happened to the screen?
}
4970 The simple display mechanism we use here will overwhelm your whole
4971 display (see Note
\ref{scholia-overwhelm-display
}); use
{\tt M-x
4972 back-to-normal
} to return to the pre-display window configuration.
4975 \begin{notate
}{Making `sch-plain-text' work with weird types
}
4976 We should either make sure that `sch-plain-text' can handle all
4977 articles with many different
\inp{type
}s.
4980 \begin{notate
}{On `scholia-display-post-update-hook'
}
4981 This provides a way to customize the article (and
4982 scholia) being displayed.
4986 (defvar scholia-display-post-update-hook nil)
4988 (add-to-list 'non-printing-types 'fake)
4991 \begin{notate
}{On `scholia-display-extras-hook'
} \label{scholia-display-extras-hook
}
4992 This hook is run at the end of `scholia-display-extras'
4993 (Note
\ref{scholia-display-extras
}) and allows for easy
4994 tweaking of the scholia display (for example, displaying
4995 special sorts of scholia for articles with certain types).
4997 Some basic additions to this hook appear in Section
4998 \ref{linear-browsing
}.
5001 \begin{notate
}{On `scholia-display-extras'
} \label{scholia-display-extras
}
5002 This is used to add some extra stuff to the Scholia Display for
5003 purposes of navigation and establishing context. It is called by
5004 `display-article' (Note
\ref{display-article
}) and
5005 `display-scholia-about-current-buffer' (Note
5006 \ref{display-scholia-about-current-buffer
}).
5008 It might be nice to have this in the main article window, but that
5009 could also be confusing, especialy if the main article is associated
5010 with some buffer; so I'm taking the route of caution here. Also note
5011 that according to the principle of order
\ref{principle-of-order
} this
5012 stuff should probably appear much later on in the
document, perhaps in
5013 Section
\ref{linear-browsing
}.
5015 It might be more appropriate to have some of these extra features
5016 display in or above the main article buffer; the info system has a
5017 nice un-editable bar for display of various navigational data.
5021 (defun scholia-display-extras ()
5022 ;; this setting is useful for presentations.
5023 (goto-char (point-min))
5024 ;; Be careful that this is ignored when the article is saved or
5025 ;; otherwise processed internally.
5028 (propertize (format "
%s" name-of-current-article) 'face 'italic)
5030 (goto-char (point-max))
5031 (run-hooks 'scholia-display-extras-hook)
5032 (goto-char (point-min)))
5035 \begin{notate
}{More than one parent
} \label{more-than-one-parent
}
5036 We'll want to allow
\emph{more than one
} parent eventually; compare
5037 what happens when following a scholium/reference in a region that has
5038 more than one of these things written about it. For the purposes of
5039 markup, ``parent'' may become a variable (so add `(reference-to-parent
5040 foo)' for the foo parent) and maybe, if the various reference scholium
5041 objects created here are actually helpful, make them include lists of
5042 references? Multi-references haven't been done anywhere in this code
5043 so far, but they seem like a reasonable idea. See also Note
5044 \ref{forward-in-parent
}, Note
\ref{backward-in-parent
}.
5047 \begin{notate
}{Text for display purposes only
} \label{display-purposes-only
}
5048 I think the setup will work so that individual sections that bear
5049 identification markup will all have their changes propagated properly,
5050 i.e., independently. However, I think we may have to do a little more
5051 work to make sure that the name of the article (currently shown in
5052 italics whenever an article is displayed, though it would probably be
5053 nicer to emulate the style used by
{\tt info
}) and any other
5054 after-the-fact textual additions are ignored whenever the article is
5059 \subsubsection{Display styles
}
5061 \begin{notate
}{On `display-style'
} \label{display-style
}
5062 As discussed in Section
\ref{stylistic-considerations
}, there are a
5063 number of different styles we'd like to offer users to choose between
5064 when they go to display an article. For now, the relevant settings
5065 for the display style variable are `plain' (the default, displaying
5066 all scholia) and `contextual' (which causes only those scholia
5067 associated with the region being displayed to appear; see Note
5068 \ref{contextual-display
}).
5070 There are a few problems here: if we go with the contextual display,
5071 what about scholia that apply to the article as a whole? That's a
5072 little tricky. I guess for now we just leave them out?
5074 Set this variable with `set-display-style', not manually.
5078 (defvar display-style 'plain)
5081 \begin{notate
}{On `window-displayed-substring'
}
5082 This variable will hold the string that is being shown
5083 through a given window at a given point in time.
5087 (defvar window-displayed-substring nil)
5090 \begin{notate
}{On `set-display-style'
} \label{set-display-style
}
5091 Use this function to control the setting of `display-style' (Note
5092 \ref{display-style
}). Relevant arguments are `plain', or
5095 (Actually, anything but `contextual' will set `display-style' to
5096 its default setting. Eventually, we might want to be able to
5097 have contextual display together with some other non-default features,
5098 at which point we'll have to adjust this function appropriately.)
5102 (defun set-display-style (style)
5103 (cond ((eq style 'contextual)
5104 ;; we may need a "double hook" here, so we get the local
5105 ;; hooks set up in the correct window
5106 (add-hook 'display-article-hook
5107 'initiate-contextual-updating)
5108 (setq display-style 'contextual))
5110 (remove-hook 'display-article-hook
5111 'initiate-contextual-updating)
5112 (setq display-style 'plain))))
5115 \begin{notate
}{On `initiate-contextual-updating'
}
5116 This function gets the rendering target buffer set up
5117 to do live-updating of scholia.
5119 For now, this function doesn't do anything for labels -- since
5120 for now, labels typically don't have scholia on their
\inp{text
}.
5121 However, this can be undone later, if necessary.
5123 In addition, we don't yet have any code for getting rid of contextual
5124 updating in an individual buffer OTF.
5126 (remove-hook 'window-scroll-functions
5127 'set-window-displayed-substring t)
5132 (defun initiate-contextual-updating ()
5133 (unless (typedata-includes (scholium-type article) 'label)
5134 (save-excursion (set-buffer rendering-target-buffer)
5135 (add-hook 'window-scroll-functions
5136 'maybe-update-scholia-display nil t))))
5139 \begin{notate
}{On `maybe-update-scholia-display'
} \label{maybe-update-scholia-display
}
5140 In order for this to work optimally, we'd might to keep track of
5141 a list of the current scholia that are being displayed. But
5142 for now, I suppose (contrary to this function's name) we can just
5143 redisplay all the scholia we encounter every time.
5147 (defun maybe-update-scholia-display ()
5148 (set-window-displayed-substring)
5149 ;; this is just a ridiculous thing to run -- for testing purposes
5150 ;; only. Eventually, we'll actually want to analyse the text,
5151 ;; figure out which scholia are relevant, and update the scholia
5153 (save-excursion (set-buffer (get-buffer-create "*scratch*"))
5155 (insert window-displayed-substring)))
5158 \begin{notate
}{On `set-window-displayed-substring'
}
5159 This function will be an element of the `window-scroll-functions'
5160 hook when the display mode is set to `contextual'.
5164 (defun set-window-displayed-substring
5165 (setq window-displayed-substring
5166 (buffer-substring (window-start)
5170 \subsubsection{Displaying articles
}
5172 \begin{notate
}{On `display-article-hook'
}
5173 We will later do some ``interesting'' things with this function, so we
5174 add a hook. For example, one use for this hook is to maintain a
5175 history of articles that have been displayed; see Section
5180 (defvar display-article-hook nil)
5183 \begin{notate
}{On `raw-scholia-selector'
}
5184 This function is here both to select raw scholia for display when
5185 `display-article' runs, and to provide for a choice between different
5186 ways of selecting raw scholia. It returns a list of scholia.
5188 This function is set up to run within the scope of `display-article'
5189 (Note
\ref{display-article
}).
5191 We select slightly different scholia when the article that is being
5192 displayed is a label; in particular, we don't want to display scholia
5193 that indicate the current article as a `parent', since these scholia
5194 will already be listed in the label's
\inp{text
} itself.
5196 If we're trying to display scholia contextually, then this function
5197 should probably be doctored with some, to make it so that the initial
5198 set of scholia that are displayed are contextually appropriate, i.e.,
5199 are just those associated with the on-screen portion of the buffer
5200 that is being displayed.
5204 (defun raw-scholia-selector (&optional what-is-displayed)
5205 (cond ((eq what-is-displayed 'label)
5208 (member-if (lambda (link)
5209 (member 'parent (cdr link)))
5210 (scholium-about scholium)))
5211 (mapcar (lambda (backlink)
5212 (get-article (car backlink)))
5213 (get-backlinks name-of-current-article))))
5214 (t (mapcar (lambda (backlink)
5215 (get-article (car backlink)))
5216 (get-backlinks name-of-current-article)))))
5218 ;; (eq display-style 'contextual)
5219 ;; (save-excursion (set-buffer (get-buffer-create "*scratch*"))
5221 ;; (insert window-displayed-substring))
5225 \begin{notate
}{On `display-article'
} \label{display-article
}
5226 Display article found via
\inp{path
} (which can just be the name of an
5227 article in the main article tabel), if said article exists. If the
5228 article lives in a buffer, that buffer will be where the article is
5229 displayed; otherwise the article is displayed in the ``Main Article
5230 Display'' buffer. Note that this function can also be used to display
5231 labels (it calls `display-label'; but see Note
5232 \ref{display-scholia-about-labels
}, since some other approach might be
5233 valuable sometimes).
5235 I don't want to have all of the children appear as scholia when a
5236 label is browsed, at least not by default; but it is kind of neat to
5237 know that they can be made to appear; if we don't do the `remove-if'
5238 then the scholia display will be the OTF-assembled compilation
5239 mentioned in Note
\ref{bits-and-pieces
}.
5241 It makes more sense to always run `display-article-hook' after the
5242 `cond', and to put things that are conditional upon being in this
5243 specific branch into `scholia-display-post-update-hook' or, barring
5244 that, some additional branch-specific hook. This of course means that
5245 the parent will be added to the history list if that is where we
5246 browse from; this is intended.
5248 If it turns out to be needed here, we could reuse the trick of running
5249 a hook and then making a test before the `cond', which we're familiar
5250 with from e.g. `sch-plain-text' (Note
\ref{sch-plain-text
}).
5252 It would be good to make the buffer disposition (left? right?)
5253 is consistent when we use this function to display labels; I
5254 think we have it sorted out properly for the display of
5255 ``normal'' articles.
5257 We may want to treat namespaces and labels together in the same
5258 `cond' branch (currently namespaces aren't handled specially by
5261 Since we are now reading in paths, these paths have to be parsed.
5262 This is the job of `generalized-get-article' (see Note
5263 \ref{generalized-get-article
}).
5267 (defun display-article (path)
5268 (interactive (list (read-article-path)))
5269 (let* ((article (generalized-get-article path))
5270 (name (scholium-name article)))
5272 (error "No article by that name found")
5273 (setq name-of-current-article name)
5275 ((typedata-includes (scholium-type article) 'label)
5276 (display-label name)
5277 (setq rendering-target-buffer "*Generic List*")
5278 (switch-to-buffer (get-buffer "*Generic List*"))
5279 (setq buffer-read-only nil)
5280 (switch-to-buffer (get-buffer-create "Scholia Display") t)
5282 (let ((raw-scholia (raw-scholia-selector 'label)))
5284 (scholia-display-extras)
5285 (switch-to-buffer (get-buffer "*Generic List*"))
5286 (setq buffer-read-only t)
5287 (pop-to-buffer "Scholia Display")
5290 (if (article-buffered article)
5291 (setq rendering-target-buffer (scholium-text article))
5292 (setq rendering-target-buffer nil))
5293 (run-hooks 'scholia-display-pre-update-hook)
5294 (scholia-overwhelm-display (sch-plain-text article))
5295 (let ((raw-scholia (raw-scholia-selector)))
5297 (scholia-display-extras)
5298 (pop-to-buffer (get-rendering-target-buffer))
5299 (run-hooks 'scholia-display-post-update-hook)))
5300 (run-hooks 'display-article-hook))))
5303 \begin{notate
}{Argument of `display-article' is typically a string
}
5304 Note that for typical interactive use, a string is expected, which
5305 means a string is produced, which means that when `get-article' is
5306 called in the next line, bad things will happen for articles whose
5307 names are not strings -- unless we do something about it.
5310 \begin{notate
}{Would have liked to associate a type with paths
} \label{associate-a-type-with-paths
}
5311 It would be nice to use a special type of object to distinguish
5312 between paths and names. (I.e., if `read-article-path' returns an
5313 object of type path when it actually builds a path and
5314 `generalized-get-article' looks for this type before deciding what to
5315 do, we could be OK just passing in an article name to the generalized
5316 function.) But I'm not sure how to assert that a given form has a
5317 given type (or even whether this is possible). Maybe by working with
5318 structs one could do it, but I don't understand structs (their
5319 documentation seems to be lacking).
5321 Note, the idea of associating a type with a form seems very
5322 scholiumific. But I've forgotten whether Lisp has anything for doing
5326 \begin{notate
}{On `redisplay-article'
}
5327 This accomplishes a simple task.
5329 It would be nice if we could get the point restored to
5330 its original position after this thing runs.
5332 Also, it would be good to have the function run automatically
5333 after scholia have been added about the
document.
5337 (defun redisplay-article ()
5339 (display-article name-of-current-article))
5342 \subsubsection{Displaying scholia about a given buffer
}
5344 \begin{notate
}{On `display-scholia-about-current-buffer'
} \label{display-scholia-about-current-buffer
}
5345 This function is similar to `display-article' (
\ref{display-article
}),
5346 but it works directly on the buffer level. (Stylistically this
5347 function should probably just be a thin wrapper, but we're running
5350 This function should perhaps check to see whether the
5351 current buffer has been
\emph{edited
} since the last time
5352 this function (or similar, through other means) was executed.
5353 If the buffer has been edited, the user should probably
5354 be prompted, and asked whether to reparse (Section
\ref{parsing
})
5355 before redisplaying.
5359 (defun display-scholia-about-current-buffer ()
5361 (let ((article (get-article (buffer-name (current-buffer)))))
5364 (setq rendering-target-buffer (current-buffer))
5365 (run-hooks 'scholia-display-pre-update-hook)
5366 (scholia-overwhelm-display (sch-plain-text article))
5368 (mapcar (lambda (backlink)
5369 (get-article (car backlink)))
5370 (get-backlinks name-of-current-article))))
5372 (scholia-display-extras)
5373 (pop-to-buffer (get-rendering-target-buffer))
5374 (run-hooks 'scholia-display-post-update-hook)
5376 (run-hooks 'display-article-hook))
5377 (call-if-user-adds-current-buffer-to-article-list
5378 'display-scholia-about-current-buffer))))
5381 \begin{notate
}{Running `display-article-hook' from `display-scholia-about-current-buffer'?
}
5382 It seems a bit little weird to have to run this hook here.
5385 \begin{notate
}{Automatically display scholia about any found buffer
}
5386 It might be handy to integrate the scholium system into
5387 day-to-day Emacs operation by adding
5388 `display-scholia-about-current-buffer' to the `find-file-hook'.
5391 \begin{notate
}{Displaying a generic buffer together with scholia
}
5392 You should be able to simply call
5393 `display-scholia-about-current-buffer' after loading the buffer
5394 (
\emph{untested
}). To turn it on all the time, add it to the
5395 appropriate hook. Note that this won't add any new scholia to the
5396 system. (To add new scholia at
\emph{file
} load time, we'll need some
5400 \subsubsection{Displaying labels
} \label{displaying-labels
}
5402 \begin{notate
}{On `display-label-hook'
}
5403 This provides a way to customize the behavior of
5408 (defvar display-label-hook nil)
5411 \begin{notate
}{On `currently-displayed-label'
}
5412 This gives us a handle on the most recently displayed
5413 label. This facilitates only the simplest
5414 improvement to reverting behavior.
5418 (defvar currently-displayed-label nil)
5421 \begin{notate
}{On `display-label'
} \label{display-label
}
5422 The function `display-label' uses the catalog browsing feature of
5423 Section
\ref{catalog
}. If we want to do other interesting rendering
5424 things with articles that have special types, we can follow the usage
5425 of `display-label' in `display-article'. It might be good for this
5426 function to run its own hook, e.g., for maintaining a special history
5427 (see
\ref{history-for-listing
}).
5431 (defun display-label (name)
5434 (let* ((completion-ignore-case t)
5436 (scholium-text (get-article 'label)))
5437 (label-strings (mapcar (lambda (name)
5440 (string-found (completing-read
5443 (place (- (length label-strings)
5444 (length (member string-found label-strings)))))
5445 (nth place label-names))))
5446 (article-menu-listing (label-to-propertized-list name))
5447 (run-hooks 'display-label-hook))
5449 (add-hook 'display-label-hook (lambda ()
5450 (setq currently-displayed-label name)))
5452 (defalias 'list-label 'display-label)
5455 \begin{notate
}{On `display-intersection-of-labels'
} \label{display-intersection-of-labels
}
5456 For displaying everything bearing every one of the
5461 (defun display-intersection-of-labels (&rest labels)
5462 (let ((intersection (label-to-list (car labels)))
5465 (setq intersection (intersection intersection
5466 (label-to-list (car ctn))
5468 (setq ctn (cdr ctn)))
5469 (article-menu-listing (turn-list-into-propertized-list
5473 \begin{notate
}{On `display-difference-of-labels'
} \label{display-difference-of-labels
}
5474 For purposes of simplicity, this is set up to work with two labels
5475 only, for the time being.
5479 (defun display-difference-of-labels (label-A label-B)
5480 (article-menu-listing (turn-list-into-propertized-list
5481 (set-difference (label-to-list label-A)
5482 (label-to-list label-B)))))
5485 \begin{notate
}{Label derivatives
} \label{label-derivatives
}
5486 It might be the case that someone
5487 would want to add a new label to the elements of an intersection
5488 or difference (as would be found by internal routines of
5489 `display-intersection-of-labels' and `display-difference-of-labels').
5492 \begin{notate
}{Display type in another column
}
5493 Probably it would be good to have another accessor that would
5494 show the article's type in a second column. This could be
5495 especially useful in a context in which a section can contain
5496 both notes and subsections (just for example).
5499 \begin{notate
}{Display scholia about labels too, at least sometimes
} \label{display-scholia-about-labels
}
5500 It would probably be good to be able to be able to compose and
5501 display scholia about labels, since they are, after all,
5502 also articles. Probably this should be optional, since there are
5503 times when we just want to see the list and not think of it as
5504 an article. And in addition, if we do plan to display scholia
5505 about labels only sometimes, we'll have to decide what to do with
5506 the contents of the scholia display buffer at times when we just
5507 want to display the list and not its scholia. One trick might be to
5508 make the listing prefer to appear in the window wherein the scholia
5509 are displayed in such a case, if it exists; this way both windows
5510 wouldn't confusingly appear at the same time. (Compare Note
5511 \ref{redisplay-after-running-make-scholium
}.)
5514 \subsubsection{Finding marked regions
} \label{finding-marked-regions
}
5516 \begin{notate
}{On `find-marked-regions'
}
5517 This function is used in the subsequent section (Section
5518 \ref{overlays-on-off
}) to locate the parts of the buffer
5519 that have scholia written about them. Note that
5520 this scheme might have been outmoded by stuff in Section
5525 (defun find-marked-regions ()
5526 (let (names-and-positions
5527 (next-change-point (point-min)))
5528 (while next-change-point
5529 (let ((next-region (find-next-marked-region)))
5531 (setq names-and-positions
5533 names-and-positions)))))
5534 names-and-positions))
5537 \begin{notate
}{On `find-next-marked-region'
}
5538 This function is within the scope of `find-marked-regions'. Should be
5539 able to find all the regions associated with any scholium. Right now,
5540 this function is working in a simplified universe in which scholia and
5541 regions are mapped to each other in
1-
1 way!
5545 (defun find-next-marked-region ()
5546 (let* ((beg (next-single-property-change next-change-point
5549 (next-single-property-change beg
5551 (setq next-change-point end)
5554 (get-text-property beg 'scholia)
5555 (list (cons beg end))))))
5558 \subsubsection{Turning overlays off and on
} \label{overlays-on-off
}
5560 \begin{notate
}{Overlays exercises
}
5561 As an exercise with text properties and overlays, here is some code
5562 for turning the overlays on and off in the Scholium Display and main
5566 \begin{notate
}{Turning overlays off
}
5567 It is easy enough to turn overlays off; this is accomplished for the
5568 main article buffer and the Scholia Display buffer by
5569 `sch-turn-main-article-overlays-off' and
5570 `sch-turn-scholia-overlays-off', respectively.
5574 (defun sch-turn-main-article-overlays-off ()
5576 (mapcar #'delete-overlay main-article-overlays)
5577 (setq main-article-overlays nil))
5579 (defun sch-turn-scholia-overlays-off ()
5581 (mapcar #'delete-overlay scholia-overlays)
5582 (setq scholia-overlays nil))
5585 \begin{notate
}{Turning overlays on
}
5586 Turning overlays on is a bit trickier. In order to be able to turn
5587 scholia on, we need to be able to find all the regions that have
5588 scholia attached to them. This is accomplished (for the main article
5589 buffer only, I think) by `find-marked-regions'.
5593 (defun sch-turn-main-article-overlays-on ()
5595 ;; to save from potential overlap weirdness
5596 (sch-turn-main-article-overlays-off)
5598 (let ((names-and-positions (find-marked-regions)))
5599 (dolist (info names-and-positions)
5600 (let* ((name (car info))
5601 (marked-regions (cadr info))
5602 (scholium (get-article name))
5605 (set-buffer-to-rendering-target-buffer)
5606 (dolist (reg marked-regions)
5607 ;; add "transient" overlay
5608 (when use-crazy-font-lock
5609 (setq main-article-overlays
5611 (make-overlay (car reg)
5613 (get-rendering-target-buffer)
5615 main-article-overlays))
5616 ;; using `scholium-face' here is a bit weird
5617 (overlay-put (car main-article-overlays)
5618 'face (scholium-face))))))))))
5620 (defun sch-turn-scholia-overlays-on ()
5625 \begin{notate
}{Using these functions as a subroutine for initial markup?
}
5626 It doesn't make a whole lot of sense to use these functions for
5627 initial markup, because they involve a bit of search that would be
5628 unneeded at that stage. However, it would be good to take another
5629 look at `mark-things-up' and see if we can get any further insights
5630 into how to write this function from there. (Presumably this function
5631 was initially based on that one already...)
5634 \section{Browsing
} \label{browsing
}
5636 \subsection{Scholia browsing
} \label{browse-scholia
}
5638 \begin{notate
}{Introduction to scholia browsing
}
5639 The point of this section is to associate scholia with the regions of
5640 the article that they apply to, and to enable the user to quickly find
5641 and navigate between the marked-up regions in the displayed version of
5642 this article and their associated scholia.
5645 \begin{notate
}{Moving without reparsing
} \label{moving-with-reparsing
}
5646 The functions for scholia browsing are likely to move you to the
5647 ``wrong place'' unless the buffer has been parsed and the scholia
5648 locations are up-to-date (i.e., it will move you to the specified
5649 region, but this will probably be the wrong region).
5652 \begin{notate
}{Problem with the design of the `move-to...-scholium' functions
}
5653 These probably shouldn't be using overlays as the source of their
5654 information about where scholia reside, since overlays are not
5655 necessarily going to be there!
5657 (I guess this means ``if the content has been cut and pasted.'' I'm
5658 guessing that there are cases where we would like to use this
5659 function under conditions in which cutting and pasting may have taken
5660 place. I'm not sure exactly what those cases would be, since I'm not
5661 sure exactly when this function is called. Seems it is, so far, only
5662 called in the case of scrolling the main article display to a certain
5663 region, namely a region with an attached scholium. It might be
5664 reasonable just to use overlays in that case (?). This is a somewhat
5665 curious point, and since it actually deals with something sort of
5666 fundamental in Emacs, maybe it would be best to give it more thought
5667 \emph{later
}, especially since this function is probably useful right
5670 They can be turned off altogether (Section
\ref{overlays-on-off
}) or
5671 one by one (Note
\ref{overlay-styles
}).
5673 (That is a good point. Audience, what do you think?)
5675 Anyway, the logic of the function is probably going to be similar
5676 no matter what guts we use.
5678 Note that there is a funny case of two references that begin
5679 at the same point (and, possibly, end at the same point as well).
5680 I think this case isn't handled well by the function the way it
5683 This is a general matter that goes beyond these functions -- and
5684 should probably be noted as such somewhere.
5687 \begin{notate
}{On `move-to-next-region-with-scholium' and `move-to-previous-region-with-scholium'
} \label{move-to-next-or-previous-region-with-scholium
}
5688 This moves the point to the beginning of the next region that has a
5689 scholium about it (if there is one).
5691 (I'm noticing a bug when the function is used interactively with the
5692 binding selected in Section
\ref{bindings
} and the cursor is
5693 positioned on a right paren; calling the function with M-x in this
5694 case doesn't result in the same problem.)
5696 Note these two functions are not quite symmetrical, because we
5697 want the cursor to end up at the beginning of the marked
5698 region. (I think there will be a problem if we try to go to the
5699 beginning of a scholium that is attached at the beginning of
5700 the article, but that isn't such a big deal.)
5704 (defun move-to-next-region-with-scholium ()
5706 (let ((change (next-overlay-change (point))))
5707 (if (overlays-at change)
5708 (progn (goto-char change)
5709 (list change (next-overlay-change change)))
5710 (if (overlays-at (next-overlay-change change))
5711 (progn (goto-char (next-overlay-change change))
5712 (list (next-overlay-change change)
5713 (next-overlay-change (next-overlay-change
5715 (message "No subsequent regions with scholia about them.")
5718 (defun move-to-previous-region-with-scholium ()
5720 (let ((change (previous-overlay-change (point))))
5721 (if (overlays-at change)
5722 (progn (goto-char change)
5723 (list change (previous-overlay-change change)))
5724 (if (overlays-at (previous-overlay-change change))
5725 (progn (goto-char (previous-overlay-change change))
5726 (list (previous-overlay-change change)
5727 (previous-overlay-change (previous-overlay-change
5729 (message "No previous regions with scholia about them.")
5732 (defun scroll-article-display-to-next-region-for-current-scholium ()
5735 (set-buffer buffer-associated-with-current-article)
5738 (while (and (not found)
5740 (move-to-next-region-with-scholium))
5741 (mapc (lambda (overlay)
5742 (when (equal (overlay-get overlay 'scholia)
5743 (name-of-current-scholium))
5745 (overlays-at (point)))
5749 (goto-char curpoint)
5750 (message "Scholium not about further regions in buffer.")))))
5752 (defun scroll-article-display-to-previous-region-for-current-scholium ()
5755 (set-buffer buffer-associated-with-current-article)
5758 (while (and (not found)
5760 (move-to-previous-region-with-scholium))
5761 (mapc (lambda (overlay)
5762 (when (equal (overlay-get overlay 'scholia)
5763 (name-of-current-scholium))
5765 (overlays-at (point)))
5769 (goto-char curpoint)
5770 (message "Scholium not about previous regions in buffer.")))))
5773 \begin{notate
}{Cycling through regions
}
5774 It wouldn't be too hard to make a variant of
5775 `scroll-article-display-to-previous-region-for-current-scholium' that
5776 cycles through the regions that the current scholium is about.
5779 \begin{notate
}{On `move-to-first-region-for-scholium'
} \label{move-to-first-region-for-scholium
}
5780 Move you to the beginning of the region marked up by the scholium
5781 named
\inp{name
}. Should this be made interactive?) At present, it
5782 is only called by `move-to-first-region-for-current-scholium'.
5786 (defun move-to-first-region-for-scholium (name)
5787 (pop-to-buffer (get-buffer rendering-target-buffer))
5788 (let ((beg (point-max))
5789 (about (scholium-about (get-article name))))
5790 (dolist (link about)
5791 ;; this should be revised in light of the
5792 ;; fact that a link can be multiply typed
5793 (when (and (typedata-includes-passage (link-type elt))
5794 (equal (linked-to-article link)
5795 name-of-current-article)
5796 (< (link-beginning link) beg))
5797 (setq beg (link-beginning link))))
5798 (unless (equal beg (point-max))
5802 \begin{notate
}{On `move-to-first-region-for-current-scholium'
}
5803 This uses the function `move-to-first-region-for-scholium' from
5804 section
\ref{browse-scholia
}; the thought behind including the
5805 function here is that it establishes a relationship between
5806 the Scholia Display buffer and the main article buffer (however
5807 it could probably go in section
\ref{browse-scholia
} equally well).
5809 This should probably be complemented by a function
5810 `move-to-last-region-for-current-scholium'.
5812 Also, it should probably have some intelligent message
5813 (not to say ``error message'') if the scholium applies to
5814 the article as a whole.
5816 (Gives some error, complaining about `elt' being void.
5817 Can this run in the Scholia Display buffer as well as the
5818 main article buffer?)
5822 (defun move-to-first-region-for-current-scholium ()
5824 (let ((current (name-of-current-scholium)))
5825 (move-to-first-region-for-scholium current)))
5828 \subsection{Local browsing
} \label{local
}
5830 \begin{notate
}{Introduction to local browsing
}
5831 This section will describe purely local navigation commands that
5832 require little in the way of additional data structures. The main
5833 idea for the functions in this section is to make it so that focus can
5834 move from the current article to adjacent articles (either articles
5835 that are about the current article or articles that the current
5836 article is about), or more generally, to articles within some
5837 neighborhood of the current article (articles that we can reach by
5838 stepping from adjacent article to its adjacent articles, etc.). We
5839 re-use the listing mechanism from the previous section as needed.
5842 \begin{notate
}{On `read-scholia-property-at-point'
}
5843 Suppose we simply want to make the current scholium into the new
5844 current article. That's what the next function is for.
5848 (defun read-scholia-property-at-point ()
5849 (get-text-property (point) 'scholia))
5852 \begin{notate
}{On `scholia-named-at-point'
}
5853 I think that this should strip out the ``mask'' tags
5854 from the link-ids, but leave the name parts. Since it
5855 is only used by interactive functions, this seems fine,
5860 (defun scholia-named-at-point ()
5861 (mapcar (lambda (id)
5862 (if (eq (car id) 'mask)
5865 (read-scholia-property-at-point)))
5868 \begin{notate
}{On `follow-scholium'
} \label{follow-scholium
}
5869 This causes the current scholium to become the current article.
5871 Eventually we'll want to be able to run this command with a
5876 (defun follow-scholium ()
5878 (let ((current (name-of-current-scholium)))
5880 (display-article current))))
5883 \begin{notate
}{On `follow-reference'
} \label{follow-reference
}
5884 This reads the `scholia' property at point and either follows the
5885 reference at point (if there is only one) or allows the user to choose
5886 between references (if there are several).
5888 We might want to provide an additional function for following links
5889 \emph{in general
}; basically the strategy for that is, just don't do
5890 the `remove-if' filtering.
5894 (defun follow-reference ()
5897 (remove-if (lambda (name)
5898 (not (typedata-includes
5899 (scholium-type (get-article name))
5901 (scholia-named-at-point))))
5903 ((equal (length references)
1)
5904 (let* ((ref (get-article (car references)))
5905 (to-article (reference-to-article ref)))
5906 (if (equal to-article name-of-current-article)
5907 (display-article (reference-from-article ref))
5908 (display-article to-article)))
5909 ;; maybe `display-article' should be returning
5910 ;; some non-`nil' value so that we don't have to do this.
5913 ;; this sort of disambiguation is really only needed if the
5914 ;; references have different targets. Two distinct references
5915 ;; to the same thing overlaying each other could be treated as
5916 ;; one for simple following purposes.
5917 (list-articles references))
5919 (message "No reference at point.")
5922 (defun follow-reference-or-scholium ()
5924 (unless (follow-reference)
5927 (defun display-an-article-that-current-article-is-about ()
5929 (let ((abouts (scholium-about
5930 (get-article name-of-current-article))))
5932 ((equal (length abouts)
1)
5933 (display-article (car abouts)))
5935 (list-articles abouts))
5937 (message "Article isn't about any other articles.")))))
5940 \begin{notate
}{On `current-scholium-is-about'
}
5941 This function is similar to the previous one, but it applies to
5942 scholia. Since one presumably knows that the current scholium is
5943 about the current article, this is most useful when a scholium is
5944 about several different articles, as it allows the user to move
5945 ``down'' to any of them.
5949 (defun current-scholium-is-about ()
5950 (scholium-about (get-article (name-of-current-scholium))))
5952 (defun display-an-article-that-current-scholium-is-about ()
5954 (let ((abouts (current-scholium-is-about)))
5956 ((equal (length abouts)
1)
5957 (display-article (car abouts))
5958 (message "Note: scholium is only about current article."))
5960 (list-articles abouts))
5962 (message "Article isn't about any other articles.")))))
5965 \subsection{Catalog browsing
} \label{catalog
}
5967 \begin{notate
}{Content-free browsing
}
5968 A popular style of browsing ignores the content of the objects
5969 themselves and looks only at their metadata. Examples include library
5970 catalogs or lists of search engine results. Since you aren't actually
5971 browsing the articles directly, this is ``browsing a catalog'' more
5972 than it is ``browsing the library''.
5974 Using this technique, one should be able to selectively choose
5975 subcollections to look at, e.g. all the works by a given author or
5976 what have you. In this section, we provide code for browsing by
5977 article name. The code is an interface to a generic browsing/listing
5978 command based on Emacs's built-in `list-buffers' command. This setup
5979 is designed with extensibility in mind, however it may be useful to
5980 rewrite the selection mechanism (or add an alternate version) in order
5981 to make each line in the current display into a bibliography-style or
5982 index-card style reference. This would make the information fit on
5983 the screen better (and such modifications should be easy to make
5986 See Note
\ref{standard-article-menu-accessors
} for a description of
5987 the data that are displayed along with names in the listing. We may
5988 eventually want to be able to switch between several alternative
5989 data-listings, e.g., we might want name, type, and namespace; or name,
5990 article-about list, about-article list. With if complicated lists
5991 like this are used, we may want to have more than one line associated
5994 We currently provide only very basic functions for working with these
5998 \begin{notate
}{Catalog browsing in the scholium system
}
5999 This code provides a generic way to perform actions on rich objects
6000 from a list. It is assumed that each object has several attributes
6001 that a user may be interested in. ``Name'', ``size'' and ``mode'' are
6002 familiar examples from `list-buffers'; here there can be an
6003 arbitrary number of arbitrary attributes. This makes this
6004 mechanism useful in some cases where `completing-read' would not
6005 provide the user with enough information.
6007 The way attributes are obtained from objects is left up to the
6008 user, as are the actual actions that can be performed on the
6011 Generality comes at an obvious, unavoidable, cost, namely any given
6012 deployment of this interface requires some extra set up -- examples
6016 \begin{notate
}{Predicate support for listing
} \label{predicate-support-for-listing
}
6017 Just for example, one thing people might want to do would be to list
6018 the articles in the vicinity of the article being browsed or in a
6019 certain section from a paper, and so on. The function will work with
6020 any set that we can select; what we need are a bunch of functions for
6021 doing the selection.
6024 \begin{notate
}{History support for listing
} \label{history-for-listing
}
6025 It would be good to maintain a special history list for this display,
6026 that way if you browse a succession of nested catalogs, you can go
6027 backwards and forwards to choose the best catalog. (Catalogs are
6028 similar to directories from dired, gopher, etc.) See Section
6029 \ref{temporal
} for a discussion of history support in general (start
6030 with Note
\ref{thematic-histories
}).
6033 \begin{notate
}{Purpose of generality
}
6034 Different menus may be useful for different purposes. A collection of
6035 article
\inp{name
}s may frequently be insufficient data from which to
6036 choose an article. Different data may be useful for different times
6037 and purposes, so we've made the system extensible. It may be useful
6038 to change the overall
\emph{style
} of the display as well (e.g. to
6039 select from a list of multi-line records rather than a list of lines);
6040 modifications at this level are on hold until such time as they are
6044 \begin{notate
}{On `make-generic-menu-mode'
}
6045 This takes the name of the menu (as a space-separated string) together
6046 with a list of bindings to be used in that particular menu mode.
6048 This should provide a docstring for the mode it creates.
6052 (defmacro make-generic-menu-mode
6054 (let* ((modedash (downcase (replace-regexp-in-string " " "-" mode)))
6055 (modesymbol (intern (concat modedash "-mode")))
6056 (mapname (intern (concat modedash "-map"))))
6059 (setq ,mapname (make-keymap))
6060 (suppress-keymap ,mapname t)
6061 (dolist (binding ,bindings)
6062 (define-key ,mapname (car binding) (cdr binding)))
6063 (defun ,modesymbol ()
6064 (kill-all-local-variables)
6065 (use-local-map ,mapname)
6066 (setq major-mode (quote ,modesymbol))
6067 (setq mode-name ,mode)
6068 (setq truncate-lines t)
6069 (setq buffer-read-only t)))))
6072 \begin{notate
}{On `generic-menu-noselect'
} \label{generic-menu-noselect
}
6073 The basic idea of this is that we have some
\inp{objects
} and some
6074 functions to map across the objects to extract the information from
6075 the objects (
\inp{accessors
}). The functions must be set up to
6076 produce strings as their output. The functions correspond to columns
6077 in the display; individual objects correspond to rows. This is the
6078 same idea no matter what the source of the objects is. (In
6079 particular, it might be a good idea for a later version of this
6080 function to accept either a hash table or a list as the source of the
6081 objects; see Note
\ref{browsing-subcollections
}.) Note that columns
6082 of the display are assumed to be as wide as their widest item!
6086 (defun generic-menu-noselect (objects accessors)
6088 (dolist (get-this accessors)
6089 ;; if we built this front-to-back rather than back-to-front,
6090 ;; that would be better
6092 (cons (car get-this)
6093 (mapcar (cdr get-this) objects))
6095 ;; find the width of the columns.
6096 (let ((lens (mapcar (lambda (col)
6099 (let ((candidate (length str)))
6100 (when (> candidate len)
6101 (setq len candidate))))
6104 (with-current-buffer (get-buffer-create "*Generic List*")
6105 (setq buffer-read-only nil)
6108 (goto-char (point-min))
6109 (goto-char (line-end-position))
6110 (dolist (str (car cols))
6112 ;; fill with spaces to make up for lost space
6113 (insert-char
32 (- (car lens) (length str)))
6114 (unless (equal (forward-line)
0)
6116 (goto-char (line-end-position)))
6117 (setq cols (cdr cols))
6118 (setq lens (cdr lens)))
6119 (goto-char (point-min))
6120 (current-buffer)))))
6123 \begin{notate
}{Improved sorting of article listing
}
6124 Sorting could be done using autocompletion on the name of the column
6125 to sort on, too, which would be kind of nice. Or we could make a
6126 command to sort on the current column, or reorder columns according to
6127 the values on the current line or just about anything you might like.
6129 But I don't think sorting is going to work at all until we have a
6130 consistent way of identifying the fields to sort; in the case of
6131 strings with spaces in them, `sort-fields' won't work. Since we
6132 compute the width of each of the columns in `generic-menu-noselect',
6133 if we were to store this info (perhaps as a text property attached to
6134 each column heading), we could adroitly divide the text up to find the
6135 strings we're trying to sort. See Note
\ref{text-properties-in-article-listing
}.
6139 (defun Generic-menu-sort (col)
6142 (sort-fields (or col
1) (progn (goto-line
2)
6147 \begin{notate
}{Hierarchies for browsing
}
6148 Hierarchies are somewhat similar to menus, e.g., we might
6149 want to use hierarchies to display sub-library relationships.
6150 (This is like KM's ontology browser.) Of course, graph
6151 browsing would be even more generic (but display of these
6152 things seems a bit far removed from what we can do right now).
6155 \begin{notate
}{Reuse of names from article listing
}
6156 It would be nice if names were displayed together with quote marks
6157 making the printed versions of the names appropriate for direct
6161 \begin{notate
}{On `standard-article-menu-accessors'
} \label{standard-article-menu-accessors
}
6162 Note that it would be easy to provide more metadata -- just revise
6163 this variable with additional fields as desired. See Note
6164 \ref{generic-menu-noselect
} for a description of how accessors work.
6168 (defvar standard-article-menu-accessors
6169 '(("Name" . identity)
6170 ("C" . (lambda (elt) " "))))
6173 \begin{notate
}{Control panels
} \label{control-panels
}
6174 A little control panel on the left of the article listing comprised of
6175 various toggle-state elements provides a way to interactively
6176 manipulate the articles individually or
\emph{en masse
} (see section
6177 \ref{masse
}). (The only feature in the control panel for now is an
6178 indicator showing which article is current; this is indicated by a dot
6179 in the ``C'' column.)
6182 \begin{notate
}{On `article-menu-listing-hook'
}
6184 customize the behavior of the article menu listing. Currently it
6185 is used to offset the activities invoked by
6186 `currently-displayed-label-hook'; whereas we want
6187 `currently-displayed-label' to be defined when the listing is
6188 used to display a label, we'd rather it be `nil' when something
6189 other than a label has been displayed, since anything else could
6194 (defvar article-menu-listing-hook nil)
6197 \begin{notate
}{On `article-menu-listing'
}
6198 The optional input
\inp{subset
} is a list of article names to pump
6199 into the generic menu; it defaults to the list of ``plain'' articles
6200 as recorded on the corresponding label. The optional input
6201 \inp{accessors
} specifies the functions to use to extract information
6202 from the articles named by
\inp{subset
}; it is in the format of, and
6203 defaults to, `standard-article-menu-accessors'. (Note that function
6204 plays a similar role to `Buffer-menu-revert' from buff-menu.el.)
6208 (defun article-menu-listing (&optional subset accessors)
6211 (generic-menu-noselect
6212 ;; maybe this should always handle propertizing itself?
6214 (label-to-propertized-list 'plain))
6216 standard-article-menu-accessors)))
6217 ;; note, this runs every time, even if the current article
6218 ;; isn't on the list.
6219 (article-menu-point-out-current-article)
6221 (run-hooks 'article-menu-listing-hook))
6223 (add-hook 'article-menu-listing-hook (lambda ()
6224 (setq currently-displayed-label
6228 \begin{notate
}{On `turn-article-table-into-list'
}
6229 I hate to actually use this function the way it is used in
6230 `display-article'... probably we should just select from the
6231 \emph{plain
} articles there, and write a separate function to display
6232 other articles. In short, there really shouldn't be any need to use
6233 this function, except maybe for debugging purposes or
\emph{explicit
}
6234 listing of all the articles (whenever that really needs to be done).
6238 (defun turn-article-table-into-list ()
6239 (let ((names (list t)))
6240 (maphash (lambda (name value)
6241 ;; It might be nice to have
%S here, but
6242 ;; I don't know if it would be _useful_
6243 (nconc names (list (format "
%s" name))))
6248 \begin{notate
}{On `turn-article-table-into-names'
}
6249 This is a variant of `turn-article-table-into-list'
6250 that produces the actual names of the articles;
6251 probably it should supercede the other, since we could
6252 get the print names by mapping over the output of this
6253 function, obviously.
6257 (defun turn-article-table-into-names ()
6258 (let ((names (list t)))
6259 (maphash (lambda (name value)
6260 (nconc names (list name)))
6265 \begin{notate
}{On `turn-article-table-into-propertized-list'
}
6266 This combines the best of both `turn-article-table-into-list' and
6267 `turn-article-table-into-names'. Compare
6268 `label-to-propertized-list'.
6272 (defun turn-article-table-into-propertized-list ()
6273 (let ((names (list t)))
6274 (maphash (lambda (name value)
6277 (propertize (format "
%s" name) 'name name))))
6282 \begin{notate
}{On `turn-list-into-propertized-list'
} \label{turn-list-into-propertized-list
}
6283 Turns an arbitrary list into a propertized list.
6287 (defun turn-list-into-propertized-list (lis)
6289 (mapc (lambda (name)
6291 (propertize (format "
%s" name) 'name name)
6297 \begin{notate
}{Special-purpose listings
} \label{special-listings
}
6298 Here are a few functions to list special collections of articles.
6299 The function `article-menu-list-labels' is perhaps particularly
6300 noteworthy; browsing labels seems to be a powerful way of organizing
6301 and retrieving information, see Note
\ref{browsing-subcollections
}.
6305 (defun article-menu-list-plain-articles ()
6307 (article-menu-listing))
6309 (defun article-menu-list-all-articles ()
6311 (article-menu-listing (turn-article-table-into-propertized-list)))
6313 (defun article-menu-list-metadata-articles ()
6315 (article-menu-listing (label-to-propertized-list 'metadata)))
6317 (defun article-menu-list-labels ()
6319 (article-menu-listing (label-to-propertized-list 'label)))
6321 (defun list-articles (lis)
6323 (article-menu-listing (turn-list-into-propertized-list lis)))
6326 \begin{notate
}{Using text properties in the article listing
} \label{text-properties-in-article-listing
}
6327 The approach that I've been using so far, searching for spaces, won't
6328 work if the names of the columns have spaces in them. Something more
6329 sophisticated (probably using text properties) would work better in
6330 general. It would also be handy to tuck the articles ``true names''
6331 in as text properties attached to the print names.
6334 \begin{notate
}{On `article-menu-display-article'
}
6335 The point is to grab the name of the article on the currrent line of
6336 the listing and display it. This needs to be checked a bit in the
6337 multicolumn case (which itself needs to be explored).
6341 (defun article-menu-display-article ()
6343 (when (> (line-number-at-pos)
1)
6345 (goto-char (line-beginning-position))
6346 (search-forward-regexp "
[. >
] .")
6347 (setq name-of-current-article
6348 (get-text-property (point) 'name))
6349 (article-menu-point-out-current-article)
6350 (display-article name-of-current-article))))
6353 \begin{notate
}{On `article-menu-mark-article'
}
6354 Use this to mark the article mentioned on this line.
6358 (defun article-menu-mark-article ()
6360 (setq buffer-read-only nil)
6361 (when (> (line-number-at-pos)
1)
6362 (goto-char (line-beginning-position))
6365 (when (< (line-number-at-pos)
6366 (progn (save-excursion (goto-char (point-max))
6367 (line-number-at-pos))))
6369 (setq buffer-read-only t))
6372 \begin{notate
}{On `article-menu-unmark-article'
}
6373 Use this to remove any mark on the article mentioned on this line.
6377 (defun article-menu-unmark-article ()
6379 (setq buffer-read-only nil)
6380 (when (and (> (line-number-at-pos)
1)
6381 (not (save-excursion (goto-char (line-beginning-position))
6382 (looking-at "\\."))))
6383 (goto-char (line-beginning-position))
6386 (when (< (line-number-at-pos)
6387 (progn (save-excursion (goto-char (point-max))
6388 (line-number-at-pos))))
6390 (setq buffer-read-only t))
6392 (defun article-menu-unmark-all-articles ()
6394 (setq buffer-read-only nil)
6395 (save-excursion (goto-line
2)
6396 (goto-char (line-beginning-position))
6397 (while (re-search-forward "^>" nil t)
6398 (replace-match " ")))
6399 (setq buffer-read-only t))
6402 \begin{notate
}{On `article-menu-point-out-current-article'
}
6403 This is a non-interactive function that puts a dot in front
6404 of the current article when the article listing is generated.
6408 (defun article-menu-point-out-current-article ()
6409 (goto-char (point-min))
6410 (setq buffer-read-only nil)
6411 (save-excursion (when (search-forward-regexp "^\\." nil t)
6412 (replace-match " ")))
6414 name-of-current-article
6415 (search-forward-regexp
6416 ;; maybe this `(format "
%s" name-of-current-article)'
6417 ;; stuff should be stored as some kind of function,
6418 ;; like `print-name-of-article' or something like that
6419 (concat "^
[.
] " (regexp-quote
6420 (format "
%s" name-of-current-article)))
6422 (replace-match (concat ". " (substring (match-string
0)
2))))
6423 (goto-char (line-beginning-position))
6424 (setq buffer-read-only t))
6427 \begin{notate
}{Features of the article menu
} \label{features-of-the-article-menu
}
6428 The only ``actionable'' feature of the current listing is display.
6429 See also Note
\ref{control-panels
}.
6433 (make-generic-menu-mode "Article Menu"
6434 '(("g" . article-menu-listing)
6435 ("m" . article-menu-mark-article)
6436 ("u" . article-menu-unmark-article)
6437 ("U" . article-menu-unmark-all-articles)
6439 ("
\C-m" . article-menu-display-article)))
6442 \begin{notate
}{Additional actions
}
6443 We also want to have a function that will give the semantics for
6444 ``select'' and other sorts of things that we might be able to do to
6445 the objects that we've listed. (Maybe we should pass this in along
6446 with the objects, and set it up as a local variable that can be called
6450 \begin{notate
}{Search engine interface
} \label{search-engine-interface
}
6451 It will be useful to interface this browsing mechanism with a
6452 simple predicate matching mechanism. Sometimes we'll want to
6453 restrict search (Note
\ref{restricting-search
}), but for now,
6454 we might as well write a function that searches everything.
6456 A more advanced search engine would apply general predicates
6457 to create the list (e.g. it would allow the user to
6458 restrict to scholia of a certain type, or that
\emph{have
}
6459 scholia of a given type, or that match other computed properties).
6461 Other basic advances would be to have a second column that
6462 showed the actual match, and to display the matches in order
6463 according to the position of the articles in question within
6464 some specific linearization of the
document (e.g. the main one).
6466 The main functions in the ``search engine'' so far are
6467 `article-menu-list-articles-matching-regexp' (Note
6468 \ref{article-menu-list-articles-matching-regexp
}) and
6469 `article-menu-list-articles-matching-predicate' (Note
6470 \ref{article-menu-list-articles-matching-predicate
})
6473 \begin{notate
}{On `article-menu-list-articles-matching-regexp'
} \label{article-menu-list-articles-matching-regexp
}
6474 This makes a listing showing all of the articles that match
6477 \emph{(It would be nice if we could leave out meta, reference,
6478 code, and label types of articles in the default version of
6483 (defun article-menu-list-articles-matching-regexp (regexp)
6484 (interactive "MRegexp: ")
6485 (let ((matches (mapcar
6487 (propertize (format "
%s" name) 'name name))
6492 ;; rough, not bothering with
6494 (let ((article (get-article elt)))
6497 (scholium-name (get-article elt)))
6500 (scholium-text article)))
6501 (goto-char (point-min))
6502 (search-forward-regexp regexp
6504 (turn-article-table-into-names)))))
6506 (article-menu-listing matches)
6507 (message "No hits."))))
6510 \begin{notate
}{On `article-menu-list-articles-matching-predicate'
} \label{article-menu-list-articles-matching-predicate
}
6511 This is a way to pick out all of the articles in the library
6512 that match a given predicate.
6516 (defun article-menu-list-articles-matching-predicate (pred)
6517 (let ((matches (mapcar
6519 (propertize (format "
%s" name) 'name name))
6520 (remove-if (lambda (elt) (not (funcall pred elt)))
6521 (turn-article-table-into-names)))))
6523 (article-menu-listing matches)
6524 (message "No hits."))))
6527 \begin{notate
}{Restricting search
} \label{restricting-search
}
6528 If we have lots of subcollections, then we will sometimes need to
6529 search through all of them, and sometimes, only through some subset.
6530 When doing search, there are two efficient ways to limit things (and
6531 these are very similar): either add subcollections that match some
6532 predicate, or remove subcollections that match some predicate.
6535 \begin{notate
}{Saving search results
}
6536 It would be handy to be able to store the listings generated by
6537 search in some workspace. As a prior step, one needs to be able
6538 to turn the arbitrary listing into an article (specifically, a
6542 \begin{notate
}{Browsing subcollections
} \label{browsing-subcollections
}
6543 Compare Section
\ref{displaying-labels
} (should that stuff go here?).
6544 Also note that functionality for displaying sub-objects made out of
6545 hash tables should probably be worked in. Note that browsing from
6546 list to list is similar to the Gopher experience.
6548 One special sort of subcollection to browse would be one generated by
6549 search. A variant of `multi-occur' that resolves at the scholium
6550 level would be very handy to have (see Note
6551 \ref{search-engine-interface
}).
6554 \begin{notate
}{Display all matches in full
}
6555 Instead of just providing the
\emph{listing
}, sometimes
6556 it could be handy to display a concatenation of all
6557 matching texts (maybe with the matching words highlighted).
6558 Compare Note
\ref{derivative-works-in-the-scholium-system
}.
6561 \begin{notate
}{On `display-article-listing'
}
6562 This just puts the cursor in the article listing.
6566 (defun display-article-listing ()
6568 (pop-to-buffer "*Generic List*"))
6571 \begin{notate
}{Arrangement of listing window
}
6572 The generic list should always go on the
\emph{left
} in our display,
6573 and similarly with files that have their own buffers. This is
6574 especially relevant whenever we're treating the listing as an article,
6575 cf. Note
\ref{display-label
}. It is possible, although perhaps
6576 unlikely, that sometimes we'll want article listings to be mapped into
6577 the Main Article Display set to a Generic List Mode.
6580 \begin{notate
}{Static catalog display
}
6581 It might be advantageous to not have the display disappear -- which
6582 presumably means, display the articles that it lists as scholia
6583 attached to it; otherwise, they display and their scholia display, and
6584 there isn't enough room on the display for the catalog. Something
6585 like this should be easy enough to do.
6588 \begin{notate
}{Electric catalog
}
6589 Probably we could write things so that sections display directly when
6590 the cursor moves over the relevant line in the catalog. This would
6591 make browsing entries very speedy.
6594 \begin{notate
}{Scholia attached to sections
}
6595 When we import the system (Note
\ref{import-scholium-system
}),
6596 an article is created for each section that is displayed
6597 as a listing. Such articles are currently displayed
6598 together with all of the articles
\emph{in
} the section shown
6599 as attached scholia. It would probably be nice to be able
6600 to turn this ``feature'' off (also perhaps on a
6601 browsing-style-dependant basis).
6604 \subsection{Temporal browsing
} \label{temporal
}
6606 \begin{notate
}{History models
}
6607 I had the idea to make a generic browser that could be used as
6608 the backend for both the scholium system's temporal browser and
6609 for my lynx-based browser nero. (It may prove to be most
6610 convenient to simply embed a new nero in the scholium system,
6611 indeed, this seems fairly likely to happen.) But I think it makes
6612 more sense at this point just to write a working scholia browser.
6613 That sort of abstractification can come later; the design will
6614 feature some effort in this direction, but perhaps largely in the
6615 form of notes about how to make things fully general and
6618 What is a temporal browser? Typically, a list of history elements
6619 that can be added to when new pages are encountered, and from which
6620 elements are deleted as new paths through the network get trod.
6622 For example, if the user browser pages $A$, $B$, and $C$ in order,
6623 there will be a history list $H=(A\ B\ C)$. Upon going
\emph{back
},
6624 the history list becomes $H=(A\ B)$, and a future list is created,
6625 $F=(C)$. If the user then visits a new page $D$, the history list
6626 becomes $H=(A\ B\ D)$ and $F=()$.
6628 In order to make access
\emph{quick
}, one obvious design strategy is
6629 to store pages that have been browsed locally (i.e., rather than
6630 re-downloading them each time they are browsed). Of course, if the
6631 pages are already stored locally, this issue is moot. And in this
6632 case, to save storage space (at a small time cost), we should be
6633 recording
\emph{metadata
} (names or pointers) on the history list, not
6634 the pages themselves.
6636 There are a couple of other models to consider.
6638 First, we can store our history data in a
\emph{tree
}. In this
6639 ``
\emph{istree
}'' model, what we would see in the above scenario is:
6647 I.e., each level of the tree stores the parent node as the car, and a
6648 list of children as the cdr (children are stored as atoms if they
6649 themselves are childless, or as the head of lists if they have
6650 children). To keep track of where we are in the tree, we need a list
6651 of directions (cars and cdrs). In the current case, the list would be
6652 (in the order of application):
\emph{cdr, car, cdr, cdr
}. (For
6653 purposes of maintaining a symmetry which will be seen momentarily, we
6654 always return a
\emph{list
} in which the current node is the car.) If
6655 the user moves
\emph{back
} from $D$ to its parent $B$, the
6656 supplementary list becomes
\emph{cdr, car
}, in other words, we find
6657 the most recent parent (car) in the list. If the user moves back
6658 again from $B$, the supplementary list becomes
\emph{nil
}, which means
6659 we are at the first node.
6661 The data structure is simple, but confessedly, the explanation is a
6662 bit complicated! Another simple model keeps track of the
\emph{full
6663 history
}. In this case, the model evolves as follows:
6670 This model has the benefit of retaining data about
\emph{loops
}
6671 (e.g. the short loop $B$, $C$, $B$). Loops can be lopped off by the
6672 following algorithm: starting at the end of the list (i.e. the current
6673 node), make a list of nodes that have been encountered, and trace
6674 backward. If the previous node hasn't been encountered, put it at the
6675 beginning of our growing loop-free list. If it has been encountered,
6676 search backward for the earliest appearance of the last novel node,
6677 and add the element preceding that one to the loop-free list. Moving
6678 ``back'' in the sense of the truncated history list of traditional
6679 browsers can be accomplished by finding antecedent of the earliest
6680 appearance of the current node. E.g., if the user wants to move
6681 \emph{back
}, we add the antecedent $B$ to the list, to obtain
6682 $T=(A\ B\ C\ B\ D\ B)$. If the user wants to move
\emph{back
} again, we obtain
6683 $T=(A\ B\ C\ B\ D\ B\ A)$, since $A$ is the earliest immediate
6685 Similarly, to move
\emph{forward
} at this point, we find the
6686 latest immediate sequel to the current node; in this case, $B$ again,
6687 and put $T=(A\ B\ C\ B\ D\ B\ A\ B)$.
6689 We can also recover the data stored in the istree model. This is left
6690 as an easy exercise to the reader, but the algorithm is given in the
6691 code; for reasons of generality (and simplicity!),
\emph{we are
6692 adopting the full history model as the basis of this browser
}.
6694 A variety of interesting novel browser actions can be performed
6695 using this information, e.g., finding all the pages you looked at
6696 before or after this one.
6699 \begin{notate
}{Science (fiction) tie-in
}
6700 Users can tap into the lived experience of a time lord (assuming we
6701 retain the ``temporal'' metaphor), or the experience of a Wolframian
6702 particle (compare NKS) if we consider a spatial metaphor instead.
6703 We'll let you sort out the paradoxes. (
\emph{Hint:
} you never
6704 step in the same river twice.)
6707 \begin{notate
}{Tabbed browsing
}
6708 Users of the full history model may be in less immediate need of
6709 ``tabs'' (in the form of multiple histories) than users of the truncated
6710 history model. Alternate browsing paths are (close to) natively
6711 available. Futhermore, a page can be marked as a divider between
6712 one ``tab'' and another. Indeed, this gives us an analogy to the
6713 ``tabs'' than stick out of file folders in a physical filing cabinet.
6714 (The only difference is that pages can be in multiple files at the
6715 same time, which is as it should be.) This means that
6716 multiple histories can be used (in a read-only mode) as virtual
6717 \emph{cabinets
} for organizing information. The actual system of
6718 cabinetry need not be maintained here; implementing extra browsing
6719 features is a good activity for some rainy day.
6721 On the other hand, see Note
\ref{thematic-histories
}.
6724 \begin{notate
}{Thematic histories
} \label{thematic-histories
}
6725 It might be useful to keep a record of several different sorts of
6726 histories, e.g. of editing events or ``catalog pages'' (Note
6727 \ref{history-for-listing
}). These
6728 alternate histories wouldn't have much to do with the temporal
6729 browser per se. Emacs does this in some cases (e.g. recording the
6730 input history for various interactive functions separately).
6732 If we're going to do this, probably the code in this section
6733 should be written in a somewhat more generic way.
6737 (defvar sb-history nil)
6739 (add-hook 'display-article-hook
6741 (sb-add-article-to-history name-of-current-article)))
6744 \begin{notate
}{Instead of adding the name
} \label{instead-of-names
}
6745 Maybe we should be adding directions on how to get the article.
6746 The name might not be sufficient if we end up working with
6750 \begin{notate
}{Complexities could be handled by `display-article'
}
6751 Of course, additional sorts of access instructions (like those alluded
6752 to in Note
\ref{instead-of-names
}) could be handled by
6753 `display-article'.
\emph{This section
} does not depend on article
6754 names being stored as strings.
6758 (defun sb-add-article-to-history (article)
6759 (setq sb-history (nconc sb-history (list article))))
6763 (let ((current (car (last sb-history)))
6767 (if (equal (nth n sb-history) current)
6768 (progn (setq found t)
6770 (display-article (nth (
1- n) sb-history))
6771 (message "Already at beginning of history.")))
6774 (defun sb-forward ()
6776 (let* ((current (car (last sb-history)))
6777 (max (
1- (length sb-history)))
6781 (if (equal (nth n sb-history) current)
6782 (progn (setq found t)
6784 (display-article (nth (
1+ n) sb-history))
6785 (message "Already at end of future")))
6789 \begin{notate
}{Keeping track of visited references
} \label{visited-references
}
6790 It seems like we might want to keep track of information about visited
6791 references in some data structures maintained by the temporal browser.
6792 Alternatively, we could put this information into the metadata
6793 articles attached to the articles that have been visited (which would
6794 make it easy to
report the number of visits to the article owners).
6795 See Note
\ref{reference-face
}.
6798 \begin{notate
}{Function to go all the way back
}
6799 Should be able to go all the way back to the beginning
6800 of the history list in one go.
6803 \begin{notate
}{On `sb-previous'
}
6804 This gives the most recently browsed article besides the current
6809 (defun sb-previous ()
6810 (car (last sb-history
2)))
6813 \begin{notate
}{Be careful to avoid cycles
}
6814 I'm not sure that the formulation of temporal browsing given in this
6815 section actually works! It needs a critical review to make sure that
6816 the future actually has an end, for example. I seem to be discovering
6817 problems by using display-only text (see Note
6818 \ref{display-purposes-only
}).
6821 \subsection{Linear browsing
} \label{linear-browsing
}
6823 \begin{notate
}{Browsing through the contents of a label
} \label{browsing-through-the-contents-of-a-label
}
6824 In Note
\ref{multidimensional-visual-browsing
}, the idea of being able
6825 to move forward through the
document's natural structure was
6826 discussed. One of the easiest ways to define this sort of structure
6827 is relative to the contents of some label. A more advanced mode would
6828 stitch together several labels, e.g., the sections and subsections of
6829 a
document, with some simple logic for moving from label to label. In
6830 addition, a given article might appear as part of several labels, in
6831 which case, the user could be presented with possible directions to
6832 travel in. This is in some sense an extension of Section
\ref{local
},
6833 since it gives more local directions to go in. It is also similar to
6834 the idea of following through a set of slides (and presumably would
6835 make it easy to implement such an arrangement).
6837 The key thing seems to be identification of the ``parent'' label(s)
6838 to use for this purpose. Maybe this info is already available in
6839 the form of backlinks? Although, note that we might not always
6840 want to turn on this sort of label browsing for all labels all the
6844 \begin{notate
}{Disposition of code for linear browsing
}
6845 Some code for additional graphical features has been added
6846 to the scholia display by `scholia-display-extras'. It would
6847 be good to add some commands to do a semantically similar
6848 sort of navigation non-graphically, here. When the multi-parent
6849 browsing ideas from Note
\ref{more-than-one-parent
} have
6850 become fixed, they should of course be available here too.
6853 \begin{notate
}{On `add-visible-back-temporal-link'
} \label{add-visible-back-temporal-link
}
6854 This makes a link to the previous-browsed page appear in the Scholia
6855 Display. It runs within the scope of `scholia-display-extras' (Note
6856 \ref{scholia-display-extras
}).
6858 It like we should potentially be able to change the strategy here, so
6859 as to add more information to the text properties and not actually
6860 create any corresponding article. I think this would require some
6861 adjustments to the way text properties are handled.
6865 (defun add-visible-back-temporal-link ()
6866 ;; this should be marked up to become a fake link (one that isn't
6867 ;; displayed in the main buffer)
6870 "Back (temporal): ")
6871 (let ((beg (point)))
6873 (format "
%s" (sb-previous)) 'face 'sch-reference-face))
6874 (scholium 'reference-to-previous-article
6876 `((,name-of-current-article
6882 (add-to-scholia-property-within-region
6885 '(reference-to-previous-article
1 1)))))
6888 \begin{notate
}{On `add-visible-parent-and-sibling-links'
} \label{add-visible-parent-and-sibling-links
}
6889 This adds links to the parent and nearest siblings in the Scholia
6890 Display buffer. It runs within the scope of `scholia-display-extras'
6891 (Note
\ref{scholia-display-extras
}).
6895 (defun add-visible-parent-and-sibling-links ()
6896 ;; identify the link to the parent, if it exists.
6897 ;; (this assumes that there is only one parent)
6898 (let ((link-to-parent (car (member-if (lambda (link)
6899 (member 'parent (cdr link)))
6900 (scholium-about article)))))
6901 (when link-to-parent
6902 (let* ((parent (get-article (first link-to-parent)))
6904 (scholium-text parent))
6905 (this-name-headed (member name-of-current-article
6907 (next (cadr this-name-headed))
6908 (prev (car (last (butlast parent-data
6909 (length this-name-headed))))))
6913 (let ((beg (point)))
6914 (insert (propertize (format "
%s" (scholium-name parent))
6915 'face 'sch-reference-face))
6916 (scholium 'reference-to-parent
6918 `((,name-of-current-article
6922 (,(scholium-name parent)))
6924 (add-to-scholia-property-within-region
6927 '(reference-to-parent
1 1))))
6930 "Back (in parent): ")
6931 (let ((beg (point)))
6932 (insert (propertize (format "
%s" prev) 'face 'sch-reference-face))
6933 (scholium 'reference-to-previous-article-in-parent
6935 `((,name-of-current-article
6941 (add-to-scholia-property-within-region
6944 '(reference-to-previous-article-in-parent
1 1))))
6947 "Forward (in parent): ")
6948 (let ((beg (point)))
6949 (insert (propertize (format "
%s" next)
6951 'sch-reference-face))
6952 (scholium 'reference-to-next-article-in-parent
6954 `((,name-of-current-article
6960 (add-to-scholia-property-within-region
6963 '(reference-to-next-article-in-parent
1 1))))))))
6965 (add-hook 'scholia-display-extras-hook
6966 'add-visible-back-temporal-link)
6967 (add-hook 'scholia-display-extras-hook
6968 'add-visible-parent-and-sibling-links)
6971 \begin{notate
}{On `forward-in-parent'
} \label{forward-in-parent
}
6972 A quick command to get the label identified as this object's parent,
6973 and move to the next mentioned after this one in this label. (It
6974 would also be possible to follow the next reference in a page, i.e.,
6975 use a page like a label; but this function doesn't do that.)
6977 It would be nice to have this function select the ``next cousin'' (or
6978 other suitable relative) if we are out of siblings.
6980 We'll also want a quick command to hop
\emph{to
} an article's parent.
6984 (defun forward-in-parent ()
6988 \begin{notate
}{On `backward-in-parent'
} \label{backward-in-parent
}
6989 Like `forward-in-parent' (Note
\ref{forward-in-parent
}) but moves
6994 (defun backward-in-parent ()
6998 \section{Editing and deleting
} \label{editing
}
7000 \subsection{Initiating edits
} \label{initiating-edits
}
7002 \begin{notate
}{How to initiate edits
}
7003 Buffers are frequently non-read-only; if these buffers have been
7004 marked up with scholia, then they can be edited directly. The Main
7005 Article Display buffer (for scholia with no other or better home) may
7006 as well be non-read-only as well. The point being that to start
7007 editing the
\inp{text
} of an article, one just needs to begin. (In
7008 the current implementation, articles in the Scholia Display buffer
7009 need to be made current with `follow-scholium', or by some other
7010 means, but that is easy enough.)
7012 However, the other parts of an article (Note
7013 \ref{definition-of-scholium
}) are not immediately editable without
7014 some intermediate step to call them up and expose them to the user.
7015 Since
\inp{bookkeeping
} data is maintained by the system itself, the
7016 only parts of articles that need special initial steps to edit are the
7017 \inp{name
},
\inp{about
}, and
\inp{type
} fields.
7020 \begin{notate
}{Inserting text in the middle of a marked up region
} \label{inserting-text-in-middle-of-marked-up-region
}
7021 When someone inserts text into the middle of a marked up region, does
7022 the new text take on the markup properties of the surrounding text, or
7023 does it not, or can we make it an option, to possibly be exercised in
7024 different ways in different places? I assume we will want different
7025 behavior at different times. (Cf. Note
7026 \ref{splitting-text-properties
}). The reference to consider is the
7027 ``Sticky Properties'' node from the Elisp manual
\footnote{(info
7028 "(elisp)Sticky Properties")
}.
7030 There they tell us that
7032 By default, a text property is rear-sticky but not front-sticky; thus,
7033 the default is to inherit all the properties of the preceding
7034 character, and nothing from the following character.
7038 If a character's `rear-nonsticky' property is `t', then none of its
7039 properties are rear-sticky. If the `rear-nonsticky' property is a
7040 list, properties are rear-sticky
\emph{unless
} their names are in the
7043 Thus, we have nothing to worry about in terms of front-stickiness, but
7044 we must maintain an appropriate rear-nonsticky list throughout the
7045 regions in which we want some of the properties to be non-sticky.
7047 Something like this (enhanced, of course) will work:
7049 (progn (put-text-property (line-beginning-position) (line-end-position)
7051 (put-text-property (line-beginning-position) (line-end-position)
7052 'rear-nonsticky '(face)))
7056 \subsection{Editing `about' data
} \label{editing-about-data
}
7058 \begin{notate
}{The joys and sorrows of editing `about' data
}
7059 As noted in
\ref{consistency-editing
}, changes to
\inp{about
} data can
7060 have broad ramifications. In addition to masking any explicit links
7061 that point at this data, we will have to change everything that uses
7064 In particular, backlinks corresponding to the set of edited links will
7065 have to change. I think that this part at least can be accomplished
7066 by running `scholium-modified-about-hook' (cf. Note
7067 \ref{hooks-for-new-and-modified-scholia
} and Note
7068 \ref{put-backlinks
}).
7070 We'll have to decide whether it is worth our trouble to change markup
7071 (it would seem to be inavoidable; however, as a quick work-around,
7072 perhaps other renderings can simply be blanked out when
\inp{about
}
7073 data is being edited).
7076 \subsection{Finding revised `about' data by parsing text properties
} \label{parsing
}
7078 \begin{notate
}{Mini-overview of parsing text properties
}
7079 This section concerns the topic of finding changes to
\inp{about
} data
7080 of scholia that are induced by changes to the
\inp{text
} of an article
7081 that they are
\inp{about
}.
7084 \begin{notate
}{Overview of parsing text-properties
} \label{overview-of-parsing-text-properties
}
7085 By finding the places in a marked-up buffer where the `scholia'
7086 property changes and examining its value before and after the change
7087 point, the beginning and end of each marked region can be found. (See
7088 the description of this property in Note
\ref{the-scholia-property
}.)
7090 More specifically: (
1) we must find all the places where the `scholia'
7091 property changes; (
2) then figure out what was new or what went away
7092 at each change point; (
3) and update a list of beginnings and endings
7093 in the approximate form of an
\inp{about
} list. This is a first step
7094 in the lengthier process of committing edits (see Section
7098 \begin{notate
}{Indicator functions
} \label{indicator-functions
}
7099 We can have marked regions that overlap to any depth; overlapping
7100 scholia can also have non-trivial non-overlapping regions.
7102 In a mathematical abstraction, we might see scholia like
7103 $
\indicator{[0,
3]}$, $
\chi_{[1,
10]}'$, $
\chi_{[2,
5]}''$,
7104 $
\chi_{[8,
9]}'''$ (as pictured in Figure
7105 \ref{Simulation-with-indicator-functions
}). We could even have
7106 different regions from the same scholium overlap.
7108 It would be nice to be able to indicate arbitrary subsets of the
7109 \inp{text
} that we're presented with. The actual set of available
7110 indicators is a $
\sigma$-algebra, if I remember correctly.
7112 For LISP code, picking out arbitrary bits of list structure would be
7113 handy (see Note
\ref{including-transcluding-and-lisp
}).
7116 \begin{notate
}{On `scholia-property-at-changepoints'
}
7117 This returns a list of pairs; points where
7118 the `scholia' property changes paired with the value of the `scholia'
7119 property at those points.
7123 %% in LaTeX, ascii art is a little bit trickier than usual
7126 \ \ \ \ \ \ \ \ -- \\
7128 \ ------------------ \\
7133 \caption{Markup simulated with indicator functions
\label{Simulation-with-indicator-functions
}}
7138 (defun scholia-property-at-changepoints ()
7139 (let ((next-change-point (point-min))
7141 (while next-change-point
7142 (setq change-points (cons (list next-change-point
7147 (setq next-change-point (next-single-property-change+predicate
7151 (when (not (null (get-text-property
7152 (caar change-points)
7154 (setq change-points (cons (point-max) change-points)))
7155 (reverse change-points)))
7158 \begin{notate
}{On `detect-scholia-structure'
} \label{detect-scholia-structure
}
7159 This function says which passages of the current article have been
7160 marked up with which scholia. Typically, this function will be run
7161 after editing, to recover the modified markup information and
7162 propagate it to attached scholia (see Section
\ref{committing
}).
7164 The way the function works is as follows. At each of the change
7165 points, we find the the annotations that have either just appeared or
7166 just disappeared, by using the `set-difference' function to compare
7167 the value of the `scholia' property at the
\emph{upcoming
} change
7168 point with the value at the
\emph{current
} one. We then sort the
7169 elements of this difference into ``opening'' and ``closing'' sets
7170 based on whether they are present at the
\emph{upcoming
} change point,
7171 or the
\emph{current
} one. In order to ensure that there is an
7172 adequate basis for comparison in all cases, exogenous points at
7173 ``$-
\infty$'' and ``$
\infty$'' are introduced, with no scholia
7176 Every ``opening'' element corresponds to some as-yet-unseen marked-up
7177 region; when encountering such an item, we add a term to the return
7178 value that looks like ``(VALUE BEG)'' where VALUE and BEG are,
7181 \item the value of the `scholia' property -- which will be the
7182 name of a scholium together with a unique link identifier, as
7183 described in Note
\ref{the-scholia-property
};
7184 \item and the point where this link starts to attach to the current
7187 Similarly, every ``closing'' element corresponds to the end of some
7188 already-seen marked-up region. When encountering such elements, we
7189 modify the corresponding previously added term in the return value to
7190 read ``(VALUE BEG END)'', END here being the point where the link in
7191 question stops attaching to the current
document.
7193 Note that since `scholia-property-at-changepoints' gives us the values
7194 in increasing order, new ``opening'' items are encountered and added
7195 to the list in increasing order as well. This property is important
7200 (defun detect-scholia-structure ()
7201 (let ((begs-and-ends
7202 (cons '(-infinity nil)
7204 (scholia-property-at-changepoints)
7205 (list '(infinity nil)))))
7207 (while (> (length begs-and-ends)
1)
7208 (let ((difference (set-difference (second
7209 (first begs-and-ends))
7211 (second begs-and-ends))))
7215 (dolist (elt difference)
7216 (if (member elt (second (second begs-and-ends)))
7217 (setq opening (cons elt opening))
7218 (setq closing (cons elt closing))))
7219 (dolist (elt opening)
7220 (setq marked-regions
7221 (add-to-or-start-list
7223 `(,elt ,(first (second begs-and-ends))))))
7224 (dolist (elt closing)
7225 (let ((found (member-if (lambda (pass)
7226 (equal (first pass) elt))
7228 (setcdr (cdr (car found))
7229 (list (first (second begs-and-ends)))))))
7230 (setq begs-and-ends (cdr begs-and-ends))))
7234 \begin{notate
}{New scholia added while editing
}
7235 I don't
\emph{think
} that new scholia added while editing will need to
7236 be treated any differently during the reparsing process from scholia
7237 that were created before editing started. Scholium-creation should be
7238 a self-contained process that gets everything stored properly; the
7239 only special concern is that text properties would need to be added to
7240 the buffer that is being edited, but that's obvious enough.
7243 \begin{notate
}{Finding changes in scholia about the whole article
} \label{changes-in-scholia-about-whole-article
}
7244 Presumably this data will be stored in a relevant metadata article,
7245 rather than in text properties (contrast Aaron's picture). We
7246 probably won't have to do reparsing to handle scholia like this,
7247 \emph{but we will have to do something
}.
7250 \begin{notate
}{Make `scholia' a variable?
}
7251 It would be easy enough to make `scholia' as used above
7252 into a variable instead of hard code, so that we could read from
7253 another text property instead. Probably we would want to complement
7254 this with similar changes to the code that adds text properties!
7257 \subsection{Committing edits
} \label{committing
}
7259 \begin{notate
}{Themes for committing
}
7260 (
1) Store stuff to metadata articles;
7261 (
2) Prefer these for rendering purposes.
7264 \begin{notate
}{Committing implications
}
7265 Edits to any part of a scholium (in particular, to its
\inp{name
},
7266 \inp{text
},
\inp{about
}, or
\inp{type
} data) need to be saved and
7267 otherwise processed. Sometimes changes in one article will result in
7268 changes to other articles, e.g.,
\emph{changing
\inp{about
} data may
7269 lead to changes in backlinks
}; and changes to
\inp{text
} may lead to
7270 changes in one or more attached scholium's
\inp{about
} data (Note
7271 \ref{set-updated-about-info
}).
7274 \begin{notate
}{Bookkeeping and version managing
}
7275 When articles have been modified,
\inp{bookkeeping
} data needs to be
7276 updated. In particular, we are supposed save sufficient data to move
7277 back and forth between article versions. This is true of both
7278 \inp{text
} data and the other data that make up articles (
\inp{name
}
7279 may be handled somewhat differently, but in general we need to store
7280 enough data to move between all versions of the article).
7283 \begin{notate
}{Setting updated `about' information
} \label{set-updated-about-info
}
7284 The idea of preferring metadata articles when rendering has been
7285 discussed in the section on metadata articles (Section
7286 \ref{metadata-articles
} and Note
\ref{updating-link-extent
} in
7287 particular), and is reflected in the way `mark-things-up' is written
7288 (Note
\ref{mark-things-up
}). For this all to work, it is necessary
7289 for `commit-edits' to store updated
\inp{about
} data when it runs.
7292 \begin{notate
}{On `store-link-masks'
} \label{store-link-masks
}
7293 This function runs within the scope of `commit-edits', after
7294 `adjusted-markup' has been found by parsing (Note
\ref{commit-edits
}).
7295 Indeed, so far, this is the only significant default action of
7296 `commit-edits' (cf. Note
\ref{set-updated-about-info
}).
7298 The function compares the elements of `current-markup' (Note
7299 \ref{current-markup
}) to the elements of `adjusted-markup'. When
7300 changes are present in the markup data, `store-link-masks' adds or
7303 More precisely, for each element of `current-markup', we select
7304 from `adjusted-markup' those elements with the same link-id
7305 (or maybe mask-id). These are the `matching-regions' corresponding
7306 to that markup element. Unless there is only one matching region
7307 and this matching region happen to point to extend over exactly
7308 the range specified by the original link, we execute an operation
7311 This operation is to swap in a replacement mask, if the markup
7312 element was coming from a mask already, or to create a brand new
7313 mask otherwise. If we're doing a replacement, we look for the
7314 \emph{one
} mask that corresponds to the link-id borne by the
7315 current markup element. We then substitute
\emph{all
} of the
7316 matching regions, for whatever was previously stored in this mask.
7318 Otherwise, we just create a new mask with the appropriate link-id,
7319 containing the relevant regions.
7323 (defun store-link-masks ()
7324 (dolist (link-ext current-markup)
7325 (let* ((matching-regions (remove-if
7326 (lambda (markup-item)
7327 (not (equal (car markup-item)
7330 (num-matching-regions (length matching-regions))
7331 (name-of-linking-article (if (eq (first
7332 (car link-ext)) 'mask)
7335 (first (first link-ext)))))
7336 (unless (and (eq num-matching-regions
1)
7337 (equal (cdr (first matching-regions))
7339 (if (eq (caar link-ext) 'mask)
7340 ;; swap in a different mask
7342 (get-metadata-field 'masks
7343 name-of-linking-article))
7344 (current-mask-headed
7345 (member-if (lambda (item)
7346 (equal (second (car link-ext))
7349 (setcdr (car current-mask-headed)
7350 (mapcar (lambda (ided-reg)
7353 (put-metadata-field 'masks
7355 name-of-linking-article))
7356 ;; create a new mask
7357 (let ((masks (or (get-metadata-field
7359 name-of-linking-article)
7365 (add-to-or-start-list
7368 ,@(mapcar (lambda (ided-reg) (cdr ided-reg))
7369 matching-regions))))
7370 name-of-linking-article)))))))
7373 \begin{notate
}{Adding new markup to rendered articles
} \label{adding-new-markup-to-rendered-articles
}
7374 Adding new markup to rendered articles
7375 will introduce a discrepancy
7376 between `adjusted-markup' and `current-markup', i.e., items
7377 will be found that weren't there before. This shouldn't,
7378 be a problem, because `store-link-masks' iterates through the
7379 members of `current-markup' looking for matches. So, anything
7380 completely new in `adjusted-markup' will be ignored by
7381 the `store-link-masks' phase of the commit process. This
7382 is relevant to Section
\ref{derivative
}, and any other code
7383 that modifies the markup of rendered articles.
7386 \begin{notate
}{On `commit-edits-hook'
} \label{commit-edits-hook
}
7387 This is the single point of customization for the commit function,
7388 to be used in future sections. It runs within the scope of
7389 `commit-edits', after `adjusted-markup' has been found
7390 by parsing. Thus, functions that are added to this hook can
7391 take advantage of this knowledge about the current state of
7396 (defvar commit-edits-hook nil)
7399 \begin{notate
}{On `after-committing-edits-hook'
} \label{after-committing-edits-hook
}
7400 This facilitates additional actions after the main committing
7401 routines are finished.
7405 (defvar after-committing-edits-hook nil)
7408 \begin{notate
}{Summary of idea behind `commit-edits'
}
7409 When you edit the buffer, the text properties showing where scholia
7410 are attached move around. When you run `commit-edits', metadata
7411 indicating the new position of these regions is stored; it will be
7412 used subsequently so that the correct regions are highlighted. (These
7413 suggestions coming can later be incorporated into the scholia by their
7414 authors.) Furthermore, `commit-edits' stores a version of the article
7415 for subsequent browsing.
7418 \begin{notate
}{On `commit-edits'
} \label{commit-edits
}
7419 Anything run by the `commit-edits-hook' that changes the text of the
7420 article being committed should store the desired value on
7421 `adjusted-text'. It is going to take a bit of thinking about how to
7422 make several functions (particularly functions having to do with
7423 derivatives) run properly, in serial. (But I'm pretty sure it can be
7426 Note that when committing we currently make sure that exactly one
7427 newline is attached to the end of the page when the text is
7428 saved. This has a beneficial effect on exporting the scholium
7429 system (see
\ref{export-scholium-system
}).
7431 We may at some point want one or more commit functions that will store
7432 more different kinds of edits from more different places. For
7433 example, we'll want to be able to commit edits that take place in the
7434 Scholia Display buffer. Similarly for edits to `about' data, and so
7435 forth (see Note
\ref{editing-about-data
}).
7439 (defun commit-edits ()
7441 (let* ((adjusted-markup (copy-tree (detect-scholia-structure)))
7442 (old-contents (get-article name-of-current-article))
7443 (adjusted-text (buffer-substring-no-properties (point-min)
7445 (old-text (scholium-text old-contents)))
7447 (run-hooks 'commit-edits-hook)
7448 ;; here is where the criterion for checking that some change has
7449 ;; actually been made would be inserted
7450 (when (not (equal adjusted-text old-text))
7451 (scholium name-of-current-article
7452 (with-temp-buffer (insert adjusted-text)
7453 (goto-char (point-max))
7455 (delete-blank-lines)
7456 (buffer-substring-no-properties
7459 ;; of course, for more advanced versions of
7460 ;; this code, these won't be static
7461 (scholium-about old-contents)
7462 (scholium-type old-contents)
7463 ;; this should be reformatted to store the old
7465 (scholium-bookkeeping old-contents)))
7466 (run-hooks 'after-committing-edits-hook)))
7469 \begin{notate
}{After committing, redisplay article
}
7470 Hopefully this won't cause any problems. The one concerning point I
7471 can think of might come up when committing fully rendered and
7472 identified compilations (Section
\ref{quick-compilations
}), but we
7473 haven't worked out the major details of that yet, so there's no reason
7474 to worry about this one minor one.
7478 (add-hook 'after-committing-edits-hook 'redisplay-article)
7481 \begin{notate
}{Shortcomings of the basic commit implementation
}
7482 Old comments should continue to apply verbatim to the old version of
7483 the
document -- and also, tentatively, to the new version. Maybe
7484 masks should contain information about which version of the article
7485 they apply to. A given link could have a collection of masks, each
7486 relevant to a different version of the article being linked to
7487 (perhaps recycling content when the masks are known to be the same).
7489 And, of course, commiting is going to have to store a version of the
7490 article on the
\inp{bookkeeping
} list (or equivalent; see Note
7491 \ref{vc-and-filesystem-support
}). We will then want support for
7492 \emph{version browsing
} -- hopefully the browsing functions can be
7493 made to ``just work'' on data coming in with an explicit version
7496 And, in addition, we should be updating backlinks as needed.
7498 (These items should be assessed to see how critical they are; it seems
7499 to me that we can probably work with things roughly as they are, if we
7500 aren't doing anything too wild. It would be interesting to
document
7501 the process of coming to rely more heavily on the system as time goes
7504 Another nice thing would be to make sure that there is a
7505 newline at the end of the committed text.
7508 \begin{notate
}{Assigning masks after reparsing
} \label{send-messages-to-redirected-scholia
}
7509 We send a message to each of the scholia that have been redirected
7510 after editing has taken place (cf. Note
\ref{masks
}). In order to do
7511 this, we have to compare the new markup data with the old markup data
7512 to figure out what will change. We may want to keep a buffer-local
7513 record of the original markup data in order to figure out precisely
7514 what has changed. (I think for now we just assume that there is one
7515 rendered article at a time, so we only keep track of one set of old
7516 markup data. But don't quote me on that.)
7518 Alternatively, we could mask
\emph{everything
}, regardless of whether
7519 or not this data has actually changed, but this seems rather silly,
7520 and potentially very inefficient besides. So we don't do that.
7523 \begin{notate
}{Similarity of deleting and committing
} \label{similarity-of-deleting-and-committing
}
7524 Note that deleting is probably going to be similar to committing, in
7525 terms of the way changes to
\inp{about
} data are reported and stored.
7526 (See Section
\ref{deletion
}.)
7529 \begin{notate
}{Where to store committed edits
}
7530 One thing I'm somewhat curious about is whether it is ever safe to
7531 assume that we can make changes to an attached scholium
7532 \emph{directly
}, without waiting for its owner's input. It seems more
7533 likely that we would want to put the updated information on that
7534 scholium's
\emph{metadata article
}, which is its ``world-writable''
7535 space (see Note
\ref{metadata-article-overview
}). If we do this,
7536 that means that the routine we use to find a scholium's
\inp{about
}
7537 data when rendering a given article may have to look at the scholium's
7538 metadata article. (The case in which the same person owns both
7539 articles might be one case in which we would wish to make changes
7543 \begin{notate
}{The role of metadata
} \label{role-of-metadata
}
7544 If we assume that changes aren't made directly, then the owner of the
7545 scholium whose metadata article has been changed will have the
7546 opportunity to accept or decline the suggested changes. Note that if
7547 the author doesn't accept the changes, then the rest of the world may
7548 still have the option to use
\inp{about
} data from the metadata
7549 article instead of from the article itself. Also note that even if a
7550 commentator retracts remarks for some updated version of the article,
7551 they may continue to apply to earlier versions.
7553 When a commentator accepts changes, most likely what will happen is
7554 that a new version of the scholium will be created, and the specific
7555 suggestions removed from its metadata article. However, if the
7556 suggestion is declined, most likely the suggestions will stay on the
7557 metadata article. (This situation seems a bit backwards.)
7558 Alternatively, if the suggestions are declined, the author might just
7559 delete them (if we make it so that anyone can make changes to the
7560 metadata article -- which might be reasonable).
7562 For more on this topic, see Section
7563 \ref{responding-to-incoming-metadata
}.
7566 \begin{notate
}{The possibility for conflicts in backpropagated `about' data
} \label{conflicts-in-masks
}
7567 The potential for conflicts in suggested changes coming from edits to
7568 various different articles exists, in theory, but I think it is
7569 dispatched by the fact that each region is drawn from exactly one
7570 article. So, as long as each link is kept up-to-date with respect to
7571 any changes in the one article that it applies to, there won't be any
7575 \begin{notate
}{Conflicts in a distributed environment
} \label{conflicts-in-a-distributed-environment
}
7576 Of course it is the case that if the same article is being changed or
7577 even just talked about in several different places, or if it is a
7578 scholium that applies to several articles that reside in different
7579 repositories, many different sorts of conflicts could arise. The task
7580 of assimilating changes from various locations should be given at
7581 least partial support in code.
7584 \begin{notate
}{Committing and reverting
}
7585 Note that ``revert'' is in some weak sense an opposite action to
7586 ``commit''. (See also Note
7587 \ref{similarity-of-deleting-and-committing
}.)
7590 \subsection{Editing en masse
} \label{masse
}
7592 \begin{notate
}{Enhanced control panel
}
7593 It might be good to add another column to the article listing control
7594 panel. Any changes to the article listing that take place in this
7595 section should be done somewhat delicately and artistically.
7596 Presumably this implies that the list of column-fields should be
7597 stored as a variable, so that it can be easily modified. Note that
7598 functions for mapping over lists of articles forms the theoretical
7599 basis of this section (see Note
7600 \ref{mapping-across-a-subcollection
}).
7603 \begin{notate
}{Adding metadata en masse
}
7604 It isn't quite ``editing'', but equally important would
7605 be a way to apply a given scholium to a set of articles
7606 (both severally and not severally), or add type data to
7607 a set of articles that you own, or whatever.
7610 \begin{notate
}{On `label-marked-articles'
}
7611 Apply the specified
\inp{label
} to each marked article.
7612 New labels can be applied no problem.
7616 (defun label-marked-articles (label)
7618 (intern (let ((completion-ignore-case t))
7621 (label-to-list 'label))))))
7622 (let (article-names)
7625 (goto-char (line-beginning-position))
7626 (while (re-search-forward "^> ." nil t)
7628 (append article-names
7630 (get-text-property (point) 'name))))))
7631 (dolist (name article-names)
7632 (label-article name label))))
7635 \subsection{Deletion
} \label{deletion
}
7637 \begin{notate
}{Deleting articles
} \label{deleting-articles
}
7638 It is sometimes desirable to delete articles that are no longer worth
7639 looking at. We want to give the user this power, though in some cases
7640 it would be nice if the article wasn't really deleted and was instead
7641 just
\emph{depreciated
}.
7643 There is a somewhat complex operation that should be executed when an
7644 article is actual deleted (and/or, conversely, a somewhat complex
7645 system we should put in place to deal, at render time, with articles
7646 that have been deleted without sufficient follow-through). Some of
7647 the steps in the deletion process should be: (
1) deleting backlinks;
7648 (
2) unindexing the article from whatever labels the article has been
7651 But right now, we just delete.
7654 \begin{notate
}{Steps to be taken when deleting an article
} \label{steps-when-deleting
}
7655 If the article is a scholium attached to the current article,
7656 we should remove the associated text properties and overlays.
7658 Since in theory we can't modify the
\inp{about
} data that point
7659 at the deleted article, we might want to broadcast a signal to
7660 these articles that say that their referent has been deleted.
7661 One way to do this would be to replace the article with a
7662 ``Deleted Article'' stub, and probably add it to a ``deleted''
7665 Of course, as with other issues having to do with
\emph{propagation
}
7666 things are somewhat different if all the articles are owned
7667 by the same person (or otherwise have conventions associated
7668 with them whereby they can be kept in sync without problems).
7671 \begin{notate
}{Set current article to `nil'
}
7672 If the current article is deleted, then the `name-of-current-article'
7673 variable should probably be set to nil. (Either that, or something
7674 from the temporal browser should be used to set the variable to the
7679 (defvar delete-article-hook nil)
7681 (defun delete-article (name)
7682 (interactive (list (read-article-name)))
7683 (let ((article (get-article name)))
7686 (remhash name article-table)
7687 (when (equal name name-of-current-article)
7688 (setq name-of-current-article nil))
7689 (run-hooks 'delete-article-hook))
7690 (error "No article by that name found"))))
7693 \begin{notate
}{Deal with effects on temporal browser
}
7694 It is a little weird to revised history to make it look like deleted
7695 pages
\emph{never existed
}. Seriously Orwellian. For now, that's
7699 \begin{notate
}{On `remove-appearances-in-history'
}
7700 This function will run inside the scope of `delete-article'.
7704 (defun remove-appearances-in-history ()
7705 (setq sb-history (delete name sb-history)))
7707 (add-hook 'delete-article-hook 'remove-appearances-in-history)
7710 \begin{notate
}{Deal with effects on articles that deleted article was attached to
}
7711 Presumably articles that the deleted article linked to will have to
7712 have their backlinks adjusted. That is to say, it would be somewhat
7713 odd to have backlinks to an article that doesn't exist.
7716 \begin{notate
}{On `delete-scholium-associated-with-current-marked-region'
}
7717 Provides a quick way to delete the scholium attached to region
7718 containing point. If more than one scholium is so attached,
7719 we bring up a menu to select items for deletion.
7721 This function assumes that the `scholia' property is simply
7722 comprised of a list of the names of attached scholia; I'm
7723 not so sure that this is an accurate assumption (if not,
7724 then we should be able to easily extract such a list from
7725 the actual `scholia' property).
7727 This is just one of several functions that would benefit from
7728 the addition of progressive markup modifications.
7732 (defun delete-scholium-associated-with-current-marked-region ()
7734 (let ((linked-scholia (scholia-named-at-point)))
7736 ((eq (length linked-scholia)
0)
7737 (message "No scholium attached here."))
7738 ((eq (length linked-scholia)
1)
7739 (delete-article (car linked-scholia)))
7741 (list-articles linked-scholia)
7743 "Inspect articles and select items for deletion with \"d\".")))))
7746 \begin{notate
}{Deletion in various strengths
}
7747 Probably there should be several different kinds of
7748 deletion (like in X windows, there is kill, destroy, minimize, wipe
7749 out to the fifth generation, etc.; also, compare the several
7750 different ``strengths'' derivative articles come in).
7753 \subsection{Responding to incoming metadata
} \label{responding-to-incoming-metadata
}
7755 \begin{notate
}{How to deal with metadata
}
7756 This section gives support for article owners dealing with incoming
7757 metadata coming from editing events. An important example: scholia
7758 may see suggested changes to their
\inp{about
} data when the
7759 article(s) that they are about change). Authors might want to
7760 incorporate such incoming changes into their
document, or obliterate
7761 them, or revise them. Perhaps a scholium author will want their
7762 comments to apply to the version of the article it commented on, but
7763 not to the revised version. Or perhaps a scholium author would like
7764 to drop their content all together (to the extent that this is
7765 possible). We'll do what we can to accomodate these various actions
7769 \subsection{Editing labels
} \label{editing-labels
}
7771 \begin{notate
}{To edit labels
}
7772 If you're going to edit a label, you'd like to do things like insert
7773 new articles, delete old articles, rearrange the order of entries, and
7774 so on. Preliminary support for this sort of thing is given in this
7778 \begin{notate
}{On `article-menu-insert-new-article'
}
7779 This function lets you add new articles to a recently browsed label.
7781 For now, we assume that we really are adding a
\emph{new
} article
7782 (and not some existing one); and that this new article will
7783 take the quotidian form offered by `make-scholium' (Note
7784 \ref{make-scholium
}). These assumptions may be relaxed later.
7786 The function one of `label-article' and `label-article-insert-before'
7787 to add the label to the new article (Note
\ref{label-article
}, Note
7788 \ref{label-article-insert-before
}).
7790 (When creating this new article, I hope that enough ancillary metadata
7791 ,
\inp{type
} and so on, is added to allow it to be recognized as part
7792 of the relevant hierarchy later.)
7796 (defun article-menu-insert-new-article ()
7798 (if currently-displayed-label
7799 (let ((new-entry (read-string "New entry: "))
7800 (old-entry (save-excursion
7801 (goto-char (line-beginning-position))
7802 (search-forward-regexp "
[. >
] ." nil t)
7803 (setq name-of-current-article
7804 (get-text-property (point) 'name)))))
7805 (setq new-scholium-name new-entry)
7806 (let ((line (line-number-at-pos)))
7808 (label-article-insert-before
7809 new-entry old-entry currently-displayed-label)
7810 (label-article new-entry currently-displayed-label))
7811 (display-label currently-displayed-label)
7814 (message "Listing doesn't represent a label.")))
7816 (define-key article-menu-map "i" 'article-menu-insert-new-article)
7819 \begin{notate
}{Committing edits to labels
} \label{commit-label
}
7820 So far, the editing steps we do with labels are automatically
7821 entered into the backend, so, at this point, we don't need a
7822 `commit-label'. If it turns out that we want one, then these
7823 routines will have to be rewritten somewhat, and `commit-edits'
7824 will have to have `commit-label' hooked into it.
7827 \subsection{Further notes on editing and deleting
}
7829 \begin{notate
}{Reparsing and propagating after editing
} \label{reparsing-after-editing
}
7830 Editing an article is one of the main reasons we'd ever need to do
7831 reparsing. When text moves around, scholia are likely to be attached
7832 to different regions. This means we need to change the
\inp{about
}
7833 elements of attached articles for the collection to stay coherent.
7834 Proper reparsing behavior is necessary for various functions to behave
7835 properly; see for example Note
\ref{moving-with-reparsing
}. We
7836 probably will want to add the appropriate reparsing function to the
7837 corresponding after-editing/before-saving-changes hook.
7840 \begin{notate
}{Changing names
}
7841 One simple ``edit'' would be changing the name of an article; doing
7842 this of course requires the new name to replace the old name in every
7843 reference to the article.
7846 \begin{notate
}{Changes to an article affect attached articles
}
7847 However, changes to the
\emph{text
} of a given article may affect any
7848 scholia that are
\emph{about
} that article. (To say nothing of how
7849 the semantic contents of the change might affect these attached
7850 scholia, the regions may be wrong.) One approach to take would be to
7851 attempt to propagate the changed buffer positions to all attached
7852 scholia. Of course, we can't necessarily assume that the owner of the
7853 attached scholia will accept these propagated changes.
7856 \begin{notate
}{We shall adopt a versioned model
} \label{we-adopt-a-versioned-model
}
7857 These considerations suggest that we should go with the ``versioned''
7858 diachronic model. According to this model, changes can be propagated,
7859 but on a tentative basis. If another user doesn't accept your
7860 changes, they will still have a perfectly good scholium attached to a
7861 previous version of your article.
7864 \begin{notate
}{Moving between versions
}
7865 It would probably be handy to have this use existing browser code,
7866 e.g. from the local browsing section (Section
\ref{local
}).
7869 \begin{notate
}{Different ownership models can do different things
}
7870 When permissions aren't a concern, we can set the system up so that
7871 propagated changes are automatically accepted. In addition, we can
7872 set up versioning to resolve at different levels of detail depending
7876 \begin{notate
}{Changes outside the system
}
7877 One further consideration is the fact that articles may change outside
7878 of the scholium system (e.g. a file may be edited, a remotely-hosted
7879 web page may change, or a process may be killed). We assume that when
7880 a change like this is noticed, the scholium system will create a new
7881 version of the article
\emph{automatically
} and propagate appropriate
7882 changes to other documents.
7885 \begin{notate
}{How to do automatic updates
}
7886 Noticing changes to files is a bit of a challenge; not insurmountable,
7887 but it does mean that we'll need an internal representation of the
7888 file's contents (i.e. one that we assume is not subject to change in
7889 the same way that the file is!). As it stands, the system doesn't
7890 include this sort of version management apparatus. In order to mend
7891 things, whenever an article is created (or edited), a backup copy
7892 should be stored that can serve as a reference. At least, I guess
7893 this is how version management software works. Presumably it isn't
7894 hard to add this sort of feature, but before plunging ahead, I think
7895 it would be worth looking into the algorithms and protocols used by
7896 extant version management tools.
7899 \begin{notate
}{When should auto-accept work?
}
7900 Although auto-accept is a nice-sounding thing, it may be best to
7901 always have changes approved by a person, since changes to the text
7902 could completely change its meaning -- and threaten to make attached
7903 scholia ridiculous. Maybe auto-accept is most useful when
\emph{one
}
7904 person is editing the
document, but even then, there may be times when
7905 content changes so much that the attached scholium would become
7906 ridiculous or meaningless. In this case, maybe auto-accept is good,
7907 but the user should be able to roll back propagated changes easily?
7909 Keeping track of the genesis of a given scholium is important. Maybe
7910 this procedural info will be marked up itself sometimes? Certainly
7911 there can be extra user-supplied info, outside of the bookkeeping
7912 info, that describes relationships between documents.
7915 \begin{notate
}{Changes to metadata in a semantically programmed environment
}
7916 We assume that changing
\inp{type
} and
\inp{about
} data also require
7917 changing the article version.
7920 \begin{notate
}{Using bookkeeping information to track versions
}
7921 As if it wasn't obvious, the
\inp{bookkeeping
} information will be used to
7922 keep track of different article versions. (Presumably including diffs
7923 between versions or what have you: it would be good to hook the GNU
7924 diff tools into this system. See also the comment about storing the
7925 ``current'' version of articles in full, to check against changes from
7929 \section{Derivative works
} \label{derivative
}
7931 \subsection{Introduction to clusions
} \label{intro-to-derivatives
}
7933 \begin{notate
}{Derivative works in the scholium system
} \label{derivative-works-in-the-scholium-system
}
7934 Section
\ref{rendering
} focuses on providing useful views
\emph{into
}
7935 the
document. The matter of assembling
\emph{new articles
} which
7936 derive from other articles drawn from the
document is essentially a
7937 separate problem; we will tackle this problem in this section. (Other
7938 sorts of derivative or derivative-like works, such as collections and
7939 indices are given their primary treatment elsewhere.)
7942 \begin{notate
}{Different kinds of derivatives
} \label{different-kinds-of-derivatives
}
7943 \emph{Inclusion
} is probably the most straightforward way to assemble
7944 an an article that derives from another article. Material from a
7945 certain version of the source article is simply inserted into the
7946 current article. Inclusion is treated in Section
\ref{inclusion
}.
7947 \emph{Transclusion
} is similar to inclusion, except that instead of
7948 simply inserting source text as it is right now, transclusion causes
7949 the source to be tracked as it changes, and its most up-to-date
7950 version to appear automatically in the derivative work when it's
7951 rendered. Transclusion is treated in Section
\ref{transclusion
}.
7952 \emph{Identification
} is like a two-way version of transclusion:
7953 instead of the source material being inherited by the derivative
7954 article, under identification, the source is shared between several
7955 articles. Thus, changes in one place will be mirror in each of the
7956 other places. This is developed in Section
\ref{identification
}.
7959 \begin{notate
}{Clusions
} \label{clusions
}
7960 We refer to specific instructions specifying an inclusion,
7961 transclusion, or identification as a
\emph{clusion
}. (By analogy to
7962 the morphisms of category theory.) In this lingo, we could also refer
7963 to identification as
\emph{biclusion
}.
7965 Both identification and transclusion are represented as links inside
7966 the
\inp{text
} field of an article, and this property is definitional
7969 Identification, on the other hand, is currently implemented as a live,
7970 one-time operation, and so it isn't strictly an example. However,
7971 once we have a proper versioning system working, it would be fairly
7972 easy to do inclusion as a proper clusion like the others (by making it
7973 point at a specific version of a
document from which to draw text) --
7974 assuming that is what is desired. It may be that the user wants to
7975 simply quote from the other
document, and doesn't want to do clusion
7976 maintenance. We'll have to give some thought to what way of operating
7977 is most desirable here.
7979 I haven't thought of any other major classes of clusions (at least,
7980 not yet), but just to point out that any clusion can be composed with
7981 straightforward text operations (e.g. reversing the characters in a
7982 cluded region) to obtain another clusion.
7984 Mainatining clusions is part of a broader problem of maintaining
7985 consistency conditions, see Section
\ref{consistency
}.
7988 \begin{notate
}{Allowable sources
} \label{allowable-sources
}
7989 Compare Note
\ref{types-of-text
}, which talks about the different
7990 allowable kinds of
\inp{text
}, but note that, one should be able to
7991 clude things other than text. The set of objects that can be cluded
7992 is same as the set of objects that a scholium can be
\inp{about
},
7993 i.e., anything a link can point at.
7996 \begin{notate
}{Derivatives and versioning
}
7997 In order to get the relevant functions for building derivatives set up
7998 properly, we really should have version management in place.
8001 \begin{notate
}{List processing as a prototypical example
} \label{including-transcluding-and-lisp
}
8002 The ``
{\tt ,@
}'' from LISP comes to mind when thinking about
8003 transcluding, whereas shared list structure is like identification.
8004 It would be interesting to spell the relationship out in detail.
8006 One further thought on the subject is that we may sometimes want to
8007 transclude symbols and s-exps of LISP code -- which brings the
8008 discussion full circle pretty quickly.
8011 \begin{notate
}{Boundaryless formulations
} \label{boundaryless-formulations
}
8012 The simplest cases to deal with appear to be those in which no
8013 boundary is mentioned. For example, cluding the whole of some article
8014 $A$ into another article $B$. In practice, sometimes we can stick to
8015 a boundaryless treatment; other times, boundaries are unavoidable.
8018 \begin{notate
}{Clusion algorithms
}
8019 It would probably be good to put an overview of things like
8020 \ref{the-transclusion-algorithm
} here, so that the subsequent
8021 discussion of markup makes sense. (We could talk about the easy
8022 work-around for building this
document, and contrast it with the more
8023 intensive operations that go on in the *Compilation* buffer (cf. Note
8024 \ref{making-a-compilation
}).
8027 \begin{notate
}{Splitting text properties
} \label{splitting-text-properties
}
8028 Text inserted in the middle of a quotation does not derive from the
8029 same source as the quoted text. Therefore, it typically should not
8030 take on the `derives-from' markup of the surrounding text. For a
8031 discussion of inserting within a marked up region in general (i.e.,
8032 not just in the cases having to do with derivatives), see Note
8033 \ref{inserting-text-in-middle-of-marked-up-region
}.
8036 \begin{notate
}{Splitting clusions
}
8037 Notice that edits in either the source or the recipient
8038 article can cause a clusion to split, as illustrated in
8039 Figure
\ref{Two-ways-to-cause-clusions-to-split
}.
8044 \begin{tabular
}{ccc
}
8045 $A$ &$
\rightarrow$& $B$ \\
8046 \verb|xxabcd| & &
\verb|yyabcd| \\
8047 \verb|efgxxx| & &
\verb|efgyyy| \\
8053 \begin{tabular
}{ccc
}
8054 $A'$ &$
\rightarrow(
\times 2)$& $B'$ \\
8055 \verb|xxabcd| & &
\verb|yyabcd| \\
8056 \verb|xxxefg| & &
\verb|efgyyy| \\
8061 \begin{tabular
}{ccc
}
8062 $A'$ &$
\rightarrow(
\times 2)$& $B'$ \\
8063 \verb|xxabcd| & &
\verb|yyabcd| \\
8064 \verb|efgxxx| & &
\verb|yyyefg| \\
8068 \caption{Edits in either $A$ or $B$ can cause a clusion to split
8069 \label{Two-ways-to-cause-clusions-to-split
}}
8073 \begin{notate
}{Masking clusions
} \label{masking-clusions
}
8074 We want to mask clusions in much the same way we mask links (Note
8075 \ref{masking-links
}). Indeed, clusions
\emph{are
} essentially links,
8076 by definition (Note
\ref{clusions
}).
8079 \begin{notate
}{Format of text with derivatives
} \label{format-of-text-with-derivatives
}
8080 The format of the
\inp{text
} field for articles with derivatives is as
8083 (twd <string | clusion> ...)
8085 Each clusion is a link with the corresponding instruction consed
8086 onto the front of it (cf. Note
\ref{links
}). The three instructions
8087 are `transclude', `identify', and `include'.
8091 (twd "This Note can be used as part of an example.
\n"
8092 (transclude "Format of text with derivatives"))
8096 (twd "Part of this Note can be used as part of an example.
\n"
8097 (transclude "Format of text with derivatives"
8101 There is a small break in transparency here; presumably this won't be
8102 a problem (Note
\ref{principle-of-transparency
}).
8105 \begin{notate
}{Transclusion and freedom
} \label{transclusion-and-freedom
}
8106 The right to make and circulate
\emph{derivative works
} is important
8107 (i.e., when it is allowed!). One easy sort of derivative is a
8108 compilation of all of the sub-objects that have a given property. For
8109 example, one could put together a collection of all the first
8110 paragraphs drawn from the various sections of an article, or all the
8111 paragraphs that have been marked as ``needs revision'', or
8112 ``theoretically interesting'', etc. Transclusion makes it easy to
8113 build simple, useful, derivatives of this sort, and keep them up to
8114 date as the master
document changes. (Sometimes one would want to use
8115 somewhat special instructions, e.g. in order to collect only the
8116 \emph{new
} items matching an otherwise-global search criterion.)
8119 \begin{notate
}{The dependence of the various derivatives on `commit-edits'
} \label{derivatives-and-committing
}
8120 I think we may have to do a commit after running `transclude-article',
8121 since it involves changing the
\inp{text
} field. By contrast, running
8122 `include-article' causes new scholia to be stored automatically, but
8123 we left committing the text field to the user. So, I'm not sure; if
8124 there is a way to do transclusion without requiring a commit
8125 automatically, that might be kind of nice.
8127 Note also that each of the different derivative styles will have
8128 things to look for whenever they commit
\emph{again
}. (E.g. articles
8129 with inclusions should be inspected to see if perhaps all of the
8130 included text has been deleted.)
8133 \begin{notate
}{Derivatives outside of the scholium system
}
8134 We leave it up to the user to write a suitable function for quoting
8135 text from scholium system objects to non-scholium system objects (if
8136 the user has any of these!).
8139 \begin{notate
}{Technical difficulties with text properties
} \label{difficulties-with-text-properties
}
8140 The fundamental difficulty with text properties seems to be that using
8141 them comes at a non-trivial cost. So we don't use them for everything
8142 (cf. Note
\ref{alternative-to-identification
}).
8144 When doing transclusion, rather than using a uniform text property, we
8145 need a text property that gives a unique ID to each character within
8146 the marked up region (Figure
8147 \ref{Rearrangement-not-detected-using-uniform-text-properties
}, Note
8148 \ref{transclusion-markup-design
}).
8150 I've been assuming that
\emph{typical
} text properties designating the
8151 association of a region with a scholium will be ``sticky'' -- if
8152 someone adds to a marked-up region, the added text will bear the new
8153 markup. At some point, we might have a non-sticky option. However,
8154 the text properties associated with transclusions should always be
8155 non-sticky, since text added in the middle of a quoted passage needs
8156 to be treated as an ``island'' in the middle of the transclusion
8157 (which actually gets split in two).
8159 The problem arises in the fact that Emacs makes it hard and/or ugly to
8160 use an individual text property for each transclusion (see Note
8161 \ref{many-scholium-properties
}). The relevant experiment took place
8162 in CVS versions
41 through
43; version
44 was then identical to
8165 The point is, that I've been maintaining all of the data about scholia
8166 on precisely one text property, which of course takes on different
8167 values as needed. However, the ``stickiness'' of each text property
8168 is controlled individually, and I can't continue to use this trick.
8170 I could, I suppose, use one sticky and one non-sticky text property,
8171 but I think that there may be a better approach involving some work on
8172 the text property system itself. This will need some more
8176 \begin{notate
}{Treating clusions
} \label{treating-clusions
}
8177 The following subsections provide commands for
\emph{building clusions
8178 interactively
}, and for
\emph{rendering them properly
}.
8181 \subsection{Transclusion
} \label{transclusion
}
8183 \begin{notate
}{On `transclude-article'
} \label{transclude-article
}
8184 First we check to see whether the article contains
8185 transclusions already, and if not, we put the text field
8186 into the format used for text with transclusions
8187 (see Note
\ref{format-of-text-with-derivatives
}).
8189 Next, we divide the text of the article in two; everything prior to
8190 point, and everything after point. (We have to divide the
8191 \emph{rendered
} text, fairly clearly; since there might be more than
8192 one different rendering, we hope that the different possible divisions
8193 are consistent, or at least that we know how to do all of the
8196 Of course, we also need to be able to specify the objects that are to
8201 ;; totally not working yet!
8202 (defun transclude-article (article)
8203 (interactive (list (read-article-name)))
8204 (let ((current (get-article name-of-current-article))
8206 ;; it really doesn't make sense to use something like this here --
8207 ;; we only deal with the internal format at commit time.
8208 (unless (and (listp current)
8209 (eq (car current) 'twd))
8211 ,(scholium-text current))))
8212 (let ((beg (point)))
8213 (insert (sch-plain-text (get-article article)))
8214 ;; this condition isn't really strong enough
8215 (when name-of-current-article
8217 `(derives-from ,name-of-current-article ,article ,(genref))
8219 `((passage (,name-of-current-article
8226 \begin{notate
}{Transclusion markup design
} \label{transclusion-markup-design
}
8227 The idea is that when some object $T$ is transcluded into the current
8228 buffer, $
\mathrm{im
}(T)$ is marked up in the following way. Character
8229 $i$ in this image is given a text property that says ``This is
8230 character $i$ of $n$ contiguous characters that have been transcluded
8231 from the object $T$.'' Then, when parsing, if these text properties
8232 show up in new places (e.g. non-contiguously) or if some of the
8233 numbers fail to show up at all, we'll know to initiate new
8234 transclusions or to change the definition of the current one being
8237 The reason for doing things this way is similar to the issue discussed
8238 in the ``Not Intervals'' node of the Elisp manual
\footnote{(info
8239 "(elisp)Not Intervals")
}. If the image of a transclusion was simply
8240 marked up with a property that said ``This is the image of the object
8241 $T$ under transclusion,'' then elements of the region that bears this
8242 text property could be rearranged without anything registering at the
8243 system level (Figure
8244 \ref{Rearrangement-not-detected-using-uniform-text-properties
}). This
8245 would pretty much be a disaster.
8247 The idea here is that
\emph{we should be able to edit texts coming
8248 from transclusion
} and continue to have the transclusion basically
8249 work. In Note
\ref{splitting-text-properties
}, we decided that text
8250 inserted into a quotation should not take on the ``derives-from''
8251 property that the surrounding text bears. Thus, if a transcluded
8252 region is broken up, or pieces of it are deleted, we assume that new
8253 transclusions are being requested by the user.
8255 These remarks apply to the representation of transclusions in rendered
8256 documents; the internal representation is discussed in Note
8257 \ref{format-of-text-with-derivatives
}.
8261 \begin{tabular
}{ccc
}
8262 \verb|-----#| & &
\verb|-----#| \\
8263 \verb|----##| & &
\verb|-#--##| \\
8264 \verb|---###| &$
\rightarrow$&
\verb|---###| \\
8265 \verb|--####| & &
\verb|--##-#| \\
8266 \verb|-#####| & &
\verb|-#####|
8269 \caption{Rearrangement isn't detected using uniform text properties
8270 \label{Rearrangement-not-detected-using-uniform-text-properties
}}
8274 \begin{notate
}{Changing boundaries in source documents
} \label{changing-boundaries-in-source-documents
}
8275 In Note
\ref{transclusion-markup-design
}, we talked about adapting
8276 transclusion boundaries to changes in the derivative
document.
8277 However, it should be noted that boundaries may shift in source
8278 documents as well: if the object being transcluded is ``the region
8279 between character position
10 and character position
250 from article
8280 $A$'' and a lengthy header is inserted, the idea behind the
8281 transclusion may be completely swept away. The way to be safest here
8282 is to specify objects without referring to their boundaries, e.g.
8283 ``Article $A$'' should be safe.
8285 \emph{There may be a way of maintaining the boundaries recorded on the
8286 transclusions themselves in such a way that edits to the source
8287 article are reflected in updated information in the transclusion;
8288 i.e., if text is inserted into the region that is being transcluded,
8289 the boundaries could grow, for example. But doing this seems tricky
8290 (at least modestly tricker than maintaining backlinks, for example),
8291 and I think I will hold off on doing anything like this until I get
8292 some clue that it is actually feasible to do it right.
}
8295 \begin{notate
}{The transclusion algorithm
} \label{the-transclusion-algorithm
}
8296 (
1) The first thing is to run a function to select an object
8299 (
2) Then we render it to plain text and insert that text in the
8300 current article. Appropriate text properties indicating that it is a
8301 transclusion are added next. (If instead of adding a new
8302 transclusion, we simply wish to render an article that includes
8303 transclusions, we must render each transcluded item in this way.)
8305 (
3) We let the user go wild.
8307 (
4) If things have changed at commit time, we need to put new
8308 transclusion instructions together. This new information replaces the
8309 old. And, in any event, the rendered transclusions are converted to
8310 an internal format for storage (Note
\ref{format-of-text-with-derivatives
}).
8313 \begin{notate
}{Simple selection makes for expediency
} \label{simple-selection-for-transclusion
}
8314 In light of the comments in Note
8315 \ref{changing-boundaries-in-source-documents
}, for the time being we
8316 choose the simple method of only allowing the transclusion of whole
8317 articles. There don't appear to be any major theoretical obstructions
8318 to the transclusion of passages, but let's start with something that
8319 will clearly be manageable. (See Note
8320 \ref{principle-of-minimality
}.)
8323 \begin{notate
}{Derivative predicates for transclusions
}
8324 Some sort of `derives-from' predicate may have to be maintained for
8325 transclusions, although here such a `derives-from' predicate might be
8326 deduced from the transclusion
\inp{text
} directly. (This is similar
8327 the approach we took with inclusions.)
8330 \subsection{Inclusion
} \label{inclusion
}
8332 \begin{notate
}{On `include-article'
} \label{include-article
}
8333 It is simple enough to find an article and insert its text at point
8334 (compare `insert-buffer').
8336 %% We then need to add `derives-from' and `derives-to' properties (note
8337 %% similarity to backlinking; indeed, we reuse `put-backlinks', relying
8338 %% on the general way in which it was written; see Note
8339 %% \ref{put-backlinks}).
8343 (defun include-article (article)
8344 (interactive (list (read-article-name)))
8345 (let ((beg (point)))
8346 (insert (sch-plain-text (get-article article)))
8347 ;; this condition isn't really strong enough
8348 (when name-of-current-article
8350 `(derives-from ,name-of-current-article ,article ,(genref))
8352 `((passage (,name-of-current-article
8359 \begin{notate
}{By default, don't print `derives-from' scholia
}
8360 Typically we don't need to see `derives-from' scholia, although it
8361 could be handy to write a special display mode in which these scholia
8362 are printed (and probably special semantics for how they are
8367 (add-to-list 'non-printing-types 'derives-from)
8370 \begin{notate
}{Deleting `derives-from' properties
}
8371 If upon reparsing, if no sections are actually marked up with a
8372 `derives-from' property that was previously recorded, it can be
8373 assumed that the text that was quoted from that particular source
8374 article has been deleted. In which case, odds are that the
8375 formerly-derivative
document doesn't derive from that source any
8379 \begin{notate
}{Add `include-article-formatting-minimally'
}
8380 It might be helpful to have a function that would do everything
8381 that the previous version does, but without marking the text up,
8382 or perhaps just running it through `format'. But I'm going
8383 to hold off on this until the use cases seem clearer to me.
8386 \begin{notate
}{Record version number of included article
}
8387 Since inclusions are static, we should probably make note of the
8388 specific version of the source article that the recipient derives
8392 \begin{notate
}{Including passages
}
8393 It might be useful to support optional ``beg'' and ``end'' arguments
8394 that would make it possible to quote only a substring of the
8395 \inp{article
} that is being included. This seems most likely to be
8396 useful in a setting in which we select the passage to include
8397 interactively. (Cf. Note
\ref{simple-selection-for-transclusion
}.)
8400 \subsection{Identification
} \label{identification
}
8402 \begin{notate
}{Identification from a design perspective
}
8403 Basically, identification is ``like transclusion for editing'': we
8404 have direct write access to the original, as well as read access.
8405 Identification is more powerful than transclusion; and, obviously, one
8406 can only objects that one has permission to modify can be edited
8407 through identification.
8409 Unlike inclusion and transclusion, identified copies should be marked
8410 up with uniform, sticky, text properties. (The user
8411 should be careful that text from the current buffer that wasn't
8412 intended to be part of the identified copy doesn't get stuck
8413 to the identification by mistake!)
8416 \begin{notate
}{The identification algorithm
} \label{the-identification-algorithm
}
8417 The object that we're identifying with should be inserted and marked
8418 up with an `identifies-with' text property at render time. Any
8419 markup of this text (e.g. processing of transclusions or
8420 identifications within the text) should be carried out just as if
8421 the source was being edited directly. At commit time, text bearing
8422 the `identifies-with' property should be compared with the object
8423 it derives from. If it has been changed, a new version of that
8424 object should be committed. As for the derivative article, an
8425 internal representation similar to the one described in Note
8426 \ref{format-of-text-with-derivatives
} should be stored.
8429 \begin{notate
}{Precedent for identification
} \label{precedent-for-identification
}
8430 The emacs package ``all.el'' is abstractly
8431 similar
\footnote{{\tt http://ftp.gnu.org/savannah/files/auctex/attic/auctex/all.el
}}, as
8432 is the idea of shared list structure (Note
8433 \ref{including-transcluding-and-lisp
}).
8436 \begin{notate
}{Identification use case
} \label{identification-use-case
}
8437 Just for instance, one could use this style of transclusion to render
8438 two articles into the same buffer and cut and paste portions of each
8439 into the other, and have the changes mapped back appropriately.
8442 \begin{notate
}{On `insert-identification-at-point'
} \label{insert-identification-at-point
}
8443 This is similar to Note
\ref{include-article
}. For now,
8444 I'm just going to write it so that you can do identification
8445 with other articles; later, more general objects will be allowed
8446 (Note
\ref{allowable-sources
}).
8448 We don't actually need to create any scholia,
8449 but we can use the scholia property. It should
8450 be exactly the same when we render articles that already had
8451 identifications recorded internally.
8455 (defun insert-identification-at-point (article-name)
8456 (interactive (list (read-article-name)))
8457 (let ((beg (point)))
8458 (insert (sch-plain-text article-name))
8459 (add-to-scholia-property-within-region
8462 ;; there aren't any links, so there's no proper linkid
8463 `(identifies-with ,article-name))))
8466 \begin{notate
}{On `propagate-changes-to-identification-source'
}
8467 This runs within the context of
8468 `store-updates-from-identification-images' (when it runs).
8469 Its purpose is to copy changes from the recipient article
8470 in an identification to the source article.
8474 (defun propagate-changes-to-identification-source ()
8475 (when (not (equal (buffer-substring-no-properties
8476 (second (car identifications))
8477 (third (car identifications)))
8479 (second (caar identifications)))))
8480 (let ((source (get-article (second (caar identifications)))))
8481 ;; compare `commit-edits'. When we actually do
8482 ;;
document versions, this should update the version
8483 ;; number and any other metadata about how this
8484 ;; version was created that we get interested in.
8485 (scholium (second (caar identifications))
8486 ;; this is bad, since it is storing
8487 ;; the rendered text, whereas we should of course
8488 ;; be storing the formatted-for-internal-storage
8489 ;; text. But I suppose this is OK for testing
8490 ;; purposes (wherein we'll only have one level
8491 ;; of identification).
8492 (buffer-substring-no-properties
8493 (second (car identifications))
8494 (third (car identifications)))
8495 (scholium-about old-contents)
8496 (scholium-type old-contents)
8497 (scholium-bookkeeping old-contents)))))
8500 \begin{notate
}{On `store-updates-from-identification-images'
}
8501 This function will run within the scope of `commit-edits' via the
8502 `commit-edits-hook' (see Note
\ref{commit-edits-hook
}).
8503 We must first identify the identifications (as it were), which we
8504 do by examining the contents of the `adjusted-markup' list.
8505 Then, once these are found, we form a suitable internal
8508 Everything
\emph{between
} identifications should get stored
8509 as plain text, whereas the identifications themselves should
8512 In addition to adjusting the internal representation of
8513 the article with the identification commands, we should
8514 adjust the text of the source articles, if necessary.
8515 (For simplicity's sake, we could just store updated text
8516 unconditionally for now.)
8518 Concerning the use of `buffer-substring-no-properties':
8519 zapping the properties is questionable, if
8520 we're planning to commit these various derivative
8521 properties serially. Will have to think about this later.
8522 I think that since this thing is being used to build
8523 internal representations, zapping text properties
8524 might actually be OK. But I'm not sure.
8526 For clarification on the use of `adjusted-text', see comments on
8529 Note that the only relevant option besides ``less'' is ``equal''
8534 (defun store-updates-from-identification-images ()
8535 (let ((identifications (remove-if
8537 (not (eq (caar elt) 'identifies-with)))
8541 (while identifications
8542 (if (< pt (second (car identifications)))
8543 (setq formatted-contents
8546 (list (buffer-substring-no-properties
8547 pt (second (car identifications)))
8548 `(ident ,(second (caar identifications)))))
8549 pt (third (car identifications)))
8550 (setq formatted-contents
8553 (list `(ident ,(second (caar identifications)))))
8554 pt (third (car identifications))))
8555 ; (propagate-changes-to-identification-source)
8556 (setq identifications (cdr identifications)))
8557 (when formatted-contents
8558 (when (< pt (point-max))
8559 (setq formatted-contents
8562 (list (buffer-substring-no-properties
8564 (setq adjusted-text (list 'twd formatted-contents)))))
8566 (add-hook 'commit-edits-hook 'store-updates-from-identification-images)
8569 \begin{notate
}{Working identifications into the rendering pathway
}
8570 We'll need to modify rendering to look at the ``ident'' objects
8571 in the
document's representation, and mark these up as identifications.
8573 The way identifications and transclusions are expanded will be
8574 similar. (See section
\ref{rendering-derivatives
} for more on this.)
8577 \begin{notate
}{Visible identification markup
}
8578 It would be handy to optionally have overlays showing which regions
8579 are marked up as identifications, and also to have scholia that say
8580 what they are identified to. (This seems like a good example of a
8581 situation in which it would be be best if the scholia only showed up
8582 when the regions they applied to appeared onscreen.)
8585 \begin{notate
}{Cutting and pasting identifications in multi-user environment
}
8586 One should be careful that passages that have been marked up as
8587 identifications, which are copied and pasted into other articles which
8588 don't have the same permission-set associated with them, are no longer
8589 treated as identifications. Perhaps some identifying information
8590 (`name-of-current-article' being a likely candidate) can be added to
8591 the text property added by `insert-identification-at-point', and some
8592 additional checks put into the commit phase.
8595 \subsection{Rendering articles containing derivative portions
} \label{rendering-derivatives
}
8597 \begin{notate
}{Cluded parts
} \label{cluded-parts
}
8598 These variables will be modified by `unwind-derivatives' to contain a
8599 list of the transcluded sections of a rendered
document.
8600 Specifically, the items on the list are of the form
8602 (<object> <beg> <end>)
8604 where `object' is a link to the thing being transcluded,
8605 and `beg' and `end' represent the beginning and end positions
8606 of the image of the object under this particular clusion, in
8607 the rendered version of the cluding article.
8609 This information will subsequently be used as part of the markup
8610 routine, where it will allow us to add appropriate text properties
8611 indicating cluded regions.
8613 (It may be advantageous to assume that we can always use a
8614 \emph{cached
} version of the article we're cluding. This could be a
8615 help when the article itself is derivative.)
8619 (defvar transcluded-parts nil)
8620 (defvar identified-parts nil)
8621 (defvar included-parts nil)
8624 \begin{notate
}{On `unwind-derivatives'
} \label{unwind-derivatives
}
8625 This will run within the scope of `sch-plain-text', and make recursive
8626 calls to `sch-plain-text' as needed, to turn cluded texts into strings
8627 suitable for display. Specifically, a simple test has been added to
8628 `sch-plain-text-hook' that causes `unwind-derivatives' to run whenever
8629 rendering an article whose
\inp{text
} field is a list that begins with
8630 the token `twd' (see Note
8631 \ref{adding-unwind-derivatives-to-rendering-pathway
}).
8633 The boundaries of the cluded regions are recorded for subsequent
8634 use, as described in Note
\ref{cluded-parts
}.
8636 The contents of the `` *Unwinding Derivatives*'' buffer needs to be
8637 cleared out before this function first runs for it to return the
8638 correct string. (Um, is this all going to work out properly if we
8639 enter into the fully recursive run of `unwind-derivatives'?) That is
8640 accomplished by modifications to `scholia-display-pre-update-hook';
8641 see Note
\ref{prep-for-rendering-text-with-derivatives
}.
8643 The need for (extensive) recursion in this function could be done away
8644 with if we cached a
\emph{rendered
} version of every article that used
8645 clusions somewhere where it could be found by other articles that
8648 However, if we are going to have things like references from cluded
8649 documents appear in the assembled
document, or (in general) if we want
8650 to have access to the scholia attached to the cluded regions (Note
8651 \ref{fancy-derivatives
}), we'll either have to pre-render the
8652 derivative components, or come up with some scheme for mapping the
8653 positions of markup associated with these things into suitable
8654 positions in the assembled
document.
8656 Note that at present markup will be added by
8657 `add-inclusion-and-transclusion-markup' (Note
8658 \ref{add-inclusion-and-transclusion-markup
}).
8662 (defun unwind-derivatives ()
8663 (set-buffer (get-buffer-create " *Unwinding Derivatives*"))
8664 (dolist (elt (cdr text))
8669 ((eq (car elt) 'transclude)
8670 (setq object (cdr elt))
8671 (setq transcluded-parts (cons `(,object ,(point))
8672 transcluded-parts)))
8673 ((eq (car elt) 'identify)
8674 (setq object (cdr elt))
8675 (setq identified-parts (cons `(,object ,(point))
8679 (insert (sch-plain-text object))
8681 ((eq (car elt) 'transclude)
8682 (setcdr (cdar transcluded-parts) `(,(point))))
8683 ((eq (car elt) 'ident)
8684 (setcdr (cdar identified-parts) `(,(point))))))))
8685 (setq ret (buffer-string)))
8688 \begin{notate
}{Preparation for rendering text with derivative components
} \label{prep-for-rendering-text-with-derivatives
}
8689 We need to zap `transcluded-parts', `identified-parts' and the
8690 contents of the buffer in which derivatives are to be unwound before
8691 `unwinding-derivatives' runs.
8695 (defun prep-for-rendering-text-with-derivative-components ()
8696 (setq transcluded-parts nil
8697 identified-parts nil
8700 (set-buffer (get-buffer-create
8701 " *Unwinding Derivatives*"))
8704 (add-hook 'scholia-display-pre-update-hook
8705 'prep-for-rendering-text-with-derivative-components)
8708 \begin{notate
}{Adding `unwind-derivatives' to the rendering pathway
} \label{adding-unwind-derivatives-to-rendering-pathway
}
8709 We make a call to `unwind-derivatives' in `sch-plain-text' when the
8710 appropriate criterion is satisifed (see Note
8711 \ref{sch-plain-text-hook
}). The relevant criterion is that we are
8712 rendering an object (i.e., something that gives us an article) whose
8713 \inp{text
} field is a list that begins with the token `twd'.
8715 (The complex wording here has to do with the matter that we sometimes
8716 render objects that aren't articles, e.g. a link to a certain passage.
8717 We will have to make sure that the criterion used here is correct for
8718 those cases as well as the easy case of rendering a whole article.
8719 See Note
\ref{sch-plain-text
} for details.)
8723 (add-hook 'sch-plain-text-hook
8725 (when (and (listp text) (eq (car text) 'twd))
8726 (unwind-derivatives))))
8729 \begin{notate
}{On `add-inclusion-and-transclusion-markup'
} \label{add-inclusion-and-transclusion-markup
}
8730 For identifications, this should add the same sort of faked-up markup
8731 that we added with `insert-identification-at-point' (Note
8732 \ref{insert-identification-at-point
}).
8734 It might be kind of cute to put some ``corners'' in, showing
8735 where the included text begins and ends (see Note
\ref{monochrome
}).
8737 These modifications to `mark-things-up' appear to be desired
8738 unconditionally (unlike e.g. the modifications to `sch-plain-text' we
8740 \ref{adding-unwind-derivatives-to-rendering-pathway
}). So we just put
8741 `add-inclusion-and-transclusion-markup' directly on the
8742 `mark-things-up-hook' (cf. Note
\ref{mark-things-up-hook
}).
8746 (defun add-inclusion-and-transclusion-markup ()
8748 (set-buffer-to-rendering-target-buffer)
8749 (dolist (elt identified-parts)
8750 (add-to-scholia-property-within-region
8753 `(identifies-with ,(first elt))))
8754 ;; this may end up having to be considerably more complicated
8755 (dolist (elt transcluded-parts)
8756 (add-to-scholia-property-within-region
8759 `(transclusion-of ,(first elt))))))
8761 (add-hook 'mark-things-up-hook 'add-inclusion-and-transclusion-markup)
8764 \begin{notate
}{Should identifications be unwound recursively?
}
8765 I think they won't need to be; if someone asks to identify a region
8766 with some other region that also contains identification, then you
8767 might expect that we'd need to follow through to identify the
8768 indicated portion of the new article with that other earlier source.
8769 That's probably the right way to do things; however, I suppose we
8770 could do something simpler in the mean time, since if we don't write
8771 documents that depend on documents with identifications in them, the
8772 case we've been discussing won't come up! Besides, it would probably
8773 be instructive to have on hand a non-recursive function that does a
8774 similar job to the function written for transclusions.
8776 (Note that labels can sometimes be used to limit complexity of certain
8777 operations, see Note
\ref{cost-of-maintaining-labels
}.
8780 \subsection{Expanded and collapsed views
} \label{expanded-and-collapsed
}
8782 \begin{notate
}{Expanded and collapsed views of derivative articles
}
8783 There should probably be at least two different views into an article
8784 that makes use of any of the derivative-making tools we've discussed
8785 in this section: one that shows all of the rendered text, and another
8786 which just shows
\emph{tokens
} standing in for the rendered text. See
8787 Note
\ref{transcluding-and-outlines
}, as well as Note
8788 \ref{rendered-and-source-views
}. Collapsed views are essentially
8789 ``graphical'' representations of formats like the one listed in
8790 Note
\ref{format-of-text-with-derivatives
}. In order to make these views
8791 available to the user, we'll want to provide `expand-derivatives'
8792 and `collapse-derivatives' commands, as well as, probably, individual
8793 commands for individual derivative items and each of the three
8797 \begin{notate
}{View is initially expanded
}
8798 New derivative pieces are inserted in their expanded
8799 form (see, e.g., Note
\ref{insert-identification-at-point
}).
8802 \begin{notate
}{Collapsing and expanding individual derivative items
}
8803 We could set things up to render everything as collapsed or
8804 expanded all at once, but another option is to have a function
8805 that collapses or expands individual items.
8808 \begin{notate
}{Identification through nontrivial maps
} \label{identification-through-nontrivial-maps
}
8809 In some cases it would be useful to have identifications
8810 go through non-trivial maps, for example, to transform
8811 a rendered piece of
\LaTeX\ text into the standard source
8812 form. In addition, it might be nice to store metadata about
8813 Notes in some other place than the note's immediate neighborhood.
8816 \begin{notate
}{Alternative to identification for simple literate programming applications
} \label{alternative-to-identification
}
8817 It may also be the case that we don't really need to do
8818 identifications to get the ability to import and export
8819 code from the scholium system. As long as everything
8820 is appearing in Notes, we should be able to edit things
8821 in an outline fashion and then export that to the
\LaTeX\
8825 \subsection{Quick compilations and other listing tricks
} \label{quick-compilations
}
8827 \begin{notate
}{Uses for compilations
}
8828 What is presented in this section likely to just be a stop-gap measure
8829 until more general and powerful mechanisms for managing derivatives
8830 are available. But nevertheless, the basic ideas seem useful. For
8831 example, when viewing a certain article that is a member of a certain
8832 label, it might be handy to view everything in the label all at once
8833 in a compilation. And so on and so forth for various compiled views
8837 \begin{notate
}{On `find-names-in-listing'
}
8838 This can be used to find the names of listed articles.
8842 (defun find-names-in-listing (just-marked)
8843 (let ((names (list t)))
8845 (set-buffer (get-buffer-create "*Generic List*"))
8846 (goto-char (point-min))
8847 (while (and (not (eobp))
8849 (search-forward-regexp "^>" nil t)
8851 (let* ((next-change (next-single-property-change
8853 (prop (when next-change
8854 (get-text-property next-change 'name))))
8855 (if (not next-change)
8856 (goto-char (point-max))
8857 (goto-char next-change)
8859 (nconc names (list prop)))))))
8863 \begin{notate
}{Making a compilation from a listing of articles
} \label{making-a-compilation
}
8864 In Note
\ref{bits-and-pieces
}, we talk about making all the articles
8865 that match a given criterion into a new article. A quick way to
8866 get this functionality to the user is to turn an article listing
8869 The version here is very preliminary; eventually we'll be putting in
8870 identifications or something like that to make the various pieces of
8871 the compilation ``hot''.
8873 It be nice to have various display options, either features that
8874 screen certain kinds of content in or out at render time
8875 (e.g. printing of attached code snippets could be optionally be made
8876 automatic), or that add actionable features to the display (e.g. to
8877 enable the user to expand and collapse cluded articles, or to select from a cluded label).
8879 We present a couple of variants here.
8883 (defun listing-to-compilation (just-marked-items)
8885 (let ((names (find-names-in-listing just-marked-items)))
8886 (pop-to-buffer (get-buffer-create "*Compilation*"))
8888 (dolist (name names)
8889 (let ((article (get-article name)))
8891 (propertize (format "
%s" (scholium-name article))
8894 (format "
%s" (scholium-text article))
8896 (goto-char (point-min))))
8898 (defun listing-to-compilation-
1 (just-marked-items)
8900 (let ((names (find-names-in-listing just-marked-items)))
8901 (pop-to-buffer (get-buffer-create "*Compilation*"))
8903 (dolist (name names)
8904 (let ((article (get-article name)))
8905 (insert "\
\begin{notate
}{"
8906 (propertize (format "
%s" (scholium-name article))
8910 (format "
%s" (scholium-text article))
8913 (dolist (scholium (mapcar (lambda (backlink)
8914 (get-article (car backlink)))
8915 (get-backlinks name)))
8916 (when (typedata-includes (scholium-type scholium) 'code)
8917 (insert "\
\b" "egin
{lisp
}\n"
8918 (scholium-text scholium)
8919 "\
\e" "nd
{lisp
}\n\n")))))
8920 (goto-char (point-min))))
8923 \begin{notate
}{Finding code continuations with backlinks
} \label{finding-code-continuations
}
8924 Establishing the existence of attached code snippets in
8925 `listing-to-compilation-
1' (Note
\ref{making-a-compilation
}) is
8926 currently done in a way that doesn't take full advantage of the
8927 backlink-to-link correspondence we've put together. This sort of
8928 thing was one reason I thought we might want to use typed backlinks;
8929 but eventually I decided that simply putting backlinks in direct
8930 correspondence with links would be enough, see Note
8931 \ref{implementation-of-backlinks
}.
8934 \begin{notate
}{Additional compilation tricks
}
8935 Code snippets aren't the only ``bonus features'' we might like to have
8936 appear in a compilation (cf. Note
\ref{making-a-compilation
}); for
8937 example, we might want to make an article appear together with the
8938 articles that immediately precede and follow it in some linear order.
8939 (This makes the compilation a bit more like browsing a printed
8942 It would also be handy to have an option for exporting a fully
8943 \LaTeX -ready version of a compilation (compare Note
8944 \ref{selectively-populate-existing-outline
}).
8946 Another fun trick that would be fairly cute, when this is all working
8947 quite a bit better, would be to have links that run internally within
8948 the compilation show up in a different
color from links that point
8949 outside of the compilation. (We'll want to develop some code for
8950 making the display jump to just the right point when following an
8951 internal link, or any link that points to a specific portion of a
8952 given article.) One might want to view one of these intra-linked
8953 articles in place in the compilation, or perhaps instead on its own,
8954 using the normal single-article display.
8956 The sequence of things displayed in the compilation buffer is the sort
8957 of thing that might benefit from having its own history list; see Note
8958 \ref{thematic-histories
}.
8961 \begin{notate
}{Selectively populate existing outline
} \label{selectively-populate-existing-outline
}
8962 It would be kind of interesting to combine `listing-to-compilation'
8963 with `export-scholium-system' (Note
\ref{export-scholium-system
})
8964 in such a way as to add some particular subset of the
8965 Notes into the section hierarchy.
8968 \begin{notate
}{On `listing-to-label'
}
8969 It can be handy to turn an arbitrary listing into
8970 a more permanent label.
8974 (defun listing-to-label (label-name)
8975 (interactive "MLabel: ")
8976 (let ((names (find-names-in-listing)))
8977 (scholium label-name
8984 \subsection{Further notes on derivative works
}
8986 \begin{notate
}{Derivatives and copyright
}
8987 Recall that for copyright purpose, it is
\emph{expression
} that is
8988 supposed to be examined when deciding whether a given work derives
8989 from some other work. This somewhat elusive quality is going to be
8990 harder to capture than the property of being a derivative via direct
8991 quotation and subsequent revision.
8994 \begin{notate
}{Pedigrees
} \label{pedigrees
}
8995 When adding metadata to show what articles a given article derives
8996 from, we probably only want to bother with the parent, not with
8997 ancestors from earlier generations. More extensive information about
8998 an article's pedigree can be found by chasing backlinks, as needed.
9001 \begin{notate
}{Aggressive management of derivatives
} \label{aggressive-dop
}
9002 A more ``aggressive'' solution to recording information about
9003 derivative works would be to mark up rendered articles with a text
9004 property that identifies them; this way, whenever the text is
9005 cut-and-pasted to a new buffer, the text property will be carried
9006 along, and the source of the text can be identified and noted
9007 when the recipient article is reparsed and committed.
9010 \begin{notate
}{Fancy derivatives
} \label{fancy-derivatives
}
9011 It may be useful at times to carry over certain scholia attached to
9012 the region that is being quoted. There are probably a number of
9013 variations that people would be interested in trying.
9016 \begin{notate
}{Eventual improved support for virtual collections?
} \label{improved-support-for-virtual-collections
}
9017 In Note
\ref{derivative-works-in-the-scholium-system
} we briefly
9018 contrasted derivative articles with collections and indices. It seems
9019 likely that we can come up with tools that will make it easier to
9020 build useful indices; subcollections (Section
\ref{subcollections
})
9021 seem to capture the basic idea, but there is room to grow there.
9024 \begin{notate
}{Derivative articles and forking
} \label{derivative-articles-and-forking
}
9025 One obvious way to fork an article is simple -- to include it in full
9026 and then begin edits there. The ability to do this gives users quite
9027 a bit of freedom; however, it is worth noting that it can frequently
9028 be to a user's benefit to get their changes inserted in (or around)
9029 the original source, instead of placing them in a separate derivative
9030 version. (This relates to Section
\ref{philosophy
}.)
9033 \begin{notate
}{Tracking changes in parents
}
9034 Transcluding will make it so that changes to the parent are
9035 immediately reflected in the child. This is not so with inclusions;
9036 however, owners of articles that use inclusion may still want to be
9037 \emph{updated
} when the parent changes. See Section
\ref{bidi
}.
9040 \begin{notate
}{Tracking changes in children
}
9041 Nevertheless, there are certainly times when it is beneficial or
9042 expedient to create a modified version. To cater to users in this
9043 situation, we could also set up a derivative-tracking device, who's
9044 function would be to update the original author about the fate and
9045 progress of any derived versions. See Section
\ref{bidi
}.
9048 \begin{notate
}{Overviews
} \label{overviews
}
9049 It would be nice to include markup associating an overview with the
9050 section of the
document that was being overviewed.
9052 \emph{Editing (or mixing) down
} is essentially similar thing done in a
9053 different spirit. Whereas I'm imagining that the edited-down version
9054 would replace the old version, the overview would likely exist in
9055 parallel with the original.
9058 \begin{notate
}{Transclusion with modifications
}
9059 In addition to the overviews of Note
\ref{overviews
}, we could be
9060 interested in other sorts of ``transclusion with modifications''. For
9061 example, if the overview is created by transcluding only the first
9062 paragraph from every chapter, other modified versions could be created
9063 by replacing
\emph{foo
} by
\emph{bar
} everywhere.
9066 \begin{notate
}{Transclusion (typically) induces a linear structure
} \label{transclusion-induces-linear-structure
}
9067 If an article is built out of other transcluded articles, then it
9068 should be possible to abstract an
\emph{order
}, so that one can say
9069 ``next article'' or ``previous article'' and have these things make
9070 sense. But of course, this order can easily be broken, say by
9071 allowing there to be two ``next articles'' (compare
\emph{Literary
9072 Machines
}). Also note that nested transclusions (typically) induce
9076 \begin{notate
}{Transclusion-like actionable derivatives
}
9077 In order to keep the first example of a scholium given in section
9078 \ref{examples
}, ``Remark on Scholium Definition'', up to date, it
9079 would be nice not to have to keep changing the numbers that identify
9080 the the beginning and end of the region being indicated by hand. This
9081 problem could be solved by putting a scholium in place of each number
9082 that renders as the appropriate number whenever the article is
9083 rendered. A standard scholium
\inp{about
} the region in question
9084 would be maintained by reparsing (Section
\ref{parsing
}), but the
9085 actual numbers that designate the beginning and end of this region
9086 will move around. Designing the actionable scholium that would
9087 accomplish the job here will take a bit of doing.
9090 \begin{notate
}{Indivisible read-only text for collapsed labels
}
9091 Perhaps collapsed text (Note
\ref{transcluding-and-outlines
}) should
9092 have a special read-only property (alternatively, changes to such text
9093 would constitute suggested changes to the
\inp{name
} of the article
9094 that was transcluded; see Note
\ref{identification-use-case
}).
9097 \begin{notate
}{Scholia Display as transclusion
}
9098 Although it isn't technically put together that way (at least, not
9099 now), one could think of the Scholia Display as being an article that
9100 is put together by transcluding all of the scholia attached to the
9101 current main article.
9104 \begin{notate
}{Rendering deleted objects
} \label{rendering-deleted-objects
}
9105 This is a general problem that affects both rendering straightforward
9106 articles which happen to be transcluded and rendering articles with
9107 transclusions that point at articles that have been deleted.
9108 Presumably, some kind of ``
404 File not found'' error will be
9109 displayed at an appropriate point in the text.
9112 \begin{notate
}{Building transcluded articles by reparsing
}
9113 Particularly if transcluded portions of a
document are not directly
9114 editable, it might make sense to build ``text with transclusions'' by
9115 first assembling the content of a buffer containing transclusions, and
9116 then parsing the text properties. If the transcluded portions were
9117 directly editable, we could get into a somewhat tricky situation
9118 (e.g. should shearing three characters off of the end of the image of
9119 some transcluded text also change the transclusion command so that
9120 those characters are not copied over in the future? -- probably,
9121 although there are probably better ways of editing transclusion
9124 This is essentially what I've decided to do; see Note Transclusion
9125 from a design perspective.
9128 \begin{notate
}{Rendering text with derivative pieces to specific places
}
9129 Right now, text that includes transclusions is set up to only render
9130 to the ``Main Article Display'' buffer (because the
\inp{text
} field
9131 is not a buffer). We could set things up so that articles whose text
9132 contains transclusions could be associated with specific buffers where
9133 the rendered text would appear. This would require some changes to
9134 `scholia-overwhelm-display' (see Note
9135 \ref{scholia-overwhelm-display
}).
9138 \section{Saving and restoring
} \label{saving-and-restoring
}
9140 \begin{notate
}{Why saving?
}
9141 Having created several different scholia, you may wish to save your
9142 work, to read back in later, or to send to a collaborator.
9145 \begin{notate
}{Reverting
}
9146 The idea of
\emph{reverting
} to an earlier revision relates to the
9147 previous section, as well as, vaguely, to the notion of
9148 \emph{restoring
} a saved article. It isn't clear which section it
9149 should go in, since it isn't actually any of these things! It seems
9150 like a somewhat likely candidate to go into the previous section
9151 instead of this one.
9154 \begin{notate
}{Restoring and managing state
}
9155 Various details (e.g. an index counting new articles that have been
9156 added to the system) may need to be maintained between sessions.
9159 \begin{notate
}{Saving buffers to files
}
9160 When saving/quitting, articles that come from buffers may then get
9161 associated with files (assuming that the buffers end up getting saved
9162 to a file). Presumably we should
\emph{offer
} to save buffers to
9163 files; alternatively, we could save them in some internal format that
9164 the scholium system knows how to restore (reminds me of Emacs
9165 filesets; see also Note
\ref{excess-of-read-scholia-file
}).
9168 \begin{notate
}{Saving special scholia
}
9169 We should presumably offer the option of just saving only
\emph{new
}
9170 or
\emph{modified
} scholia, or those that are connected with the
9171 current buffer, or those that have a certain
\inp{type
}, etc., rather
9172 than saving the whole library. In some cases, the collection to be
9173 will presumably only be found by predicate matching; other times, we
9174 will be able to maintain an index of the subcollection to be saved
9175 (e.g. we can keep track of all the articles that have been modified
9176 since the last save).
9179 \begin{notate
}{Autosave
}
9180 We might consider making some environment variable that would cause
9181 things to be saved to disk automatically.
9185 (defun save-all-scholia (filename)
9187 (read-file-name "Filename: ")))
9188 (save-window-excursion
9190 (write-file filename)
9191 (kill-buffer (current-buffer))))
9194 \begin{notate
}{On `gather-scholia'
}
9195 It might be a good idea for this function to take an optional
9196 predicate or label, and gather only scholia that match that predicate.
9197 We could easily cause the gathering function to run only within a
9198 certain context as well.
9200 This function doesn't really have anything to do with saving,
9201 logically speaking, so perhaps it shouldn't go in this section.
9205 (defun gather-scholia ()
9207 (set-buffer (get-buffer-create "*Scholia*"))
9208 (delete-region (point-min) (point-max))
9209 (maphash (lambda (name val)
9210 (write-scholium (cons name val)))
9212 (display-buffer "*Scholia*"))
9215 \begin{notate
}{Improving the design of `write-scholium'
}
9216 One could probably make these things print a bit nicer, e.g. to make
9217 everything fit within
80 columns, but this seems to be good enough for
9222 (defun write-scholium (article)
9225 (concat "(scholium " (maybe-quoted-format (scholium-name article))
9226 nl (maybe-quoted-format (scholium-text article))
9227 nl (maybe-quoted-format (scholium-about article))
9228 nl (format "'
%S" (scholium-type article))
9229 nl (format "'
%S" (scholium-bookkeeping article))
9232 (defun maybe-quoted-format (obj)
9233 (if (and (not (null obj))
9234 (or (atom obj) (consp obj)))
9239 \begin{notate
}{Design of `read-scholia-file'
}
9240 This reads and evaluates all of the scholia that have been written out
9241 into the file stored at
\inp{filepath
}.
9245 (defun read-scholia-file (filepath)
9246 (interactive "fFile: ")
9247 (find-file-literally filepath)
9248 (read-scholia-buffer)
9249 (kill-buffer (current-buffer)))
9251 (defun read-scholia-buffer ()
9252 (while (condition-case nil
9253 (eval (read (current-buffer)))
9257 \begin{notate
}{Apparently excessive generality of `read-scholia-file'
} \label{excess-of-read-scholia-file
}
9258 This system would actually read any elisp file (er, I'm not sure it
9259 would deal well with comments). There are built-in functions that
9260 accomplish the same thing (`load-file' and `eval-buffer' come to
9261 mind). The idea here was that we might want to do something somewhat
9262 more complicated than simply evaluating the code found in the file.
9263 That may still happen.
9267 (defvar search-directory-for-scholia t)
9269 (add-hook 'find-file-hook 'search-directory-for-scholia)
9271 (defun search-directory-for-scholia ()
9272 (list-directory default-directory t)
9274 (replace-regexp-in-string "\\..*" ".sch" (buffer-file-name))))
9275 (when (search-forward sch-file nil t)
9276 (read-scholia-file sch-file)
9277 (display-scholia-about-current-buffer)))
9278 (kill-buffer "*Directory*"))
9281 \section{Distributed authorship
} \label{distributed
}
9283 \begin{notate
}{Introducing distributed authoriship
}
9284 Thus far, there has only been one author. But on a multi-user system,
9285 several different authors would be adding text to the system. It is
9286 fairly trivial to set up a system-wide list of directories to browse
9287 for articles, enabling users of a shared filesystem to co-author a
9288 digital library together. We can do something very similar when the
9289 authors are not physically co-located, by using CVS or GNU Arch to
9290 collect the contributions of the various authors.
9293 \begin{notate
}{Masters
}
9294 Do we need to have one ``master'' copy of each article in the system,
9295 or can downstream users consider the version that they downloaded to
9296 be the de-facto master copy? Probably the Arch documentation has
9297 something to say about this.
9300 \begin{notate
}{Differences between the system here and the typical diff-based model
}
9301 I'm not completely sure what the advantages of the system here will be
9302 over the typical diff- and email-based system for maintaining code.
9303 One difference is that information will be relayed using a ``pull''
9304 rather than a ``push'' model (see Note
\ref{draw
}). Other aspects of
9305 the system may simply be more convenient ways of doing things that
9306 people already do; for example, loading and unloading sets of patches.
9307 (I'm sure there is already plenty of software for doing this
9308 conveniently.) On this note, compare
9309 filesets
\footnote{{\tt http://www.nongnu.org/qualta/FilesetsDoc.html
}};
9310 contributed data coming from any given source would likely be loaded
9311 into a special subcollection.
9314 \begin{notate
}{Relationship of namespaces to distributed authorship
}
9315 One might consider reading articles from each distinct article source
9316 into its own namespace. On the other hand, it would be possible
9317 to simply tag the articles with some
\inp{bookkeeping
} information
9318 to show where they had come from. The same complexity issues arise
9319 here as in other (possible) applications of the namespace principle.
9322 \begin{notate
}{Merging articles with name conflicts
}
9323 From time to time, authors will create scholia about similar things
9324 (e.g. Emacs functions) and someone will want to merge the results. We
9325 should make it straightforward to do this. (It may be that the best
9326 way to merge is to just use namespaces and always display the articles
9330 \begin{notate
}{Scalability of search
}
9331 In general, some work will have to be done to keep search spaces
9332 fairly small, but an opt-in model for spaces to search will help with
9333 that (compare RSS). The algorithms associated with a
\emph{global
}
9334 version of this system (like Xanadu) would be pretty intensive. We'll
9335 have to think more about this if a deployed system ever gets big.
9338 \begin{notate
}{Draw
} \label{draw
}
9339 People should subscribe or not depending on their preferences. Free
9340 software, if nothing else, teaches us to
\emph{look at the demand
9343 In distributed implementations, we typically won't
\emph{send
} updates
9344 as much as make them available for pickup. We certainly could send
9345 some sort of notification saying that new content is available. On
9346 the other hand, there's no particular reason
\emph{not
} to send
9347 content directly in some implementations. (For more on the topic of
9348 making updates available, see Note
9349 \ref{send-messages-to-redirected-scholia
}.)
9352 \begin{notate
}{FAIF not FAIB, and DRM
}
9353 To think about this another way: the Xanadu system is FAIF but not
9354 FAIB. The idea was to charge people on a pay-per-view (or
9355 pay-per-use) basis, with some fraction of royalties going back to each
9356 of the authors whose work made up part of the delivered text. (It
9357 would be interesting to try to connect -- or to dissociate -- this
9358 model from current DRM ideas.)
9361 \begin{notate
}{The p2p connection
}
9362 Assembling a
document from various disparate sources in the database,
9363 reminds me of something that comes up in p2p filesharing, namely the
9364 way in which documents can be assembled from partial data drawn from
9365 various nodes. How should one go about the process of assembling the
9366 document from the sources available? We will need to think and learn
9367 more about the algorithms that would need to be employed in a system
9368 like the one described here, including its potential uses in
9369 distributed content systems.
9372 \begin{notate
}{Increasingly expensive local operations
}
9373 Assembling massive amounts of information, e.g., sorting the scholia
9374 about a given
document, is going to be somewhat computationally
9375 intense ($n
\log n$, right?). If we ever got into situations in which
9376 there were thousands of scholia about any given article, we might want
9377 to avoid doing sorting (perhaps by storing the scholia in sorted order
9378 some place or other). Also, by default, we should avoid sorting any
9379 scholia we don't need to display (e.g. frequently, actionable
9380 scholia), because sorting them is just a waste of time.
9383 \begin{notate
}{Reasons things might not bubble up too bad
}
9384 My
\emph{guess
} is that even a very popular article won't have a whole
9385 lot of printing scholia attached to it. A number of people will want
9386 to make comments, sure, but others will prefer to make derived
9387 versions, or comments on the
1st generation of comments.
9390 \begin{notate
}{Are names always available?
}
9391 I'm not sure whether an article would ever appear that had been marked
9392 up with names or namespaces that we don't have access to. Maybe.
9393 This seems more likely to be an issue in
9394 real life when we're dealing with distributed documents, but it could
9395 potentially be an issue whenever there are multiple namespaces
9396 (or even one poorly maintained namespace; compare Note
\ref{rendering-deleted-objects
} --
9397 sometimes articles will be deleted).
9400 \begin{notate
}{Accepting updated `about' information
} \label{accepting-updated-about-info
}
9401 Why would an author want to incorporate updated
\inp{about
}
9402 information into the original article? One reason is simply to check
9403 that this information is accurate. By allowing users to set updated
9404 \inp{about
} data automatically when editing a scholium's target, a
9405 degree of flexibility is built into the system that would be
9406 impossible (and, indeed, probably wouldn't make sense) otherwise.
9407 But when one's work is being interpreted in a new way, and, indeed,
9408 in a new context, it may be worthwhile to check that you agree with
9409 this interpretation.
9412 \subsection{Bidirectional updates
} \label{bidi
}
9414 \begin{notate
}{Setup for bidirectional updating
}
9415 We'll assume that one of the authors is using the scholium system, and
9416 the other isn't. (The other possible cases have either been covered
9417 or are not part of our mandate.)
9419 In order to make bidirectional updating work when some of the editing
9420 is going on outside of the scholium-based system, we would need to be
9421 able to read a stream of diffs coming from the other system and decide
9422 how to incorporate the modifications. And we also need to be able to
9423 provide them with a stream of diffs that they can use however they see
9424 fit. We'll certainly have to think more about how to do this!
9427 \begin{notate
}{Using simulation to do bidirectional updating
} \label{simulation-for-bidi
}
9428 It seems to me that the most useful approach for someone working
9429 within the scholium system and trying to do bidi updates with a
9430 non-scholium system would be to run a simulated version of the
9431 non-scholium system inside the scholium system.
9434 \begin{notate
}{The simplest case
}
9435 The simplest case of bidirectional updating is
\emph{identification
},
9436 which is treated in Section
\ref{identification
}. Even this case has
9437 some complexity to it in the distributed case; updates coming from
9438 multiple authors presumably need to be formatted into branching
9439 derivative versions. (Actually, this is an $n$-directional updating
9440 problem; Arch has had some things to say about this, but we can
9444 \subsection{Interoperability
} \label{interoperability
}
9446 \begin{notate
}{Exporting
} \label{exporting
}
9447 It should be possible to reduce metadata and so on to some format that
9448 would work with external programs (e.g. database programs). I'm not
9449 at all sure how the use of text properties would be replaced in other
9450 programs, but I think that, in theory, the things we save (Section
9451 \ref{saving-and-restoring
}) should be sufficient and readable for any
9452 other interested program. I'd be interested to know the thoughts of
9453 others on building other interfaces to the scholium system.
9456 \subsection{A simple scheme for multiuser cooperation
} \label{multiuser-cooperation
}
9458 \begin{notate
}{Crosscut by users and dates
}
9459 A simple scheme for facilitating interactions between several users is
9460 as follows. Each user gets a directory to call their own. Each users
9461 scholia for the day are stored in a file in this directory. To catch
9462 up with the activities of all users, one simply loads all of the files
9463 that have appeared since the last load date.
9465 To implement this scheme, we need a method for populating the
9466 data-store and another for scanning it to determine which files to
9469 We'll assume that only the scholia that bear a certain label (say ``to
9470 publish'') will be published, and that once they have been published,
9471 this label is wiped out (maybe it is set to ``last published''). In
9472 general, the ``to publish'' set could be determined by some somewhat
9473 complicated algorithm, not just by looking at a label.
9475 Also, we should presumably maintain all of the imported scholia in a
9476 namespace (most likely, certainly some subcollection) in order to keep
9477 them straight. (For a first draft, we could just import everything to
9478 the main article table, given that namespaces don't completely work
9481 Presumably we should start by building the infrastructure in our CVS
9482 directory. (Some more general formulation that allows collaboration
9483 between different people writing to disparate locations online would
9484 be good to have eventually; to support this we'll want some sort of
9485 protocol, maybe something like RSS.)
9488 \begin{notate
}{Networked blotters
}
9489 Keeping one another up to date on the important features of daily
9490 goings on is an important use of the multiuser system. The notion
9491 that each user would maintain some sort of ``blotter'', possibly
9492 incorporating some auto-generated content, which others can read to
9496 \begin{notate
}{Strategic usefulness of building and using collaboration tools early on
} \label{collaborate-early
}
9497 While we could ask people to work on other things first (and to some
9498 extent it will be necessary for people to work on other things all
9499 along the way) it seems likely that using powerful collaboration tools
9500 will help people get things done on other projects or subprojects.
9501 When many people can share differing views on a topic, the discussions
9502 of this topic will develop a richness that wouldn't be so likely to
9503 develop otherwise. A system that can take into account many views in
9504 a coherent and useful way is going to be a powerful system. (It would
9505 be good to do some research on the differing abilities of various
9506 extant systems to accomplish this.)
9508 Collaboration is a challenging thing to deal with. You have greenhorn
9509 or yahoo types who want to charge off and do things on their own (I'm
9510 often one of them), and in the mean time, you don't always have a
9511 central point for collaboration on some topic where you might hope one
9512 would be. It isn't always clear when you have a certain vision
9513 whether there are others out there who would share that vision or not.
9514 Partly, that's because when you have a vision it isn't always
9515 completely clear what that vision is; but these things interact.
9518 \section{Bindings and environment variables
} \label{bindings
}
9520 \begin{notate
}{Room to improve on bindings
}
9521 This is just an attempt to make something usable, but it is probably
9522 nowhere near close to optimal. One thing that would be nice would be
9523 to have some prefix for browsing relative to all scholia versus
9524 some other prefix for browsing relative to only the current scholium.
9525 Thus, you could cycle between regions for the current scholium or
9526 regions for all scholia (or go to the first region or whatever)
9527 depending on what prefix you specified -- but the final keystroke
9528 (``f'' for forward or whatever) would be the same. Perhaps we
9529 could substitute in the first register (as opposed to the second)
9530 for changing the general style of browsing (e.g. from scholia to
9531 temporal or whatever), but keep second and third pretty much the
9532 same. It would be good to spell out the analogies in a somewhat
9538 (lambda (elt) (global-set-key (eval (car elt)) (eval (cdr elt))))
9539 '((
[?
\C-\;
] . (make-keymap))
9540 (
[?
\C-\;?m
] . (make-sparse-keymap))
9541 (
[?
\C-\;?d
] . (make-sparse-keymap))
9542 (
[?
\C-\;?o
] . (make-sparse-keymap))
9543 (
[?
\C-\;?s
] . (make-sparse-keymap))
9545 ((kbd "C-; c") . 'commit-edits)
9546 ((kbd "C-; g") . 'gather-scholia)
9547 ((kbd "C-; f") . 'follow-reference-or-scholium)
9548 ((kbd "C-; n") . 'name-of-current-scholium)
9549 ((kbd "C-; r") . 'save-all-scholia)
9551 ((kbd "C-; v n") . 'back-to-normal)
9552 ((kbd "C-; v o") . 'back-to-other-view)
9554 ((kbd "C-; b b") . 'sb-back)
9555 ((kbd "C-; b f") . 'sb-forward)
9557 ((kbd "C-; l a") . 'article-menu-list-all-articles)
9558 ((kbd "C-; l l") . 'article-menu-list-labels)
9559 ((kbd "C-; l m") . 'article-menu-list-articles-matching-regexp)
9560 ((kbd "C-; l d") . 'article-menu-list-metadata-articles)
9561 ((kbd "C-; l p") . 'article-menu-list-plain-articles)
9563 ((kbd "C-; m a") . 'make-scholium-about-current-article)
9564 ((kbd "C-; m b") . 'make-scholium-about-current-buffer)
9565 ((kbd "C-; m l") . 'make-scholium-about-current-line)
9566 ((kbd "C-; m n") . 'make-new-undirected-article)
9567 ((kbd "C-; m i") . 'make-current-buffer-into-article)
9568 ((kbd "C-; m p") . 'make-scholium-about-part-of-current-article)
9570 'make-scholium-about-several-parts-of-current-article)
9571 ((kbd "C-; m s") . 'make-scholium-about-current-scholium)
9573 ((kbd "C-; d a") . 'display-article)
9574 ((kbd "C-; d b") . 'display-scholia-about-current-buffer)
9575 ((kbd "C-; d l") . 'display-article-listing)
9577 'display-an-article-that-current-article-is-about)
9579 'display-an-article-that-current-scholium-is-about)
9580 ((kbd "C-; d r") . 'redisplay-article)
9582 ((kbd "C-; o y") . 'sch-turn-main-article-overlays-on)
9583 ((kbd "C-; o n") . 'sch-turn-main-article-overlays-off)
9586 'scroll-article-display-to-next-region-for-current-scholium)
9588 'scroll-article-display-to-previous-region-for-current-scholium)
9589 ((kbd "C-; s b") . 'move-to-previous-region-with-scholium)
9590 ((kbd "C-; s f") . 'move-to-next-region-with-scholium)
9591 ((quote
[S-tab
]) . 'move-to-next-region-with-scholium)
9592 ((kbd "C-; s a") . 'move-to-first-region-for-current-scholium)))
9595 \begin{notate
}{Style of code for bindings
}
9596 I've heard that using `eval' is typically bad style,
9597 but something had to be done to make these bindings work.
9598 What would have been better in terms of coding style?
9601 \begin{notate
}{Environment variables
} \label{environment-variables
}
9602 It would be handy to be able to have things set up so that e.g. every
9603 buffer is automatically an article, too. Various innovations along
9604 these lines should be added here.
9607 \begin{notate
}{Automatically loading scholia
}
9608 Along the lines of Note
\ref{environment-variables
}, this section
9609 would be a good place to put a variable that would cause scholia to be
9610 loaded for all buffers (which I think says slightly more, or anyway
9611 something slightly different from, the statement that every buffer
9612 would automatically
\emph{be
} an article). Note that whenever loading
9613 scholia for a given buffer, there may be several different places to
9614 look to find those scholia: in the article table, but also in local
9615 ``.sch'' files, or other places.
9618 \section{Experiments
} \label{experiments
}
9620 \begin{notate
}{Experiments to try
}
9621 This section should describe our experiments modeling different CBPP
9622 systems that are out there in the world -- and coming up with new ones
9623 that we like better.
9625 In this section, we can describe some separate packages that provide
9626 more interesting or advanced display features, for example. Also
9627 maybe some packages that do things with code (e.g. interactive
9628 text-based games). Wiki portage would be one basic thing to try.
9629 Finally, of course, it would presumably be useful to get the HDM
9630 codebase into the scholium system.
9633 \item Importing a wiki and getting the scholium system set up
9634 to do wiki-like things.
9635 \item Using the scholium system to write a play, novel, screenplay, or
9636 an interactive fiction type of game (actionable scholia would
9637 probably be part of just about any game). Hipster the
9638 Gathering
\footnote{{\tt
9639 http://planetx.cc.vt.edu/AsteroidMeta/Hipster
\_the\_Gathering}}
9640 would presumably be an easy game to code up. My forays into ``fine
9641 literature'' with the Penmaster's Apprentice saga could also be
9642 typed up. These things are currently interesting examples of
9643 physical scholia (see Section
\ref{more-physical-scholia
}).
9644 \item Using the scholium system to maintain a text-based forum
9645 or set of fora, as found on PM or slashdot.
9646 \item Using the scholium system to manage an evolving codebase,
9647 e.g. HDM content, say APM and APM-$
\Xi$, or this
document itself
9648 (making the system interoperable with
\LaTeX\ would be important).
9649 \item Using the scholium system to manage TODO lists (like we used to
9651 \item Port GCIDE to Emacs and give instant access to definitions from
9652 within the browser. Make GCIDE scholiumific (supplying semantically
9653 close definitions or whatever?).
9654 \item do something like mmm-mode but using scholia about the buffer
9655 instead of begin/end regexps?
9656 \item Make a semantic network describing relationships between words
9657 and use it for writing poetry.
9658 \item make a system for exporting to other formats (see Note
9659 \ref{rendered-and-source-views
})
9660 \item Write text-generation software that will provide different ways
9661 of viewing the network's structure.
9665 \begin{notate
}{Cross-referencing in
\LaTeX} \label{cross-refs-in-latex
}
9666 Note that the system of labels and references in
\LaTeX\ allow you to
9667 make ``hypertextual'' linear documents. This system could perhaps be
9668 extended (maybe by exploiting the scholium system). It would be cool
9669 to be able to cross-reference the relevant label in some other
9670 document and have a suitable reference show up here. This is a
9671 scholium-like thing: how to make it work in
\LaTeX? (Maybe
9672 \verb|
\pmxref| should be able to refer to anything that has a
9673 \verb|
\label| about it. Perhaps this would work already.) This also
9674 relates to the topic of Namespaces, see Section
\ref{subcollections
}.
9677 \begin{notate
}{A comprehensive regression suite
}
9678 This would be a fairly simple experiment, which would nevertheless
9679 be very helpful for programming the system. Namely, create
9680 a short program that tries to do everything that you can do with
9684 \begin{notate
}{Go moves
}
9685 It would be nice to have a browsable database of Go moves and games
9686 with user annotations: presumably the already-existing Go resources
9687 online include things like this. If the scholium system can help
9688 improve upon these resources, that would be cool. For example,
9689 perhaps gnugo's move book could be simultaneously an instruction
9690 manual for human users.
9693 \begin{notate
}{Games built of scholia
}
9694 Note that the relationships of people to rooms (containment), people
9695 to their backpacks (carrying), and so forth -- the basic elements of
9696 text-based games -- are all interpretable as scholia-based. The
9697 ``fantasy'' tie-in of these sorts of games works reasonably well with
9698 the name Arxana. If we're going to push development along this route,
9699 it would be good to do some reading on MUD-like systems.
9702 \begin{notate
}{Stress testing the system
}
9703 It would probably be worth doing some empirical tests to see what
9704 happens in a library full of a bunch of junk. How long does it take
9705 to find and display the one relevant scholium? How much are things
9706 helped by storing articles in namespaces?
9709 \begin{notate
}{Scholia about functions
}
9710 This function, or something like it, seems especially important if
9711 we're going to use the scholium system to manage code. Every time we
9712 create a function, for example, it would be good to create a scholium
9713 attached to that function (perhaps a scholium object whose
\inp{name
}
9714 is the function's symbol name, though there could be the need to
9715 disambiguate between the function and variable versions of the same
9716 symbol) with a ``defined-in-buffer'' link
\inp{about
} the buffer in
9717 which the given function definition is found; Emacs already has
9718 functionality like this in its help subsystem. This could be done by
9719 explicit command or just on-the-fly by some appropriately-constructed
9722 In addition, one could create scholia that say, for instance, which
9723 functions that function calls. Then, later, one could assemble a
9724 who-calls or who-is-called listing about a given function, for the
9725 user to browse. Although this can be done easily enough already
9726 (there is a who-calls.el), it is my sense that this approach would
9727 save on search. Browsing code at the ``who calls'' level seems
9728 potentially interesting; it would be worth investigating the prior art
9732 \begin{notate
}{Barkov's ``Hamlet''
} \label{barkovs-hamlet
}
9733 The system could be used to handily create different versions of a
9734 play, e.g., to write a version of ``Hamlet'' manifesting the view that
9735 actually Horatio is the
9736 prince
\footnote{{\tt http://www.geocities.com/shakesp
\_marlowe/index.html
}} or to
9737 splice in ``Rosencrantz and Guildenstern are Dead'' by Stoppard or
9738 ``King of Shreds and Patches'' by Elrord or whatever (assuming that
9739 doing so was legally copacetic; for personal use of course it would
9740 be). Similarly, our treatment could describe theories about how the
9741 play relates to things outside the play, or (being even more meta),
9742 how the
\emph{interpretation
} of the play relates to the presentation,
9743 or (still more), where the interpretation comes from, and how I think
9744 \emph{my
} interpretation of these various things gets involved.
9747 \begin{notate
}{Using scholia on PlanetMath
}
9748 Since articles in the encyclopedia are supposed to describe known
9749 math, they aren't really the right place to describe new insights,
9750 even if these new insights occur while reading that article. (In
9751 theory such insights could be discussed in the attached forum along
9752 with basic questions or whatever; but a catch-all forum or collection
9753 of catch-all fora and postings without metadata may not be the most
9754 conducive to research-oriented work.) My thought is, why not have an
9755 attached discussion not in the encyclopedia for talking about some
9756 particular advanced question. This area can itself use encyclopedia
9757 definitions as scholia to help orient casual readers. This way,
9758 treatments of established and ``live'' mathematics can develop
9762 \begin{notate
}{Implement a web browser that works with the scholium system
} \label{nero2
}
9763 Maybe I'll write this before long? It seems like the sort of thing
9764 that could be very helpful; search through scholia on web pages you've
9765 browsed (and also download everything you browse and save it to
9766 disk, so that you can search through the web pages themselves too).
9768 Through this sort of approach, you might imagine the web (or portions
9769 thereof) being ``embedded'' in a more advanced hypertext system, at
9770 least for some users. Something similar can be done for working with
9771 Project Gutenberg
\footnote{{\tt http://www.promo.net/pg
}} or any
9772 collection of computer-readable text.
9775 \begin{notate
}{Use the scholium system to assist in literature review
} \label{literature-review
}
9776 There are a number of different literatures that are relevant to the
9777 scholium system. From artificial intelligence, we have things like KM
9778 or SNePS that are available as free software, and which can
9779 accordingly be reviewed
\emph{in their entirety
}. Or, at least in as
9780 much of their entirety as seems useful. It may be desirable to
9781 simulate or at least partially simulate these systems (which is partly
9782 what the
\emph{preliminary
} literature review is supposed to
9783 determine, by looking at the basic theory of these systems).
9785 In hypertext, there are systems like No\"osphere which can be treated
9786 similarly. Indeed, I am planning a meetup with No\"osphere's author,
9787 Aaron Krowne, for purposes of mutual exchange over and potential
9788 cross-breeding between these two systems.
9790 There are no doubt many other interesting literature things to study
9791 out there. Deciding which ones will be most profitable to look at is
9792 an interesting challenge.
9795 \begin{notate
}{Backlink tricks
} \label{backlink-tricks
}
9796 One obvious thing to do with backlinks is to compute the
9797 most-linked-to article, or, even better, to rank articles by their
9798 popularity according to in-links. This can be done by mapping a very
9799 simple function over the
\inp{metadata
} label (or the ranking could be
9800 maintained on the fly).
9803 \subsection{Some extremely simple example to show people what's going on
}
9805 \begin{notate
}{Simplest example
}
9806 It would be handy to create a very simple example of a buffer
9807 together with scholia.
9810 \begin{notate
}{Next-simplest example
}
9811 After that, it would be handy to make an example of a properly
9812 scholia-based
document (showing some richer graph structure).
9815 \begin{notate
}{Various other simple examples?
}
9816 And while we're at it, maybe later a simple example of transclusion or
9817 identification or whatever.
9820 \subsection{Use the scholium system to maintain a library of projects
} \label{library
}
9822 \begin{notate
}{Managing several projects
}
9823 We'll do several different experiments, some of which will involve
9824 corpora that are (at least essentially) distinct. One high-level
9825 object to point at the ``main pages'' of these various projects might
9826 come in handy. There could be a number of other more advanced
9827 library-like features to add later.
9830 \begin{notate
}{Managing workflow
}
9831 In addition to simply presenting output of these projects, it would be
9832 helpful to have the system set up to manage workflow (tasks and so
9833 on). For now, see
\ref{appendix-cal
}.
9836 \begin{notate
}{Library of major works
}
9837 We have an overall structure for the digital library as a whole worked
9838 out already (Section
\ref{digital-library
}), but not yet a specific
9839 list of major works. It is convenient to have an index of these (just
9840 like, later, it will be convenient to have many different indices of
9841 different kinds of documents with different features). So, we create
9842 a virtual library to index these works in. (Once this is set up
9843 properly, of course the imported version of the scholium system itself
9848 (scholium 'major-articles nil nil 'label 'system)
9851 \subsection{Use the scholium system to do literate programming
} \label{literate
}
9853 \begin{notate
}{Importing LaTeX docs
} \label{importing-latex-docs
}
9854 Note that importing a
\LaTeX\
document (this one, in particular)
9855 wouldn't be so different from importing a wiki (see Section
9858 One of the issues is how we're going to represent cross references
9859 (see Note
\ref{cross-refs-in-latex
}). In compiled
\LaTeX, they
9860 typically appear as a number, whereas in source they appear as a tag.
9861 In the scholium system, reference markup should presumably be used,
9862 and I also suppose that we may as well use the name of the article
9863 being referred to directly. So, for example, this article would
9864 be linked to by text that read ``see `Importing LaTeX docs'.''
9865 This is similar to the way references appear in Texinfo.
9867 Outside references (footnotes) could be rendered in a different
9868 color (Note
\ref{fancy-references
}), and made browsable within
9869 the scholium system (Note
\ref{nero2
}).
9871 On the implementation: `end' might be followed by a lisp expression
9872 that should be attached to the note, but this should be fun for a
9875 The format of the scholia representing the notes is kind of weird. We
9876 shouldn't have junk in the text field of the article. It would
9877 probably make more sense for items of type "note" to be rendered
9878 specially (if one wished) and maybe to store the tag as a part of a
9879 formatted text field, or, more likely, part of the
\emph{type
} data.
9881 I think I'd be relatively comfortable adding identification
9882 properties to the regions of the larger
document, to get
9883 them to inherit from the individual pieces. Later we could
9884 parse the section structure.
9886 It would, generally speaking, be a good idea if lower levels
9887 in the hierarchy were
\inp{about
} their parents in such a way
9888 that we could easily move ``up''.
9892 (add-hook 'scholia-display-post-update-hook 'text-mode)
9894 (add-to-list 'modified-type-labels '(note . note) t)
9895 (add-to-list 'modified-type-labels '(section . section) t)
9896 (add-to-list 'modified-type-labels '(subsection . subsection) t)
9897 (add-to-list 'modified-type-labels '(subsubsection . subsubsection) t)
9900 \begin{notate
}{On `map-label'
} \label{map-label
}
9901 This gives you a way to apply a
\inp{function
} to every article that
9902 bears a given
\inp{label
}.
9906 (defun map-label (function label)
9907 (mapc function (scholium-text (get-article label))))
9910 \begin{notate
}{Example of mapping across a label
} \label{mapping-across-a-subcollection
}
9911 Notice that we use `map-label' (Note
\ref{map-label
}) in the APM-$
\Xi$
9912 importing routine, to convert once-processed content to a more useful
9913 format. See Note
\ref{chunk-out-apmxi-definitions
}.
9916 \begin{notate
}{On `swap-out-latex-references'
}
9917 Does the opposite of `swap-in-latex-references' (Note
9918 \ref{swap-in-latex-references
}): that is, this
9919 function makes
\verb|
\ref| tags
9920 in the text look like hyperlinks.
9924 (defun swap-out-latex-references ()
9925 (let ((tags-alist (scholium-text (get-article
9926 'Tag-to-Name-converter))))
9927 (map-label (lambda (name)
9929 (let ((article (get-article name)))
9930 (insert (scholium-text article))
9931 (goto-char (point-min))
9932 (while (re-search-forward
9933 ;; I don't think we use "xrefs" any more.
9934 "\\\\\\(x\\)?ref
{\\(
[^
}]+\\)
}" nil t)
9936 (assoc (match-string
2)
9939 (replace-match target t t)
9940 (let ((name-of-current-article name))
9941 (make-reference-in-current-article
9943 (+ (match-beginning
0) (length target))
9945 ;; we don't want these references to be fake
9947 (buffer-substring-no-properties
9950 (scholium-about article)
9955 \begin{notate
}{On `import-scholium-system'
} \label{import-scholium-system
}
9956 For now, this is just `import-sections', but it would be good if we
9957 could do something about sections that contain neither subsections nor
9958 notes, for example, the preface. Other nice features (e.g. creating
9959 ``function type'' scholia for functions, as in Note
9960 \ref{elisp-function-type
}) should be added too, eventually. Sometimes
9961 work arounds can be applied for the time being.
9963 \emph{Hint: I've found that for now one has to `(clrhash
9964 article-table)' before running this function for things to work
9965 properly. I intend to address this issue soon.
}
9967 (We might want to make this article use some kind of identification
9968 routine; alternatively, make it work with a ``large structure'' map of
9969 the
document's contents.)
9973 (defun import-scholium-system ()
9976 ; (label-article 'section 'major-articles)
9977 (swap-out-latex-references))
9980 \begin{notate
}{Shorthand for editing the text of a scholium
}
9981 It would certainly be nice to have some short-hand
9982 from the "editing" section to make it so that we didn't
9983 have to use the `scholium' function every time we wanted
9984 to edit some article.
9987 \begin{notate
}{Autobacklink to label
} \label{autobacklink-to-label
}
9988 Also, it would be nice if the mere inclusion of ``section'' in the
9989 ``major-articles'' label meant that there would be a ``parent''
9990 (back)link from ``section'' to ``major-articles'' (see Note
9991 \ref{import-scholium-system
} for the source of this example).
9993 Such backlinks would let you navigate from things that bear a certain
9994 label to the label itself and thence to the peers within that label.
9995 (This certainly seems like a good idea!)
9998 \begin{notate
}{On `import-sections'
}
9999 For each section, import any notes and any subsections.
10001 I'm going to try to get this to import front- and back-matter (before
10002 the first section and after the last note, respectively). This will
10003 make it easier to typeset everything with one command.
10007 (defun import-sections ()
10009 (set-buffer "sbdm4cbpp.tex")
10010 (goto-char (point-min))
10011 (search-forward-regexp "^\\\
\section{Prelude
}")
10012 (goto-char (match-beginning
0))
10013 (scholium "Scholium system frontmatter"
10014 (buffer-substring-no-properties (point-min) (point))
10017 (while (re-search-forward
10019 "^\\\
\section\\*?
{\\(
[^
}\n]*\\)
}"
10020 "\\( +\\\
\label{\\)?"
10023 (let* ((name (match-string-no-properties
1))
10024 (tag (match-string-no-properties
3))
10025 (section-end (save-excursion
10026 (search-forward-regexp
10027 "^\\\
\section{.*" nil t)))
10028 (notes-end (or (save-excursion
10029 (search-forward-regexp
10030 "^\\\
\subsection{.*"
10033 (notes (let ((current-parent name))
10035 (subsections (let ((current-parent name))
10036 (import-subsections))))
10037 (when (not (equal tag ""))
10038 (scholium 'Tag-to-Name-converter
10039 (add-to-or-start-list
10040 (scholium-text (get-article
10041 'Tag-to-Name-converter))
10046 '((section parent))
10047 '(section label))))
10048 (goto-char (point-max))
10049 (search-backward-regexp "^\\\
\clearpage")
10050 (scholium "Scholium system backmatter"
10051 (buffer-substring-no-properties (point) (point-max))
10056 \begin{notate
}{On `import-subsections'
}
10057 For each subsection, import any notes and any subsubsections.
10058 notes are imported if they appear before the first subsubsection,
10059 if there is one, or before the end of the subsection, otherwise,
10060 or before the end of the section, if this is the last subsection
10064 (defun import-subsections ()
10066 (while (re-search-forward
10068 "^\\\
\subsection{\\(
[^
}\n]*\\)
}"
10069 "\\( +\\\
\label{\\)?"
10072 (let* ((name (match-string-no-properties
1))
10073 (tag (match-string-no-properties
3))
10074 (subsection-end (or (save-excursion
10075 (search-forward-regexp
10076 "^\\\
\subsection{.*"
10079 (notes-end (or (save-excursion
10080 (search-forward-regexp
10081 "^\\\
\subsubsection{.*"
10085 (notes (let ((current-parent name))
10087 (subsubsections (let ((current-parent name))
10088 (import-subsubsections))))
10089 (when (not (equal tag ""))
10090 (scholium 'Tag-to-Name-converter
10091 (add-to-or-start-list
10092 (scholium-text (get-article
10093 'Tag-to-Name-converter))
10098 `((,current-parent parent))
10099 '(subsection label))
10101 (append subsections (list name)))))
10105 \begin{notate
}{On `import-subsubsections'
}
10106 For each subsubsection, import any notes that appear before
10107 the end of the subsubsection (if this is the last subsection,
10108 then before the end of the subsection, etc.).
10112 (defun import-subsubsections ()
10113 (let (subsubsections)
10114 (while (re-search-forward
10116 "^\\\
\subsubsection{\\(
[^
}\n]*\\)
}"
10117 "\\( +\\\
\label{\\)?"
10120 (let* ((name (match-string-no-properties
1))
10121 (tag (match-string-no-properties
3))
10122 (notes-end (or (save-excursion
10123 (search-forward-regexp
10124 "^\\\
\subsubsection{.*"
10128 (notes (let ((current-parent name))
10130 (when (not (equal tag ""))
10131 (scholium 'Tag-to-Name-converter
10132 (add-to-or-start-list
10133 (scholium-text (get-article
10134 'Tag-to-Name-converter))
10138 `((,current-parent parent))
10139 `(subsubsection label))
10140 (setq subsubsections
10141 (append subsubsections (list name)))))
10145 \begin{notate
}{On `import-notes'
}
10146 This imports the notes at the current level in the
10151 (defun import-notes ()
10154 (re-search-forward (concat "\\\
\begin{notate
}"
10156 "\\( +\\\
\label{\\)?"
10159 (let* ((name (match-string-no-properties
1))
10160 (tag (match-string-no-properties
3))
10161 (beg (progn (next-line
1)
10162 (line-beginning-position)))
10163 ;; no need to bound the search for the end, because we
10164 ;; assume that every "notate" environment is actually
10166 (end (progn (search-forward-regexp
10168 (match-beginning
0))))
10169 (when (not (equal tag ""))
10170 (scholium 'Tag-to-Name-converter
10171 (add-to-or-start-list
10172 (scholium-text (get-article
10173 'Tag-to-Name-converter))
10176 (buffer-substring-no-properties beg end)
10177 `((,current-parent parent))
10180 (append notes (list name)))
10181 (import-code-continuations)))
10185 \begin{notate
}{On `import-code-continuations'
}
10186 This runs within the scope of `import-notes', to turn any Lisp chunks
10187 that follow a given Note into scholia attached to that note. (This
10188 won't import the one stand-alone ``verbatim'' environment used in the
10189 code; we could change this function, or include the environment inside
10190 of a Note. Or we could just put the literate programming code into
10191 another file. Minor issue. Also, figure environments would be left
10192 out, except for a small trick, namely including them within
10193 surrounding Notes.) Notice that previous versions of these articles
10194 shouldn't exist at import time, or Lisp sections will be doubled.
10196 The code continuations and the code descriptions wind up being
10197 mutually about one another, which is kind of cute.
10201 (defun import-code-continuations ()
10202 ;; ugly formatting = latex overrides!
10203 (while (looking-at (concat "
\n\n\\\
\b" "egin
{lisp
}"))
10204 (scholium `(code-continuation ,name)
10205 (let ((old-text (scholium-text
10207 `(code-continuation ,name))))
10208 (new-text (buffer-substring-no-properties
10209 (progn (next-line
3)
10210 (line-beginning-position))
10211 (progn (search-forward-regexp
10212 (concat "\\\
\e" "nd
{lisp
}"))
10213 (match-beginning
0)))))
10215 (concat old-text "
\n" new-text)
10217 `(((article ,name)))
10219 ;; this should add an appropriate link to the article
10220 ;; that this is a code-continuation of.
10221 (let ((article-to-edit (get-article name)))
10222 (scholium (scholium-name article-to-edit)
10223 (scholium-text article-to-edit)
10224 (add-to-or-start-list
10225 (scholium-about article-to-edit)
10226 `(code-continuation (code-continuation ,name)))
10227 (scholium-bookkeeping article-to-edit)))))
10230 \begin{notate
}{A theoretical issue with code continuations
}
10231 I like to think of the notes as being scholia
10232 attached to the code, rather than the code as scholia attached
10233 to the notes. But the way the importing routine is set up,
10234 this relationship is reversed.
10237 \begin{notate
}{Rendering code continuations
}
10238 If we know what kind of code is stored in the code continuation
10239 articles, we may want to render it in the appropriate mode. (The use
10240 of connection coloration is disruptive to this kind of display, so
10241 we'd want to use some other mechanism for showing associations, if
10242 these need to be shown. See Note
\ref{color-and-style
}.)
10245 \begin{notate
}{Identification of notes is slow
}
10246 I tried identifying each note with its source region by running
10248 (add-to-scholia-property-within-region
10251 `(identifies-with ,name))
10253 towards the end of `import-notes', but it slowed everything down.
10255 We may be able to get something similar by other means
10256 anyway (Note
\ref{alternative-to-identification
}).
10260 (defun browse-scholium-system ()
10262 (import-scholium-system)
10263 (display-article 'section)
10264 (message "You've successfully imported the system!"))
10267 \begin{notate
}{Finding all articles with code continuations
} \label{with-code
}
10268 Cf. Note
\ref{article-menu-list-articles-matching-predicate
}.
10270 (article-menu-list-articles-matching-predicate
10272 (let ((article (get-article name)))
10273 (and (member-if (lambda (link)
10274 (typedata-includes (cdr link)
10275 'code-continuation))
10276 (scholium-about article))
10277 (typedata-includes (scholium-type article)
10280 You can then run `listing-to-compilation' to get a new
document that
10281 drops all the interstitial chit chat found in this one.
10284 \begin{notate
}{Finding all articles without code continuations
} \label{without-code
}
10285 For our friends from the liberal arts,
10287 (article-menu-list-articles-matching-predicate
10289 (let ((article (get-article name)))
10290 (and (not (member-if (lambda (link)
10291 (typedata-includes (cdr link)
10292 'code-continuation))
10293 (scholium-about article)))
10294 (typedata-includes (scholium-type article)
10298 (Curiously enough, this
document currently seems pretty balanced in
10299 that the code plus immediately important documentation takes up just
10300 about the same amount of space as the philosophical musings. Well,
10301 almost as much. And of course those verbatim environments are long.)
10304 \begin{notate
}{Finding all articles with emphasized parenthetical remarks
}
10305 Cf. Note
\ref{article-menu-list-articles-matching-regexp
}. These are
10306 the articles that contain side remarks that should eventually be turned
10309 (progn (article-menu-list-articles-matching-regexp "\\\
\emph{(")
10310 (listing-to-label "Comments"))
10314 \begin{notate
}{Exporting LaTeX docs
} \label{exporting-latex-docs
}
10315 This should give an inverse to importing
10316 \LaTeX\ documents (Note
\ref{importing-latex-docs
}).
10317 Exporting in one go is a cheap alternative to live updating via
10318 identifications (Section
\ref{identification
}). Either would
10319 work, but exporting seems a little easier to get going quickly.
10320 (Incidentally, exporting is similar to producing a compilation;
10321 see Section
\ref{quick-compilations
}.)
10324 \begin{notate
}{On `export-scholium-system'
} \label{export-scholium-system
}
10325 We use a similar sort of "recursive" style to that used in the import.
10326 First, loop through the sections. These must of course be exported in
10327 their own limited fashion. Then, for each, examine the contents. The
10328 items contained in each section are either subsections or notes. If
10329 the item really is a subsection, then do something similar to what we
10330 did with sections; otherwise, it is a note and we simply export it.
10331 The items at the penultimate level are either subsubsections or notes;
10332 and finally, in the end, the items are all notes.
10334 Note that getting the ``Tag-to-Name-converter'' each time it
10335 is used in the child functions is really sort of excessive,
10336 since it could be found once in the parent. However, things seem
10337 to run fast enough.
10341 (defun export-scholium-system ()
10342 (set-buffer (get-buffer-create "*Export*"))
10344 (insert (scholium-text (get-article "Scholium system frontmatter")))
10345 (dolist (sect (scholium-text (get-article 'section)))
10346 (export-section sect)
10347 (let ((contents (scholium-text (get-article sect))))
10348 (dolist (item contents)
10349 (let ((current-item (get-article item)))
10350 (if (typedata-includes (scholium-type current-item)
10352 (export-subsection (scholium-name current-item))
10353 (export-note current-item))))))
10354 (insert (scholium-text (get-article "Scholium system backmatter"))))
10357 \begin{notate
}{Child functions
} \label{child-functions
}
10358 Notice the sort of interesting use of the words ``child'' and
10359 ``parent'' in Note
\ref{export-scholium-system
}; this is what comes
10360 of working on section listings most of the day. No reason that I can
10361 think of not to view code this way. Eventually we may want to parse
10362 Lisp functions and annotate them with hierarchies representing this
10363 sort of information.
10366 \begin{notate
}{Stable import/export
}
10367 The text, import, and export routines are all adapted to each other
10368 well enough to make it so that the text is stable under importing and
10369 subsequent exporting. We'll have to do more extensive testing to be
10370 sure that it is also behaving properly with regard to intervening
10371 editing operations, but things are currently looking pretty good in
10372 this regard. (But be careful, and back up your work!)
10375 \begin{notate
}{On `export-note'
} \label{export-note
}
10376 This is for exporting notes. When the note has a code
10377 continuation it also exports that code.
10379 To really work, this is going to have to replace references with
10380 \verb|
\refs| and
\verb|
\refs|. Hopefully we're storing the relevant
10381 information somewhere easily accessible at import time? We should at
10382 very least be able to do the opposite of what is done with
10383 `swap-out-latex-references'.
10385 We essentially need to render the article to know
10386 what the relevant references are (and where they are).
10387 This suggests to me that if we don't want to disrupt the
10388 user's experience of the rendered articles appearing in
10389 the standard display, we should be able to ``beam'' a
10390 rendering to some other buffer and then pick it up from
10391 there. Also, if some references have been generated
10392 that don't correspond to items with tags, we'll have to
10397 (defun export-note (note)
10398 (set-buffer (get-buffer "*Export*"))
10399 (let* ((name (scholium-name note))
10400 (tag (car (rassoc name (scholium-text
10402 'Tag-to-Name-converter))))))
10403 (insert "\
\begin{notate
}{" name "
}"
10405 (concat " \
\label{" tag "
}\n")
10407 (swap-in-latex-references note)
10408 "\
\end{notate
}\n\n")
10409 (dolist (scholium (mapcar (lambda (backlink)
10410 (get-article (car backlink)))
10411 (get-backlinks name)))
10412 ;; we were missing one function from a list of two in my last
10413 ;; test of exporting, should look into this.
10414 (when (typedata-includes (scholium-type scholium) 'code)
10415 (insert "\
\b" "egin
{lisp
}\n"
10416 (scholium-text scholium)
10417 "\
\e" "nd
{lisp
}\n\n")))))
10420 \begin{notate
}{On `swap-in-latex-references'
} \label{swap-in-latex-references
}
10421 Maybe it would be easier if each of the references had
10422 the name of the tag stored locally? This doesn't
10423 seem like it would actually help. The point I guess
10424 is that we don't want to detect the scholia structure
10425 all at once, but rather, zip through and make changes
10426 to each item we encounter, in order. I.e., the endpoints
10427 of the regions that we'll be modifying are always in
10430 `move-to-next-region-with-scholium' will have to be set up to
10431 return `nil' if there is no next scholium. It would also be
10432 nice if this returned the boundaries of the region to which the
10433 scholium is attached, when there is a scholium, since we're
10434 going to want to do a replacement of the text in that region.
10435 (If it proves more reasonable to use a different function for
10436 this purpose, that would be fine, but this is roughly what it
10437 should do.) Note that `move-to-next-region-with-scholium'
10438 currently works in terms of overlays, which isn't really
10441 After we find the scholia at the start and end of the marked region,
10442 we could check a complicated condition to see if there is a reference
10443 at the beginning and another copy of the same reference at the end.
10444 But for the time being we aren't going to work with this general case
10445 of overlapping references, and we'll just assume one reference per
10446 marked region and get on with things.
10450 (defun swap-in-latex-references (note)
10452 (let ((tags-alist (scholium-text (get-article
10453 'Tag-to-Name-converter))))
10454 (display-article (scholium-name note))
10455 (set-buffer (get-buffer "Main Article Display"))
10456 (let ((next-region (move-to-next-region-with-scholium)))
10458 (let ((scholium-property-at-start
10459 (get-text-property (first next-region) 'scholia))
10460 (scholium-property-at-end
10461 (get-text-property (second next-region) 'scholia)))
10462 (let* ((scholium-id (first scholium-property-at-start))
10463 (scholium-name (first scholium-id))
10464 (possible-reference (get-article scholium-name)))
10465 (when (typedata-includes
10466 (scholium-type possible-reference)
10468 (let ((scholium-tag
10469 (car (rassoc (reference-to-article
10470 possible-reference)
10473 (progn (delete-region (first next-region)
10474 (second next-region))
10475 (goto-char (first next-region))
10476 (insert "\
\ref{" scholium-tag "
}"))
10477 (let ((new-tag (replace-regexp-in-string
10479 (buffer-substring-no-properties
10480 (first next-region)
10481 (second next-region)))))
10482 (delete-region (first next-region)
10483 (second next-region))
10484 (goto-char (first next-region))
10485 (insert "\
\ref{" new-tag "
}"))))))
10486 (setq next-region (move-to-next-region-with-scholium)))))
10487 (buffer-substring-no-properties (point-min)
10490 (defun export-section (section-name)
10491 (set-buffer (get-buffer "*Export*"))
10492 (let* ((tag (car (rassoc section-name (scholium-text
10494 'Tag-to-Name-converter))))))
10495 (insert "\
\section{" section-name "
}"
10497 (concat " \
\label{" tag "
}\n\n")
10500 (defun export-subsection (subsection-name)
10501 (set-buffer (get-buffer "*Export*"))
10502 (let* ((tag (car (rassoc subsection-name (scholium-text
10504 'Tag-to-Name-converter))))))
10505 (insert "\
\subsection{" subsection-name "
}"
10507 (concat " \
\label{" tag "
}\n\n")
10509 (let ((contents (scholium-text current-item)))
10510 (dolist (item contents)
10511 (let ((current-item (get-article item)))
10512 (if (typedata-includes (scholium-type current-item)
10514 (export-subsubsection (scholium-name current-item))
10515 (export-note current-item))))))
10517 (defun export-subsubsection (subsubsection-name)
10518 (set-buffer (get-buffer "*Export*"))
10519 (let* ((tag (car (rassoc subsubsection-name (scholium-text
10521 'Tag-to-Name-converter))))))
10522 (insert "\
\subsubsection{" subsubsection-name "
}"
10524 (concat " \
\label{" tag "
}\n\n")
10526 (let ((contents (scholium-text current-item)))
10528 (dolist (item contents)
10529 (let ((current-item (get-article item)))
10530 (export-note current-item)))))
10533 \begin{notate
}{Name conflicts
}
10534 As we talked about vis a vis namespaces (Note
10535 \ref{labels-and-namespaces
}), it would be nice if
10536 we could deal with multiple different things having
10537 the same name, say a Section and a Note, or two
10538 Notes in different sections. A disambiguation page
10539 could be created whenever the ambiguity needed to be
10543 \begin{notate
}{Revise to support ``function'' type articles
} \label{elisp-function-type
}
10544 Instead of referring to Notes that describe functions, sometimes
10545 we may prefer to refer to ``function'' articles, which will
10546 include the function and the note that describes it.
10549 \begin{notate
}{Group functions sharing scope
}
10550 Objects with type functions could have ``runs
10551 within the scope of this function'' slots. This would facilitate
10552 propagating changes in notation.
10555 \begin{notate
}{Other features for function articles
}
10556 As top-level objects, functions could be fitted
10557 out with their own fora and FAQ's. They could be
10558 displayed with the appropriate mode turned on
10561 A short
document containing only the functions that
10562 one had been working on recently could be created easily;
10563 see Note
\ref{making-a-compilation
} and Note
\ref{recent-referents
}.
10566 \subsection{On-the-fly scholium creation
} \label{otf
}
10568 \begin{notate
}{Why on-the-fly?
}
10569 This section is about creating scholia automatically. For example,
10570 every time I type ``scholium system'', maybe something happens -- for
10571 instance, maybe the text gets marked up with a reference to some other
10572 object describing the scholium system. This is sort of like what
10573 happens in No\"osphere, though there, auto-linking happens when the
10574 document is rendered.
10576 Another similar thing is the auto-indexing feature present in Apple
10577 Computer, Inc.'s latest OS, wherein content is automatically indexed
10578 as it is being created. We could do something fairly similar with the
10579 scholium system (and some of this indexed information could be shared
10580 with other collaborators whenever there are multiple people using the
10581 scholium system together).
10583 Another example use would be to display interesting feedback about
10584 things you had just typed -- maybe related definitions or phrases,
10585 or some other cool stuff. Doing this on an automatic on the fly
10586 basis is a minor simplification (from the user's point of view)
10587 over doing it only when the user issues an explicit command.
10589 Obviously you don't want to search every editspace. For example,
10590 displaying a
\emph{definition
} as a scholium means that you would
10591 probably just want to search the dictionary namespace. This is
10592 \emph{not
} the same as creating a scholium, indeed, the dictionary may
10593 not ``really'' contain scholia at all; you can use the structure of
10594 the dictionary to easily retrieve information that you would like to
10595 superimpose on the current
document. (This is a somewhat traditional
10596 sounding digital libraries sort of thing.)
10599 \begin{notate
}{Compare flyspell
}
10600 Some good ideas might be available in the flyspell package for Emacs.
10603 \begin{notate
}{Automatically adding files to the article list
}
10604 We can also set things up so that visited files are added to the
10605 article list automatically, etc.
10608 \begin{notate
}{Lexical autolinking
}
10609 One major application of this system would be to create
10610 No\"osphere-like autolinking. Thus, part of this ``experiment'' is to
10611 reimplement autolinking in this model. Note, that once you have
10612 implemented linking within the model, then autolinking should probably
10613 be ``easy'' to add by reimplementing the No\"osphere algorithm. One
10614 advantage of doing things this way is that links appear at edit time
10615 rather than render time (presumably anyway), which means that they can
10616 be tinkered with right away as needed.
10618 I wonder if the autolinker could be used to make an index of terms
10619 automatically, too? Seems likely.
10622 \subsection{Simulating a wiki with the scholium system
} \label{wiki
}
10624 \begin{notate
}{Build scholia by first adding markup and then parsing
}
10625 The idea in this section is to assemble a collection of scholia that
10626 simulate the page-reference markup found in a wiki. The strategy we
10627 use is to read the wiki page and add
\emph{text properties
} to the
10628 ``alt text'' indicating the link targets. We then parse the buffer
10629 and create scholia about the regions that bear text properties. The
10630 reason for going through this two-step process is that the position of
10631 text in the buffer will be shifting around as we get rid of wiki
10632 markup, so it is convenient to add scholium system markup in a format
10633 that in invariant under such shifting. To the extent that we need to
10634 specify
\inp{type
} data, we overload the
\inp{name
} data that we use
10635 for initial markup. For example, ``(external-page <page-name>
10636 <URL>)'' is the format we'd choose as the
\inp{name
} of scholia
10637 representing references to external pages.
10640 \begin{notate
}{On `mark-up-wiki-with-reference-scholia'
}
10641 Find things in double brackets, possibly with an intervening ``|'',
10642 making sure to find the minimal double bracket pair. What
10643 \emph{should
} happen (though the current draft is a bit different) is:
10644 a reference scholium should be created for each reference, and stuck into the
10645 article list in some appropriate place (presumably the namespace
10646 associated with the article in question, more specifically, on some
10647 specific reference subspace of that space).
\emph{Then
} when someone goes
10648 to render the
document in question, we grab the references out of their
10649 storage facility and mark up the
document with text properties.
10650 (The current implementation is really just a regexp check...)
10654 (defun mark-up-wiki-with-reference-scholia ()
10656 (goto-char (point-min))
10657 (while (re-search-forward
10658 ;; we could probably get all types of reference in
10659 ;; one regexp. I'm not sure why the old
10660 ;; version for grabbing external references was deleted,
10661 ;; but it is featured in the Sept
4 printout.
10662 "\\
[\\
[\\(
[^
]|
\n]+\\)\\(|\\)?\\(
[^
]]+?\\)?
]]" nil t)
10663 (replace-match (propertize (or (match-string
3)
10669 \begin{notate
}{Recent changes and recent referents
} \label{recent-referents
}
10670 It would be handy to have some code that would list the articles that
10671 have had new scholia written about them. This would help a user (e.g.
10672 the author of the articles under discussion) see what people are
10673 talking about. Some additional semantics could be provided, to list
10674 recent modified versions, which are similar to
document changes, but
10675 arguably more relevant in a system with object ownership. Actual
10676 changes should be listed too.
10679 \begin{notate
}{Handling references
}
10680 (
1) Do special markup;
10681 (
2) What is the format of a reference precisely?;
10682 (
3) Do they have backlinks?;
10683 (
4) Notice that they will probably need to have a special markup
10684 property associated with them (instead of the typical `scholia'
10686 (
5) Note that we might want to record all the references associated with
10687 a given buffer on its metadata article, as well as on the full list
10688 of articles and a `reference' label (unless we were to just make a reference
10692 \begin{notate
}{Strikethrough
}
10693 One of the most important things you can do with a wiki
10694 is to delete things that other people have written.
10695 Showing ``deletion'' as a sort of scholium would be
10696 a handy feature for a wiki modeling experiment.
10699 \begin{notate
}{Delete/insert patches
}
10700 Note that patches that delete or insert changes are something like
10701 ``quoted'' changes to files; i.e., as opposed to the ``direct''
10702 changes that occur when editing.
10705 \subsection{Using the scholium system to do AI stuff
} \label{AI-stuff
}
10707 \begin{notate
}{Take an example from a known system
}
10708 It would be a good idea to find at least one example from a ``standard
10709 AI'' system (KM's chemistry-problem solving, for example) and import
10710 and otherwise emulate it in the system here. We'll have to look
10711 around for a good example.
10714 \subsection{Using the scholium system for HDM things
} \label{HDM-things
}
10716 \begin{notate
}{What is HDM and how does it relate to the scholium system?
}
10717 The HDM (expanded: Hyperreal Dictionary of Mathematics) project is
10718 about
\emph{taking the world's mathematical knowledge, and getting it
10719 into a format that is as useful as possible.
}
10721 The key point to make here is that HDM will be a free culture artifact
10722 containing lots and lots of mathematical information (definitions,
10723 theorems, proofs, expositions, examples, and excursions, etc.) that
10724 will need to be organized for use by both individual humans and
10725 networks of machines. The scholium system is part of the HDM project
10726 because of these organizational needs --
\emph{and
} (in particular) it
10727 is being designed in such a way that it should be able to satisfy the
10728 ``AI needs'' of the project.
10730 The revolution will be computerized -- and it will be total.
10733 \begin{notate
}{Application of the scholium principle for HDM
}
10734 We should talk about encoding different types of objects in the system
10735 and showing their relationships using typed links; also about
10736 assembling reports via transclusion, and so on and so forth. We
10737 should also show how this system can be used as a stand-in for more
10738 ``traditional'' KRR systems (SNePs, KM), and how reasoning modules can
10739 be implemented for the system. But this is pretty advanced stuff, and
10740 it is going to be a little while until we get to it.
10742 In the mean time, we have various fun things (a little music and even
10743 less Go), and we can think about the relationships to Dirk Gently and
10744 so on and so forth.
10747 \begin{notate
}{Template utilities as an example
}
10748 Ray was working on a set of template utilities that could be encoded
10749 as a scholium-based
document.
10752 \begin{notate
}{Overview of Arxana as an example
}
10753 It might be nice to create a simplified version of the current
10754 document that would deal with the core functions and ideas only. This
10755 would presumably help people learn how to work with the system.
10758 \subsubsection{Managing the contents of a mathematical dictionary
}
10760 \begin{notate
}{Importing the APM-$Xi$
}
10761 See
\ref{import-apmxi
} (currently the main function in this section,
10762 although we may come up with some additional functions later on).
10763 Actually, we should probably also import the APM, however, I'm not
10764 completely sure I can get copyright waivers for the APM's content. I
10765 hope so; I should investigate that. If I can get written permission,
10766 then I suppose we should put APM into the HDM's archive along with
10770 \begin{notate
}{Large-scale structure of APM and APM-$
\Xi$
}
10771 We have some words and phrases. These phrases come up in the APM in
10772 various places. Each phrase has a list of problems that it is
10773 associated with. It also has a list of definitions that it is
10774 associated with. For APM, we would want the relevant definitions to
10775 appear as attached scholia. For APM-$
\Xi$, we presumably want a
10776 namespace for each phrase, into which we put each of the definitions
10777 as its own article, together with the specially-designated list of
10778 associated problems. Here it seems like we have the opportunity to
10779 use links with different types. (Maybe we would just attach the list
10780 of associated problems to the namespace as a whole.) To parse the
10781 document this far, the first thing to do is to break it into sections,
10782 then parse each of these sections into lists of problems.
10785 \begin{notate
}{Types for the APM-$
\Xi$
}
10786 We keep track of the sections, entries, and stubs that belong to
10787 APM-$
\Xi$ as special types.
10791 (add-to-list 'modified-type-labels '(apmxi-section . apmxi-section) t)
10792 (add-to-list 'modified-type-labels '(apmxi-entry . apmxi-entry) t)
10793 (add-to-list 'modified-type-labels '(apmxi-stub . apmxi-stub) t)
10796 \begin{notate
}{On `make-apmxi-sections-into-articles'
}
10797 This function makes every section in the APM-$
\Xi$ into its own
10798 article. The list of these articles is recorded on the article
10803 (defun make-apmxi-sections-into-articles ()
10804 (save-window-excursion
10805 (find-file "../p2/Xi.tex")
10806 (goto-char (point-min))
10807 (while (re-search-forward "^\\\
\section{{ \\(.+\\)
}} " nil t)
10808 (let ((article-name (match-string-no-properties
1))
10810 (end (save-excursion (search-forward "\
\section" nil t)
10811 (match-beginning
0))))
10813 (scholium article-name
10814 (buffer-substring-no-properties beg end)
10816 'apmxi-section))))))
10819 \begin{notate
}{On `chunk-out-apmxi-definitions'
} \label{chunk-out-apmxi-definitions
}
10820 Apparently some of the terms in APM-$
\Xi$ were defined in multiple
10821 sections. At least,
\emph{stubs
} appear in multiple places. This
10822 should presumably create multiple definitions when multiple
10823 definitions are given, or get rid of stub-like definitions, or
10826 Note that the way this is set up, even sections that contain only
10827 stubs can also contain references to the real articles, when they
10828 exist -- this means that the real articles may appear in several
10829 listings, which I think is as it should be.
10833 (defun chunk-out-apmxi-definitions ()
10834 (map-label (lambda (name)
10836 ;; this ensures that sexps are defined properly
10838 (let ((topic (get-article name))
10840 (insert (scholium-text topic))
10841 (goto-char (point-min))
10842 (while (re-search-forward "^(" nil t)
10843 (let* ((beg (match-beginning
0))
10844 (title-beg (match-end
0))
10845 (title-end (progn (goto-char beg)
10848 (stub-p (looking-at " *$"))
10849 (title (buffer-substring-no-properties
10852 (end (save-excursion
10853 (search-forward-regexp "^$")))
10854 (possible-previous (get-article title)))
10855 (when (or (not possible-previous)
10856 (typedata-includes (scholium-type
10860 (buffer-substring-no-properties
10865 '(apmxi-stub apmxi-entry)
10867 (setq contents (cons title contents))))
10871 '(apmxi-section label)))))
10875 \begin{notate
}{On `import-apmxi'
} \label{import-apmxi
}
10876 This function puts into play all of the other functions developed
10877 above, to fully process the APM-$
\Xi$ and get it nicely situated in
10878 the scholium system.
10882 (defun import-apmxi ()
10883 (make-apmxi-sections-into-articles)
10884 (chunk-out-apmxi-definitions))
10887 \begin{notate
}{Special reference types
} \label{special-reference-types
}
10888 In the mathematics domain, would be handy to have ``related to'',
10889 ``depends on'', ``proof of'' and ``prerequisite for understanding''
10890 reference sub-types. It is easy enough to create a subtype -- just
10891 add the secondary category to the
\inp{type
} variable along with the
10892 ``reference'' datum. Special types of references are one of the key
10893 semantic network-like features of the scholium system (see also Note
10894 \ref{type-creation
}). Maybe the reference-creating facility should
10895 provide an optional second argument for specifying reference sub-type.
10898 \begin{notate
}{Selecting all APM-$
\Xi$ stubs
}
10899 If you want to look at a list of all stubs in the APM-$
\Xi$, run this code:
10901 (article-menu-list-articles-matching-predicate
10903 (when (typedata-includes (scholium-type (get-article name))
10907 (See Note
\ref{article-menu-list-articles-matching-predicate
}.)
10910 \begin{notate
}{Screening out APM-$
\Xi$ stubs
} \label{apmxi-stub-processing
}
10911 If you want to screen
\emph{out
} the stubs in the APM-$
\Xi$, run
10913 (display-difference-of-labels 'apmxi-entry 'apmxi-stub)
10915 (see Note
\ref{display-difference-of-labels
}). Of course,
10916 eventually we're going to want to do some more processing
10917 to make the stubs into useful things.
10920 \subsubsection{Facilitate collaboration between HDM authors
}
10922 \begin{notate
}{Use a simple scheme
}
10923 The collaboration scheme is described in Section
10924 \ref{multiuser-cooperation
}. I might try to make that version
10925 ``general'' and in this section implement some ``specifics''.
10928 \subsection{Model a physical space and its contents
} \label{space-model
}
10929 \begin{notate
}{Holtzermann Kitchen Companion
}
10930 I've been thinking that it would be handy to have a full inventory
10931 of the kitchen I share. The inventory, or model, really, could be
10932 shared with the kitchen-mates and it could help us remember where
10933 things go and what needs to happen around the place. More generally,
10934 the idea would be: to help improve communication about goings on in
10938 \begin{notate
}{Typelock
} \label{typelock
}
10939 In order to talk about the contents of cupboards versus the
10940 refrigerator, for example, the user should be able to specify
10941 a bunch of `(contains A B)' relationships. Both `contains'
10942 and `A' will stay fixed for reasonably long periods of time.
10944 In addition, probably everything that is created in this experiment
10945 should have a
{\tt kitchen-element
} type (and label). Thus,
10946 we want some sort of typelock at the level of object creation
10947 and link creation. (Indeed, we could probably set things
10948 up so that the links didn't need to be specially-typed, but
10949 rather were just part of some specially-typed scholia.)
10951 A sort of segue away from the main topic: it could be handy
10952 to optionally display all of the `contains' items using the listing
10953 mechanism instead of the standard scholia display.
10956 \begin{notate
}{Case for namespaces
}
10957 % Let it not be said that this document contains everything but the
10958 % kitchen sink. Here is the sink.
10959 Both the sink cabinet and the doorless cupboard contain a ``drawerful
10960 of assorted utensils''. Of course, these aren't
\emph{the same
}
10961 drawers (nor are they the same utensils). We find the same sort of
10962 thing in earlier imports of the scholium system, in which several
10963 sections had ``Further notes'' subsections. As a work-around, all of
10964 these were given distinct names, but subsequently, especially when
10965 working with complexes of formulaic scholia (Note
\ref{formulaic
}),
10966 that behavior wouldn't be desirable.
10969 \subsection{Make more physical scholia
} \label{more-physical-scholia
}
10971 \begin{notate
}{Extended rendering
}
10972 The scholium-based
document idea can be extended outside of the
10973 computer. The examples that are produced this way can help illuminate
10974 and inspire out work. See Note
\ref{physical-scholium-system
}.
10977 \begin{notate
}{Math paper as gallery tour
} \label{math-paper-as-gallery-tour
}
10978 We could put pictures from a math paper on the walls of a gallery,
10979 with the space divided up in such a way as to have each wing
10980 correspond to a section of the paper.
10983 \begin{notate
}{Scholia on architectural space
}
10984 A generalization of Note
\ref{math-paper-as-gallery-tour
} is to put
10985 together spaces that incorporate scholia into their surfaces
10986 (graffiti, chalkboards), or into their basic design. Memory spaces
10987 (mnemonic architectures) are spaces with double (or more) meanings,
10988 i.e., multiple sets of scholia on the same space.
10991 \begin{notate
}{The HPDA
}
10992 This is a somewhat famous example (among a certain geek crowd) example
10993 of a scholium-based
document system. I invented a game that goes
10997 \begin{notate
}{Printing things out
}
10998 Questions as to the impact and relevance of putting things on paper
11002 \begin{notate
}{Node-based systems
}
11003 Systems like freemind
\footnote{{\tt
11004 https://sourceforge.net/projects/freemind
}} aren't exactly
11005 ``physical'' in the sense of something you can handle, but they
11006 provide a different sort of view into a
document, and views are
11007 physical things. (It seems to that freemind itself only provides
11008 hierarchical views, which isn't particularly pleasant for us. I know
11009 that the KM people had a tool that looked good for more complicated
11010 views, but I'm also pretty sure they didn't want to release this tool
11011 to the public.) Some sort of nice graphical tool could be used to
11012 make a schematic of the scholium system that people might find useful.
11015 \begin{notate
}{Outline management
}
11016 In Table
\ref{scheme-for-outline-managemnent
}, we illustrate
11017 line-numbers
1--
5 at left, items a--e at right, together with labels
11018 $
\alpha$--$
\epsilon$. We envision this outline changing over time,
11019 and references such as
\verb|
\itemref{|$
\alpha$
\verb|
}| consistently
11020 producing the correct line number. I think
\LaTeX\ can already handle
11021 this sort of thing, I just forget how you do it.
11024 \begin{tabular
}{ll
}
11025 1 & a ($
\alpha$) \\
11026 2 &
\quad b ($
\beta$) \\
11027 3 & c ($
\gamma$) \\
11028 4 &
\quad d ($
\delta$) \\
11029 5 &
\quad \quad e ($
\epsilon$)
11032 \caption{A scheme for outline management
\label{scheme-for-outline-managemnent
}}
11036 \begin{notate
}{Offline usefulness
} \label{online-usefulness
}
11037 Printed documents are only useful offline; the question as to whether
11038 they are more useful offline than a non-networked computer remains.
11039 Sometimes they will have a certain pragmatic edge, e.g., they allow
11040 one to avoid lugging the computer from place to place. On the other
11041 hand, one typically then must type up one's handwritten comments.
11043 (The problem of integrating interesting documents into Arxana is
11044 present whether or not these documents are physical.)
11047 \begin{notate
}{Getting jobs done in different ways
}
11048 Many of the things we talk about in Arxana (and in the HDM project in
11049 general) have to do with finding new ways to get jobs done which we
11050 already can get done in some other way. The hope is that the new ways
11051 of working will allow us to be more efficient or have more fun or that
11052 they will otherwise be beneficial. (It isn't completely clear that
11053 you really do get the same job done if you do it in a different way.)
11056 \section{Philosophy of the scholium system
} \label{philosophy
}
11058 \begin{notate
}{Code
} \label{code
}
11059 The concerns mentioned in Note
\ref{the-philosophy
} are closely
11060 related to the questions and ideas of ``Code and Other Laws of
11061 Cyberspace''
\footnote{{\tt http://codebook.jot.com/WikiHome
}}.
11062 Cf. Note
\ref{consistency-why
}.
11064 I'd be interested to know whether pass-by-reference as a basis for
11065 document exchange doesn't provide a final solution to the copyright
11066 problem. OK, almost final; you still need some high-tech system for
11067 managing the references and finally retrieving and operating on
11071 \begin{notate
}{An observation
} \label{observation-on-cyberspace
}
11072 There is a lot of room in cyberspace.
11075 \begin{notate
}{Definitions of freedom
}
11076 In Note
\ref{inspirations
}, I talk about the importance of user
11077 freedom. I should go into this more. For now, I'll just say that for
11078 me ``user freedom'' in some sense includes the notion of ``user
11079 convenience.'' Why? Because what is
\emph{freedom to do
} if it
11080 doesn't go along with actual
\emph{ability to do
}?
\emph{Empty!
} I
11081 call the basic notion at work here the ``liberties model of freedom.''
11082 (With all due apologies to The Dead Kennedys.)
11084 (Note that the guaranteed freedom to do something that one might
11085 potentially be able to do at some point but can't do just now isn't
11086 empty, it's more like ``half full''.)
11089 \begin{notate
}{``Free culture'' is ambiguous
} \label{free-culture
}
11090 We should be careful when using this term to make sure it is really
11091 defined properly, something I don't think anyone really has done yet.
11092 I'm not really cool with using terms that aren't defined. But then I
11093 get caught up using the term. So, I'm not sure. I'm guessing that
11094 there is a false dichotomy here similar to the dichotomy between
11095 ``text'' and ``hypertext'' -- in other words, something that could
11096 perhaps be formalized, but which as yet hasn't been (see Note
11097 \ref{hyperstuff
}). My sense is that ``free culture'' may be as
11098 ambiguously overloaded a term as ``intellectual property'' (just for
11099 example). And yet, freedom seems to be an important part of a useful
11100 system. We proceed with caution.
11103 \begin{notate
}{``All information is superimposed.''
}
11104 Statements are superimposed on an author's perceptions and inner life.
11105 Perceptions are superimposed on the base data of experience (and are a
11106 part of this data). Everything we identify as ``information'' is
11110 \begin{notate
}{What, then is at the bottom?
}
11111 Is there a bottom, a ``real'' reality, even if it is an
11112 extra-informational one? Or is reality as we know it a mutually
11113 agreed-upon set of mutually-referential superimposed bits? (And for
11114 that matter, is there a top, and what would
\emph{that
} look like?)
11117 \begin{notate
}{A possible interpretation of physical scholium systems
}
11118 The physical systems of Section
\ref{more-physical-scholia
} and
11119 elsewhere show that physical systems can ``do'' simulation. Compare
11120 also Alan Moore's ``Supreme'', a fictional character who is somewhat
11121 aware of the effects of being as such, although not
\emph{quite
} to
11122 the point of being fully cognizant of the fact that he is fictional.
11123 Physical scholium systems are only partially aware of their
11124 computational possibilities (and, mutatis mutandi, computational
11125 systems don't always fully take into account their physical
11126 manifestations, whether concrete or only barely imaginable).
11129 \begin{notate
}{Making things easier to learn
}
11130 If subject matter to be learned is embedded in a scholium system,
11131 questions and answers that people have asked already would tend to be
11132 easily accessible and clearly organized. It would also be easy to ask
11133 new questions in the context in which the right people will take
11137 \begin{notate
}{The extensions of man
}
11138 What are the things you can do in a given medium? What can you point
11139 at (indicate)? What sorts of gestures can you make? See Note
11140 \ref{human-and-artificial-intelligence
}.
11143 \begin{notate
}{Designing a free code market
}
11144 A ``consortium'' of free software supporting companies would be
11145 similar to the scholium model of business and relates to FSB. It is
11146 important to know what is in demand and what the supply and costs are.
11149 \begin{notate
}{Scholia in ``The star's my destination''
}
11150 The modifications to the main character's teeth are an example of
11151 actionable scholia. The tattoos are another obvious example, adding
11152 art on top of skin. This makes me think that perhaps the issue of
11153 scholia also comes up in the book by Dumas that this one draws so
11154 heavily upon. The SF book might also be considered to be a sort of
11155 scholium attached to Dumas's ``The Count of Monty Cristo'' (cf. Note
11156 \ref{barkovs-hamlet
}).
11159 \begin{notate
}{Anthropogenic change
}
11160 Changes effected by humans upon the world might be considered to be
11161 scholia. Changes effected upon ourselves (whether skin-deep or
11162 destiny-changing) could be as well. But this vision of anthropogenic
11163 change is also somewhat
\emph{anthrocentric
}. Humans are just part of
11164 a much broader world. Our ``will'' and ``agency'' are brought into
11165 question in the context in which ``everything is connected.''
11166 (Compare ``Les Enfants Terrible'' on that one.)
11169 \begin{notate
}{Document closure
} \label{closure
}
11170 Wittgenstein said that the world is all that is the case. Baudrillard
11171 said that the world is that which can't be exchanged for anything
11172 else. A
document that contains references to things outside of itself
11173 is really an article in a larger
document.
11176 \begin{notate
}{When is a
document finished?
}
11177 The question as to what needs to go into a
document before the
11178 document is finished has probably been thought about by many authors
11179 and editors in the past. Some things are bound to be off topic,
11180 whereas other things are bound to be completely critical. Some things
11181 are of only peripheral importance.
11184 \begin{notate
}{Different kinds of documents
}
11185 Different kinds of documents correspond to different sorts of context
11186 -- spatial, temporal, ideational, etc. (see Note
\ref{context
}).
11187 Note
\ref{container
}, Note
\ref{thread
}, Note
\ref{process
}, and
11188 Note
\ref{collection
} talk about several different kinds of
11189 documents. See also Note
\ref{displaying-nearby-scholia
} for some
11190 further words about different kinds of context.
11193 \begin{notate
}{Document as container
} \label{container
}
11194 Each
document or article contains statements. Sometimes these
11195 statements can be bonafide objects, for example, each section in this
11196 document contains Notes and certain other objects. ``Frames'' and
11197 ``ontologies'' fall into this category (and presumably so does the
11198 notion of ``category''). This model seems particularly well-adapted
11199 to the notion of transclusion (and vice versa), and to the idea of a
11200 document as the expansion of an outline. Comments about the
document
11201 as a whole should apply to the containing object (so that in some
11202 cases, comments about the
document as a whole come from within, i.e.,
11203 comments need to be contained somewhere; see Note
\ref{closure
}). If
11204 we set the current
document up in the scholium system on public
11205 display (and for public comment), we would probably want to have a
11206 special place for general comments about the article. This relates to
11207 the issue of namespaces and labels (Note
11208 \ref{labels-and-namespaces
}).
11211 \begin{notate
}{Document as thread
} \label{thread
}
11212 Sometimes a
document takes you along a linear path through a more
11213 complicated space (see Note
11214 \ref{transclusion-induces-linear-structure
} for a description of one
11215 way this can work). Frequently authors don't know where their writing
11216 is going when they start. Franz Kafka and Stephen King are notable
11217 proponents of this style of writing, which is almost the antithesis of
11218 writing from an outline. Whether stitching a specific pattern or
11219 exploring a strange labyrinth, the writer's experience has several
11220 threadlike qualities. When there are many authors, then the metaphor
11221 is more obviously one of weaving many threads. Of course, individual
11222 threads and an overall threadlike quality writing only appear under
11223 certain circumstances. (I wonder what Dijkstra said about writing.
11224 One thing I know is that his thought about writing proofs was that
11225 each step should be made clear; the reader shouldn't be left
11229 \begin{notate
}{Document as process
} \label{process
}
11230 The view advanced in Note
\ref{thread
} admits, but does not
11231 necessarily imply, the view of the
document as a
\emph{process
}. A
11232 thread or body of woven threads could exist outside of the process
11233 proper; in this model, the author might follow the thread along to its
11234 conclusion (like a detective ``unraveling'' a mystery). It seems
11235 apparent that a
document, whether it is written by one or many authors
11236 is a process, at least until it is ``finished''. Even then, though
11237 the central text becomes fixed, the body of peripheral texts continues
11238 to grow, as the central text is reinterpreted in new contexts.
11240 In order to evolve, documents typically need to interact with the
11241 world somehow. The schedule of interactions could be arbitrary, but
11242 when humans are involved some sort of phasic structure is often
11243 involved too. Laying down the law with some sort of schedule for work
11244 on this
document might be something I could make myself do (whether or
11245 not keeping the schedule is also is not yet decided, and could be
11246 interesting to
document either way). Personal schedules and
11247 organizational schedules are related. I really don't know what to do
11248 (when things grind to a halt, but I assume it would be a good idea to
11252 \begin{notate
}{Document as collection
} \label{collection
}
11253 Maybe the evolution of the desktop that we hear so much about (or the
11254 evolution of email, a la Gmail) is going to carry over to documents as
11255 well. Instead of being organized into sections, documents could just
11256 be miscellaneous collections of notes, which then take on certain
11257 organization through search (or maybe some fancy self-organizing
11258 phenomena) as needed.
11261 \begin{notate
}{Document as ontology
} \label{ontology
}
11262 Documents typically come in an outline-oriented fashion. The idea of
11263 ``
document as ontology'' just expands on the idea of ``
document as
11264 container'' and posits some nested containers. I'm not actually sure
11265 what the difference between an ``ontology'' and a set of nested sets
11266 is; my sense is that ontologies will typically also specify
11267 interrelationships beyond just ``is-a''. It would be worth looking
11271 \begin{notate
}{Document as simulasm
} \label{simulasm
}
11272 Eventually when one has abstracted out the author a
document takes on
11273 the appearance of an agentless simulation.
11276 \begin{notate
}{Unlimited refactoring
}
11277 The system seems to go one level beyond ``refactoring'' to something
11278 more like ``multiple on-the-fly as-needed refactoring.'' Code will
11279 take whatever shape you put it in temporarily; however, these shapes
11280 can also be saved. Maybe this is what refactoring is already about in
11281 sophisticated systems (on a wiki it means something much weaker).
11282 This would be worth investigating.
11285 \begin{notate
}{Assimilating data
} \label{assimilating-data
}
11286 We learn to map data ``up'' (local) hierarchies. For example, when we
11287 make lists of things to do, we map observations up from a perceptual
11288 space to a potential action space. It is valuable when living and
11289 writing to have good heuristics for figuring out the best level for
11290 observations. (Some should be simple data, some should be containers
11291 for other sorts of data.) This also relates to the issue of text and
11292 code from Note
\ref{text-and-code
}.
11294 If the
document is a process (Note
\ref{process
}), then it may
11295 sometimes be a ``process of understanding'', or a trace thereof. When
11296 we think about something, we may be thinking in terms of an internal
11297 ``scholia-based
document''.
11299 As I've been working on
\emph{this
} document, various ideas have
11300 occured to me, and they make their way in as marginalia, then as
11301 Notes, and perhaps more expanded or refined.
11303 It would be nice to have a specific reference to something from
11304 ``psychology'' here -- the
\emph{On Intelligence
} book would work,
11305 even though it could be a better book. Note that the Minsky book
11306 contains similar (but more theoretical) notions.
11308 The idea of ``hooking'' from Note
\ref{thought-processes
} seems
11309 related -- both with regard to expressing assimilated knowledge by
11310 supplying suitable hooks, and with regard to figuring things out by
11311 hooking them together or hooking them to things that we already know.
11314 \begin{notate
}{Text and code
} \label{text-and-code
}
11315 What items should be coded up and what should be written about? This
11316 question seems particularly on-topic for a literate program. (See
11317 Note
\ref{motto
}.) Historically, many thinkers were not able to
11318 write (useful) programs, because there weren't computers to run the
11319 programs on. But algorithms have been being designed for a long time.
11320 If Newton had kept calculus on a completely abstract and philosophical
11321 level, it wouldn't have been useful for computation. On the other
11322 hand, I have very little idea how the phenomenologists could have gone
11323 about coding up their ideas. Even though now, work in knowledge
11324 representation apparently follows in their footsteps. Part of the
11325 issue is that there are different languages for different things.
11326 People frequently work on the ``conceptual'' level, and they need
11327 things to be narrated to them. Programs typically only ``work'', if
11328 they come with some suitable narration, either intrinsic or extrinsic.
11329 The actionable-nonactionable dichotomy may not be so useful (compare
11330 Minsky on dumbbell theories). The notion that things ``evolve'' from
11331 nonactionable to actionable is probably a somewhat misleading, as
11332 appealing as it might be. Sometimes we need to ask: what programs
11333 must be written to understand this question? To paraphrase a
11334 correspondent of mine (Ray Puzio), text and code are like yin and yang
11336 linguistics''
\footnote{{\tt http://www.thing.de/projekte/
7:
9\%
23/chuang
\_tzu\_linguistics.html
}}?).
11337 Understanding how they relate to one another in more detail would
11338 presumably be quite fruitful.
11341 \begin{notate
}{Hyperstuff
} \label{hyperstuff
}
11342 Text is (or can be) hypertext; mathematics is just as ``hyperreal'' as
11343 the HDM. But I suppose that with some work towards
\emph{formalizing
}
11344 a definition the ``hyper'' prefix might give us more than just hype
11345 about a quote-un-quote new technology. (As an example of how these
11346 categories run together, Note
11347 \ref{derivative-works-in-the-scholium-system
} contrasts hypertext-like
11348 indices with more text-like compilations.)
11350 Accordingly, you can build an AI out of all sorts of miscellaneous
11351 components. Mathematics is already very AI-like, even though many of
11352 its agents are human beings. It isn't completely clear what the
11353 differences there are between working with systems with more
11354 electronic components and systems with less. Is, or, how is, one set
11355 inherently more powerful, or more risky, or just better for different
11358 Compare Note
\ref{physical-scholium-system
}.
11361 \begin{notate
}{Not-so-holistic mathematics
}
11362 The QA section is typically split into two or three parts, each found
11363 in a separate library. Here in Minnesota, there is the math library,
11364 the math philosophy section in the humanities library, and the
11365 engineering library. It can be somewhat inconvenient and a bit
11366 offputting for people who want to look at math from all of these
11367 perspectives. On the other hand, it frequently makes sense to divide
11368 when resources can't be copied. Note that digital libraries don't
11369 need to be divided in a permanent way; cf. Aaron's Emory paper -- in
11370 both positive and negative senses -- in particular, think about
11371 Google, today's great integrator. Compare Leibnitz on the university
11372 and Minsky on the mind.
11375 \begin{notate
}{Philosophy of intelligent documents
}
11376 The main thing to look at here is the Dreyfus and Dreyfus article in
11377 \emph{The Artifical Intelligence Debate
}. The ideas in the current
11378 document (e.g. in Note
\ref{human-and-artificial-intelligence
})
11379 should give some ideas about why there is hope for AI, and why we can
11380 make something that people like to use as we make progress towards
11384 \begin{notate
}{Usefulness of bidirectional linking
}
11385 When a note contains a link to a section that contains more
11386 information on the topic of that note, this gives the author a way to
11387 have some of this topic spread into different contexts, but also to
11388 have a compressed treatment that reflects all the different ideas
11389 about the given topic in the
document as a whole. Bidirectional links
11390 can be used to facilitate this bifurcated style of writing.
11393 \begin{notate
}{Being ``meta''
}
11394 One way to be ``meta'' is to loop through some dimension that was
11395 previously held static. Just for example, we might switch from
11396 single-article rendering to multi-article rendering at some point.
11399 \begin{notate
}{Thought processes
} \label{thought-processes
}
11400 It is interesting how different pieces of information will attach
11401 themselves to a train of thought -- like so many carriages. Or like
11402 the miscellaneous stops on a messenger race.
11404 In such races, there is actually no ``message'' to deliver; rather,
11405 the racers must simply visit several predesignated stops, and
11406 sometimes perform a certain task at each -- like drink a beer, for
11407 instance. Typically these stops can be visited in any order.
11409 Like
\emph{post facto
} routes, thought process seems to be exploring a
11410 large web-like space -- and only finally getting pulled together into
11411 one narrative thread. Perhaps one unwinds an
\emph{Ariadne's thread
}
11412 as one explores; and perhaps at each important stop a hook is added,
11413 so that when we get to the ``end'' of the path, we pull the Ariadne's
11414 thread, and the hooked-in items from hither and yon are present before
11415 us, ready in salute.
11417 This business with the Ariadne's thread is pretty amazing, but the
11418 hooks, by contrast, seem pointedly quotidian. They include such drole
11419 things as word-association, metaphor, alliteration, and various other
11422 Some thoughts are fleeting and remain between the lines forever (``you
11423 should have seen the one that got away!''). Is this a problem?
11424 Perhaps less so when you are focused (Note
\ref{staying-focused
}).
11427 \begin{notate
}{Mnemonics
}
11428 The fact that humans can often improve their ability to remember
11429 things maybe means that we shouldn't trivialize memory-hooks
11430 too much. Ultimately, however, it seems like we do run into
11431 ``wetware limitations''.
11434 \begin{notate
}{Search
}
11435 Being able to search is a very nice feature of the computer
11436 interface. But of course, it is also possible to use
11437 thought processes (Note
\ref{thought-processes
}) to search.
11438 (If it wasn't, we'd almost surely be utterly screwed.)
11441 \begin{notate
}{Experience
}
11442 Experiences give you things to point at or hook to. They are sort of
11443 like pre-computed cases -- you can save time and be secure by knowing
11444 what to do in a given situation in advance. However, our experiences
11445 are almost always (or maybe ``always'') only heuristically applicable.
11447 Scholia, too, are sort of like pre-computed cases; i.e., they
document
11448 the experiences of persons who have interacted with a given subject.
11451 \begin{notate
}{Establishing setting
}
11452 In filmmaking (and fiction writing), there is a tradition of images
11453 that are only secondarily part of the story per se, but which, rather,
11454 tend to say
\emph{where
} the story takes place, and to lend it some
11455 realism (or similar quality of substance).
11457 These images are sort of like attached scholia; they could be cut and
11458 the plot would remain. However, we often see films that have been
11459 ``ruined'' by overzealous cutting.
11462 \begin{notate
}{This
document as an example of CBPP
}
11463 This
document will hopefully be CBPP (``for real'', and not just via
11464 the Swift-Minsky societies of my mind). The transition from solo work
11465 to group work is probably almost always rocky, and sometimes even too
11466 off-putting for it to happen at all. However, there are certainly
11467 some steps that can be taken to ease the process along -- it is
11468 possible that having a ``cool'' product helps (some would argue
11469 vehemently that the cool factor is unimportant to the extreme).
11471 Hopefully by trying to make the code and documentation as accessible,
11472 starting with some discussions about the system, moving to discussions
11473 within the system, and from there soliciting code, etc., things will
11474 work out for the current current project.
11477 \begin{notate
}{Freedom, bookmaking, and book-buying
}
11478 In my view, part of the idea of paying for copies
\emph{should
} be
11479 that the copy itself is a work of art. If the copy is simply
11480 something you could run off yourself on your laser printer, it might
11481 not really be worth buying. If it is a limited edition artwork -- and
11482 if the price is right -- then it could be very much worth buying. On
11483 the other hand, if the salient features can be simulated cheaply, then
11484 even the ``unique'' artwork may not be very valuable.
11486 This relates to Section
\ref{more-physical-scholia
}. The value of
11487 print versions of a
document is an interesting psychological question.
11488 Writing marginal notes into a printed
document seems to be a perfectly
11489 viable way of building meaning clusters, but it isn't clear whether it
11490 has any specific psychological benefits over writing marginal notes
11491 into a sufficiently robust electronic system.
11494 \begin{notate
}{Staying focused
} \label{staying-focused
}
11495 In a scholia-based
document, it should be somewhat obvious when you
11496 drift off subject or off task. Sometimes the connection between the
11497 ``off subject'' elements of the
document and the ``on subject''
11498 elements comes through a ``meta'' sort of connection. For example, I
11499 initially worte this Note as a reminder to myself to stay focused on
11500 the code I'm looking at today, and not to get distracted by too many
11501 peripheral or minor concerns. Even though this Note is peripheral
11502 with regard to the semantic content of the code, hopefully it will have
11503 a salutory ``meta-level'' effect on the coding process.
11506 \begin{notate
}{Hetrarchy
} \label{hetrarchy
}
11507 If it isn't obvious, a hetrarchy is an example of a scholium-based
11508 document in which the articles are people and the attachment
11509 relationships are given by who is working on whose project. It
11510 shouldn't be too hard to map out these sorts of relationships in a
11511 given CBPP system (like PlanetMath, for example).
11514 \begin{notate
}{Hierarchy
} \label{hierarchy
}
11515 Of course, a hetrarchy (Note
\ref{hetrarchy
}) can be viewed as the
11516 joining-together of several hierarchies. It seems helpful to be able
11517 to look at the local hierarchies associated with certain articles.
11518 Who cites who, and who do
\emph{they
} cite? -- and so on.
11521 \begin{notate
}{Scholia-based digital libraries
}
11522 Some of the relationships to Digital Libraries are as follows.
11524 In a physical library, marginalia are considered to be graffiti. In a
11525 digital library, they can easily be ignored, if that is desired. They
11526 are more like sticky notes than they are like true marginalia, but
11527 even more potentiallly-ignorable than these handy-dandy things.
11529 Still, the fact of the matter is that adding scholia to a
document
11530 will always change the
document's meaning in some sense. However, in
11531 the case of
\emph{private
} scholia, other people will be in the dark
11532 as to the nature of the change. There is a gradient here; some
11533 scholia. may be ``so public'' that everyone sees them, no matter how
11534 their filters are set. (E.g., the user interface to monolithic
11535 operating systems.)
11537 In a physical library, loud conversation is considered to be
11538 disruptive. In a scholia-based
document, it should be possible to
11539 mark conversations with metadata that will make them more or less
11540 private. (Conversations are an example of processes-as-scholia.) In
11541 a typical feedback-forum situation, user feedback isn't actionable.
11542 But of course scholia can be made actionable -- and they need not be
11543 favorable. For example, scholia can be used to vote such-and-such an
11544 item out of the collection.
11547 \begin{notate
}{The system
} \label{the-system
}
11548 ``The system'' is comprised exactly of the most-public articles.
11549 Every user ``sees'' the system (as filtered through their own
11550 customizations). Freedom of users to make (not-publically-visible)
11551 customizations
\emph{ad infinitum
} is certainly important. But
11552 questions as to who can change the system itself and
11553 \emph{how
} it can be changed seem to be at least as important.
11556 \begin{notate
}{Ontology versus pre-ontology
}
11557 Most of the work done so far in this
document has been at the
11558 level of pre-ontology; work on the associate ontology or
11559 ontologies can begin before long.
11562 \begin{notate
}{Various free and nonfree cultures
}
11563 I still don't know what to say about the license-defined
11564 common versus a managed public domain common commons.
11567 \begin{notate
}{Teamwork
}
11568 Building a good team relates to the platform's usability (in both
11569 directions). Is the whole just as good as the sum of its parts?
11570 What's good/bad/indifferent about
\emph{informal
} teams?
11573 \begin{notate
}{Places to store thoughts
}
11574 Places, or spaces, for thoughts can be helpful to have around. File
11575 $X$ under ``experiments'', $Y$ under ``community spirit'' and so on.
11576 As to whether the metaphor of ``file'' works, that's a good question;
11577 labels may be uniformly better to use. Furthermore, just about any
11578 sort of attachment relationship can be used to categorize things;
11579 compare Note
\ref{hyperstuff
}.
11582 \begin{notate
}{Work ethic
}
11583 The achievement of a workable work ethic was supposed to be the big
11584 event in Penmaster's Apprentice issue
2. With regard to this work, it
11585 is interesting to consider the interplay of different work styles:
11586 small and large, physical and computational. We can get very
11587 different sorts of meaning clusters simply by adjusting our
11588 scholia-creation patterns (at least in theory). The (judicious) use
11589 of summaries, critiques, new-found relationships, and so forth, give
11590 an overall feeling to the evolution of a
document.
11593 \begin{notate
}{Interpretation
}
11594 What is meaningful? In relationships, in activities, and so forth?
11595 In literature, you want to figure out e.g. how to do character
11596 development in a ``meaningful'' way, to create something that people
11597 will want to read (and which they will find meaningful).
11600 \begin{notate
}{Vanity publishing
}
11601 One's vanity can at least have the effect of encouraging one to write
11602 and perhaps to do research as well.
11605 \begin{notate
}{Role of philosophy in this
document}
11606 Some people have told me that they don't see the point of writing so
11607 much. But code is allegedly supposed to come after design, and design
11608 is supposed to come after you understand the problem. I think on
11609 paper, and code things up as I understand them. By this token,
11610 perhaps eventually we'll see a version of the
document in which most
11611 of the philosophy has code associated with it.
11613 One thing to realize (might as well do so at some point) is that this
11614 is more than just a program; it is a philosophy of documents, whence,
11615 maybe even a tentative metaphysics, since what can't be regarded as a
11616 document, after all!, and as making some addition to the philosophy of
11617 (the society of) mind.
11620 \begin{notate
}{Philosophy of dictionaries
}
11621 Someone or other said something about defining via every
\emph{use
}.
11622 Which implies that each definition is a more-than-octopodal sort of
11623 thing, reaching all over the place. Uses can often be partitioned,
11624 and showing this partition only can massively simplify things. It is
11625 interesting to think about the scholium nature of partitions and
11626 representatives of the partitional classes.
11629 \begin{notate
}{Control
}
11630 One tends to imagine that the things that one can control are
11634 \subsection{Mathematics of the scholium system
} \label{mathematics
}
11636 \begin{notate
}{Document topology
}
11637 The conversation about identification of
document regions has a very
11638 topological flavor, as does the idea (also mentioned in the paper)
11639 about stitching documents together out of articles attached along
11643 \begin{notate
}{Cyberspace geometry
}
11644 The ``observation'' mentioned in Note
\ref{observation-on-cyberspace
}
11645 could presumably be translated -- at least partially -- into a
11646 statement about the hyperbolic geometry of cyberspace. And I think
11647 people have been studying this stuff for a while. However, I think
11648 there is more to the statement than just that.
11651 \begin{notate
}{Region arithmetic
}
11652 The notion that regions can be copied, broken apart, deleted, and
11653 added on the fly gives a notion of $*$, $/$, $-$, and $+$ for marked
11654 up regions (and this applies to both text and markup). I don't know
11655 whether much can be made of these things, but they are the fundamental
11656 operations, so perhaps there is something here.
11659 \begin{notate
}{Clusion algebra
}
11660 Studying articles and clusions could be an interesting computational
11661 variant on the study of objects and morphisms.
11664 \begin{notate
}{Transclusion linearity
}
11665 The fact that transclusions shouldn't be indicated by constant, but
11666 rather, linear, functions, seems cute (but I'm not sure what to make
11670 \begin{notate
}{Scholium mathematics in general
}
11671 I'm particularly reminded of topology (including graph theory) and
11672 ergodic theory. ``Information theory'' seems related to the issues of
11673 updates and versioning; similarly, ``knowledge theory'' may be related
11674 to the issues of multi-directional updating. From there we could move
11675 on to game theory, I suppose, as the mathematical domain most
11676 closely related to culture building (
\emph{nomics
}
11677 are what I'm thinking of here; these also relate to MUDs).
11679 Economics, more generally, seems to be where things are headed, when
11680 we think about the social welfare situation associated with CBPP
11681 system policies (e.g. rejecting corrections on PlanetMath has no
11682 %% Maybe the open source version would be Franklinstein
11683 repurcussions; if an essay about
\emph{Frankenstein
} is posted to the
11684 site and the author rejects all corrections which say ``this is not
11685 math!'', the administrators will presumably have to get involved, and
11686 take some extra-protocol action to remove the article).
11688 Other topics that should be taken up are the linguistic and
11689 ``mathematical artificial intelligence'' threads coming from the HDM
11693 \begin{notate
}{Network navigation
}
11694 If a scholium-based
document is broken up into trees, the
document's
11695 underlying network can be linearized simply by ordering the roots of
11696 these trees. This relates to questions about literate programming and
11697 proof checking (how do you write a ``structured proof''?).
11700 \subsection{Document analysis and the scholium system
} \label{document-analysis
}
11702 \begin{notate
}{Pitfalls of summarization
}
11703 It isn't completely clear that Note
\ref{the-philosophy
} makes a great
11704 summary of the whole of the philosophy of this work. Any summary
11705 leaves things out or is otherwise vague.
11708 \begin{notate
}{Recapitulation
}
11709 An article $A$ that appears after some article $B$ in a given ordering
11710 which contains a summary of $B$. This relationship could be indicated
11711 by a link in one direction or another (likely to run from $A$ to $B$).
11714 \begin{notate
}{Discourse analysis and holographic or monadological structures
}
11715 Long-range reference and design theory seem related to each other and
11716 to this work as a whole; cf. Section
\ref{mathematics
}.
11719 \begin{notate
}{Unified semantics
}
11720 Nelson (I think) has advertised some kind of unified theory of
11721 semantics; it might be fun to take a look at that.
11724 \section{Conclusions
} \label{conclusions
}
11726 \begin{notate
}{Original conclusion
}
11727 In a context with multiple authors talking about many
11728 intersubjectively important concepts, with ownership of the texts that
11729 they write but freedom with the content, treating the total
document
11730 as a collection of scholia could provide important alternative
11731 perspectives on a given subject. The presence of on-screen scholia
11732 could encourage responsible maintainership and aid users in making
11733 specific comments and suggestions part of their critical reviews of
11737 \begin{notate
}{Difficulty of putting things together
}
11738 Technological difficulties are posed by the fact that a
document must
11739 be assembled out of several pieces for presentation purposes and the
11740 fact that standard web browsers and editors may not be very useful for
11741 browsing or creating these sorts of documents. (This isn't
11742 \emph{always
} a difficulty; rather, it motivates the current
11743 development effort!) Compare the message on the outside of the
11744 Walker (Figure
\ref{author-as-scholium
}).
11746 And: why didn't we see something like this
document before? Why
11747 haven't the systems on the Hyperworlds server become ``popular''? I'm
11748 not completely sure; there are probably a number of interrelated
11752 \begin{notate
}{Freedom in an online context
}
11753 Another very important thing to talk about is free versus non-free web
11754 services. I'm not sure if we mean to completely
\emph{skewer
}
11755 non-free systems, i.e., systems that don't have a collaborative free
11756 scholia-based compenent to them. But on the other hand, such systems
11757 really may be much less useful. The current model is basically: if
11758 you want to create some commentary on something else, you need to find
11759 your own platform/soapbox from which to make that commentary. Some
11760 systems, like PM's attached fora, invite commentary and provide a
11761 place for it. But many, many, pages out there do not invite
11762 commentary or simply do not supply a place to put it. Another thing
11763 to notice about the scholia-based system is that it is very
11764 egalitarian. Just because something was ``there first'' doesn't make
11765 it better. The commentary can become just as important as the main
11766 document, or more important. On the other hand, it would be very
11767 useful to develop some algorithms that can be used to sort out the
11768 useful commentary from the utter crap. Slashdot does a pretty good
11769 job of this, but I think there is still room for improvement. And,
11770 even though PM provides attached fora, they could do a significantly
11771 better job of exposing the content that is provided in those fora in
11772 the ``default view'' or some ``secondary view'' of the object that is
11773 being commented on. It might just take something simple, like
11774 expanding all of the threads, or possibly using some Slashdot-like
11775 rating system to expand notable threads. Both interactive and
11776 automatic ways of determining the usefulness of certain feedback can
11777 be used -- and there are already some things like this in Gnus (I'm
11781 \begin{notate
}{Knowledge communities
}
11782 It would also be good to talk about Ray's comments about knowledge
11783 communities -- need to take another look at those again. Also,
11784 referring to other Ray stuff, I wonder what conditions would be
11785 necessary for academics to accept more off-the-beaten-track
11786 publications (e.g. PlanetMath). Of course, if these things became
11787 popular they wouldn't be off-the-beaten-track any more, really, but
11788 let's not get circular. My sense is that making some sort of medium
11789 ``respectable'' has to do with the social contract thing. On the
11790 other hand, people do seem to get respect for out-there stuff if it is
11791 somehow novel, or useful, or
\emph{something
}. (Not sure what the
11792 relevant quality here is, how much ``uptake'' has to do with it, how
11793 much ``propaganda'' (or ``PR'') or what -- if I knew maybe I'd try to
11794 exploit this knowledge!)
11797 \begin{notate
}{Social simplicity
}
11798 Sometimes complexity may not be totally avoidable within the code.
11799 (E.g. if there are
1 billion scholia about a given article, sorting
11800 them would take a long time.) Sometimes we can do clever things --
11801 but other times we can probably rely on the user groups to structure
11802 things in ways that won't push things too far. It isn't clear how
11803 much we can rely on them for this -- but my guess is that things that
11804 the machine would whine about are frequently going things that people
11805 want to avoid for their own reasons.
11808 \begin{notate
}{Human and artificial intelligence
} \label{human-and-artificial-intelligence
}
11809 The HDM project may be better off building something that smart people
11810 can hack than building smart code right away. Perhaps that's why I'm
11811 giving precedence to the scholium system over things like parsers and
11812 the like. The ``human element'' in software development seems
11813 powerful. It is curious that I've envisioned the scholium system as
11814 being mainly about the AI component of HDM; but it may be that we can
11815 expect more from it, namely, a contribution to AI for HDM creation.
11816 Take a look at Note
\ref{text-and-code
} for some words against
11817 thinking about things in terms of ``evolution towards actionable
11818 form.'' I think a better argument would be for
\emph{co-evolution
}
11819 (which is good, because there has been plenty of thinking done on this
11820 issue). SNePs seems to have some things to say on this
11821 topic
\footnote{{\tt
11822 http://www.cse.buffalo.edu/sneps/snerg.prospectus/node19.html
}}.
11823 Presumably so do others; still, by contrast with many other systems,
11824 the co-evolution view seems to be emphasized particularly strongly
11828 \begin{notate
}{Labels vs namespaces, transclusion vs inclusion, overlays vs text properties
}
11829 It is interesting to compare the ``hard'' to the ``soft'' approaches,
11830 both of which appear in this
document in different roles (sometimes in
11831 interestingly similar relationships to one another).
11834 \begin{notate
}{Compatibility between versions of this system?
}
11835 All else equal, it would be nice for any future versions of this
11836 system to be compatible with this one. But we can make no guarantees
11837 that this will actually happen, although I do think that the system
11838 will be revised somewhat to continue to make improvements and add new
11842 \begin{notate
}{Future work
}
11843 It would be pleasant to have Arxana hooked up with a graphical
11844 node/edge display, such as fenfire
\footnote{{\tt http://fenfire.org
}}.
11845 Building rich displays is a problem that we'll want to consider from
11846 many angles (cf. Note
\ref{large-form
}). The usefulness of getting
11847 various tools worked out in plain-text modes shouldn't be ignored!
11850 \begin{notate
}{Getting work done on Arxana
}
11851 We mentioned one strategic point, that of collaborating early on, in
11852 Note
\ref{collaborate-early
}. There are probably other things I
11853 should be doing that would enhance my ability to get things done with
11854 this system. Productivity is a topic that should be studied more.
11855 Working a lot, trying to check concrete usefulness or applicability a
11856 lot, maintaining a strategic plan -- these all seem like good ideas.
11861 \section{Appendix: A simple literate programming system
} \label{appendix-lit
}
11863 \begin{notate
}{The literate programming system used in this paper
}
11864 The point of this code is to grab all the Lisp sections
11865 of this
document and evaluate them. It requires that
11866 the
\LaTeX\ be written in a certain consistent way, with
11867 all of the code in a certain kind of environment. That
11868 is all it does and all it requires.
11871 (defvar lit-code-beginning-regexp "^\\\
\begin{lisp
}")
11872 (defvar lit-code-end-regexp "^\\\
\end{lisp
}")
11873 (defvar lit-count
0)
11877 (lit-process 'eval))
11879 (defun lit-process (&optional code)
11881 (setq lit-count (
1+ lit-count))
11883 (let ((to-buffer (concat "*Lit Code " (int-to-string
11885 (from-buffer (buffer-name (current-buffer))))
11886 (set-buffer (get-buffer-create to-buffer))
11888 (set-buffer (get-buffer-create from-buffer))
11889 (goto-char (point-min))
11890 (while (re-search-forward
11891 lit-code-beginning-regexp nil t)
11892 (let* ((beg (match-end
0))
11893 (end (save-excursion
11894 (search-forward-regexp
11895 lit-code-end-regexp nil t)
11896 (match-beginning
0)))
11897 (match (buffer-substring beg end)))
11899 (set-buffer to-buffer)
11903 (set-buffer to-buffer)
11905 (kill-buffer (current-buffer)))
11907 (switch-to-buffer to-buffer))))))
11909 (defun lit-require (feature)
11910 (let* ((basename (symbol-name 'scholium-preliminaries))
11911 (name (concat basename ".tex"))
11912 (livep (buffer-live-p name)))
11919 (kill-buffer (current-buffer))))))
11923 \begin{notate
}{Another way
}
11924 This code could go into a stand-alone file. This would
11925 make it somewhat more reuseable, at the cost of making
11926 the current
document somewhat less self-contained.
11927 Since I seem to like writing literate programs, making
11928 the code reusable probably wins out.
11931 \begin{notate
}{Adding docstrings at deliteration time
}
11932 It might be adventageous to have some way to add docstrings to
11933 functions that have been literately documented when the literate
11934 documentation is stripped out, before the functions are evalled.
11937 \begin{notate
}{Split into sections
}
11938 It might be handy to have the code that evaluates
11939 this file split it into several separate files, or
11940 to provide an option for doing this in the ancillary
11944 \begin{notate
}{LaTeX verbatim environments
}
11945 The only thing you can't put into a verbatim environment is the text
11946 ``
\verb|
\end{verbatim
}|'' $
\ddot{\smile}$. See Note
11947 \ref{principle-of-transparency
}.
11950 \section{Appendix: Overview of specifications
} \label{appendix-specs
}
11952 \begin{notate
}{A quick guide for the theoretically minded
}
11953 This section will contain an overview of the specifications of
11954 \emph{this
} scholium system, which, I think should help people who
11955 want to hack on it, or who want to create
\emph{other
} scholium
11956 systems. The full theory is found in the main
document, of course;
11957 this section serves to remind the reader of points that are dealt with
11958 in greater detail there.
11961 \begin{notate
}{Spec for article
}
11962 An article is an element of some namespace, by default,
11963 the main article-table (a hash table).
11964 It takes the form of a quintuplet,
11966 (name text about type bookkeeping)
11968 where, when stored in the hash table,
\inp{name
} is used
11969 as the key. (See Note
\ref{structure-of-articles
}.)
11972 \begin{notate
}{Spec for about data
}
11973 About data in articles takes the form of a list of
\emph{links
}. (See
11974 Note
\ref{format-of-about-field
}.)
11977 \begin{notate
}{Spec for link
}
11978 Each link takes the form
11980 (<target article's name> &rest <link-types>)
11982 The design here maintains partial symmetry between the treatment of
11983 article types and link types; the cdr of a link can be processed
11984 by the same typedata processing functions as the
\inp{type
}
11985 data from articles. (See Note
\ref{links
}.)
11988 \begin{notate
}{Spec for type data
}
11989 A type can be a single token specifying a type or a list of types.
11990 Types can, themselves, come with additional data; in which case they
11991 take the form of a list, where the car gives the type's name, and the
11992 cdr carries all additional specifics.
11995 \begin{notate
}{Spec for metadata article
}
11996 An article $A$ has metadata article $
\tilde{A
}$ whose
12001 The
\inp{text
} of a metadata article takes the form of a list of
12002 lists, with each sub-list headed by a tag naming the contents of that
12003 sub-list. The
\inp{about
} data is `nil', the
\inp{type
} is `meta',
12004 and the bookkeeping data is `system'. (See Note
12005 \ref{metadata-article-design
}.)
12008 \begin{notate
}{Spec for backlink
}
12009 An article's backlinks are stored on the `backlink' field of its
12010 metadata article. An individual backlink
12013 (<name> <link number>
[<version number>
])
12015 where ``name'' is the name of the article being backlinked, and
12016 link number indicates the particular link to which this backlink
12017 corresponds. The optional version number is used if the backlink
12018 corresponds to a specific version of the linking article other
12019 than the most current one.
12020 (See Note
\ref{implementation-of-backlinks
}.)
12023 \begin{notate
}{Spec for link-id
}
12024 The purpose of a link-id is to specify a link when marking up a piece
12025 of text with a text property corresponding to a scholium, namely the
12026 link through with that region was indicated (see Note
12027 \ref{the-scholia-property
}; the `scholia' text property contains a
12028 list of link-ids.).
12030 The format of a link-id is
12032 (<name> <link number>)
12035 Notice that link-id's also come up in the context of masks and other
12036 places. They are a sort of idiom used in several places in the work
12037 (as you can easily see by looking around at the specs shown in this
12038 appendix). One thing to notice is that the ``usable about data'' of
12039 Note
\ref{compute-usable-about-data
} \emph{et seq.
} leads up to markup
12040 fairly directly, and, in particular, that it computes markup by
12041 applying masks to links as needed. So, it is no wonder that there is
12042 some continuity between these various parts of the system; and, in
12043 particular, the fact that link-id's are a part of that continuity
12047 \begin{notate
}{Spec for mask
} \label{spec-for-mask
}
12048 An article's masks are stored in the `masks' field of its metadata
12049 article. An individual mask takes the form
12051 ((<name> <link number>) &rest regions)
12053 The regions are two-element lists, each giving the beginning and end
12054 of a region that the link is being redirected to. See Note
12055 \ref{masking-links
} and Note
\ref{masks
}, and for further discussion
12056 of the lack of generality in the current mask format, see Note
12057 \ref{generality-of-masks
}.
12060 \begin{notate
}{Spec for `usable-about-data'
}
12061 Something called ``usable-about-data'' is produced by the function
12062 `compute-usable-about-data' (see Note
12063 \ref{compute-usable-about-data
}). This stuff is used when marking
12064 things up (in particular, by `mark-up-scholium' and
12065 `mark-up-reference'). The reason for documenting it here is that its
12066 format is confusing and easy to forget. I think that it would be best
12067 if we could find another way to get this data to where it needs to be.
12069 The format of the return value of `compute-usable-about-data'
12070 is a list of elements of the form
12072 ((<name> <link number>) <beg end | nil>)
12074 where name is the name of a scholium, `beg' and `end', if specified,
12075 give the beginning and end of a marked region (yes, only one region
12076 per link, as mentioned in Note
\ref{links-indicating-passages
}),
12077 whereas `nil' is specified if the link indicated by the `car' of this
12078 form points at the whole of the article being rendered.
12080 (I am not a huge fan of this format, but it does seem to work;
12081 however, maybe the name should be changed to ``usable about data for
12082 markup'' or something like that, to make it clear why we are focusing
12083 on data describing regions.)
12085 (Also, perhaps we should note in this spec that instead of the
12086 \inp{name
}, sometimes ``(mask
\inp{name
})'' is used instead. The
12087 development here seems a bit confusing: if we use (mask
\inp{name
}),
12088 is this a proper link-id? Something to think about, I guess.)
12091 \begin{notate
}{Comments on specs
}
12092 I fear that the choice to allow a token or a list of types may come
12093 back to bite later; it is certainly somewhat annoying now. But I
12094 think we're running with it?
12096 Eventually we might want some specs for various operations or other
12097 objects (e.g. transclusions are both operations and static objects).
12098 But we can hold off on that til it is all defined.
12100 Furthermore, we'll want to have clear specs for the formats that are
12101 used
\emph{in markup
} (of regular links, links coming from references,
12102 fake references, possibly etc.) but we don't quite have that taken
12106 \section{Appendix: Time and workflow management
} \label{appendix-cal
}
12108 \begin{notate
}{Framework for keeping track of time and events
}
12109 People have been using calendars since the beginning of time
12110 (literally!). However, this is a case where reinventing the wheel
12111 might be called for. The scholium system can be used to keep track of
12112 epochs of different scales, and maintain the proper relationships
12113 between them. Well, different calendar programs already exist that
12114 will e.g. keep track of the events that are taking place in all of the
12115 days of the month, and know (in some sense of the word) that these
12116 events are taking place in that month. But I think I can do somewhat
12117 better for my needs. One of the reasons is to keep a lot of data in
12118 the system and integrate it up to get certain conclusions.
12119 Furthermore, I want to keep track of the way big tasks get parceled
12120 out to smaller time-scales. Another useful feature is the ability to
12121 go in the opposite direction, and produce somewhat realistic
12122 predictions about what can be done by when.
12124 So, we'll give it a shot.
12126 (Presumably if this ``appendix'' gets extremely verbose, big parts of
12127 it should be chunked out into some other separate
document.)
12130 \begin{notate
}{Summer
2006}
12131 I want to get a releasable version of Arxana out. I have to help
12132 mentor Shaneal on his proof checking stuff. I'd like to get started
12133 with some NLP stuff. I'd want to keep up with general reading and
12134 correspondence related to the HDM project. And finally, I want to do
12135 some more math related things.
12138 \begin{notate
}{Miscellaneous items that can get into release
} \label{misc-items-for-release
}
12139 This stuff has come up as potentially important or at least
12140 interesting to consider for the release.
12142 \item How about being able to spawn a semi-anonymous scholium rooted
12143 in the current article?
12144 \item Build a subdocument library.
12145 \item Make an easy to use demo.
12146 \item Get a system for unique ID's working.
12147 \item Import APM-Xi.
12148 \item Go back over the internal formatting and display, and make sure
12149 that the format is actually used properly by the code that is
12150 supposed to use it.
12151 \item Finish putting together the ``restricted view'' mode.
12152 \item Perfect some system for managing clusions (including a
12153 simplified version for assembling a
document from outlines).
12157 \begin{notate
}{Revising the schedule
}
12158 One of the most reasonable-seeming things to do when starting work is
12159 to assess the schedule of events, and clarify exactly which activities
12160 will be done during that work session. Other clarifications to the
12161 schedule can be effected at this point too.
12164 \begin{notate
}{Release conditions
}
12165 It would be nice to get some sort of system set up for collaborative
12166 work on the same state-containing scholium system. Maybe Arxana will
12167 have to be made inherently peer-to-peer for this to work (given that
12168 Emacs doesn't seem to include features for operating as a server with
12169 several distinct users working on it at the same time). Or
12170 conceivably we can find a good back-end (e.g. in Common Lisp or
12171 scheme?) to connect people to. Another possibility that might work,
12172 although it sounds like a little bit of a long-shot, is to get
12174 http://dev.technomancy.us/phil/browser/dotfiles/.emacs.d/ebby.el
}}
12175 working with Gobby, or build on this system to make some
12176 Emacs(-friendly) multi-user environment. (Since Ebby apparently just
12177 works as a client, I currently suspect that it won't directly solve
12178 our state-maintaining problems.)
12180 Since this all looks tricky, it seems to me that having some
12181 acceptible (though certainly not perfected, that would be asking too
12182 much) single-user environment ready to go even before making too many
12183 more investigations of the multi-user stuff. See Note
12184 \ref{misc-items-for-release
} for the key details on this topic.
12187 \begin{notate
}{Tue Jun
6 15:
12:
52 2006}
12188 I write this section up to the current point. Then I think about what
12189 to do next. I guess it would be a good idea to look at importing
12190 APM-Xi again, and maybe try to get the subdocument library stuff
12191 working. Since this should be fairly easy (at least initially).
12194 \section{Appendix: Annotated non-bibliography
} \label{appendix-bib
}
12196 \begin{notate
}{Outside references
}
12197 For now, references are contained in footnotes. To view a compilation
12198 of the Notes that contain footnotes, evaluate this form:
12200 (progn (article-menu-list-articles-matching-regexp "\
\footnote")
12201 (listing-to-compilation nil))
12203 Eventually we may have a nicer way of presenting this data. Also,
12204 there are a number of references made in the text for which there are
12205 no footnotes, and the footnotes that do exist don't necessarily take a
12206 proper or in any way standard form. This can be fixed up eventually.
12209 %%%%%%%%%%%%%%%%%%% Back matter %%%%%%%%%%%%%%%%%%%%%%
12213 % \addcontentsline{toc}{section}{\numberline {}References}
12214 % \bibliography{sbdm4cbpp}
12220 %%% sbdm4cbpp.tex ends here