← Back to team overview

dolfin team mailing list archive

Useful emacs macros

 

Here are some useful lines to put in ~/.emacs I've put together with
the help of Google. It automatically updates the time stamp ("Last
changed: 2009-08-09") upon saving and also removes any trailing white
space.

I imagine (I mean challenge) Ola will have something similar for Vim.

;; Update time stamp for DOLFIN source code
(setq
  time-stamp-start "Last changed:\\\\? "; start of pattern
  time-stamp-end "\\\\?\n"              ; end of pattern
  time-stamp-active t                   ; do enable time-stamps
  time-stamp-line-limit 20              ; check first 10 lines
  time-stamp-format "%04y-%02m-%02d")   ; date format

;; Update timestamp before saving
(add-hook 'before-save-hook 'time-stamp)

;; Remove trailing whitespaces before saving
(add-hook 'before-save-hook 'delete-trailing-whitespace)

--
Anders

Attachment: signature.asc
Description: Digital signature