[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] master d053709 08/46: tiny.el: expr now can return a list.
From: |
Oleh Krehel |
Subject: |
[elpa] master d053709 08/46: tiny.el: expr now can return a list. |
Date: |
Sun, 22 Mar 2015 17:42:26 +0000 |
branch: master
commit d05370989be3bc034153a53f066c173267e4d997
Author: oleh <address@hidden>
Commit: oleh <address@hidden>
tiny.el: expr now can return a list.
e.g:
m1\n10listx+x96&convert img&s.jpg -monochrome -resize 50% -rotate 180
img&c_mono.pdf
---
tiny.el | 19 +++++++++++++++----
1 files changed, 15 insertions(+), 4 deletions(-)
diff --git a/tiny.el b/tiny.el
index e4f8c9c..445d122 100644
--- a/tiny.el
+++ b/tiny.el
@@ -59,6 +59,9 @@
;; m, 7&0x&02x
;; m1\n14&*** TODO http://emacsrocks.com/e&02d.html
;; m1\n10&convert img&s.jpg -monochrome -resize 50% -rotate 180 img&s_mono.pdf
+;; (setq foo-list '(m1 11+x96&?&c))
+;; m1\n10listx+x96&convert img&s.jpg -monochrome -resize 50% -rotate 180
img&c_mono.pdf
+;; m1\n10listxnthxfoo-list&convert img&s.jpg -monochrome -resize 50% -rotate
180 img&c_mono.pdf
;;
;; As you might have guessed, the syntax is as follows:
;; m[<range start:=0>][<separator:= >]<range end>[lisp expr][&][format expr]
@@ -151,19 +154,27 @@ expression."
(setq expr "x"))
(when (zerop (length fmt))
(setq fmt "%s"))
+ ;;
+ (let* ((lexpr (read expr))
+ (format-expressions (if (eq (car lexpr) 'list)
+ (mapconcat #'identity
+ (loop for i from 0 to (1-
(length lexpr))
+ collecting (format "(nth %d
x)" i))
+ " ")
+ (if n-uses
+ (apply #'concat (make-list n-uses "x "))
+ "x"))))
(unless (>= (read n1) (read n2))
(format
(concat
"(mapconcat (lambda(x) (setq x %s)(format \"%s\" "
- (if n-uses
- (apply #'concat (make-list n-uses "x "))
- "x")
+ format-expressions
")) (number-sequence %s %s) \"%s\")")
expr
fmt
n1
n2
- s1))))
+ s1)))))
(defun tiny-mapconcat-parse ()
"Try to match a snippet of this form:
- [elpa] master updated (302a16a -> 3f035ad), Oleh Krehel, 2015/03/22
- [elpa] master ae0853e 03/46: tiny.el: fixed two snippets., Oleh Krehel, 2015/03/22
- [elpa] master 1273eae 04/46: tiny.el: added to the comments., Oleh Krehel, 2015/03/22
- [elpa] master 086708f 01/46: Initial import., Oleh Krehel, 2015/03/22
- [elpa] master 1baa50b 05/46: tiny.el: fixed some typos., Oleh Krehel, 2015/03/22
- [elpa] master 466e02c 06/46: tiny.el: added a use case for multiple TODO items in org-mode., Oleh Krehel, 2015/03/22
- [elpa] master cc8d243 02/46: tiny.el: Added new test snippets., Oleh Krehel, 2015/03/22
- [elpa] master 7cc4e00 07/46: tiny.el: x can be reused in format string., Oleh Krehel, 2015/03/22
- [elpa] master d053709 08/46: tiny.el: expr now can return a list.,
Oleh Krehel <=
- [elpa] master 03aef85 09/46: tiny.el: fixed a bug introduced by previous commit., Oleh Krehel, 2015/03/22
- [elpa] master 835c63e 12/46: tiny.el: fixed a small whitespace issue in `tiny-tokenize'., Oleh Krehel, 2015/03/22
- [elpa] master 36c8dc0 10/46: tiny.el: added missing functions., Oleh Krehel, 2015/03/22
- [elpa] master 067e820 11/46: tiny.el: improved `tiny-mapconcat` and `tiny-mapconcat-parse'., Oleh Krehel, 2015/03/22
- [elpa] master cad8e50 13/46: tiny.el: added the option to include %(sexps) into the format string., Oleh Krehel, 2015/03/22
- [elpa] master 78241c4 15/46: tiny.el: fixed a bug for expansion of m5%x., Oleh Krehel, 2015/03/22
- [elpa] master 29b5b76 16/46: Added README.md, Oleh Krehel, 2015/03/22
- [elpa] master b9c35e1 17/46: README.md: minor update., Oleh Krehel, 2015/03/22
- [elpa] master 97b9fdf 14/46: tiny.el: fixed up the previous change., Oleh Krehel, 2015/03/22
- [elpa] master 80e64b8 18/46: README.md: minor update., Oleh Krehel, 2015/03/22