Style Guidelines for People
In the midst of some unrelated Googling, I came across Luca de Alfaro's style guidelines for student co-authors. This is good stuff. I particularly like "one sentence per line" b/w "fill-sentence macro". It's an elegant solution to a frequently annoying deficiency of diff
, which is unfortunately the baseline for anyone collaborating via CVS or SVN. I tweaked his macro to get nice indentation in AucTeX:
(defun fill-sentence ()
(interactive)
(save-excursion
(forward-char)
(forward-sentence -1)
(indent-relative)
(let ((beg (point)))
(forward-sentence)
(if (equal "LaTeX" (substring mode-name (string-match "LaTeX" mode-name)))
(LaTeX-fill-region-as-paragraph beg (point))
(fill-region-as-paragraph beg (point))))))
(global-set-key "\ej" 'fill-sentence)
[UPDATE 1/20/07] Fixed an off-by-one error when the cursor is on the first character of the sentence by adding
(forward-char)
.
No comments:
Post a Comment