[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] master 9b83857 7/9: Merge commit '366689f15373ffacfe4d28b36e6325d
From: |
Oleh Krehel |
Subject: |
[elpa] master 9b83857 7/9: Merge commit '366689f15373ffacfe4d28b36e6325d193a4e752' from tiny |
Date: |
Tue, 08 Dec 2015 09:26:23 +0000 |
branch: master
commit 9b838575be93d8bd2c1d0842b4692dae6090e0b0
Merge: 8574898 366689f
Author: Oleh Krehel <address@hidden>
Commit: Oleh Krehel <address@hidden>
Merge commit '366689f15373ffacfe4d28b36e6325d193a4e752' from tiny
---
packages/tiny/Makefile | 15 +++++----------
packages/tiny/tiny-test.el | 2 ++
packages/tiny/tiny.el | 33 +++++++++++++++++++++++----------
3 files changed, 30 insertions(+), 20 deletions(-)
diff --git a/packages/tiny/Makefile b/packages/tiny/Makefile
index 6332238..708ea1a 100644
--- a/packages/tiny/Makefile
+++ b/packages/tiny/Makefile
@@ -1,18 +1,13 @@
-EMACS ?= emacs
-CASK_EXEC ?= cask exec
-
+emacs ?= emacs
all: test
-test: clean-elc
- ${MAKE} unit
-
-unit:
- ${CASK_EXEC} ${EMACS} -Q -batch -l tiny-test.el -l tiny.el --eval "(ert
t)"
+test: clean
+ cask exec emacs -Q -batch -l tiny-test.el -l tiny.el -f
ert-run-tests-batch-and-exit
compile:
- ${CASK_EXEC} ${EMACS} -Q -batch -f batch-byte-compile tiny.el
+ $(emacs) -Q -batch -f batch-byte-compile tiny.el
-clean-elc:
+clean:
rm -f f.elc
.PHONY: all test
diff --git a/packages/tiny/tiny-test.el b/packages/tiny/tiny-test.el
index dc9c3b9..3d9ec54 100644
--- a/packages/tiny/tiny-test.el
+++ b/packages/tiny/tiny-test.el
@@ -74,6 +74,8 @@ with point at the end of TXT."
(ert-deftest tiny-mapconcat ()
(should (equal (with-text-value "m10" (lambda()(eval (read
(tiny-mapconcat)))))
"0 1 2 3 4 5 6 7 8 9 10"))
+ (should (equal (with-text-value "mm10" (lambda()(eval (read
(tiny-mapconcat)))))
+ "012345678910"))
(should (equal (with-text-value "m5 10" (lambda()(eval (read
(tiny-mapconcat)))))
"5 6 7 8 9 10"))
(should (equal (with-text-value "m5 10*xx" (lambda()(eval (read
(tiny-mapconcat)))))
diff --git a/packages/tiny/tiny.el b/packages/tiny/tiny.el
index 78d44bb..90c89d5 100644
--- a/packages/tiny/tiny.el
+++ b/packages/tiny/tiny.el
@@ -4,7 +4,7 @@
;; Author: Oleh Krehel <address@hidden>
;; URL: https://github.com/abo-abo/tiny
-;; Version: 0.1
+;; Version: 0.1.1
;; Keywords: convenience
;; This file is part of GNU Emacs.
@@ -122,6 +122,11 @@ At the moment, only `tiny-mapconcat' is supported.
"Setup shortcuts."
(global-set-key (kbd "C-;") 'tiny-expand))
+(defalias 'tiny--preceding-sexp
+ (if (fboundp 'elisp--preceding-sexp)
+ 'elisp--preceding-sexp
+ 'preceding-sexp))
+
;;;###autoload
(defun tiny-replace-this-sexp ()
"Eval and replace the current sexp.
@@ -137,9 +142,9 @@ On error go up list and try again."
(catch 'success
(while t
(ignore-errors
- (unless (looking-back ")")
+ (unless (looking-back ")" (line-beginning-position))
(error "Bad location"))
- (let ((sexp (preceding-sexp)))
+ (let ((sexp (tiny--preceding-sexp)))
(if (eq (car sexp) 'lambda)
(error "Lambda evaluates to itself")
(let ((value (eval sexp)))
@@ -169,8 +174,14 @@ Must throw an error when can't go up further."
Defaults are used in place of null values."
(let ((parsed (tiny-mapconcat-parse)))
(when parsed
- (let* ((n1 (or (nth 0 parsed) "0"))
- (s1 (or (nth 1 parsed) " "))
+ (let* ((n0 (or (nth 0 parsed) "0"))
+ (n1 (nth 1 parsed))
+ (s1 (cond ((null n1)
+ " ")
+ ((equal n1 "m")
+ "")
+ (t
+ n1)))
(n2 (nth 2 parsed))
(expr (or (nth 3 parsed) "x"))
(lexpr (read expr))
@@ -193,12 +204,12 @@ Defaults are used in place of null values."
(cdr tes)
" ")
")))(number-sequence %s %s) \"%s\")")))
- (unless (>= (read n1) (read n2))
+ (unless (>= (read n0) (read n2))
(format
format-expression
expr
(replace-regexp-in-string "\\\\n" "\n" fmt)
- n1
+ n0
n2
s1))))))
@@ -266,7 +277,8 @@ Return nil if nothing was matched, otherwise
(when (catch 'done
(cond
;; either start with a number
- ((looking-back "\\bm\\(-?[0-9]+\\)\\([^\n]*?\\)")
+ ((looking-back "\\bm\\(-?[0-9]+\\)\\([^\n]*?\\)"
+ (line-beginning-position))
(setq n1 (match-string-no-properties 1)
str (match-string-no-properties 2)
tiny-beg (match-beginning 0)
@@ -276,7 +288,8 @@ Return nil if nothing was matched, otherwise
n1 nil)
(throw 'done t)))
;; else capture the whole thing
- ((looking-back "\\bm\\([^%|\n]*[0-9][^\n]*\\)")
+ ((looking-back "\\bm\\([^%|\n]*[0-9][^\n]*\\)"
+ (line-beginning-position))
(setq str (match-string-no-properties 1)
tiny-beg (match-beginning 0)
tiny-end (match-end 0))
@@ -361,7 +374,7 @@ Return nil if nothing was matched, otherwise
(cond
;; general functionp
((not (eq t (help-function-arglist sym)))
- (setq expect-fun)
+ (setq expect-fun nil)
(setq allow-spc t)
;; (when (zerop n-paren) (push "(" out))
(unless (equal (car out) "(")
- [elpa] master updated (8574898 -> a0561bf), Oleh Krehel, 2015/12/08
- [elpa] master 98726b3 2/9: Makefile: bring back cask for undercover to load, Oleh Krehel, 2015/12/08
- [elpa] master 2f68d9c 1/9: Allow empty separator though e.g. "mm10", Oleh Krehel, 2015/12/08
- [elpa] master 90a4e76 4/9: hydra.el (hydra-disable): Call the exit action only in one frame, Oleh Krehel, 2015/12/08
- [elpa] master 144892b 3/9: Makefile: use plain cask, Oleh Krehel, 2015/12/08
- [elpa] master 366689f 6/9: Fix byte-compiler warnings, Oleh Krehel, 2015/12/08
- [elpa] master 9b83857 7/9: Merge commit '366689f15373ffacfe4d28b36e6325d193a4e752' from tiny,
Oleh Krehel <=
- [elpa] master a0561bf 9/9: Merge commit '97c2270f7138530de21f773f094c1495498cac78' from hydra, Oleh Krehel, 2015/12/08
- [elpa] master 7e5f64e 5/9: hydra-ox.el: Add a require hydra, Oleh Krehel, 2015/12/08
- [elpa] master 97c2270 8/9: Fix byte-compiler warning, Oleh Krehel, 2015/12/08