Skip to content

Instantly share code, notes, and snippets.

@apraga
Created June 9, 2019 15:59
Show Gist options
  • Save apraga/7fc7175f5afab9298ad6af08efbe54be to your computer and use it in GitHub Desktop.
Save apraga/7fc7175f5afab9298ad6af08efbe54be to your computer and use it in GitHub Desktop.
Lisp : apply a function to regexp match (converts between 2 date formats)
;; Call this function with query-replace-regexp with \,(convert-date) as the replacement (with a backslash)
;; Example of search :
;; ^\(Sun\|Mon\|Tue\|Wed\|Thu\|Fri\|Sat\).*$
(defun convert-date ()
(setq dformat "* <%Y-%m-%d>")
(setq s (match-string-no-properties 0))
(format-time-string dformat (apply #'encode-time (parse-time-string s)))
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment