[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] master 5df4f79 25/46: tiny.el: removed `tiny-beginning-of-string'
From: |
Oleh Krehel |
Subject: |
[elpa] master 5df4f79 25/46: tiny.el: removed `tiny-beginning-of-string' |
Date: |
Sun, 22 Mar 2015 17:42:33 +0000 |
branch: master
commit 5df4f79cf0a400f7c9922bc7a25909008b6e41de
Author: oleh <address@hidden>
Commit: oleh <address@hidden>
tiny.el: removed `tiny-beginning-of-string'
---
tiny.el | 43 +++++++++++++++++--------------------------
1 files changed, 17 insertions(+), 26 deletions(-)
diff --git a/tiny.el b/tiny.el
index b2dd391..071b842 100644
--- a/tiny.el
+++ b/tiny.el
@@ -87,6 +87,7 @@
(eval-when-compile
(require 'cl))
(require 'help-fns)
+(require 'org)
(defvar tiny-beg nil
"Last matched snippet start position.")
@@ -119,24 +120,17 @@ At the moment, only `tiny-mapconcat' is supported.
(or
(and (looking-back ")")
(ignore-errors
- (tiny-replace-last-sexp)))
+ (let ((sexp (preceding-sexp)))
+ (unless (eq (car sexp) 'lambda)
+ (let ((value (eval sexp)))
+ (kill-sexp -1)
+ (insert (format "%s" value))
+ t)))))
(save-excursion (tiny-replace-sexp-desperately))))
-(defun tiny-replace-last-sexp ()
- (interactive)
- (let ((sexp (preceding-sexp)))
- (unless (eq (car sexp) 'lambda)
- (let ((value (eval sexp)))
- (kill-sexp -1)
- (insert (format "%s" value))
- t))))
-
(defun tiny-replace-sexp-desperately ()
- "Try to eval the current sexp.
-Replace it if there's no error.
-Go upwards until it's possible to eval.
-Skip lambdas."
- (interactive)
+ "Eval and replace the current sexp.
+On error, go upwards and try again. Skip lambdas."
(condition-case nil
(tiny-up-list)
(error "can't go up this list"))
@@ -152,16 +146,13 @@ Skip lambdas."
(insert (format "%s" value)))
(error (tiny-replace-sexp-desperately)))))))
-(defun tiny-beginning-of-string ()
- "If inside string, move point to its beginning"
+(defun tiny-up-list ()
(interactive)
+ ;; check if inside string
(let ((p (nth 8 (syntax-ppss))))
(when (eq (char-after p) ?\")
- (goto-char p))))
-
-(defun tiny-up-list ()
- (interactive)
- (tiny-beginning-of-string)
+ ;; go to beginning for string
+ (goto-char p)))
(up-list))
(defun tiny-mapconcat ()
@@ -369,10 +360,10 @@ Return nil if nothing was matched, otherwise
(make-string n-paren ?\)))))))
(defun t-date (s &optional shift)
- (let ((time (->> (current-time)
- decode-time
- (org-read-date-analyze s nil)
- (apply 'encode-time))))
+ (let ((time (apply 'encode-time
+ (org-read-date-analyze
+ s nil
+ (decode-time (current-time))))))
(when shift
(setq time (time-add time (days-to-time shift))))
(format-time-string "%Y-%m-%d %a" time)))
- [elpa] master cad8e50 13/46: tiny.el: added the option to include %(sexps) into the format string., (continued)
- [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
- [elpa] master 2bd9abb 21/46: tiny.el: moved tests to tiny-test.el., Oleh Krehel, 2015/03/22
- [elpa] master b99315d 20/46: tiny.el: updated the doc., Oleh Krehel, 2015/03/22
- [elpa] master 11722a1 19/46: tiny.el: fixed typos., Oleh Krehel, 2015/03/22
- [elpa] master b4fff55 23/46: tiny.el: fixed `tiny-tokenize', Oleh Krehel, 2015/03/22
- [elpa] master 5df4f79 25/46: tiny.el: removed `tiny-beginning-of-string',
Oleh Krehel <=
- [elpa] master 8a3cab0 27/46: tiny.el: removed `tiny-replace-preceding-sexp', Oleh Krehel, 2015/03/22
- [elpa] master f1d1a2e 22/46: tiny-test.el: switched to ERT., Oleh Krehel, 2015/03/22
- [elpa] master 4c87ade 29/46: tiny.el: fixed a bug in `tiny-mapconcat-parse'., Oleh Krehel, 2015/03/22
- [elpa] master a6e4144 30/46: tiny.el (tiny-extract-sexps): can handle e.g. %0.1f(...) style formatting., Oleh Krehel, 2015/03/22
- [elpa] master 80cd28f 28/46: tiny-test.el: added a test for `tiny-replace-this-sexp', Oleh Krehel, 2015/03/22
- [elpa] master 08ba593 24/46: tiny.el: fixed `tiny-tokenize', Oleh Krehel, 2015/03/22
- [elpa] master e6abbc6 31/46: tiny.el (tiny-date): renamed from t-date. In format string it's just "date", Oleh Krehel, 2015/03/22
- [elpa] master c59bc94 36/46: tiny.el (tiny-extract-sexps): add missing let binding, Oleh Krehel, 2015/03/22
- [elpa] master cf74dd1 34/46: tiny.el: fix docs, Oleh Krehel, 2015/03/22
- [elpa] master b843226 26/46: tiny.el: removed `tiny-replace-sexp-desperately', Oleh Krehel, 2015/03/22