 ;;; (see http://www.cabochon.com/~stevey/blog-rants/effective-emacs.html)
 (dolist (f '(menu-bar-mode scroll-bar-mode tool-bar-mode)) (funcall f -1))
 
-;; (setq visible-bell t) ; flash a frame instead of beeping
-
 (transient-mark-mode t) ; highlight marked region
+
 (progn
   (iswitchb-mode t) ; enable switching between buffers using substrings
   (setq iswitchb-prompt-newbuffer nil)) ; create a buffer silently
-(icomplete-mode t) ; enable incremental minibuffer completion
+(icomplete-mode t)  ; enable incremental minibuffer completion
+
 (progn (require 'uniquify) (setq uniquify-buffer-name-style 'forward))
 
 (setq backup-directory-alist '((".*" . "~/.backups"))) ; backups location
+
 (setq require-final-newline t default-indicate-empty-lines t)
+
 (put 'narrow-to-region 'disabled nil)
 
+(setq enable-local-variables :safe)
+
 (setq c-default-style '((c-mode . "linux") (awk-mode . "awk") (other . "gnu")))
-(setq enable-local-variables :safe)
-
+
+;;; GNU global
 (when (file-readable-p "/opt/local/share/gtags/gtags.el")
   (autoload 'gtags-mode "/opt/local/share/gtags/gtags.el" nil t)
   (setq gtags-suggested-key-mapping t gtags-pop-delete t)

				 (buffer-name))))
      (delete-trailing-whitespace))))
(add-hook 'before-save-hook 'delete-trailing-whitespace-if-confirmed)

(global-set-key (kbd "C-c t") 'toggle-truncate-lines)
(global-set-key (kbd "C-c w") 'whitespace-mode)

(global-set-key (kbd "C-c v f") 'view-file)
(global-set-key (kbd "C-c v m") 'view-mode)
;; don't let gtags overwrite `C-c v'
(eval-after-load "gtags" '(define-key gtags-mode-map "\C-cv" nil))

(autoload 'work-log-mode "~/lib/emacs/work-log/work-log.el" nil t)

;;; Org Mode
(eval-after-load "org"
  '(setq org-hide-leading-stars t
	 ;; SEE ALSO http://doc.norang.ca/org-mode.html#sec-16-7
	 org-odd-levels-only t))

;;; Spell check
(global-set-key (kbd "C-c ib") 'ispell-buffer)
(global-set-key (kbd "C-c ir") 'ispell-region)
;XXX; (add-hook 'c-mode-hook 'flyspell-prog-mode)

;;; Dictionary
;; (try `M-x dictionary-match-words')
(when (file-accessible-directory-p "~/lib/emacs/dictionary/")
  (setq load-path (cons "~/lib/emacs/dictionary" load-path))
  (autoload 'dictionary-search "dictionary" nil t)
  (global-set-key (kbd "C-c d") 'dictionary-search)
  (eval-after-load "dictionary"
    '(define-key dictionary-mode-map (kbd "DEL") 'scroll-down)))

(eval-after-load "ps-print"
  '(setq ps-paper-type 'a4
	 ps-print-header nil
	 ps-multibyte-buffer 'bdf-font-except-latin))

(defun insert-logt-entry ()
  "Append new entry to ~/.logt file."
  (interactive)
  (find-file "~/.logt")
  (goto-char (point-min))
  (open-line 1)
  (insert (format-time-string "%a %Y-%m-%d %T> ")))
(global-set-key (kbd "C-c l") 'insert-logt-entry)

(define-key help-map "A" 'apropos-variable)

(setq vc-follow-symlinks t)

;XXX; ;;; --------------------------------------------------------------------
;XXX; ;;; Aquamacs settings

  ;; Your init file should contain only one such instance.
  ;; If there is more than one, they won't work right.
 '(default ((t (:inherit nil :stipple nil :background "Black" :foreground "White" :inverse-video nil :box nil :strike-through nil :overline nil :underline nil :slant normal :weight normal :height 130 :width normal :foundry "apple" :family "Menlo")))))
(put 'scroll-left 'disabled nil)
