|
Warning: this is an htmlized version!
The original is here, and the conversion rules are here. |
;; dnc-0.el - my first attempt at implementing dnc abbreviations to
;; eepitch.
;; Author: Eduardo Ochs <eduardoochs@gmail.com>
;; Maintainer: Eduardo Ochs <eduardoochs@gmail.com>
;; Version: 2009jul31
;; Keywords: e-scripts, Coq.
;;
;; Latest version: <http://angg.twu.net/COQ/dnc-0.el>
;; htmlized: <http://angg.twu.net/COQ/dnc-0.el.html>
;; See also: <http://angg.twu.net/eev-current/README.html>
;; and: <http://angg.twu.net/eev-current/eev-langs.el.html>
;;
;; [a>1]^2 [b>0]^1 [b>0]^1
;; ---------------- -------
;; [a<1]^2 [b=0]^1 ab>b b>=1
;; ------- ------- ------------------
;; a=0 ab=0 ab>1
;; ---- -------- ----- -----
;; a~=1 ab=0 b=0\/b>0 ab~=1 ab~=1
;; ------- ----- -----------------------------------
;; a<1\/a>1 ab~=1 ab~=1
;; -------------------------------------
;; ab~=1
;;
(defun dnc-strings (str) (setq dnc-strings (ee-split str)))
(dnc-strings "[a<1]^2 [a>1]^2 [b=0]^1 [b>0]^1 a<1\\/a>1 a=0 ab=0 ab>1
ab>b ab~=1 a~=1 b=0\\/b>0 b>=1")
(defun dnc-to-number (str)
(let ((m (member str dnc-strings)))
(if m (- (length dnc-strings) (length m)))))
(defun dnc-to-dncnnn (str)
(let ((n (dnc-to-number str)))
(if n (format "dnc%d" n))))
;; (dnc-to-number "[a>1]^2")
;; (dnc-to-dncnnn "[a>1]^2")
;; (defun dnc-expand1 (str) (format "<%s>" str))
(defun dnc-expand1 (str) (or (dnc-to-dncnnn str)
(error "Not in dnc-strings: %S" str)))
(defun dnc-expand (bigstr)
(replace-regexp-in-string
"\\([^ \t\n]+\\)"
(lambda (str) (dnc-expand1 (substring str 1 -1)))
bigstr
'fixedcase))
;; (dnc-expand "fooa=0bar")
;; (dnc-expand "fooa=2bar")
;; (find-efunctiondescr 'replace-regexp-in-string)
;; (find-efunctiondescr 'match-string)
;; (find-elnode "Creating Strings")
;; (substring "abcdefg" 1 -1)
;; (find-efunction 'ee-aref)
;; (find-elnode "Index" "* member:")
;; (find-efunction 'eepitch-line)
;; (find-eev "eev-mini-steps.el" "eepitch-line")
(defun eepitch-line-orig (line)
(save-selected-window
(select-window (get-buffer-window eepitch-target-buffer))
(insert line) ; "type" the line
(call-interactively (key-binding "\r")))) ; then do a RET
(defun eepitch-line (line)
(eepitch-line-orig (dnc-expand line)))
;; (find-angg ".emacs" "eev-traffic-light-glyphs")
;; (find-efunction 'eev-math-glyphs-set)
;; (find-efunction 'eev-set-glyph)
;; (find-epalette my-palette)
;; (find-ecolor-links (ee-choosecolor "#6c1829"))
(eev-glyphs-set-face 'eev-glyph-dnc-open "red" nil)
(eev-glyphs-set-face 'eev-glyph-dnc-open "red" "#6c1829")
(eev-glyphs-set-face 'eev-glyph-dnc-close "gold" nil)
(eev-glyphs-set-face 'eev-glyph-dnc-close "magenta" nil)
(eev-glyphs-set-face 'eev-glyph-dnc-close "magenta" "#6c1829")
(eev-set-glyph ? ?< 'eev-glyph-dnc-open)
(eev-set-glyph ? ?> 'eev-glyph-dnc-close)
'("
# A test:
* (eepitch-shell)
* (eepitch-kill)
* (eepitch-shell)
echo a=0-ab=0
")
;; Local Variables:
;; coding: raw-text-unix
;; ee-anchor-format: "«%s»"
;; End: