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 part of Planner. It is not part of GNU Emacs.
14 ;; Planner is free software; you can redistribute it and/or modify it
15 ;; under the terms of the GNU General Public License as published by
16 ;; the Free Software Foundation; either version 2, or (at your option)
19 ;; Planner is distributed in the hope that it will be useful, but
20 ;; WITHOUT ANY WARRANTY; without even the implied warranty of
21 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
22 ;; General Public License for more details.
24 ;; You should have received a copy of the GNU General Public License
25 ;; along with Planner; see the file COPYING. If not, write to the
26 ;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
27 ;; Boston, MA 02110-1301, USA.
31 ;; This file records cvs (and VC) commits into todays planner file.
35 ;; Dryice Dong Liu (dryice AT liu.com.cn) provided the
36 ;; `planner-log-edit-quote-filenames-flag' option and patched the code
39 ;; Yann Hodique added the possibility to ignore patterns before
40 ;; inserting commit messages as notes (useful for psvn) via the new
41 ;; `planner-log-edit-flush-regexp-list' option.
48 (defgroup planner-log-edit nil
49 "Planner options for log-edit."
50 :prefix
"planner-log-edit-"
53 (defcustom planner-log-edit-include-files-flag
55 "Non-nil means include a list of committed files in the note."
57 :group
'planner-log-edit
)
59 (defcustom planner-log-edit-quote-filenames-flag
61 "Non-nil means quote the file names with \"=\"."
63 :group
'planner-log-edit
)
65 (defcustom planner-log-edit-notice-commit-function t
66 "Function that should return non-nil if this commit should be noted.
67 The function will be run in the log buffer."
69 (const :tag
"Always note commits" t
)
71 :group
'planner-log-edit
)
73 (defcustom planner-log-edit-flush-regexp-list
75 "List of regexps to flush before inserting note"
76 :type
'(repeat regexp
)
77 :group
'planner-log-edit
)
79 (defcustom planner-log-edit-module-name-function
'planner-log-edit-cvs-module
80 "Function that should return a name for the current module."
82 :group
'planner-log-edit
)
84 (defun planner-log-edit-quote-file-maybe (arg)
85 "Quote ARG if `planner-log-edit-quote-filenames-flag is non-nil."
86 (if planner-log-edit-quote-filenames-flag
90 (defun planner-log-edit-cvs-module ()
92 (when (fboundp 'cvs-get-module
) (cvs-get-module))))
95 (defun planner-log-edit-add-note ()
96 "Add a note describing the commit to the current planner page."
97 (let* ((buffer (current-buffer))
98 (files (log-edit-files))
99 ;; This should be a function call into log-edit, but until it
101 (module-name (funcall planner-log-edit-module-name-function
)))
102 (if (if (functionp planner-log-edit-notice-commit-function
)
103 (funcall planner-log-edit-notice-commit-function
)
104 planner-log-edit-notice-commit-function
)
106 (save-window-excursion
107 (planner-create-note nil
)
111 (planner-log-edit-quote-file-maybe
115 (when planner-log-edit-include-files-flag
117 (insert (mapconcat 'planner-log-edit-quote-file-maybe files
" "))
122 (insert-buffer-substring buffer
)
123 (goto-char (point-min))
124 (mapc (lambda (regexp)
125 (flush-lines regexp
))
126 planner-log-edit-flush-regexp-list
)
128 ;(insert-buffer-substring buffer)
131 (add-hook 'log-edit-done-hook
'planner-log-edit-add-note
)
133 (provide 'planner-log-edit
)
135 ;;; planner-log-edit.el ends here