(defgroup mdw nil
"Customization for mdw's Emacs configuration."
- :prefix "mdw-")
+ :prefix "mdw-"
+ :group 'local)
(defun mdw-check-command-line-switch (switch)
(let ((probe nil) (next command-line-args) (found nil))
;;;--------------------------------------------------------------------------
;;; Some general utilities.
+;; Some error trapping.
+;;
+;; If individual bits of this file go tits-up, we don't particularly want
+;; the whole lot to stop right there and then, because it's bloody annoying.
+
+(eval-and-compile
+ (defmacro trap (&rest forms)
+ "Execute FORMS without allowing errors to propagate outside."
+ (declare (indent 0)
+ (debug t))
+ `(condition-case err
+ ,(if (cdr forms) (cons 'progn forms) (car forms))
+ (error (message "Error (trapped): %s in %s"
+ (error-message-string err)
+ ',forms)))))
+
+;; Load packages helpful for compiling.
+
(eval-when-compile
(unless (fboundp 'make-regexp) (load "make-regexp"))
- (require 'cl-lib))
+ (require 'cl-lib)
+ (trap (require 'a68-mode))
+ (trap (require 'asm-mode))
+ (trap (require 'autorevert))
+ (trap (require 'bibtex))
+ (trap (require 'calendar))
+ (with-no-warnings (defvar date)) ; used in `diary' sexp protocol
+ (trap (require 'cc-mode))
+ (defvar c-syntactic-context)
+ (defvar c-syntactic-element)
+ (trap (require 'compile))
+ (trap (require 'dired))
+ (trap (require 'ediff))
+ (trap (require 'f90))
+ (trap (require 'flymake))
+ (trap (require 'fortran))
+ (trap (require 'fsharp)
+ (require 'fsharp-indent))
+ (trap (require 'glasses))
+ (trap (require 'gtags))
+ (trap (require 'haskell-mode))
+ (trap (require 'ispell))
+ (trap (require 'js))
+ (trap (require 'mailcap))
+ (trap (require 'nntp))
+ (trap (require 'org))
+ (trap (require 'ox-latex))
+ (defvar org-export-latex-classes) ; old variable
+ (trap (require 'ps-print))
+ (trap (require 'rexx-mode))
+ (trap (require 'reftex))
+ (trap (require 'sgml-mode))
+ (trap (require 'tex))
+ (trap (require 'w3m) (require 'w3m-search))
+ (trap (require 'whitespace))
+ )
(defmacro mdw-regexps (&rest list)
"Turn a LIST of strings into a single regular expression at compile-time."
(t (setq mode (get mode 'derived-mode-parent)))))
answer))
-;; Some error trapping.
-;;
-;; If individual bits of this file go tits-up, we don't particularly want
-;; the whole lot to stop right there and then, because it's bloody annoying.
-
-(eval-and-compile
- (defmacro trap (&rest forms)
- "Execute FORMS without allowing errors to propagate outside."
- (declare (indent 0)
- (debug t))
- `(condition-case err
- ,(if (cdr forms) (cons 'progn forms) (car forms))
- (error (message "Error (trapped): %s in %s"
- (error-message-string err)
- ',forms)))))
-
;; Configuration reading.
(defvar mdw-config nil)
(let ((w (calendar-absolute-from-gregorian (calendar-current-date)))
(d (calendar-absolute-from-gregorian date)))
(if when
- (setq w (max w (calendar-absolute-from-gregorian
- (cond
- ((not european-calendar-style)
- when)
- ((> (car when) 100)
- (list (nth 1 when)
- (nth 2 when)
- (nth 0 when)))
- (t
- (list (nth 1 when)
- (nth 0 when)
- (nth 2 when))))))))
+ (let ((style (cond
+ ((> (car when) 100) 'iso)
+ ((boundb 'calendar-date-style) calendar-date-style)
+ ((symbol-value 'european-calendar-style) 'european)
+ (t 'american))))
+ (setq w (max w (cl-ecase style
+ (iso
+ (list (nth 1 when) (nth 2 when) (nth 0 when)))
+ (european
+ (list (nth 1 when) (nth 0 when) (nth 2 when)))
+ (american
+ when))))))
(eq w d)))
(defadvice org-agenda-list (around mdw-preserve-links activate)
(eval-after-load "ox-latex"
'(setq org-latex-classes (append mdw-org-latex-defs org-latex-classes)
- org-latex-caption-above nil
+ org-latex-table-caption-above nil
org-latex-default-packages-alist '(("AUTO" "inputenc" t)
("T1" "fontenc" t)
("" "fixltx2e" nil)
("" "hyperref" nil)
"\\tolerance=1000")))
-(setq org-export-docbook-xslt-proc-command "xsltproc --output %o %s %i"
- org-export-docbook-xsl-fo-proc-command "fop %i.safe %o"
- org-export-docbook-xslt-stylesheet
- "/usr/share/xml/docbook/stylesheet/docbook-xsl/fo/docbook.xsl")
-
;; Glasses.
(setq glasses-separator "-"
(unless mdw-designated-window (error "No designated window!"))
(prog1 mdw-designated-window
(with-selected-window mdw-designated-window (switch-to-buffer buffer))
- (setq mdw-designated-window nil
- display-buffer-function nil)))
+ (setq mdw-designated-window nil)
+ (unless (mdw-emacs-version-p 24)
+ (with-no-warnings (setq display-buffer-function nil)))))
(defun mdw-display-buffer-in-designated-window (buffer alist)
"Display function to use the designated window."
(cond (mdw-designated-window
(setq mdw-designated-window nil)
(unless (mdw-emacs-version-p 24)
- (setq display-buffer-function nil))
+ (with-no-warnings (setq display-buffer-function nil)))
(message "Window designation cleared."))
(t
(message "No designated window active."))))
(t
(setq mdw-designated-window window)
(unless (mdw-emacs-version-p 24)
- (setq display-buffer-function
- #'mdw-designated-window-display-buffer-function))
+ (with-no-warnings
+ (setq display-buffer-function
+ #'mdw-designated-window-display-buffer-function)))
(message "Window designated.")))))
(when (mdw-emacs-version-p 24)
Pretend they don't exist. They might be on other display devices."
(ad-set-arg 2 nil))
-(setq even-window-sizes nil
- even-window-heights nil
- display-buffer-reuse-frames nil)
+(with-no-warnings
+ (setq even-window-sizes nil
+ even-window-heights nil
+ display-buffer-reuse-frames nil))
(defvar mdw-fallback-window-alist nil
"Alist mapping frames to fallback windows.")
mdw-flymake-master-make-init)
("\\.p[lm]" flymake-perl-init)))
+(defvar flymake-mode-map)
(setq flymake-mode-map
(let ((map (if (boundp 'flymake-mode-map)
flymake-mode-map
((eq (car pat) 'not)
(if (or (null (cdr pat)) (cddr pat))
(error "Invalid `not' pattern `%S'" pat))
- (not (mdw-fill-prefix-match-p (car pats))))
+ (not (mdw-fill-prefix-match-p (cadr pat))))
(t (error "Unknown pattern form `%S'" pat))))
(defun mdw-maybe-car (p)
(reveal-mode t)
(trap (turn-on-font-lock)))
+(make-variable-buffer-local 'whitespace-line-column)
+
(defun mdw-post-local-vars-misc-mode-config ()
(setq whitespace-line-column mdw-text-width)
(when (and mdw-do-misc-mode-hacking
(debug 0))
`(progn
(copy-face 'mdw-virgin-face ',name)
- (defvar ,name ',name)
+ (with-no-warnings (defvar ,name ',name))
(put ',name 'face-defface-spec ',body)
(face-spec-set ',name ',body nil)))
"Remove the current-point overlay."
(delete-overlay mdw-point-overlay))
-(defun mdw-update-point-overlay ()
- "Mark the current point position with an overlay."
- (if (not mdw-point-overlay-mode)
- (mdw-remove-point-overlay)
- (overlay-put mdw-point-overlay 'window (selected-window))
- (move-overlay mdw-point-overlay
- (line-beginning-position)
- (+ (line-end-position) 1))))
-
(defvar mdw-point-overlay-buffers nil
"List of buffers using `mdw-point-overlay-mode'.")
(remove-hook 'pre-command-hook 'mdw-remove-point-overlay)
(remove-hook 'post-command-hook 'mdw-update-point-overlay))))
+(defun mdw-update-point-overlay ()
+ "Mark the current point position with an overlay."
+ (if (not mdw-point-overlay-mode)
+ (mdw-remove-point-overlay)
+ (overlay-put mdw-point-overlay 'window (selected-window))
+ (move-overlay mdw-point-overlay
+ (line-beginning-position)
+ (+ (line-end-position) 1))))
+
(define-globalized-minor-mode mdw-global-point-overlay-mode
mdw-point-overlay-mode
(lambda () (if (not (minibufferp)) (mdw-point-overlay-mode t))))
(var (intern (concat "mdw-c-style/" name-string)))
(func (intern (concat "mdw-define-c-style/" name-string))))
`(progn
+ (defvar ,var nil
+ ,(format "C `%s' style definition" name))
(setq ,var
,(if (null parent)
`',assocs
;; Other stuff.
(mdw-javascript-style)
- (setq js-auto-indent-flag t)
+ (when (boundp 'js-auto-indent-flag) (setq js-auto-indent-flag t))
;; Now define things to be fontified.
(make-local-variable 'font-lock-keywords)