Loads and loads of misc updates
[syinit] / 11-pkgs-sy.el
1 ;; 11-pkgs-sy.el --- Various XE Package Settings   -*- Emacs-Lisp -*-
2
3 ;; Copyright (C) 2007 - 2013 Steve Youngs
4
5 ;;     Author: Steve Youngs <steve@sxemacs.org>
6 ;; Maintainer: Steve Youngs <steve@sxemacs.org>
7 ;;    Created: <2007-12-02>
8 ;; Time-stamp: <Friday Aug 16, 2013 13:27:27 steve>
9 ;;   Download: <http://bastard.steveyoungs.com/~steve/SXEmacs/inits/>
10 ;;   HTMLised: <http://bastard.steveyoungs.com/~steve/SXEmacs/htmlinits/11-pkgs-sy.html>
11 ;;   Git Repo: git clone http://git.sxemacs.org/syinit
12 ;;   Keywords: init, compile
13
14 ;; This file is part of SYinit
15
16 ;; Redistribution and use in source and binary forms, with or without
17 ;; modification, are permitted provided that the following conditions
18 ;; are met:
19 ;;
20 ;; 1. Redistributions of source code must retain the above copyright
21 ;;    notice, this list of conditions and the following disclaimer.
22 ;;
23 ;; 2. Redistributions in binary form must reproduce the above copyright
24 ;;    notice, this list of conditions and the following disclaimer in the
25 ;;    documentation and/or other materials provided with the distribution.
26 ;;
27 ;; 3. Neither the name of the author nor the names of any contributors
28 ;;    may be used to endorse or promote products derived from this
29 ;;    software without specific prior written permission.
30 ;;
31 ;; THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR
32 ;; IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
33 ;; WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
34 ;; DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
35 ;; FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
36 ;; CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
37 ;; SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
38 ;; BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
39 ;; WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
40 ;; OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
41 ;; IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
42
43 ;;; Commentary:
44 ;;
45 ;;   Lots of settings for various XEmacs packages that I use.  Plus a
46 ;;   few other packages.
47 ;;
48 ;;   I want to point out that I DO NOT blindly install the "sumo"
49 ;;   packages.  I only install what I need and use.  And I absolutely
50 ;;   DO NOT have the "fsf-compat" package installed.
51
52 ;;; Credits:
53 ;;
54 ;;   The HTML version of this file was created with Hrvoje Niksic's
55 ;;   htmlize.el which is part of the XEmacs "text-modes" package.
56 ;;
57
58 ;;; Todo:
59 ;;
60 ;;     
61
62 ;;; Code:
63 ;:*======================
64 ;:* MusicPD  (Not an XEmacs package)
65 (require 'mpd)
66
67 (defun sy-mpd-play ()
68   "Start playing music from a randomly chosen playlist."
69   (interactive)
70   (mpd-send "clear")
71   (mpd-send "load Full-sorted.playlist")
72   (mpd-send "random 1")
73   (mpd-send "repeat 1")
74   (mpd-playpause))
75
76 (defun 2001-mpd-play ()
77   "Start playing 2001 audio book."
78   (interactive)
79   (mpd-send "clear")
80   (mpd-send "load 2001_A_Space_Odyssey.playlist")
81   (mpd-send "random 0")
82   (mpd-send "repeat 0")
83   (mpd-playpause))
84
85 ;; Audio keybindings
86 (global-set-key [XF86AudioPlay] #'mpd-playpause)
87 (global-set-key [XF86AudioStop] #'mpd-stop)
88 (global-set-key [XF86AudioNext] #'mpd-next-track)
89 (global-set-key [XF86AudioPrev] #'mpd-previous-track)
90 (global-set-key [XF86AudioRaiseVolume] #'mpd-volume-up)
91 (global-set-key [XF86AudioLowerVolume] #'mpd-volume-down)
92 (global-set-key [XF86AudioMute] #'mpd-volume-mute/unmute)
93
94 ;; Mpd frame props
95 (push (cons 'override-redirect t) mpd-dock-frame-plist)
96 (push (cons 'left 1780) mpd-dock-frame-plist)
97 (push (cons 'top 5) mpd-dock-frame-plist)
98 (push (cons 'internal-border-width 4) mpd-dock-frame-plist)
99 (push (cons 'border-width 1) mpd-dock-frame-plist)
100 (push (cons 'border-color "red") mpd-dock-frame-plist)
101
102
103 ;:*======================
104 ;; pcl-cvs - a GNU Emacs front-end to CVS
105 ;; Does anyone use CVS anymore?
106 ;(autoload 'cvs-update "pcl-cvs" nil t)
107 ;(setq
108 ; cvs-reuse-cvs-buffer 'always
109 ; cvs-add-default-message "Initial version"
110 ; cvs-allow-dir-commit t)
111
112 ;:*======================
113 ;:* View-process (`top' for emacs)
114 (require 'view-process-mode)
115 (setq View-process-host-names-and-system-types
116       '(("bastard.steveyoungs.com"
117          ("linux" nil "bsd"
118           View-process-field-name-descriptions-linux
119           View-process-kill-signals-linux))))
120 (setq View-process-status-command-switches-system-v "auxw")
121 (setq View-process-ps-header-window-offset 3)
122 (add-hook 'View-process-header-mode-hook 
123           (lambda ()
124             (set-specifier horizontal-scrollbar-visible-p nil (current-buffer))
125             (set-specifier vertical-scrollbar-visible-p nil (current-buffer))))
126
127 ;:*=====================
128 ;:* whitespace-mode
129 (autoload 'whitespace-mode "whitespace-mode"
130   "Toggle whitespace mode.
131      With arg, turn whitespace mode on iff arg is positive.  In
132      whitespace mode the different whitespaces (tab, blank return) are
133      highlighted with different faces. The faces are:
134      `whitespace-blank-face', `whitespace-tab-face' and
135      `whitespace-return-face'."
136   t)
137
138 (autoload 'whitespace-incremental-mode "whitespace-mode"
139   "Toggle whitespace incremental mode.
140      With arg, turn whitespace incremental mode on iff arg is positive.
141      In whitespace incremental mode the different whitespaces (tab and
142      blank) are highlighted with different faces. The faces are:
143      `whitespace-blank-face' and `whitespace-tab-face'.  Use the command
144      `whitespace-show-faces' to show their values.  In this mode only
145      these tabs and blanks are highlighted, which are in the region from
146      (point) - (window-heigh) to (point) + (window-heigh)."
147   t)
148
149 ;:*======================
150 ;:* func-menu
151 (add-hook 'find-file-hooks 'fume-setup-buffer)
152 (add-hook 'Manual-mode-hook 'turn-on-fume-mode)
153 (define-key global-map "\C-cl" 'fume-list-functions)
154 (define-key global-map "\C-cg" 'fume-prompt-function-goto)
155 (define-key global-map '(control button3) 'mouse-function-menu)
156 (setq
157  fume-display-in-modeline-p t
158  fume-menubar-menu-location "File")
159
160 ;:*======================
161 ;:* font-lock
162 (remove-hook 'font-lock-mode-hook 'turn-on-fast-lock)
163 (require 'font-lock)
164
165 ;:*======================
166 ;:* recent-files.el --- Maintain menu of recently opened files.
167 (when (featurep 'menubar)
168   (require 'recent-files)
169   (setq recent-files-non-permanent-submenu t)
170   (recent-files-initialize))
171
172 ;:*======================
173 ;:* jka-compr
174 ;; Handle automatic (de)compresion of [bg]zip files
175 (require 'jka-compr)
176 (jka-compr-install)
177
178 ;:*======================
179 ;:* iswitchb
180 ;: A really cool package to switch buffers
181 (require 'iswitchb)
182 (setq iswitchb-default-method 'samewindow)
183 (iswitchb-default-keybindings)
184 (add-hook
185  'iswitchb-define-mode-map-hook
186  '(lambda ()
187     (define-key iswitchb-mode-map " " 'iswitchb-next-match)
188     (define-key iswitchb-mode-map [(control ?\ )] 'iswitchb-prev-match)
189     (define-key iswitchb-mode-map "\C-a" 'iswitchb-toggle-ignore)))
190
191 ;:*======================
192 ;:* backup
193 ;:  move all backups in one directory
194 (require 'backup-dir)
195 (setq bkup-backup-directory-info
196       '((t "~/.autosave/" ok-create full-path)))
197 (setq version-control 'preserve-prefer-numbered)
198 (setq-default delete-old-versions t)
199
200 ;:*======================
201 ;:* Load minibuffer history, but only if mule or file-coding is available
202 (when (featurep '(or mule file-coding))
203   (require 'savehist)
204   (setq savehist-file (expand-file-name "history" user-init-directory))
205   (setq savehist-coding-system
206         (coding-system-name (find-coding-system 'iso-8859-1)))
207   (savehist-mode 1))
208
209 ;:*======================
210 ;:* Kyle Jones' redo package.
211 (when running-xemacs
212   (require 'redo)
213   (global-set-key "\C-^" 'redo)         ; for tty-s...
214   (global-set-key [(control ?6)] 'redo) ; ...and for X
215   (global-set-key "\M-_" 'redo))        ; universal
216 (require 'scroll-in-place)
217
218 ;:*======================
219 ;:* pending-del
220 ;:  Non-nil when Pending Delete mode is enabled. In Pending Delete mode, typed
221 ;:  text replaces the selected region. Normally, you shouldn't modify this
222 ;:  variable by hand, but use the function `pending-delete-mode' instead. However,
223 ;:  you can customize the default value from the options menu (auto delete
224 ;:  selection).
225 (require 'pending-del)
226 (turn-on-pending-delete nil)
227
228 ;:*======================
229 ;:* comment-region
230 ;:  Comment or uncomment each line in the region.
231 ;:  Comments are terminated on each line, even for syntax in which newline does
232 ;:  not end the comment.  Blank lines do not get comments.
233 (require 'newcomment)
234 (global-set-key '(control f12)  'comment-or-uncomment-region)
235 (global-set-key '(meta f12) 'uncomment-or-uncomment-region)
236
237 ;:*======================
238 ;:* parens that mark sexpressions
239 (require 'paren)
240 (paren-set-mode 'paren)
241
242 ;:*======================
243 ;:* easy editing of crontab files
244 (require 'crontab-edit "crontab.elc")
245 (setq crontab-delete-blank-lines nil)
246 (setq crontab-filename (expand-file-name ".crontab" (user-home-directory)))
247 (setq crontab-directory
248       (paths-construct-path '("spool" "cron" "crontabs") "/var"))
249
250 ;:*======================
251 ;:* a major mode for editing X resource database files
252 (autoload 'xrdb-mode "xrdb-mode" "Mode for editing X resource files" t)
253
254 ;:*======================
255 ;:* Footnote package
256 (require 'footnote)
257
258 ;:*======================
259 ;:* Filladapt-Mode
260 (require 'filladapt)
261 (setq-default filladapt-mode t)
262 (setq filladapt-fill-column-tolerance 5)
263 (add-hook 'c-mode-hook 'turn-off-filladapt-mode)
264
265 ;:*======================
266 ;:* Speedbar
267 (setq
268  speedbar-query-confirmation-method 'none-but-delete
269  speedbar-show-unknown-files t
270  speedbar-tag-hierarchy-method '(speedbar-prefix-group-tag-hierarchy
271                                  speedbar-trim-words-tag-hierarchy
272                                  speedbar-simple-group-tag-hierarchy
273                                  speedbar-sort-tag-hierarchy)
274  speedbar-track-mouse-flag t
275  speedbar-use-tool-tips-flag t
276  speedbar-visiting-tag-hook 'speedbar-recenter-to-top)
277
278 (when (featurep 'menubar)
279   (add-menu-button '("Tools")
280                    ["Speedbar" speedbar-frame-mode
281                     :style toggle
282                     :selected (and (boundp 'speedbar-frame)
283                                    (frame-live-p speedbar-frame)
284                                    (frame-visible-p speedbar-frame))]
285                    "--"))
286 (global-set-key [(f4)] 'speedbar-get-focus)
287 (require 'sb-info)
288 (require 'sb-texinfo)
289 (eval-after-load "speedbar" '(load-library "sb-texinfo"))
290 (eval-after-load "speedbar" '(load-library "sb-html"))
291 (autoload 'w3-speedbar-buttons "sb-w3"
292   "W3 specific speedbar button generator.")
293
294 ;; Speedbar frame props (so I can use matched windows in Sawfish)
295 (setq speedbar-frame-plist
296       (plist-put speedbar-frame-plist 'name "Speedbar::Frame"))
297 ;:*======================
298 ;:* Shell-mode
299 (autoload 'ansi-color-for-comint-mode-on "ansi-color" nil t)
300 (add-hook 'shell-mode-hook 'ansi-color-for-comint-mode-on)
301 (add-hook 'shell-mode-hook 'turn-on-font-lock)
302
303 ;:*=======================
304 ;:* Shell-script
305 (setq sh-basic-offset 8)
306
307 ;:*======================
308 ;:* Compile-Mode
309 (setq
310  compilation-always-signal-completion t
311  mode-compile-make-program "make"
312  compilation-read-command t
313  compilation-window-height 10
314  compile-command "make")
315
316 ;:*======================
317 ;:* Balloon Help (now in calendar settings)
318
319 ;:*======================
320 ;:* Version Control
321 (vc-load-vc-hooks)
322 (setq
323  vc-handled-backends '(Arch SVN GIT CVS MCVS RCS)
324  vc-follow-symlinks t)
325
326 ;:*======================
327 ;:* Ediff & Diff-mode
328 (require 'ediff)
329 (require 'diff-mode)
330 (setq ediff-use-toolbar-p nil        ; was t but plays havoc with xwem
331       ediff-custom-diff-options "-u"
332       ediff-window-setup-function 'ediff-setup-windows-plain)
333 (setq diff-switches "-u")
334
335 ;:*=====================
336 ;:* Tramp
337 (require 'tramp)
338 (setq tramp-default-method "ssh"
339       tramp-auto-save-directory "~/.autosave/"
340       tramp-remote-path
341       '("/usr/lib/pkgusr"
342         "/usr/bin"
343         "/bin"
344         "/usr/X11R6/bin"))
345
346 ; :*======================
347 ; :* Eshell
348 ;(require 'pcmpl-arch)
349 (setq 
350  eshell-ask-to-save-history 'always
351  eshell-save-history-on-exit t
352  eshell-banner-message (concat "Welcome to Eshell on "
353                                (system-name)
354                                ", running "
355                                (shell-command-to-string "uname -rs")
356                                "In: "
357                                emacs-version
358                                "\n\n")
359  eshell-hist-ignoredups t
360  eshell-modules-list '(eshell-alias
361                        eshell-banner
362                        eshell-basic
363                        eshell-cmpl
364                        eshell-dirs
365                        eshell-glob
366                        eshell-hist
367                        eshell-ls
368                        eshell-pred
369                        eshell-prompt
370                        ;eshell-rebind 
371                        eshell-script
372                        ;eshell-smart
373                        eshell-term
374                        eshell-unix
375                        eshell-xtra))
376
377 (defun sy-eshell-bol-maybe (&optional prompt)
378   "*Move point to beginning of command or bol if there already.
379  If at bol, move point to beginning of command.
380  Optional arg, PROMPT is a regexp of your eshell prompt."
381   (interactive)
382   (let* ((prompt (or prompt "^.+ [$%] "))
383          (lbpos (point-at-bol))
384          (prspos (save-excursion
385                    (goto-char lbpos)
386                    (search-forward-regexp prompt (point-at-eol) t)))
387          (cpos (point)))
388     (goto-char
389      (cond ((null prspos)
390             lbpos)
391            ((= cpos (or prspos 0))
392             lbpos)
393            (prspos)
394            (t lbpos)))))
395
396 (defun sy-eshell-bol-maybe-key ()
397   (define-key eshell-mode-map [(control ?a)] 'sy-eshell-bol-maybe))
398
399 (add-hook 'eshell-mode-hook #'sy-eshell-bol-maybe)
400 (add-hook 'eshell-mode-hook #'sy-eshell-bol-maybe-key t)
401 (add-hook 'eshell-output-filter-functions #'eshell-handle-ansi-color)
402
403 (defun sy-esh-cdl (&optional type)
404   "Eshell function to find current kernel's build or source dir.
405
406  Non-nil TYPE means find the current kernel's build directory, otherwise
407  find the source directory."
408   (let* ((base "/lib/modules/")
409          (ver (substring (shell-command-to-string "uname -r") 0 -1))
410          (dir (file-name-as-directory
411                (concat base ver "/"
412                        (if type
413                            "build"
414                          "source")))))
415     (cd dir)))
416
417 (defun cdls ()
418   "Change directory to current kernel source directory.
419
420  Convenience function to use with Eshell."
421   (interactive)
422   (sy-esh-cdl))
423
424 (defun cdlb ()
425   "Change directory to current kernel build directory.
426
427  Convenience function to use with Eshell."
428   (interactive)
429   (sy-esh-cdl 'build))
430
431 ; :*======================
432 ; :* FFAP -- Find File At Point
433 (require 'ffap)
434
435 (setq
436  ffap-bindings
437  (nconc
438   '((global-set-key '(shift button3) 'ffap-at-mouse)
439     (global-set-key '(control shift button3) 'ffap-menu)
440     (global-set-key "\C-x\C-f" 'find-file-at-point)
441     (global-set-key "\C-x4f"   'ffap-other-window)
442     (global-set-key "\C-x5f"   'ffap-other-frame)))
443  ffap-machine-p-known 'accept
444  ffap-machine-p-unknown 'accept
445  ffap-machine-p-local 'accept)
446
447 (ffap-bindings)
448 (add-hook 'mouse-track-click-hook 'ffap-mouse-track-click)
449
450 ;:*======================
451 ;:* Auto-Insert
452 (require 'auto-insert-tkld)
453
454 (setq auto-insert-alist '(("\\.texi\\(nfo\\)?$" . "TeXinfo")
455                           ("\\.c$"              . "C")
456                           ("\\.cc$"             . "C++")
457                           ("\\.h$"              . "C Header")
458                           ("\\.el$"             . "Emacs Lisp")
459                           ("[Mm]akefile"        . "Makefile")
460                           ("\\.sh$"             . "Sh")
461                           ("\\.pl$"             . "Perl")))
462
463 (setq auto-insert-type-alist '(("TeXinfo"    . "texinfo-insert.texi")
464                                ("C"          . "c-insert.c")
465                                ("C Header"   . "h-insert.h")
466                                ("C++"        . "c++-insert.cc")
467                                ("Emacs Lisp" . "elisp-insert.el")
468                                ("Makefile"   . "makefile.inc")
469                                ("Perl"       . "perl-insert.pl")
470                                ("Sh"         . "sh-insert.sh")))
471
472 (add-to-list 'auto-insert-path '"~/etc/SXEmacs/templates/")
473
474 ;; Don't auto-insert into AucTeX style .els
475 (defadvice TeX-auto-store (around no-auto-insert activate)
476   "Ensure auto-insert is deactivated"
477   (let ((auto-insert-automatically nil))
478     ad-do-it))
479 (message "Auto-Insert initialised!")
480 ;:*======================
481 ;:* XEtla
482 ; I don't think anyone uses tla anymore
483 ;(require 'xetla)
484 ;(setq
485 ; xetla-show-internal-buffers-on-menu nil
486 ; xetla-switch-to-buffer-mode 'single-window
487 ; xetla-use-arrow-keys-for-navigation t)
488 ;(defun sy-xetla-reload ()
489 ;  "Reload XEtla."
490 ;  (interactive)
491 ;  (call-interactively 'xetla-reload)
492 ;  (require 'xetla-browse)
493 ;  (setq
494 ;   xetla-show-internal-buffers-on-menu nil
495 ;   xetla-switch-to-buffer-mode 'single-window
496 ;   xetla-use-arrow-keys-for-navigation t))
497
498 ;:*=======================
499 ;:* My git shit
500 (require 'sy-git)
501
502 ;:*======================
503 ;:* Emacs Lisp List
504 (defvar sxell-initialised-flag)
505 (defvar sxell-download-directory)
506 (when (and (featurep '(and sxemacs postgresql))
507            (fboundp 'ffi-defun))
508   (require 'sxell)
509   (setq sxell-initialised-flag t
510         sxell-download-directory
511         (file-name-as-directory (expand-file-name "download/SXEmacs"
512                                                   (user-home-directory)))))
513 ;:*======================
514 ;:* EasyPG
515 (require 'epa-setup)
516
517 (defun sy-epa-export-key ()
518   "Wrapper for `epa-export-keys' to export ASCII armoured keys."
519   (interactive)
520   (let ((epa-armor t))
521     (call-interactively #'epa-export-keys)))
522
523 (define-key epa-key-list-mode-map [?O] #'sy-epa-export-key)
524
525 ;:*=======================
526 ;:* Howm thing. (this needs mule, but that is default so no biggie)
527 (require 'howm)
528
529 ;; howm has the unfortunate name that ends in `wm' which is what
530 ;; winmgr-mode uses, so nuke winmgr-mode from auto-mode-alist
531 (remove-alist 'auto-mode-alist "\\.[^/]*wm2?\\(?:rc\\)?\\'")
532
533 ;; The howm people are stupid, they bind C-h to scroll-down
534 ;; Get rid of it and replace with DEL and BACKSPACE
535 (define-key howm-menu-mode-map "\C-h" nil)
536 (define-key howm-menu-mode-map [delete] #'scroll-down)
537 (define-key howm-menu-mode-map [backspace] #'scroll-down)
538 (define-key riffle-summary-mode-map "\C-h" nil)
539 (define-key riffle-summary-mode-map [delete] #'scroll-other-window-down)
540 (define-key riffle-summary-mode-map [backspace] #'scroll-other-window-down)
541 (define-key riffle-contents-mode-map "\C-h" nil)
542 (define-key riffle-contents-mode-map [delete] #'scroll-down)
543 (define-key riffle-contents-mode-map [backspace] #'scroll-down)
544
545 ;; Add a binding to show the active todo list
546 (global-set-key [(control ?c) ?t] #'howm-list-active-todo)
547
548 ;; Another problem with howm... it fucks up window configuration
549 (defadvice howm-keyword-search (before howm-save-kw (&rest args) activate)
550   "Save window configuration before viewing howm buffers."
551   (window-configuration-to-register ?h))
552
553 (defadvice howm-list-grep-fixed (before howm-save-win1 (&rest args) activate)
554   "Save window configuration before viewing howm buffers."
555   (window-configuration-to-register ?h))
556
557 (defadvice howm-list-grep (before howm-save-win (&rest args) activate)
558   "Save window configuration before viewing howm buffers."
559   (window-configuration-to-register ?h))
560
561 (defadvice howm-list-todo (before howm-save-win (&rest args) activate)
562   "Save window configuration before viewing howm buffers."
563   (window-configuration-to-register ?h))
564
565 (defadvice howm-list-active-todo (before howm-save-win (&rest args) activate)
566   "Save window configuration before viewing howm buffers."
567   (window-configuration-to-register ?h))
568
569 (defadvice riffle-kill-buffer (after howm-restore-win (&rest args) activate)
570   "Restore the original window configuration."
571   (jump-to-register ?h))
572
573 (setq howm-directory "~/.howm")
574
575 ;; howm fucks up font-lock'ing like you wouldn't believe, adding a
576 ;; call to `turn-on-font-lock' here at least restores a certain level
577 ;; of normalcy.
578 (defun turn-on-howm-mode ()
579   (turn-on-font-lock)
580   (howm-mode 1))
581
582 (defun turn-off-howm-mode ()
583   (howm-mode 0))
584
585 ;; Turn it on where I need it
586 (add-hook 'lisp-interaction-mode-hook #'turn-on-howm-mode)
587 ;; You gotta be fooking kidding me, this prevents lisp-initd.el from
588 ;; compiling the generated .el
589 ;; (add-hook 'emacs-lisp-mode-hook #'turn-on-howm-mode)
590 (add-hook 'text-mode-hook #'turn-on-howm-mode)
591 (add-hook 'latex-mode-hook #'turn-on-howm-mode)
592 (add-hook 'c-mode-hook #'turn-on-howm-mode)
593 (add-hook 'sh-mode-hook #'turn-on-howm-mode)
594
595 ;; Turn it off where I don't
596 (add-hook 'emchat-log-mode-hook #'turn-off-howm-mode)
597 (add-hook 'html-mode-hook #'turn-off-howm-mode)
598 (add-hook 'texinfo-mode-hook #'turn-off-howm-mode)
599
600 ;;; Various other howm problem fixes
601
602 ;; I'm having a big problem with howm/font-lock/message-mode playing
603 ;; nicely together.  This gives me font-locking in message-mode, plus
604 ;; howm functionality, but no howm font-locking.  I can live without
605 ;; howm font-lock in one buffer.
606 (add-hook 'message-mode-hook #'(lambda ()
607                                  (font-lock-mode)
608                                  (font-lock-mode)))
609 ;; XEtla/howm probs
610 ;(add-hook 'xetla-changelog-mode-hook #'turn-on-font-lock)
611 ;(add-hook 'xetla-log-edit-mode-hook #'turn-on-font-lock)
612 ;; ChangeLogs
613 (add-hook 'change-log-mode-hook #'font-lock-mode)
614
615 ;;:*=====================
616 ;;:* snap!
617 ;;  save/load snapshot of application to/from text
618 ;;  Usage:
619 ;; 
620 ;;  (1) M-x snap-record on application, e.g. Wanderlust.
621 ;;  (2) Yank (C-y) on any buffer, e.g. *scratch* or ~/memo.txt.
622 ;;  (3) M-x snap-play on yanked text ==> snapshot (1) is restored.
623 (require 'snap)
624
625 ;;;; env var trickery.
626 (setq snap-abbreviate-environment-variables
627       '("HOME" "JAVA_HOME" "module_path"))
628
629 (defadvice snap-abbreviate-file-name (around env-var (raw-path) activate)
630   ad-do-it
631   (let ((path (expand-file-name raw-path))
632         (rules (mapcar #'(lambda (var)
633                            (let ((val (getenv var)))
634                              (and val
635                                   (cons (concat "^" (regexp-quote val))
636                                         (format "${%s}" var)))))
637                        snap-abbreviate-environment-variables)))
638     (mapc #'(lambda (r)
639               (when (and r (string-match (car r) path))
640                 (setq ad-return-value
641                       (replace-regexp-in-string (car r) (cdr r) path))))
642           (reverse rules))))
643
644 ;; Bookmark extras
645 (eval-after-load "bookmark"
646   (progn
647     (ad-enable-advice 'bookmark-buffer-file-name 'around 'with-snap)
648     (ad-enable-advice 'bookmark-jump-noselect 'around 'with-snap)))
649
650 ;; ffap extras 
651 (setq ffap-url-regexp snap-ffap-url-regexp)
652 (setq ffap-url-fetcher snap-ffap-url-fetcher)
653
654 ;:*=======================
655 ;:* ElDoc (handy thingy dingy for lisp programming)
656 ;;  displays function args and var doc strings in echo area
657 ;(setq eldoc-use-idle-timer-p nil)
658 ;(autoload #'turn-on-eldoc-mode "eldoc" nil t)
659 ;(add-hook 'emacs-lisp-mode-hook #'turn-on-eldoc-mode)
660 ;(add-hook 'lisp-interaction-mode-hook #'turn-on-eldoc-mode)
661
662 ;:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*
663 (message "packages loaded")