;; .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 Dec 26 14:08:31 2011 ;; Update Count : 1018 ;; Status : yuck (tool-bar-mode 0) (menu-bar-mode 0) ;(require 'w3m-load) (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" ;still needed with snapshot 2/2011 ) load-path))))) (eval-after-load "sh-script" '(add-to-list 'sh-alias-alist '(sh . bash))) (setq ; pop-up-frames t ; special-display-regexps '("\\*Man" "\\*compilation") frame-auto-hide-function 'delete-frame send-mail-function 'sendmail-send-it sendmail-query-once-function 'sendmail-send-it ; old? ;browse-url-new-window-flag t ;browse-url-firefox-new-window-is-tab t ispell-dictionary "american" Buffer-menu-buffer+size-width 44 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 size-indication-mode t compilation-auto-jump-to-first-error t ;compilation-scroll-output 'first-error ;default-truncate-lines t ) (defvar jidanni-truncate-lines nil "*Usually truncate lines or not.") ;; (defun solipsistic-child (process) ;; "Me, me, look at me!" ;; (with-current-buffer (process-buffer process) ;; (delete-other-windows))) ;; (add-hook 'compilation-start-hook 'solipsistic-child) (add-hook 'compilation-mode-hook (function (lambda () (add-to-list 'compilation-error-regexp-alist-alist '(basex "^Stopped at line \\([0-9]+\\), column \\([0-9]+\\) in \\(.*?\\):$" 3 1 2)) (add-to-list 'compilation-error-regexp-alist 'basex) (toggle-read-only 1);else I often edit it because it looks like my makefile (switch-to-buffer "*compilation*");alas, forget using any personal compilation-buffer-name-function (delete-other-windows) (and jidanni-truncate-lines (toggle-truncate-lines))))) (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) (if (eq window-system 'x) (progn (setq default-frame-alist '( (fullscreen . maximized) ; (info "(emacs) Fonts") (font . "-sony-fixed-medium-r-normal--16-120-100-100-c-80-iso8859-1") ; (font . "-sony-fixed-medium-r-normal--24-120-100-100-c-80-iso8859-1") (vertical-scroll-bars . right))) (if(/= 0(user-uid)) (progn (add-to-list 'default-frame-alist '(background-color . "DarkSlateGray")) (add-to-list 'default-frame-alist '(foreground-color . "Wheat")) ) (progn (add-to-list 'default-frame-alist '(background-color . "Hotpink4")) (add-to-list 'default-frame-alist '(foreground-color . "Wheat")) )))) (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 mark-even-if-inactive t) (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/"))) ;(global-set-key [f3] 'cyclebuffer-forward) ;(global-set-key [f4] 'cyclebuffer-backward) ;(global-set-key "\C-x\C-b" 'bs-show) ;(global-set-key [(f3)] 'bs-cycle-next) ;(global-set-key [(f4)] 'bs-cycle-previous) (global-set-key (quote [f3]) (quote next-buffer)) (global-set-key (quote [f4]) (quote previous-buffer)) (defun danj1:backwards-scroll-other-window () (interactive) (scroll-other-window '-)) (setq term-setup-hook (function (lambda () (global-set-key [(meta g)] 'goto-line) (global-set-key [f6] 'scroll-other-window) (global-set-key [f5] 'danj1:backwards-scroll-other-window) (global-set-key [f12] 'other-window) )) 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 header-copyright-notice "Copyright : http://www.gnu.org/licenses/gpl.html" 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) ;(setq x-select-enable-clipboard t);for midori at least (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 'prog-mode-hook 'flyspell-prog-mode) (add-hook 'shell-mode-hook (function (lambda () (setq comint-input-autoexpand nil) (flyspell-prog-mode);for *shell* ))) ;;;;;; 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 'supercite)) ;(add-hook 'gnus-startup-hook 'bbdb-insinuate-gnus) ;(require 'fbdb)(bbdb-initialize 'gnus 'message 'sc) (ffap-bindings) (setq ffap-dired-wildcards "[*?][^/]*\\'") (defun my-ffap (&optional filename) ;PJ Weisberg (interactive) (let ((ffap-url-fetcher (if current-prefix-arg #'browse-url-firefox ffap-url-fetcher)) (current-prefix-arg nil)) (find-file-at-point filename))) (global-set-key "\C-x\C-f" 'my-ffap) (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 '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) ;;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 (quote [f4]) (quote previous-buffer)) )) (add-hook 'php-mode-hook '(lambda nil '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" 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, incase 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 major-mode 'text-mode show-trailing-whitespace t indicate-empty-lines t) ;; ;;Just to see if there are any zero width U+200E LEFT-TO-RIGHT MARK ;; ;;hiding in our files, we do: ;; (global-whitespace-mode 1) ;; (setq whitespace-style '(spaces)) ;; ;;Set neighbor characters on fire in order to see where the ;; ;;"invisible man" is: ;; (setq whitespace-space-regexp "\\(.?\x200E+.?\\)") ;; (put 'whitespace-space-before-tab 'face-alias 'whitespace-space);fire color ;; ;;Works except if it is the only char on a line. (In emacs -nw it is ;; ;;width 1, not zero, for me.) ;;wrong.... (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)) (add-to-list 'auto-mode-alist '("\\.xq\\'" . xquery-mode)) (autoload 'xquery-mode "xquery-mode") (add-hook 'xquery-mode-hook (lambda () (set (make-local-variable 'compilation-error-screen-columns) nil) (flyspell-prog-mode))) (defadvice xquery-mode (after xquery-add-hook activate);give it a hook that the author forgot (run-mode-hooks 'xquery-mode-hook)) (setq mouse-drag-copy-region t x-select-enable-primary t x-select-enable-clipboard nil) (global-set-key [mouse-2] 'mouse-yank-at-click) (eval-after-load "image-mode" '(progn (define-key image-mode-map "q" (lambda () (interactive) (quit-window (not current-prefix-arg))))));bug#8615 (eval-after-load "arc-mode" '(progn (define-key archive-mode-map "q";note the difference from the library name (lambda () (interactive) (quit-window (not current-prefix-arg))))))