Skip to content
This repository has been archived by the owner on Mar 28, 2022. It is now read-only.

Commit

Permalink
Sync from Mr. Purcell.
Browse files Browse the repository at this point in the history
  • Loading branch information
GSMLG-BOT committed Mar 28, 2022
2 parents 2d728f5 + 521829c commit 51bea9f
Show file tree
Hide file tree
Showing 45 changed files with 413 additions and 462 deletions.
9 changes: 7 additions & 2 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,22 @@ jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest]
os: [ubuntu-latest]
emacs_version:
- 26.3
- 27.1
- 27.2
- snapshot
include:
- os: macos-latest
emacs_version: 27.2
steps:
- uses: purcell/setup-emacs@master
with:
version: ${{ matrix.emacs_version }}

- uses: actions/checkout@v1
- uses: actions/checkout@v2
- name: Check startup
run: ./test-startup.sh
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -62,3 +62,5 @@ site-lisp/package/
/transient
/.lsp-session-v1
/smex-items
/eln-cache/
/projects
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Copyright (c) 2006-2018, Steve Purcell
Copyright (c) 2006-2021, Steve Purcell
All rights reserved.

Redistribution and use in source and binary forms, with or without
Expand Down
21 changes: 10 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ Emacs itself comes with support for many programming languages. This
config adds improved defaults and extended support for the following, listed
in the approximate order of how much I use them, from most to least:

* Haskell / Purescript / Elm
* Haskell / Purescript / Elm / OCaml
* Ruby / Ruby on Rails
* SQL
* CSS / LESS / SASS / SCSS
Expand All @@ -28,13 +28,15 @@ in the approximate order of how much I use them, from most to least:

