;; ~cymbala/.emacs
;; Emacs-Time-stamp: "2005-03-22 14:11:53 cymbala"
;; Emacs-File-stamp: "/home/cymbala/.emacs"
;;
(setq time-stamp-format "%:y-%02m-%:d %02H:%02M:%02S %u")
;;
(load-file "~cymbala/.emacs_essential")
(load "~cymbala/bin/rjc_fill.el")
;; (concat "~/" my-dns-mia "/archive/lenin/works/")
(setq my-dns-mia "www.marxists.org")
(load-file "~/bin/file-stamp.el")
(setq time-stamp-line-limit file-stamp-line-limit)
;;; SET-KEYs
;
(global-set-key [f13] 'save-buffers-kill-emacs)
;;; (global-set-key [f18] 'rjc-mail-signature-use-other)
(global-set-key [f20] 'iso-accents-mode)
(global-set-key [f21] 'iso-accents-mode) ; No shift-F9 ?
(global-set-key [f6] 'calendar)
(global-set-key [f7] '(lambda nil (interactive) (switch-to-buffer nil)))
(global-set-key "\C-x\C-b" 'buffer-menu)
;;
(setq user-mail-address "rCymbala@yahoo.com")
(setq user-mail-address "rCymbala@marxists.org")
(setq user-mail-address "cymbaLa-1@Lafn.org")
(setq user-mail-address "cymbaLa@Lafn.org")
(setq user-mail-address-default user-mail-address)
(add-hook 'mail-setup-hook
(lambda () (setq user-mail-address user-mail-address-default)))
;;; Thu Oct 12 08:57:17 PDT 2000
; But if FCEDIT is 'emacs -q' this will not get executed from ~/.emacs.
(setq auto-mode-alist
(append '(("^\\bash\\'" . shell-script-mode)) auto-mode-alist))
;;; Sat Jan 13 20:33:01 PST 2001
; Make C-c C-c evaluate buffer (similar to sending mail message).
(add-hook 'emacs-lisp-mode-hook
(lambda ()
(local-set-key "\C-c\C-c" 'eval-current-buffer)))
;;; Wed Apr 4 22:37:07 PDT 2001
; If mailcrypt package not installed and save not happening, evaluate
; next hook lines, but with "remove-hook" instead of "add-hook".
;;;
;;; Had to disable this when gnus install deleted semi + flim1.13...
;;;
(add-hook 'rmail-show-message-hook 'mc-install-read-mode)
(add-hook 'rmail-summary-mode-hook 'mc-install-read-mode)
(setq mc-default-scheme 'mc-scheme-gpg)
;;; Sun Mar 19 18:53:24 PST 2000
(display-time)
(setq display-time-day-and-date nil)
;;; Tue Jul 10 11:56:08 PDT 2001
;;; Sets ``sgml-custom-dtd'' (includes XML DocBk).
(setq spam "~/.50rjc-sgml-mode.el")
(if (file-exists-p spam)
(load spam))
;;; Sat Apr 8 17:12:49 PDT 2000
(setq spam "~/Db/db.el")
(if (file-exists-p spam)
(load spam))
;;; Wed Mar 22 14:10:27 PST 2000
;;; (require 'font-lock)
;;; font-lock-mode...
;;; *Messages*
;;; X windows are not in use or not initialized
;;; Thu Mar 16 20:53:42 PST 2000
(autoload 'db-find-file "database" "EDB database package" t)
(autoload 'load-database "database" "EDB database package" t)
(autoload 'byte-compile-database "database" "EDB database package" t)
;
(setq find-file-hooks (cons 'after-find-file-edb find-file-hooks))
(defun after-find-file-edb ()
"If this is a database file in EDB internal file layout, run EDB."
;; When this is called we are at the beginning of the buffer.
(if (looking-at ";; Database file written by EDB")
(progn
(require 'database)
(db-this-buffer)
;; db-this-buffer kills the current buffer; and an error results
;; when Emacs tries to switch back to it. find-file-noselect
;; uses the buf variable to hold the new buffer.
(setq buf (buffer-name (current-buffer))))))
;;; GNU Emacs Pocket Reference
(setq default-major-mode 'text-mode)
(add-hook 'text-mode-hook 'turn-on-auto-fill)
;
(setq-default abbrev-mode t)
(setq spam "~/.abbrev_defs")
(if (file-exists-p spam)
(read-abbrev-file spam))
(setq save-abbrevs t)
;;;
(setq mail-archive-file-name "~/.mail-archive-file-name")
; Fri May 26 20:17:47 PDT 2000
(setq mail-archive-file-name "~/_MAIL")
; Sun Jul 30 16:17:29 PDT 2000
; See also: "rjc-mail-change-fcc" (it has a default too).
;;; (setq mail-aliases t)
(setq mail-yank-prefix "> ")
;;; (add-hook 'mail-setup-hook 'spook)
(setq mail-signature t)
(setq rmail-delete-after-output t)
(setq rmail-summary-window-size 9)
;;; Email-related:
(add-hook 'mail-setup-hook
(lambda ()
(local-set-key "\C-c\C-z" 'rjc-mail-backup)))
(add-hook 'mail-setup-hook
(lambda ()
(local-set-key "\C-c\C-h" 'rjc-mail-yank-format)))
;; (add-hook 'sgml-mode-hook
;; (lambda ()
;; (local-set-key "\C-c\C-h" 'sgml-hide-tags)))
;; (add-hook 'sgml-mode-hook
;; (lambda ()
;; (local-set-key "\C-c\C-g" 'sgml-show-tags)))
;;; Sun Mar 19 18:53:24 PST 2000
;;; Emacs EDB
(global-set-key "\C-c\C-f" 'db-find-file)
;;; Mon May 1 12:00:20 PDT 2000
;;; HOW? (global-set-key "\C-c\C-l" '(shell-command "lockvc"))
;;; Sun Jul 23 12:36:26 PDT 2000
;;; ...each command that sets a bookmark will also save your bookmarks...
(setq bookmark-save-flag 1)
;;; Sun Jul 23 13:43:09 PDT 2000
(setq mail-signature-file "~/.signature")
(setq rjc-mail-signature-other "~/.signature_redpraxis")
;;; Sat Jul 29 00:26:30 PDT 2000
; Begin with "M-x calendar" to use diary.
(setq spam "~/.calendar")
(if (file-exists-p spam)
(progn
(setq diary-file spam)
(diary)))
;;; Thu Oct 5 09:18:40 PDT 2000
; With 'potato' up and down arrows do not go through minibuffer history.
(add-hook 'minibuffer-setup-hook
'(lambda ()
(local-set-key "\M-[A" 'previous-history-element)
(local-set-key "\M-[B" 'next-history-element)
))
;;; Wed Oct 11 06:05:41 PDT 2000
; Between Debian 'slink' and 'potato' keys [up] and [down] went away.
; Using C-h k it is seen that [up] arrow is ESC [ A ...
(add-hook 'dired-mode-hook
(lambda ()
(local-set-key "b" 'bury-buffer)))
(add-hook 'dired-mode-hook
(lambda ()
(local-set-key [up] 'dired-previous-line)))
(add-hook 'dired-mode-hook
(lambda ()
(local-set-key "\M-[A" 'dired-previous-line)))
(add-hook 'dired-mode-hook
(lambda ()
(local-set-key "\M-[B" 'dired-next-line)))
;;; Tue Aug 7 13:24:48 PDT 2001
;;; ~root/lout-mode-0.3.tar.gz <-- README
;;; # cp /tmp/lout-mode/lout-mode.el /usr/share/emacs/site-lisp/
(autoload 'lout-mode "lout-mode" "Major mode for editing Lout text" t)
(setq auto-mode-alist
(append '(("\\.lout\\'" . lout-mode)) auto-mode-alist))
;;; -------------------------------------------------------
; Rest of this file is mostly "rjc-" functions...
; -------------------------------------------------------
(setq rjc-format-time-yyyymmdd "%Y.%m.%d")
;;; Tue, 3 Jul 2001 09:50:32 -0700
(defun rjc-mail-store-spam-header (my-string)
"Store header from spam email."
(interactive "p")
(let ((my-spam-header-storage "~/Db/spam.headers"))
(save-excursion
(save-restriction
(beginning-of-buffer)
(setq my-beginning (point))
(search-forward-regexp "^$")
(forward-line)
(append-to-file my-beginning (point) my-spam-header-storage)
))))
;;; Sat, May 26, 2001
(defun rjc-text-one-line (my-string)
"Remove leading/trailing spaces and change newlines to spaces"
; Newlines first.
(while (string-match "\n" my-string)
(setq my-string (concat
(substring my-string 0 (match-beginning 0))
" "
(substring my-string (match-end 0)))))
; Leading white-space.
(while (string-match "^[ ]+" my-string)
(setq my-string (substring my-string (match-end 0))))
; Trailing white-space.
(while (string-match "[ ]+$" my-string)
(setq my-string (substring
my-string 0 (match-beginning 0))))
my-string)
(defun rjc-mail-store-file ()
"Update file using file in email if newer"
(interactive)
(unless (string= major-mode "rmail-mode")
(error "Buffer's major mode is not rmail-mode."))
(let (filename my-start my-end
my-mail-time-stamp my-file-time-stamp my-list
(my-rmail-buffer-name (buffer-name)))
(defun my-get-stamp (arg1)
(let (my-start my-regex)
(goto-char (point-min))
(setq my-regex (concat arg1 "-stamp: [\"<]"))
(if (search-forward-regexp my-regex nil t)
(progn
(setq my-start (point))
(if (string= "Time" arg1)
(progn
(search-forward-regexp "[0-9]+")
(search-forward-regexp "[0-9]+")
(search-forward-regexp "[0-9]+")
(search-forward-regexp "[0-9]+")
(search-forward-regexp "[0-9]+")))
(if (string= "File" arg1)
(search-forward-regexp "[^>\"]+"))
(buffer-substring my-start (point)))
(error (concat arg1 " stamp not found.")))))
(defun my-find-home-file (arg1)
(let (my-list)
(setq my-list (split-string arg1 "/"))
(shell-command (concat
"find ~ -regex .*/"
(car (nthcdr (- (length my-list) 2) my-list)) "/"
(car (nthcdr (- (length my-list) 1) my-list))))
(if (buffer-live-p (get-buffer "*Shell Command Output*"))
(progn
(set-buffer (get-buffer "*Shell Command Output*"))
(if (= 1 (count-lines (point-min) (point-max)))
(buffer-substring 1 (- (line-end-position) 1))
(error "More than 1 line in '*Shell Command Output'")))
nil)))
(save-excursion
(save-restriction
(goto-char (point-min))
(search-forward-regexp "Subject: ")
(setq filename (buffer-substring (point) (line-end-position)))
(unless (file-exists-p filename)
(if (my-find-home-file filename)
(setq filename (my-find-home-file filename))
(if (my-find-home-file (my-get-stamp "File"))
(setq filename ((my-get-stamp "File")))
(error (concat "File not found: " filename)))))
(unless (file-writable-p filename)
(if (my-find-home-file filename)
(setq filename (my-find-home-file filename))
(error (concat "File not found: " filename))))
;; Let's assume files under ~ are writable.
(set-buffer my-rmail-buffer-name)
(setq my-mail-time-stamp (my-get-stamp "Time"))
(shell-command (concat "head -"
time-stamp-line-limit " " filename))
(set-buffer "*Shell Command Output*")
(setq my-file-time-stamp (my-get-stamp "Time"))
(kill-buffer (get-buffer "*Shell Command Output*"))
(set-buffer my-rmail-buffer-name)
(goto-char (point-min))
(search-forward-regexp "^[ ]*$")
(forward-line)
(if (string-lessp my-file-time-stamp my-mail-time-stamp)
(write-region (point) (point-max) filename))
(delete-other-windows) (split-window-vertically)
(other-window 1)
(find-file-literally filename) (toggle-read-only)
(other-window 1)))))
;;; Sun, May 13, 2001
;; Example of a record in EDB database "url.dat":
;; ====== URL's ======
;; URL: http://www.oreilly.com/catalog/debian/chapter/index.html
;; title: Learning Debian GNU/Linux
;; date: 2001.05.26
;; notes: By Bill McCarty
;; ==================================================================
;;
;; To-DO: If just title (missing notes), it fails...
;;
(defun rjc-mail-store-url (args)
"Copy URL from subject (and title and notes, if any) from email to url.dat"
(interactive "p")
(let ((my-email-buffer-name "RMAIL")
(my-regexp-subject "^Subject: ")
(my-regexp-title "^[ ]*[Tt][Ii][Tt][Ll][Ee]:")
(my-regexp-notes "^[ ]*[Nn][Oo][Tt][Ee][Ss]?:")
(my-pt-start -1)
(my-pt-stop -1)
(my-url nil)
(my-title nil)
(my-notes nil)
(my-url-database "url.dat")
)
(save-excursion
(save-restriction
(if (not (equal my-email-buffer-name (buffer-name)))
(error "%s %s" "This buffer is not named:" my-email-buffer-name))
(beginning-of-buffer)
(if (search-forward-regexp my-regexp-subject)
(progn
(setq my-pt-start (point))
(end-of-line)
(setq my-pt-stop (point))
(setq my-url (buffer-substring my-pt-start my-pt-stop))
; Get title, if any.
(if (search-forward-regexp my-regexp-title nil nil)
(progn
(setq my-pt-start (point))
(forward-paragraph)
(setq my-pt-stop (point))
(setq my-title (buffer-substring my-pt-start my-pt-stop))
(setq my-title (rjc-text-one-line my-title)))
(setq my-title "?"))
(if (search-forward-regexp my-regexp-notes nil t)
(progn
(setq my-pt-start (point))
(forward-paragraph)
(setq my-pt-stop (point))
(setq my-notes (buffer-substring my-pt-start my-pt-stop))
(setq my-notes (rjc-text-one-line my-notes)))
(setq my-notes "?"))
(if (set-buffer my-url-database)
(progn
(db-view-mode)
(db-last-record)
(db-add-record)
(db-move-to-field-exact 0) ; ...URL
(insert my-url)
(db-move-to-field-exact 1) ; ...title
(insert my-title)
(db-move-to-field-exact 2) ; ...date
(rjc-insert-date-yyyymmdd nil)
(db-move-to-field-exact 3) ; ...notes
(insert my-notes)
; Done!
(db-view-mode)
(if (not (equal my-title "?"))
(message (concat my-url-database ": " my-title))
(message (concat my-url-database
": Need a TITLE for: " my-url)))))
;;; (rmail-delete-forward)
)
(error "Expression not found:" my-regexp-subject))
))))
;;; Mon Nov 6 06:19:48 PST 2000
(defun rjc-insert-date-yyyymmdd (arg1)
"Date"
(interactive "p")
(insert (format-time-string rjc-format-time-yyyymmdd)))
;;; Sun Mar 18 14:56:59 PST 2001
(defun rjc-insert-numbers ()
"Insert [TAB]# to end-of-file"
(interactive)
(let ((my_var "my_var") (counter 0))
(save-excursion
(save-restriction
(while (not (eq 1 (forward-line)))
(if (equal 0 counter)
(forward-line -1))
(setq counter (+ counter 1))
(end-of-line)
(insert (concat "\t" (format "%02d" counter) "\t"))
)
))))
;;; Tue Jul 4 22:00:13 PDT 2000
(defun rjc-lout-reference-types ()
"List of values for @Type allowed by Lout (see User's Guide)."
(interactive)
(setq text "LOUT: The only compulsory options are @Tag, @Type, and @Title...
@Type:
Book TechReport Article InBook
Proceedings MastersThesis InProceedings
PhDThesis Misc")
(message "%s" text)
(switch-to-buffer-other-window "*Messages*")
(goto-char (point-max))
)
;;; Sun Mar 11 08:16:23 PST 2001
;;
;; NOTE: This yanks at current point; could move to first line of
;; body to prevent yanking into header.
;;
(defun rjc-mail-yank-format ()
"Format yank text immediately after C-c C-y"
(interactive)
;--(save-excursion
;--(save-restriction
(let (
(my-pt-start nil) (my-pt-end nil)
(my-yank-start nil)
(my-date-line nil)
(my-from-value nil))
(exchange-point-and-mark) ;--assume C-c C-y last command.
(setq my-yank-start (make-marker))
(set-marker my-yank-start (point))
(re-search-forward (concat "^" mail-yank-prefix "Date: "))
(beginning-of-line)
(setq my-pt-start (point))
(end-of-line)
(setq my-date-line (buffer-substring my-pt-start (point)))
(message my-date-line)
(goto-char my-yank-start)
(re-search-forward (concat "^" mail-yank-prefix "From: "))
(setq my-pt-start (point))
(end-of-line)
(setq my-from-value (buffer-substring my-pt-start (point)))
;
(goto-char my-yank-start)
(re-search-forward (concat "^" mail-yank-prefix "$"))
(delete-region my-yank-start (point))
(insert (concat my-from-value " wrote:\n"))
(insert (concat my-date-line "\n"))
(insert " [...]")
))
;;; Sun Jun 25 20:08:58 PDT 2000
; Keep a copy of out-going email in /tmp directory.
; But, will over-write previous messages sent to same email address.
; Also, uses "Mark" from "Mark Gee <margk@dom.com>"
;
(defun rjc-mail-backup ()
"Save contents of buffer *mail* to a backup file."
(interactive)
(save-excursion
(set-buffer "*mail*")
(beginning-of-buffer)
(re-search-forward "To: ")
(setq beg (point))
; What if more than one addressee? ... (end-of-line)
(search-forward-regexp "[^,
]+")
(setq to-field (buffer-substring beg (point)))
; temporary-file-directory can be
; used below.
; See .bash_profile for emptying trash.
(setq my-date (format-time-string rjc-format-time-yyyymmdd))
(write-region 1 (buffer-size) (concat "~/Trash/"
"\*mail\*" "_" to-field "_" my-date))))
(add-hook 'mail-send-hook 'rjc-mail-backup)
;;; Tue May 30 15:00:22 PDT 2000
(defun rjc-lout-letter (arg)
"Insert a letter template using lout."
(interactive "p")
(setq letter "")
(setq letter (concat letter ""))
(setq letter (concat letter "@SysInclude { doc }\n"))
(setq letter (concat letter "@Document\n"))
(setq letter (concat letter " @InitialFont { Times Base 13p }\n"))
(setq letter (concat letter "//\n@Text @Begin\n\n"))
(setq letter (concat letter "@RightDisplay lines @Break {\n"))
(setq letter (concat letter "{}\n{}\n{}\n{}\n{}\n"))
(setq letter (concat letter "Robert J. Cymbala\n"))
(setq letter (concat letter "[ address ]\n"))
(setq letter (concat letter "\n"))
(setq letter (concat letter "@Date @Format { @Month @DayNum, @Year }\n"))
(setq letter (concat letter "}\n"))
(setq letter (concat letter "\n"))
(setq letter (concat letter "@LeftDisplay lines @Break {\n" ))
(setq letter (concat letter "T @DropCapTwo { he Union @LLP\n" ))
(setq letter (concat letter "___ }\n" ))
(setq letter (concat letter "@LLP\n" ))
(setq letter (concat letter "___\n" ))
(setq letter (concat letter "{}\n" ))
(setq letter (concat letter "Re. [ ___ ]\n" ))
(setq letter (concat letter "}\n\n" ))
(setq letter (concat letter "@LLP\nHello,\n\n" ))
(setq letter (concat letter "@PP\n" ))
(setq letter (concat letter "This is about...\n\n" ))
(setq letter (concat letter "@LeftDisplay lines @Break {\n" ))
(setq letter (concat letter "{}\n"))
(setq letter (concat letter "Sincerely,\n{}\n{}\n{}\nRobert Cymbala\n"))
(setq letter (concat letter "}\n" ))
(setq letter (concat letter "@End @Text" ))
(setq letter (concat letter "###\n#\n" ))
(setq letter (concat letter "" ))
(insert letter)
(exchange-point-and-mark)
)
;;; Sun Sep 24 23:10:36 PDT 2000
; Dropped .signeutral on 2001.04.06.
(defun rjc-mail-signature-use-other (args)
"Change signature of out-going mail message."
(interactive "p")
(save-excursion
(save-restriction
(let ((my-test "a"))
(setq sig (debian-file->string mail-signature-file))
(goto-char (point-max))
(backward-char (+ (length sig) 1))
(if (looking-at sig)
(progn
(message (concat
"Replacing string from "
mail-signature-file
" with string from "
rjc-mail-signature-other
"."))
(kill-forward-chars (length sig))
(insert-file-contents rjc-mail-signature-other)
))))))
;;; Mon Jan 29 10:23:32 PST 2001
(defun rjc-mail-insert-reply_to ()
"Insert 'Reply-To:' if mail from 'To:' is blocked by MAPS RBL."
; TESTING:
; (interactive "p")
; ... and above change "()" to "(args)"
(save-excursion
(save-restriction
(let ((my-email-address "") (header-boundary "") (my-pos ""))
(beginning-of-buffer)
; Find 'To:'
(setq header-boundary "^--text follows this line--")
(if (re-search-forward header-boundary nil t)
(progn
(if (re-search-backward "^[tT][oO]:[ ]+" nil t)
(progn
(re-search-forward "[ ]+" nil t)
(setq my-pos (match-end 0))
(re-search-forward "[\n, ]" nil t)
(setq my-email-address (buffer-substring my-pos
(match-beginning 0)))
(backward-char)
(if (looking-at "\n")
(progn
; Just one name in "To:" field.
(message "%s" my-email-address)
)))
(error "%s" "Did not find '^To: '.")))
(error "%s %s" "Did not find:" header-boundary))
; If just one value, see if it is in list of blocked domains.
; If value is in blocked list, add 'Reply-To:'
))))
(add-hook 'mail-send-hook 'rjc-mail-insert-reply_to)
;;; Wed Jul 26 00:13:35 PDT 2000
(defun rjc-mail-change-fcc ()
"Change default of '~/_MAIL' to a real file name."
(setq filename "")
(if (< (length filename) 1)
(setq filename (read-from-minibuffer
"Enter an RMAIL file for FCC: "
"XMAIL" nil nil)))
; 2000.07.27: Not working. If blank string given to read-from-minibuffer
; the abort below does not happen. Want to change from abort to simply
; deletion of FCC: line.
(save-excursion
(save-restriction
(end-of-buffer)
(goto-char (point-min))
(beginning-of-buffer)
(setq header-boundary "^--text follows this line--")
(if (re-search-forward header-boundary nil t)
(progn
(if (re-search-backward "^FCC: " nil t)
(progn
(if (< (length filename) 1)
(progn
(message "%s"
"No file name, deleting FCC field.")
;
(setq my-point (point))
(forward-line)
(delete-region my-point (point))
)
(search-forward " " nil t)
; Depends on value of mail-archive-file-name.
(search-forward "~/" nil t)
(kill-line)
(insert filename)
(message "%s %s%s" "Changed FCC to:" filename ".")
))
(message "%s" "Did not find '^FCC: '.")))
(message "%s %s" "Did not find:" header-boundary)))))
(add-hook 'mail-setup-hook 'rjc-mail-change-fcc)
;
; (rjc-mail-change-fcc "a")
; (rjc-mail-change-fcc "")
;;; Wed Aug 9 10:43:55 PDT 2000
(defun rjc-insert-date-verbal (args)
"Insert date."
(interactive "p")
(shell-command "date" t)
; Wed Aug 9 10:50:09 PDT 2000
(search-forward " ")(backward-char)(insert ",")
(search-forward-regexp "[0-9]+")(insert ",")
(setq start (point))
(search-forward-regexp "[A-Z]+")(delete-region start (point))
(end-of-line)(kill-line)
; Tue, Jan 16, 2001
)
;;; Sat Aug 26 17:08:50 PDT 2000
(defun rjc-sgml-convert-to-entities (args)
"Change ASCII characters to “ ... ” ... etc."
(interactive "p")
(let ((my-test "a"))
(save-excursion
(save-restriction
;
; <!-- see homepage.py, which uploads this file using PRE tags.
(beginning-of-buffer)
(while (re-search-forward "^<Body Text>" nil t)
(replace-match "
" t t))
(beginning-of-buffer)
(while (re-search-forward "^<Body Quote>" nil t)
(replace-match "
" t t))
(beginning-of-buffer)
(while (re-search-forward "^<End of Article>" nil t)
(replace-match "
" t t))
(beginning-of-buffer)
(while (re-search-forward "^<>" nil t)
(replace-match "
" t t))
; -->
;
; 22 is right-single-quote.
(beginning-of-buffer)
(while (search-forward "’" nil t)
(replace-match "’" t t))
; 223 is left-double-quote.
(beginning-of-buffer)
(while (search-forward "“" nil t)
(replace-match "“" t t))
; 227 is mdash;
(beginning-of-buffer)
(while (search-forward "—" nil t)
(replace-match "—" t t))
; 322 is left-double-quote.
(beginning-of-buffer)
(while (search-forward "Ò" nil t)
(replace-match "“" t t))
;
; 224 is right-double-quote.
(beginning-of-buffer)
(while (search-forward "”" nil t)
(replace-match "”" t t))
; 323 is right-double-quote.
(beginning-of-buffer)
(while (search-forward "Ó" nil t)
(replace-match "”" t t))
;
; 321 is em dash.
(beginning-of-buffer)
(while (search-forward "Ñ" nil t)
(replace-match "—" t t))
;
; 324 is left single quote;
(beginning-of-buffer)
(while (search-forward "Ô" nil t)
(replace-match "‘" t t))
;
; 325 is right single quote;
; (--possesive, contraction--).
(beginning-of-buffer)
(while (search-forward "Õ" nil t)
(replace-match "’" t t))
;
; 311 is horizontal ellipsis;
(beginning-of-buffer)
(while (search-forward "É" nil t)
(replace-match "…" t t))
;
; PLAIN CHARACTERS TO CONVERT TO ENTITIES.
; Horizontal ellipsis
(beginning-of-buffer)
(while (re-search-forward "[.][.][.]" nil t)
(backward-char 3)
(delete-char 3)
(insert "…"))
; Open double-quote:
(beginning-of-buffer)
(while (re-search-forward "[ \t]\"[A-Za-z]" nil t)
(backward-char 2)
(delete-char 1)
(insert "“"))
; Close double-quote:
; - - - - how to avoid:
; - - - - <literallayout format="linespecific" class="normal">
(beginning-of-buffer)
(while (re-search-forward "[A-Za-z.,]\"[ .]" nil t)
(backward-char 2)
(delete-char 1)
(insert "”"))
; Close single-quote (contraction or possessive):
(beginning-of-buffer)
(while (re-search-forward "'[a-z][ ,]" nil t)
(backward-char 3)
(delete-char 1)
(insert "’"))
; Long dash (--)
(beginning-of-buffer)
(while (re-search-forward " -- " nil t)
(backward-char 3)
(delete-char 2)
(insert "—"))
; accent (`)
(beginning-of-buffer)
(while (re-search-forward "`" nil t)
(backward-char 1)
(delete-char 1)
(insert "‘"))
))))
;;; Thu Sep 14 01:32:29 PDT 2000
(defun rjc-sgml-find-invalid-char (args)
"Look for invalid characters in mark-up."
(interactive "p")
(let ((my-test "a"))
; (save-excursion
; (save-restriction
;
; (beginning-of-buffer)
(re-search-forward "[^][,)(~><_.;: ?
@a-z=\*\+\"'0-9!\\#/| &$%^-]")))
;;; Insert entities for left- and right-double quote.
;; Sun Sep 17 17:42:28 PDT 2000
(defun rjc-insert-entities-dquo (arg1)
"Insert pair of double-quote entities and put point in middle."
(interactive "p")
(insert "“”")
(search-backward "&"))
;; With Debian 'slink' key [f15] worked for SHIFT-F3.
;; With Debian 'potato' it doesn't work, but is S-F3
;; (add-hook 'sgml-mode-hook
;; (lambda ()
;; (local-set-key [f15] 'rjc-insert-entities-dquo)))
;; (add-hook 'sgml-mode-hook
;; (lambda ()
;; (local-set-key [S-f3] 'rjc-insert-entities-dquo)))
;;; Sun Jan 14 19:46:23 PST 2001
(defun rjc-calendar-zeropad (args)
"Zero-pad days 1st through 9th in .calendar file, for sorting purposes"
(interactive "p")
(save-excursion
(save-restriction
(let ((my-test "a"))
(beginning-of-buffer)
; Is this .calendar?
(setq my-desired-file-name ".calendar")
(setq my-name (split-string (buffer-file-name) "/"))
(setq my-name (nthcdr
(- (length my-name) 1) my-name))
(if (not (equal (list my-desired-file-name) my-name))
(error "This buffer isn't .calendar!"))
; Ex.
; Jan 5[tab/space/comma]
(while (not (eq 1 (forward-line)))
(beginning-of-line)
(if (looking-at "[a-z][a-z][a-z] [0-9][ , ]")
(progn
(forward-char 4) (insert "0")
))
)
))))
;;; 2001.04.26
; SAMPLE:
; >Messages from the following e-mail addresses have been blocked:
; >
; >7sr9gi69@@compuserver.com
; >hkb@supanet.com
;
(defun rjc-mail-spam-contact (args)
"Send email to those who attempted to send SPAM email"
(interactive "p")
(let (
(my-find-string "Messages from the following e-mail addresses have been blocked:\n")
(my-counter 0)
(my-shrink "")
(my-foo "")
(my-cc "rCymbala@yahoo.com")
(my-pathfile "/tmp/.rjc-mail-spam-contact")
)
;(save-excursion
;(save-restriction
(beginning-of-buffer)
(setq my-shrink (concat "Hello!\n\n"
" Thanks for sending me mail.\n"
" However, it did not work because\n"
" Los Angeles Free-Net (LAFN) uses MAPS RBL.\n"
"\n"
" For more info:\n"
" http://mail-abuse.org/rbl/\n"
"\n"
" If you want to try again,\n"
" use this address:\n"
" rCymbala@yahoo.com\n\n"
"--\n"))
(write-region my-shrink nil my-pathfile)
(write-region (debian-file->string "~/.signature") nil my-pathfile t)
; Move to end of email header.
(re-search-forward "^$")
(forward-char 1)
(if (not (looking-at my-find-string))
(error "Oops, string not found!"))
; How many newlines in find-string?
(setq my-shrink my-find-string)
(while (string-match "\n" my-shrink)
(setq my-counter (+ 1 my-counter))
(setq my-shrink (substring my-shrink (+ 1 (match-beginning 0))))
)
(forward-line my-counter)
; Every "@" should be part of address.
(setq my-counter 0)
(setq my-shrink (buffer-substring (point) (point-max)))
; Some addresses have "@@"
; ... 7sr9gi69@@compuserver.com
(while (string-match "[^ \t\n@]+@[^@ \t\n]+" my-shrink)
(setq my-counter (+ 1 my-counter))
; Note what happens w/ "...sending..."
; !!!
(setq my-foo (match-string 0 my-shrink))
(message " ..sending.. %d %s" my-counter my-foo)
(call-process "mail" my-pathfile nil nil my-foo my-cc)
(setq my-shrink (substring my-shrink (match-end 0))))
(message "Found %d email addresses." my-counter)
(view-buffer-other-window "*Messages*")
(goto-char (point-max))
(recenter)
(other-window 1)
)) ;))
(defun rjc-i2e (my-prefix-arg)
"Pass word at point to i2e within *shell*; assumes ``dpkg -i i2e''"
(interactive "P")
(let (
(my-word "Mmm"))
(save-excursion
(save-restriction
(save-current-buffer
(forward-char 1)
(backward-word 1)
(mark-word 1)
(setq my-word (buffer-substring (point) (mark)))
(if (< (count-windows) 2)
(split-window-vertically))
(other-window 1)
(shell)
(end-of-buffer)
; Drop "s" from "...es"
(setq my-word-minus-two (substring my-word (- (length my-word) 2)))
(if (or (equal "as" my-word-minus-two)
(equal "es" my-word-minus-two)
(equal "os" my-word-minus-two))
(setq my-word (substring my-word 0 (- (length my-word) 1))))
;
(insert (concat "i2e.sh" " "
(if (not my-prefix-arg)
"-r ")
my-word))
(comint-send-input)
(sleep-for 1)
(recenter (- (window-height) 2))
(other-window 1))))))
;;; Fri Oct 18 12:32:19 PDT 2002
(add-hook 'debian-changelog-mode-hook 'my-debian-changelog-mode-hook)
(defun my-debian-changelog-mode-hook ()
(make-local-variable 'add-log-mailing-address)
(setq add-log-mailing-address "cymbala@lafn.org"))
;;; Mon Jan 6 10:04:33 PST 2003
(add-hook 'sgml-mode-hook (lambda () (set 'fill-column 80)))
;; Always have this file open so it can be updated using rjc-mail-store-url.
(db-find-file "~/Db/url.dat")
; (copy-file "~/Lafn/schedule.html" "/officed@www.lafn.org:/" t)
;
; Local Variables:
; eval: (standard-display-european t)
; End: