Warning: this is an htmlized version!
The original is across this link,
and the conversion rules are here.
;; My .emacs was getting too big, so I moved the functions related to
;; TeX to this file.
;; Edrx, 2004mar25

;; «.diagskel»	(to "diagskel")
;; «.dednames»	(to "dednames")


;; (find-e20node "Single Shell")
;; (describe-function 'shell-command-on-region)
;; Very old: (find-angg "TCL/dednames")
;; New:      (find-dn4 "dednames.lua")
;;
;; «dednames»  (to ".dednames")
;;
(defun dednames () (interactive)
  (kill-region (point) (mark))
  (yank)
  (yank)
  (shell-command-on-region (point) (mark) "~/TCL/dednames" t t))

;; «diagskel»  (to ".diagskel")
;; Moved to: (find-angg ".emacs.templates" "diagskel")

(defun my-replace-file-extension (fname regex replacement)
  (if (string-match regex fname)
      (replace-match replacement t t fname)
    fname))
;; Example: (my-replace-file-extension "foo.tex" "\\.tex$" ".auto.dnt")

(defun find-defded (fname dedtag &rest rest)
  (apply 'find-fline
	 (or fname (my-replace-file-extension
		    buffer-file-name "\\.tex$" ".auto.dnt"))
	 (format "\\defded{%s}{" dedtag) rest))

;; «totoc»  (to ".totoc")
;; (find-elnode "Syntax of Regexps")

(defun totoc () (interactive)
  (fooi-re "{\\\\bf \\(.*\\)}\n\\\\label{\\(.*\\)}"
	   (concat "% «.\\2»\t\t(to \"\\2\")\n"
		   "% «T\\2»  (to \"\\2\")\n"
		   "  \\\\tocline {\\1} {\\2}\n"
		   "\\\\newpage\n"
		   "\n"
		   "%%%%\n"
		   "%\n"
		   "% «\\2»  (to \".\\2\")\n"
		   "% (to \"T\\2\")\n"
		   "%\n"
		   "%%%%\n"
		   "\n"
		   "{\\\\bf \\1}\n"
		   "\\\\label{\\2}")))

' (progn (set-mark-command nil)
	 (insert "{\\bf Dependent products, dependent sums}\n")
	 (insert "\\label{dep-prods-dep-sums}\n")
	 (exchange-point-and-mark)
	 (totoc))


;; «ee-el»  (to ".ee-el")
;;
(defun ee-el-do-here ()
  "If right after point there's a series of \"% ...\" lines, then 
a line like \"%EL <sexp>\", then execute <sexp> and leave the point
after it."
  (if (looking-at "\\([%#]\\([ \t][^\n]*\\)?\n\\)*[%#]EL")
      (progn (goto-char (match-end 0))
	     (eval (read (current-buffer))))))
