Created
June 9, 2019 15:59
-
-
Save apraga/7fc7175f5afab9298ad6af08efbe54be to your computer and use it in GitHub Desktop.
Lisp : apply a function to regexp match (converts between 2 date formats)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;; 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