(calendar-absolute-from-julian): Declare as a function.
[bpt/emacs.git] / lisp / log-edit.el
index 8ee8e36..5c2cf98 100644 (file)
@@ -1,16 +1,16 @@
 ;;; log-edit.el --- Major mode for editing CVS commit messages
 
-;; Copyright (C) 1999, 2000, 2002, 2003, 2004,
-;;   2005 Free Software Foundation, Inc.
+;; Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004,
+;;   2005, 2006, 2007 Free Software Foundation, Inc.
 
-;; Author: Stefan Monnier <monnier@cs.yale.edu>
+;; Author: Stefan Monnier <monnier@iro.umontreal.ca>
 ;; Keywords: pcl-cvs cvs commit log
 
 ;; This file is part of GNU Emacs.
 
 ;; GNU Emacs is free software; you can redistribute it and/or modify
 ;; it under the terms of the GNU General Public License as published by
-;; the Free Software Foundation; either version 2, or (at your option)
+;; the Free Software Foundation; either version 3, or (at your option)
 ;; any later version.
 
 ;; GNU Emacs is distributed in the hope that it will be useful,
@@ -448,8 +448,10 @@ This contacts the repository to get the rcstemplate file and
 can thus take some time."
   (interactive)
   (when (or (interactive-p) (= (point-min) (point-max)))
-    (when (file-readable-p "CVS/Entries")
-      (call-process "cvs" nil t nil "checkout" "-p" "CVSROOT/rcstemplate"))))
+    (when (file-readable-p "CVS/Root")
+      ;; Ignore the stderr stuff, even if it's an error.
+      (call-process "cvs" nil '(t nil) nil
+                    "checkout" "-p" "CVSROOT/rcstemplate"))))
 
 (defun log-edit-insert-filenames ()
   "Insert the list of files that are to be committed."
@@ -536,7 +538,7 @@ If we are between paragraphs, return the previous paragraph."
             (point))
           (if (re-search-forward "^[ \t\n]*$" nil t)
               (match-beginning 0)
-            (point)))))
+            (point-max)))))
 
 (defun log-edit-changelog-subparagraph ()
   "Return the bounds of the ChangeLog subparagraph containing point.
@@ -566,7 +568,7 @@ for more details."
 (defvar user-mail-address)
 (defun log-edit-changelog-ours-p ()
   "See if ChangeLog entry at point is for the current user, today.
-Return non-nil iff it is."
+Return non-nil if it is."
   ;; Code adapted from add-change-log-entry.
   (let ((name (or (and (boundp 'add-log-full-name) add-log-full-name)
                  (and (fboundp 'user-full-name) (user-full-name))
@@ -588,25 +590,23 @@ The return value looks like this:
   (LOGBUFFER (ENTRYSTART . ENTRYEND) ...)
 where LOGBUFFER is the name of the ChangeLog buffer, and each
 \(ENTRYSTART . ENTRYEND\) pair is a buffer region."
-  (save-excursion
-    (let ((changelog-file-name
-          (let ((default-directory
-                  (file-name-directory (expand-file-name file)))
-                (visiting-buffer (find-buffer-visiting file)))
-            ;; If there is a buffer visiting FILE, and it has a local
-            ;; value for `change-log-default-name', use that.
-            (if (and visiting-buffer
-                     (local-variable-p 'change-log-default-name
-                                       visiting-buffer))
-                (save-excursion
-                  (set-buffer visiting-buffer)
-                  change-log-default-name)
-              ;; `find-change-log' uses `change-log-default-name' if set
-              ;; and sets it before exiting, so we need to work around
-              ;; that memoizing which is undesired here
-              (setq change-log-default-name nil)
-              (find-change-log)))))
-      (set-buffer (find-file-noselect changelog-file-name))
+  (let ((changelog-file-name
+         (let ((default-directory
+                 (file-name-directory (expand-file-name file)))
+               (visiting-buffer (find-buffer-visiting file)))
+           ;; If there is a buffer visiting FILE, and it has a local
+           ;; value for `change-log-default-name', use that.
+           (if (and visiting-buffer
+                    (local-variable-p 'change-log-default-name
+                                      visiting-buffer))
+               (with-current-buffer visiting-buffer
+                 change-log-default-name)
+             ;; `find-change-log' uses `change-log-default-name' if set
+             ;; and sets it before exiting, so we need to work around
+             ;; that memoizing which is undesired here
+             (setq change-log-default-name nil)
+             (find-change-log)))))
+    (with-current-buffer (find-file-noselect changelog-file-name)
       (unless (eq major-mode 'change-log-mode) (change-log-mode))
       (goto-char (point-min))
       (if (looking-at "\\s-*\n") (goto-char (match-end 0)))