From 24b408110dfbe231b9784f62d8f89eacb75e1007 Mon Sep 17 00:00:00 2001 From: Ivan Malison Date: Thu, 16 Jun 2016 17:21:54 -0700 Subject: [PATCH] get-file-string and move imalison:get-lat-long --- dotfiles/emacs.d/README.org | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/dotfiles/emacs.d/README.org b/dotfiles/emacs.d/README.org index 981254c1..a0391194 100644 --- a/dotfiles/emacs.d/README.org +++ b/dotfiles/emacs.d/README.org @@ -443,6 +443,22 @@ Prefix alternatives is a macro that builds a function that selects one of a coll (setq result (concat (file-name-as-directory result) dir))) result)) #+END_SRC +** Get file string +#+BEGIN_SRC emacs-lisp + (defun imalison:get-string-from-file (filePath) + "Return filePath's file content." + (with-temp-buffer + (insert-file-contents filePath) + (buffer-string))) +#+END_SRC +** Get current location +#+BEGIN_SRC emacs-lisp + (defun imalison:get-lat-long () + (condition-case _ex + (mapcar 'string-to-number (s-split "," (s-trim (shell-command-to-string + "whereami")))) + (error (list 37.7879312624533 -122.402388853402)))) +#+END_SRC ** Haversine distance #+BEGIN_SRC emacs-lisp (defun imalison:sin2 (p) @@ -590,12 +606,6 @@ This was taken from [[http://emacs.stackexchange.com/questions/7583/transiently- ((< (car a) (car b)) -1) (t (imalison:compare-int-list (cdr a) (cdr b)))))) - (defun imalison:get-lat-long () - (condition-case _ex - (mapcar 'string-to-number (s-split "," (s-trim (shell-command-to-string - "whereami")))) - (error (list 37.7879312624533 -122.402388853402)))) - (defun get-date-created-from-agenda-entry (agenda-entry) (org-time-string-to-time (org-entry-get (get-text-property 1 'org-marker agenda-entry) "CREATED")))