From e8ea88ba22a0e762bf6dfc6cfe12b2379e408b8e Mon Sep 17 00:00:00 2001 From: Mark Wooding Date: Sun, 20 Mar 2016 17:41:10 +0000 Subject: [PATCH] dot/emacs, el/dot-emacs.el: Better Emacs version checking. Sometimes we must check the minor version number. --- dot/emacs | 4 ++-- el/dot-emacs.el | 11 ++++++++--- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/dot/emacs b/dot/emacs index 04c8189..708ea7b 100644 --- a/dot/emacs +++ b/dot/emacs @@ -84,7 +84,7 @@ (require 'paren) (trap (show-paren-mode t)) -(or window-system (>= emacs-major-version 22) (menu-bar-mode -1)) +(or window-system (mdw-emacs-version-p 22) (menu-bar-mode -1)) ;; Multiple cursors. @@ -111,7 +111,7 @@ ;; Emacs server behaviour. -(and (or window-system (>= emacs-major-version 23)) +(and (or window-system (mdw-emacs-version-p 23)) (progn (setq server-temp-file-regexp (concat "^" tmpdir "\\|/draft$") edit-server-new-frame nil gnuserv-frame t) diff --git a/el/dot-emacs.el b/el/dot-emacs.el index 11be2ac..f4a33d8 100644 --- a/el/dot-emacs.el +++ b/el/dot-emacs.el @@ -57,6 +57,12 @@ This may be at the expense of cool features.") (interactive) (error "wrong button")) +(defun mdw-emacs-version-p (major &optional minor) + "Return non-nil if the running Emacs is at least version MAJOR.MINOR." + (or (> emacs-major-version major) + (and (= emacs-major-version major) + (>= emacs-minor-version (or minor 0))))) + ;; Some error trapping. ;; ;; If individual bits of this file go tits-up, we don't particularly want @@ -189,8 +195,7 @@ fringes is not taken out of the allowance for WIDTH, unlike "Split a wide window into appropriate widths." (interactive "P") (setq width (cond (width (prefix-numeric-value width)) - ((and window-system - (>= emacs-major-version 22)) + ((and window-system (mdw-emacs-version-p 22)) 77) (t 78))) (let* ((win (selected-window)) @@ -1014,7 +1019,7 @@ doesn't match any of the regular expressions in (((type w32)) :family "courier new" :height 85) (((type x)) :family "6x13" :foundry "trad" :height 130) (t :foreground "white" :background "black")) -(if (>= emacs-major-version 23) +(if (mdw-emacs-version-p 23) (mdw-define-face variable-pitch (((type x)) :family "sans" :height 100)) (mdw-define-face variable-pitch -- 2.11.0