Skip to content

Commit

Permalink
Drop Emacs 23 support
Browse files Browse the repository at this point in the history
  • Loading branch information
purcell committed Apr 9, 2017
1 parent 0a2c2bd commit a7993fd
Show file tree
Hide file tree
Showing 12 changed files with 38 additions and 132 deletions.
1 change: 0 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ before_install:
- evm install $EVM_EMACS --use --skip

env:
- EVM_EMACS=emacs-23.4-travis
- EVM_EMACS=emacs-24.1-travis
- EVM_EMACS=emacs-24.2-travis
- EVM_EMACS=emacs-24.3-travis
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ other languages.

## Supported Emacs versions

The config should run on Emacs 23.3 or greater and is designed to
The config should run on Emacs 24.1 or greater and is designed to
degrade smoothly - see the Travis build - but note that Emacs 24 and
above is required for an increasing number of key packages, including
`magit`, `company` and `flycheck`, so to get full you should use the
Expand Down
2 changes: 1 addition & 1 deletion init.el
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
;;; This file bootstraps the configuration, which is divided into
;;; a number of other files.

(let ((minver "23.3"))
(let ((minver "24.1"))
(when (version<= emacs-version minver)
(error "Your Emacs is too old -- this config requires v%s or higher" minver)))
(when (version<= emacs-version "24")
Expand Down
21 changes: 0 additions & 21 deletions lisp/init-compat.el
Original file line number Diff line number Diff line change
@@ -1,15 +1,3 @@
;;----------------------------------------------------------------------------
;; Provide a version of Emacs 24's 'string-prefix-p in older emacsen
;;----------------------------------------------------------------------------
(when (eval-when-compile (< emacs-major-version 24))
(defun string-prefix-p (str1 str2 &optional ignore-case)
"Return non-nil if STR1 is a prefix of STR2.
If IGNORE-CASE is non-nil, the comparison is done without paying attention
to case differences."
(eq t (compare-strings str1 nil nil
str2 0 (length str1) ignore-case))))


;;----------------------------------------------------------------------------
;; Allow recent packages to safely pass an arg to 'called-interactively-p
;; in older Emacsen, including 23.1.
Expand All @@ -22,15 +10,6 @@ to case differences."
"Overridden; see `sanityinc/called-interactively-p' for the wrapped function."
(sanityinc/called-interactively-p))))

(when (eval-when-compile (< emacs-major-version 24))
;; Help package.el work in older Emacsen, where there's no TRASH arg
;; for 'delete-directory
(message "Warning: overriding delete-directory to support TRASH argument.")
(fset 'sanityinc/delete-directory (symbol-function 'delete-directory))
(defun delete-directory (directory &optional recursive trash)
"Overridden: see `sanityinc/delete-directory' for the wrapped function"
(sanityinc/delete-directory directory recursive)))


;;----------------------------------------------------------------------------
;; Restore removed var alias, used by ruby-electric-brace and others
Expand Down
23 changes: 2 additions & 21 deletions lisp/init-elpa.el
Original file line number Diff line number Diff line change
@@ -1,16 +1,5 @@
;;; Find and load the correct package.el

;; When switching between Emacs 23 and 24, we always use the bundled package.el in Emacs 24
(let ((package-el-site-lisp-dir
(expand-file-name "site-lisp/package" user-emacs-directory)))
(when (and (file-directory-p package-el-site-lisp-dir)
(> emacs-major-version 23))
(message "Removing local package.el from load-path to avoid shadowing bundled version")
(setq load-path (remove package-el-site-lisp-dir load-path))))

