Skip to content

Instantly share code, notes, and snippets.

@naohaq
Created April 3, 2015 05:26
Show Gist options
  • Save naohaq/a9e460df4f6e43c6c94d to your computer and use it in GitHub Desktop.
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
(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