;;; teco.el Major Mode for editing MIT TECO code -*- coding: utf-8 -*- ;;; Copyright (c) 2006 Devon Sean McCullough ;;; Licensed under the GPL (GNU Public License) ; SAIL (Stanford Artificial Intelligence Laboratory) character set ; with similar looking glyphs from other character sets ; raw -%TOSAI +%TOSAI Key +%TXTOP Graphic HTML Unicode ; ^@ ↑@ c-@ · Centered Dot U+000B7 Middle Dot ;  ^A ↑A c-A ↓ Down Arrow U+02193 Downwards Arrow ; ^K ↑K c-K ↑ Up Arrow ↑ U+02191 Upwards Arrow ;  ^R ↑R c-R ∩ Intersection U+02229 Intersection ;  ^Z ↑Z Call ≠ Not Equal U+02260 Not Equal To ;  $ ◊ AltMode ◊ AltMode* ◊ U+025CA Lozenge ;  ^_ ↑_ BckNxt* ∨ Logical Or U+02228 Logical Or ; Space Space U+00020 Space ; ! ! ! ! ! Bang* U+00021 Exclamation Point ;;; ... ; ~ ~ ~ ~ ~ Tilde U+0007E Tilde ;  ^? ↑? RubOut ∫ Integral U+0222B Integral ; [*] ; "Lozenge" is a decent stand-in for the missing glyph Open Diamond Star ; "AltMode" has the same code as the ASCII Escape character, ; not to be confused with the KTV Escape key ; used to perform local terminal functions, e.g., ; complement video, buzz door, call elevator. ; "Bang" is printer jargon, rarely used by ITS hackers ; "BckNxt" is not a canonical abbreviation for the BackNext key ; but it fits within eigtht-wide tab stops. ; Not yet implemented but I needed a place to put this ; quick hack which I use to display TECO on the web. (defun teco-to-html-echo (beg end non-altmode-p) "Like ``ascii-to-html-echo'' but inverts prefix arg." (interactive "r\nP") (ascii-to-html-echo beg end (not non-altmode-p))) (defun ascii-to-html-echo (beg end altmodep) "Convert region from raw ascii control characters to html showing how they would echo. Prefix arg ALTMODEP converts esc to appear as Lozenge (Open-Diamond) rather than Up-Arrow Left-Square-Bracket." (interactive "r\nP") (save-excursion (goto-char beg) (setq end (copy-marker end t)) (insert "
")
    (while (search-forward-regexp "[\000-\010\013-\014\016-\037\177<>&]" end t)
      (replace-match (cond ((= (char-before) ?&) "&")
			   ((= (char-before) ?<) "<")
			   ((= (char-before) ?>) ">")
			   ((and altmodep
				 (= (char-before) ?\e)) "◊")
			   (t (format "↑%c"
				      (logxor ?@ (char-before)))))
		     t t))
    (goto-char end)
    (insert "
") (set-marker end nil)))