(load "~/svn_test/trunk/osc.el") ;; ____some OSC/PD ;; /root/project/patches... also svn_test/trunk/piksel2007.pd ;;(osc-send "localhost" 7770 "/test" "help") (defun speak-region (start end) (interactive "r") (let ((print-escape-newlines t)) (speaky (subst-char-in-string (string-to-char "\n") (string-to-char " ") (prin1-to-string (buffer-substring-no-properties start end) t))))) (subst-char-in-string FROMCHAR TOCHAR STRING &optional INPLACE) (defun speak-line () (interactive) (speak-region (line-beginning-position) (line-end-position))) (defun speaky (string) (interactive) (osc-send "localhost" 7770 "/test" string)) ;; (comint-run "pd") ;; (osc-send "localhost" 7770 "/control" 12) - control is for timing in PD (defun pd-control (number channel) (osc-send "localhost" 7770 (format "/control%d" channel) number)) ;;(pd-control 13 1) ;; ____display settings (tool-bar-mode nil) ;; for emacsclient -c execution (set-background-color "pink") (custom-set-faces '(org-level-1 ((t (:inherit (outline-1 default) :background "black" :foreground "blue" :inverse-video nil :weight bold : height 4.0)))) '(org-level-2 ((t (:inherit outline-2 :foreground "blue" :weight bold :height 5.0)))) '(org-level-3 ((t (:inherit outline-3 :foreground "red" :weight bold :height 3.0)))) '(org-level-4 ((t (:inherit outline-3 :foreground "orange" :weight bold :height 2.0))))) ;; ____image-dired code ;;(image-dired-insert-thumbnail (image-dired-thumb-name "/root/Wiki/images/alic01.jpg") "/root/Wiki/images/alic01.jpg" "one") ;; go through dir - if there is thumbnail display but we still need ;; link for full image (defun image-piksel-display-thumbs (directory) (interactive) (let ((buf (current-buffer)) curr-file thumb-name files count dired-buf beg) ;; directory (setq files (directory-files directory t (image-file-name-regexp) nil)) (goto-char (point)) (mapc (lambda (curr-file) (setq thumb-name (image-dired-thumb-name curr-file)) (if (and (not (file-exists-p thumb-name)) (not (= 0 (image-dired-create-thumb curr-file thumb-name)))) (message "Thumb could not be created for file %s" curr-file) (image-dired-insert-thumbnail thumb-name curr-file dired-buf))) files))) ;;(image-piksel-display-thumbs "~/svn_test/trunk/image_pool/oslo") ;;(image-piksel-display-thumbs "~/svn_test/trunk/image_pool/piksel") (defun image-piksel-display () (interactive0) (image-dired-display-current-image-full) ;; split and open buffer (split-window-vertically) (save-excursion (other-window 1) (switch-to-buffer "*image-dired-display-image*"))) ;; oslo pool ;; piksel pool ;;_____ scheduling - and some interface to Common Lisp processes (SLIME) (defvar processlist nil) ;;(setq processlist nil) (defun schedule (name time repeat function 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(num) (pd-control (random 10) num)) ;;(schedule 'narty 2 2 #'func 1) (defun scheduletext (name time repeat text) (schedule name time repeat (lambda(x) (insert x)) text)) ;;(scheduletext 'mint 2 nil "hello") ;;(unschedule 'narty) (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 - see permute.el ;; (current-time-string) ;;_____ 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)))