In particular, there's a nice config for *autocompletion* with
[company](https://company-mode.github.io/), and
[flycheck](http://www.flycheck.org) is used to immediately highlight
syntax errors in Ruby, Python, Javascript, Haskell and a number of
other languages.
`flymake` (re-using backends from [flycheck](http://www.flycheck.org))
is used to immediately highlight syntax errors in Ruby, Python,
Javascript, Haskell and a number of other languages.

LSP support is provided using `eglot`.

## Supported Emacs versions

The config should run on Emacs 24.5 or greater and is designed to
The config should run on Emacs 25.1 or greater and is designed to
degrade smoothly - see the CI build - but note that much newer
versions are required for an increasing number of key packages, so to
get full functionality you should use the latest Emacs version
Expand Down Expand Up @@ -68,8 +70,9 @@ running `M-x package-refresh-contents` before doing so.

## Updates

Update the config with `git pull`. You'll probably also want/need to update
the third-party packages regularly too:
Update the config with `git pull`. You'll probably also want/need to
update the third-party packages regularly too, because that's what I
do, and the config assumes it:

<kbd>M-x package-list-packages</kbd>, then <kbd>U</kbd> followed by <kbd>x</kbd>.

Expand Down Expand Up @@ -101,10 +104,6 @@ config remains compatible with the latest package and Emacs versions.
*Please note that I cannot provide support for customised versions of
this configuration.*

## Similar configs

You might also want to check out `emacs-starter-kit` and `prelude`.

## Support / issues

If you hit any problems, please first ensure that you are using the latest version
Expand Down
46 changes: 16 additions & 30 deletions init.el
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@
;; Produce backtraces when errors occur: can be helpful to diagnose startup issues
;;(setq debug-on-error t)

(let ((minver "24.5"))
(let ((minver "25.1"))
(when (version< emacs-version minver)
(error "Your Emacs is too old -- this config requires v%s or higher" minver)))
(when (version< emacs-version "25.1")
(when (version< emacs-version "26.1")
(message "Your Emacs is old, and some functionality in this config will be disabled. Please upgrade if possible."))

(add-to-list 'load-path (expand-file-name "lisp" user-emacs-directory))
Expand All @@ -22,19 +22,20 @@
(defconst *is-a-mac* (eq system-type 'darwin))
(defconst *is-a-win* (eq system-type 'windows-nt))

;;----------------------------------------------------------------------------

;; Adjust garbage collection thresholds during startup, and thereafter
;;----------------------------------------------------------------------------

(let ((normal-gc-cons-threshold (* 20 1024 1024))
(init-gc-cons-threshold (* 128 1024 1024)))
(setq gc-cons-threshold init-gc-cons-threshold)
(add-hook 'emacs-startup-hook
(lambda () (setq gc-cons-threshold normal-gc-cons-threshold))))

;;----------------------------------------------------------------------------

;; Bootstrap config
;;----------------------------------------------------------------------------
(setq custom-file (expand-file-name "custom.el" user-emacs-directory))


(setq custom-file (locate-user-emacs-file "custom.el"))
(require 'init-utils)
(require 'init-site-lisp) ;; Must come before elpa, as it may provide package.el
;; Calls (package-initialize)
Expand All @@ -43,15 +44,11 @@
(when *is-a-win*
(require 'init-windows-nt))

;;----------------------------------------------------------------------------

;; Allow users to provide an optional "init-preload-local.el"
;;----------------------------------------------------------------------------
(require 'init-preload-local nil t)

;;----------------------------------------------------------------------------
;; Load configs for specific features and modes
;;----------------------------------------------------------------------------

(require-package 'diminish)
(maybe-require-package 'scratch)
(require-package 'command-log-mode)
Expand All @@ -67,12 +64,11 @@
(require 'init-grep)
(require 'init-uniquify)
(require 'init-ibuffer)
(require 'init-flycheck)
(require 'init-flymake)
(require 'init-eglot)

(require 'init-recentf)
(require 'init-smex)
(require 'init-ivy)
;; (require 'init-helm)
(require 'init-minibuffer)
(require 'init-hippie-expand)
(require 'init-yasnippet)
(require 'init-company)
Expand Down Expand Up @@ -112,6 +108,8 @@
(require 'init-ruby)
(require 'init-rails)
(require 'init-sql)
(require 'init-ocaml)
(require 'init-j)
(require 'init-nim)
(require 'init-rust)
(require 'init-toml)
Expand Down Expand Up @@ -150,8 +148,6 @@
(require-package 'htmlize)
(when *is-a-mac*
(require-package 'osx-location))
(unless (eq system-type 'windows-nt)
(maybe-require-package 'daemons))
(maybe-require-package 'dotenv-mode)
(maybe-require-package 'shfmt)

Expand All @@ -164,35 +160,25 @@

(require 'init-direnv)

;;----------------------------------------------------------------------------


;; Allow access from emacsclient
;;----------------------------------------------------------------------------
(add-hook 'after-init-hook
(lambda ()
(require 'server)
(unless (server-running-p)
(server-start))))

;;----------------------------------------------------------------------------
;; Variables configured via the interactive 'customize' interface
;;----------------------------------------------------------------------------
(when (file-exists-p custom-file)
(load custom-file))


;;----------------------------------------------------------------------------
;; Locales (setting them earlier in this file doesn't work in X)
;;----------------------------------------------------------------------------
(require 'init-locales)


;;----------------------------------------------------------------------------
;; Allow users to provide an optional "init-local" containing personal settings
;;----------------------------------------------------------------------------
(require 'init-local nil t)



(provide 'init)

;; Local Variables:
Expand Down
2 changes: 1 addition & 1 deletion lisp/init-benchmarking.el
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ LOAD-DURATION is the time taken in milliseconds to load FEATURE.")
(defun sanityinc/require-times-tabulated-list-entries ()
(cl-loop for (feature start-time millis) in sanityinc/require-times
with order = 0
do (incf order)
do (cl-incf order)
collect (list order
(vector
(format "%.3f" (sanityinc/time-subtract-millis start-time before-init-time))
Expand Down
22 changes: 2 additions & 20 deletions lisp/init-company.el
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@
(when (maybe-require-package 'company)
(add-hook 'after-init-hook 'global-company-mode)
(with-eval-after-load 'company
(dolist (backend '(company-eclim company-semantic))
(delq backend company-backends))
(diminish 'company-mode)
(define-key company-mode-map (kbd "M-/") 'company-complete)
(define-key company-mode-map [remap completion-at-point] 'company-complete)
(define-key company-mode-map [remap indent-for-tab-command] 'company-indent-or-complete-common)
(define-key company-active-map (kbd "M-/") 'company-other-backend)
(define-key company-active-map (kbd "C-n") 'company-select-next)
(define-key company-active-map (kbd "C-p") 'company-select-previous)
Expand All @@ -26,24 +26,6 @@
(when (maybe-require-package 'company-quickhelp)
(add-hook 'after-init-hook 'company-quickhelp-mode)))

;; Suspend page-break-lines-mode while company menu is active
;; (see https://github.com/company-mode/company-mode/issues/416)
(with-eval-after-load 'company
(with-eval-after-load 'page-break-lines
(defvar-local sanityinc/page-break-lines-on-p nil)

(defun sanityinc/page-break-lines-disable (&rest ignore)
(when (setq sanityinc/page-break-lines-on-p (bound-and-true-p page-break-lines-mode))
(page-break-lines-mode -1)))

(defun sanityinc/page-break-lines-maybe-reenable (&rest ignore)
(when sanityinc/page-break-lines-on-p
(page-break-lines-mode 1)))

(add-hook 'company-completion-started-hook 'sanityinc/page-break-lines-disable)
(add-hook 'company-after-completion-hook 'sanityinc/page-break-lines-maybe-reenable)))



(provide 'init-company)
;;; init-company.el ends here
10 changes: 5 additions & 5 deletions lisp/init-direnv.el
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@
;;; Commentary:
;;; Code:

(defun sanityinc/maybe-enable-envrc-global-mode ()
"Enable `envrc-global-mode' if `direnv' is installed."
(when (executable-find "direnv")
(envrc-global-mode)))

(when (maybe-require-package 'envrc)
(defun sanityinc/maybe-enable-envrc-global-mode ()
"Enable `envrc-global-mode' if `direnv' is installed."
(when (executable-find "direnv")
(envrc-global-mode)))

(with-eval-after-load 'envrc
(define-key envrc-mode-map (kbd "C-c e") 'envrc-command-map))
(add-hook 'after-init-hook 'sanityinc/maybe-enable-envrc-global-mode))
Expand Down
Loading

0 comments on commit 51bea9f

Please sign in to comment.