chiark / gitweb /
Makefile, el/dot-emacs.el: Muffle warnings from compiling Emacs startup. mdw/emacs-warnings
authorMark Wooding <mdw@distorted.org.uk>
Tue, 23 Jul 2024 15:00:51 +0000 (16:00 +0100)
committerMark Wooding <mdw@distorted.org.uk>
Tue, 23 Jul 2024 15:00:51 +0000 (16:00 +0100)
Makefile
el/dot-emacs.el

index 29359c000128daab370cd4a4a10f66da7a7cfc44..004f55043b9863fd26a9e83e93ad3762137b332f 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -105,7 +105,7 @@ SCRIPTLINKS         += aspell-hack emerge-hack wakey.sh
 %.elc: %.el $$(foreach e, $$($$*_DEPS), $$(DEP_$$e))
        $(call v_tag,EMACS)if ! $(EMACS) >$*.build-log 2>&1 \
                -L el/ -L $(EMACSLIB) \
 %.elc: %.el $$(foreach e, $$($$*_DEPS), $$(DEP_$$e))
        $(call v_tag,EMACS)if ! $(EMACS) >$*.build-log 2>&1 \
                -L el/ -L $(EMACSLIB) \
-               --batch --no-site-file \
+               --batch \
                --eval '(kill-emacs (if (byte-compile-file "$<") 0 2))'; then \
          cat $*.build-log; exit 2; \
        fi
                --eval '(kill-emacs (if (byte-compile-file "$<") 0 2))'; then \
          cat $*.build-log; exit 2; \
        fi
index 1af6e8e18f1a514e65bb858c4382098f1f66168f..3d705ef52f0d4cff312ff0ae7710d41b9acd749f 100644 (file)
@@ -26,7 +26,8 @@
 
 (defgroup mdw nil
   "Customization for mdw's Emacs configuration."
 
 (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))
 
 (defun mdw-check-command-line-switch (switch)
   (let ((probe nil) (next command-line-args) (found nil))
@@ -54,9 +55,62 @@ (setq mdw-splashy-startup
 ;;;--------------------------------------------------------------------------
 ;;; Some general utilities.
 
 ;;;--------------------------------------------------------------------------
 ;;; 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"))
 (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."
 
 (defmacro mdw-regexps (&rest list)
   "Turn a LIST of strings into a single regular expression at compile-time."
@@ -82,22 +136,6 @@ (defun mdw-submode-p (mode parent)
                 (t (setq mode (get mode 'derived-mode-parent)))))
     answer))
 
                 (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)
 ;; Configuration reading.
 
 (defvar mdw-config nil)
@@ -515,18 +553,18 @@ (defun mdw-todo (&optional when)
   (let ((w (calendar-absolute-from-gregorian (calendar-current-date)))
        (d (calendar-absolute-from-gregorian date)))
     (if when
   (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)
     (eq w d)))
 
 (defadvice org-agenda-list (around mdw-preserve-links activate)
@@ -651,7 +689,7 @@ (eval-after-load "org-latex"
 
 (eval-after-load "ox-latex"
   '(setq org-latex-classes (append mdw-org-latex-defs org-latex-classes)
 
 (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)
         org-latex-default-packages-alist '(("AUTO" "inputenc" t)
                                            ("T1" "fontenc" t)
                                            ("" "fixltx2e" nil)
@@ -668,11 +706,6 @@ (eval-after-load "ox-latex"
                                            ("" "hyperref" nil)
                                            "\\tolerance=1000")))
 
                                            ("" "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 "-"
 ;; Glasses.
 
 (setq glasses-separator "-"
@@ -689,8 +722,9 @@ (defun mdw-designated-window-display-buffer-function (buffer not-this-window)
   (unless mdw-designated-window (error "No designated window!"))
   (prog1 mdw-designated-window
     (with-selected-window mdw-designated-window (switch-to-buffer buffer))
   (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."
 
 (defun mdw-display-buffer-in-designated-window (buffer alist)
   "Display function to use the designated window."
@@ -709,7 +743,7 @@ (defun mdw-designate-window (cancel)
           (cond (mdw-designated-window
                  (setq mdw-designated-window nil)
                  (unless (mdw-emacs-version-p 24)
           (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."))))
                  (message "Window designation cleared."))
                 (t
                  (message "No designated window active."))))
@@ -718,8 +752,9 @@ (defun mdw-designate-window (cancel)
          (t
           (setq mdw-designated-window window)
           (unless (mdw-emacs-version-p 24)
          (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)
           (message "Window designated.")))))
 
 (when (mdw-emacs-version-p 24)
@@ -768,9 +803,10 @@ (defadvice display-buffer (before mdw-inhibit-other-frames activate)
 Pretend they don't exist.  They might be on other display devices."
   (ad-set-arg 2 nil))
 
 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.")
 
 (defvar mdw-fallback-window-alist nil
   "Alist mapping frames to fallback windows.")
@@ -1008,6 +1044,7 @@ (setq flymake-allowed-file-name-masks
           mdw-flymake-master-make-init)
          ("\\.p[lm]" flymake-perl-init)))
 
           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
 (setq flymake-mode-map
        (let ((map (if (boundp 'flymake-mode-map)
                       flymake-mode-map
@@ -1560,7 +1597,7 @@ (defun mdw-fill-prefix-match-p (pat)
        ((eq (car pat) 'not)
         (if (or (null (cdr pat)) (cddr pat))
             (error "Invalid `not' pattern `%S'" pat))
        ((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)
        (t (error "Unknown pattern form `%S'" pat))))
 
 (defun mdw-maybe-car (p)
@@ -1768,6 +1805,8 @@ (defun mdw-misc-mode-config ()
   (reveal-mode t)
   (trap (turn-on-font-lock)))
 
   (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
 (defun mdw-post-local-vars-misc-mode-config ()
   (setq whitespace-line-column mdw-text-width)
   (when (and mdw-do-misc-mode-hacking
@@ -1886,7 +1925,7 @@ (defmacro mdw-define-face (name &rest body)
           (debug 0))
   `(progn
      (copy-face 'mdw-virgin-face ',name)
           (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)))
 
      (put ',name 'face-defface-spec ',body)
      (face-spec-set ',name ',body nil)))
 
@@ -2367,15 +2406,6 @@ (defun mdw-remove-point-overlay ()
   "Remove the current-point overlay."
   (delete-overlay mdw-point-overlay))
 
   "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'.")
 
 (defvar mdw-point-overlay-buffers nil
   "List of buffers using `mdw-point-overlay-mode'.")
 
@@ -2400,6 +2430,15 @@ (define-minor-mode mdw-point-overlay-mode
         (remove-hook 'pre-command-hook 'mdw-remove-point-overlay)
         (remove-hook 'post-command-hook 'mdw-update-point-overlay))))
 
         (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))))
 (define-globalized-minor-mode mdw-global-point-overlay-mode
   mdw-point-overlay-mode
   (lambda () (if (not (minibufferp)) (mdw-point-overlay-mode t))))
@@ -2500,6 +2539,8 @@ (cl-defmacro mdw-define-c-style (name (&optional parent) &rest assocs)
         (var (intern (concat "mdw-c-style/" name-string)))
         (func (intern (concat "mdw-define-c-style/" name-string))))
     `(progn
         (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
        (setq ,var
               ,(if (null parent)
                    `',assocs
@@ -2905,7 +2946,7 @@ (defun mdw-fontify-javascript ()
 
   ;; Other stuff.
   (mdw-javascript-style)
 
   ;; 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)
 
   ;; Now define things to be fontified.
   (make-local-variable 'font-lock-keywords)