;; specifial HTML-editing support functions (defun insert-date () ; insert the current date at point (interactive) (shell-command "date" t)) (defun insert-date-short () ; i'll have to update this in 5 years! (interactive) (shell-command "date +%h\\ %d\\ 19%y,\\ %H:%M" t) (exchange-dot-and-mark) ; jump to the end of the inserted material (backward-delete-char 1) ; delete the spurious newline (insert " ") ) (defun insert-std-date () ; i'll have to update this in 5 years! (interactive) (shell-command "date +19%y-%m-%d\\ %H:%M" t) (exchange-dot-and-mark) ; jump to the end of the inserted material (backward-delete-char 1) ; delete the spurious newline ) (defun insert-date-italics () (interactive) (insert "(") (shell-command "date +%d.%m.%y" t) (exchange-dot-and-mark) ; jump to the end of the inserted material (backward-delete-char 1) ; delete the spurious newline (insert ")")) (global-set-key [f1] 'insert-date-italics) (defun insert-as-anchor () ; if you have a href in the cut buffer (interactive) ; and want to create an anchor for it (insert "") (set-mark-command nil) (insert "") (exchange-dot-and-mark)) (global-set-key [f2] 'insert-as-anchor) (defun kill-html-tag () (interactive) (re-search-forward "<[^>]*>") (kill-region (match-beginning 0)(match-end 0)) ) (global-set-key [f3] 'kill-html-tag) (defun kill-html-region () (interactive) (re-search-forward "<\\([^>]*\\)>") (let ((p (match-beginning 0)) (s (buffer-substring (match-beginning 1) (match-end 1)))) (re-search-forward (concat "")) (kill-region p (match-end 0)))) (global-set-key [f4] 'kill-html-region) (defun insert-last-edit () ; insert the a "last changed on " line suitable for WWW (interactive) (insert "Last changed on ") (let ((p (point))) (insert ". Comments&corrections to mfx@cs.tu-berlin.de.") (goto-char p) (insert-std-date) (end-of-line))) (global-set-key [f5] 'insert-last-edit) (defun htmlify-region () ; change & < > to html counterparts (interactive) (narrow-to-region (region-beginning)(region-end)) (goto-char (region-beginning)) (while (search-forward "&" nil t) (replace-match "&" nil t)) (goto-char (region-beginning)) (while (search-forward "<" nil t) (replace-match "<" nil t)) (goto-char (region-beginning)) (while (search-forward ">" nil t) (replace-match ">" nil t)) (goto-char (region-beginning)) (while (search-forward "ä" nil t) (replace-match "ä" nil t)) (goto-char (region-beginning)) (while (search-forward "ö" nil t) (replace-match "ö" nil t)) (goto-char (region-beginning)) (while (search-forward "ü" nil t) (replace-match "ü" nil t)) (goto-char (region-beginning)) (while (search-forward "Ä" nil t) (replace-match "Ä" nil t)) (goto-char (region-beginning)) (while (search-forward "Ö" nil t) (replace-match "Ö" nil t)) (goto-char (region-beginning)) (while (search-forward "Ü" nil t) (replace-match "Ü" nil t)) (goto-char (region-beginning)) (while (search-forward "ß" nil t) (replace-match "ß" nil t)) (widen)) (global-set-key [f6] 'htmlify-region) (global-set-key [f7] "

********** CURRENTLY BEING EDITED **********

\n") (global-set-key [f8] "This page is part of the Trash Heap.") (defun comment-region () ; change < > to [ ] (interactive) (narrow-to-region (region-beginning)(region-end)) (goto-char (region-beginning)) (while (search-forward "<" nil t) (replace-match "[" nil t)) (goto-char (region-beginning)) (while (search-forward ">" nil t) (replace-match "]" nil t)) (widen)) (global-set-key [f9] 'comment-region) (defun uncomment-region () ; change [ ] to < > (interactive) (narrow-to-region (region-beginning)(region-end)) (goto-char (region-beginning)) (while (search-forward "[" nil t) (replace-match "<" nil t)) (goto-char (region-beginning)) (while (search-forward "]" nil t) (replace-match ">" nil t)) (widen)) (global-set-key [f10] 'uncomment-region) (defun entag-word (tag) ; fooo -> fooo (backward-word 1) (insert "<") (insert tag) (insert ">") (forward-word 1) (insert "") ) (defun mark-as-code () ; fooo -> fooo (interactive) (entag-word "code")) (global-set-key [(f11)] 'mark-as-code) ; emacs 19 ; (global-set-key [(control f1)] 'mark-as-code) ; xemacs 19 (defun repair-name () (interactive) (beginning-of-buffer) (while (search-forward "mfx@cs.tu.berlin.de" nil t) (replace-match "mfx@cs.tu-berlin.de" nil t)) (save-buffer) (kill-buffer (current-buffer)))