From: tfheen Date: Thu, 26 Sep 2002 08:12:15 +0000 (+0000) Subject: Cleanup X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c313ffc07384bc47ae6a9e40c122929781ecc634;p=dotfiles Cleanup git-svn-id: file:///svn/tfheen/trunk/dotfiles@8 8da78d58-1cd3-0310-bee5-d77bd1b3e8bf --- diff --git a/emacs b/emacs index fdaa39f..618762f 100644 --- a/emacs +++ b/emacs @@ -1,151 +1,63 @@ +; -*- emacs-lisp -*- +; + +(message "loading .emacs-standard") +(load "~/.emacs-standard") (setq tfheen-color-preference 'light) ; light or dark -(if (not (string-match "Lucid" emacs-version)) - (setq xemacsp nil)) - -(if (not xemacsp) - (save-excursion - (if (string< "21" emacs-version ) - (set-language-environment "Latin-1") - (let () - (standard-display-european t) - (if (string< emacs-version "20") - (load-library "iso-syntax") ; emacs 19.x - (require 'latin-1)) ; emacs 20.x - (set-input-mode (car (current-input-mode)) - (nth 1 (current-input-mode)) - 0))))) +(cw/for-emacs + (set-language-environment "Latin-1")) ;(prefer-coding-system "utf-8") (add-to-list 'Info-default-directory-list (expand-file-name "~/usr/info")) -;(add-to-list 'Info-default-directory-list -; (expand-file-name "~/data/emacs/lisp/tramp/texi")) (add-to-list 'load-path (expand-file-name "~/data/emacs/lisp")) -;(add-to-list 'load-path (expand-file-name "~/data/emacs/lisp/tramp/lisp")) - -(require 'bbdb) -(setq tramp-default-method "rsync") +(cw/requiring-package (bbdb) + (bbdb-initialize 'gnus 'message 'w3) + (setq bbdb-use-pop-up nil + bbdb-quiet-about-name-mismatches t + bbdb-default-area-code nil + bbdb-north-american-phone-numbers-p nil + bbdb-user-mail-names "\(tollef|tfheen\)" + bbdb-offer-save 1 + bbdb-use-pop-up nil + mail-setup-hook 'bbdb-insinuate-sendmail) + (add-hook mail-setup-hook 'bbdb-define-all-aliases)) -(bbdb-initialize 'gnus 'message 'w3) - -(setq bbdb-use-pop-up nil - bbdb-quiet-about-name-mismatches t - bbdb-default-area-code nil - bbdb-north-american-phone-numbers-p nil - bbdb-user-mail-names "\(tollef|tfheen\)" - bbdb-offer-save 1 - bbdb-use-pop-up nil - mail-setup-hook 'bbdb-insinuate-sendmail) -(add-hook mail-setup-hook 'bbdb-define-all-aliases) (setq default-major-mode 'text-mode) (add-hook 'text-mode-hook 'turn-on-auto-fill) -(defun dos-to-unix () - (interactive) - (save-excursion - (goto-char (point-min)) - (replace-string "‘" "æ") - (replace-string "›" "ø") - (replace-string "†" "å") - (replace-string "’" "Æ") - (replace-string "" "Ø") - (replace-string "" "Å") - (replace-string " " "") - (replace-string "" "") - ) - ) - - -(defun text-to-html () - (interactive) - (save-excursion - (goto-char (point-min)) - (replace-string "æ" "æ") - (replace-string "æ" "ø") - (replace-string "å" "å") - (replace-string "Æ" "Æ") - (replace-string "Ø" "Ø") - (replace-string "Å" "Å") - ) - ) - (fset 'yes-or-no-p 'y-or-n-p) -(load-library "mailcrypt") -(mc-setversion "gpg") - -(autoload 'mc-install-write-mode "mailcrypt" nil t) -(autoload 'mc-install-read-mode "mailcrypt" nil t) -(add-hook 'mail-mode-hook 'mc-install-write-mode) -(add-hook 'mail-setup-hook 'mc-install-write-mode) - -(add-hook 'gnus-summary-mode-hook 'mc-install-read-mode) -(add-hook 'news-reply-mode-hook 'mc-install-write-mode) +(cw/requiring-package (mailcrypt) + (mc-setversion "gpg") + (autoload 'mc-install-write-mode "mailcrypt" nil t) + (autoload 'mc-install-read-mode "mailcrypt" nil t) + (add-hook 'mail-mode-hook 'mc-install-write-mode) + (add-hook 'mail-setup-hook 'mc-install-write-mode) + (add-hook 'gnus-summary-mode-hook 'mc-install-read-mode) + (add-hook 'news-reply-mode-hook 'mc-install-write-mode) + (setq mc-temp-directory (expand-file-name "~/tmp") + mc-encrypt-for-me t + mc-gpg-user-id "tfheen@opera.no" + mc-passwd-timeout 600)) (global-set-key "\M-n" 'browse-url-at-point) (global-set-key [(control backspace)] 'undo) (global-set-key [(control return)] 'find-tag) -;;; Custom stuff. -(setq load-path (cons "/usr/share/emacs/site-lisp" load-path)) -(condition-case () (require 'w3-auto "w3-auto") (error nil)) -(custom-set-variables - '(ecb-source-path (quote ("~/data/ntnu/SIF8005/prosjekt/risk/"))) - '(w3-user-fonts-take-precedence t) - '(browse-url-browser-function (quote browse-url-netscape) t) - '(browse-url-new-window-p t t) - '(browse-url-generic-program "opera" t) - '(browse-url-netscape-program "opera") - '(gnuserv-program (concat exec-directory "/gnuserv")) - '(tramp-multi-file-name-structure (quote ("\\`/r:\\(\\([a-z0-9]+\\)\\)?\\(\\(%s\\)+\\):\\(.*\\)\\'" 2 3 -1))) - '(tramp-make-tramp-file-format "/r:%m/%u@%h:%p") - '(tramp-file-name-regexp "\\`/r:") - '(tramp-make-multi-tramp-file-format (quote ("/r:%m" "/%m:%u@%h" ":%p"))) - '(tramp-auto-save-directory "/home/tfheen/tmp") - '(load-home-init-file t t) - '(py-beep-if-tab-change nil) - '(tramp-make-tramp-file-user-nil-format "/r:%m/%h:%p") - '(tramp-file-name-structure (quote ("\\`/r:\\(\\([a-zA-Z0-9]+\\)/\\)?\\(\\([-a-zA-Z0-9_#/:]+\\)@\\)?\\([-a-zA-Z0-9_#/:@.]+\\):\\(.*\\)\\'" 2 4 5 6))) - '(browse-url-temp-dir "~/tmp/") - '(nnmail-prepare-incoming-header-hook (quote (nnmail-fix-eudora-headers))) - '(jde-bug-vm-includes-jpda-p t) - '(w3-user-colors-take-precedence t)) - - (if (eq tfheen-color-preference 'dark) - (custom-set-faces - '(w3-style-face-00003 ((t (:foreground "#000000" :background "black"))) t) - '(w3-style-face-00002 ((t (:background "black"))) t) - '(w3-style-face-00001 ((t (:background "black"))) t) - '(custom-set-face ((((class color)) (:foreground "blue" :background "black")))) - '(font-lock-keyword-face ((((class color) (background dark)) (:foreground "Maroon")))) - '(show-paren-mismatch-face ((((class color)) (:bold t :foreground "Red")))) - '(gnus-cite-face-3 ((t (:foreground "Green")))) - '(gnus-cite-face-2 ((t (:foreground "LightBlue")))) - '(gnus-cite-face-1 ((t (:foreground "Yellow")))) - '(show-paren-match-face ((((class color)) (:bold t :foreground "White")))) - '(font-lock-builtin-face ((((class color) (background dark)) (:foreground "BlueViolet"))))) - (custom-set-faces - '(w3-style-face-00003 ((t (:foreground "#000000" :background "black"))) t) - '(w3-style-face-00002 ((t (:background "black"))) t) - '(w3-style-face-00001 ((t (:background "black"))) t) - - '(custom-set-face ((((class color)) (:foreground "blue" :background "black")))) - '(sh-heredoc-face ((((class color) (background light)) (:foreground "DarkGreen")))) - '(font-lock-keyword-face ((t (:foreground "DarkBlue"))) t) - '(font-lock-string-face ((t (:foreground "Blue"))) t) - '(mmm-default-submode-face ((t (:background "White"))) t) - '(show-paren-mismatch-face ((((class color)) (:bold t :foreground "Red")))) - '(gnus-cite-face-3 ((t (:foreground "DarkGreen")))) - '(gnus-cite-face-2 ((t (:foreground "DarkRed")))) - '(gnus-cite-face-1 ((t (:foreground "DarkBlue")))) - '(show-paren-match-face ((((class color)) (:bold t :foreground "White")))) - '(font-lock-builtin-face ((((class color) (background dark)) (:foreground "BlueViolet")))))) +(cw/requiring-package (w3-auto)) + +(setq browse-url-browser-function 'browse-url-netscape + browse-url-new-window-p t + browse-url-generic-program "opera" + browse-url-netscape-program "opera") + ;; File modes (autoload 'php-mode "php-mode" "PHP editing mode" t) @@ -175,12 +87,7 @@ perl-continued-brace-offset 0 perl-brace-offset -5 perl-brace-imaginary-offset 0 - perl-label-offset -5 - ) - -;(if (not xemacsp) -; (c-set-style "k&r")) - + perl-label-offset -5) (setq next-line-add-newlines nil compilation-window-height 10 @@ -196,34 +103,24 @@ (setq bar (cdr bar))) (reverse liste))) -(defun reverse-nnml-list-in-list (reverse-list) - (require 'cl) - (let '(bar (copy-list reverse-list)) - (setq liste (list)) - (while (car bar) - (let '(elem (car bar)) - (print (car elem)) - (add-to-list 'liste (list (car (cdr elem)) (concat "nnml:" (car elem)))) - (setq bar (cdr bar)))) - (reverse liste))) (setq py-honor-comment-indentation nil) (add-hook 'sgml-mode-hook '(lambda()(local-set-key "\C-c>" 'sgml-insert-end-tag))) (add-hook 'emacs-lisp-mode-hook '(lambda()(local-set-key "\C-j" 'find-function))) -(setq mc-temp-directory (expand-file-name "~/tmp") - mc-encrypt-for-me t - mc-gpg-user-id "tfheen@opera.no") ;(require 'template) ;(add-hook 'c-mode-common-hook 'tmpl-init) ;(add-hook 'c-mode-common-hook 'auto-insert-file-header) (add-hook 'c-mode-common-hook (lambda() (local-set-key "\M-\C-x" 'compile))) (add-hook 'c-mode-common-hook (lambda() (local-set-key "\M-\C-z" 'next-error))) -(require 'auto-header) + +(cw/requiring-package (auto-header)) + (setq header-full-name "Tollef Fog Heen" header-email-address "tollef@add.no" add-log-mailing-address "tfheen@debian.org" debian-changelog-mailing-address "tfheen@debian.org" tags-table-list (list (expand-file-name "~/usr/include/"))) + (setq sgml-local-catalogs (list "~/usr/lib/sgml/sgml.catalog")) ;; Find-file hooks @@ -238,86 +135,114 @@ ;; Visual fluff. -(if (not xemacsp) - (toggle-scroll-bar -1) - (setq scrollbars-visible-p nil)) +(cw/for-emacs + (toggle-scroll-bar -1) + (setq scrollbars-visible-p nil)) (setq scroll-bar-mode nil) + ; show-paren-style 'expression) ; Highlight matching/nonmatching parens ;(if (not xemacsp) ; (show-paren-mode t)) ; show-paren-mode takes too much cpu -(if (not xemacsp) - (global-font-lock-mode t) - (font-lock-mode 1)) -(if (not xemacsp) - (server-start)) +(cw/for-emacs + (global-font-lock-mode t) + (font-lock-mode 1) + (server-start)) ;; Multiple mode - -(require 'mmm-auto) -(setq mmm-global-mode 'maybe) -(custom-set-faces - '(w3-style-face-00003 ((t (:foreground "#000000" :background "black"))) t) - '(w3-style-face-00002 ((t (:background "black"))) t) - '(w3-style-face-00001 ((t (:background "black"))) t) - '(font-lock-string-face ((t (:foreground "Blue")))) - '(custom-set-face ((((class color)) (:foreground "blue" :background "black")))) - '(font-lock-keyword-face ((t (:foreground "DarkBlue")))) - '(show-paren-mismatch-face ((((class color)) (:bold t :foreground "Red")))) - '(gnus-cite-face-3 ((t (:foreground "DarkGreen")))) - '(gnus-cite-face-2 ((t (:foreground "DarkRed")))) - '(gnus-cite-face-1 ((t (:foreground "DarkBlue")))) - '(mmm-default-submode-face ((t (:background "White")))) - '(show-paren-match-face ((((class color)) (:bold t :foreground "White")))) - '(font-lock-builtin-face ((((class color) (background dark)) (:foreground "BlueViolet"))))) -(setq mc-passwd-timeout 600) - -(if (not xemacsp) - (require 'tramp)) - - -(if (and (not xemacsp) (= emacs-major-version 21)) - (progn - (blink-cursor-mode 0) - (tooltip-mode 0) - (tool-bar-mode 0) - (global-set-key [home] 'beginning-of-buffer) - (global-set-key [end] 'end-of-buffer) - (setq cursor-in-non-selected-windows nil))) +(cw/requiring-package + (mmm-auto) + (setq mmm-global-mode 'maybe) + (set-face-background 'mmm-default-submode-face "White")) + +(cw/requiring-package (tramp) + (setq tramp-multi-file-name-structure (quote ("\\`/r:\\(\\([a-z0-9]+\\)\\)?\\(\\(%s\\)+\\):\\(.*\\)\\'" 2 3 -1)) + tramp-make-tramp-file-format "/r:%m/%u@%h:%p" + tramp-file-name-regexp "\\`/r:" + tramp-make-multi-tramp-file-format (quote ("/r:%m" "/%m:%u@%h" ":%p")) + tramp-auto-save-directory "/home/tfheen/tmp" + tramp-make-tramp-file-user-nil-format "/r:%m/%h:%p" + tramp-default-method "rsync")) + +; '(tramp-file-name-structure (quote ("\\`/r:\\(\\([a-zA-Z0-9]+\\)/\\)?\\(\\([-a-zA-Z0-9_#/:]+\\)@\\)?\\([-a-zA-Z0-9_#/:@.]+\\):\\(.*\\)\\'" 2 4 5 6))) + +(cw/for-emacs-21 + (blink-cursor-mode 0) + (tooltip-mode 0) + (tool-bar-mode 0) + (global-set-key [home] 'beginning-of-buffer) + (global-set-key [end] 'end-of-buffer) + (setq cursor-in-non-selected-windows nil)) (global-set-key [C-tab] 'dabbrev-expand) -(setq mail-open-quote "«") -(setq mail-close-quote "»") - -(defun mail-insert-quote (arg) - "Insert the appropriate quote marks for Norwegian mail. -Inserts the value of `mail-open-quote' (normally «) or `mail-close-quote' -\(normally ») depending on the context. With prefix argument, always -inserts \" characters." - (interactive "*P") - (if arg - (self-insert-command (prefix-numeric-value arg)) - (insert - (cond ((or (bobp) - (save-excursion - (forward-char -1) - (looking-at "\\s(\\|\\s \\|\\s>"))) - mail-open-quote) - ((= (preceding-char) ?\\) - ?\") - (t - mail-close-quote))))) - -(add-hook 'diary-hook 'appt-make-list) + +;(add-hook 'diary-hook 'appt-make-list) +;(add-hook 'diary-hook 'appt-make-list) +;(diary 0) + +; Mode line (display-time) -(add-hook 'diary-hook 'appt-make-list) -(diary 0) (display-battery) +(setq display-time-format "%H:%M" + display-time-string-forms '(24-hours ":" minutes)) + (setq show-trailing-whitespace t) (setq-default indent-tabs-mode nil) (define-coding-system-alias 'iso885915 'iso-8859-15) -(setq display-time-format "%H:%M" - display-time-string-forms '(24-hours ":" minutes)) \ No newline at end of file + +;;; Custom stuff. +;(custom-set-variables +; '(ecb-source-path (quote ("~/data/ntnu/SIF8005/prosjekt/risk/"))) +; '(w3-user-fonts-take-precedence t) +; '(gnuserv-program (concat exec-directory "/gnuserv")) +; '(load-home-init-file t t) +; '(py-beep-if-tab-change nil) +; '(browse-url-temp-dir "~/tmp/") +; '(jde-bug-vm-includes-jpda-p t) +; '(w3-user-colors-take-precedence t)) + +;; (if (eq tfheen-color-preference 'dark) +;; (custom-set-faces +;; '(w3-style-face-00003 ((t (:foreground "#000000" :background "black"))) t) +;; '(w3-style-face-00002 ((t (:background "black"))) t) +;; '(w3-style-face-00001 ((t (:background "black"))) t) +;; '(custom-set-face ((((class color)) (:foreground "blue" :background "black")))) +;; '(font-lock-keyword-face ((((class color) (background dark)) (:foreground "Maroon")))) +;; '(show-paren-mismatch-face ((((class color)) (:bold t :foreground "Red")))) +;; '(gnus-cite-face-3 ((t (:foreground "Green")))) +;; '(gnus-cite-face-2 ((t (:foreground "LightBlue")))) +;; '(gnus-cite-face-1 ((t (:foreground "Yellow")))) +;; '(show-paren-match-face ((((class color)) (:bold t :foreground "White")))) +;; '(font-lock-builtin-face ((((class color) (background dark)) (:foreground "BlueViolet"))))) +;; (custom-set-faces +;; '(w3-style-face-00003 ((t (:foreground "#000000" :background "black"))) t) +;; '(w3-style-face-00002 ((t (:background "black"))) t) +;; '(w3-style-face-00001 ((t (:background "black"))) t) + +;; '(custom-set-face ((((class color)) (:foreground "blue" :background "black")))) +;; '(sh-heredoc-face ((((class color) (background light)) (:foreground "DarkGreen")))) +;; '(font-lock-keyword-face ((t (:foreground "DarkBlue"))) t) +;; '(font-lock-string-face ((t (:foreground "Blue"))) t) +;; '(mmm-default-submode-face ((t (:background "White"))) t) +;; '(show-paren-mismatch-face ((((class color)) (:bold t :foreground "Red")))) +;; '(gnus-cite-face-3 ((t (:foreground "DarkGreen")))) +;; '(gnus-cite-face-2 ((t (:foreground "DarkRed")))) +;; '(gnus-cite-face-1 ((t (:foreground "DarkBlue")))) +;; '(show-paren-match-face ((((class color)) (:bold t :foreground "White")))) +;; '(font-lock-builtin-face ((((class color) (background dark)) (:foreground "BlueViolet")))))) + +;; Custom + +;; (custom-set-faces +;; '(font-lock-string-face ((t (:foreground "Blue")))) +;; '(custom-set-face ((((class color)) (:foreground "blue" :background "black")))) +;; '(font-lock-keyword-face ((t (:foreground "DarkBlue")))) +;; '(show-paren-mismatch-face ((((class color)) (:bold t :foreground "Red")))) +;; '(gnus-cite-face-3 ((t (:foreground "DarkGreen")))) +;; '(gnus-cite-face-2 ((t (:foreground "DarkRed")))) +;; '(gnus-cite-face-1 ((t (:foreground "DarkBlue")))) +;; '(show-paren-match-face ((((class color)) (:bold t :foreground "White")))) +;; '(font-lock-builtin-face ((((class color) (background dark)) (:foreground "BlueViolet"))))) diff --git a/emacs-standard b/emacs-standard index 22f87a9..4f04c1e 100644 --- a/emacs-standard +++ b/emacs-standard @@ -1,6 +1,6 @@ ;; -*- mode: emacs-lisp -*- -;; $Id: emacs-standard,v 1.1 2002/09/26 07:12:54 tfheen Exp $ +;; $Id: emacs-standard,v 1.2 2002/09/26 08:12:15 tfheen Exp $ (require 'cl) (defmacro cw/for-emacs-20 (&rest body) @@ -8,7 +8,17 @@ ,@body)) (defmacro cw/for-emacs-21 (&rest body) - `(when (>= emacs-major-version 21) + `(when (and (>= emacs-major-version 21) + (not (string-match "Lucid" emacs-version))) + ,@body)) + +(defmacro cw/for-emacs (&rest body) + `(when (not (string-match "Lucid" emacs-version)) + ,@body)) + +(defmacro cw/for-xemacs-21 (&rest body) + `(when (and (>= emacs-major-version 21) + (string-match "Lucid" emacs-version)) ,@body)) (defmacro cw/for-host (host &rest body) @@ -103,3 +113,28 @@ str (setcdr (car alist) value)) (setq alist (cdr alist))))) +; Various functions + +(defun dos-to-unix () + (interactive) + (save-excursion + (goto-char (point-min)) + (replace-string "‘" "æ") + (replace-string "›" "ø") + (replace-string "†" "Ã¥") + (replace-string "’" "Æ") + (replace-string "" "Ø") + (replace-string "" "Å") + (replace-string " " "") + (replace-string "" ""))) + +(defun text-to-html () + (interactive) + (save-excursion + (goto-char (point-min)) + (replace-string "æ" "æ") + (replace-string "æ" "ø") + (replace-string "Ã¥" "å") + (replace-string "Æ" "Æ") + (replace-string "Ø" "Ø") + (replace-string "Å" "Å"))) diff --git a/gnus b/gnus index 31a6d47..6e91688 100644 --- a/gnus +++ b/gnus @@ -1,5 +1,16 @@ ;; -*- lisp -*- +(defun reverse-nnml-list-in-list (reverse-list) + (require 'cl) + (let '(bar (copy-list reverse-list)) + (setq liste (list)) + (while (car bar) + (let '(elem (car bar)) + (print (car elem)) + (add-to-list 'liste (list (car (cdr elem)) (concat "nnml:" (car elem)))) + (setq bar (cdr bar)))) + (reverse liste))) + (defun tfheen-random-from-list (list) (let ((r (random (list-length list)))) (while (> r 0) @@ -25,6 +36,29 @@ (add-hook 'nntp-server-opened-hook 'nntp-send-authinfo) (add-hook 'nntp-server-opened-hook 'nntp-send-mode-reader) +(setq mail-open-quote "«") +(setq mail-close-quote "»") + +(defun mail-insert-quote (arg) + "Insert the appropriate quote marks for Norwegian mail. +Inserts the value of `mail-open-quote' (normally «) or `mail-close-quote' +\(normally ») depending on the context. With prefix argument, always +inserts \" characters." + (interactive "*P") + (if arg + (self-insert-command (prefix-numeric-value arg)) + (insert + (cond ((or (bobp) + (save-excursion + (forward-char -1) + (looking-at "\\s(\\|\\s \\|\\s>"))) + mail-open-quote) + ((= (preceding-char) ?\\) + ?\") + (t + mail-close-quote))))) + + (setq nnmail-split-methods (list '("junk.2002" "^From:.*Cron") '("spam" "^From:.*lifeminders.com") @@ -183,6 +217,7 @@ (list (format-time-string "in-%Y-%m") ""))) (setq gnus-split-methods (reverse-nnml-list-in-list nnmail-split-methods)) (setq gnus-move-split-methods (reverse-nnml-list-in-list nnmail-split-methods)) +(add-hook 'nnmail-prepare-incoming-header-hook 'nnmail-fix-eudora-headers) (defun tfheen-maybe-sign () "Sign if appropiate. Only news. Selects correct sender." @@ -591,4 +626,4 @@ on multiple mail-followup-to headers" (add-hook 'message-header-setup-hook 'message-subject-strip-any-re) (setq gnus-treat-display-smileys nil) -(require 'deuglify) +(cw/requiring-package (deuglify))