1 ;;; planner-log-edit.el --- Record VC commits as a note in todays planner file
3 ;; Copyright (C) 2004 Simon Winwood (sjw AT cse.unsw.edu.au)
4 ;; Parts copyright (C) 2004 Free Software Foundation, Inc.
5 ;; Parts copyright (C) 2004 Dryice Dong Liu (dryice AT liu.com.cn)
6 ;; Parts copyright (C) 2005 Yann Hodique (yann.hodique AT gmail.com)
8 ;; Author: Simon Winwood <sjw@cse.unsw.edu.au>
10 ;; Keywords: planner, vc, pcl-cvs, log-edit
12 ;; This file is free software; you can redistribute it and/or modify
13 ;; it under the terms of the GNU General Public License as published by
14 ;; the Free Software Foundation; either version 2, or (at your option)
17 ;; This file is distributed in the hope that it will be useful,
18 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
19 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 ;; GNU General Public License for more details.
22 ;; You should have received a copy of the GNU General Public License
23 ;; along with GNU Emacs; see the file COPYING. If not, write to
24 ;; the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
25 ;; Boston, MA 02110-1301, USA.
29 ;; This file records cvs (and VC) commits into todays planner file.
33 ;; Dryice Dong Liu (dryice AT liu.com.cn) provided the
34 ;; `planner-log-edit-quote-filenames-flag' option and patched the code
37 ;; Yann Hodique added the possibility to ignore patterns before
38 ;; inserting commit messages as notes (useful for psvn) via the new
39 ;; `planner-log-edit-flush-regexp-list' option.
46 (defgroup planner-log-edit nil
47 "Planner options for log-edit."
48 :prefix
"planner-log-edit-"
51 (defcustom planner-log-edit-include-files-flag
53 "Non-nil means include a list of committed files in the note."
55 :group
'planner-log-edit
)
57 (defcustom planner-log-edit-quote-filenames-flag
59 "Non-nil means quote the file names with \"=\"."
61 :group
'planner-log-edit
)
63 (defcustom planner-log-edit-notice-commit-function t
64 "Function that should return non-nil if this commit should be noted.
65 The function will be run in the log buffer."
67 (const :tag
"Always note commits" t
)
69 :group
'planner-log-edit
)
71 (defcustom planner-log-edit-flush-regexp-list
73 "List of regexps to flush before inserting note"
74 :type
'(repeat regexp
)
75 :group
'planner-log-edit
)
77 (defcustom planner-log-edit-module-name-function
'planner-log-edit-cvs-module
78 "Function that should return a name for the current module."
80 :group
'planner-log-edit
)
82 (defun planner-log-edit-quote-file-maybe (arg)
83 "Quote ARG if `planner-log-edit-quote-filenames-flag is non-nil."
84 (if planner-log-edit-quote-filenames-flag
88 (defun planner-log-edit-cvs-module ()
90 (when (fboundp 'cvs-get-module
) (cvs-get-module))))
93 (defun planner-log-edit-add-note ()
94 "Add a note describing the commit to the current planner page."
95 (let* ((buffer (current-buffer))
96 (files (log-edit-files))
97 ;; This should be a function call into log-edit, but until it
99 (module-name (funcall planner-log-edit-module-name-function
)))
100 (if (if (functionp planner-log-edit-notice-commit-function
)
101 (funcall planner-log-edit-notice-commit-function
)
102 planner-log-edit-notice-commit-function
)
104 (save-window-excursion
105 (planner-create-note nil
)
109 (planner-log-edit-quote-file-maybe
113 (when planner-log-edit-include-files-flag
115 (insert (mapconcat 'planner-log-edit-quote-file-maybe files
" "))
120 (insert-buffer-substring buffer
)
121 (goto-char (point-min))
122 (mapc (lambda (regexp)
123 (flush-lines regexp
))
124 planner-log-edit-flush-regexp-list
)
126 ;(insert-buffer-substring buffer)
129 (add-hook 'log-edit-done-hook
'planner-log-edit-add-note
)
131 (provide 'planner-log-edit
)
133 ;;; planner-log-edit.el ends here