(require 'package)



;;; Install into separate package dirs for each Emacs version, to prevent bytecode incompatibility
(let ((versioned-package-dir
Expand All @@ -27,21 +16,13 @@

;;; Standard package repositories

(when (< emacs-major-version 24)
;; Mainly for ruby-mode
(add-to-list 'package-archives '("marmalade" . "http://marmalade-repo.org/packages/")))

;; We include the org repository for completeness, but don't normally
;; use it.
(add-to-list 'package-archives '("org" . "http://orgmode.org/elpa/"))

(when (< emacs-major-version 24)
(add-to-list 'package-archives '("gnu" . "http://elpa.gnu.org/packages/")))


(defconst sanityinc/no-ssl (or (< emacs-major-version 24)
(and (memq system-type '(windows-nt ms-dos))
(not (gnutls-available-p)))))
(defconst sanityinc/no-ssl (and (memq system-type '(windows-nt ms-dos))
(not (gnutls-available-p))))

;;; Also use Melpa for most packages
(add-to-list 'package-archives
Expand Down
59 changes: 29 additions & 30 deletions lisp/init-fci.el
Original file line number Diff line number Diff line change
@@ -1,39 +1,38 @@
;; Fill column indicator
(when (eval-when-compile (> emacs-major-version 23))
(require-package 'fill-column-indicator)
(defun sanityinc/prog-mode-fci-settings ()
(turn-on-fci-mode)
(when show-trailing-whitespace
(set (make-local-variable 'whitespace-style) '(face trailing))
(whitespace-mode 1)))
(require-package 'fill-column-indicator)
(defun sanityinc/prog-mode-fci-settings ()
(turn-on-fci-mode)
(when show-trailing-whitespace
(set (make-local-variable 'whitespace-style) '(face trailing))
(whitespace-mode 1)))

;;(add-hook 'prog-mode-hook 'sanityinc/prog-mode-fci-settings)
;;(add-hook 'prog-mode-hook 'sanityinc/prog-mode-fci-settings)

(defun sanityinc/fci-enabled-p ()
(bound-and-true-p fci-mode))
(defun sanityinc/fci-enabled-p ()
(bound-and-true-p fci-mode))

(defvar sanityinc/fci-mode-suppressed nil)
(make-variable-buffer-local 'sanityinc/fci-mode-suppressed)
(defvar sanityinc/fci-mode-suppressed nil)
(make-variable-buffer-local 'sanityinc/fci-mode-suppressed)

(defadvice popup-create (before suppress-fci-mode activate)
"Suspend fci-mode while popups are visible"
(let ((fci-enabled (sanityinc/fci-enabled-p)))
(when fci-enabled
(setq sanityinc/fci-mode-suppressed fci-enabled)
(turn-off-fci-mode))))
(defadvice popup-delete (after restore-fci-mode activate)
"Restore fci-mode when all popups have closed"
(when (and sanityinc/fci-mode-suppressed
(null popup-instances))
(setq sanityinc/fci-mode-suppressed nil)
(turn-on-fci-mode)))
(defadvice popup-create (before suppress-fci-mode activate)
"Suspend fci-mode while popups are visible"
(let ((fci-enabled (sanityinc/fci-enabled-p)))
(when fci-enabled
(setq sanityinc/fci-mode-suppressed fci-enabled)
(turn-off-fci-mode))))
(defadvice popup-delete (after restore-fci-mode activate)
"Restore fci-mode when all popups have closed"
(when (and sanityinc/fci-mode-suppressed
(null popup-instances))
(setq sanityinc/fci-mode-suppressed nil)
(turn-on-fci-mode)))

;; Regenerate fci-mode line images after switching themes
(defadvice enable-theme (after recompute-fci-face activate)
(dolist (buffer (buffer-list))
(with-current-buffer buffer
(when (sanityinc/fci-enabled-p)
(turn-on-fci-mode))))))
;; Regenerate fci-mode line images after switching themes
(defadvice enable-theme (after recompute-fci-face activate)
(dolist (buffer (buffer-list))
(with-current-buffer buffer
(when (sanityinc/fci-enabled-p)
(turn-on-fci-mode)))))


(provide 'init-fci)
21 changes: 1 addition & 20 deletions lisp/init-flyspell.el
Original file line number Diff line number Diff line change
@@ -1,26 +1,7 @@
;;----------------------------------------------------------------------------
;; Add spell-checking in comments for all programming language modes
;;----------------------------------------------------------------------------
(if (fboundp 'prog-mode)
(add-hook 'prog-mode-hook 'flyspell-prog-mode)
(dolist (hook '(lisp-mode-hook
emacs-lisp-mode-hook
scheme-mode-hook
clojure-mode-hook
ruby-mode-hook
yaml-mode
python-mode-hook
shell-mode-hook
php-mode-hook
css-mode-hook
haskell-mode-hook
caml-mode-hook
nxml-mode-hook
crontab-mode-hook
perl-mode-hook
tcl-mode-hook
javascript-mode-hook))
(add-hook hook 'flyspell-prog-mode)))
(add-hook 'prog-mode-hook 'flyspell-prog-mode)

(after-load 'flyspell
(add-to-list 'flyspell-prog-text-faces 'nxml-text-face))
Expand Down
3 changes: 1 addition & 2 deletions lisp/init-misc.el
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@
(add-auto-mode 'tcl-mode "Portfile\\'")
(fset 'yes-or-no-p 'y-or-n-p)

(when (fboundp 'prog-mode)
(add-hook 'prog-mode-hook 'goto-address-prog-mode))
(add-hook 'prog-mode-hook 'goto-address-prog-mode)
(setq goto-address-mail-face 'link)

(add-hook 'after-save-hook 'executable-make-buffer-file-executable-if-script-p)
Expand Down
8 changes: 2 additions & 6 deletions lisp/init-org.el
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
(when (< emacs-major-version 24)
(require-package 'org))
(require-package 'org-fstree)
(when *is-a-mac*
(maybe-require-package 'grab-mac-link)
Expand Down Expand Up @@ -69,17 +67,15 @@ typical word processor."
(set (make-local-variable 'blink-cursor-interval) 0.6)
(set (make-local-variable 'show-trailing-whitespace) nil)
(flyspell-mode 1)
(when (fboundp 'visual-line-mode)
(visual-line-mode 1)))
(visual-line-mode 1))
(kill-local-variable 'truncate-lines)
(kill-local-variable 'word-wrap)
(kill-local-variable 'cursor-type)
(kill-local-variable 'show-trailing-whitespace)
(buffer-face-mode -1)
;; (delete-selection-mode -1)
(flyspell-mode -1)
(when (fboundp 'visual-line-mode)
(visual-line-mode -1))))
(visual-line-mode -1)))

;;(add-hook 'org-mode-hook 'buffer-face-mode)

Expand Down
9 changes: 0 additions & 9 deletions lisp/init-site-lisp.el
Original file line number Diff line number Diff line change
Expand Up @@ -44,13 +44,4 @@ source file under ~/.emacs.d/site-lisp/name/"
(and f (string-prefix-p (file-name-as-directory (site-lisp-dir-for name)) f))))



;; Download these upstream libs

(unless (> emacs-major-version 23)
(ensure-lib-from-url
'package
"http://repo.or.cz/w/emacs.git/blob_plain/ba08b24186711eaeb3748f3d1f23e2c2d9ed0d09:/lisp/emacs-lisp/package.el"))


(provide 'init-site-lisp)
18 changes: 1 addition & 17 deletions lisp/init-xterm.el
Original file line number Diff line number Diff line change
@@ -1,27 +1,11 @@
(require 'init-frame-hooks)

(defun fix-up-xterm-control-arrows ()
(let ((map (if (boundp 'input-decode-map)
input-decode-map
function-key-map)))
(define-key map "\e[1;5A" [C-up])
(define-key map "\e[1;5B" [C-down])
(define-key map "\e[1;5C" [C-right])
(define-key map "\e[1;5D" [C-left])
(define-key map "\e[5A" [C-up])
(define-key map "\e[5B" [C-down])
(define-key map "\e[5C" [C-right])
(define-key map "\e[5D" [C-left])))

(global-set-key [mouse-4] (lambda () (interactive) (scroll-down 1)))
(global-set-key [mouse-5] (lambda () (interactive) (scroll-up 1)))

(defun sanityinc/console-frame-setup ()
(when (< emacs-major-version 23)
(fix-up-xterm-control-arrows))
(xterm-mouse-mode 1) ; Mouse in a terminal (Use shift to paste with middle button)
(when (fboundp 'mwheel-install)
(mwheel-install)))
(mwheel-install))



Expand Down
3 changes: 0 additions & 3 deletions site-lisp/README
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
This is a place for 3rd party code which isn't available in MELPA or
other package repositories. This directory and its immediate subdirectories
will be added to load-path at start-up time.

Notably, in Emacs 23.x, a backported package.el is automatically
downloaded and installed here.

0 comments on commit a7993fd

Please sign in to comment.