;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; MAIN CONFIGURATION FILE ;; ----------------------- ;; Author: Yaroslav Halchenko Contacts: {www.|yoh@}onerussian.com ;; ;; This file consists all improvements I collected and introduced into my ;; everyday work with emacs. Many pieces were grabbed from .emacs's of others, ;; so you will mention some inconsistence within comments and structure of this ;; file. ;; ;; Hope that you'll find smth useful for yourself in this file. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;(require 'uncompress) (require 'cl) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; DEFINE SOME INFORMATION ABOUT SYSTEM ;; Mostly taken from Barak's .emacs ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (if (not (boundp 'emacs-major-version)) (setq emacs-major-version (car (read-from-string (let* ((b (string-match "[0-9]+" emacs-version)) (e (match-end 0))) (substring emacs-version b e)))))) (if (not (boundp 'emacs-minor-version)) (setq emacs-minor-version (car (read-from-string (let* ((b (string-match "\\.[0-9]+" emacs-version)) (e (match-end 0))) (substring emacs-version (+ b 1) e)))))) (defun emacs-version-above (major minor) "Return whether the current emacs is above MAJOR.MINOR." (or (and (= emacs-major-version major) (>= emacs-minor-version minor)) (> emacs-major-version major))) (when (< emacs-major-version 20) (require 'cl)) ;for push (defvar mule-present (featurep 'mule) "Running MULE enabled emacs?") (when (not (boundp 'running-xemacs)) (setq running-xemacs nil)) (defvar thishost (or (system-name) (getenv "THISHOST")) "Full hostname.") (defvar machine (or (getenv "HOSTTYPE") (getenv "MACHINE")) "CPU type.") (defvar user (intern (or (getenv "USER") (user-login-name))) "This user's uid.") (defconst isroot (string-match "^root" user-real-login-name) "Am I root?") (defconst isyoh (string-match "^\\(yoh\\|yarik\\)$" user-real-login-name) "Am I myself today?") (defvar home (expand-file-name "~") "This user's home directory.") (defconst home_els (concat home "/soft/emacs.els") "Where I keep yoh-wide emacs packages") (defconst rutgers (string-match "\\"))) (setq mail-archive-file-name "~/mail/sent-mail") (setq mail-signature "\n\n\--Yarik\n") (setq mail-header-separator "--O Emacs, I am unworthy! My humble message follows--" gnus-local-organization "-= Yari(C)/RU/NJIT/KitchenSink =-") ) (when full-dotemacs ;; Stuff for the mail & the news ;;(load-library "nnmail") (setenv "MAILHOST" "pop.cs.unm.edu") ;;(load-library "message") ) (when (and full-dotemacs) ;; unm ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;; GNUS and MAIL ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (setq gnus-nntp-server "news.fido7.ru" gnus-select-method '(nntp gnus-nntp-server) gnus-secondary-select-methods '((nnml "private")) ;; nnmail-spool-file "po:yoh" ;(list (concat "po:" (user-login-name))) ;; ;; nnmail-pop-password-required t nnmail-pop-password mailPass gnus-read-active-file nil gnus-add-to-list t gnus-suppress-duplicates t gnus-inhibit-startup-message t gnus-nov-is-evil t gnus-check-new-newsgroups 'ask-server gnus-article-save-directory "~/pers/News" gnus-novice-user nil gnus-auto-select-next nil gnus-cite-minimum-match-count 1 nnmail-treat-duplicates "delete" gnus-outgoing-message-group "nnml:sent-mail" ;; Citing gnus-use-sc t ;use supercite sc-citation-leader "" ;I don't want \t first in citation sc-preferred-attribution-list '("sc-lastchoice" "x-attribution" "initials" "firstname" "lastname") sc-fixup-whitespace-p t ;delete trailing whitespaces sc-nested-citation-p t ;nested citations ) ;; Scoring (setq gnus-use-score t ;use scoring gnus-use-adaptive-scoring t) (defvar gnus-default-adaptive-score-alist '((gnus-unread-mark) (gnus-ticked-mark (from 4)) (gnus-dormant-mark (from 5)) (gnus-del-mark (from -4) (subject -1)) (gnus-read-mark (from 1) (subject 1)) (gnus-expirable-mark (from -1) (subject -1)) (gnus-killed-mark (from -1) (subject -3)) (gnus-kill-file-mark) (gnus-ancient-mark) (gnus-low-score-mark) (gnus-catchup-mark (subject -4)) ) ) ;;* Higher Scoring of followups to myself (add-hook 'message-sent-hook 'gnus-score-followup-article) (add-hook 'message-sent-hook 'gnus-score-followup-thread) (require 'gnus-setup) (require 'gnus-art) (require 'gnus-cite) (setq gnus-strict-mime t mime-editor/transfer-level 8 mime-editor/transfer-level-string "8bit" default-mime-charset 'koi8-r message-default-charset 'koi8-r gnus-strict-mime t mime-editor/transfer-level 8 mime-editor/transfer-level-string "8bit") (add-hook 'mime/editor-mode-hook '(lambda () (put-alist 'koi8-r nil mime-editor/charset-default-encoding-alist) (put-alist "Subject" nil mime/field-encoding-method-alist) (put-alist "To" nil mime/field-encoding-method-alist) )) (setq gnus-posting-styles '( (".*" (signature (my-signature ?u)) ("X-FTN-Tearline" "Gnus v5.8.8(GNU/Emacs 21.2)*Debian GNU/Linux Woody") (organization "Computer Science Department, UNM")) (".*fido7\\..*" (From "Yarik ") (signature (my-signature ?f)) ("Keywords" fidoPass) ("X-FTN-Tearline" "Gnus v5.8.8(GNU/Emacs 21.2)*Debian GNU/Linux Woody") (organization "-= Yari(C) =-")) (".*Rutgers" (signature (my-signature ?r)) (organization "Psychology Department, Rutgers. Newark")))) ;; ;; Topic-Mode (add-hook 'gnus-group-mode-hook 'gnus-topic-mode) (setq gnus-topic-line-format "%i%3A: %(%{%n%}%)%v\n") (setq nnmail-split-methods '(("ERROR" "\\(From:.*Mail Delivery Subsystem\\|Subject:.*Returned mail: Service unavailable\\|Subject:.*mail failed, returning to sender\\|Subject:.*Article not acceptable\\)") ;; ("Natasha" "^To:yoh@svitonline.com") ("Timchenko" "From:.*timchen@svitonline.com.*") ("cschat" "\\(To\\|Cc\\):.*\\(csfaculty\\|cschat\\|csgrad\\)@cs.unm.edu.*") ("comps" "\\(To\\|Cc\\):.*\\(comps\\)@cs.unm.edu.*") ("mypoints" "From:.*mypoints.com.*") ("OIPS" "From:.*oips@\\(UNM.EDU\\|unm.edu\\).*") ("UNM" "From:.*\\(cselcir\\).*unm.edu.*") ("IZone" "From:.*\\(IZone\\|null@maillist.ru\\).*") ("cs530" "\\(To\\|Cc\\):.*cs530@cs.unm.edu.*") ("cs460grpd" "\\(To\\|Cc\\):.*cs460grpd@.*") ("Tony" "From:.*tony488@hotmail.com.*") ("ImpDiff" "From:.*\\(lanl.gov\\).*") ("Stephen" "From:.*\\(jose@\\).*") ("Barak" "From:.*\\(bap@\\).*") ("Rutgers" "From:.*\\(elflord\\|rutgers.edu\\).*") ("NJIT" "From:.*\\(njit.edu\\).*\\|To:.*inter-students.*njit.edu.*") ("Trash" "To:.*trash@onerussian.com.*") ("BCOMPlab" "\\(To\\|Cc\\):.*lab@sweat.cs.unm.edu.*\\|From:.*NatMalas.*") ("Friends" "From:.*\\(yoh@svit\\||patrikk\\|smolev\\|natik_g\\|mystery\\|dmykola\\|yuliyapopova\\|yp61\\|sigen\\|pliz\\|advokat\\|kardio\\|alex_f\\|vieic\\|natashaza\\|natashanani\\|buhl\\|DogovorovD\\|marinad\\|patrikk\\|irchik_s\\|sms.kyivstar.net\\|yustas\\|okk@svi\\|mirnova\\).*") ("Yarik" "From:.*yoh@cs.unm.edu.*") ("Other" "") )) (setq nnmail-expiry-wait-function (lambda (group) (cond ((string-match "\\(ERROR\\|Trash\\)" newsgroup) 2) ((string-match "IZone" newsgroup) 5) ((string-match "OIPS" newsgroup) 90) ((string-match "Yarik" newsgroup) 90) ((string-match "sent-mail" newsgroup) 31) ((string-match "\\(cschat\\|cs460grpd\\|cs530\\)" newsgroup) 60) ((string-match "Other" newsgroup) 1024) ((string-match "Important" newsgroup) 'never) ((string-match "ImpDiff" newsgroup) 'never) (t 'never)))) (defun gnus-reopen-connection () "Makes gnus to reopen connection to the server" (interactive) (nntp-open-server gnus-nntp-server)) (add-hook 'message-mode-hook '(lambda () (auto-fill-mode 1) (font-lock-mode 1) (setq fill-column 75) ;;(signature "UNM") )) (defun Make-Comment-To (from) (if (string-match " *<.*> *" from) (concat (substring from 0 (match-beginning 0)) (substring from (match-end 0))) (if (string-match "\(.*\)" from) (substring from (+ (match-beginning 0) 1) (- (match-end 0) 1)) from))) (add-hook 'message-setup-hook '(lambda () ;; (setq message-signature 'My-Signature) ;; Add X-Comment-To: field. We need From: field from original ;; letter. How to get right? (if message-reply-buffer (let ((cur-buffer (current-buffer)) from-field) (save-excursion (set-buffer message-reply-buffer) (if (string-match "^From: " (buffer-string)) (progn (setq from-start (+ (match-end 0) 1)) (goto-char from-start) (end-of-line) (setq from-field (buffer-substring from-start (point)))))) (if from-field (save-excursion (goto-char (point-min)) (insert "X-Comment-To: " (Make-Comment-To from-field) "\n"))))))) (add-hook 'gnus-article-display-hook '(lambda () (gnus-article-highlight) (gnus-article-hide-headers-if-wanted) (setq gnus-visible-headers '("^From:" "^X-Comment-To:" "^Comment-To:" "^Subject:" "^Date:" "^Followup-To:" "^Reply-To:" "^Organization:" "^Summary:" "^Keywords:" "^To:" "^Cc:" "^Posted-To:" "^Mail-Copies-To:" "^Apparently-To:" "^Gnus-Warning:" "^Resent-From" "^Spam" ) ) (article-emphasize))) (add-hook 'gnus-summary-mode-hook '(lambda () (local-set-key [tab] 'gnus-summary-next-unread-article) (local-set-key [delete] 'gnus-summary-delete-article))) (add-hook 'gnus-summary-exit-hook 'gnus-summary-bubble-group) (when (eq emacs-major-version '21) ;; As for displaying html (setq ;; prefer to show plain text over markup for multipart/alternative mm-discouraged-alternatives (append mm-discouraged-alternatives '("text/html" "text/richtext" ))) (when (locate-library "poe") (require 'poe) ;for remassoc (setq ;; use lynx -dump to view inline HTML mm-inline-media-tests (cons '("text/html" my:gnus-html2text (lambda (handle) (fboundp 'my:gnus-html2text))) (remassoc "text/html" mm-inline-media-tests))))) ;; function to call to handle text/html attachments (defun my:gnus-html2text (handle) (let (text) (with-temp-buffer (mm-insert-part handle) (save-window-excursion (my:html2text-region (point-min) (point-max)) (setq text (buffer-string)))) (mm-insert-inline handle text))) (defun my:html2text-region (min max) "Replace the region with the result of running my own html2text---which calls lynx -dump---on it." (interactive "r") (call-process-region min max "html2text" t t t "-nobs"))) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; DIFFERENT GLOBAL VARIABLES' DEFINITIONS ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (auto-save-mode 10) (set-cursor-color "blue3") (show-paren-mode 1) (transient-mark-mode 1) (auto-compression-mode 1) (global-font-lock-mode t) (display-time) ; how late am I? (setq next-line-add-newlines nil ;stop in last line of buffer resize-minibuffer-mode 1 ;show everything in minibuffer search-highlight t ;highlight found matches query-replace-highlight t ;highlight found matches delete-key-deletes-forward t mouse-yank-at-point nil ;I-don't-like-mouse-that-much lpr-switches '("-Plaser") ;print options visible-bell t ;do not beep inhibit-startup-message t ;ok I've seen the copyleft &c scroll-step 1 ;move one line at a time column-number-mode t ;show column number in status bar next-line-add-newlines nil ;don't add newlines by the end of buf font-lock-maximum-decoration t x-select-enable-clipboard nil ;access to a system clipboard show-paren-style 'mixed ;mixed mode for showing paren paren-face 'bold ;how to show matching () minibuffer-max-depth nil ;no limit on size split-height-threshold 15 ;Barak likes lots of small windows. blink-cursor-mode 1 ;I'm fine with no blinking require-final-newline t ;'ask ;ask if I need it enable-local-variables t ;was 'ask enable-local-eval t ;was 'query show-trailing-whitespace t ;show trailing spaces by default paren-sexp-mode t ;how to show matching () truncate-lines t ) ; to avoid problem on freshly installed stable debians (when (featurep 'ess-utils) (autoload 'nuke-trailing-whitespace "nuke-trailing-whitespace" nil t) (setq nuke-trailing-whitespace-p 'ask) (add-hook 'write-file-hooks 'nuke-trailing-whitespace)) (when (emacs-version-above 21 0) (tool-bar-mode 0) ;no toolbar - what for? (setq default-major-mode 'text-mode)) (add-hook 'text-mode-hook 'turn-on-auto-fill) ;make the y or n suffice for a yes or no question (fset 'yes-or-no-p 'y-or-n-p) ;be able to do Ctrl-X, u/l to upper/lowercase regions without confirm (put 'downcase-region 'disabled nil) (put 'upcase-region 'disabled nil) (put 'narrow-to-region 'disabled nil) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;; DEFINITIONS AND KEY BINDINGS FOR POINT RINGS ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (setq find-tag-marker-ring-length 100) (require 'etags) ;load her for a ring definition (defun remember-point-marker () "Remembers current position in the find-tag ring so to be restored after with M-*" (interactive) (ring-insert find-tag-marker-ring (point-marker))) (global-set-key "\M-&" 'remember-point-marker) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; SPELLING HOOKS ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (cond ((and x11 (fboundp 'flyspell-mode)) ;; temporary fix for flyspell ;; (set-default 'ispell-local-dictionary (or ispell-dictionary "american")) ;; Russian ispell setup (setq ispell-dictionary-alist (append ispell-dictionary-alist (list (list "" "[áâ÷çäåöúéëìíîïðòóôõæèãþûý³ÿøùüàñÁÂ×ÇÄÅÖÚÉËÌÍÎÏÐÒÓÔÕÆÈÃÞÛÝ£ßØÙÜÀÑ]" "[^áâ÷çäåöúéëìíîïðòóôõæèãþûý³ÿøùüàñÁÂ×ÇÄÅÖÚÉËÌÍÎÏÐÒÓÔÕÆÈÃÞÛÝ£ßØÙÜÀÑ]" "[\0]" nil nil nil))) ispell-dictionary "russian") (add-hook 'text-mode-hook 'flyspell-mode) (add-hook 'tex-mode-hook (lambda () (setq ispell-parser 'tex case-fold-search 't))))) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; DIFFERENT MODES ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; Additional Modes aliases (nconc auto-mode-alist '( ( "\\.html\((.??\\|\))$" . html-mode ) ( "\\.phtml$" . php-mode ) ( "\\.tei$" . tei-mode ) ( "\\.template$" . c++-mode ) ( "\\.h$" . c++-mode ) ( "\\.c\\(pp\\|++\\|c\\)$" . c++-mode ) ( "\\.dsl$" . scheme-mode ) ( "\\.gwm$" . lisp-mode ) ( "\\.py$" . python-mode ) ( "\\.l$" . flex-mode ))) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; PERL ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (add-to-list 'auto-mode-alist '("\\.\\([pP][Llm]\\|al\\)\\'" . cperl-mode)) (nconc interpreter-mode-alist '(("perl" . cperl-mode) ("perl5" . cperl-mode) ("miniperl" . cperl-mode))) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; FLEX ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; (require 'flex-mode) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; MATLAB ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;(setq matlab-shell-command-switches " -nosplash") ;for Matlab 6.0 (autoload 'matlab-mode "matlab" "Enter Matlab mode." t) (setq auto-mode-alist (cons '("\\.m\\'" . matlab-mode) auto-mode-alist) matlab-auto-fill nil matlab-shell-command "matlab" matlab-shell-command-switches " -nojvm -nodesktop -nosplash") ;for Matlab 6.0 (autoload 'matlab-shell "matlab" "Interactive Matlab mode." t) (add-hook 'matlab-mode-hook '(lambda () (setq indent-tabs-mode nil) (flyspell-prog-mode))) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; C/C++ MODES ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;(require 'cc-mode) (defun my-auto-header () (interactive) (insert "/*==================------... X ...------==================*/") ) (defun my-psignature(dname comEach) "Returns signature for source code - depending is it lab's code or mine" (cond ((string-match ".*/meg[./].*" dname) (concat comEach " Brain & Computation Lab CS Dept. UNM\n" comEach " http://www-bcl.cs.unm.edu http://www.cs.unm.edu\n")) ((string-match ".*/rutg[./].*" dname) (concat comEach " RUMBA project Psychology Department. Rutgers, Newark\n" comEach " http://psychology.rutgers.edu/RUMBA http://psychology.rutgers.edu\n" comEach " e-mail: yoh@psychology.rutgers.edu\n")) ;; ((string-match ".*/njit[./].*" dname) ;; (concat comEach " NJIT Computer Science Department. Newark\n" ;; comEach " http://www.onerussian.com/ http://psychology.rutgers.edu\n" ;; comEach " e-mail: yh42@njit.edu\n")) (t (concat comEach " Yaroslav Halchenko CS@UNM, CS@NJIT\n" comEach " web: http://www.onerussian.com & PSYCH@RUTGERS\n" comEach " e-mail: yoh@onerussian.com ICQ#: 60653192\n")))) (defun my-cvs-keywords(comEach) "Returns string with ..." (concat comEach " CVS version control block - do not edit manually\n" comEach " $RCSfile:$\n" comEach " $Source: $\n" comEach "\n" comEach " Created: " (current-time-string) "\n" comEach " Commited: $Date:$\n" comEach " Revision: $Revision:$\n")) (defun my-svn-keywords(comEach) "Returns string with ..." (concat comEach " SVN version control block - do not edit manually\n" comEach " $Id: $\n" comEach "\n" comEach " Created: " (current-time-string) "\n" comEach " $Date: $\n" comEach " $Rev: $\n")) (defun my-vc-keywords(dname comEach) "Checks if the directory dname has CVS or .svn subdirectories and selects approapriate header" (cond ((file-exists-p (concat dname "/.svn")) (my-svn-keywords comEach)) ((file-exists-p (concat dname "/CVS")) (my-cvs-keywords comEach)) (t ""))) (defun my-header(languages comStart comEnd comEach comOne) "Creates standard header for files - code sources" (let ((f-name (file-name-nondirectory (buffer-file-name))) (d-name (file-name-directory (buffer-file-name))) (spunkt (make-string (/ (- 76 (length languages) 10 (length comStart)) ;to make upper string proper centered 2) ?-))) (insert comOne spunkt " =+- " languages " -+= " spunkt "\n" ;;; comStart "\n" comEach " @file " f-name "\n" comEach " @date " (current-time-string) "\n" comEach " @brief\n" comEach "\n" (my-vc-keywords d-name comEach) comEach "\n" (my-psignature d-name comEach) comEach "\n" comEach " DESCRIPTION (NOTES):\n" comEach "\n" comEnd "\n" comOne "-----------------\\____________________________________/------------------\n"))) (defun my-m-function(f-sname) "Returns template for Matlab function" (let ((d-name (file-name-directory (buffer-file-name)))) (concat "function " f-sname "()\n" "%" (upcase f-sname) " ?\n" "% \n" "% INPUTS:\n" "% \n" "% OUTPUTS:\n" "% \n" (my-psignature d-name "%")))) (defun my-auto-insert () "Depending on current buffer name inserts header" (interactive) (let ((f-name (file-name-nondirectory (buffer-file-name))) (d-name (file-name-directory (buffer-file-name)))) (let ((f-ext (if (string-match "\\..*$" f-name) (substring f-name (+ (match-beginning 0) 1)) "")) (f-sname (substring f-name 0 (match-beginning 0) ))) (when (string-match "^\\(C\\|template\\|cc\\|c..\\|h..\\|h\\)$" f-ext) (my-header "C / C++" "/**" " */" " *" "//")) (when (string-match "^sh$" f-ext) (my-header "Shell script" "#" "#" "#" "#")) (when (string-match "^py$" f-ext) (my-header "Python script" "#" "#" "#" "#")) (when (string-match "^pl$" f-ext) (my-header "Perl script" "#" "#" "#" "#")) (when (string-match "^tex$" f-ext) (my-header "Latex file" "%" "%" "%" "%")) (when (string-match "^el$" f-ext) (my-header "Emacs Lisp script" ";" ";" ";" ";")) (when (string-match "^m$" f-ext) ;; (my-header "Matlab/Octave" "%" "" "%") (insert (my-m-function f-sname) "%\n" (my-vc-keywords d-name "%")))))) (add-hook 'find-file-not-found-hooks '(lambda () (my-auto-insert) (not-modified))) (when (emacs-version-above 21 0) (add-hook 'c-mode-hook 'flyspell-prog-mode) (add-hook 'c++-mode-hook 'flyspell-prog-mode)) (add-hook 'c-mode-common-hook '(lambda () (c-set-style "stroustrup") (line-number-mode t) (column-number-mode t) (abbrev-mode t) (auto-fill-mode nil) (local-set-key "\C-ch" 'my-auto-header) (local-set-key "\C-ci" 'my-auto-insert) (local-set-key "\C-cs" 'my-psignature) (setq indent-tabs-mode nil fill-column 150 show-trailing-whitespace t) ;;; tab-width 8 ;;; c-basic-offset 4) (when (featurep 'doxymacs) (require 'doxymacs) (doxymacs-mode)) ;; (local-set-key [return] 'reindent-then-newline-and-indent) )) (add-hook 'c++-mode-common-hook 'c-mode-common-hook) ;;; Conform to the Linux kernel coding standards: (defun linux-c-mode () "C mode with adjusted defaults for use with the Linux kernel." (interactive) (c-mode) (c-set-style "k&r") (setq c-basic-offset 8)) ;;; Conform to the standards agreed in Rutgers RUMBA (defun rumba-c-mode () "C/C++ mode with adjusted defaults for use with the Rumba projects." (interactive) (c++-mode) (c-set-style "stroustrup")) (nconc auto-mode-alist '((".*/src/.*/linux.*/.*\\.[ch]$" . linux-c-mode) (".*/src/linux.*/.*\\.[ch]$" . linux-c-mode))) (pushnew '(".*/rutg/.*\\.[chpC]+$" . rumba-c-mode) auto-mode-alist) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; HTML-helper mode ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (autoload 'html-helper-mode "html-helper-mode" "Yay HTML" t) (add-to-list 'auto-mode-alist '("\\.html$" . html-helper-mode)) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;; XML/PSGML mode ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (autoload 'sgml-mode "psgml" "Yay SGML" t) (setq sgml-always-quote-attributes t sgml-auto-insert-required-elements t sgml-auto-activate-dtd t sgml-data-directory "/usr/share/sgml/declaration/" sgml-indent-data t sgml-indent-step 2 sgml-minimize-attributes nil sgml-omittag nil sgml-shortag nil sgml-custom-markup '(("Version1" "") ("New page" "")) sgml-xml-declaration "/usr/share/sgml/declaration/xml.dcl" sgml-display-char-list-filename "/usr/share/sgml/charsets/iso88591.map" sgml-live-element-indicator t sgml-public-map '("%S" "/usr/share/sgml/%S" "/usr/share/sgml/%o/%c/%d" "/usr/local/lib/sgml/%o/%c/%d") sgml-system-path '("/usr/share/sgml" "/usr/share/sgml/cdtd" "/usr/local/lib/sgml") sgml-tag-region-if-active t sgml-set-face t ) (autoload 'nxml-mode "nxml-mode" "nXML" t) (nconc auto-mode-alist '( ( "\\.xml$" . nxml-mode) ( "\\.docbook$" . nxml-mode ) ( "\\.sgml$" . nxml-mode ))) (when (not athome) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;; CSS mode ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;(setq load-path (cons "~/bin/emacs.els/" load-path)) ;; (autoload 'css-mode "css-mode") ;; (setq auto-mode-alist ;; (cons '("\\.css\\'" . css-mode) auto-mode-alist)) ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;; CSS module ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;(setq load-path (cons "~/bin/emacs.els/" load-path)) ;;(add-hook 'html-helper-load-hook ;; (function (lambda () (load "css.el")))) ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;; PHP module ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (autoload 'php-mode "php-mode" "PHP editing mode" t) (nconc auto-mode-alist '(("\\.php3\\'" . php-mode) ("\\.php\\'" . php-mode))) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;; PSQL module ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (autoload 'psql-mode "psql-mode" "PostgresSQL editing mode" t) (add-to-list 'auto-mode-alist '("\\.p?sql$" . psql-mode )) (setq psql-run-host "onerussian.com") (setq psql-run-port "5432") (setq psql-program-name "/usr/bin/psql") (setq psql-run-database "webdb") ) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; Scheme Mode ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (setq scheme-program-name "mzscheme") ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; Dictionary (frontend to dict) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;(add-to-load-path "/tmp/dictionary-1.7.3" ) ; now system wide (autoload 'dictionary-search "dictionary" "Ask for a word and search it in all dictionaries" t) (autoload 'dictionary-match-words "dictionary" "Ask for a word and search all matching words in the dictionaries" t) (autoload 'dictionary "dictionary" "Create a new dictionary buffer" t) ;(setq dictionary-coding-systems-for-dictionaries '(("mueller" . koi8-r))) (global-set-key [(control c) ?s] 'dictionary-search) (global-set-key [(meta f1)] 'dictionary-search) (global-set-key [(control c) ?m] 'dictionary-match-words) (setq dictionary-server (cond (rutgers "washoe.rutgers.edu") ((or (file-exists-p "/etc/init.d/dictd") off-net) "localhost") (t "localhost"))) ;; Tool-tip support for GNU Emacs 21 (when (featurep 'tooltip) (setq dictionary-tooltip-dictionary "eng-deu") (global-dictionary-tooltip-mode 1)) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; X configure files ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (autoload 'x-resource-generic-mode "generic-x" "mode for editing x config files" t) (add-to-list 'auto-mode-alist '("\\.Xresources$" . x-resource-generic-mode)) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; Prolog Mode ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (autoload 'prolog-mode "prolog" "Prolog editing mode" t) (nconc auto-mode-alist '(("\\.prolog" . prolog-mode) ("\\.pro" . prolog-mode))) (setq prolog-program-name "pl") (setq prolog-consult-string "[user].\n") ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; Java Mode - run JDE if present ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (when (locate-library "jde") (autoload 'jde-mode "jde" "JDE mode" t) (nconc auto-mode-alist '(("\\.java" . jde-mode) ("\\.js" . jde-mode))) (add-hook 'jde-mode-hook 'flyspell-prog-mode)) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; SML Mode ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;(add-to-load-path-els "/SML" ) ;; ;;;(require 'sml-site) (autoload 'sml-mode "sml-mode" "Major mode for editing SML." t) (autoload 'run-sml "sml-proc" "Run an inferior SML process." t) ;; ;;;; put this also if you feel like it (for SML/NJ's compilation manager) ;;(add-to-list 'completion-ignored-extensions "CM/") (setq sml-program-name "sml") (nconc auto-mode-alist '(("\\.sml$" . sml-mode) ("\\.sig$" . sml-mode) ("\\.ML$" . sml-mode))) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; Diff ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (setq diff-switches "-u") (autoload 'diff-mode "diff-mode" "Diff major mode" t) (add-to-list 'auto-mode-alist '("\\.\\(diffs?\\|patch\\|rej\\)\\'" . diff-mode)) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; CVS and related Mode ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; I prefer unified context diffs. (setq cvs-diff-flags '("-upN")) (require 'vc) (defadvice vc-print-log (after set-mode activate compile) "Sets mode to cvs-log-mode" (cvs-log-mode)) (setq vc-annotate-background "seashell") (setq vc-annotate-very-old-color "black") (setq vc-annotate-color-map '(( 26.3672 . "#FF0066") ( 52.7344 . "#EE0055") ( 79.1016 . "#DD0044") (105.4688 . "#DD0033") (131.8359 . "#DD0022") (158.2031 . "#BB0011") (184.5703 . "#0000AA") (210.9375 . "#000099") (237.3047 . "#000088") (263.6719 . "#000077") (290.0391 . "#000066") (316.4063 . "#000055") (342.7734 . "#000044") (369.1406 . "#000033") (395.5078 . "#000022") (421.8750 . "#000011") (448.2422 . "#000000"))) (add-hook 'vc-logentry-check-hook 'flyspell-mode) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; Debian stuff ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (setq debian-changelog-mailing-address "debian@onerussian.com") (setq debian-changelog-full-name "Yaroslav O. Halchenko") ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; CVS Environmental variables ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (defun setenv-default (var val) (unless (getenv var) (setenv var val))) (setenv-default "CVS_RSH" "ssh") (setenv-default "RSYNC_RSH" "ssh") (setenv-default "CVSROOT" ":ext:cvs-bcl.cs.unm.edu:/home/cvs") ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; WINDOWS-EL keeps information about configuration of windows ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;(require 'session) (when (featurep 'revive) (require 'revive) (require 'windows) (win:startup-with-window) (define-key ctl-x-map "C" 'see-you-again) (global-set-key [(super s)] 'see-you-again) (global-set-key [(super r)] 'resume-windows) (autoload 'save-current-configuration "revive" "Save status" t) (autoload 'resume "revive" "Resume Emacs" t) (autoload 'wipe "revive" "Wipe Emacs" t) (define-key ctl-x-map "S" 'save-current-configuration) (define-key ctl-x-map "F" 'resume) (define-key ctl-x-map "K" 'wipe) (add-hook 'kill-emacs-hook 'save-current-configuration) ) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; DIFFERENT SMALL FUNCTIONS ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; ^T - This version always exchanges the prior two chars, so it's context-free (defun my-ctl-t () (interactive) (transpose-chars -1) (forward-char 1)) (defun Kill-Line () (interactive) (beginning-of-line) (kill-line)) (defun Kill-Buffer () (interactive) (kill-buffer (current-buffer))) (if (not (boundp 'emacs-major-version)) (defvar compile-command "make -k" "Defines variable for compile-command")) ;;; Lets compilation window follow the output (setq compilation-scroll-output t) (defun My-Compile () "Saves all unsaved buffers, and runs 'compile'." (interactive) (save-some-buffers t) (compile compile-command) ) (defun scroll-up-one () (interactive) (scroll-up 1)) ; glitch up with C-c C-v (defun line-to-top () (interactive) (recenter 0)) ; point to top w/ C-c C-l (defun gnus-start () (interactive) (message "Starting GNUS...") (gnus)) (defun my-signature (name) (interactive "cSignature (F)ido, (U)NM") (goto-char (point-max)) (shell-command-to-string (concat "cat " (cond ((equal name ?f) "~/pers/signatures/FIDO.sig") ((equal name ?r) "~/pers/signatures/RUTG.sig") (t "~/pers/signatures/UNM.sig"))))) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; MORE DIFFERENT SMALL FUNCTIONS ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (defun copy-url-at-point () "Copy url at point." (interactive) (kill-new (url-get-url-at-point))) ;-;(global-set-key "\^Cu" 'copy-url-at-point) (defun copy-symbol-near-point () "Copy symbol near point." (interactive) (kill-new (symbol-near-point))) ;-;(global-set-key [(control i) s] 'copy-symbol-near-point) ;;; GNU Emacs doesn't have `point-at-bol' and `point-at-eol'. ;;; These are somewhat restricted alternatives. (when (not (fboundp 'point-at-bol)) (defun point-at-bol () (let ((current (point)) bol) (beginning-of-line) (setq bol (point)) (goto-char current) bol))) (when (not (fboundp 'point-at-eol)) (defun point-at-eol () (let ((current (point)) eol) (end-of-line) (setq eol (point)) (goto-char current) eol))) (defun duplicate-current-line () "Duplicate current line. Will not work on the first line." (interactive) (save-excursion (beginning-of-line) (kill-line) (yank) (end-of-line) (newline) (yank) ) ) (global-set-key "\^Cd" 'duplicate-current-line) (defun copy-current-line () "Copy current line." (interactive) (kill-new (buffer-substring (point-at-bol) (point-at-eol)))) (global-set-key "\^Cl" 'copy-current-line) ;; set browser to lynx in a emacs window ;;(setq-default browse-url-browser-function 'browse-url-netscape) (when (locate-library "w3m") (require 'w3m) (setq browse-url-browser-function 'w3m-browse-url) ) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; SCROLLING ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; ;;the following snippet was copied from the Oreilly-published book ;;"Writing GNU Emacs Extensions" by Bob Glickstein. (defalias 'scroll-ahead 'scroll-up) (defalias 'scroll-behind 'scroll-down) (defun scroll-n-lines-ahead (&optional n) "Scroll ahead N lines (1 by default)." (interactive "P") (progn (scroll-ahead (prefix-numeric-value n)) (next-line 1))) (defun scroll-n-lines-behind (&optional n) "Scroll behind N lines (1 by default)." (interactive "P") (progn (scroll-behind (prefix-numeric-value n)) (previous-line 1))) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; BUFFER SWITCHING ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; ;;begin buffer-switching methods, which I bind to Ctrl-TAB and Ctrl-Shift-TAB ;; ---------------------------------------------------------------------- ;; Original yic-buffer.el ;; From: choo@cs.yale.edu (young-il choo) ;; Date: 7 Aug 90 23:39:19 GMT ;; ;; Modified ;; ---------------------------------------------------------------------- (defun yic-ignore (str) (or ;;buffers I don't want to switch to (string-match "\\*Buffer List\\*" str) (string-match "^TAGS" str) (string-match "^\\*Messages\\*$" str) (string-match "^\\*Completions\\*$" str) (string-match "^ " str) ;;Test to see if the window is visible on an existing visible frame. ;;Because I can always ALT-TAB to that visible frame, I never want to ;;Ctrl-TAB to that buffer in the current frame. That would cause ;;a duplicate top-level buffer inside two frames. (memq str (mapcar (lambda (x) (buffer-name (window-buffer (frame-selected-window x)))) (visible-frame-list))) )) (defun yic-next (ls) "Switch to next buffer in ls skipping unwanted ones." (let* ((ptr ls) bf bn go ) (while (and ptr (null go)) (setq bf (car ptr) bn (buffer-name bf)) (if (null (yic-ignore bn)) ;skip over (setq go bf) (setq ptr (cdr ptr)) ) ) (if go (switch-to-buffer go)))) (defun yic-prev-buffer () "Switch to previous buffer in current window." (interactive) (yic-next (reverse (buffer-list)))) (defun yic-next-buffer () "Switch to the other buffer (2nd in list-buffer) in current window." (interactive) (bury-buffer (current-buffer)) (yic-next (buffer-list))) ;;end of yic buffer-switching methods ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; DIFFERENT KEY BINDINGS ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (global-set-key [(hyper T)] 'my-ctl-t) ; previous two chars (global-set-key "\^C\^V" 'scroll-up-one) ; ^C^V move window up one line (global-set-key "\^C\^L" 'line-to-top) ; ^C^L point line to top of window (global-set-key "\C-cr" 'replace-string) ; ^C^R put replace on a key already! (global-set-key "\C-xg" 'goto-line) ; ^Xg go to specific line # (global-set-key "\C-xc" 'compile) ; ^Xc do compilation command (global-set-key "\C-xt" 'auto-fill-mode) ; ^Xt toggle auto fill (global-set-key "\C-x*" 'shell) ; ^X* start or switch to *shell* (global-set-key "\C-xm" 'matlab-shell) ; ^X* start or switch to *shell* ;(global-set-key "\C-xr" 'rmail) ; ^Xr read mail (global-set-key [(super s)] 'server-start) ;Assignments to functional keys which is close to the one under Windows IDEs (global-set-key [help] 'info) (global-set-key [f1] 'man-follow) (global-set-key [(control f1)] 'manual-entry) (global-set-key [f3] 'find-file) (global-set-key [(shift f3)] 'find-file-at-point) (global-set-key [f2] 'save-buffer) (global-set-key [f5] 'delete-other-windows) (global-set-key [f6] 'other-window) (global-set-key [(control f6)] 'switch-to-buffer) (global-set-key [f7] 'replace-string) (global-set-key [f8] 'next-error) (global-set-key [f9] 'My-Compile) (global-set-key [f10] 'delete-frame) (global-set-key [(control f10)] 'kill-buffer) (global-set-key [(control f11)] 'gnus-start) (global-set-key [(control f12)] 'gnus-summary-catchup-and-exit) (global-set-key [(control tab)] 'yic-next-buffer) ;forward reference (global-set-key [(control shift iso-lefttab)] 'yic-prev-buffer) ;forward reference (global-set-key "\M-0" 'buffer-menu) ;(global-set-key [(control menu)] 'popup-mode-menu) ;(global-set-key [(control x) m] 'mh-smail) ;(global-set-key [(control x) r j] 'bookmark-jump) (global-set-key [(meta THORN)] 'execute-extended-command) ;;(global-set-key [(alt meta !)] 'shell-filter-region) (global-set-key "\ " 'checkdoc-rogue-spaces) ;;(global-set-key "\^C-return" 'reindent-then-newline-and-indent) (global-set-key "\^Cs" 'my-signature) (global-set-key "\M-n" 'scroll-n-lines-ahead) ;forward reference (global-set-key "\M-p" 'scroll-n-lines-behind) ;forward reference ;; from Barak's config - seems to be usefull (global-set-key "\M-s" 'center-line) (global-set-key "\M-[" 'backward-paragraph) (global-set-key "\M-]" 'forward-paragraph) ;; (global-unset-key "\M-w") (defun DefineKeyPadKeys () (global-set-key 'kp-1 "1") (global-set-key 'kp-2 "2") (global-set-key 'kp-3 "3") (global-set-key 'kp-4 "4") (global-set-key 'kp-5 "5") (global-set-key 'kp-6 "6") (global-set-key 'kp-7 "7") (global-set-key 'kp-8 "8") (global-set-key 'kp-9 "9") (global-set-key 'kp-0 "0") (global-set-key 'kp-decimal ".") (global-set-key 'kp-enter "\C-m") (global-set-key 'kp-add "+") (global-set-key 'kp-subtract "-") (global-set-key 'kp-multiply "*") (global-set-key 'kp-divide "/") ) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; LaTeX ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;(autoload 'latex-mode "tex-site" "AUCTeX." t) (require 'tex-site) ;; Generate automatic preview of formulas in latex - it is fun! (when (locate-library "preview") (require 'tex-site) (require 'preview) (require 'gs) (setq gs-device "x11") (setq gs-options (append '("-dTextAlphaBits=4" "-dGraphicsAlphaBits=2" "-dMaxBitmap=10000000") gs-options))) (add-hook 'LaTeX-mode-hook '(lambda () (put 'LaTeX-hide-environment 'disabled nil) (setq-default TeX-master nil) ; Query for master file. (setq tex-dvi-view-command "xdvi -allowshell" outline-minor-mode-prefix "\C-c\C-o") (outline-minor-mode) (local-set-key [(super up)] 'hide-subtree) (local-set-key [(super down)] 'show-subtree) (turn-on-reftex) (setq reftex-plug-into-AUCTeX t))) (setq-default x-symbol-image nil x-symbol-8bits nil) ;; (custom-set-variables ;; '(x-symbol-auto-style-alist ;; '((tex-mode % mail-mode message-mode gnus-article-mode vm-presentation-mode) ;; tex t t nil nil t nil))) (when full-dotemacs ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;; MAXIMA ;;; Maxima is a really cool computer algebra system. It lives at ;;; ;;; maxima.el and its siblings provide a nice major mode for editing ;;; Maxima files. They live here: ;;; ;;; .emacs code from ;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (defvar yoh-maxima-p (locate-library "maxima") "Whether or not maxima.el appears to be installed.") (when yoh-maxima-p (autoload 'maxima-mode "maxima" "Maxima mode" t) (autoload 'maxima "maxima" "Maxima interaction" t) (add-to-list 'auto-mode-alist '("\\.max$" . maxima-mode))) ;; imaxima.el is a really cool hack that runs Maxima output through ;; LaTeX and inlines the resultant images. Who needs Maple or ;; Mathematica when you've got Emacs? Get imaxima.el here: ;; (when (locate-library "imaxima") (autoload 'imaxima "imaxima" "Maxima interaction with LaTeX" t) (setq imaxima-pt-size 10 imaxima-fnt-size "normalsize" ;; imaxima-image-type 'postscript ;; imaxima-use-maxima-mode-flag yoh-maxima-p ;; imaxima-gs-options (append imaxima-gs-options "-interaction nonstopmode") )) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;; HTMLIZE ;;; To make HTML files from fontified Emacs buffers, use htmlize.el, ;;; which you can find here: ;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;(when yoh-use-colors-p (when (locate-library "htmlize") (autoload 'htmlize-buffer "htmlize" nil t)) ;;) ) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; TOOLTIPS: Configure tooltips in GNU Emacs 21. (when (featurep 'tooltip) (require 'tooltip) (setq tooltip-mode 1 tooltip-gud-tips-p t) (tooltip-gud-tips-setup)) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; Handle ANSI color sequences nicely. (autoload 'ansi-color-for-comint-mode-on "ansi-color" nil t) (add-hook 'shell-mode-hook 'ansi-color-for-comint-mode-on) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; Be able to open images. (when (fboundp 'auto-image-file-mode) (auto-image-file-mode 1)) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; Indicate Empty Lines ;;!!!!!!!! There should be a cond (setq default-indicate-empty-lines t) ;; But it can be annoying, so let's turn it off occasionally. (let ((hook '(lambda () (setq indicate-empty-lines nil))) (mode-hooks (list 'shell-mode-hook 'term-mode-hook 'gnus-article-mode-hook 'gnus-summary-mode-hook 'gnus-group-mode-hook 'eshell-mode-hook))) (mapc (lambda (mode-hook) (add-hook mode-hook hook)) mode-hooks)) ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; ;; Diary and Calendar ;; ;;; ;; (when (file-exists-p (expand-file-name "~/pers/.diary")) ;; ;; (and isyoh (or unm athome washoe)) ;; (custom-set-variables ;; ;; custom-set-variables was added by Custom -- don't edit or cut/paste it! ;; ;; Your init file should contain only one such instance. ;; '(diary-file "~/pers/.diary") ;; '(load-home-init-file t t) ;; '(mark-diary-entries-in-calendar t)) ;; ;; ;; Initial Window ;; (calendar) ;; (diary) (other-window 1)) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;; BBDB (taken from Barak's .emacs) ;;; (when (and (file-exists-p (expand-file-name "~/pers/.bbdb")) (locate-library "bbdb")) (load-library "bbdb") (bbdb-initialize 'rmail 'gnus 'sendmail) (setq bbdb-file "~/pers/.bbdb" bbdb-default-area-code 505 bbdb-auto-revert-p t bbdb-completion-type nil ;; Fields to skip when showing 'full' entries. bbdb-elided-display '(creation-date timestamp pilot-id) bbdb-pop-up-elided-display '(creation-date timestamp aka address pilot-id attribution) bbdb-display-layout-alist '((one-line (order . (phones mail-alias net notes)) (name-end . 24) (toggle . t)) (multi-line (omit . (creation-date timestamp)) (toggle . t)) (full-multi-line)) ;; (describe-variable 'bbdb-display-layout-alist) bbdb-display-layout 'multi-line bbdb-pop-up-display-layout 'one-line bbdb/gnus-mark-known-posters t ; GNUS subject list will contain marks gnus-optional-headers 'bbdb/gnus-lines-and-from ;; bbdb/mail-auto-create-p 'bbdb-ignore-most-messages-hook bbdb/mail-auto-create-p `bbdb-ignore-most-messages-hook ;ignore most of msg bbdb-ignore-most-messages-alist '(("To" . "yoh@\\|yarik@\\|yaroslav@") ;; ("From" . "@.*lanl\\.gov") )) (autoload 'bbdb/gnus-lines-and-from "bbdb-gnus") (add-hook 'rmail-mode-hook 'bbdb-insinuate-rmail) (add-hook 'gnus-startup-hook 'bbdb-insinuate-gnus) (add-hook 'mail-setup-hook 'bbdb-insinuate-sendmail) (global-set-key "\C-ca" 'bbdb) (global-set-key "\C-cn" 'bbdb-complete-name)) (server-start) (when (and isyoh (or unm athome washoe)) (custom-set-variables ;; custom-set-variables was added by Custom -- don't edit or cut/paste it! ;; Your init file should contain only one such instance. '(ecb-source-path (quote (("/" "/") ("/scsi/home/yoh/rutg/misc" "m")))) '(gnuserv-program (concat exec-directory "/gnuserv")))) (custom-set-variables ;; custom-set-variables was added by Custom -- don't edit or cut/paste it! ;; Your init file should contain only one such instance. '(diary-file "~/pers/.diary") '(load-home-init-file t t) '(mark-diary-entries-in-calendar t)) (server-start) (custom-set-faces ;; custom-set-faces was added by Custom -- don't edit or cut/paste it! ;; Your init file should contain only one such instance. '(trailing-whitespace ((((class color) (background light)) (:background "gray")))))