;; .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: Mon Aug 16 07:26:45 2010 ;; Update Count : 920 ;; Status : yuck (blink-cursor-mode 0) (kill-buffer "*scratch*") (add-hook 'emacs-lisp-mode-hook '(lambda () (turn-on-auto-fill) (flyspell-prog-mode) (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" ;still needed with snapshot 6/2009 ; ) load-path )load-path))))) ;(setq ispell-dictionary "american") (setq ispell-local-dictionary "american"); #bug 6143 (setq ;;sgml-quick-keys t yank-excluded-properties t longlines-show-hard-newlines t grep-program "zgrep" vc-stay-local t use-dialog-box nil scroll-preserve-screen-position t 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 ; default-truncate-lines t ) (setq-default major-mode 'text-mode) (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 ) ;; (goto-char (point-min))? ))) (setq 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) (menu-bar-mode 0) (tool-bar-mode 0) (if (eq window-system 'x) (progn (setq default-frame-alist '((fullscreen . maximized);;also see toobar+menubar bugs 3643@debbugs.gnu.org (vertical-scroll-bars . right))) (if(not(getenv "jidanni_white")) ;;my amateur method (setq default-frame-alist (append default-frame-alist `((font . "-sony-fixed-medium-r-normal--16-120-100-100-c-80-iso8859-1") (foreground-color . "Wheat") (background-color . , (if(/= 0(user-uid)) "DarkSlateGray" "chocolate4")))))))) (add-hook 'set-language-environment-hook (function (lambda () (setq default-input-method 'chinese-py-punct-b5))));no 'utf' ones (global-set-key "\C-xc" 'compile) (global-set-key "\C-xx" 'w3m) (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") (define-key dired-mode-map "b" 'browse-url-of-dired-file)))) (setq Man-notify-method 'bully;but q didn't put me back in my initial state html-helper-verbose nil;else cant see quail etc. prompts auto-save-list-file-prefix "~/.backups/.saves-";less clutter in $HOME backup-directory-alist '((".*" . "~/.backups/"))) ;(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] 'next-buffer) (global-set-key [f4] 'previous-buffer) (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 "\\.mp3$" "mplayer -quiet" "eyeD3 --no-color") (list "^cpiome\\..*\\.cpio\\.gz$" "cpiome -t" "cpiome") (list "\\.ogg$" "mplayer -quiet") (list "\\.torrent$" "transmissioncli --info" "transmission") (list "\\.p\\(db\\|rc\\)$" "pilot-xfer -i") (list "\\.\\(jpe?g\\|png\\|p[bgpn]m\\|gif\\)$" "xli") (list "\\.html?$" "firefox" "validate -w --emacs"))) (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 : http://jidanni.org/\n"));" (user-full-name) (and (eq window-system 'x) (progn ;;http://debbugs.gnu.org/cgi/bugreport.cgi?bug=6720 (setq x-select-enable-clipboard nil x-select-enable-primary t select-active-regions nil mouse-drag-copy-region t) (global-set-key [mouse-2] 'mouse-yank-at-click) ;;end of bug 6720 fixes (global-font-lock-mode 1);too crazy colors outside X (and (/= 0(user-uid)) (server-start)) )) (global-set-key "\C-xw" 'browse-url-of-buffer) (show-paren-mode) (setq browse-url-save-file t browse-url-browser-function 'w3m-browse-url transient-mark-mode 't highlight-nonselected-windows 't truncate-partial-width-windows nil dired-clean-up-buffers-too nil;for a second chance when I blow a file away comint-scroll-show-maximum-output t kill-read-only-ok t ) (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) (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 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 () (define-key bbdb-mode-map "\C-k" 'kill-line);restore emacs default (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 (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 'sh-mode-hook (lambda()(flyspell-prog-mode))) (add-hook 'perl-mode-hook (lambda()(flyspell-prog-mode))) (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-prog-mode)));(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 " (match-string-no-properties 1)) (or(car compile-history)"make ")))))) (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) (add-hook 'html-helper-mode-hook '(lambda nil (local-set-key [f4] 'previous-buffer))) (add-hook 'php-mode-hook '(lambda nil (local-set-key [f4] 'previous-buffer) 'mw-mode)) (add-to-list 'auto-mode-alist '("\\.inc\\'" . php-mode)) (put 'not-modified 'disabled t) (setq tar-mode-show-date t dired-guess-shell-gnutar "tar" manual-program "man_for_emacs" ; bug 4056 history-delete-duplicates t inhibit-splash-screen t) (setq kill-whole-line t diff-switches "-U0" 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 Info-isearch-search nil ;isearch-allow-scroll t auto-coding-regexp-alist (cons '("\\`\177ELF" . no-conversion) auto-coding-regexp-alist) mouse-wheel-progressive-speed nil ps-multibyte-buffer 'bdf-font ibuffer-movement-cycle nil mode-line-in-non-selected-windows nil;else looks like my background color ) ;here instead of .gnus.el, in case I reenable if from the question posed (put 'gnus-draft-send-all-messages 'disabled t) (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) (eval-after-load "ffap" '(setcar (cdr (assq 'url ffap-string-at-point-mode-alist)) "--:=&?$+@-Z_[:lower:][:multibyte:]()~#,%;*")) (custom-set-faces '(cursor((t(:background"White":foreground"Black")))t)) ;;else how are we to see final error messages? ;(add-hook ; 'kill-emacs-hook ; '(lambda () ; (sleep-for 5) ;or (sit-for 5) ; )) (setenv "PAGER" "cat") (setenv "LESS" nil) ;;http://www.mediawiki.org/wiki/Manual:Coding_conventions (defconst mw-style '((c-offsets-alist . ( (case-label . +) (arglist-close . 0) (cpp-macro . (lambda(x)(cdr x))) (comment-intro . 0) )) (c-hanging-braces-alist (defun-open after) (block-open after) (defun-close) ) )) (c-add-style "MediaWiki" mw-style) (define-minor-mode mw-mode "tweak style for mediawiki" nil " MW" nil (if mw-mode (progn (setq tab-width 4 c-basic-offset 4) (c-set-style "MediaWiki")) (kill-local-variable 'tab-width) (kill-local-variable 'c-basic-offset))) (eval-after-load "browse-url";workaround '(let ((file (rassoc "file:/" browse-url-filename-alist))) (if file (setcdr file "file:///")))) (setq-default show-trailing-whitespace t indicate-empty-lines t) (setq auto-mode-alist (rassq-delete-all 'doc-view-mode auto-mode-alist)) (add-to-list 'auto-mode-alist '("\\.\\(?:PDF\\|DVI\\|pdf\\|dvi\\)\\'" . w3m-mode)) (put 'scroll-left 'disabled nil) (global-set-key (kbd "") 'scroll-right) (global-set-key (kbd "") 'scroll-left) ;(aset standard-display-table ?‎ (vconcat "♥")); http://debbugs.gnu.org/cgi/bugreport.cgi?bug=6860 ;(aset standard-display-table 8206 [9829])