From f5fa6631fcab9027d2f0fe3787b4749481d75754 Mon Sep 17 00:00:00 2001 From: Christopher Cooper Date: Sun, 16 Jul 2017 19:31:29 -0400 Subject: [PATCH 01/64] add coverage reporting with undercover/coveralls --- .emacs.d/test/lisp/install.el | 3 +++ .emacs.d/test/lisp/run-tests.el | 18 ++++++++++++++++++ .travis.yml | 2 +- 3 files changed, 22 insertions(+), 1 deletion(-) diff --git a/.emacs.d/test/lisp/install.el b/.emacs.d/test/lisp/install.el index a5b79e2..19c79e9 100644 --- a/.emacs.d/test/lisp/install.el +++ b/.emacs.d/test/lisp/install.el @@ -4,4 +4,7 @@ (package-initialize) (package-refresh-contents) +;; add undercover for coverage reporting +(setf kotct/dependency-list (cons 'undercover kotct/dependency-list)) + (mapc #'package-install kotct/dependency-list) diff --git a/.emacs.d/test/lisp/run-tests.el b/.emacs.d/test/lisp/run-tests.el index 7f5e552..00856ad 100644 --- a/.emacs.d/test/lisp/run-tests.el +++ b/.emacs.d/test/lisp/run-tests.el @@ -2,6 +2,24 @@ (package-initialize) +(unless (package-installed-p 'undercover) + (require 'repositories "~/.emacs.d/lisp/package/repositories") + (package-refresh-contents) + (package-install 'undercover 'dont-select)) + (load-file (concat (file-name-directory load-file-name) "/dot-tests.el")) +(require 'undercover) +;; undercover can't search for matching files recursively +;; override a local function that fixes this +(advice-add + #'undercover--wildcards-to-files :override + (lambda (wildcards) + (mapcar (lambda (filename) + ;; undercover adds a leading "/", so remove the + ;; "/" at the beginning of the absolute filename + (substring (file-truename filename) 1)) + (directory-files-recursively "~/.emacs.d/lisp/" ".el$")))) +(undercover) + (kotct/run-tests) diff --git a/.travis.yml b/.travis.yml index 812720c..0f11be8 100644 --- a/.travis.yml +++ b/.travis.yml @@ -16,5 +16,5 @@ install: before_script: - emacs --version script: - - emacs --script ~/.emacs.d/init.el - emacs --script .emacs.d/test/lisp/run-tests.el + - emacs --script ~/.emacs.d/init.el From 04e45470121939b1d4e7dd0dd287b01e26defdb5 Mon Sep 17 00:00:00 2001 From: Kristofer Rye Date: Sun, 30 Jul 2017 19:13:05 -0500 Subject: [PATCH 02/64] Add basic sh-mode support [GitHub] This commit resolves #69. --- .emacs.d/lisp/code/languages/language-hub.el | 1 + .emacs.d/lisp/code/languages/sh.el | 16 ++++++++++++++++ 2 files changed, 17 insertions(+) create mode 100644 .emacs.d/lisp/code/languages/sh.el diff --git a/.emacs.d/lisp/code/languages/language-hub.el b/.emacs.d/lisp/code/languages/language-hub.el index e3cccf6..c73a5c4 100644 --- a/.emacs.d/lisp/code/languages/language-hub.el +++ b/.emacs.d/lisp/code/languages/language-hub.el @@ -5,6 +5,7 @@ ruby rust java + sh web-c) "A list of packages configured by the language-hub.") diff --git a/.emacs.d/lisp/code/languages/sh.el b/.emacs.d/lisp/code/languages/sh.el new file mode 100644 index 0000000..250e03d --- /dev/null +++ b/.emacs.d/lisp/code/languages/sh.el @@ -0,0 +1,16 @@ +(require 'indentation) + +;; Synchronize `sh-basic-offset' and `sh-indentation' to the global tab size +(kotct/setf-tab sh-basic-offset) +(kotct/setf-tab sh-indentation) + +;; Always use indent-tabs-mode in sh-mode +(add-hook 'sh-mode-hook (lambda () (setf indent-tabs-mode t))) + +;; Indent case labels at the same level as the case statement +(setf sh-indent-for-case-label 0) + +;; Indent case alts to + +(setf sh-indent-for-case-alt '+) + +(provide 'sh) From 28e8ee10ee5e1ffb9d0acfa61cc7a1f24df49f72 Mon Sep 17 00:00:00 2001 From: Christopher Cooper Date: Wed, 2 Aug 2017 20:31:28 -0400 Subject: [PATCH 03/64] add badges --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index 37552d8..4e92c3f 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,7 @@ # kotct/dot +[![Build Status](https://travis-ci.org/kotct/dot.svg?branch=master)](https://travis-ci.org/kotct/dot) [![Coverage Status](https://coveralls.io/repos/github/kotct/dot/badge.svg)](https://coveralls.io/github/kotct/dot) + Dot is a collective configuration system which contains configurations for programs like Emacs and zsh, but also (potentially) Vim. Dot is written under the following principles: From 69c3bf14c698dc53412799d693b638253cda5474 Mon Sep 17 00:00:00 2001 From: Christopher Cooper Date: Wed, 2 Aug 2017 20:38:25 -0400 Subject: [PATCH 04/64] don't try to run undercover locally --- .emacs.d/test/lisp/run-tests.el | 29 ++++++++++++----------------- 1 file changed, 12 insertions(+), 17 deletions(-) diff --git a/.emacs.d/test/lisp/run-tests.el b/.emacs.d/test/lisp/run-tests.el index 00856ad..0386ded 100644 --- a/.emacs.d/test/lisp/run-tests.el +++ b/.emacs.d/test/lisp/run-tests.el @@ -2,24 +2,19 @@ (package-initialize) -(unless (package-installed-p 'undercover) - (require 'repositories "~/.emacs.d/lisp/package/repositories") - (package-refresh-contents) - (package-install 'undercover 'dont-select)) - (load-file (concat (file-name-directory load-file-name) "/dot-tests.el")) -(require 'undercover) -;; undercover can't search for matching files recursively -;; override a local function that fixes this -(advice-add - #'undercover--wildcards-to-files :override - (lambda (wildcards) - (mapcar (lambda (filename) - ;; undercover adds a leading "/", so remove the - ;; "/" at the beginning of the absolute filename - (substring (file-truename filename) 1)) - (directory-files-recursively "~/.emacs.d/lisp/" ".el$")))) -(undercover) +(if (require 'undercover nil 'noerror) + ;; undercover can't search for matching files recursively + ;; override a local function that fixes this + (advice-add + #'undercover--wildcards-to-files :override + (lambda (wildcards) + (mapcar (lambda (filename) + ;; undercover adds a leading "/", so remove the + ;; "/" at the beginning of the absolute filename + (substring (file-truename filename) 1)) + (directory-files-recursively "~/.emacs.d/lisp/" ".el$")))) + (undercover)) (kotct/run-tests) From c1b13d66f1065625b25a51f06e2036f08f2fdda5 Mon Sep 17 00:00:00 2001 From: Christopher Cooper Date: Wed, 2 Aug 2017 20:46:42 -0400 Subject: [PATCH 05/64] use when where i meant to i am an idiot --- .emacs.d/test/lisp/run-tests.el | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/.emacs.d/test/lisp/run-tests.el b/.emacs.d/test/lisp/run-tests.el index 0386ded..0a13baf 100644 --- a/.emacs.d/test/lisp/run-tests.el +++ b/.emacs.d/test/lisp/run-tests.el @@ -4,17 +4,17 @@ (load-file (concat (file-name-directory load-file-name) "/dot-tests.el")) -(if (require 'undercover nil 'noerror) - ;; undercover can't search for matching files recursively - ;; override a local function that fixes this - (advice-add - #'undercover--wildcards-to-files :override - (lambda (wildcards) - (mapcar (lambda (filename) - ;; undercover adds a leading "/", so remove the - ;; "/" at the beginning of the absolute filename - (substring (file-truename filename) 1)) - (directory-files-recursively "~/.emacs.d/lisp/" ".el$")))) +(when (require 'undercover nil 'noerror) + ;; undercover can't search for matching files recursively + ;; override a local function that fixes this + (advice-add + #'undercover--wildcards-to-files :override + (lambda (wildcards) + (mapcar (lambda (filename) + ;; undercover adds a leading "/", so remove the + ;; "/" at the beginning of the absolute filename + (substring (file-truename filename) 1)) + (directory-files-recursively "~/.emacs.d/lisp/" ".el$")))) (undercover)) (kotct/run-tests) From e621fe7a5930e2024e76741578cffdfdb5f81b16 Mon Sep 17 00:00:00 2001 From: Kristofer Rye Date: Wed, 2 Aug 2017 20:00:07 -0500 Subject: [PATCH 06/64] Change the VERSION on `master` to 0.2-pre --- VERSION | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/VERSION b/VERSION index 77d6f4c..2df1373 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -0.0.0 +0.2-pre From f18f7758847522f4409fbc470cbc2bca21935245 Mon Sep 17 00:00:00 2001 From: Christopher Cooper Date: Wed, 2 Aug 2017 21:11:24 -0400 Subject: [PATCH 07/64] use relative path for emacs init --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 38761bb..9e92662 100644 --- a/.travis.yml +++ b/.travis.yml @@ -18,7 +18,7 @@ before_script: - emacs --version script: - emacs --script .emacs.d/test/lisp/run-tests.el -- emacs --script ~/.emacs.d/init.el +- emacs --script .emacs.d/init.el notifications: slack: secure: Pu2AagcBjx2iBPwsIJ3oNdB5koGfqSP12Mat9KYajxtIwbyzgGsToiyma3+s+Yl02+IRZdGonZaKH/c2RGNF05PK4PAoNfkhYafiog4hKD5ZusIi1xVr0zWOREZVsqpAeu0cxs/b+p7Va66+CRukGYxTGs0LjfEXoJ3KRJYwziSVDYVEoujGHFTPKlyNZNU0fSW+pioVneiVy+hpVvfdzqby9WJG9nK/607xceJ+HVdntXABnUBDk6/1KVqbH36U2Xlw2hlRebGWIowqg/S6yOqn+NxvrM5FNb7LHWxx/mLM3o5Ml1pm9mcDS0M+sPOquLlW/0NPfiV3cz485W6aoSo37z9eassQ4DKQsEjiL4AfGXH4Wgu3BASnWTMkSXfGwW09rKSu1PCyozp76htkiMWp2tJQo/GUAey7PYTSEHhFWBhBL2UaJ3WY4H/1SdaVqHwnBNXU6YEMIJn0S7F31MmQUmSIcVMbqP9XojWl9DHDKP9o4S5CCshYlKR3XzdSeOzyQKb2PKr5NAtU2lYVMfL4XYEsz+sWO1yOCUB+U0yVXdk9kInGHY5AAwIJ6v/ODSDGW67SlXMAJcrkW2nlX8I9JZ+aR4vKo47j+MCPsPMBaPoHyGquVe9++iq67Kdxl18azrQ6fVbjNda3LRTZVH9ekWRf9eMsVBbSeyORUx8= From de1ad78c7afeb9cdd6965415295e6eebe85ac90e Mon Sep 17 00:00:00 2001 From: Christopher Cooper Date: Wed, 2 Aug 2017 21:22:17 -0400 Subject: [PATCH 08/64] move badges in README to title line --- README.md | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/README.md b/README.md index a2db27b..b61063f 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,4 @@ -# kotct/dot - -[![Build Status](https://travis-ci.org/kotct/dot.svg?branch=master)](https://travis-ci.org/kotct/dot) [![Coverage Status](https://coveralls.io/repos/github/kotct/dot/badge.svg)](https://coveralls.io/github/kotct/dot) +# kotct/dot [![Build Status](https://travis-ci.org/kotct/dot.svg?branch=master)](https://travis-ci.org/kotct/dot) [![Coverage Status](https://coveralls.io/repos/github/kotct/dot/badge.svg)](https://coveralls.io/github/kotct/dot) Dot is a collective configuration system which contains configurations for programs like Emacs and zsh, but also (potentially) Vim. Dot is From 32c4644ea285d5366e50d121d237ca0f9c2485d3 Mon Sep 17 00:00:00 2001 From: Christopher Cooper Date: Wed, 2 Aug 2017 21:27:23 -0400 Subject: [PATCH 09/64] mark unused variable --- .emacs.d/test/lisp/run-tests.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.emacs.d/test/lisp/run-tests.el b/.emacs.d/test/lisp/run-tests.el index 0a13baf..7472df9 100644 --- a/.emacs.d/test/lisp/run-tests.el +++ b/.emacs.d/test/lisp/run-tests.el @@ -9,7 +9,7 @@ ;; override a local function that fixes this (advice-add #'undercover--wildcards-to-files :override - (lambda (wildcards) + (lambda (_wildcards) (mapcar (lambda (filename) ;; undercover adds a leading "/", so remove the ;; "/" at the beginning of the absolute filename From ca3a448e695738fc09d9001520785a429cf5008d Mon Sep 17 00:00:00 2001 From: Kristofer Rye Date: Sat, 5 Aug 2017 15:19:50 -0500 Subject: [PATCH 10/64] Add gitignore-mode, gitattributes-mode, and gitconfig-mode as deps --- .emacs.d/lisp/package/dependencies.el | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.emacs.d/lisp/package/dependencies.el b/.emacs.d/lisp/package/dependencies.el index 0e2865b..2441299 100644 --- a/.emacs.d/lisp/package/dependencies.el +++ b/.emacs.d/lisp/package/dependencies.el @@ -21,6 +21,9 @@ rust-mode ;; for editing Rust code buttercup ;; for tests smartparens ;; for dealing with paired control flow symbols + gitignore-mode ;; for editing .gitignore files + gitattributes-mode ;; for editing .gitattributes files + gitconfig-mode ;; for editing .git/config files ;; THEMES solarized-theme) From 8f340222237e8e117f72d04794bc01552057657c Mon Sep 17 00:00:00 2001 From: Kristofer Rye Date: Tue, 8 Aug 2017 19:14:19 -0500 Subject: [PATCH 11/64] Write a sh-mode test --- .emacs.d/test/lisp/code/languages/sh-test.el | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 .emacs.d/test/lisp/code/languages/sh-test.el diff --git a/.emacs.d/test/lisp/code/languages/sh-test.el b/.emacs.d/test/lisp/code/languages/sh-test.el new file mode 100644 index 0000000..d812cdc --- /dev/null +++ b/.emacs.d/test/lisp/code/languages/sh-test.el @@ -0,0 +1,7 @@ +(kotct/load-corresponding) + +(describe "sh config" + (it "adds a tab variable setter for `sh-basic-offset'" + (expect (assoc 'sh-basic-offset kotct/tab-variable-setters) :to-be-truthy)) + (it "adds a tab variable setter for `sh-indentation'" + (expect (assoc 'sh-indentation kotct/tab-variable-setters) :to-be-truthy))) From a1cab2dfa64c6638a6baef67a010a105ecdebb95 Mon Sep 17 00:00:00 2001 From: Kristofer Rye Date: Tue, 8 Aug 2017 19:17:46 -0500 Subject: [PATCH 12/64] Add the rest of the specs for the sh configuration Note that I did not include a test for `sh-mode-hook` having `indent-tabs-mode` set to `t` by default. This is primarily due to concerns about equality checking, since it currently runs a `lambda`. I plan to make API changes to `indentation` to improve all of this, however, so it might be best to ship it like this. --- .emacs.d/test/lisp/code/languages/sh-test.el | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/.emacs.d/test/lisp/code/languages/sh-test.el b/.emacs.d/test/lisp/code/languages/sh-test.el index d812cdc..da53aa0 100644 --- a/.emacs.d/test/lisp/code/languages/sh-test.el +++ b/.emacs.d/test/lisp/code/languages/sh-test.el @@ -4,4 +4,8 @@ (it "adds a tab variable setter for `sh-basic-offset'" (expect (assoc 'sh-basic-offset kotct/tab-variable-setters) :to-be-truthy)) (it "adds a tab variable setter for `sh-indentation'" - (expect (assoc 'sh-indentation kotct/tab-variable-setters) :to-be-truthy))) + (expect (assoc 'sh-indentation kotct/tab-variable-setters) :to-be-truthy)) + (it "sets the indentation for case labels to 0" + (expect sh-indent-for-case-label :to-be 0)) + (it "sets the indentation for case alts to be one level" + (expect sh-indent-for-case-alt :to-be '+))) From 42370239dc5479c0cbcafd3f300c21c2aa7a95c8 Mon Sep 17 00:00:00 2001 From: Kristofer Rye Date: Wed, 9 Aug 2017 10:05:45 -0500 Subject: [PATCH 13/64] Add ../../../../lisp/code to sh-test's load-path --- .emacs.d/test/lisp/code/languages/sh-test.el | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.emacs.d/test/lisp/code/languages/sh-test.el b/.emacs.d/test/lisp/code/languages/sh-test.el index da53aa0..5f1e489 100644 --- a/.emacs.d/test/lisp/code/languages/sh-test.el +++ b/.emacs.d/test/lisp/code/languages/sh-test.el @@ -1,3 +1,5 @@ +(add-to-list 'load-path (concat (file-name-directory load-file-name) "../../../../lisp/code/")) + (kotct/load-corresponding) (describe "sh config" From 4619474767ab08b1afb24720d4916b530531b3a1 Mon Sep 17 00:00:00 2001 From: Kristofer Rye Date: Thu, 31 Aug 2017 15:34:00 -0500 Subject: [PATCH 14/64] Require 'cl at compile-time when running tests [GitHub] This commit resolves #85, at least locally. --- .emacs.d/test/lisp/dot-tests.el | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.emacs.d/test/lisp/dot-tests.el b/.emacs.d/test/lisp/dot-tests.el index f7c3fb1..03f6ce1 100644 --- a/.emacs.d/test/lisp/dot-tests.el +++ b/.emacs.d/test/lisp/dot-tests.el @@ -1,5 +1,7 @@ (require 'buttercup) +(eval-when-compile (require 'cl)) + (defun kotct/quietly-load-file (filename &optional throw-error) "Load FILENAME, but do not send a message on success. If loading throws an error, send a message with FILENAME and the error. From 4a535ee1391e4f4eff3e4e3d23c6aa84fa460ca7 Mon Sep 17 00:00:00 2001 From: Kristofer Rye Date: Tue, 3 Oct 2017 12:59:18 -0500 Subject: [PATCH 15/64] Add `force-load` optional argument to `kotct/switch-to-theme` This will be used to instruct `kotct/switch-to-theme` to load the file without worrying about whether or not it is already known. For performance reasons, this is optional, (and will be nil in all instances where it is already used) because loading a theme over and over again requires evaluation. --- .emacs.d/lisp/visual/theme.el | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.emacs.d/lisp/visual/theme.el b/.emacs.d/lisp/visual/theme.el index 51a50d0..0dda84b 100644 --- a/.emacs.d/lisp/visual/theme.el +++ b/.emacs.d/lisp/visual/theme.el @@ -2,8 +2,10 @@ nil "The currently enabled theme.") -(defun kotct/switch-to-theme (theme) - "Enable the theme THEME. Disable the current theme." +(defun kotct/switch-to-theme (theme &optional force-load) + "Enable the theme THEME. Disable the current theme. + +If FORCE-LOAD is set, THEME is always loaded." (if kotct/current-theme (disable-theme kotct/current-theme)) (if (member theme custom-known-themes) (enable-theme theme) From 26ad140fcb4eb3957cb2c8e069c3a8aaf72f1883 Mon Sep 17 00:00:00 2001 From: Kristofer Rye Date: Tue, 3 Oct 2017 13:17:37 -0500 Subject: [PATCH 16/64] Implement `force-load behavior` --- .emacs.d/lisp/visual/theme.el | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.emacs.d/lisp/visual/theme.el b/.emacs.d/lisp/visual/theme.el index 0dda84b..c950308 100644 --- a/.emacs.d/lisp/visual/theme.el +++ b/.emacs.d/lisp/visual/theme.el @@ -7,7 +7,8 @@ If FORCE-LOAD is set, THEME is always loaded." (if kotct/current-theme (disable-theme kotct/current-theme)) - (if (member theme custom-known-themes) + (if (and (not force-load) + (member theme custom-known-themes)) (enable-theme theme) (load-theme theme 'no-confirm)) (setf kotct/current-theme theme) From 16d8e0b03c48418167e064693d3d0d9c337345f7 Mon Sep 17 00:00:00 2001 From: Kristofer Rye Date: Sun, 15 Oct 2017 14:16:21 -0500 Subject: [PATCH 17/64] Increase MELPA Stable's priority This will prevent it from conflicting with GNU and everybody else. --- .emacs.d/lisp/package/repositories.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.emacs.d/lisp/package/repositories.el b/.emacs.d/lisp/package/repositories.el index 2351185..ff31fd8 100644 --- a/.emacs.d/lisp/package/repositories.el +++ b/.emacs.d/lisp/package/repositories.el @@ -16,7 +16,7 @@ "http://elpa.gnu.org/packages/")) (setf package-archive-priorities - '(("melpa-stable" . 10) + '(("melpa-stable" . 20) ("gnu" . 10) ("marmalade" . 10) ("melpa" . 0))) From e5914e8ed7d404cdb786b0d272e01cad1caffc05 Mon Sep 17 00:00:00 2001 From: Kristofer Rye Date: Sun, 15 Oct 2017 14:18:43 -0500 Subject: [PATCH 18/64] Delete Marmalade from our list of package-archive priorities We don't need to keep it around if it's not configured---Marmalade users can definitely install it themselves later on. --- .emacs.d/lisp/package/repositories.el | 1 - 1 file changed, 1 deletion(-) diff --git a/.emacs.d/lisp/package/repositories.el b/.emacs.d/lisp/package/repositories.el index ff31fd8..6b7f71a 100644 --- a/.emacs.d/lisp/package/repositories.el +++ b/.emacs.d/lisp/package/repositories.el @@ -18,7 +18,6 @@ (setf package-archive-priorities '(("melpa-stable" . 20) ("gnu" . 10) - ("marmalade" . 10) ("melpa" . 0))) ;; (require 'packup) From 30f9715e5796370bbe6ba0d0ee1257eb8a3ddb69 Mon Sep 17 00:00:00 2001 From: Kristofer Rye Date: Sun, 15 Oct 2017 14:19:36 -0500 Subject: [PATCH 19/64] Move MELPA to the bottom of the list of package archive additions This matches the priority listing. --- .emacs.d/lisp/package/repositories.el | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.emacs.d/lisp/package/repositories.el b/.emacs.d/lisp/package/repositories.el index 6b7f71a..28f46e8 100644 --- a/.emacs.d/lisp/package/repositories.el +++ b/.emacs.d/lisp/package/repositories.el @@ -1,10 +1,5 @@ (require 'package) -;; Add MELPA repository -(add-to-list 'package-archives - '("melpa" . - "http://melpa.milkbox.net/packages/")) - ;; Add MELPA Stable (add-to-list 'package-archives '("melpa-stable" . @@ -15,6 +10,11 @@ '("gnu" . "http://elpa.gnu.org/packages/")) +;; Add MELPA repository +(add-to-list 'package-archives + '("melpa" . + "http://melpa.milkbox.net/packages/")) + (setf package-archive-priorities '(("melpa-stable" . 20) ("gnu" . 10) From 6a9b848a22ebac6dad98c996f52e01d296062326 Mon Sep 17 00:00:00 2001 From: Kristofer Rye Date: Sun, 5 Nov 2017 14:45:26 -0600 Subject: [PATCH 20/64] Add yaml-mode to the dependency list --- .emacs.d/lisp/package/dependencies.el | 1 + 1 file changed, 1 insertion(+) diff --git a/.emacs.d/lisp/package/dependencies.el b/.emacs.d/lisp/package/dependencies.el index 2441299..71739aa 100644 --- a/.emacs.d/lisp/package/dependencies.el +++ b/.emacs.d/lisp/package/dependencies.el @@ -19,6 +19,7 @@ web-mode ;; for editing web files elixir-mode ;; for editing Elixir code rust-mode ;; for editing Rust code + yaml-mode ;; for editing YAML files buttercup ;; for tests smartparens ;; for dealing with paired control flow symbols gitignore-mode ;; for editing .gitignore files From 90b876355ff454595a3ee286829fae1ebb5e3edc Mon Sep 17 00:00:00 2001 From: Kristofer Rye Date: Fri, 10 Nov 2017 09:54:26 -0600 Subject: [PATCH 21/64] Stop testing against Emacs Git This is causing permanently-failing builds. --- .travis.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 9e92662..e4506d3 100644 --- a/.travis.yml +++ b/.travis.yml @@ -4,7 +4,6 @@ cache: apt env: - EVM_EMACS=emacs-25.1-travis - EVM_EMACS=emacs-25.2-travis -- EVM_EMACS=emacs-git-snapshot-travis before_install: - git clone https://github.com/rejeep/evm.git ~/.evm - export PATH="~/.evm/bin:$PATH" From 57a772f4dca7a8f8d8ce4eab18836dda121c0213 Mon Sep 17 00:00:00 2001 From: Kristofer Rye Date: Tue, 26 Dec 2017 14:57:15 -0600 Subject: [PATCH 22/64] Add support for fish-mode --- .emacs.d/lisp/code/languages/fish.el | 11 +++++++++++ .emacs.d/lisp/code/languages/language-hub.el | 1 + 2 files changed, 12 insertions(+) create mode 100644 .emacs.d/lisp/code/languages/fish.el diff --git a/.emacs.d/lisp/code/languages/fish.el b/.emacs.d/lisp/code/languages/fish.el new file mode 100644 index 0000000..5c6c742 --- /dev/null +++ b/.emacs.d/lisp/code/languages/fish.el @@ -0,0 +1,11 @@ +(require 'fish-mode) + +(smart-tabs-add-language-support fish fish-mode-hook + ((fish-indent-line . standard-indent) + (fish-indent-region . standard-indent))) + +(smart-tabs-insinuate 'fish) + +(add-hook 'fish-mode-hook (lambda () (setf indent-tabs-mode t))) + +(provide 'fish) diff --git a/.emacs.d/lisp/code/languages/language-hub.el b/.emacs.d/lisp/code/languages/language-hub.el index c73a5c4..cb8db0a 100644 --- a/.emacs.d/lisp/code/languages/language-hub.el +++ b/.emacs.d/lisp/code/languages/language-hub.el @@ -2,6 +2,7 @@ '(c elisp elixir + fish ruby rust java From f0d02fc5d1bcea1948887351bb5575115790b796 Mon Sep 17 00:00:00 2001 From: Kristofer Rye Date: Tue, 26 Dec 2017 14:58:31 -0600 Subject: [PATCH 23/64] Add fish-mode as a dependency --- .emacs.d/lisp/package/dependencies.el | 1 + 1 file changed, 1 insertion(+) diff --git a/.emacs.d/lisp/package/dependencies.el b/.emacs.d/lisp/package/dependencies.el index 71739aa..6fa5af7 100644 --- a/.emacs.d/lisp/package/dependencies.el +++ b/.emacs.d/lisp/package/dependencies.el @@ -25,6 +25,7 @@ gitignore-mode ;; for editing .gitignore files gitattributes-mode ;; for editing .gitattributes files gitconfig-mode ;; for editing .git/config files + fish-mode ;; for editing fish shell configuration files ;; THEMES solarized-theme) From 5e49fac713eaa5f114116bf3a2eb1160a9709cb4 Mon Sep 17 00:00:00 2001 From: Kristofer Rye Date: Tue, 26 Dec 2017 14:58:53 -0600 Subject: [PATCH 24/64] Darwin: force use of sh as shell This might break stuff, idk --- .emacs.d/lisp/system/darwin.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.emacs.d/lisp/system/darwin.el b/.emacs.d/lisp/system/darwin.el index 2f5ae5a..dbb11ef 100644 --- a/.emacs.d/lisp/system/darwin.el +++ b/.emacs.d/lisp/system/darwin.el @@ -45,7 +45,7 @@ stuff. This also respects the user's shell decision." ;; set, and the path should already be okay. (if (not (getenv "TERM_PROGRAM")) ;; Ask the shell to print out its value for $PATH. - (let ((path (shell-command-to-string "$SHELL -cl \"printf %s \\\"\\\$PATH\\\"\""))) + (let ((path (shell-command-to-string "/bin/sh -cl \"printf %s \\\"\\\$PATH\\\"\""))) ;; Set the PATH variable to this to match everything up. (setenv "PATH" path) ;; Split $PATH and store in `exec-path'. From db152340e4dd05072c7cea8251f1e8d632594afb Mon Sep 17 00:00:00 2001 From: Christopher Cooper Date: Mon, 9 Apr 2018 22:55:17 -0400 Subject: [PATCH 25/64] add go-mode for editing golang source code --- .emacs.d/lisp/code/languages/go.el | 9 +++++++++ .emacs.d/lisp/code/languages/language-hub.el | 3 ++- .emacs.d/lisp/package/dependencies.el | 2 ++ 3 files changed, 13 insertions(+), 1 deletion(-) create mode 100644 .emacs.d/lisp/code/languages/go.el diff --git a/.emacs.d/lisp/code/languages/go.el b/.emacs.d/lisp/code/languages/go.el new file mode 100644 index 0000000..b4ff914 --- /dev/null +++ b/.emacs.d/lisp/code/languages/go.el @@ -0,0 +1,9 @@ +(add-to-list 'exec-path "/home/cooperc/gocode/bin/") + +(add-hook 'go-mode-hook (lambda () + (local-set-key (kbd "M-.") 'godef-jump))) + +(with-eval-after-load 'go-mode + (require 'go-autocomplete)) + +(provide 'go) diff --git a/.emacs.d/lisp/code/languages/language-hub.el b/.emacs.d/lisp/code/languages/language-hub.el index cb8db0a..6dca9ff 100644 --- a/.emacs.d/lisp/code/languages/language-hub.el +++ b/.emacs.d/lisp/code/languages/language-hub.el @@ -7,7 +7,8 @@ rust java sh - web-c) + web-c + go) "A list of packages configured by the language-hub.") (let ((to-compile ())) diff --git a/.emacs.d/lisp/package/dependencies.el b/.emacs.d/lisp/package/dependencies.el index 6fa5af7..b694446 100644 --- a/.emacs.d/lisp/package/dependencies.el +++ b/.emacs.d/lisp/package/dependencies.el @@ -26,6 +26,8 @@ gitattributes-mode ;; for editing .gitattributes files gitconfig-mode ;; for editing .git/config files fish-mode ;; for editing fish shell configuration files + go-mode ;; for editing go code + go-autocomplete ;; AC support for go ;; THEMES solarized-theme) From d298e9c9a198f308f9205194e848b966455ed94d Mon Sep 17 00:00:00 2001 From: Christopher Cooper Date: Mon, 9 Apr 2018 23:00:30 -0400 Subject: [PATCH 26/64] remove machine-local code --- .emacs.d/lisp/code/languages/go.el | 2 -- 1 file changed, 2 deletions(-) diff --git a/.emacs.d/lisp/code/languages/go.el b/.emacs.d/lisp/code/languages/go.el index b4ff914..37c2fb3 100644 --- a/.emacs.d/lisp/code/languages/go.el +++ b/.emacs.d/lisp/code/languages/go.el @@ -1,5 +1,3 @@ -(add-to-list 'exec-path "/home/cooperc/gocode/bin/") - (add-hook 'go-mode-hook (lambda () (local-set-key (kbd "M-.") 'godef-jump))) From 094783d1c78d6ad736899c183b39f680b8f32cc8 Mon Sep 17 00:00:00 2001 From: Christopher Cooper Date: Sun, 29 Apr 2018 08:45:41 -0400 Subject: [PATCH 27/64] fix themes that use (selected-frame) by manually selecting frame See #42 and cpaulik/emacs-material-theme#45. --- .emacs.d/lisp/visual/theme.el | 46 ++++++++++++++++++++++++++--------- 1 file changed, 35 insertions(+), 11 deletions(-) diff --git a/.emacs.d/lisp/visual/theme.el b/.emacs.d/lisp/visual/theme.el index c950308..baabd41 100644 --- a/.emacs.d/lisp/visual/theme.el +++ b/.emacs.d/lisp/visual/theme.el @@ -1,22 +1,46 @@ +;; -*- lexical-binding: t; -*- + (defvar kotct/current-theme nil "The currently enabled theme.") +(defvar kotct/deferred-theme + nil + "A theme that was not able to be loaded on init (probably because +we don't yet have a frame) and has been deferred to be loaded +later by `kotct/theme-callback'.") + +(defun kotct/theme-callback (frame) + "Can be called with a FRAME to select the frame and load `kotct/deferred-theme'. + +Also removes itself from `after-make-frame-functions', if present." + (remove-hook 'after-make-frame-functions #'kotct/theme-callback) + ;; we must select the frame, so the theme can + ;; access it via (selected-frame) + (with-selected-frame frame + (kotct/switch-to-theme (car kotct/deferred-theme) (cdr kotct/deferred-theme))) + (setf kotct/deferred-theme nil)) + (defun kotct/switch-to-theme (theme &optional force-load) "Enable the theme THEME. Disable the current theme. If FORCE-LOAD is set, THEME is always loaded." - (if kotct/current-theme (disable-theme kotct/current-theme)) - (if (and (not force-load) - (member theme custom-known-themes)) - (enable-theme theme) - (load-theme theme 'no-confirm)) - (setf kotct/current-theme theme) - ;; make specific theme customizations - (cond ((or (eq kotct/current-theme 'solarized-dark) - (eq kotct/current-theme 'solarized-light)) - (progn - (setf x-underline-at-descent-line t))))) + (if (string= (terminal-name (frame-terminal)) "initial_terminal") + ;; defer loading until after we have a frame + (progn + (setf kotct/deferred-theme (cons theme force-load)) + (add-hook 'after-make-frame-functions #'kotct/theme-callback)) + (if kotct/current-theme (disable-theme kotct/current-theme)) + (if (and (not force-load) + (member theme custom-known-themes)) + (enable-theme theme) + (load-theme theme 'no-confirm)) + (setf kotct/current-theme theme) + ;; make specific theme customizations + (cond ((or (eq kotct/current-theme 'solarized-dark) + (eq kotct/current-theme 'solarized-light)) + (progn + (setf x-underline-at-descent-line t)))))) (kotct/switch-to-theme 'solarized-dark) From 4e807472d7b78843b7daab5dbd67ab0883080101 Mon Sep 17 00:00:00 2001 From: samontea Date: Thu, 21 Jun 2018 16:40:57 -0400 Subject: [PATCH 28/64] change to avy --- .emacs.d/lisp/behavior/text.el | 8 ++++---- .emacs.d/lisp/package/dependencies.el | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/.emacs.d/lisp/behavior/text.el b/.emacs.d/lisp/behavior/text.el index fbb1b24..6abe65a 100644 --- a/.emacs.d/lisp/behavior/text.el +++ b/.emacs.d/lisp/behavior/text.el @@ -7,12 +7,12 @@ (require 'cl) ;;; ace jump mode -(global-set-key (kbd "C-c SPC") #'ace-jump-mode) +(global-set-key (kbd "C-c SPC") #'avy-goto-word-1) +(global-set-key (kbd "C-c '") #'avy-goto-char-1) ;; save zapped chars to kill ring -(setf ajz/zap-function #'kill-region) -(global-set-key (kbd "M-z") #'ace-jump-zap-to-char) - +(setf avy-zap-function #'kill-region) +(global-set-key (kbd "M-z") #'avy-zap-to-char-dwim) ;;; jump to line (global-set-key (kbd "C-x g") #'goto-line) diff --git a/.emacs.d/lisp/package/dependencies.el b/.emacs.d/lisp/package/dependencies.el index b694446..0f5bc2a 100644 --- a/.emacs.d/lisp/package/dependencies.el +++ b/.emacs.d/lisp/package/dependencies.el @@ -11,8 +11,8 @@ auto-complete ;; code autocompletion markdown-mode ;; major mode for markdown smart-tabs-mode ;; indentation with tabs and spaces - ace-jump-mode ;; immediately jump to any visible character - ace-jump-zap ;; zap-to-char but harnessing ace-jump + avy ;; immediately jump to any visible character + avy-zap ;; zap-to-char but harnessing ace-jump editorconfig ;; editorconfig plugin hl-todo ;; highlight TODO, FIXME, FAIL, etc. highlight-symbol ;; navigate between and highlight symbols From 49230d634868d2848a8d83da81106e5a92c0d620 Mon Sep 17 00:00:00 2001 From: samontea Date: Thu, 21 Jun 2018 16:49:08 -0400 Subject: [PATCH 29/64] correcty wrong symbol --- .emacs.d/lisp/behavior/text.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.emacs.d/lisp/behavior/text.el b/.emacs.d/lisp/behavior/text.el index 6abe65a..1db0902 100644 --- a/.emacs.d/lisp/behavior/text.el +++ b/.emacs.d/lisp/behavior/text.el @@ -8,7 +8,7 @@ ;;; ace jump mode (global-set-key (kbd "C-c SPC") #'avy-goto-word-1) -(global-set-key (kbd "C-c '") #'avy-goto-char-1) +(global-set-key (kbd "C-c '") #'avy-goto-char) ;; save zapped chars to kill ring (setf avy-zap-function #'kill-region) From 9d8107559dcbe6589d4f6ce0d33f5c0385831681 Mon Sep 17 00:00:00 2001 From: samontea Date: Thu, 21 Jun 2018 19:16:43 -0400 Subject: [PATCH 30/64] update stale comments --- .emacs.d/lisp/behavior/text.el | 2 +- .emacs.d/lisp/package/dependencies.el | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.emacs.d/lisp/behavior/text.el b/.emacs.d/lisp/behavior/text.el index 1db0902..7942caa 100644 --- a/.emacs.d/lisp/behavior/text.el +++ b/.emacs.d/lisp/behavior/text.el @@ -6,7 +6,7 @@ (require 'cl) -;;; ace jump mode +;;; avy jump mode (global-set-key (kbd "C-c SPC") #'avy-goto-word-1) (global-set-key (kbd "C-c '") #'avy-goto-char) diff --git a/.emacs.d/lisp/package/dependencies.el b/.emacs.d/lisp/package/dependencies.el index 0f5bc2a..5ea0cd4 100644 --- a/.emacs.d/lisp/package/dependencies.el +++ b/.emacs.d/lisp/package/dependencies.el @@ -12,7 +12,7 @@ markdown-mode ;; major mode for markdown smart-tabs-mode ;; indentation with tabs and spaces avy ;; immediately jump to any visible character - avy-zap ;; zap-to-char but harnessing ace-jump + avy-zap ;; zap-to-char but harnessing avy editorconfig ;; editorconfig plugin hl-todo ;; highlight TODO, FIXME, FAIL, etc. highlight-symbol ;; navigate between and highlight symbols From 5fcd86bee65ec6fba31f1293897e01cb3dd3b4bd Mon Sep 17 00:00:00 2001 From: samontea Date: Mon, 31 Jul 2017 23:23:59 -0400 Subject: [PATCH 31/64] add kotct/packup which initializes buffer for ui --- .emacs.d/lisp/package/packup.el | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/.emacs.d/lisp/package/packup.el b/.emacs.d/lisp/package/packup.el index 00f3639..b48008d 100644 --- a/.emacs.d/lisp/package/packup.el +++ b/.emacs.d/lisp/package/packup.el @@ -15,6 +15,37 @@ Does not automatically refresh package list." (every (lambda (x) (package-installed-p package (package-desc-version x))) (cdr (assq package package-archive-contents)))) +(defun kotct/insert-package-row (package-name package-update-date package-desc-version) + "Inserts a package row into current buffer." + (let ((inhibit-read-only t)) + (insert (format "[x] %s %s %s\n" package-name package-update-date package-desc-version)))) + +(defun kotct/packup-initialize-buffer () + "Initializes the packup buffer." + (kill-all-local-variables) +;; (use-local-map packup-mode-map) ;; mapppppps + (setq major-mode 'packup-mode + mode-name "Packup" + buffer-read-only t ;; read only + mode-line-buffer-identification "packup") + (package-refresh-contents) + (let ((install-list nil)) + (dolist (package kotct/dependency-list) + (let () + (if (or (not (package-installed-p package)) + (not (kotct/package-up-to-date-p package))) + (apply 'kotct/insert-package-row (cons package (package-desc-version (cadr (assq package package-alist)))))))))) + +;;;###autoload +(defun kotct/packup () + "Creates an interactive buffer to install/update packages." + (interactive) + (let ((old-buf (current-buffer)) + (buffer (create-file-buffer "*packup*"))) ;; this is wrong... + (set-buffer buffer) + (kotct/packup-initialize-buffer) + (pop-to-buffer-same-window buffer))) + ;;;###autoload (defun kotct/packup-install-dependencies (no-refresh &optional update) "Installs the dependencies. From d716e45eddb7b5cb000c8f7f9fff63075ccdad39 Mon Sep 17 00:00:00 2001 From: samontea Date: Wed, 2 Aug 2017 00:22:34 -0400 Subject: [PATCH 32/64] add commands mark & unmark to dired (w/ region support!) --- .emacs.d/lisp/package/packup.el | 69 ++++++++++++++++++++++++++++++--- 1 file changed, 64 insertions(+), 5 deletions(-) diff --git a/.emacs.d/lisp/package/packup.el b/.emacs.d/lisp/package/packup.el index b48008d..c3e1cad 100644 --- a/.emacs.d/lisp/package/packup.el +++ b/.emacs.d/lisp/package/packup.el @@ -9,21 +9,72 @@ (package-initialize) +(defvar kotct/packup-marker-char ?x + "In Packup, the current mark character. +This is what the do-commands look for, and the flag the mark-commands store." + ) + (defun kotct/package-up-to-date-p (package) "Returns true if PACKAGE is up-to-date. Does not automatically refresh package list." (every (lambda (x) (package-installed-p package (package-desc-version x))) (cdr (assq package package-archive-contents)))) -(defun kotct/insert-package-row (package-name package-update-date package-desc-version) +(defun kotct/packup-insert-package-row (package-name package-update-date package-desc-version) "Inserts a package row into current buffer." (let ((inhibit-read-only t)) - (insert (format "[x] %s %s %s\n" package-name package-update-date package-desc-version)))) + (insert (format "[%c] %s %s %s\n" kotct/packup-marker-char package-name package-update-date package-desc-version)))) + +(defun kotct/packup-mark-files-in-region (start end) + "" ;; TODO + (let ((inhibit-read-only t)) + (if (> start end) + (error "start > end")) + (goto-char start) ; assumed at beginning of line + (while (< (point) end) + (forward-char 1) + (progn + (delete-char 1) + (insert kotct/packup-marker-char)) + (forward-line 1)))) + +(defun kotct/packup-repeat-over-lines (arg function) + (while (and (> arg 0) (not (eobp))) + (setq arg (1- arg)) + (beginning-of-line) + (save-excursion (funcall function)))) + +;; TODO advance the pointer +(defun kotct/packup-mark (arg &optional interactive) + "Mark the package at point in the Packup buffer. +If the region is active, mark all the files in the region." + (interactive (list current-prefix-arg t)) + (cond + ((use-region-p) + (save-excursion + (let ((beg (region-beginning)) + (end (region-end))) + (kotct/packup-mark-files-in-region + (progn (goto-char beg) (line-beginning-position)) + (progn (goto-char end) (line-beginning-position)))))) + (t + (let ((inhibit-read-only t)) + (kotct/packup-repeat-over-lines + (prefix-numeric-value arg) + (lambda () (forward-char 1) (delete-char 1) (insert kotct/packup-marker-char))))))) + +(defun kotct/packup-unmark (arg &optional interactive) + "" ;; TODO: finish me + (interactive (list current-prefix-arg)) + (let ((kotct/packup-marker-char ?\040)) + (kotct/packup-mark arg interactive))) + +;; TODO (un)mark all (defun kotct/packup-initialize-buffer () "Initializes the packup buffer." (kill-all-local-variables) -;; (use-local-map packup-mode-map) ;; mapppppps + (use-local-map packup-mode-map) ;; mapppppps (setq major-mode 'packup-mode mode-name "Packup" buffer-read-only t ;; read only @@ -31,10 +82,18 @@ Does not automatically refresh package list." (package-refresh-contents) (let ((install-list nil)) (dolist (package kotct/dependency-list) - (let () + (let () ;; TODO: delete me? (if (or (not (package-installed-p package)) (not (kotct/package-up-to-date-p package))) - (apply 'kotct/insert-package-row (cons package (package-desc-version (cadr (assq package package-alist)))))))))) + (apply 'kotct/packup-insert-package-row (cons package (package-desc-version (cadr (assq package package-alist)))))))))) + +(defvar packup-mode-map + (let ((map (make-keymap))) + (define-key map "m" 'kotct/packup-mark) + (define-key map "u" 'kotct/packup-unmark) +;; (define-key map "g" 'kotct/packup-refresh) TODO + + map)) ;;;###autoload (defun kotct/packup () From 8a7ecdf7b1e5b7125f0d5d5c690fd49cfb678adf Mon Sep 17 00:00:00 2001 From: samontea Date: Wed, 2 Aug 2017 20:07:36 -0400 Subject: [PATCH 33/64] change format for packup --- .emacs.d/lisp/package/packup.el | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.emacs.d/lisp/package/packup.el b/.emacs.d/lisp/package/packup.el index c3e1cad..e23da85 100644 --- a/.emacs.d/lisp/package/packup.el +++ b/.emacs.d/lisp/package/packup.el @@ -20,10 +20,10 @@ Does not automatically refresh package list." (every (lambda (x) (package-installed-p package (package-desc-version x))) (cdr (assq package package-archive-contents)))) -(defun kotct/packup-insert-package-row (package-name package-update-date package-desc-version) +(defun kotct/packup-insert-package-row (package-name package-desc-version) "Inserts a package row into current buffer." (let ((inhibit-read-only t)) - (insert (format "[%c] %s %s %s\n" kotct/packup-marker-char package-name package-update-date package-desc-version)))) + (insert (format "[%c] %s -> %s\n" kotct/packup-marker-char package-name package-desc-version)))) (defun kotct/packup-mark-files-in-region (start end) "" ;; TODO @@ -85,7 +85,7 @@ If the region is active, mark all the files in the region." (let () ;; TODO: delete me? (if (or (not (package-installed-p package)) (not (kotct/package-up-to-date-p package))) - (apply 'kotct/packup-insert-package-row (cons package (package-desc-version (cadr (assq package package-alist)))))))))) + (apply 'kotct/packup-insert-package-row (list package (package-desc-version (cadr (assq package package-alist)))))))))) (defvar packup-mode-map (let ((map (make-keymap))) From 8eab72acf7bdd6f53bc389b6ef017cbac590a30c Mon Sep 17 00:00:00 2001 From: samontea Date: Sat, 5 Aug 2017 01:19:24 -0400 Subject: [PATCH 34/64] update documentation, fix typos --- .emacs.d/lisp/package/packup.el | 29 ++++++++++++++++++++--------- 1 file changed, 20 insertions(+), 9 deletions(-) diff --git a/.emacs.d/lisp/package/packup.el b/.emacs.d/lisp/package/packup.el index e23da85..4fe2665 100644 --- a/.emacs.d/lisp/package/packup.el +++ b/.emacs.d/lisp/package/packup.el @@ -25,8 +25,7 @@ Does not automatically refresh package list." (let ((inhibit-read-only t)) (insert (format "[%c] %s -> %s\n" kotct/packup-marker-char package-name package-desc-version)))) -(defun kotct/packup-mark-files-in-region (start end) - "" ;; TODO +(defun kotct/packup-mark-packages-in-region (start end) (let ((inhibit-read-only t)) (if (> start end) (error "start > end")) @@ -39,32 +38,44 @@ Does not automatically refresh package list." (forward-line 1)))) (defun kotct/packup-repeat-over-lines (arg function) + "Helper function for iterating over lines ARG times, and applying FUNCTION on each line." (while (and (> arg 0) (not (eobp))) (setq arg (1- arg)) (beginning-of-line) - (save-excursion (funcall function)))) + (save-excursion (funcall function)) + (forward-line))) + +;; TODO implement me +(defun kotct/packup-do-update () + "" + ) -;; TODO advance the pointer (defun kotct/packup-mark (arg &optional interactive) - "Mark the package at point in the Packup buffer. -If the region is active, mark all the files in the region." + "Mark the package for update at point in the Packup buffer. +If a region is selected, mark all the packages in the region. +If an prefix-arg is passed mark ARG times." (interactive (list current-prefix-arg t)) (cond ((use-region-p) (save-excursion (let ((beg (region-beginning)) (end (region-end))) - (kotct/packup-mark-files-in-region + (kotct/packup-mark-packages-in-region (progn (goto-char beg) (line-beginning-position)) (progn (goto-char end) (line-beginning-position)))))) (t (let ((inhibit-read-only t)) (kotct/packup-repeat-over-lines (prefix-numeric-value arg) - (lambda () (forward-char 1) (delete-char 1) (insert kotct/packup-marker-char))))))) + (lambda () + (forward-char 1) + (delete-char 1) + (insert kotct/packup-marker-char))))))) (defun kotct/packup-unmark (arg &optional interactive) - "" ;; TODO: finish me + "Unmark the package for update at point in the Packup buffer. +If a region is selected, unmark all the packages in the region. +If an prefix-arg is passed unmark ARG times." (interactive (list current-prefix-arg)) (let ((kotct/packup-marker-char ?\040)) (kotct/packup-mark arg interactive))) From 904997ba9fc1d50fe8fea97eb7314055cf67cc27 Mon Sep 17 00:00:00 2001 From: samontea Date: Wed, 9 Aug 2017 00:09:34 -0400 Subject: [PATCH 35/64] implement kotct/packup-{do-update,refresh} --- .emacs.d/lisp/package/packup.el | 96 +++++++++++++++++++++++++++------ 1 file changed, 80 insertions(+), 16 deletions(-) diff --git a/.emacs.d/lisp/package/packup.el b/.emacs.d/lisp/package/packup.el index 4fe2665..b6d48ee 100644 --- a/.emacs.d/lisp/package/packup.el +++ b/.emacs.d/lisp/package/packup.el @@ -45,10 +45,61 @@ Does not automatically refresh package list." (save-excursion (funcall function)) (forward-line))) -;; TODO implement me +(defun kotct/packup-marker-regexp () + (concat "^\\[" (regexp-quote (char-to-string kotct/packup-marker-char)) "\\]")) + +(defmacro kotct/packup-map-over-marks (body) + "Call BODY on each marked line in current buffer." + `(prog1 + (let ((inhibit-read-only t) case-fold-search found results) + (let ((regexp (kotct/packup-marker-regexp)) next-position) + (save-excursion + (goto-char (point-min)) + ;; remember position of next marked package before BODY + ;; can insert lines before the just found package, + ;; confusing us by finding the same marked package again + ;; and again and... + (setq next-position (and (re-search-forward regexp nil t) + (point-marker)) + found (not (null next-position))) + (while next-position + (goto-char next-position) + (setq results (cons ,body results)) + (message "hi") + ;; move after last match + (goto-char next-position) + (forward-line 1) + (set-marker next-position nil) + (setq next-position (and (re-search-forward regexp nil t) + (point-marker)))))) + (if t + results + nil)))) + +(defun kotct/packup-get-package-name () + "Gets package name on current line. +Returns \"\" if there is no package name on the line." + (save-excursion + (beginning-of-line) + (let (p) + (forward-char 4) + (setq p (point-marker)) + (if (re-search-forward " " nil t) + (prog2 + (backward-char) + (buffer-substring p (point-marker)) + ) + "")))) + (defun kotct/packup-do-update () - "" - ) + "Executes update in current buffer." + (interactive) + (let ((inhibit-read-only t)) + (save-excursion + (goto-char (point-min)) + (let ((kotct/dependency-list (kotct/packup-map-over-marks (intern (kotct/packup-get-package-name))))) + (kotct/packup-install-dependencies nil t t)))) + (kotct/packup-refresh)) (defun kotct/packup-mark (arg &optional interactive) "Mark the package for update at point in the Packup buffer. @@ -80,7 +131,15 @@ If an prefix-arg is passed unmark ARG times." (let ((kotct/packup-marker-char ?\040)) (kotct/packup-mark arg interactive))) -;; TODO (un)mark all +;; TODO {,un}mark all + +(defun kotct/packup-initialize-buffer-contents () + (package-refresh-contents) + (let ((install-list nil)) + (dolist (package kotct/dependency-list) + (if (or (not (package-installed-p package)) + (not (kotct/package-up-to-date-p package))) + (apply 'kotct/packup-insert-package-row (list package (package-desc-version (cadr (assq package package-alist))))))))) (defun kotct/packup-initialize-buffer () "Initializes the packup buffer." @@ -90,20 +149,23 @@ If an prefix-arg is passed unmark ARG times." mode-name "Packup" buffer-read-only t ;; read only mode-line-buffer-identification "packup") - (package-refresh-contents) - (let ((install-list nil)) - (dolist (package kotct/dependency-list) - (let () ;; TODO: delete me? - (if (or (not (package-installed-p package)) - (not (kotct/package-up-to-date-p package))) - (apply 'kotct/packup-insert-package-row (list package (package-desc-version (cadr (assq package package-alist)))))))))) + (kotct/packup-initialize-buffer-contents) +) + +(defun kotct/packup-refresh () + "Refreshes packages in current buffer." + (interactive) + (if (eq major-mode 'packup-mode) + (let ((inhibit-read-only t)) + (erase-buffer) + (kotct/packup-initialize-buffer-contents)))) (defvar packup-mode-map (let ((map (make-keymap))) (define-key map "m" 'kotct/packup-mark) (define-key map "u" 'kotct/packup-unmark) -;; (define-key map "g" 'kotct/packup-refresh) TODO - + (define-key map "x" 'kotct/packup-do-update) + (define-key map "g" 'kotct/packup-refresh) map)) ;;;###autoload @@ -117,10 +179,11 @@ If an prefix-arg is passed unmark ARG times." (pop-to-buffer-same-window buffer))) ;;;###autoload -(defun kotct/packup-install-dependencies (no-refresh &optional update) +(defun kotct/packup-install-dependencies (no-refresh &optional update auto-update) "Installs the dependencies. With a non-nil or prefix arg NO-REFRESH, do not refresh package list. -If UPDATE is non-nil, out-of-date packages will be updated." +If UPDATE is non-nil, out-of-date packages will be added to install list. +If AUTO-UPDATE is non-nil, out-of-date/uninstalled packages will be updated." (interactive "P") (unless no-refresh (package-refresh-contents)) @@ -148,7 +211,8 @@ If UPDATE is non-nil, out-of-date packages will be updated." (terpri) (princ (symbol-name (car package))) (princ (if (cdr package) " (update)" " (install)")))) - (if (y-or-n-p "Auto install/update these package?") + (if (or auto-update + (y-or-n-p "Auto install/update these package?")) (progn (package-download-transaction (package-compute-transaction () install-list)) (kill-buffer "*packup: packages to upgrade*") (message "Dependency installation completed.")) From e11881fc65c2d6f1ec2ed3104f03c123865a1df8 Mon Sep 17 00:00:00 2001 From: samontea Date: Mon, 14 Aug 2017 14:49:11 -0400 Subject: [PATCH 36/64] add kotct/packup-{mark-all,unmark-all,help} --- .emacs.d/lisp/package/packup.el | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/.emacs.d/lisp/package/packup.el b/.emacs.d/lisp/package/packup.el index b6d48ee..526dcb6 100644 --- a/.emacs.d/lisp/package/packup.el +++ b/.emacs.d/lisp/package/packup.el @@ -131,7 +131,17 @@ If an prefix-arg is passed unmark ARG times." (let ((kotct/packup-marker-char ?\040)) (kotct/packup-mark arg interactive))) -;; TODO {,un}mark all +(defun kotct/packup-mark-all () + (interactive) + (save-excursion + (kotct/packup-mark-packages-in-region (point-min) (point-max)))) + + +(defun kotct/packup-unmark-all () + (interactive) + (save-excursion + (let ((kotct/packup-marker-char ?\040)) + (kotct/packup-mark-packages-in-region (point-min) (point-max))))) (defun kotct/packup-initialize-buffer-contents () (package-refresh-contents) @@ -149,8 +159,7 @@ If an prefix-arg is passed unmark ARG times." mode-name "Packup" buffer-read-only t ;; read only mode-line-buffer-identification "packup") - (kotct/packup-initialize-buffer-contents) -) + (kotct/packup-initialize-buffer-contents)) (defun kotct/packup-refresh () "Refreshes packages in current buffer." @@ -160,12 +169,19 @@ If an prefix-arg is passed unmark ARG times." (erase-buffer) (kotct/packup-initialize-buffer-contents)))) +(defun kotct/packup-help () + (interactive) + (message "g-refresh m-mark u-unmark x-execute ?-help")) + (defvar packup-mode-map (let ((map (make-keymap))) (define-key map "m" 'kotct/packup-mark) + (define-key map "M" 'kotct/packup-mark-all) (define-key map "u" 'kotct/packup-unmark) + (define-key map "U" 'kotct/packup-unmark-all) (define-key map "x" 'kotct/packup-do-update) (define-key map "g" 'kotct/packup-refresh) + (define-key map "?" 'kotct/packup-help) map)) ;;;###autoload From d79dbc79c8ea43c71b2351ae6f36f937529331e6 Mon Sep 17 00:00:00 2001 From: samontea Date: Thu, 24 Aug 2017 21:44:17 -0400 Subject: [PATCH 37/64] switch kotct/packup to get-buffer-create --- .emacs.d/lisp/package/packup.el | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.emacs.d/lisp/package/packup.el b/.emacs.d/lisp/package/packup.el index 526dcb6..656ab75 100644 --- a/.emacs.d/lisp/package/packup.el +++ b/.emacs.d/lisp/package/packup.el @@ -144,6 +144,8 @@ If an prefix-arg is passed unmark ARG times." (kotct/packup-mark-packages-in-region (point-min) (point-max))))) (defun kotct/packup-initialize-buffer-contents () + (let ((inhibit-read-only t)) + (kill-region (point-min) (point-max))) (package-refresh-contents) (let ((install-list nil)) (dolist (package kotct/dependency-list) @@ -189,7 +191,7 @@ If an prefix-arg is passed unmark ARG times." "Creates an interactive buffer to install/update packages." (interactive) (let ((old-buf (current-buffer)) - (buffer (create-file-buffer "*packup*"))) ;; this is wrong... + (buffer (get-buffer-create "*packup*"))) (set-buffer buffer) (kotct/packup-initialize-buffer) (pop-to-buffer-same-window buffer))) From 37007358fffd64994b588be4f131999ce9d5badc Mon Sep 17 00:00:00 2001 From: samontea Date: Thu, 24 Aug 2017 21:48:06 -0400 Subject: [PATCH 38/64] cleanup :shower: --- .emacs.d/lisp/package/packup.el | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/.emacs.d/lisp/package/packup.el b/.emacs.d/lisp/package/packup.el index 656ab75..14f26e7 100644 --- a/.emacs.d/lisp/package/packup.el +++ b/.emacs.d/lisp/package/packup.el @@ -11,8 +11,7 @@ (defvar kotct/packup-marker-char ?x "In Packup, the current mark character. -This is what the do-commands look for, and the flag the mark-commands store." - ) +This is what the do-commands look for, and the flag the mark-commands store.") (defun kotct/package-up-to-date-p (package) "Returns true if PACKAGE is up-to-date. @@ -65,7 +64,6 @@ Does not automatically refresh package list." (while next-position (goto-char next-position) (setq results (cons ,body results)) - (message "hi") ;; move after last match (goto-char next-position) (forward-line 1) @@ -87,8 +85,7 @@ Returns \"\" if there is no package name on the line." (if (re-search-forward " " nil t) (prog2 (backward-char) - (buffer-substring p (point-marker)) - ) + (buffer-substring p (point-marker))) "")))) (defun kotct/packup-do-update () From ae288cc3219073581d1fffce28ff68b1f2416910 Mon Sep 17 00:00:00 2001 From: samontea Date: Thu, 24 Aug 2017 22:19:50 -0400 Subject: [PATCH 39/64] alert user if no new packages available --- .emacs.d/lisp/package/packup.el | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/.emacs.d/lisp/package/packup.el b/.emacs.d/lisp/package/packup.el index 14f26e7..e2201fc 100644 --- a/.emacs.d/lisp/package/packup.el +++ b/.emacs.d/lisp/package/packup.el @@ -191,7 +191,11 @@ If an prefix-arg is passed unmark ARG times." (buffer (get-buffer-create "*packup*"))) (set-buffer buffer) (kotct/packup-initialize-buffer) - (pop-to-buffer-same-window buffer))) + (if (= (point-min) (point-max)) + (progn + (kill-buffer buffer) + (message "Nothing to update!")) + (pop-to-buffer-same-window buffer)))) ;;;###autoload (defun kotct/packup-install-dependencies (no-refresh &optional update auto-update) From 128126a3df15a341657bb3f5f31cba42abeba5e4 Mon Sep 17 00:00:00 2001 From: samontea Date: Thu, 24 Aug 2017 22:33:47 -0400 Subject: [PATCH 40/64] small cleanup :shower: --- .emacs.d/lisp/package/packup.el | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/.emacs.d/lisp/package/packup.el b/.emacs.d/lisp/package/packup.el index e2201fc..fdeafad 100644 --- a/.emacs.d/lisp/package/packup.el +++ b/.emacs.d/lisp/package/packup.el @@ -79,14 +79,13 @@ Does not automatically refresh package list." Returns \"\" if there is no package name on the line." (save-excursion (beginning-of-line) - (let (p) - (forward-char 4) - (setq p (point-marker)) - (if (re-search-forward " " nil t) - (prog2 - (backward-char) - (buffer-substring p (point-marker))) - "")))) + (forward-char 4) + (let ((point (point-marker))) + (if (re-search-forward " " nil t) + (prog2 + (backward-char) + (buffer-substring point (point-marker))) + "")))) (defun kotct/packup-do-update () "Executes update in current buffer." From adab27088fcf400a6a3115364d61fc3ed2df4ded Mon Sep 17 00:00:00 2001 From: samontea Date: Sun, 27 Aug 2017 11:19:55 -0400 Subject: [PATCH 41/64] remove buffer identification --- .emacs.d/lisp/package/packup.el | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/.emacs.d/lisp/package/packup.el b/.emacs.d/lisp/package/packup.el index fdeafad..ff96605 100644 --- a/.emacs.d/lisp/package/packup.el +++ b/.emacs.d/lisp/package/packup.el @@ -152,11 +152,10 @@ If an prefix-arg is passed unmark ARG times." (defun kotct/packup-initialize-buffer () "Initializes the packup buffer." (kill-all-local-variables) - (use-local-map packup-mode-map) ;; mapppppps + (use-local-map packup-mode-map) (setq major-mode 'packup-mode mode-name "Packup" - buffer-read-only t ;; read only - mode-line-buffer-identification "packup") + buffer-read-only t) (kotct/packup-initialize-buffer-contents)) (defun kotct/packup-refresh () From 1ce63c11754e7096b052a99688a17308f2e75091 Mon Sep 17 00:00:00 2001 From: Kristofer Rye Date: Tue, 29 Aug 2017 16:43:45 -0500 Subject: [PATCH 42/64] Add autoload comment at top of packup.el This is in accordance with our code style. --- .emacs.d/lisp/package/packup.el | 1 + 1 file changed, 1 insertion(+) diff --git a/.emacs.d/lisp/package/packup.el b/.emacs.d/lisp/package/packup.el index ff96605..72af96f 100644 --- a/.emacs.d/lisp/package/packup.el +++ b/.emacs.d/lisp/package/packup.el @@ -1,5 +1,6 @@ ;;; THIS FILE IS NOT LOADED AT STARTUP. ;;; This file is autoloaded on the following symbols: +;;; kotct/packup ;;; kotct/packup-install-dependencies ;;; kotct/packup-update From 4e018070966ba313280163ac5f1e36b5e4fea010 Mon Sep 17 00:00:00 2001 From: Kristofer Rye Date: Tue, 29 Aug 2017 16:44:01 -0500 Subject: [PATCH 43/64] Fix English used in auto install/update process --- .emacs.d/lisp/package/packup.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.emacs.d/lisp/package/packup.el b/.emacs.d/lisp/package/packup.el index 72af96f..4239dc5 100644 --- a/.emacs.d/lisp/package/packup.el +++ b/.emacs.d/lisp/package/packup.el @@ -230,7 +230,7 @@ If AUTO-UPDATE is non-nil, out-of-date/uninstalled packages will be updated." (princ (symbol-name (car package))) (princ (if (cdr package) " (update)" " (install)")))) (if (or auto-update - (y-or-n-p "Auto install/update these package?")) + (y-or-n-p "Auto install/update these package(s)?")) (progn (package-download-transaction (package-compute-transaction () install-list)) (kill-buffer "*packup: packages to upgrade*") (message "Dependency installation completed.")) From 2a6fb7e925122c1939ebc1328051ed3ce70bc250 Mon Sep 17 00:00:00 2001 From: Christopher Cooper Date: Tue, 3 Jul 2018 20:38:01 -0400 Subject: [PATCH 44/64] enable some minor modes for tex-mode, with tests --- .emacs.d/.gitignore | 1 + .emacs.d/lisp/code/languages/language-hub.el | 3 +- .emacs.d/lisp/code/languages/tex.el | 6 +++ .emacs.d/test/lisp/code/languages/tex-test.el | 39 +++++++++++++++++++ 4 files changed, 48 insertions(+), 1 deletion(-) create mode 100644 .emacs.d/lisp/code/languages/tex.el create mode 100644 .emacs.d/test/lisp/code/languages/tex-test.el diff --git a/.emacs.d/.gitignore b/.emacs.d/.gitignore index 9fb1397..4214041 100644 --- a/.emacs.d/.gitignore +++ b/.emacs.d/.gitignore @@ -17,6 +17,7 @@ network-security.data session.* recentf custom.el +eshell/ # packages elpa/ diff --git a/.emacs.d/lisp/code/languages/language-hub.el b/.emacs.d/lisp/code/languages/language-hub.el index 6dca9ff..3e1df69 100644 --- a/.emacs.d/lisp/code/languages/language-hub.el +++ b/.emacs.d/lisp/code/languages/language-hub.el @@ -8,7 +8,8 @@ java sh web-c - go) + go + tex) "A list of packages configured by the language-hub.") (let ((to-compile ())) diff --git a/.emacs.d/lisp/code/languages/tex.el b/.emacs.d/lisp/code/languages/tex.el new file mode 100644 index 0000000..29e08b8 --- /dev/null +++ b/.emacs.d/lisp/code/languages/tex.el @@ -0,0 +1,6 @@ +(add-hook 'tex-mode-hook (lambda () + (visual-line-mode +1) + (if (executable-find ispell-program-name) + (flyspell-mode +1)))) + +(provide 'tex) diff --git a/.emacs.d/test/lisp/code/languages/tex-test.el b/.emacs.d/test/lisp/code/languages/tex-test.el new file mode 100644 index 0000000..6c1e43e --- /dev/null +++ b/.emacs.d/test/lisp/code/languages/tex-test.el @@ -0,0 +1,39 @@ +(add-to-list 'load-path (concat (file-name-directory load-file-name) "../../../../lisp/code/")) + +(kotct/load-corresponding) + +(describe "tex config" + (describe "mode hook" + :var (test-buffer) + + (before-each + (setf test-buffer (generate-new-buffer "*kotct/test-buffer*")) + (set-buffer test-buffer)) + + (after-each + (kill-buffer test-buffer)) + + (it "enables visual-line-mode" + (tex-mode) + (expect visual-line-mode :to-be-truthy)) + + (describe "flyspell-mode" + (spy-on #'executable-find :and-call-fake + (lambda (command) + (string= command "findme"))) + + ;; we need this noop because the real flyspell-mode-on will + ;; try to start ispell-program name (which of course won't work) + (spy-on #'flyspell-mode-on :and-call-fake (lambda ())) + + (it "is enabled when ispell-program-name can be found" + (let ((ispell-program-name "findme")) + (tex-mode) + (expect flyspell-mode :to-be-truthy) + (expect #'executable-find :to-have-been-called))) + + (it "is not enabled when ispell-program-name cannot be found" + (let ((ispell-program-name "DONTfindme")) + (tex-mode) + (expect flyspell-mode :not :to-be-truthy) + (expect #'executable-find :to-have-been-called)))))) From e350c6d0c62d0367dafc607ac3bb84848c3a7446 Mon Sep 17 00:00:00 2001 From: Christopher Cooper Date: Tue, 3 Jul 2018 21:12:33 -0400 Subject: [PATCH 45/64] fix some bugs causing tests to fail in weird circumstances --- .emacs.d/lisp/code/languages/tex.el | 1 + .emacs.d/lisp/file/file-content.el | 2 +- .emacs.d/test/lisp/code/languages/tex-test.el | 6 +++++- .emacs.d/test/lisp/file/file-content-test.el | 3 ++- 4 files changed, 9 insertions(+), 3 deletions(-) diff --git a/.emacs.d/lisp/code/languages/tex.el b/.emacs.d/lisp/code/languages/tex.el index 29e08b8..f8337bb 100644 --- a/.emacs.d/lisp/code/languages/tex.el +++ b/.emacs.d/lisp/code/languages/tex.el @@ -1,5 +1,6 @@ (add-hook 'tex-mode-hook (lambda () (visual-line-mode +1) + (require 'ispell) (if (executable-find ispell-program-name) (flyspell-mode +1)))) diff --git a/.emacs.d/lisp/file/file-content.el b/.emacs.d/lisp/file/file-content.el index 3f00b36..1f90960 100644 --- a/.emacs.d/lisp/file/file-content.el +++ b/.emacs.d/lisp/file/file-content.el @@ -1,6 +1,6 @@ ;; make sure files always have a LF at EOF when saving ;; if you don't want this for a particular file, do ;; M-x set-variable RET require-final-newline RET nil RET -(setf require-final-newline t) +(setq-default require-final-newline t) (provide 'file-content) diff --git a/.emacs.d/test/lisp/code/languages/tex-test.el b/.emacs.d/test/lisp/code/languages/tex-test.el index 6c1e43e..005e612 100644 --- a/.emacs.d/test/lisp/code/languages/tex-test.el +++ b/.emacs.d/test/lisp/code/languages/tex-test.el @@ -1,5 +1,9 @@ (add-to-list 'load-path (concat (file-name-directory load-file-name) "../../../../lisp/code/")) +;; we have to require flyspell since the spy on flyspell-mode-on has to +;; override the actual function, not the other way around +(require 'flyspell) + (kotct/load-corresponding) (describe "tex config" @@ -7,7 +11,7 @@ :var (test-buffer) (before-each - (setf test-buffer (generate-new-buffer "*kotct/test-buffer*")) + (setf test-buffer (generate-new-buffer "*kotct/tex-test-buffer*")) (set-buffer test-buffer)) (after-each diff --git a/.emacs.d/test/lisp/file/file-content-test.el b/.emacs.d/test/lisp/file/file-content-test.el index 8164e7e..b6287ea 100644 --- a/.emacs.d/test/lisp/file/file-content-test.el +++ b/.emacs.d/test/lisp/file/file-content-test.el @@ -2,4 +2,5 @@ (describe "file content config" (it "should require newlines at EOF" - (expect require-final-newline :to-equal t))) + (expect require-final-newline :to-equal t) + (expect (default-value 'require-final-newline) :to-equal t))) From 19b53aeb433a325e9536bd465723302108730d61 Mon Sep 17 00:00:00 2001 From: Christopher Cooper Date: Thu, 5 Jul 2018 15:11:02 -0400 Subject: [PATCH 46/64] update repositories to https and use melpa.org --- .emacs.d/lisp/package/repositories.el | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.emacs.d/lisp/package/repositories.el b/.emacs.d/lisp/package/repositories.el index 28f46e8..ba4bf75 100644 --- a/.emacs.d/lisp/package/repositories.el +++ b/.emacs.d/lisp/package/repositories.el @@ -8,12 +8,12 @@ ;; Add GNU ELPA repository (add-to-list 'package-archives '("gnu" . - "http://elpa.gnu.org/packages/")) + "https://elpa.gnu.org/packages/")) ;; Add MELPA repository (add-to-list 'package-archives '("melpa" . - "http://melpa.milkbox.net/packages/")) + "https://melpa.org/packages/")) (setf package-archive-priorities '(("melpa-stable" . 20) From 809f27e866786814ee7a4fcdcf0e94ee5ec2a22e Mon Sep 17 00:00:00 2001 From: Christopher Cooper Date: Fri, 6 Jul 2018 11:39:39 -0400 Subject: [PATCH 47/64] add ability to run pre-load config --- .emacs.d/init.el | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.emacs.d/init.el b/.emacs.d/init.el index 1ab225c..dcb3c57 100644 --- a/.emacs.d/init.el +++ b/.emacs.d/init.el @@ -1,5 +1,8 @@ ;;; dot/.emacs +;; load any absolute must-have code +(load "~/.emacs-emergency" 'noerror 'nomessage 'nosuffix) + ;; Initialize the package repository. (package-initialize) From 45a01a984e3364387543e8c0820f2da12731df17 Mon Sep 17 00:00:00 2001 From: Christopher Cooper Date: Fri, 6 Jul 2018 21:30:18 -0400 Subject: [PATCH 48/64] clean up elisp in packup.el --- .emacs.d/lisp/package/packup.el | 123 ++++++++++++++++---------------- 1 file changed, 61 insertions(+), 62 deletions(-) diff --git a/.emacs.d/lisp/package/packup.el b/.emacs.d/lisp/package/packup.el index 4239dc5..ee088b4 100644 --- a/.emacs.d/lisp/package/packup.el +++ b/.emacs.d/lisp/package/packup.el @@ -29,18 +29,18 @@ Does not automatically refresh package list." (let ((inhibit-read-only t)) (if (> start end) (error "start > end")) - (goto-char start) ; assumed at beginning of line + ;; assume we are at beginning of line + (goto-char start) (while (< (point) end) (forward-char 1) - (progn - (delete-char 1) - (insert kotct/packup-marker-char)) + (delete-char 1) + (insert kotct/packup-marker-char) (forward-line 1)))) (defun kotct/packup-repeat-over-lines (arg function) "Helper function for iterating over lines ARG times, and applying FUNCTION on each line." (while (and (> arg 0) (not (eobp))) - (setq arg (1- arg)) + (setf arg (1- arg)) (beginning-of-line) (save-excursion (funcall function)) (forward-line))) @@ -50,43 +50,40 @@ Does not automatically refresh package list." (defmacro kotct/packup-map-over-marks (body) "Call BODY on each marked line in current buffer." - `(prog1 - (let ((inhibit-read-only t) case-fold-search found results) - (let ((regexp (kotct/packup-marker-regexp)) next-position) - (save-excursion - (goto-char (point-min)) - ;; remember position of next marked package before BODY - ;; can insert lines before the just found package, - ;; confusing us by finding the same marked package again - ;; and again and... - (setq next-position (and (re-search-forward regexp nil t) - (point-marker)) - found (not (null next-position))) - (while next-position - (goto-char next-position) - (setq results (cons ,body results)) - ;; move after last match - (goto-char next-position) - (forward-line 1) - (set-marker next-position nil) - (setq next-position (and (re-search-forward regexp nil t) - (point-marker)))))) - (if t - results - nil)))) + `(let ((inhibit-read-only t) + (regexp (kotct/packup-marker-regexp)) + case-fold-search next-position results) + (save-excursion + (goto-char (point-min)) + ;; remember position of next marked package before BODY + ;; can insert lines before the just found package, + ;; confusing us by finding the same marked package again + ;; and again and... + (setf next-position (and (re-search-forward regexp nil t) + (point-marker))) + (while next-position + (goto-char next-position) + (setf results (cons ,body results)) + ;; move after last match + (goto-char next-position) + (forward-line 1) + (set-marker next-position nil) + (setf next-position (and (re-search-forward regexp nil t) + (point-marker))))) + results)) (defun kotct/packup-get-package-name () - "Gets package name on current line. + "Gets package name on current line. Returns \"\" if there is no package name on the line." - (save-excursion - (beginning-of-line) - (forward-char 4) - (let ((point (point-marker))) - (if (re-search-forward " " nil t) - (prog2 - (backward-char) - (buffer-substring point (point-marker))) - "")))) + (save-excursion + (beginning-of-line) + (forward-char 4) + (let ((point (point-marker))) + (if (re-search-forward " " nil t) + (progn + (backward-char) + (buffer-substring point (point-marker))) + "")))) (defun kotct/packup-do-update () "Executes update in current buffer." @@ -95,7 +92,7 @@ Returns \"\" if there is no package name on the line." (save-excursion (goto-char (point-min)) (let ((kotct/dependency-list (kotct/packup-map-over-marks (intern (kotct/packup-get-package-name))))) - (kotct/packup-install-dependencies nil t t)))) + (kotct/packup-install-dependencies nil 'update 'auto-update)))) (kotct/packup-refresh)) (defun kotct/packup-mark (arg &optional interactive) @@ -135,10 +132,10 @@ If an prefix-arg is passed unmark ARG times." (defun kotct/packup-unmark-all () - (interactive) - (save-excursion - (let ((kotct/packup-marker-char ?\040)) - (kotct/packup-mark-packages-in-region (point-min) (point-max))))) + (interactive) + (save-excursion + (let ((kotct/packup-marker-char ?\040)) + (kotct/packup-mark-packages-in-region (point-min) (point-max))))) (defun kotct/packup-initialize-buffer-contents () (let ((inhibit-read-only t)) @@ -146,15 +143,15 @@ If an prefix-arg is passed unmark ARG times." (package-refresh-contents) (let ((install-list nil)) (dolist (package kotct/dependency-list) - (if (or (not (package-installed-p package)) - (not (kotct/package-up-to-date-p package))) - (apply 'kotct/packup-insert-package-row (list package (package-desc-version (cadr (assq package package-alist))))))))) + (when (or (not (package-installed-p package)) + (not (kotct/package-up-to-date-p package))) + (apply #'kotct/packup-insert-package-row (list package (package-desc-version (cadr (assq package package-alist))))))))) (defun kotct/packup-initialize-buffer () "Initializes the packup buffer." (kill-all-local-variables) (use-local-map packup-mode-map) - (setq major-mode 'packup-mode + (setf major-mode 'packup-mode mode-name "Packup" buffer-read-only t) (kotct/packup-initialize-buffer-contents)) @@ -162,24 +159,24 @@ If an prefix-arg is passed unmark ARG times." (defun kotct/packup-refresh () "Refreshes packages in current buffer." (interactive) - (if (eq major-mode 'packup-mode) + (when (eq major-mode 'packup-mode) (let ((inhibit-read-only t)) - (erase-buffer) - (kotct/packup-initialize-buffer-contents)))) + (erase-buffer)) + (kotct/packup-initialize-buffer-contents))) (defun kotct/packup-help () (interactive) (message "g-refresh m-mark u-unmark x-execute ?-help")) (defvar packup-mode-map - (let ((map (make-keymap))) - (define-key map "m" 'kotct/packup-mark) - (define-key map "M" 'kotct/packup-mark-all) - (define-key map "u" 'kotct/packup-unmark) - (define-key map "U" 'kotct/packup-unmark-all) - (define-key map "x" 'kotct/packup-do-update) - (define-key map "g" 'kotct/packup-refresh) - (define-key map "?" 'kotct/packup-help) + (let ((map (make-sparse-keymap))) + (define-key map "m" #'kotct/packup-mark) + (define-key map "M" #'kotct/packup-mark-all) + (define-key map "u" #'kotct/packup-unmark) + (define-key map "U" #'kotct/packup-unmark-all) + (define-key map "x" #'kotct/packup-do-update) + (define-key map "g" #'kotct/packup-refresh) + (define-key map "?" #'kotct/packup-help) map)) ;;;###autoload @@ -192,8 +189,8 @@ If an prefix-arg is passed unmark ARG times." (kotct/packup-initialize-buffer) (if (= (point-min) (point-max)) (progn - (kill-buffer buffer) - (message "Nothing to update!")) + (kill-buffer buffer) + (message "Nothing to update!")) (pop-to-buffer-same-window buffer)))) ;;;###autoload @@ -206,7 +203,9 @@ If AUTO-UPDATE is non-nil, out-of-date/uninstalled packages will be updated." (unless no-refresh (package-refresh-contents)) - (let ((install-list nil)) + ;; install-list is a list of cons cells + ;; the car of each is a package-desc, the cdr is the currently installed package-desc + (let (install-list) (dolist (package kotct/dependency-list) (let ((updating nil)) From 77a989fc3495df7515d8f98523aad448f00f9ebc Mon Sep 17 00:00:00 2001 From: Christopher Cooper Date: Fri, 6 Jul 2018 21:32:14 -0400 Subject: [PATCH 49/64] make sure we prefer packages from melpa-stable, even in emacs 24 --- .emacs.d/lisp/package/packup.el | 89 +++++++++++++++++++-------- .emacs.d/lisp/package/repositories.el | 19 ++++-- 2 files changed, 77 insertions(+), 31 deletions(-) diff --git a/.emacs.d/lisp/package/packup.el b/.emacs.d/lisp/package/packup.el index ee088b4..1cfda83 100644 --- a/.emacs.d/lisp/package/packup.el +++ b/.emacs.d/lisp/package/packup.el @@ -14,11 +14,32 @@ "In Packup, the current mark character. This is what the do-commands look for, and the flag the mark-commands store.") +(defun kotct/package-latest-available (package) + "Get the lastest-available package-desc for PACKAGE, preferring repositories +as listed in `package-archive-priorities' or `kotct/package-ordered-archives'. +Does not automatically refresh the package list." + (if (version< emacs-version "25.1") + ;; no package-archive-priorities, so use kotct/package-ordered-archives + (let ((versions (cdr (assoc package package-archive-contents))) + found-desc) + (dolist (archive kotct/package-ordered-archives) + (when (not found-desc) + ;; no match yet, keep looking + (setf found-desc (car (cl-member archive versions + :key #'package-desc-archive + :test #'string=))))) + found-desc) + ;; package-archive-priorities means we only have to check + ;; the first package-desc, because that should be from the best repo + (cadr (assoc package package-archive-contents)))) + (defun kotct/package-up-to-date-p (package) - "Returns true if PACKAGE is up-to-date. -Does not automatically refresh package list." - (every (lambda (x) (package-installed-p package (package-desc-version x))) - (cdr (assq package package-archive-contents)))) + "Returns T if PACKAGE is installed and up-to-date. +Does not automatically refresh package list. +Before emacs 25, we have to manually check in preferred-repository order." + (let ((latest (kotct/package-latest-available package))) + (when latest + (package-installed-p package (package-desc-version latest))))) (defun kotct/packup-insert-package-row (package-name package-desc-version) "Inserts a package row into current buffer." @@ -143,9 +164,9 @@ If an prefix-arg is passed unmark ARG times." (package-refresh-contents) (let ((install-list nil)) (dolist (package kotct/dependency-list) - (when (or (not (package-installed-p package)) - (not (kotct/package-up-to-date-p package))) - (apply #'kotct/packup-insert-package-row (list package (package-desc-version (cadr (assq package package-alist))))))))) + (when (not (kotct/package-up-to-date-p package)) + (apply #'kotct/packup-insert-package-row (list package (package-desc-version (kotct/package-latest-available package)))))))) + (defun kotct/packup-initialize-buffer () "Initializes the packup buffer." @@ -208,38 +229,52 @@ If AUTO-UPDATE is non-nil, out-of-date/uninstalled packages will be updated." (let (install-list) (dolist (package kotct/dependency-list) - (let ((updating nil)) - (if (or (not (package-installed-p package)) - (and update (not (kotct/package-up-to-date-p package)) (setf updating t))) - (add-to-list 'install-list - (cons package - ;; haxily say we need the next version by adding a .1 to the version - ;; ie if we have version 2.3.0 ask for 2.3.0.1 - (if updating - (list (append (package-desc-version (cadr (assq package package-alist))) - '(1))))))))) + (if (or (not (package-installed-p package)) + (and update (not (kotct/package-up-to-date-p package)))) + (add-to-list 'install-list + (cons (kotct/package-latest-available package) + (cadr (assoc package package-alist)))))) (if install-list (progn (with-output-to-temp-buffer "*packup: packages to upgrade*" (princ "Packages to be installed:") - (dolist (package install-list) - (message (symbol-name (car package))) + (dolist (package-cons install-list) + (message (symbol-name (package-desc-name (car package-cons)))) (terpri) - (princ (symbol-name (car package))) - (princ (if (cdr package) " (update)" " (install)")))) + (princ (symbol-name (package-desc-name (car package-cons)))) + (princ (if (cdr package-cons) + (format " (update %s -> %s)" + (package-version-join (package-desc-version (cdr package-cons))) + (package-version-join (package-desc-version (car package-cons)))) + (format " (install %s)" + (package-version-join (package-desc-version (car package-cons)))))))) (if (or auto-update (y-or-n-p "Auto install/update these package(s)?")) - (progn (package-download-transaction (package-compute-transaction () install-list)) + (progn (package-download-transaction + (package-compute-transaction + () (mapcar (lambda (package-cons) + (list (package-desc-name (car package-cons)) + (package-desc-version (car package-cons)))) + install-list))) (kill-buffer "*packup: packages to upgrade*") (message "Dependency installation completed.")) (let ((manual-install-list nil)) - (dolist (package install-list) + (dolist (package-cons install-list) (if (y-or-n-p (format "Package %s is %s. Install it? " - (car package) - (if (cdr package) "out of date" "missing"))) - (add-to-list 'manual-install-list package))) - (progn (package-download-transaction (package-compute-transaction () manual-install-list)) + (package-desc-name (car package-cons)) + (if (cdr package-cons) + (format "out of date (%s -> %s)" + (package-version-join (package-desc-version (cdr package-cons))) + (package-version-join (package-desc-version (car package-cons)))) + "missing"))) + (add-to-list 'manual-install-list package-cons))) + (progn (package-download-transaction + (package-compute-transaction + () (mapcar (lambda (package-cons) + (list (package-desc-name (car package-cons)) + (package-desc-version (car package-cons)))) + manual-install-list) )) (kill-buffer "*packup: packages to upgrade*") (message "Dependency installation completed."))))) diff --git a/.emacs.d/lisp/package/repositories.el b/.emacs.d/lisp/package/repositories.el index ba4bf75..29b15d0 100644 --- a/.emacs.d/lisp/package/repositories.el +++ b/.emacs.d/lisp/package/repositories.el @@ -15,10 +15,21 @@ '("melpa" . "https://melpa.org/packages/")) -(setf package-archive-priorities - '(("melpa-stable" . 20) - ("gnu" . 10) - ("melpa" . 0))) +(if (version< emacs-version "25.1") + (defvar kotct/package-ordered-archives + '("melpa-stable" + "gnu" + "melpa") + "Define the preferred order of package repositories. +If a repository is earlier in the list, it is preferred over +a repository that is later in the list. + +This variable is succeeded by `package-archive-priorities' +in emacs 25 and later.") + (setf package-archive-priorities + '(("melpa-stable" . 20) + ("gnu" . 10) + ("melpa" . 0)))) ;; (require 'packup) From c52652dfe5a2b2409285b12dd4b36dab1fde2098 Mon Sep 17 00:00:00 2001 From: Christopher Cooper Date: Fri, 6 Jul 2018 21:51:53 -0400 Subject: [PATCH 50/64] hack emacs 24 package.el by let-binding package-archive-contents --- .emacs.d/lisp/package/packup.el | 42 +++++++++++++++++++++++++-------- 1 file changed, 32 insertions(+), 10 deletions(-) diff --git a/.emacs.d/lisp/package/packup.el b/.emacs.d/lisp/package/packup.el index 1cfda83..7068e4b 100644 --- a/.emacs.d/lisp/package/packup.el +++ b/.emacs.d/lisp/package/packup.el @@ -14,6 +14,26 @@ "In Packup, the current mark character. This is what the do-commands look for, and the flag the mark-commands store.") +(defmacro kotct/with-stable-package-archive-contents (body) + "Run BODY, but if we don't have emacs 25 or later, let-bind +a modified `package-archive-contents' that only includes the package-desc +from the most-preferred repository" + (message "%s" emacs-version) + (if (version< emacs-version "25.1") + `(let ((package-archive-contents + (mapcar (lambda (pkg) + (let (desc) + (dolist (archive kotct/package-ordered-archives) + (when (not desc) + ;; no match yet, keep looking + (setf desc (car (cl-member archive (cdr pkg) + :key #'package-desc-archive + :test #'string=))))) + (list (car pkg) desc))) + package-archive-contents))) + ,body) + `(progn ,body))) + (defun kotct/package-latest-available (package) "Get the lastest-available package-desc for PACKAGE, preferring repositories as listed in `package-archive-priorities' or `kotct/package-ordered-archives'. @@ -252,11 +272,12 @@ If AUTO-UPDATE is non-nil, out-of-date/uninstalled packages will be updated." (if (or auto-update (y-or-n-p "Auto install/update these package(s)?")) (progn (package-download-transaction - (package-compute-transaction - () (mapcar (lambda (package-cons) - (list (package-desc-name (car package-cons)) - (package-desc-version (car package-cons)))) - install-list))) + (kotct/with-stable-package-archive-contents + (package-compute-transaction + () (mapcar (lambda (package-cons) + (list (package-desc-name (car package-cons)) + (package-desc-version (car package-cons)))) + install-list)))) (kill-buffer "*packup: packages to upgrade*") (message "Dependency installation completed.")) (let ((manual-install-list nil)) @@ -270,11 +291,12 @@ If AUTO-UPDATE is non-nil, out-of-date/uninstalled packages will be updated." "missing"))) (add-to-list 'manual-install-list package-cons))) (progn (package-download-transaction - (package-compute-transaction - () (mapcar (lambda (package-cons) - (list (package-desc-name (car package-cons)) - (package-desc-version (car package-cons)))) - manual-install-list) )) + (kotct/with-stable-package-archive-contents + (package-compute-transaction + () (mapcar (lambda (package-cons) + (list (package-desc-name (car package-cons)) + (package-desc-version (car package-cons)))) + manual-install-list)))) (kill-buffer "*packup: packages to upgrade*") (message "Dependency installation completed."))))) From 80b216136c4d77ec10f8a66f8e1d0f39cd7eebf0 Mon Sep 17 00:00:00 2001 From: Christopher Cooper Date: Fri, 6 Jul 2018 21:53:07 -0400 Subject: [PATCH 51/64] update old updater manual prompt --- .emacs.d/lisp/package/packup.el | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.emacs.d/lisp/package/packup.el b/.emacs.d/lisp/package/packup.el index 7068e4b..dd615ad 100644 --- a/.emacs.d/lisp/package/packup.el +++ b/.emacs.d/lisp/package/packup.el @@ -282,13 +282,13 @@ If AUTO-UPDATE is non-nil, out-of-date/uninstalled packages will be updated." (message "Dependency installation completed.")) (let ((manual-install-list nil)) (dolist (package-cons install-list) - (if (y-or-n-p (format "Package %s is %s. Install it? " + (if (y-or-n-p (format "Package %s is %s. Install %s? " (package-desc-name (car package-cons)) (if (cdr package-cons) - (format "out of date (%s -> %s)" - (package-version-join (package-desc-version (cdr package-cons))) - (package-version-join (package-desc-version (car package-cons)))) - "missing"))) + (format "out of date (%s)" + (package-version-join (package-desc-version (cdr package-cons)))) + "missing") + (package-version-join (package-desc-version (car package-cons))))) (add-to-list 'manual-install-list package-cons))) (progn (package-download-transaction (kotct/with-stable-package-archive-contents From 4b56f794d85c0d044fa61febf7aea6aeb6688a31 Mon Sep 17 00:00:00 2001 From: Christopher Cooper Date: Fri, 6 Jul 2018 22:02:08 -0400 Subject: [PATCH 52/64] resolve compilation warnings --- .emacs.d/lisp/package/packup.el | 20 ++++++++++---------- .emacs.d/lisp/package/repositories.el | 18 ++++++++---------- 2 files changed, 18 insertions(+), 20 deletions(-) diff --git a/.emacs.d/lisp/package/packup.el b/.emacs.d/lisp/package/packup.el index dd615ad..df1a293 100644 --- a/.emacs.d/lisp/package/packup.el +++ b/.emacs.d/lisp/package/packup.el @@ -187,16 +187,6 @@ If an prefix-arg is passed unmark ARG times." (when (not (kotct/package-up-to-date-p package)) (apply #'kotct/packup-insert-package-row (list package (package-desc-version (kotct/package-latest-available package)))))))) - -(defun kotct/packup-initialize-buffer () - "Initializes the packup buffer." - (kill-all-local-variables) - (use-local-map packup-mode-map) - (setf major-mode 'packup-mode - mode-name "Packup" - buffer-read-only t) - (kotct/packup-initialize-buffer-contents)) - (defun kotct/packup-refresh () "Refreshes packages in current buffer." (interactive) @@ -220,6 +210,16 @@ If an prefix-arg is passed unmark ARG times." (define-key map "?" #'kotct/packup-help) map)) +(defun kotct/packup-initialize-buffer () + "Initializes the packup buffer." + (kill-all-local-variables) + (use-local-map packup-mode-map) + (setf major-mode 'packup-mode + mode-name "Packup" + buffer-read-only t) + (kotct/packup-initialize-buffer-contents)) + + ;;;###autoload (defun kotct/packup () "Creates an interactive buffer to install/update packages." diff --git a/.emacs.d/lisp/package/repositories.el b/.emacs.d/lisp/package/repositories.el index 29b15d0..a303de2 100644 --- a/.emacs.d/lisp/package/repositories.el +++ b/.emacs.d/lisp/package/repositories.el @@ -15,22 +15,20 @@ '("melpa" . "https://melpa.org/packages/")) -(if (version< emacs-version "25.1") - (defvar kotct/package-ordered-archives - '("melpa-stable" - "gnu" - "melpa") - "Define the preferred order of package repositories. +(defvar kotct/package-ordered-archives + '("melpa-stable" + "gnu" + "melpa") + "Define the preferred order of package repositories. If a repository is earlier in the list, it is preferred over a repository that is later in the list. -This variable is succeeded by `package-archive-priorities' -in emacs 25 and later.") +This variable is succeeded by `package-archive-priorities' in emacs 25 and later.") + +(when (version<= "25.1" emacs-version) (setf package-archive-priorities '(("melpa-stable" . 20) ("gnu" . 10) ("melpa" . 0)))) -;; (require 'packup) - (provide 'repositories) From 9d23d34eac420163e856c4c0efd3a2bfa5841995 Mon Sep 17 00:00:00 2001 From: Christopher Cooper Date: Fri, 6 Jul 2018 22:10:40 -0400 Subject: [PATCH 53/64] add missing docstrings to packup.el --- .emacs.d/lisp/package/packup.el | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/.emacs.d/lisp/package/packup.el b/.emacs.d/lisp/package/packup.el index df1a293..87c56bd 100644 --- a/.emacs.d/lisp/package/packup.el +++ b/.emacs.d/lisp/package/packup.el @@ -67,6 +67,8 @@ Before emacs 25, we have to manually check in preferred-repository order." (insert (format "[%c] %s -> %s\n" kotct/packup-marker-char package-name package-desc-version)))) (defun kotct/packup-mark-packages-in-region (start end) + "Mark all packages in the current packup buffer that are between +START and END. START should be at the beginning of a line." (let ((inhibit-read-only t)) (if (> start end) (error "start > end")) @@ -87,6 +89,8 @@ Before emacs 25, we have to manually check in preferred-repository order." (forward-line))) (defun kotct/packup-marker-regexp () + "Return a regexp to search for `kotct/packup-marker-char' surrounded by quotes, +as in '[x]'." (concat "^\\[" (regexp-quote (char-to-string kotct/packup-marker-char)) "\\]")) (defmacro kotct/packup-map-over-marks (body) @@ -114,7 +118,7 @@ Before emacs 25, we have to manually check in preferred-repository order." results)) (defun kotct/packup-get-package-name () - "Gets package name on current line. + "Get package name on current line. Returns \"\" if there is no package name on the line." (save-excursion (beginning-of-line) @@ -127,7 +131,7 @@ Returns \"\" if there is no package name on the line." "")))) (defun kotct/packup-do-update () - "Executes update in current buffer." + "Execute update in current buffer." (interactive) (let ((inhibit-read-only t)) (save-excursion @@ -167,18 +171,25 @@ If an prefix-arg is passed unmark ARG times." (kotct/packup-mark arg interactive))) (defun kotct/packup-mark-all () + "Mark all packages in the current packup buffer." (interactive) (save-excursion (kotct/packup-mark-packages-in-region (point-min) (point-max)))) (defun kotct/packup-unmark-all () + "Unmark all packages in the current packup buffer." (interactive) (save-excursion (let ((kotct/packup-marker-char ?\040)) (kotct/packup-mark-packages-in-region (point-min) (point-max))))) (defun kotct/packup-initialize-buffer-contents () + "Initialize contents of the current packup buffer. + +This refreshes `package-archive-contents' and finds all packages that need +updating or installing. It then uses this information to write the +contents of the buffer." (let ((inhibit-read-only t)) (kill-region (point-min) (point-max))) (package-refresh-contents) @@ -196,6 +207,7 @@ If an prefix-arg is passed unmark ARG times." (kotct/packup-initialize-buffer-contents))) (defun kotct/packup-help () + "Show packup help." (interactive) (message "g-refresh m-mark u-unmark x-execute ?-help")) @@ -208,7 +220,8 @@ If an prefix-arg is passed unmark ARG times." (define-key map "x" #'kotct/packup-do-update) (define-key map "g" #'kotct/packup-refresh) (define-key map "?" #'kotct/packup-help) - map)) + map) + "The keymap for packup-mode.") (defun kotct/packup-initialize-buffer () "Initializes the packup buffer." From a1ea74f8981ebc9a629b88f2e5be77c73b7609f6 Mon Sep 17 00:00:00 2001 From: Christopher Cooper Date: Fri, 6 Jul 2018 22:27:19 -0400 Subject: [PATCH 54/64] remove debugging message --- .emacs.d/lisp/package/packup.el | 1 - 1 file changed, 1 deletion(-) diff --git a/.emacs.d/lisp/package/packup.el b/.emacs.d/lisp/package/packup.el index 87c56bd..c0e4848 100644 --- a/.emacs.d/lisp/package/packup.el +++ b/.emacs.d/lisp/package/packup.el @@ -18,7 +18,6 @@ This is what the do-commands look for, and the flag the mark-commands store.") "Run BODY, but if we don't have emacs 25 or later, let-bind a modified `package-archive-contents' that only includes the package-desc from the most-preferred repository" - (message "%s" emacs-version) (if (version< emacs-version "25.1") `(let ((package-archive-contents (mapcar (lambda (pkg) From 595d7b63a42f2a1aced66c3c82351951e7d5f1f4 Mon Sep 17 00:00:00 2001 From: Christopher Cooper Date: Fri, 6 Jul 2018 23:12:58 -0400 Subject: [PATCH 55/64] add support for package-pinned-packages --- .emacs.d/lisp/package/dependencies.el | 5 +++++ .emacs.d/lisp/package/packup.el | 18 ++++++++++++++---- 2 files changed, 19 insertions(+), 4 deletions(-) diff --git a/.emacs.d/lisp/package/dependencies.el b/.emacs.d/lisp/package/dependencies.el index 5ea0cd4..1afde7a 100644 --- a/.emacs.d/lisp/package/dependencies.el +++ b/.emacs.d/lisp/package/dependencies.el @@ -33,4 +33,9 @@ solarized-theme) "A list of all packages required for operation.") +(with-eval-after-load 'package + (setf package-pinned-packages + '(;; stable highlight-symbol is very old and VERY LOUD + (highlight-symbol . "melpa")))) + (provide 'dependencies) diff --git a/.emacs.d/lisp/package/packup.el b/.emacs.d/lisp/package/packup.el index c0e4848..f9f5486 100644 --- a/.emacs.d/lisp/package/packup.el +++ b/.emacs.d/lisp/package/packup.el @@ -17,11 +17,16 @@ This is what the do-commands look for, and the flag the mark-commands store.") (defmacro kotct/with-stable-package-archive-contents (body) "Run BODY, but if we don't have emacs 25 or later, let-bind a modified `package-archive-contents' that only includes the package-desc -from the most-preferred repository" +from the most-preferred repository." (if (version< emacs-version "25.1") `(let ((package-archive-contents (mapcar (lambda (pkg) - (let (desc) + ;; first check package-pinned-packages + (let* ((pinned-archive (cdr (assoc (car pkg) package-pinned-packages))) + (desc (when pinned-archive + (car (cl-member pinned-archive (cdr pkg) + :key #'package-desc-archive + :test #'string=))))) (dolist (archive kotct/package-ordered-archives) (when (not desc) ;; no match yet, keep looking @@ -39,8 +44,13 @@ as listed in `package-archive-priorities' or `kotct/package-ordered-archives'. Does not automatically refresh the package list." (if (version< emacs-version "25.1") ;; no package-archive-priorities, so use kotct/package-ordered-archives - (let ((versions (cdr (assoc package package-archive-contents))) - found-desc) + (let* ((versions (cdr (assoc package package-archive-contents))) + ;; check package-pinned-packages first + (pinned-archive (cdr (assoc package package-pinned-packages))) + (found-desc (when pinned-archive + (car (cl-member pinned-archive versions + :key #'package-desc-archive + :test #'string=))))) (dolist (archive kotct/package-ordered-archives) (when (not found-desc) ;; no match yet, keep looking From 9710150e5b3790d92b4f9a3d00e92a42cf2bdc1a Mon Sep 17 00:00:00 2001 From: Christopher Cooper Date: Fri, 6 Jul 2018 23:21:51 -0400 Subject: [PATCH 56/64] add a nice message after updated refresh --- .emacs.d/lisp/package/packup.el | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.emacs.d/lisp/package/packup.el b/.emacs.d/lisp/package/packup.el index f9f5486..703e329 100644 --- a/.emacs.d/lisp/package/packup.el +++ b/.emacs.d/lisp/package/packup.el @@ -213,7 +213,10 @@ contents of the buffer." (when (eq major-mode 'packup-mode) (let ((inhibit-read-only t)) (erase-buffer)) - (kotct/packup-initialize-buffer-contents))) + (kotct/packup-initialize-buffer-contents) + (when (= (point-min) (point-max)) + (let ((inhibit-read-only t)) + (insert "Everything is up to date!\n"))))) (defun kotct/packup-help () "Show packup help." From 732a0e95c1c096ac0996f01239623f0cc370b4b0 Mon Sep 17 00:00:00 2001 From: Christopher Cooper Date: Fri, 6 Jul 2018 23:38:50 -0400 Subject: [PATCH 57/64] add some additional packup mappings --- .emacs.d/lisp/package/packup.el | 30 ++++++++++++++++++++++++------ 1 file changed, 24 insertions(+), 6 deletions(-) diff --git a/.emacs.d/lisp/package/packup.el b/.emacs.d/lisp/package/packup.el index 703e329..f932007 100644 --- a/.emacs.d/lisp/package/packup.el +++ b/.emacs.d/lisp/package/packup.el @@ -10,7 +10,7 @@ (package-initialize) -(defvar kotct/packup-marker-char ?x +(defvar kotct/packup-marker-char ?* "In Packup, the current mark character. This is what the do-commands look for, and the flag the mark-commands store.") @@ -152,7 +152,7 @@ Returns \"\" if there is no package name on the line." (defun kotct/packup-mark (arg &optional interactive) "Mark the package for update at point in the Packup buffer. If a region is selected, mark all the packages in the region. -If an prefix-arg is passed mark ARG times." +If a prefix-arg is passed mark ARG times." (interactive (list current-prefix-arg t)) (cond ((use-region-p) @@ -169,7 +169,8 @@ If an prefix-arg is passed mark ARG times." (lambda () (forward-char 1) (delete-char 1) - (insert kotct/packup-marker-char))))))) + (insert kotct/packup-marker-char))) + (forward-char))))) (defun kotct/packup-unmark (arg &optional interactive) "Unmark the package for update at point in the Packup buffer. @@ -193,6 +194,18 @@ If an prefix-arg is passed unmark ARG times." (let ((kotct/packup-marker-char ?\040)) (kotct/packup-mark-packages-in-region (point-min) (point-max))))) +(defun kotct/packup-next () + "Go to the next package in the current packup buffer." + (interactive) + (move-beginning-of-line 2) + (forward-char)) + +(defun kotct/packup-prev () + "Go to the previous package in the current packup buffer." + (interactive) + (move-beginning-of-line 0) + (forward-char)) + (defun kotct/packup-initialize-buffer-contents () "Initialize contents of the current packup buffer. @@ -214,9 +227,10 @@ contents of the buffer." (let ((inhibit-read-only t)) (erase-buffer)) (kotct/packup-initialize-buffer-contents) - (when (= (point-min) (point-max)) - (let ((inhibit-read-only t)) - (insert "Everything is up to date!\n"))))) + (if (= (point-min) (point-max)) + (let ((inhibit-read-only t)) + (insert "Everything is up to date!\n")) + (goto-char 2)))) (defun kotct/packup-help () "Show packup help." @@ -230,8 +244,11 @@ contents of the buffer." (define-key map "u" #'kotct/packup-unmark) (define-key map "U" #'kotct/packup-unmark-all) (define-key map "x" #'kotct/packup-do-update) + (define-key map "n" #'kotct/packup-next) + (define-key map "p" #'kotct/packup-prev) (define-key map "g" #'kotct/packup-refresh) (define-key map "?" #'kotct/packup-help) + (define-key map "q" #'quit-window) map) "The keymap for packup-mode.") @@ -257,6 +274,7 @@ contents of the buffer." (progn (kill-buffer buffer) (message "Nothing to update!")) + (goto-char 2) (pop-to-buffer-same-window buffer)))) ;;;###autoload From 90fa15201ad25774a5ccedc0b4bb3f5d2b8e5179 Mon Sep 17 00:00:00 2001 From: Christopher Cooper Date: Sat, 7 Jul 2018 13:24:31 -0400 Subject: [PATCH 58/64] be a little less brutal when killing emacs --- .emacs.d/lisp/behavior/pane-management.el | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/.emacs.d/lisp/behavior/pane-management.el b/.emacs.d/lisp/behavior/pane-management.el index 91ffde5..8d3bdf0 100644 --- a/.emacs.d/lisp/behavior/pane-management.el +++ b/.emacs.d/lisp/behavior/pane-management.el @@ -11,15 +11,12 @@ or if passed an argument, but just current frame if otherwise." (condition-case nil (let ((frame-list (frame-list))) (if (or (= (length frame-list) 1) arg) - (if (not (boundp 'server-process)) - (if (y-or-n-p "Kill Emacs?") - (kill-emacs) - (message "Didn't do anything, promise!")) - (if (y-or-n-p "Kill Emacs?") - (kill-emacs) - (if (y-or-n-p "Delete current frame?") - (delete-frame) - (message "Didn't do anything, promise!")))) + (if (y-or-n-p "Kill Emacs?") + (save-buffers-kill-emacs) + (if (and (boundp 'server-process) + (y-or-n-p "Delete current frame?")) + (delete-frame) + (message "Didn't do anything, promise!"))) (delete-frame))) (error (kill-emacs)))) From 33cb56b2e1df5e53f894dfb5b90095b2b3e74a74 Mon Sep 17 00:00:00 2001 From: Christopher Cooper Date: Sat, 7 Jul 2018 13:32:29 -0400 Subject: [PATCH 59/64] let TRAMP choose its own default --- .emacs.d/lisp/file/tramp-c.el | 4 ---- 1 file changed, 4 deletions(-) diff --git a/.emacs.d/lisp/file/tramp-c.el b/.emacs.d/lisp/file/tramp-c.el index 1cb3d9f..843183c 100644 --- a/.emacs.d/lisp/file/tramp-c.el +++ b/.emacs.d/lisp/file/tramp-c.el @@ -1,9 +1,5 @@ ;;; C-c C-f: find the current file as sudo -;; ssh is faster than the default scp -(with-eval-after-load 'tramp - (setf tramp-default-method "ssh")) - (defun kotct/sudo-edit (&optional arg) "Edit currently visited file as root. With a prefix ARG prompt for a file to visit. From cb65f833f670dc22a6aeba4359fb3eb68215bc76 Mon Sep 17 00:00:00 2001 From: Christopher Cooper Date: Sat, 7 Jul 2018 13:58:04 -0400 Subject: [PATCH 60/64] rename .emacs-emergency to .emacs-preload --- .emacs.d/init.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.emacs.d/init.el b/.emacs.d/init.el index dcb3c57..49618a2 100644 --- a/.emacs.d/init.el +++ b/.emacs.d/init.el @@ -1,7 +1,7 @@ ;;; dot/.emacs ;; load any absolute must-have code -(load "~/.emacs-emergency" 'noerror 'nomessage 'nosuffix) +(load "~/.emacs-preload" 'noerror 'nomessage 'nosuffix) ;; Initialize the package repository. (package-initialize) From b889186ac09deed7625d949d61cb5f318f1cdab0 Mon Sep 17 00:00:00 2001 From: Christopher Cooper Date: Sat, 7 Jul 2018 14:19:36 -0400 Subject: [PATCH 61/64] fix docstrings in packup --- .emacs.d/lisp/package/packup.el | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/.emacs.d/lisp/package/packup.el b/.emacs.d/lisp/package/packup.el index f932007..56eef1a 100644 --- a/.emacs.d/lisp/package/packup.el +++ b/.emacs.d/lisp/package/packup.el @@ -15,7 +15,7 @@ This is what the do-commands look for, and the flag the mark-commands store.") (defmacro kotct/with-stable-package-archive-contents (body) - "Run BODY, but if we don't have emacs 25 or later, let-bind + "Run BODY, but if we don't have Emacs 25 or later, let-bind a modified `package-archive-contents' that only includes the package-desc from the most-preferred repository." (if (version< emacs-version "25.1") @@ -41,6 +41,7 @@ from the most-preferred repository." (defun kotct/package-latest-available (package) "Get the lastest-available package-desc for PACKAGE, preferring repositories as listed in `package-archive-priorities' or `kotct/package-ordered-archives'. + Does not automatically refresh the package list." (if (version< emacs-version "25.1") ;; no package-archive-priorities, so use kotct/package-ordered-archives @@ -63,15 +64,16 @@ Does not automatically refresh the package list." (cadr (assoc package package-archive-contents)))) (defun kotct/package-up-to-date-p (package) - "Returns T if PACKAGE is installed and up-to-date. + "Return non-nil if PACKAGE is installed and up-to-date. + Does not automatically refresh package list. -Before emacs 25, we have to manually check in preferred-repository order." +Before Emacs 25, we have to manually check in preferred-repository order." (let ((latest (kotct/package-latest-available package))) (when latest (package-installed-p package (package-desc-version latest))))) (defun kotct/packup-insert-package-row (package-name package-desc-version) - "Inserts a package row into current buffer." + "Insert a package row into current buffer." (let ((inhibit-read-only t)) (insert (format "[%c] %s -> %s\n" kotct/packup-marker-char package-name package-desc-version)))) @@ -128,7 +130,7 @@ as in '[x]'." (defun kotct/packup-get-package-name () "Get package name on current line. -Returns \"\" if there is no package name on the line." +Return \"\" if there is no package name on the line." (save-excursion (beginning-of-line) (forward-char 4) @@ -221,7 +223,7 @@ contents of the buffer." (apply #'kotct/packup-insert-package-row (list package (package-desc-version (kotct/package-latest-available package)))))))) (defun kotct/packup-refresh () - "Refreshes packages in current buffer." + "Refresh packages in current packup buffer." (interactive) (when (eq major-mode 'packup-mode) (let ((inhibit-read-only t)) @@ -253,7 +255,7 @@ contents of the buffer." "The keymap for packup-mode.") (defun kotct/packup-initialize-buffer () - "Initializes the packup buffer." + "Initialize the packup buffer." (kill-all-local-variables) (use-local-map packup-mode-map) (setf major-mode 'packup-mode @@ -264,7 +266,7 @@ contents of the buffer." ;;;###autoload (defun kotct/packup () - "Creates an interactive buffer to install/update packages." + "Create an interactive buffer to install/update packages." (interactive) (let ((old-buf (current-buffer)) (buffer (get-buffer-create "*packup*"))) @@ -279,8 +281,9 @@ contents of the buffer." ;;;###autoload (defun kotct/packup-install-dependencies (no-refresh &optional update auto-update) - "Installs the dependencies. + "Install the dependencies. With a non-nil or prefix arg NO-REFRESH, do not refresh package list. + If UPDATE is non-nil, out-of-date packages will be added to install list. If AUTO-UPDATE is non-nil, out-of-date/uninstalled packages will be updated." (interactive "P") From 55e592c75ebd1d509ad1506f78014e1e2d54d2e5 Mon Sep 17 00:00:00 2001 From: Christopher Cooper Date: Sat, 7 Jul 2018 15:01:48 -0400 Subject: [PATCH 62/64] unsynchronize recentf saves --- .emacs.d/lisp/file/recentf-c.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.emacs.d/lisp/file/recentf-c.el b/.emacs.d/lisp/file/recentf-c.el index df4bff8..dd9336a 100644 --- a/.emacs.d/lisp/file/recentf-c.el +++ b/.emacs.d/lisp/file/recentf-c.el @@ -9,7 +9,7 @@ (setf recentf-max-saved-items 200) ;; Set timer to save `recentf-list' every 5 minutes. -(run-at-time t (* 5 60) #'recentf-save-list) +(run-at-time (* 5 60) (* 5 60) #'recentf-save-list) ;; recentf completion using `ido-mode' ;; From 972a072ea180df5b5e1ea4fd7b012fb28de4bd53 Mon Sep 17 00:00:00 2001 From: Kristofer Rye Date: Mon, 9 Jul 2018 21:34:09 -0500 Subject: [PATCH 63/64] Code of conduct (#114) --- CODE_OF_CONDUCT.md | 52 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 52 insertions(+) create mode 100644 CODE_OF_CONDUCT.md diff --git a/CODE_OF_CONDUCT.md b/CODE_OF_CONDUCT.md new file mode 100644 index 0000000..6610299 --- /dev/null +++ b/CODE_OF_CONDUCT.md @@ -0,0 +1,52 @@ +# Contributor Covenant Code of Conduct + +## Our Pledge + +In the interest of fostering an open and welcoming environment, we as contributors and maintainers pledge to making participation in our project and our community a harassment-free experience for everyone, regardless of age, body size, disability, ethnicity, sex characteristics, gender identity and expression, level of experience, education, socio-economic status, nationality, personal appearance, race, religion, or sexual identity and orientation. + +## Our Standards + +Examples of behavior that contributes to creating a positive environment include: + +* Using welcoming and inclusive language +* Being respectful of differing viewpoints and experiences +* Gracefully accepting constructive criticism +* Focusing on what is best for the community +* Showing empathy towards other community members + +Examples of unacceptable behavior by participants include: + +* The use of sexualized language or imagery and unwelcome sexual attention or advances +* Trolling, insulting/derogatory comments, and personal or political attacks +* Public or private harassment +* Publishing others' private information, such as a physical or electronic address, without explicit permission +* Other conduct which could reasonably be considered inappropriate in a professional setting + +## Our Responsibilities + +Project maintainers are responsible for clarifying the standards of acceptable behavior and are expected to take appropriate and fair corrective action in response to any instances of unacceptable behavior. + +Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, or to ban temporarily or permanently any contributor for other behaviors that they deem inappropriate, threatening, offensive, or harmful. + +## Scope + +This Code of Conduct applies both within project spaces and in public spaces when an individual is representing the project or its community. +Examples of representing a project or community include using an official project e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event. +Representation of a project may be further defined and clarified by project maintainers. + +## Enforcement + +Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting the project team at [kristofer.rye@gmail.com, christopher.c.cooper@gmail.com, and merciers.merciers@gmail.com][group_email]. +All complaints will be reviewed and investigated and will result in a response that is deemed necessary and appropriate to the circumstances. +The project team is obligated to maintain confidentiality with regard to the reporter of an incident. +Further details of specific enforcement policies may be posted separately. + +Project maintainers who do not follow or enforce the Code of Conduct in good faith may face temporary or permanent repercussions as determined by other members of the project's leadership. + +[group_email]: mailto:kristofer.rye@gmail.com,christopher.c.cooper@gmail.com,merciers.merciers@gmail.com + +## Attribution + +This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, available at https://www.contributor-covenant.org/version/1/4/code-of-conduct.html + +[homepage]: https://www.contributor-covenant.org From 8e17ab5823d759b4a494b199a7489abd43572b69 Mon Sep 17 00:00:00 2001 From: Kristofer Rye Date: Sun, 15 Jul 2018 14:43:06 -0500 Subject: [PATCH 64/64] Bump VERSION to 0.2.0 --- VERSION | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/VERSION b/VERSION index 2df1373..0ea3a94 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -0.2-pre +0.2.0