From: Mark Wooding Date: Tue, 23 Jul 2024 15:00:51 +0000 (+0100) Subject: Makefile, el/dot-emacs.el: Muffle warnings from compiling Emacs startup. X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~mdw/git/profile/commitdiff_plain/0d980fe876ddfb0390b30752f15b8bf1abebe862 Makefile, el/dot-emacs.el: Muffle warnings from compiling Emacs startup. --- diff --git a/Makefile b/Makefile index 29359c0..004f550 100644 --- 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) \ - --batch --no-site-file \ + --batch \ --eval '(kill-emacs (if (byte-compile-file "$<") 0 2))'; then \ cat $*.build-log; exit 2; \ fi diff --git a/el/dot-emacs.el b/el/dot-emacs.el index 1af6e8e..3d705ef 100644 --- a/el/dot-emacs.el +++ b/el/dot-emacs.el @@ -26,7 +26,8 @@ (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)) @@ -54,9 +55,62 @@ (setq mdw-splashy-startup ;;;-------------------------------------------------------------------------- ;;; 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." @@ -82,22 +136,6 @@ (defun mdw-submode-p (mode parent) (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) @@ -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 - (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) @@ -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) - org-latex-caption-above nil + org-latex-table-caption-above 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"))) -(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 "-" @@ -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)) - (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." @@ -709,7 +743,7 @@ (defun mdw-designate-window (cancel) (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.")))) @@ -718,8 +752,9 @@ (defun mdw-designate-window (cancel) (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) @@ -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)) -(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.") @@ -1008,6 +1044,7 @@ (setq flymake-allowed-file-name-masks 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 @@ -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)) - (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) @@ -1768,6 +1805,8 @@ (defun mdw-misc-mode-config () (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 @@ -1886,7 +1925,7 @@ (defmacro mdw-define-face (name &rest body) (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))) @@ -2367,15 +2406,6 @@ (defun mdw-remove-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'.") @@ -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)))) +(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)))) @@ -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 + (defvar ,var nil + ,(format "C `%s' style definition" name)) (setq ,var ,(if (null parent) `',assocs @@ -2905,7 +2946,7 @@ (defun mdw-fontify-javascript () ;; 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)