get-file-string and move imalison:get-lat-long
This commit is contained in:
parent
a96aceccb7
commit
24b408110d
@ -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)))
|
(setq result (concat (file-name-as-directory result) dir)))
|
||||||
result))
|
result))
|
||||||
#+END_SRC
|
#+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
|
** Haversine distance
|
||||||
#+BEGIN_SRC emacs-lisp
|
#+BEGIN_SRC emacs-lisp
|
||||||
(defun imalison:sin2 (p)
|
(defun imalison:sin2 (p)
|
||||||
@ -590,12 +606,6 @@ This was taken from [[http://emacs.stackexchange.com/questions/7583/transiently-
|
|||||||
((< (car a) (car b)) -1)
|
((< (car a) (car b)) -1)
|
||||||
(t (imalison:compare-int-list (cdr a) (cdr b))))))
|
(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)
|
(defun get-date-created-from-agenda-entry (agenda-entry)
|
||||||
(org-time-string-to-time
|
(org-time-string-to-time
|
||||||
(org-entry-get (get-text-property 1 'org-marker agenda-entry) "CREATED")))
|
(org-entry-get (get-text-property 1 'org-marker agenda-entry) "CREATED")))
|
||||||
|
Loading…
Reference in New Issue
Block a user