emacs-elpa-diffs
[Top][All Lists]
Advanced

[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)))



reply via email to

[Prev in Thread] Current Thread [Next in Thread]