;; .emacs -- Dan Jacobson's personal .emacs file ;; Author : Dan Jacobson http://jidanni.org/ ;; Copyright : http://www.fsf.org/copyleft/gpl.html ;; Created On : 1986? ;; Last Modified On: Fri May 9 09:50:51 2008 ;; Update Count : 654 ;; Status : yuck (blink-cursor-mode 0) (kill-buffer "*scratch*") (add-hook 'emacs-lisp-mode-hook '(lambda () (turn-on-auto-fill) (or (string-equal buffer-file-name "/home/jidanni/.newsrc.eld") (add-hook 'after-save-hook '(lambda () (byte-compile-file buffer-file-name) ) nil t)))) (let ((dan_dir (expand-file-name "~jidanni/.emacs_")));root also uses (if (file-exists-p dan_dir) (progn (setq load-path (append (list dan_dir "/usr/share/emacs/site-lisp/bbdb/lisp" ;Debian fools ) load-path))))) (setq version-control t kept-old-versions 0 dired-kept-versions 3 dired-listing-switches "-alo" ;save space kept-new-versions 5 delete-old-versions t require-final-newline t;needed by diff, etc. backup-by-copying-when-linked t;don't destroy other hard links backup-by-copying-when-mismatch t parens-require-spaces nil ;sorry, else shell scripts get "$ ()"... visible-cursor nil x-stretch-cursor t Man-support-local-filenames t ;; debug-on-error t;but could blow lots of input visible-bell t compilation-window-height 111 size-indication-mode t) (defvar jidanni-truncate-lines nil "*Usually truncate lines or not.") (setq compilation-mode-hook (function (lambda () (toggle-read-only 1);else I often edit it because it ;looks like my makefile (and jidanni-truncate-lines (toggle-truncate-lines);few docs for this ) (define-key compilation-mode-map "q" 'quit-window) (define-key compilation-mode-map ":" 'compilation-send-line:tt) ;; (goto-char (point-min))? ))) (setq default-major-mode 'text-mode) (add-hook 'text-mode-hook (lambda () (or buffer-read-only (turn-on-auto-fill)) (and (not buffer-read-only)(> 88888 (buffer-size))(flyspell-mode 1)) ; (abbrev-mode t);local only? how then to put in find-file hook? )) (set-frame-name (concat (or(and(= 0(user-uid))"#")"E") (substring (current-time-string) 11 16) "macs")) ;avoid chinese input switch on C-SPC (global-set-key (kbd "C-2") 'set-mark-command);kai (global-set-key (kbd "M-C-2") 'mark-sexp) (setq default-frame-alist (append '((font . "-sony-fixed-medium-r-normal--16-120-100-100-c-80-iso8859-1")) default-frame-alist)) (add-to-list 'default-frame-alist '(vertical-scroll-bars . right)) (add-hook 'set-language-environment-hook (function (lambda () (setq default-input-method 'chinese-py-punct-b5))));no 'utf' ones (or window-system ;; should do only if env is utf8 (set-terminal-coding-system 'utf-8-unix)); for emacs -nw (or window-system (menu-bar-mode 0)) (global-set-key "\C-xc" 'compile) (setq message-log-max 200) (autoload 'sc-cite-original "supercite" "Supercite" t) (autoload 'sc-submit-bug-report "supercite" "Supercite" t) (add-hook 'mail-citation-hook 'sc-cite-original) (setq news-reply-header-hook nil) (setq sc-citation-leader "") (setq mm-auto-save-coding-system 'utf-8 message-draft-coding-system 'utf-8) (add-hook 'message-mode-hook ;news-reply-mode-hook (function (lambda () (local-set-key "\C-ci" 'ispell-message)))) (setq dabbrev-case-replace nil confirm-kill-emacs 'y-or-n-p dabbrev-abbrev-char-regexp "\\sw\\|\\s_" shell-command-default-error-buffer "shell-command-errors") (global-set-key "\C-xt" 'jidanni-tidy-buffer) (defun jidanni-tidy-buffer () "Run Tidy HTML parser on current buffer." (interactive) (let ((START (point-min)) (END (point-max)) (NOW (point)) (COMMAND "dantidy")) ; save-excursion not too hot... (shell-command-on-region START END COMMAND t t shell-command-default-error-buffer t) (goto-char NOW)));close but no cigar (defun kill-buffer-other-window (arg) "Kill the buffer in the other window, and make the current buffer full size. If no other window, kills current buffer." (interactive "p") (let ((buf (save-window-excursion (other-window arg) (current-buffer)))) (delete-windows-on buf) (kill-buffer buf))) (global-set-key [f8] 'kill-buffer-other-window) (setq tempo-interactive t) (setq mark-even-if-inactive t);try it. mandrake turned on transient ;mark mode. (global-set-key "\M-#" 'query-replace-regexp) ;C-M-% unusable (add-hook 'dired-load-hook (function (lambda () (load "dired-x") (and (/= 0(user-uid)) (define-key dired-mode-map "b" 'browse-url-of-dired-file))))) (setq Man-notify-method 'bully);aggressive ok, but q didn't put me ;back in my initial state (setq html-helper-verbose nil);else cant see quail etc. prompts (setq auto-save-list-file-prefix "~/.backups/.saves-") ;;less clutter in $HOME (require 'backup-dir) (setq bkup-backup-directory-info '(("/home/jidanni/.*" "/home/jidanni/.backups/" ok-create full-path prepend-name) ("^/[^/:]+:" ".backups/") ; handle EFS files specially: don't ("^/[^/:]+:" "./") ; search-upward... its very slow (t ".backups/" full-path prepend-name search-upward))) (global-set-key "\C-x\C-b" 'ibuffer-and-update-other-window) ;(setq emacs-goodies-el-defaults t) (global-set-key [f3] `cyclebuffer-forward) (global-set-key [f4] `cyclebuffer-backward) (defun danj1:backwards-scroll-other-window () (interactive) (scroll-other-window '-)) (setq term-setup-hook (function (lambda () (global-set-key [kp-next] 'scroll-other-window);keypad 3 (global-set-key [(meta g)] `goto-line) (defun switch-to-other-buffer () (interactive) (switch-to-buffer (other-buffer))) (global-set-key [(meta control ?l)] `switch-to-other-buffer) (if (eq window-system 'x) (global-set-key [kp-insert] 'switch-to-other-buffer);mdk (global-set-key "\eOp" 'switch-to-other-buffer);mdk ) (global-set-key [f6] 'scroll-other-window) (global-set-key [f5] 'danj1:backwards-scroll-other-window) (global-set-key [f12] 'other-window) ))) (setq dired-guess-shell-alist-user (list (list "\\.[Mm][Pp]3" "mplayer -quiet") (list "\\.pdb" "pilot-xfer -i") (list "\\.prc" "pilot-xfer -i") (list "\\.JPG" "xli");too bad can't be case insensitive (list "\\.pnm" "xli") (list "\\.html?$" "validate -w --emacs")));NO NO NO, should ;do M-x compile... ;Kevin Rodgers says then do:`M-x compilation-minor-mode' ;in the *Shell Command Output* buffer :-( (load "header" t t) ;Lynn Slater 1991... (defadvice describe-function (after where-is activate) "Call `\\[where-is] FUNCTION'." (where-is (ad-get-arg 0))) ;Kevin Rodgers (setq apropos-do-all t) (defun jidanni-compilation-buffer-name-function (maj-mode) "my buffer name individualizer. Helps me not to stomp forgotten compilation logs so fast... maybe upon exiting emacs, we should also somehow ask about compilation buffers that we haven't taken a look at after their compilation finished." (concat "*" (downcase maj-mode) " " ;(file-name-nondirectory default-directory....) ;too bad I don't know how ;to do an exact replica of "basname `pwd`" but in lisp. So I guess ;I'll have to settle for default-directory "*")) (setq compilation-buffer-name-function 'jidanni-compilation-buffer-name-function) (setq header-copyright-notice "Copyright : http://www.fsf.org/copyleft/gpl.html") (setq make-header-hooks '(header-mode-line header-file-name header-copyright jidanni-header-author header-creation-date header-modification-author header-modification-date header-update-count header-status header-end-line)) (defun jidanni-header-author () "Inserts the current user's name as the module's author. This is a utility to be placed in make-header-hooks." (insert (and(boundp 'header-prefix-string) header-prefix-string) "Author : " (user-full-name) " http://jidanni.org/\n")) (and (eq window-system 'x) (global-font-lock-mode 1);too crazy colors outside X (/= 0(user-uid)) (progn (server-start) (defun browse-url-firefox (url &optional ignored) "Browse URL using a new tab in firefox." (interactive "sURL: ") (let ((process-environment (cons "DISPLAY=:0.0" process-environment))) (call-process "firefox" nil 0 nil ;"-remote" (format "openURL(%s, new-tab)" url)))) (global-set-key "\C-xw" 'browse-url-of-buffer) (setq browse-url-save-file t browse-url-generic-program "wwwoffle" browse-url-netscape-program "firefox" browse-url-browser-function '(("^mailto:" . browse-url-mail) ("http:" . browse-url-generic) ("." . browse-url-netscape) )))) (setq transient-mark-mode 't highlight-nonselected-windows 't) (show-paren-mode) (setq truncate-partial-width-windows nil) (global-set-key "\C-xI" 'insert-buffer) (eval-when-compile (require 'comint)) (add-hook 'comint-mode-hook ;no more "!" surprises (function (lambda ()(setq comint-input-autoexpand nil)))) (add-hook 'shell-mode-hook (function (lambda ()(setq comint-input-autoexpand nil)))) ;;;;;; sorry (load "gnuserv")(gnuserv-start) (setq comint-scroll-show-maximum-output t) (put 'set-goal-column 'disabled nil) (require 'uniquify)(setq uniquify-buffer-name-style 'forward) ;(setq uniquify-min-dir-content 2) ;;; after that do uniquify-rationalize-file-buffer-names by hand once (setq change-log-default-name "changelog.txt") (setq dired-clean-up-buffers-too nil);for a second chance when I blow a ;file away ;(setq query-replace-interactive t) ;(defalias 'perl-mode 'cperl-mode) (load "mini-ibfn" nil t) (define-key minibuffer-local-map "\C-c\C-f" 'minibuffer-ins-buffer-file-name) (define-key minibuffer-local-ns-map "\C-c\C-f" 'minibuffer-ins-buffer-file-name) (define-key minibuffer-local-completion-map "\C-c\C-f" 'minibuffer-ins-buffer-file-name) (define-key minibuffer-local-must-match-map "\C-c\C-f" 'minibuffer-ins-buffer-file-name) (auto-compression-mode 1) (setq makefile-cleanup-continuations-p nil);else too smart (add-hook 'bbdb-load-hook (lambda () (setq bbdb-file-coding-system 'utf-8-unix bbdb-offer-save 1 bbdb-send-mail-style 'message bbdb-north-american-phone-numbers-p nil bbdb-check-zip-codes-p nil bbdb-use-pop-up nil bbdb-send-mail-style 'compose-mail bbdb-dwim-net-address-allow-redundancy 'netonly bbdb-quiet-about-name-mismatches 3 ))) (and (require 'bbdb nil t)(bbdb-initialize 'gnus 'message 'sc)) ;(add-hook 'gnus-startup-hook 'bbdb-insinuate-gnus) ;(require 'fbdb)(bbdb-initialize 'gnus 'message 'sc) (ffap-bindings) (setq ffap-dired-wildcards "[*?][^/]*\\'") (setq ffap-ftp-regexp nil ffap-ftp-sans-slash-regexp nil) ;use (Info-copy-current-node-name) to complain about things I see in Info (setq-default show-trailing-whitespace t) (setq default-indicate-empty-lines t) (setq kill-read-only-ok t) (make-variable-buffer-local 'compile-command);want directory-local too ;stop overaggressiveness for offline me (setq ffap-machine-p-known 'accept file-name-handler-alist (delq (rassq 'ange-ftp-completion-hook-function file-name-handler-alist) file-name-handler-alist) ;but now ange-ftp quite disabled ange-ftp-try-passive-mode t tramp-default-method "ftp" flyspell-use-global-abbrev-table-p t;hush up its bug completion-ignored-extensions '(".bogus_junk_or_else_emacs_loops") sh-indent-for-then 0) (add-hook 'makefile-mode-hook (lambda () ;So no longer have to switch to compilation buffer before killing!: (define-key (and(boundp 'makefile-mode-map) makefile-mode-map) "\C-c\C-k" 'kill-compilation) (and (not buffer-read-only)(> 88888 (buffer-size)) (progn (flyspell-mode 1)));(turn-on-auto-fill) ;;Region sensitive Makefile compile-command, Juri Linkov (set (make-local-variable 'compile-command) '(save-excursion (beginning-of-line) (if (or (looking-at makefile-macroassign-regex) (looking-at makefile-dependency-regex) (makefile-previous-dependency)) (concat "make -k " (match-string-no-properties 1)) (car compile-history)))))) (setq jit-lock-stealth-time nil);don't wake up behind my back (setq sentence-end-double-space nil) (setq sentence-end "[.?!][]\"')]*\\($\\|\t\\| \\)[ \t\n]*") (defun jidanni-html-helper-default-insert-timestamp () "Jidanni timestamp insertion function." (insert (format-time-string "Last modified:\n %Y-%m-%d %T %z"))) (setq html-helper-timestamp-hook 'jidanni-html-helper-default-insert-timestamp) (put 'not-modified 'disabled t) (setq tar-mode-show-date t) (setq dired-guess-shell-gnutar "tar") (setq manual-program "LC_CTYPE=C man") (setq history-delete-duplicates t) (setq inhibit-splash-screen t) (fset 'html-mode 'html-helper-mode);emacs22 bug (defun html-mode () "jidanni override" (html-helper-mode));emacs22 bug ;but why sometimes breaks? need both? (setq kill-whole-line t) (setq diff-default-read-only t);broken? ;(setq same-window-buffer-names (cons "*Diff*" same-window-buffer-names)) ;`C-h f display-buffer' describes how flexible it really is.--Rodgers (setq custom-file "~jidanni/.emacs-custom.el")(load custom-file) (global-set-key (quote [home]) (quote beginning-of-buffer)) (global-set-key (quote [end]) (quote end-of-buffer)) (global-set-key (quote [select]) (quote end-of-buffer));xterm (setq Info-hide-note-references 'tag) (setq Info-isearch-search nil) (setq isearch-allow-scroll t) (setq auto-coding-regexp-alist (cons '("\\`\177ELF" . no-conversion) auto-coding-regexp-alist)) (setq mouse-wheel-progressive-speed nil) (setq ps-multibyte-buffer 'bdf-font) (setq ibuffer-movement-cycle nil) (setq mode-line-in-non-selected-windows nil) ;else looks like my background color ;here instead of .gnus.el, incase I reenable if from the question posed (put 'gnus-draft-send-all-messages 'disabled t) (autoload 'mapserver-mode "mapserver-mode" "For UMN MapServer files." t) (add-to-list 'auto-mode-alist '("\\.map\\'" . mapserver-mode)) (defun gnus-toggle nil "Into gnus and out" (interactive) (if (or (equal major-mode 'gnus-group-mode) (equal major-mode 'gnus-summary-mode) (equal major-mode 'gnus-article-mode)) (bury-buffer) (gnus))) (global-set-key "\C-xg" 'gnus-toggle) (delete-selection-mode -1);put at the bottom of .emacs! ;use until fixed (define-coding-system-alias 'gb18030 'gb2312) (define-coding-system-alias 'x-gbk 'gb2312) (define-coding-system-alias 'gbk 'gb2312)