;; platform - annotation, scheduling and life coding platform ;;handing off between parsing and buffer AS code --- macros also ;; link system after planner mode (links to/as anchors or any form of markup in files) ;; possible relationships: [which can also change link parties - alter ;; text of link (esp.with regard for example to version control] ;; - doubling ;; - (and how differs from) mirroring /and/ symmetry ;; - enframe/frames ;; - isa (within the category of) ;; - overlay ;; - transparency/opacity - and thus to opposition ;; - embedding (spatial relations - exteriority/expulsion/laying open in the world ;; - slots and properties (eg. devices, actors, cast and so on - live process) ;; -> original kodiak.lisp > dom (sub in PAIP), rel, ind, val, and [further] each, dif, when, not, and ;; dom/sub - (sub dog animal) dog is a kind of animal ;; rel - (rel birthday animal date) birthday relation holds between animal and some date ;; ind (ind fido dog) the individual fido is categorised as a dog ;; val (val birthday fido july-1) the birthday of ind fido is july-1 ;; and (and A B) bothe A and B are true // leave rest ... ;; from kodiak.lisp : ;;Syntax: ;; (a category [inst] (rel value)*) ;;Example: ;; (a person (name (a person-name (first Joe) (last Smith))) (age old)) ;; ==> ;; (and (ind person-1 Joe) (val name person-1 person-name-1) ;; (val age person-1 old) (val first person-name-1 Joe) ;; (val last person-name-1 Smith)) ;;Syntax: ;; (each category [(isa super*)] (rel constraint)*) ;; ;; Example: ;; (each person (isa animal) (name person-name) (age integer)) ;; ==> ;; (and (dom person animal) (rel name person person-name) ;; (rel age person integer)) ;;||# (defvar platform-mode-hook nil "*list of functions to call on entering platform mode") (defvar platform-mode-map nil "local keymap for platform") (setq platform-mode-map nil) (if platform-mode-map nil (setq platform-mode-map (make-sparse-keymap)) (define-key platform-mode-map "K" 'next-frame)) (defun platform-mode () "annotation and performance life coding platform" (interactive) (pop-to-buffer "*platform*" nil) (kill-all-local-variables) (defvar filename nil "filename") (setq major-mode 'platform-mode) (setq mode-name "platform") (use-local-map platform-mode-map)) ;; helping functions (defconst number-regexp "-?\\([0-9]+\\.?\\|\\.\\)[0-9]*\\(e[0-9]+\\)?" "Regular expression for recognizing numbers.") ;; saving list to file by way of intermediate buffer (defun make-save-buffer () (switch-to-buffer (get-buffer-create "*save*")) (erase-buffer)) (defun save-this-buffer (filename) (progn (goto-char (point-min)) (write-region 1 (point-max) filename nil 1) (kill-buffer (current-buffer)))) (defun minsert (string) (if (stringp string) (insert string) (insert (prin1-to-string string)))) (defun save_a_list (listy filename) (if (file-exists-p filename) (version-control-file filename)) (make-save-buffer) (minsert "(setq evaled '") (minsert listy) (minsert ")") (save-this-buffer filename) (switch-to-buffer "*platform*")) (defun read_a_list (filename) (let (old-buffer result) (setq result t) (setq old-buffer (current-buffer)) (switch-to-buffer (get-buffer-create "*load*")) (erase-buffer) (insert-file-contents filename) (eval-current-buffer) (kill-buffer (current-buffer))) (switch-to-buffer old-buffer) evaled) ;; annotation - according to categories. categories become links to access other annotations ;; ;; text is annotated with actions/categories/images and so on which are then re-worked and include and extend knowledge rep system ;; ;; how it can embed links and further annotations? - multiple annotations across sections ;; examine in muse context (defvar annotation-types '(("text" "c:") ("video" "f:") ("scratch" "s:") ("image" "i:") ("audio" "a:") ("process" "p:") ("code" "k:")) "The available annotation types.") (defvar annotation-default-type "commentary" "The default annotation type.") (defcustom annotation-default-cat "none" "Specify the default name of the annotation author. It is advisable to keep the name-string very short, for example to use the initials." :type 'string :group 'annotation-protoype) (defun annotation-insert-annotation (text &optional type category_list begin end) (interactive ;; "(let ... (list ...))" according to Elisp Reference Manual 2.8 / ;; 21.2.1 Using interactive (let ((text (read-string "Text: " nil nil "" t)) (type (completing-read (concat "Type (" annotation-default-type "): ") ;; prompt annotation-types ;; alist used for completion nil ;; limiting completion to a subset of ;; `annotation-types' is not done t ;; only input from `annotation-types' or null ;; is allowed nil ;; no initial input inserted into minibuffer nil ;; no history list is used for input annotation-default-type ;; the default value t)) ;; minibuffer inherits current input method and ;; "multibyte-character" setting (category_list (read-string (concat "Category (" annotation-default-cat ") :") ;; prompt nil ;; no initial input inserted into minibuffer nil ;; no history list is used for input annotation-default-cat ;; the default value t))) ;; minibuffer inherits current input method ;; and "multibyte-character" setting (list text type category_list (when mark-active (region-beginning)) (when mark-active (region-end))))) ;; Insert mark-up for an optional referred region ;; (when (and begin end) (goto-char begin) ;; this is for final markup - rewrite (insert "(add-annotate(\"") (goto-char (+ end 15)) ;; for (add-annotate.... ) (insert (make-annotation text type category_list)) ) (defun make-annotation (text &optional type category_list) "Constructs an annotation structure (string). TEXT is a string that holds the text of the annotation. When the optional parameters TYPE or AUTHOR are omitted, these parameters are set to their default values. Although, in the case of AUTHOR this is only the case if `annotation-set-author' is true. In addition to this, it is checked that if TYPE is passed, TYPE refers to a legal annotation type. Note: When the function is called indirectly by `annoation-insert-annotation' the setting of default values for type and author and the assertion of a valid annotation type is already coped with by `annotation-insert-annotation'" (when (not type) (setq type annotation-default-type)) (when (not category_list) (setq category_list annotation-default-cat)) (if (not (assoc type annotation-types)) (error "Illegal annotation type")) ;; this is for final markup - rewrite (concat "\"" (cadr (assoc type annotation-types)) " \"" text "\" '(" category_list "))" )) ;;split-string---= string-to-list ;; markup in situ after [muse-]annotation ;; categories backtracking. linking system a la planner ;; _______________________________ ;; scheduling - and some interface to Common Lisp processes (defvar processlist nil) (setq processlist nil) (defun schedule (name time repeat function &rest arg) (setq processlist (cons (cons name (run-at-time time repeat function arg)) processlist))) ;; needs make assoc list for name and then we can lookup and do cancel-timer for this (defun unschedule (name) (cancel-timer (cdr (assoc name processlist)))) (defun func() (insert "n")) ;; whatever. maybe switch to schedule buffer and print string ;;(schedule "narty" 10 10 #'func) (defun scheduletext (name time repeat text) (schedule name time repeat (lambda(x) (insert x)) text)) ;;(scheduletext 'mint 2 4 "hello") (unschedule 'mint) (defun scheduleprocess (name time repeat process args) (setq processlist (cons (cons name (run-at-time time repeat (lambda(x y) (start-process x "boo" x y)) process args)) processlist))) ;;(scheduleprocess 'minty 10 nil "display" "/root/kamera/image010.jpg") ;; markup for a processlist (schedule) - do this and save ;; remote access - see prmisc and httpd.el // use of test.php for entry of remote data ;; also need way for remote client to view buffers here live! (defvar remprocess nil) (defvar the_buffer nil) (defvar host nil) (defvar port nil) (defun remserv-start (&optional port) (interactive (list (read-string "Serve requests on port: " "8080"))) (if (null port) (setq port 8080) (if (stringp port) (setq port (string-to-number port)))) (if remprocess (delete-process remprocess)) (setq the_buffer (generate-new-buffer "*remote*")) (setq remprocess (make-network-process :name "prm" :buffer the_buffer :host 'local :service port :server t :noquery t :filter 'remserve))) (defun rem-stop () (interactive) (when remprocess (message "networked.el server on port %d has stopped" (cadr (process-contact remprocess))) (delete-process remprocess) (setq remprocess nil))) (defun rem-serve (proc string) (let ((remprocess proc)) (switch-to-buffer-other-window the_buffer) (print (eval (read string)) the_buffer))) ;; write directly into *remote* buffer - divide up frames according to ;; action(process), annotation, remote and so on ;;_________________________________ ;; markup for knowledge base processing (open new buffer/throw in ;; markuped buffer/save as file and process) - interface to results ;; markup into new buffer//save new buffer//save also an alist//send ;; file to be evaluated and potentially parse results (ilisp) (defun markandsave (buffer) ) ;;Syntax: ;; (a category [inst] (rel value)*) ;; ;;Example: ;; (a person (name (a person-name (first Joe) (last Smith))) (age old)) ;; ==> ;; (and (ind person-1 Joe) (val name person-1 person-name-1) ;; (val age person-1 old) (val first person-name-1 Joe) ;; (val last person-name-1 Smith)) ;; ;;Syntax: ;; (each category [(isa super*)] (rel constraint)*) ;; ;;Example: ;; (each person (isa animal) (name person-name) (age integer)) ;; ==> ;; (and (dom person animal) (rel name person person-name) ;; (rel age person integer)) ;; ;;dom/sub- categories and hierarchy (sub mirror double) ;; ;;rel- slots. (rel device actor thing) ;; ;;ind- individual example of category (ind jekyll actor) ;; ;;val- filling slot(val device jekyll bottle) ;; ;;question is of category->relationship (active). eg mirror->mirroring, double->doubling ;;making new relationship. also of the attachment to the source/annotated text ;; ;;new relation as function/action attached - process or schedule ;; category (mirror) -> function/action (on a body of text) mirroring