;;; gawd-mode-frobs.el --- Startup code that plays with specific modes' options ;;; Copyright (C) 1999--2001 Nix . ;; Author: Nix ;; Created: 1999-04-18 ;; Keywords: local ;; Version: $Revision: 1.25 $ ;; This file is not part of XEmacs. ;;; Commentary: ;; This file exists to centralise generic stuff that was ;; previously scattered all over site-start.el. ;; All stuff fiddling with specific major and minor modes goes ;; in here; yes, even keymap fiddles. (When the Grand Fix to ;; gawd-keys.el is done, we can move the keymap fiddles into there.) ;;; Code: ;; Requirements (require 'advice) ; the term-output-filter-functions and dired stuff &c do heavy advisements (require 'filladapt) ; Adaptive filling (for C code!) (require 'hideshow) ; Turn Emacs into a folding editor. (require 'term) ; We need it for lots of stuff below. (require 'comint) ; We need it for comint-truncate-buffer (require 'vc) ; Needed for `vc-before-checkin-hook'. (unless (noninteractive) (require 'uptimes)) ; Track uptimes of Emacs. (eval-when-compile (require 'uptimes)) ; Compilations, even noninteractive ones, need it too (eval-when-compile ; ensure that at compile time Emacs can see all function and macro definitions (require 'dired) (require 'cc-cmds) (require 'cc-styles) (require 'jde)) ;; auto-mode-alist customizations, for newly added packages &c (setq auto-mode-alist (append '(("\\.plt$" . gnuplot-mode) ("\\.m$" . matlab-mode) ("\\.jl$" . sawfish-mode)) auto-mode-alist)) ;; time.el customizations (time / date / lavg in mode line) (setq display-time-day-and-date t ; Display the day and date in the mode line display-time-form-list '(date time-text load) ; Don't say if mail is waiting display-time-interval 30 ; Redisplay every thirty seconds display-time-24hr-format t ; Use 24hr format; I hate AM/PM, crappy artificial solar distinction :) display-time-load-list '(0.5 1.2 1.5 1.7 2.3 2.9)) ; New load avgs, taking into account that mine is normally >=1 ;; Display XEmacs uptime at the end of the modeline. (defvar gawd-uptime-string nil "The uptime string displayed in the modeline.") (defun gawd-update-uptime () "Update the `gawd-uptime-string' displayed in the modeline." (interactive) (setq gawd-uptime-string (multiple-value-bind (days hours mins secs) (uptimes-uptime-values) (format "%id-%0.2i:%0.2i" days hours mins)))) (unless (noninteractive) (gawd-update-uptime) (add-hook 'display-time-hook 'gawd-update-uptime) (define-modeline-control "uptime" (list "---{" 'gawd-uptime-string "}%-") "Modeline control identifying XEmacs's uptime." nil "button3 displays all uptime records for this XEmacs.") (define-key modeline-uptime-map (kbd "") 'uptimes-this) (define-key modeline-uptime-map (kbd "") 'uptimes) ;; Put the uptime at the end of the modeline. (setq-default modeline-format (append modeline-format (list (cons modeline-uptime-extent 'modeline-uptime)))) (setq-default modeline-format (list-shuffle-predicated #'(lambda (el seq) (eq (cdr-safe el) 'modeline-uptime)) #'(lambda (el seq) (nth (- (length seq) 2) seq)) modeline-format)) (setq modeline-format (default-value 'modeline-format))) ;; tramp customizations (require 'tramp) ;; dired customizations (add-hook 'dired-load-hook (function (lambda () "Set up dired variables initially" (setq dired-ls-F-marks-symlinks (memq system-type '(aix-v3 hpux silicon-graphics-unix usg-unix-v)) dired-copy-preserve-time t dired-no-confirm '(byte-compile compress ispell load shell uncompress) dired-omit-files t dired-compression-method-alist (cons '(bzip2 ".bz2" ("bzip2") ("bzip2" "-d") "-f") dired-compression-method-alist))))) ;; igrep customizations. (eval-when-compile (require 'igrep)) (igrep-define zgrep) (igrep-define bzgrep) (igrep-find-define zgrep) (igrep-find-define bzgrep) ;; This provides a nifty dired function which acts ;; like `dired-do-find-file', only it can visit an unlmited ;; number of files at once and does not affect the screen. (defun gawd-simultaneous-find-file (file-list &optional displayp) "Visit all files in FILE-LIST. Arrange them in the frame's buffer list with `record-buffer', as though switched to via `\\[switch-to-buffer]'. If DISPLAYP is non-nil, display them simultaneously, like `dired-simultaneous-find-file'; otherwise, do not affect the display. This provides a much-needed feature, the equivalent of `vi *' for heathens, only more powerful. `dired-simultaneous-find-file' implements much of this, but not all, as it cannot hide the buffers it displays and cannot be used to look at more than a small number of files at once." (if displayp (dired-simultaneous-find-file file-list) (mapc (function (lambda (file) (let ((find-file-run-dired t)) (record-buffer (find-file-noselect file))))) file-list))) (defun gawd-dired-do-find-file (&optional arg) "Visit all marked files at once. With negative prefix arg, display them simultaneously. See also functions `dired-do-find-file' and `gawd-simultaneous-find-file'." (interactive "p") (gawd-simultaneous-find-file (dired-get-marked-files nil) (< arg 0))) (add-hook 'dired-setup-keys-hook #'(lambda () "Set up dired keymaps initially" (define-key dired-mode-map (kbd "C-c F") 'gawd-dired-do-find-file))) ;; This lets you spell-check marked files via ispell.el. (defun gawd-dired-do-to-file-internal (function &optional args) "Call some FUNCTION on the marked files, loading them temporarily if they're not already loaded, and saving them afterwards." (let* ((file-buffer-exists (get-buffer (dired-get-filename 'no-dir))) (file-buffer (if file-buffer-exists file-buffer-exists (find-file-noselect (dired-get-filename))))) (save-excursion (save-window-excursion (set-buffer file-buffer) (set-window-buffer (last-nonminibuf-window) file-buffer t) (save-restriction (apply function args) (unless file-buffer-exists (save-buffer) (kill-buffer file-buffer))))))) (defun gawd-dired-ispell-file () "Ispell a file." (gawd-dired-do-to-file-internal 'ispell) nil) (defun gawd-dired-ispell-file-comments () "Ispell a file's comments." (gawd-dired-do-to-file-internal 'ispell-comments-and-strings) nil) (defun gawd-dired-ispell-marked-files (&optional arg) "Ispell the marked (or next ARG) files." (interactive "P") (dired-map-over-marks-check 'gawd-dired-ispell-file arg 'ispell "spell-check")) (defun gawd-dired-ispell-marked-file-comments (&optional arg) "Ispell the marked (or next ARG) files." (interactive "P") (dired-map-over-marks-check 'gawd-dired-ispell-file-comments arg 'ispell "spell-check")) (add-hook 'dired-setup-keys-hook #'(lambda () "Set up dired keymaps initially" (define-key dired-mode-map (kbd "C-c $") 'gawd-dired-ispell-marked-files) (define-key dired-mode-map (kbd "C-c ;") 'gawd-dired-ispell-marked-file-comments))) ;; flyspell customizations (mapc #'(lambda (mode) (put mode 'flyspell-mode-predicate 'flyspell-generic-progmode-verify)) '(c-mode c++-mode java-mode shell-script-mode cperl-mode jde-mode lisp-mode scheme-mode lisp-interaction-mode)) ;; calendar customizations (add-hook 'calendar-load-hook #'(lambda () (setq calendar-week-start-day 1 ; Weeks start on a Monday in the UK number-of-diary-entries [2 2 2 2 2 4 1] mark-diary-entries-in-calendar t mark-holidays-in-calendar t european-calendar-style t))) ;; browse-kill-ring customizations (setq browse-kill-ring-quit-action 'save-and-restore browse-kill-ring-display-duplicates nil) ;; Tempbuf customizations (setq tempbuf-mode-line-string " Temp") (add-hook 'custom-mode-hook 'turn-on-tempbuf-mode) (add-hook 'w3-mode-hook 'turn-on-tempbuf-mode) (add-hook 'Manual-mode-hook 'turn-on-tempbuf-mode) (add-hook 'browse-kill-ring-hook 'turn-on-tempbuf-mode) ;; w3m customizations ; Turn off stuff that requires MULE or expects me to be a Japanese speaker (setq w3m-language "English" w3m-process-environment nil w3m-coding-system 'iso-8859-1 w3m-output-coding-system 'iso-8859-1 w3m-file-coding-system 'iso-8859-1 w3m-file-name-coding-system 'iso-8859-1 w3m-bookmark-file-coding-system 'iso-8859-1) ; Miscellaneous customizations; some will have no effect outside X. (setq w3m-key-binding 'info ; Better for Emacs than Lynx w3m-display-inline-image t w3m-pop-up-windows nil w3m-search-default-engine "google") (add-hook 'w3m-load-hook #'(lambda () (add-to-list 'w3m-content-type-alist '("application/x-dvi" "\\.dvi$" ("xdvi" file))))) ;; Printing customizations (setq ps-paper-type 'a4) ; European citizens all ;; efs frobs (defalias 'efs-get-pid 'emacs-pid) ; Work around a horrible efs bug ;; bbdb frobs (bbdb-initialize) ; Initialize the BBDB (setq bbdb-info-file "bbdb.info.gz" ; Our info file is gzipped, say so for `bbdb-info' bbdb-north-american-phone-numbers-p nil ; We are not all Yanks, thanks bbdb-notice-auto-save-file t) ; Use autosave files correctly ;; Fix the broken mail-mode-hook (defvar mail-mode-hook nil "Called when a new mail message is created. Should be created in sendmail.el, but sendmail.el forgets to do so.") ;; Set the ispell dictionary and hyphenation language. (setq ispell-dictionary "british" hyphenation-initial-language "uk") ;; Turn off tshell-mode's horrible broken variable autoexpansion. (setq tshell-input-autoexpand nil) ;; Set up the equivalent of output-filter-functions for eterms, which do not ;; implement them (defvar gawd-term-output-filter-functions '(comint-truncate-buffer) "Functions to call immediately after output is inserted into the buffer. One possible function is `comint-truncate-buffer'. These functions get one argument, a string containing the text inserted.") (make-local-hook 'gawd-term-output-filter-functions) (defadvice term-emulate-terminal (after gawd-term-emulate-terminal) "Implement output-filter-functions for term-mode. Called after the string has been displayed. Only calls its hooks if we have just ended a line; kludgy, maybe, but CPU-efficient, and good enough for log tailing :)" (if (= (aref str (- (length str) 1)) ?\n) (save-excursion (set-buffer (process-buffer proc)) (run-hook-with-args 'gawd-term-output-filter-functions str)))) ;; Stop term-mode's history-fetch messages from being logged. ;; We don't want to use `log-message-ignore-regexps', because it is too slow. We ;; don't want to redefine `message' globally because doing a regexp match in ;; there is just as slow :) and we don't want to change the code to specify 'log ;; priority. We can't locally rebind `log-message-ignore-regexps' because that ;; takes effect when a message is *removed* from the echo area, not when it is ;; added. ;; So we have to kludge it, and rebind `message' locally to use 'no-log when ;; appropriate. (defun gawd-snuff-message-function (fmt &rest args) "Print a one-line message at the bottom of the frame. The arguments are the same as to `format'. Unlike `message' this does a regexp match over the `log-message-ignore-regexps' itself, and displays the message with the 'no-log label if it matches the regexp. Bind this locally to `message' when you want to add expensive things to the `log-message-ignore-regexps' around one or two functions or subrs you do not want to modify. Do not bind it permanently there, as it adds an extra regexp scan, and so is actually slower than a `message' would be." (if (and (null fmt) (null args)) (progn (clear-message nil) nil) (let ((str (apply 'format fmt args))) (display-message (if (log-message-filter 'message str) 'message 'no-log) str) str))) (defadvice term-previous-matching-input (around gawd-term-previous-matching-input-snuff-logging last) "Block logging of the `History item:' messages. (They are still displayed.)" (let ((old-message-function (symbol-function 'message)) (log-message-ignore-regexps (append log-message-ignore-regexps '("\\`History item: " "\\`\\(Partially c\\|C\\)omplet\\(ing\\|ed\\)")))) (unwind-protect ; Don't permanently smash `message' (progn (fset 'message (symbol-function 'gawd-snuff-message-function)) ad-do-it) (fset 'message old-message-function)))) (defadvice term-replace-by-expanded-history-before-point (around gawd-term-replace-by-expanded-history-before-point-snuff-logging last) "Block logging of the `History item:' messages. (They are still displayed.)" (unwind-protect ; Don't permanently smash `message' (let ((old-message-function (symbol-function 'message)) (log-message-ignore-regexps (append log-message-ignore-regexps '("\\`History item: " "\\`\\(Partially c\\|C\\)omplet\\(ing\\|ed\\)")))) (unwind-protect ; Don't permanently smash `message' (progn (fset 'message (symbol-function 'gawd-snuff-message-function)) ad-do-it) (fset 'message old-message-function))))) (defadvice term-replace-by-expanded-history-before-point (around gawd-term-replace-by-expanded-history-before-point-snuff-logging last) "Block logging of the `History item:' messages. (They are still displayed.)" (let ((log-message-ignore-regexps (append log-message-ignore-regexps '("\\`History item: " "\\`\\(Partially c\\|C\\)omplet\\(ing\\|ed\\)")))) ad-do-it)) ;; Put `tshell-forward-command' and `tshell-backward-command' on up and down, ;; and cursor movement on shift-up and shift-down, in the tshell-mode. ;; Make tshell-mode's keymap inherit from term-mode's, rather than copying it. ;; Also move a bunch of keys around. ;; I hate this copy-and-pasting, but it is necessary; damn tshell-mode for lacking a load hook! (setq tshell-mode-map (make-sparse-keymap)) (set-keymap-parents tshell-mode-map term-mode-map) (define-key tshell-mode-map "\C-c\C-f" 'tshell-forward-command) (define-key tshell-mode-map "\C-c\C-b" 'tshell-backward-command) (define-key tshell-mode-map "\t" 'term-dynamic-complete) (define-key tshell-mode-map "\M-?" 'term-dynamic-list-filename-completions) (define-key term-mode-map (kbd "M-r") 'term-previous-matching-input-from-input) (define-key term-mode-map (kbd "M-C-r") 'term-previous-matching-input) (substitute-key-definition 'previous-line 'term-previous-input tshell-mode-map) (substitute-key-definition 'next-line 'term-next-input tshell-mode-map) (define-key tshell-mode-map (kbd "") 'term-previous-input) (define-key tshell-mode-map (kbd "") 'term-next-input) (define-key tshell-mode-map (kbd "S-up") 'previous-line) (define-key tshell-mode-map (kbd "S-down") 'next-line) (setq term-input-ring-size 256) ; Set a reasonably-sized input ring ;; Fix an ugly and horrible bug in file-coding-systems, as it affects term-mode. ;; TODO: This *must* be removed when the underlying bug is fixed! (defun gawd-evil-term-process-coding-system-bugfix () "Fix a horrible bug in the term `process-coding-system' stuff. TODO: Remove, when the bug is fixed." (set-buffer-process-coding-system 'binary 'binary)) (add-hook 'term-exec-hook 'gawd-evil-term-process-coding-system-bugfix) ;; Point man-mode at a man program that turns off groff-1.18's colour features; ;; they confuse rman greviously, and man-mode's Lisp cleaner even more. (setq Manual-program "/usr/bin/man-nocolor") ;; This extends the man mode's hyperlinking so that it works from the ;; keyboard. (Also, it unbreaks the rest of man-mode's keymaps, which have been ;; broken for some time.) It has several parts. ;; First, we need to arrange for our hyperlink-jump code to be added to the ;; keymap as an entry for `newline'. There is no man-load-hook, so we need to ;; kludge it in terms of Manual-mode-hook, like we do for tshell-mode. (defcustom Manual-mode-hook 'gawd-frob-man-keymap "Function or functions run on entry to Manual-mode." :type 'hook :group 'man) (defun gawd-frob-man-keymap () "Frob the `Manual-mode-map' to allow hyperlinking. A kludge. Attached to the `Manual-mode-hook' before manual mode is entered for the first time, it removes itself after manipulating the keymap. It defines the extra keys used by the `Manual-mode-map', and removes the overriding definitions of these keys as undefined from the `view-minor-mode-map'. (Why are they there? God alone knows.)" (define-key Manual-mode-map (kbd "TAB") 'gawd-manual-next-xref) (define-key Manual-mode-map (kbd "C-RET") 'gawd-manual-follow-xref) (define-key view-minor-mode-map (kbd "TAB") nil) (define-key view-minor-mode-map (kbd "C-RET") nil) (define-key view-minor-mode-map ?l nil) (remove-hook 'Manual-mode-hook 'gawd-frob-man-keymap)) ;; Next, we have the code. ;; Finding xrefs is the complicated part. ;; One might think we need to do a regexp scan for the next thing that looks ;; like an xref, and so forth, but luckily this has already been done for us by ;; `Manual-mouseify-xrefs'. So we merely need to find the first extent with an ;; `extent-start-position' greater than `point', less than `point-max', and with ;; a `man' property containing a list with 'Manual-follow-xref' as its car. ;; (This is the same algorithm as used by `Manual-follow-xref', so we are safe ;; there.) If there are none satisfying this criterion, we look instead for the ;; one with the lowest `extent-start-position' greater than `point-min'. We set ;; point to that. This is done by `map-extents'ing over the extents between `+ ;; 1 point' and `point-max' with the `next-man-xref' uninterned function (which ;; returns the next manual cross-reference), and, if that returns nil, trying ;; again from `point-min' to `point'. Luckily, `map-extents' does nearly all of ;; the work for us. (defun gawd-manual-next-xref () "Jump to the next cross-reference, if any. The `next' cross-reference is defined as that with the lowest position greater than `point' and less than `point-max', or, failing that, that with the lowest point greater than `point-min'." (interactive) (let ((next-man-xref (function (lambda (extent nothing) (setq the-posn (or the-posn (and (eq (car-safe (extent-property extent 'man)) 'Manual-follow-xref) (extent-start-position extent))))))) (the-posn)) ; This will eventually contain the point to jump to, if any ; If we're not at the end of the buffer, it is worthwhile searching for an ; xref up to the end (if (not (eq (point) (point-max))) (map-extents next-man-xref (current-buffer) (+ 1 (point)) (point-max) nil 'start-and-end-in-region 'man)) ; If none were found, search again from the buffer's accessible start, up ; to point. (We've already searched the rest.) ; Cater for extents overlapping `point' by changing the inclusion ; condition. (if (null the-posn) (map-extents next-man-xref (current-buffer) (point-min) (point) nil 'start-in-region 'man)) (if (not (null the-posn)) (goto-char the-posn))) nil) ;; Now for the easy part, following an xref. ;; In general we act like info-mode; if there is no xref under point, we do ;; nothing at all. This code will break if man ever adds other kinds of ;; extent... I should fix it to use map-extent instead, really. (defun gawd-manual-follow-xref (point) "Follow the cross-reference under POINT. Nothing happens when not on a cross-reference." (interactive "d") (let ((man-extent (extent-at point (current-buffer) 'man))) (if (and man-extent (eq (car-safe (extent-property man-extent 'man)) 'Manual-follow-xref)) (eval (extent-property man-extent 'man))))) ;; Fix calc-mode, by defining the defunct function `window-edges' again and ;; marking it as obsolete. The definition is stolen from `tapestry-window-edges' ;; in the tapestry package, but I don't want to have to load that on every boot ;; given that the rest of it is rarely used. (defun window-edges (&optional window) "Return a list giving the edge coordinates of WINDOW." (let ((edges (window-pixel-edges window)) tmp) (setq tmp edges) (setcar tmp (/ (car tmp) (face-width 'default))) (setq tmp (cdr tmp)) (setcar tmp (/ (car tmp) (face-height 'default))) (setq tmp (cdr tmp)) (setcar tmp (/ (car tmp) (face-width 'default))) (setq tmp (cdr tmp)) (setcar tmp (/ (car tmp) (face-height 'default))) edges)) (make-obsolete 'window-edges "use `window-pixel-edges' instead.") ;; Make lisp-mode and lisp-interaction-mode indent by default. (define-key shared-lisp-mode-map "\C-m" 'newline-and-indent) ;; Tell AUCTeX where our TeX macros are. (setq TeX-macro-global '("/usr/teTeX/sitemf/tex/latex/")) (add-hook 'LaTeX-mode-hook #'(lambda () (require 'font-latex))) ;; Make `c-backslash-region' not space out its tabs, so that it can be used ;; for string data as well as macros. (defadvice c-backslash-region (after gawd-c-backslash-region-no-spaces activate) "Do not space out the region, so that text strings as well as macros may be backslashified." (if (not delete-flag) (save-excursion (goto-char from) (while (re-search-forward "\\s-*\\\\$" nil t) (replace-match " \\" nil t))))) ;; Teach VM about some particularly objectionable Windows charsets. (setq vm-mime-charset-font-alist `(("Windows-1252" . ,(face-font-name 'default)))) ;; Teach C-mode what a return character looks like (defun gawd-setup-c-mode-keymap () "Fix up the cc-mode keymap. Substitute C-specific functions for Lisp-specific functions still bound to keys in cc-mode, for some reason. (It's probably RMS's fault. Most things are, except for those that are not.) Always indent on RET." (define-key c-mode-base-map "\C-m" 'c-context-line-break) (substitute-key-definition 'beginning-of-defun 'c-beginning-of-defun c-mode-base-map (current-global-map)) (substitute-key-definition 'end-of-defun 'c-end-of-defun c-mode-base-map (current-global-map))) (defun gawd-setup-c-mode () "Set up C, C++ and Java mode. This is run in the `c-mode-common-hook' to set up indentation and other parameters on creation of buffers managed by cc-mode.el." (gawd-setup-c-mode-keymap) (setq c-default-style '((c . "gnu") (java-mode . "java") (other . "user")))) (defvar gawd-personal-code-regexp nil "A regular expression matching code that is written to your coding standards. (That is, code that is not written to, say, the GNU standards.) nil means that the code is written to your standards all the time.") (defun gawd-personal-code-p (&optional buffer) "Return t if the BUFFER is possibly visiting personal code." (or (null gawd-personal-code-regexp) (null (buffer-file-name buffer)) (string-match gawd-personal-code-regexp (buffer-file-name buffer)))) (defun gawd-clean-up-c-common-hook () "Clean up the C mode common hook. Removes the globally-useful style setup functions from the hook, so that they only get run once, rather than repeatedly." (remove-hook 'c-mode-common-hook 'gawd-setup-c-mode-keymap) (remove-hook 'c-mode-common-hook 'gawd-clean-up-c-common-hook)) (defun gawd-setup-this-c-mode-buffer () "Set up this buffer for viewing C code. This happens even if it is a personal-styled buffer." (c-setup-filladapt) (hs-minor-mode 1) (if (not (gawd-personal-code-p)) (progn (c-make-styles-buffer-local t) ; Don't let this interfere with user styles (c-toggle-hungry-state 1) (setq fill-column 80) (auto-fill-mode)))) (add-hook 'c-mode-common-hook 'gawd-setup-c-mode-keymap t) (add-hook 'c-mode-common-hook 'gawd-clean-up-c-common-hook t) (add-hook 'c-mode-common-hook 'gawd-setup-this-c-mode-buffer t) ;; JDE customizations (defun gawd-jde-initialize () "Initialize the JDE's myriad settings." (setq jde-compile-option-debug t jde-compile-option-optimize t jde-compile-option-depend t jde-compile-option-target '("1.3") jde-help-remote-file-exists-function '("url-file-exists") jde-auto-parse-max-buffer-size 500000 jde-complete-function 'jde-complete-minibuf jde-import-auto-sort-function 'jde-import-organize jde-jdk-registry '(("1.4.1" . "/usr/packages.bin/non-free/j2sdk1.4.1")) jde-jdk '("1.4.1") jde-quote-classpath nil jde-checkstyle-option-lcurly-type '("nl") jde-checkstyle-option-lcurly-method '("nl") jde-checkstyle-option-lcurly-other '("nl") jde-checkstyle-option-lcurly-other '("alone") jde-checkstyle-option-allow-paren-padding t jde-checkstyle-option-block-try '("stmt") jde-checkstyle-option-block-catch '("ignore") jde-checkstyle-option-block-finally '("stmt") jde-checkstyle-option-allow-noauthor t jde-checkstyle-option-maxlinelen 132 jde-checkstyle-option-javadoc-check-unused-throws t jde-gen-k&r nil jde-gen-method-signature-padding-1 " " jde-xref-cache-size 10) (remove-hook 'jde-mode-hook 'gawd-jde-initialize)) (add-hook 'jde-mode-hook 'gawd-jde-initialize) ;; Activate the docstring checker and folding editor in elisp. (add-hook 'emacs-lisp-mode-hook 'checkdoc-minor-mode) (add-hook 'emacs-lisp-mode-hook 'hs-minor-mode) (add-hook 'lisp-interaction-mode-hook 'checkdoc-minor-mode) (add-hook 'lisp-interaction-mode-hook 'hs-minor-mode) (add-hook 'ielm-mode-hook 'checkdoc-minor-mode) (add-hook 'ielm-mode-hook 'hs-minor-mode) ;; Specify some usable keys for hideshow mode. (`@' as a keybinding?!) (define-key hs-minor-mode-map (kbd "C-c h") 'hs-hide-block) (define-key hs-minor-mode-map (kbd "C-c s") 'hs-show-block) (define-key hs-minor-mode-map (kbd "C-c H") 'hs-hide-all) (define-key hs-minor-mode-map (kbd "C-c S") 'hs-show-all) (when (not (featurep 'xemacs)) (define-key hs-minor-mode-map (kbd "C-c l") 'hs-hide-level)) ;; A menu of recent files. (when (not (featurep 'xemacs)) (setq recentf-save-file (locate-user-emacs-file ".recentf")) (recentf-mode 1)) ;; File sets. (when (not (featurep 'xemacs)) (setq filesets-menu-ensure-use-cached t)) ;; Some modes conflict with hideshow. (add-hook 'ediff-prepare-buffer-hook 'turn-off-hideshow) (add-hook 'vc-before-checkin-hook (lambda () (goto-char (point-min)) (hs-show-block))) (provide 'gawd-mode-frobs)