commit f0200aa32c820a8314518c4762da8529958eac97
parent 75bfe60f3200bf2fa2a2f4dd5e9e8a5ab43f1660
Author: Wilfred Hughes <me@wilfred.me.uk>
Date: Sat, 16 Dec 2017 15:06:40 +0000
Make it easier to download emacs source code
Diffstat:
4 files changed, 25 insertions(+), 11 deletions(-)
diff --git a/.travis.yml b/.travis.yml
@@ -6,9 +6,7 @@ cache:
- emacs-25.3
before_install:
- # A copy of the emacs source code.
- - wget http://ftpmirror.gnu.org/emacs/emacs-25.3.tar.gz
- - tar -xzf emacs-25.3.tar.gz
+ - ./download_emacs_src.sh
- curl -fsSkL https://gist.github.com/rejeep/ebcd57c3af83b049833b/raw > x.sh && source ./x.sh
- evm install $EVM_EMACS --use --skip
diff --git a/download_emacs_src.sh b/download_emacs_src.sh
@@ -0,0 +1,9 @@
+#!/bin/bash
+
+if [ ! -d "emacs-25.3" ]; then
+ set -e
+ set -x
+
+ wget http://ftpmirror.gnu.org/emacs/emacs-25.3.tar.gz
+ tar -xzf emacs-25.3.tar.gz
+fi
diff --git a/helpful.el b/helpful.el
@@ -109,6 +109,13 @@ with double-quotes."
(cl-prettyprint value)
(s-trim (buffer-string))))
+(defun helpful--indent-rigidly (s amount)
+ "Indent string S by adding AMOUNT spaces to each line."
+ (with-temp-buffer
+ (insert s)
+ (indent-rigidly (point-min) (point-max) amount)
+ (buffer-string)))
+
(defun helpful--format-properties (symbol)
"Return a string describing all the properties of SYMBOL."
(let* ((syms-and-vals
@@ -118,14 +125,14 @@ with double-quotes."
(string-lessp (symbol-name sym1) (symbol-name sym2)))
syms-and-vals))
(lines
- (-map
- (-lambda ((sym val))
- (format "%s %s"
+ (--map
+ (-let* (((sym val) it)
+ (pretty-val
+ (helpful--pretty-print val)))
+ (format "%s\n%s"
(propertize (symbol-name sym)
'face 'font-lock-constant-face)
- (if (eq (type-of val) 'compiled-function)
- "#<compiled-function>"
- (helpful--pretty-print val))))
+ (helpful--indent-rigidly pretty-val 2)))
syms-and-vals)))
(when lines
(s-join "\n" lines))))
diff --git a/test/unit-test.el b/test/unit-test.el
@@ -88,7 +88,7 @@
(if (f-exists-p emacs-src-path)
(let ((find-function-C-source-directory emacs-src-path))
(helpful-callable 'if))
- (message "No Emacs source code found at %S, skipping test."
+ (message "No Emacs source code found at %S, skipping test. Run ./download_emacs_src.sh."
emacs-src-path))))
(ert-deftest helpful--no-symbol-properties ()
@@ -148,7 +148,7 @@
(if (f-exists-p emacs-src-path)
(let ((find-function-C-source-directory emacs-src-path))
(helpful--definition 'default-directory nil))
- (message "No Emacs source code found at %S, skipping test."
+ (message "No Emacs source code found at %S, skipping test. Run ./download_emacs_src.sh"
emacs-src-path))))
(ert-deftest helpful-variable ()