This is the mail archive of the guile@sourceware.cygnus.com mailing list for the Guile project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

changelogs vs cvs comments (was Re: ChangeLog renaming...)


I am in support of the changelog->cvs camp.

One thing that used to bother was how to make sure to get everything
mentioned in the log entry. With a bit of help from emacs I have
developed a style where I go through the diff, line by line, and can
conveniently add changelog entries whenever I reach a new
function/variable. And since add-change-log-entry-other-window is
quite clever, I feel quite confident in the coverage of the logging.

The code I use is below. It mimics `next-error' by finding the source
line corresponding to the next "+" line in the diff buffer. There are
several shortcomings (such as using hardwired diff buffer names or
assuming unidiff output) but nothing that keeps me sleepless at
nights.

(do not become confused about the compilation-frame stuff, I believe
it works without.)

(defconst cvs-next-diff-started nil)

(defun cvs-next-diff (&optional arg)
  "Move point to the next difference.
With optional ARG \(prefix argument\), restart from top of diff buffer.
This is currently hardwired to pcl-cvs \(cvs 1.8\) and unidiff output."
  (interactive "P")
  (let ((obuf (current-buffer))
	(ofrm (window-frame (get-buffer-window (current-buffer))))
	(diff-section "^@@ \\-\\([0-9]+\\),\\([0-9]+\\) \\+\\([0-9]+\\),\\([0-9]+\\) @@")
	(diff-deletion "^-")
	(diff-insertion "^+")
	buf found eof secno lineno diffno)
    (setq buf (or (and (eq major-mode 'cvs-mode) (get-buffer "*cvs-diff*"))
		  (get-buffer "*vc-diff*")
		  (get-buffer "*cvs-diff*")))
    (cond
     ((not (buffer-live-p buf))
      (error "Couldn't find any cvs diff output buffer."))
     ((and window-system (boundp 'compilation-frame-id)
	   (framep compilation-frame-id) (frame-live-p compilation-frame-id))
      (select-frame compilation-frame-id)
      (switch-to-buffer buf))
     (t
      (set-buffer buf)))
    (save-match-data 
      (and (or arg
	       (null cvs-next-diff-started)
	       (not (equal cvs-next-diff-started obuf)))
	   (goto-char (point-min))
	   (not (re-search-forward diff-section nil t))
	   (error "cvs-next-diff: no diff section found."))
      (setq cvs-next-diff-started obuf)
      (end-of-line)
      (if (not (re-search-forward diff-insertion nil t))
	  (progn (message "No more diffs.")
		 (setq cvs-next-diff-started nil)))
      (setq lineno -1)
      (setq diffno (point))
      (setq found nil)
      (while (progn
	       (cond
		((looking-at diff-section)
		 (setq found t)
		 (setq secno (string-to-number (match-string 3)))
		 (goto-char diffno)
		 (beginning-of-line)
		 (select-frame ofrm)
		 (switch-to-buffer obuf)
		 (goto-line secno)
		 (forward-line lineno))
		((not (looking-at diff-deletion))
		 (setq lineno (1+ lineno))))
	       (and (not found)
		    (setq eof (forward-line -1))
		    (= eof 0)))))))


---------------------------+--------------------------------------------------
Christian Lynbech          | Ericsson Telebit A/S                       
Fax:   +45 8628 8186       | Fabrikvej 11, DK-8260 Viby J
Phone: +45 8738 2228       | email: chl@tbit.dk --- URL: http://www.tbit.dk
---------------------------+--------------------------------------------------
Hit the philistines three times over the head with the Elisp reference manual.
                                        - petonic@hal.com (Michael A. Petonic)

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]