(defun ee-el-do ()
  "Execute the %EL-sexp in the beginning of the current TeX block.
See `ee-el-do-here'."
  (interactive)
  (save-excursion
    (goto-char (ee-search-backward ee-delimiter-percent))
    (ee-el-do-here)))
(defun ee-el-tex-this ()
  "Return the eev TeX block around point."
  (save-excursion
    (buffer-substring-no-properties
     (ee-search-backward ee-delimiter-percent)
     (ee-search-forward  ee-delimiter-percent))))
(defun ee-el-eev (anchor)
  "Return the eev shell block around the anchor ANCHOR."
  (save-excursion
    (to anchor)
    (buffer-substring-no-properties
     (ee-search-backward ee-delimiter-hash)
     (ee-search-forward  ee-delimiter-hash))))
(defun ee-el-tex-this-after (anchor)
  "Used at %EL-TeX blocks that are to be prefixed (in the tmp.tex file) by
other %EL-TeX blocks. See the source."
  (concat
   (save-excursion (to anchor) (ee-el-do))
   ee-delimiter-percent
   (ee-el-tex-this)))
(defun ee-el-tex-this-with (anchor eevstring)
  "Used at top-level %EL-TeX blocks.
ANCHOR specifies where to start getting the TeX headers from, and EEVSTRING
is what is to be executed by the next \"ee\" at a shell."
  (eev (concat (ee-el-tex-this-after anchor)
	       ee-delimiter-percent
	       "\\end{document}\n")
       nil eelatex-file)
  (eev eevstring)
  (message "Wrote %s and %s" eelatex-file ee-file))



;;;;;
;;
;; «dout»  (to ".dout")
;;
;;;;;

;; (find-angg ".zshrc" "dout")
;; (find-angg "~/LATEX/dout/doutfont.el")
;;
(defun dout () (interactive)
  (find-fline "~/LATEX/dout/")
  (load-file "~/LATEX/dout/doutfont.el"))

;; (find-elnode "Macros")
;; (find-elnode "Simple Macro")
;; (find-elnode "Backquote")

;; (find-fline "~/LATEX/dout/defs-dnt.tex")
;; (find-fline "~/LATEX/dout/Makefile")
;; (find-fline "~/LATEX/dout/tmp-only.tex")
;;
(defun eedout (s &optional e)
  (interactive "r")
  (ee-write-with-nl s e
		    "%L processfile \"defs-dnt.tex\"\n" ""
		    "~/LATEX/dout/tmp.metatex")
  (eev "cd ~/LATEX/dout/
make tmp-only.metatex-clean
make tmp-only.dvi && rexdvi tmp-only.dvi")
  "Wrote ~/LATEX/dout/tmp.metatex and $EE")

;; (ee-define-bounded eedout eedout-bounded ee-delimiter-percent)
;; (eeb-define eedout eedout-bounded1 eedout-bounded ee-delimiter-percent)
;;
;; (find-fline "~/LATEX/dout/")





;;;;;
;;
;; «source2e-parts»  (to ".source2e-parts")
;;
;;;;;

;; (find-es "tex" "source2e.dvi")
;;
'(		; comment out the source2e block (start)
(code-c-d "latexsrc" "~/usrc/latex/base/")

(setq source2e-parts-list
  '("a" "ltdirchk.dtx"   1 "b" "ltplain.dtx"   13 "c" "ltvers.dtx"    24
    "d" "ltdefns.dtx"   26 "e" "ltalloc.dtx"   40 "f" "ltcntrl.dtx"   42
    "g" "lterror.dtx"   46 "h" "ltpar.dtx"     55 "i" "ltspace.dtx"   57
    "j" "ltlogos.dtx"   69 "k" "ltfiles.dtx"   70 "l" "ltoutenc.dtx"  80
    "m" "ltcounts.dtx" 112 "n" "ltlength.dtx" 116 "o" "ltfssbas.dtx" 117
    "p" "ltfsstrc.dtx" 137 "q" "ltfsscmp.dtx" 160 "r" "ltfssdcl.dtx" 165
    "s" "ltfssini.dtx" 186 "t" "fontdef.dtx"  192 "u" "preload.dtx"  209
    "v" "ltfntcmd.dtx" 213 "w" "ltpageno.dtx" 221 "x" "ltxref.dtx"   222
    "y" "ltmiscen.dtx" 226 "z" "ltmath.dtx"   235 "A" "ltlists.dtx"  245
    "B" "ltboxes.dtx"  260 "C" "lttab.dtx"    271 "D" "ltpictur.dtx" 293
    "E" "ltthm.dtx"    315 "F" "ltsect.dtx"   319 "G" "ltfloat.dtx"  329
    "H" "ltidxglo.dtx" 345 "I" "ltbibl.dtx"   347 "J" "ltpage.dtx"   350
    "K" "ltoutput.dtx" 353 "L" "ltclass.dtx"  408 "M" "lthyphen.dtx" 426
    "N" "ltfinal.dtx"  428 "O" "ltpatch.ltx"  436))

(defun source2e-tofname (charorfname)
  (if (= 1 (length charorfname))
      (second (member charorfname source2e-parts-list))
    charorfname))
(defun source2e-topage (charorfname)
  (second (member (source2e-tofname charorfname) source2e-parts-list)))

(defun find-source2e (charorfname &rest rest)
  (let ((fullfname (ee-latexsrcfile (source2e-tofname charorfname))))
    (if (not rest) (find-fline fullfname)
      (find-fline fullfname "\\begin{macrocode}")
      (re-search-forward "\n\\([^%]\\|$\\|%<\\)" nil nil (car rest))
      (ee-goto-rest (cdr rest)))))

(defun find-source2epage (charorfname)
  (let* ((page (source2e-topage charorfname))
	 (realpage (+ 9 page))
	 (dvifname (ee-latexsrcfile "source2e.dvi")))
    (find-dvipage dvifname realpage)))

;; (find-dvipage (ee-latexsrcfile "doc.dvi") 23)
;; (find-latexsrcfile "doc.dtx" "\n\n")

;; (find-latexsrcfile "source2e.ind")
;; (find-latexsrcfile "source2e.ind" "\\ttfamily equation")
;; (source2e "z-197")
;;
(defun source2e-ind (&rest rest) (interactive)
  (apply 'find-latexsrcfile "source2e.ind" rest))
(defun source2e (s &optional e arg)
  (interactive "r\nP")
  (let* ((str (ee-se-to-string s e))
	 (c (substring str 0 1))
	 (n (string-to-number (substring str 2))))
    (if (not arg) (find-source2e c n)
      (find-source2epage c))))

)		; comment out the source2e block (end)


(defun my-head-s (s) (concat "\
%%%%
%
% «." s "»	(to \"" s "\")
% «" s "»  (to \"." s "\")
%
%%%%

"))

(defun my-h (s e)
  (interactive "r")
  (let ((tag (buffer-substring s e)))
    (beginning-of-line)
    (insert (my-head-s tag))))



;;
;; Local Variables:
;; coding:               raw-text-unix
;; ee-delimiter-hash:    "\n#*\n"
;; ee-delimiter-percent: "\n%*\n"
;; ee-anchor-format:     "«%s»"
;; ee-charset-indicator: "Ñ"
;; End: