Created
April 3, 2015 05:26
-
-
Save naohaq/a9e460df4f6e43c6c94d to your computer and use it in GitHub Desktop.
Emacs lisp for semi-automatic update of "CreationDate" comment on a postscript file
This file contains 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
(defun format-time-string-with-locale-c (fmt) | |
(let ((system-time-locale "C")) (format-time-string fmt))) | |
(require 'ps-mode) | |
(defun ps-mode-update-creationdate () | |
(interactive nil) | |
(save-excursion | |
(goto-char (point-min)) | |
(and | |
(re-search-forward "^%%CreationDate: " nil t) | |
(y-or-n-p "Update really?") | |
(and | |
(re-search-forward ".*$" nil t) | |
(let ((tstr (format-time-string-with-locale-c "%c"))) | |
(replace-match tstr)))) | |
) | |
) | |
(define-key ps-mode-map "\C-c\C-d" 'ps-mode-update-creationdate) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment