Added EmacsConfigurationAndHelp directory
[temp.git] / .emacs
blobe62099b6a39f323e19d3dac97da6be4b4fad4288
1 (add-to-list 'load-path "/cygdrive/c/cygwin-1.7/usr/will")\r
2 (add-to-list 'load-path "/cygdrive/c/cygwin-1.7/usr/share/emacs/site-lisp")\r
3 (add-to-list 'load-path "~/.emacs.d")\r
4 (add-to-list 'load-path "~/.emacs.d/conf")\r
5 (add-to-list 'load-path "/cygdrive/c/cygwin-1.7/usr/share/emacs/site-lisp/includes")\r
6 \r
7 ;;my elisp functions\r
8 (load "wl-elisp-funcs")\r
9 \r
10 ;I like the Consolas font!\r
11 ;(set-frame-font "-microsoft-Consolas-normal-normal-normal-*-13-*-*-*-m-0-iso10646-1")\r
12 ;this font is better\r
13 (set-frame-font "Bitstream Vera Sans Mono-12")\r
15 ;Time settings\r
16 (setq display-time-day-and-date t)\r
17 (setq calendar-time-zone -360)\r
18 (setq calendar-standard-time-zone-name "EST")\r
19 (setq calendar-daylight-time-zone-name "EDT")\r
20 (display-time)\r
22 ;; disable bell function\r
23 (setq ring-bell-function 'ignore)\r
25 ;; arg >= 1 enable the menu bar.\r
26 (menu-bar-mode 0)\r
28 ;Enable save history\r
29 (savehist-mode 1)\r
31 ;;Disable the tool bar (with numeric ARG, display the tool bar if and only if ARG is positive)\r
32 (tool-bar-mode -1)\r
34 ;; current buffer name in title bar\r
35 (setq frame-title-format "%b")\r
37 ;;Disble scroll-bar-mode\r
38 (if (fboundp 'scroll-bar-mode) (scroll-bar-mode -1))\r
40 ;;Don't show the startup message\r
41 ;(setq inhibit-startup-message t)\r
43 ;; disable splash screen\r
44 (custom-set-variables\r
45   ;; custom-set-variables was added by Custom.\r
46   ;; If you edit it by hand, you could mess it up, so be careful.\r
47   ;; Your init file should contain only one such instance.\r
48   ;; If there is more than one, they won't work right.\r
49  '(display-time-24hr-format nil)\r
50  '(ecb-cache-directory-contents nil)\r
51  '(ecb-cache-directory-contents-not nil)\r
52  '(ecb-layout-name "left13")\r
53  '(ecb-options-version "2.32")\r
54  '(ecb-primary-secondary-mouse-buttons (quote mouse-1--C-mouse-1))\r
55  '(ecb-show-sources-in-directories-buffer (quote ("left7" "left13" "left14" "left15")))\r
56  '(ecb-source-path (quote (("/cygdrive/c/Projects" "Projects") ("/usr/will/perl" "perl") ("/cygdrive/c/Projects/Rails2.1/cookbook" "cookbook") ("/usr/will/EmacsPractice" "practice") ("/cygdrive/z/" "Z Drive") ("/usr/will/" "will"))))\r
57  '(ecb-tip-of-the-day nil)\r
58  '(inhibit-startup-screen t)\r
59  '(org-agenda-files (quote ("~/notes/Personal/personal.org")))\r
60  '(org-file-apps (quote ((auto-mode . emacs) (directory . "cygstart %s") ("\\.mm\\'" . default) ("\\.x?html?\\'" . default) ("\\.pdf\\'" . "cygstart %s") ("\\.doc\\'" . "cygstart %s") ("\\.xls\\'" . "cygstart %s") ("\\.ppt\\'" . "cygstart %s"))))\r
61  '(ps-bottom-margin 25.51968503937008)\r
62  '(ps-font-family (quote Times))\r
63  '(ps-font-size (quote (12 . 12)))\r
64  '(ps-header-font-size (quote (12 . 12)))\r
65  '(ps-header-offset 18.346456692913385)\r
66  '(ps-inter-column 26.69291338582677)\r
67  '(ps-left-margin 12.69291338582677)\r
68  '(ps-line-number-font-size 10)\r
69  '(ps-print-header t)\r
70  '(ps-print-only-one-header t)\r
71  '(ps-right-margin 28.69291338582677)\r
72  '(ps-spool-duplex nil)\r
73  '(ps-top-margin 25.51968503937008)\r
74  '(tramp-encoding-command-switch "-c")\r
75  '(tramp-encoding-shell "/cygdrive/c/cygwin-1.7/bin/bash.exe"))\r
77 ;(setq default-frame-alist\r
78 ;      '((font . "Bitstream Vera Sans Mono-12")))\r
80 ;;position emacs window in the left half of my screen\r
81 (setq initial-frame-alist\r
82       '((user-position t) (top . 30) (left . 4)\r
83         (width . 92) (height . 57)\r
84         ))\r
86 ;;Clear the PID env var as emacs might inherit this if started from a bash shell\r
87 (setenv "PID" nil)\r
89 ; Override nasty Xfce Home/will\r
90 (setq default-directory "~/" )\r
92 ;;Set up printing using PDFCreator\r
93 (setenv "PRINTER" "PDFCreator")\r
94 (cond ((eq system-type 'cygwin)\r
95    (setq ps-printer-name "PDFCreator")\r
96    (setq ps-printer-name-option "-d")\r
97    (setq ps-lpr-command "/bin/lpr")))\r
99 ;;Something seems to have broken in the above (not working on other machine either)\r
100 ;;Try something different--doesn't work, try something else...\r
101 ;   (setenv "GS_LIB" "/cygdrive/c/Program Files/gs/gs8.64/lib;/cygdrive/c/Program Files/gs/gs8.64/fonts")\r
102 ;   (setq ps-lpr-command "/cygdrive/c/Program Files/gs/gs8.64/bin/gswin32c.exe")\r
103 ;   (setq ps-lpr-switches '("-q" "-dNOPAUSE" "-dBATCH" "-sDEVICE=mswinpr2"))\r
104 ;   (setq ps-printer-name t)\r
106 ;This works (prints with Courier, to change, see file:///C:/Program%20Files/gs/gs8.64/doc/Fonts.htm\r
107 ;(setq ps-printer-name t)\r
108 ;(setq ps-lpr-command "/cygdrive/c/Program Files/gs/gs8.64/bin/gswin32c.exe")\r
109 ;(setq ps-lpr-switches '("-q" "-dNOPAUSE" "-dBATCH"\r
110 ;                       "-sDEVICE=mswinpr2"\r
111 ;                       "-sPAPERSIZE=a4"))\r
113 ;;Window-resizing Functions\r
114 ;;With split windows, I only want the second window as a reference so keep these resize functions handy.\r
115 (defun joc-enlarge-by-ten()\r
116   "enlarges a window 10 lines"\r
117   (interactive)\r
118   (enlarge-window 10))\r
120 (defun joc-shrink-by-five()\r
121   "shrinks a window 5 lines"\r
122   (interactive)\r
123   (shrink-window 5))\r
125 ;;Stevey's Effective Emacs keybindings\r
126 (global-set-key "\C-x\C-m" 'execute-extended-command)\r
127 (global-set-key "\C-c\C-m" 'execute-extended-command)\r
128 (global-set-key "\C-w" 'backward-kill-word)\r
129 (global-set-key "\C-x\C-k" 'kill-region)\r
130 (global-set-key "\C-c\C-k" 'kill-region)\r
131 (global-set-key "\C-xt" 'beginning-of-buffer)\r
132 (global-set-key "\C-xn" 'end-of-buffer)\r
134 ;;Stevey's aliases\r
135 (defalias 'qrr 'query-replace-regexp)\r
137 ;;My keybindings\r
138 (global-set-key [(f4)] 'ecb-activate)\r
139 (global-set-key [(shift f4)] 'ecb-hide-ecb-windows)\r
140 (global-set-key [(shift f3)] 'ecb-show-ecb-windows)\r
141 (global-set-key "\C-ca" 'org-agenda)\r
142 (global-set-key "\C-cg" 'goto-line)\r
143 ; NOTE: C-\ was formerly bound to the toggle-input-method is an interactive compiled Lisp function in `mule-cmds.el'.\r
144 ;;but since mule-cmds is for multi-lingual environments, I thought I'd use it for my replace-backslashes udf.\r
145 (global-set-key "\C-\\" 'replace-backslashes)\r
147 ;;Load macros\r
148 (load-file "~/macros")\r
150 (setq-default ispell-program-name "aspell")\r
152 ;;Useful package for viewing registers\r
153 (require 'list-register)\r
154 (global-set-key (kbd "C-x r v") 'list-register)\r
156 ;color-theme package\r
157 (add-to-list 'load-path "~/.emacs.d/color-theme")\r
158 (require 'color-theme)\r
159 (eval-after-load "color-theme"\r
160   '(progn\r
161      (color-theme-initialize)\r
162      ;(color-theme-hober) ; Not sure I like hober...use wombat instead defined in a fnc below.\r
163      ))\r
165 ;; Org mode settings\r
166 (require 'org-install)\r
167 (add-to-list 'auto-mode-alist '("\\.org$" . org-mode))\r
168 (define-key global-map "\C-cl" 'org-store-link)\r
169 (define-key global-map "\C-ca" 'org-agenda)\r
170 (setq org-log-done t)\r
172 ;;If I want project support in ido (like TextMate)\r
173 (defun ido-find-file-in-tag-files ()\r
174   (interactive)\r
175   (save-excursion\r
176     (let ((enable-recursive-minibuffers t))\r
177       (visit-tags-table-buffer))\r
178     (ido-completing-read "Project file: "\r
179                          (tags-table-files)\r
180                          nil t)))\r
182 ;http://www.emacswiki.org/emacs/ColorTheme\r
183 ;Here are four alternative ways to cycle among color themes in a list. For illustration, they all use the same list.\r
184 (setq my-color-themes (list 'color-theme-billw 'color-theme-jsc-dark\r
185                               'color-theme-sitaramv-solaris 'color-theme-resolve\r
186                               'color-theme-classic 'color-theme-jonadabian-slate\r
187                               'color-theme-kingsajz 'color-theme-shaman\r
188                               'color-theme-subtle-blue 'color-theme-snowish\r
189                               'color-theme-sitaramv-nt 'color-theme-wheat\r
190                               'color-theme-railscasts 'color-theme-sunburst\r
191                               'color-theme-colorful-obsolescence 'color-theme-twilight))\r
193 ;This one doesn't work b/c I don't have the doremi-cmd.el implemented\r
194 ;  (setq doremi-color-themes my-color-themes) ; Otherwise, cycles among _all_ themes.\r
195 ;  (defun doremi-color-themes ()\r
196 ;    "Successively cycle among color themes."\r
197 ;    (interactive)\r
198 ;    (doremi (lambda (newval) (funcall newval) newval) ; update fn - just call theme\r
199 ;            (car (last doremi-color-themes)) ; start with last theme\r
200 ;            nil                           ; ignored\r
201 ;            nil                           ; ignored\r
202 ;            doremi-color-themes))         ; themes to cycle through\r
204     (defun my-theme-set-default () ; Set the first row\r
205       (interactive)\r
206       (setq theme-current my-color-themes)\r
207       (funcall (car theme-current)))\r
209     (defun my-describe-theme () ; Show the current theme\r
210       (interactive)\r
211       (message "%s" (car theme-current)))\r
213    ; Set the next theme (fixed by Chris Webber - tanks)\r
214     (defun my-theme-cycle ()\r
215       (interactive)\r
216       (setq theme-current (cdr theme-current))\r
217       (if (null theme-current)\r
218       (setq theme-current my-color-themes))\r
219       (funcall (car theme-current))\r
220       (message "%S" (car theme-current)))\r
222     (setq theme-current my-color-themes)\r
223     (setq color-theme-is-global nil) ; Initialization\r
224     (my-theme-set-default)\r
225     (global-set-key [f12] 'my-theme-cycle)\r
227 ;;tramp support\r
228 (require 'tramp)\r
229 (setq tramp-default-method "sshx")\r
230 ;;(setq tramp-debug-buffer t)\r
231 ;;(setq tramp-chunksize 500)\r
232 ;;(setq shell-prompt-pattern "^H")\r
235 ;; For Common Lisp stuff\r
236 (require 'cl)\r
238 ;;use mmm mode\r
239 (require 'mmm-mode)\r
240 (require 'mmm-auto)\r
241 (setq mmm-global-mode 'maybe)\r
242 (setq mmm-submode-decoration-level 2)\r
243 (set-face-background 'mmm-output-submode-face  "LightBlue")\r
244 (set-face-background 'mmm-code-submode-face    "LightGray")\r
245 (set-face-background 'mmm-comment-submode-face "LightYellow")\r
246 (set-face-background 'mmm-special-submode-face "Yellow")\r
248 (mmm-add-classes\r
249  '((erb-code\r
250     :submode ruby-mode\r
251     :match-face (("<%#" . mmm-comment-submode-face)\r
252                  ("<%=" . mmm-output-submode-face)\r
253                  ("<%"  . mmm-code-submode-face))\r
254     :front "<%[#=]?"\r
255     :back "%>"\r
256     :insert ((?% erb-code       nil @ "<%"  @ " " _ " " @ "%>" @)\r
257              (?# erb-comment    nil @ "<%#" @ " " _ " " @ "%>" @)\r
258              (?= erb-expression nil @ "<%=" @ " " _ " " @ "%>" @))\r
259     )))\r
261 (mmm-add-classes\r
262  '((gettext\r
263     :submode gettext-mode\r
264     :front "_(['\"]"\r
265     :face mmm-special-submode-face\r
266     :back "[\"'])")))\r
268 (mmm-add-classes\r
269  '((html-script\r
270     :submode javascript-mode\r
271     :front "<script>"\r
272     :back "</script>")))\r
274 (add-to-list 'auto-mode-alist '("\\.rhtml$" . html-mode))\r
275 ;;WSL--I added the following line as an attempt to include those Rails 2.1 rhtml.erb files...\r
276 (add-to-list 'auto-mode-alist '("\\.erb$" . html-mode))\r
278 (add-hook 'html-mode-hook\r
279           (lambda ()\r
280             (setq mmm-classes '(erb-code html-js html-script gettext embedded-css))\r
281             (mmm-mode-on)))\r
283 (add-to-list 'mmm-mode-ext-classes-alist '(ruby-mode nil gettext))\r
285 (global-set-key [f8] 'mmm-parse-buffer)\r
286 ;;END MMM Test\r
288 ;;use ido (interactive do)\r
289 (require 'ido)\r
290 (ido-mode t)\r
292 ;;load line-num.el\r
293 (require 'line-num "line-num.el")\r
295 ;; Load cedet NOTE: Why do I need this?  Maybe just a require\r
296 ;;(load-file "/cygdrive/c/cywin-1.7/usr/share/emacs/site-lisp/cedet-1.0pre4/common/cedet.el")\r
297 (require 'cedet)\r
299 (define-key-after (lookup-key global-map [menu-bar tools])\r
300       [speedbar] '("Speedbar" . speedbar-frame-mode) [calendar])\r
302 ;;turn font-lock on automatically\r
303 (if (fboundp 'global-font-lock-mode)\r
304     (global-font-lock-mode 1)        ; GNU Emacs\r
305   (setq font-lock-auto-fontify t))   ; XEmacs\r
307 ;; Enabling various SEMANTIC minor modes.  See semantic/INSTALL for more ideas.\r
308 ;; Select one of the following:\r
310 ;; * This enables the database and idle reparse engines\r
311 ;;(semantic-load-enable-minimum-features)\r
313 ;;Bind Refresh to F5 key\r
314 (global-set-key [f5]\r
315 '(lambda () "Refresh the buffer from the disk (prompt of modified)."\r
316 (interactive)\r
317 (revert-buffer t (not (buffer-modified-p)) t)))\r
319 ;; * This enables some tools useful for coding, such as summary mode\r
320 ;;   imenu support, and the semantic navigator\r
321 ;;(semantic-load-enable-code-helpers)\r
323 ;; * This enables even more coding tools such as the nascent intellisense mode\r
324 ;;   decoration mode, and stickyfunc mode (plus regular code helpers)\r
325 (semantic-load-enable-gaudy-code-helpers)\r
327 ;; * This turns on which-func support (Plus all other code helpers)\r
328 ;; (semantic-load-enable-excessive-code-helpers)\r
330 ;; This turns on modes that aid in grammar writing and semantic tool\r
331 ;; development.  It does not enable any other features such as code\r
332 ;; helpers above.\r
333 ;; (semantic-load-enable-semantic-debugging-helpers)\r
335 ;;Load ECB\r
336 ;;If you want to load the ECB first after starting it by ecb-activate (faster loading)\r
337 (require 'ecb)\r
339 ;;This loads all available autoloads of ECB, e.g. ecb-activate, ecb-minor-mode, ecb-byte-compile and ecb-show-help.\r
340 (require 'ecb-autoloads)\r
342 ;;Added automatically after activating ECB the 1st time.\r
346 (custom-set-faces\r
347   ;; custom-set-faces was added by Custom.\r
348   ;; If you edit it by hand, you could mess it up, so be careful.\r
349   ;; Your init file should contain only one such instance.\r
350   ;; If there is more than one, they won't work right.\r
351  )\r
353 ;; keep searching throughout the file\r
354 (require 'find-recursive)\r
356 ;;; ri-documentation\r
357 (add-to-list 'load-path "/cygdrive/c/cywin-1.7/usr/share/emacs/site-lisp/ri")\r
358 (setq ri-ruby-script "/cygdrive/c/cywin-1.7/usr/share/emacs/site-lisp/ri/ri-emacs.rb")\r
359 (autoload 'ri "/cygdrive/c/cywin-1.7/usr/share/emacs/site-lisp/ri/ri-ruby.el" nil t)\r
360 ;;Bind the ri command to a key\r
361 ;;Method/class completion is also available\r
362 (add-hook 'ruby-mode-hook (lambda ()\r
363     (local-set-key "\C-cd" 'ri)\r
364     (local-set-key "\C-cf" 'ri-ruby-complete-symbol)\r
365     (local-set-key "\C-ca" 'ri-ruby-show-args)\r
366 ))\r
368 ;;use the ruby-mode for ruby (*.rb) files\r
369 (add-to-list 'load-path "/cygdrive/c/cywin-1.7/usr/share/emacs/site-lisp/ruby-mode")\r
370 (autoload 'ruby-mode "ruby-mode" "Ruby editing mode." t)\r
371 (add-to-list 'auto-mode-alist '("\\.rb$" . ruby-mode))\r
372 (add-to-list 'interpreter-mode-alist '("ruby" . ruby-mode))\r
373 (autoload 'run-ruby "inf-ruby"\r
374     "Run an inferior Ruby process")\r
375 (autoload 'inf-ruby-keys "inf-ruby"\r
376     "Set local key defs for inf-ruby in ruby-mode")\r
377 (add-hook 'ruby-mode-hook\r
378     '(lambda ()\r
379         (inf-ruby-keys)))\r
381 ;;use electric mode for ruby\r
382 (require 'ruby-electric)\r
383 (add-hook 'ruby-mode-hook (lambda () (ruby-electric-mode t)))\r
385 ;;FlymakeRuby\r
386 ;(require 'flymake)\r
387 ;; Change the default colors :)\r
388 ;(set-face-background 'flymake-errline "red4")\r
389 ;(set-face-background 'flymake-warnline "dark slate blue")\r
391 ;NOTE: This includes the flymake-create-temp-in-system-tempdir fnc which\r
392 ; keeps temp files in the system temp dir instead of the same directory as the file.\r
393 ; but until that becomes a problem, I'm going to use the flymake for ruby configuration included in\r
394 ; C:\cygwin-1.7\usr\share\emacs\site-lisp\rails\rails-ruby.el\r
395 ;(require 'flymake-ruby)\r
396 ;(add-hook 'ruby-mode-hook 'flymake-ruby-load)\r
398 ;;emacs-rails\r
399 (setq load-path (cons "/cygdrive/c/cywin-1.7/usr/share/emacs/site-lisp/rails" load-path))\r
400 (require 'snippet)\r
401 (require 'rails)\r
403 ;;use the 4gl-mode for Informix .4gl files\r
404 (autoload '4gl-mode "4gl-mode" "Informix 4gl editing mode." t)\r
405 (add-to-list 'auto-mode-alist '("\.4gl$" . 4gl-mode))\r
406 (add-to-list 'interpreter-mode-alist '("4gl" . 4gl-mode))\r
408 ;;; Set up PSGML\r
409 ;; Add PSGML to load-path so Emacs can find it.\r
410 ;; Note the forward slashes in the path... this is platform-independent so I\r
411 ;; would suggest using them over back slashes. If you use back slashes, they\r
412 ;; MUST BE doubled, as Emacs treats backslash as an escape character.\r
413 (setq load-path (append (list nil "/cygdrive/c/cywin-1.7/usr/share/emacs/site-lisp/psgml/") load-path))\r
415 ;; Use PSGML for sgml and xml major modes.  No, use Jim Clark's nXML major mode\r
416 ;;(autoload 'sgml-mode "psgml" "Major mode to edit SGML files." t)\r
417 ;;(autoload 'xml-mode "psgml" "Major mode to edit XML files." t)\r
419 ;;nXML Mode by Jim Clark\r
420 ;;For documentation of this mode, see http://www.nmt.edu/tcc/help/pubs/nxml/\r
421 ;; Add the nxml files to emacs's search\r
422 ;; path for loading:\r
423 ;;--\r
424 (setq load-path\r
425         (append load-path\r
426                 '("~/.emacs.d/plugins/nxml-mode-20041004/")))\r
427 ;;--\r
428 ;; Make sure nxml-mode can autoload\r
429 ;;--\r
430 ;;File rng-auto.el will not be loaded until needed (for example by opening some .xml file)\r
431 (autoload 'nxml-mode "rng-auto.el" nil t)\r
434 ;;--\r
435 ;; Load nxml-mode for files ending in .xml, .xsl, .rng, .xhtml\r
436 ;;--\r
437   (setq auto-mode-alist\r
438                 (cons '("\\.\\(xml\\|xsl\\|rng\\|xhtml\\)\\'" . nxml-mode)\r
439               auto-mode-alist))\r
442 ;; Use cperl-mode instead of the default perl-mode\r
443 ;;brevity is the soul of wit\r
444 (defalias 'perl-mode 'cperl-mode)\r
446 ;;Customize the tabs for CPerl\r
447 (add-hook 'cperl-mode-hook 'n-cperl-mode-hook t)\r
448 (defun n-cperl-mode-hook ()\r
449   (setq cperl-indent-level 4)\r
450   (setq cperl-continued-statement-offset 0)\r
451   (setq cperl-extra-newline-before-brace t)\r
452   (set-face-background 'cperl-array-face "wheat")\r
453   (set-face-background 'cperl-hash-face "wheat")\r
454   )\r
455 ;;Customizing CPerl mode\r
456 ;;Disable underscore spacebar feature\r
457 (setq cperl-invalid-face nil)\r
458 ;;Expand keywords like foreach, while, etc...\r
459 (setq cperl-electric-keywords t)\r
460 ;;electic parenthesis\r
461 (setq cperl-electric-parens t)\r
462 ;;automatically add newlines before and after braces, colons, semicolons\r
463 (setq cperl-auto-newline nil)\r
465 ;; cmd-mode is automatically activated when you open a file whose\r
466 ;; extention is "cmd" or "bat".\r
467 (autoload 'cmd-mode "cmd-mode" "CMD mode." t)\r
468 (setq auto-mode-alist (append '(("\\.\\(cmd\\|bat\\)$" . cmd-mode))\r
469                                   auto-mode-alist))\r
471 ;;Per Steve Yegge, he always, always, always runs a shell in emacs--until I need to, I'm turning this off...\r
472 ;;(shell)\r
474 ;;Yegge's JavaScript mode\r
475 (autoload 'js2-mode "js2" nil t)\r
476 (add-to-list 'auto-mode-alist '("\\.js$" . js2-mode))\r
477 (setq js2-basic-offset 2)\r
478 (setq js2-use-font-lock-faces t)\r
480 ;;More Yegge Stuff (fonts)  currently not working (parchment-screen nope...linux-font...nope)\r
481 (global-font-lock-mode t)\r
482 ; (parchment-screen)\r
483 ; (set-default-font linux-font)\r
484 ; (set-mouse-color "black")\r
486 ;;Highlights erroneous lines and displays associated error messages.\r
487 ;;set colors in PSGML mode:\r
488 (setq screenshots nil)   ; t for screenshot color settings, else nil\r
490 (make-face 'sgml-comment-face)\r
491 (make-face 'sgml-start-tag-face)\r
492 (make-face 'sgml-end-tag-face)\r
493 (make-face 'sgml-entity-face)\r
494 (make-face 'sgml-doctype-face)\r
496 (cond ((equal screenshots nil)\r
497    (set-face-foreground 'sgml-comment-face "FireBrick")\r
498    (set-face-foreground 'sgml-start-tag-face "SlateBlue")\r
499    (set-face-foreground 'sgml-end-tag-face "SlateBlue")\r
500    (set-face-background 'sgml-entity-face "SlateBlue")\r
501    (set-face-foreground 'sgml-entity-face "Red")\r
502    (set-face-foreground 'sgml-doctype-face "FireBrick")\r
503   )\r
504   ((equal screenshots t)\r
505    ; This set for screen shots\r
506    (set-background-color "White")\r
507    (set-face-foreground 'sgml-comment-face "White")  ; Comments: white on\r
508    (set-face-background 'sgml-comment-face "Gray")   ; gray.\r
509    (set-face-background 'sgml-start-tag-face "Gray") ; Tags: black (default)\r
510    (set-face-background 'sgml-end-tag-face "Gray")   ; on gray.\r
511    (set-face-foreground 'sgml-entity-face "White")   ; Entity references:\r
512    (set-face-background 'sgml-entity-face "Black")   ; white on black.\r
513   )\r
514 (t nil))\r
516 (setq sgml-set-face t)  ; without this, all SGML text is in same color\r
517 (setq sgml-markup-faces\r
518    '((comment   . sgml-comment-face)\r
519      (start-tag . sgml-start-tag-face)\r
520      (end-tag   . sgml-end-tag-face)\r
521      (doctype   . sgml-doctype-face)\r
522      (entity    . sgml-entity-face)))\r
525 (defvar sgml-font-lock-keywords\r
526   '(; Highlight the text between these tags in SGML mode.\r
527       ("<indexterm[^>]*>" . font-lock-comment-face)\r
528       ("</indexterm>" . font-lock-comment-face)\r
529       ("<primary[^<]+</primary>" . font-lock-comment-face)\r
530       ("<secondary[^<]+</secondary>" . font-lock-comment-face)\r
531       ("<see[^<]+</see>" . font-lock-comment-face)\r
532       ("<seealso[^<]+</seealso>" . font-lock-comment-face)\r
533    )\r
534   "Additional expressions to highlight in SGML mode.")\r
536   (setq font-lock-defaults '(sgml-font-lock-keywords t))\r
538 ;;Emulate the clear command from bash to clear the entire shell buffer\r
539 (add-hook 'shell-mode-hook 'n-shell-mode-hook)\r
540 (defun n-shell-mode-hook ()\r
541   "12Jan2002 - sailor, shell mode customizations."\r
542   (local-set-key '[up] 'comint-previous-input)\r
543   (local-set-key '[down] 'comint-next-input)\r
544   (local-set-key '[(shift tab)] 'comint-next-matching-input-from-input)\r
545   (setq comint-input-sender 'n-shell-simple-send)\r
546   )\r
548 (defun n-shell-simple-send (proc command)\r
549   "17Jan02 - sailor. Various commands pre-processing before sending to shell."\r
550   (cond\r
551    ;; Checking for clear command and execute it.\r
552    ((string-match "^[ \t]*clear[ \t]*$" command)\r
553     (comint-send-string proc "\n")\r
554     (erase-buffer)\r
555     )\r
556 ;; Checking for man command and execute it.\r
557    ((string-match "^[ \t]*man[ \t]*" command)\r
558     (comint-send-string proc "\n")\r
559     (setq command (replace-regexp-in-string "^[ \t]*man[ \t]*" "" command))\r
560     (setq command (replace-regexp-in-string "[ \t]+$" "" command))\r
561     ;;(message (format "command %s command" command))\r
562     (funcall 'man command)\r
563     )\r
564    ;; Send other commands to the default handler.\r
565    (t (comint-simple-send proc command))\r
566    )\r
567   )\r
569 (add-to-list 'load-path "/cygdrive/c/cywin-1.7/usr/share/emacs/site-lisp/rhtml/")\r
570     (require 'rhtml-mode)\r
572 ; Install mode-compile to give friendlier compiling support!\r
573 (autoload 'mode-compile "mode-compile"\r
574 "Command to compile current buffer file based on the major mode" t)\r
575 (global-set-key "\C-cc" 'mode-compile)\r
576 (autoload 'mode-compile-kill "mode-compile"\r
577  "Command to kill a compilation launched by `mode-compile'" t)\r
578 (global-set-key "\C-ck" 'mode-compile-kill)\r
580 ;;more from Yegge's "My .emacs file" blog entry\r
581 (defun swap-windows ()\r
582  "If you have 2 windows, it swaps them." (interactive) (cond ((not (= (count-windows) 2)) (message "You need exactly 2 windows to do this."))\r
583  (t\r
584  (let* ((w1 (first (window-list)))\r
585          (w2 (second (window-list)))\r
586          (b1 (window-buffer w1))\r
587          (b2 (window-buffer w2))\r
588          (s1 (window-start w1))\r
589          (s2 (window-start w2)))\r
590  (set-window-buffer w1 b2)\r
591  (set-window-buffer w2 b1)\r
592  (set-window-start w1 s2)\r
593  (set-window-start w2 s1)))))\r
595 ;; Never understood why Emacs doesn't have this function.\r
596 (defun rename-file-and-buffer (new-name)\r
597  "Renames both current buffer and file it's visiting to NEW-NAME." (interactive "sNew name: ")\r
598  (let ((name (buffer-name))\r
599         (filename (buffer-file-name)))\r
600  (if (not filename)\r
601         (message "Buffer '%s' is not visiting a file!" name)\r
602  (if (get-buffer new-name)\r
603          (message "A buffer named '%s' already exists!" new-name)\r
604         (progn   (rename-file name new-name 1)   (rename-buffer new-name)        (set-visited-file-name new-name)        (set-buffer-modified-p nil)))))) ;;\r
606 ;; Never understood why Emacs doesn't have this function, either.\r
607 (defun move-buffer-file (dir)\r
608  "Moves both current buffer and file it's visiting to DIR." (interactive "DNew directory: ")\r
609  (let* ((name (buffer-name))\r
610          (filename (buffer-file-name))\r
611          (dir\r
612          (if (string-match dir "\\(?:/\\|\\\\)$")\r
613          (substring dir 0 -1) dir))\r
614          (newname (concat dir "/" name)))\r
616  (if (not filename)\r
617         (message "Buffer '%s' is not visiting a file!" name)\r
618  (progn  (copy-file filename newname 1)\r
619          (delete-file filename)\r
620          (set-visited-file-name newname)\r
621          (set-buffer-modified-p nil)     t))))\r