;; This file: ;; http://angg.twu.net/.emacs.templates ;; http://angg.twu.net/.emacs.templates.html ;; file:///home/edrx/TH/L/.emacs.templates.html ;; (find-angg ".emacs.templates") ;; (find-angg ".emacs") ;; (find-angg ".emacs" ".emacs.papers") ;; (find-angg ".emacs" ".emacs.templates") ;; «.ee-template» (to "ee-template") ;; «.ee-template-expand» (to "ee-template-expand") ;; «.find-qtdemo-links» (to "find-qtdemo-links") ;; «.find-dn4tex-links» (to "find-dn4tex-links") ;; «.s2008a» (to "s2008a") ;; «.ee-mkdl» (to "ee-mkdl") ;; «.find-mkdl» (to "find-mkdl") ;; «.ee-ps2pdf-script» (to "ee-ps2pdf-script") ;; «ee-template» (to ".ee-template") ;; «ee-template-expand» (to ".ee-template-expand") ;; (find-efunction 'replace-regexp-in-string) ;; (find-elnode "Index" "* replace-regexp-in-string:") ;; (find-elnode "Search and Replace") ;; (find-elnode "Association Lists") ;; (cadr (assoc "b" '(("a" "AA") ("b" "CC") ("c" "CC")))) ;; (find-efunction 'find-psne-links) ;; Moved to: ;; (find-eev "eev-insert.el") ;; (find-eev "eev-insert.el" "ee-template") ' (defun ee-template (pairs template) (let ((f (lambda (match) (or (cadr (assoc (match-string 1 match) pairs)) match)))) (replace-regexp-in-string "{\\([^{}]+\\)}" f template 'fixedcase))) ;; Two demos: ' (ee-template '(("a" "AA") ("b" "CC") ("c" "CC")) "foo{a}bar{bla}poo{b}bletch") ' (ee-template '(("http" "https") ("a/b/" "foo/bar/") ("c" "index.html")) " (eepitch-shell) mkdir -p $S/{http}/{a/b/} cd $S/{http}/{a/b/} wget '{http}://{a/b/}{c}' echo '{http}://{a/b/}{c}' >> ~/.psne.log") ;; «find-qtdemo-links» (to ".find-qtdemo-links") ;; (find-qtdemo-links) (defun find-qtdemo-links (&optional name &rest rest) (interactive) (setq name (or name "{qtdemo}")) (find-elinks `((find-qtdemo-links ,name ,@rest) (find-angg ".emacs.templates" "find-qtdemo-links") (find-angg ".emacs" "qt") (find-qtprogrammingw3m "toc.html") (find-qt4docfile "") (find-es "qt") "" ,(ee-template `(("qtdemo" ,name)) "# rm -Rv /tmp/{qtdemo}/ mkdir /tmp/{qtdemo}/ cd /tmp/{qtdemo}/ cat > {qtdemo}.pro <<'%%%' TEMPLATE = app CONFIG += qt warn_on HEADERS = SOURCES = main.cpp TARGET = {qtdemo} QTDIR_build:REQUIRES=\"contains(QT_CONFIG, small-config)\" %%% cat > main.cpp <<'%%%' #include #include int main(int argc, char *argv[]) { QApplication app(argc, argv); QPushButton hello(\"Hello world!\"); hello.resize(100, 30); hello.show(); return app.exec(); } %%% qmake-qt4 -project qmake-qt4 {qtdemo}.pro make CXX=\"gcc -g\" |& tee om #")))) ;; «find-dn4tex-links» (to ".find-dn4tex-links") ;; (find-angg ".emacs" "find-dn4tex-links") ;; (define-key eev-mode-map "\M-h\M-u" 'find-dn4tex-links) ;; Test: ;; (find-dn4tex-links) ;; (defun find-dn4tex-links (&optional stem &rest rest) "Visit a temporary buffer containing hyperlinks for dn4tex." (interactive) (setq stem (or stem "{stem}")) (apply 'find-elinks `( (find-dn4tex-links ,stem ,@rest) "" ,(ee-template `(("stem" ,stem)) "\ % (find-angg \"LATEX/{stem}.tex\") % (find-dn4ex \"edrx08.sty\") % (find-angg \".emacs.templates\" \"s2008a\") % (defun c () (interactive) (find-zsh \"cd ~/LATEX/ && ~/dednat4/dednat41 {stem}.tex && latex {stem}.tex\")) % (defun c () (interactive) (find-zsh \"cd ~/LATEX/ && ~/dednat4/dednat41 {stem}.tex && pdflatex {stem}.tex\")) % (eev \"cd ~/LATEX/ && Scp {stem}.{dvi,pdf} edrx@angg.twu.net:slow_html/LATEX/\") % (defun d () (interactive) (find-dvipage \"~/LATEX/{stem}.dvi\")) % (find-dvipage \"~/LATEX/{stem}.dvi\") % (find-pspage \"~/LATEX/{stem}.pdf\") % (find-pspage \"~/LATEX/{stem}.ps\") % (find-zsh0 \"cd ~/LATEX/ && dvips -D 300 -o {stem}.ps {stem}.dvi\") % (find-zsh0 \"cd ~/LATEX/ && dvips -D 600 -P pk -o {stem}.ps {stem}.dvi && ps2pdf {stem}.ps {stem}.pdf\") % (find-zsh0 \"cd ~/LATEX/ && dvips -D 300 -o tmp.ps tmp.dvi\") % (find-pspage \"~/LATEX/tmp.ps\") % (ee-cp \"~/LATEX/{stem}.pdf\" (ee-twupfile \"LATEX/{stem}.pdf\") 'over) % (ee-cp \"~/LATEX/{stem}.pdf\" (ee-twusfile \"LATEX/{stem}.pdf\") 'over)\n \\documentclass[oneside]{book} \\usepackage[latin1]{inputenc} \\usepackage{edrx08} % (find-dn4ex \"edrx08.sty\") %L process \"edrx08.sty\" -- (find-dn4ex \"edrx08.sty\") \\input edrxheadfoot.tex % (find-dn4ex \"edrxheadfoot.tex\") \\begin{document}\n \\input {stem}.dnt\n % % (eedn4-51-bounded)\n Index of the slides: \\msk % To update the list of slides uncomment this line: %\\makelos{tmp.los} % then rerun LaTeX on this file, and insert the contents of \"tmp.los\" % below, by hand (i.e., with \"insert-file\"): % (find-fline \"tmp.los\") % (insert-file \"tmp.los\")\n %\n \\end{document}\n % L\157cal Variables: % coding: raw-text-unix % ee-anchor-format: \"«%s»\" % End:\n") ) rest)) ;; «s2008a» (to ".s2008a") ;; (find-angg ".emacs.templates" "s2008a") ;; Used to create section headers for some LaTeX files. ;; (find-LATEX "2008comprcat.tex") ;; (defalias 's 's2008a) ;; Example: ' (eesteps '( (find-estring (format "%% %S\n" '(s2008a "Slide: foo bar" "foo-bar"))) "M-e")) (defun s2008a (title tag) (insert (ee-template `(("title" ,title) ("tag" ,tag) ("line" ,(ee-no-trailing-nl (ee-no-properties (ee-delete-and-extract-line 1))))) "\ % «.{tag}» (to \"{tag}\") \\newpage % -------------------- % «{tag}» (to \".{tag}\") {line} \\myslide {{title}} {{tag}} "))) (defalias 's 's2008a) (defun sec2008a (title tag) (insert (ee-template `(("title" ,title) ("tag" ,tag) ("line" ,(ee-no-trailing-nl (ee-no-properties (ee-delete-and-extract-line 1))))) "\ % «.{tag}» (to \"{tag}\") % -------------------- % «{tag}» (to \".{tag}\") {line} \\mysection {{title}} {{tag}} "))) (defalias 'sec 'sec2008a) (defun chap2008a (title tag) (insert (ee-template `(("title" ,title) ("tag" ,tag) ("line" ,(ee-no-trailing-nl (ee-no-properties (ee-delete-and-extract-line 1))))) "\ % «.{tag}» (to \"{tag}\") % -------------------- % «{tag}» (to \".{tag}\") {line} \\mychapter {{title}} {{tag}} "))) (defalias 'chap 'chap2008a) ;; «ee-mkdl» (to ".ee-mkdl") ;; «find-mkdl» (to ".find-mkdl") ;; (find-dn4 "Makefile.base") ;; Make a download block for my makefiles ;; (find-efunction 'eeurl-u-to-f) ;; (find-efunction 'ee-template) ;; (find-estring (ee-mkdl "FOO" "http://foo.org/bar/plic.tgz")) ;; (find-mkdl "STEM" "http://foo/bar/plic.tgz") (defun find-mkdl (STEM url) (interactive (list "STEM" "http://foo/bar/plic.tgz")) (find-elinks `((find-mkdl ,STEM ,url) nil ,(ee-mkdl STEM url)))) (defun ee-mkdl (STEM url) (let* ((localurl (replace-regexp-in-string "^\\(https?\\|ftp\\)://" "\\1/" url)) (localurldir (file-name-directory localurl))) (ee-template `(("http://www.foo.org/bar/plic.tgz" ,url) ( "http/www.foo.org/bar/plic.tgz" ,localurl) ( "http/www.foo.org/bar/" ,localurldir) ("STEM" ,STEM) ("stem" ,(downcase STEM))) "\ {STEM}URL = {http://www.foo.org/bar/plic.tgz} {STEM}TGZ = $(S)/{http/www.foo.org/bar/plic.tgz} {STEM}TGZDIR = $(S)/{http/www.foo.org/bar/} {stem}download: $({STEM}TGZ) $({STEM}TGZ): mkdir -p $({STEM}TGZDIR) cd $({STEM}TGZDIR) && \\ $(wget) $({STEM}URL) "))) ;; «ee-ps2pdf-script» (to ".ee-ps2pdf-script") ;; (find-efunctiondescr 'ee-template) ;; (ee-ps2pdf-script "$S/http/foo/" "stem" ".ps.gz") (defun ee-ps2pdf-script (dir stem ext) (ee-template `(("$S/http/foo/" ,dir) ("stem" ,stem) (".ps.gz" ,ext)) "cd {$S/http/foo/} && zcat {stem}{.ps.gz} | ps2pdf - {stem}.pdf")) ;; ;; Local Variables: ;; mode: emacs-lisp ;; coding: raw-text-unix ;; ee-delimiter-hash: "\n#\n" ;; ee-delimiter-percent: "\n%\n" ;; ee-anchor-format: "«%s»" ;; ee-comment-prefix: ";;" ;; End: