Write command my-copy-gpx-timestamps
This commit is contained in:
parent
f9ae684967
commit
5b5b2fd41b
19
init.org
19
init.org
|
@ -2417,6 +2417,25 @@ What if...
|
||||||
:load-path "/media/data/anon/Documents/Text Files/programming/elisp/chronometrist/elisp/")
|
:load-path "/media/data/anon/Documents/Text Files/programming/elisp/chronometrist/elisp/")
|
||||||
#+END_SRC
|
#+END_SRC
|
||||||
|
|
||||||
|
#+BEGIN_SRC emacs-lisp
|
||||||
|
(defun my-copy-gpx-timestamps ()
|
||||||
|
"Copy ISO-8601 timestamps from GPX data as ISO-8601 timestamps in local time."
|
||||||
|
(interactive)
|
||||||
|
(let* ((dom (libxml-parse-xml-region (point-min) (point-max)))
|
||||||
|
(trkseg (esxml-query "trkseg" dom))
|
||||||
|
(first-trkpt (third trkseg))
|
||||||
|
(first-iso (second (alist-get 'time first-trkpt)))
|
||||||
|
(first-unix (parse-iso8601-time-string first-iso))
|
||||||
|
(last-trkpt (first (last trkseg)))
|
||||||
|
(last-iso (second (alist-get 'time last-trkpt)))
|
||||||
|
(last-unix (parse-iso8601-time-string last-iso))
|
||||||
|
(plist (list :start (chronometrist-format-time-iso8601 first-unix)
|
||||||
|
:stop (chronometrist-format-time-iso8601 last-unix)))
|
||||||
|
(string (apply #'format "%S %S\n%S %S" plist)))
|
||||||
|
(kill-new string)
|
||||||
|
(apply #'message "Copied %S %S %S %S to kill ring" plist)))
|
||||||
|
#+END_SRC
|
||||||
|
|
||||||
*** count-expressions
|
*** count-expressions
|
||||||
*** querying data
|
*** querying data
|
||||||
An example of querying the Chronometrist file data - finding out how much time I've spent on tasks matching a certain criteria.
|
An example of querying the Chronometrist file data - finding out how much time I've spent on tasks matching a certain criteria.
|
||||||
|
|
Loading…
Reference in New Issue