Commits

youngs  committed b82b9e8

2002-02-22 Steve Youngs <youngs@xemacs.org>

* package-info.in: Add patch-keywords.

* Makefile (REQUIRES): Add gnus for 'patch-keywords.el'.
(ELCS): Add patch-keywords.elc

2002-01-18 Adrian Aichner <adrian@xemacs.org>

* patch-keywords.el (patch-keywords-insert): Don't abbreviate
numeric keywords.

2002-01-17 Steve Youngs <youngs@xemacs.org>

* patch-keywords.el (patch-keywords): Update doc string.

2002-01-16 Adrian Aichner <adrian@xemacs.org>

* patch-keywords.el (patch-keywords): Use full release numbers.
(patch-keywords-insert): Use last digit of numeric keyword.

2002-01-15 Adrian Aichner <adrian@xemacs.org>

* patch-keywords.el: Typo fix.
(patch-keywords-message-beginning-of-line): Use
`patch-keywords-in-header-p' in older gnus-versions < 5.090004.
(patch-keywords-insert): Supply version argument to
`gnus-continuum-version'. It wasn't optional in gnus-versions
< 5.090004.

2002-01-14 Steve Youngs <youngs@xemacs.org>

* patch-keywords.el: New.

  • Participants
  • Parent commits 44c34a9

Comments (0)

Files changed (4)

+2002-02-22  Steve Youngs  <youngs@xemacs.org>
+
+	* package-info.in: Add patch-keywords.
+
+	* Makefile (REQUIRES): Add gnus for 'patch-keywords.el'.
+	(ELCS): Add patch-keywords.elc
+
+2002-01-18  Adrian Aichner  <adrian@xemacs.org>
+
+	* patch-keywords.el (patch-keywords-insert): Don't abbreviate
+	numeric keywords.
+
+2002-01-17  Steve Youngs  <youngs@xemacs.org>
+
+	* patch-keywords.el (patch-keywords): Update doc string.
+
+2002-01-16  Adrian Aichner  <adrian@xemacs.org>
+
+	* patch-keywords.el (patch-keywords): Use full release numbers.
+	(patch-keywords-insert): Use last digit of numeric keyword.
+
+2002-01-15  Adrian Aichner  <adrian@xemacs.org>
+
+	* patch-keywords.el: Typo fix.
+	(patch-keywords-message-beginning-of-line): Use
+	`patch-keywords-in-header-p' in older gnus-versions < 5.090004.
+	(patch-keywords-insert): Supply version	argument to
+	`gnus-continuum-version'.  It wasn't optional in gnus-versions 
+	< 5.090004. 
+
+2002-01-14  Steve Youngs  <youngs@xemacs.org>
+
+	* patch-keywords.el: New.
+
 2002-02-08  Simon Josefsson  <jas@extundo.com>
 
 	* elp.el: Change maintainer to XEmacs dev team exclusively.
 MAINTAINER = XEmacs Development Team <xemacs-beta@xemacs.org>
 PACKAGE = xemacs-devel
 PKG_TYPE = single-file
-REQUIRES = xemacs-base ispell mail-lib
+REQUIRES = xemacs-base ispell mail-lib gnus
 CATEGORY = standard
 
 ELCS = bench.elc checkdoc.elc docref.elc eldoc.elc elp.elc eval-expr.elc \
 	find-func.elc find-gc.elc hide-copyleft.elc ielm.elc \
 	lisp-file-db.elc patcher.elc profile.elc pretty-print.elc \
-	reposition.elc trace.elc
+	reposition.elc trace.elc patch-keywords.elc
 
 include ../../XEmacs.rules
 

File package-info.in

    filename FILENAME
    md5sum MD5SUM
    size SIZE
-   provides (checkdoc docref eldoc elp eval-expr find-func hide-copyleft ielm patcher pp trace)
+   provides (checkdoc docref eldoc elp eval-expr find-func hide-copyleft ielm patcher pp trace patch-keywords)
    requires (REQUIRES)
    type single
 ))

File patch-keywords.el

+;;; patch-keywords.el --- Insert action keywords into patch followups.
+
+;; Copyright (C) 2002 Steve Youngs
+
+;; RCS: $Id$
+;; Author:        Steve Youngs <youngs@xemacs.org>
+;; Maintainer:    Steve Youngs <youngs@xemacs.org>
+;; Created:       2002-01-14
+;; Last-Modified: <2002-01-24 09:59:57 (steve)>
+;; Keywords:      maint
+
+;; This file is part of XEmacs
+
+;; XEmacs 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 of the License, or
+;; (at your option) any later version.
+
+;; XEmacs is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+;; GNU General Public License for more details.
+
+;; You should have received a copy of the GNU General Public License
+;; along with this program; if not, write to the Free Software
+;; Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+
+
+;;; Commentary:
+;;
+;;  This file is an aid to mailing followups to patches submitted via
+;;  email.  It adds "Reviewer Action Keywords" to the message.  These
+;;  "keywords" can later be used as an aid to patch tracking.
+
+;;  At this stage, this file is probably only useful to anyone who
+;;  reviews patches submitted to <xemacs-patches@xemacs.org> (and is
+;;  using Gnus for email).
+
+;;  To use: simply add '(require 'patch-keywords)' to your
+;;  '~/.xemacs/init.el' and then when you are following up to a patch
+;;  submission (in `message-mode') hitting 'M-p' will prompt you for
+;;  the keywords you wish to add to the message.
+
+;;  The keywords are added to 3 separate places in the message.
+;;    - In abbreviated form (1st character of each keyword) enclosed
+;;      in square brackets at the start of the subject header.
+;;
+;;    - In a "X-Reviewer-Action:" header (full keywords).
+;;
+;;    - At line 0, column 0 of the message body.
+
+;;  To see how to setup a "X-Reviewer-Action:" header, see
+;;  `gnus-posting-styles'
+
+;;  Many thanks to Adrian Aichner <adrian@xemacs.org> for his ideas,
+;;  code examples and testing.
+
+;;; Code:
+(eval-when-compile
+  (require 'message)
+  (autoload 'gnus-continuum-version "gnus"))
+
+(defgroup patch-review nil
+  "Patch submission review."
+  :group 'mail)
+
+(defcustom patch-keywords
+  '("APPROVE"
+    "COMMIT"
+    "FORWARD"
+    "QUERY"
+    "RECOMMEND"
+    "SUPERSEDES"
+    "VETO"
+    "21.4"
+    "21.5")
+  "List of keywords used for reviewing patches.
+
+The default values are the keywords currently used by the XEmacs
+Review Board.  There is a slight inconsistency here because \"4\"
+and \"5\" are not complete keywords.  They represent \"21.4\" and
+\"21.5\" respectively.  They are cut down here for the convenience
+of a `replace-match'."
+  :group 'patch-review
+  :type '(repeat (string :tag "Review Action Keyword"))
+  :tag "Action Keywords")
+
+(defcustom patch-review-mua 'gnus
+  "The MUA (Mail User Agent) you use for reviewing patches.
+
+Currently, the only MUA that is supported is Gnus.  VM isn't supported
+yet, but hopefully soon.  Should we even bother with things like MEW
+or Rmail?"
+  :group 'patch-review
+  :type '(choice
+	  (item gnus)
+	  (item vm\ \(Not\ Supported\))
+	  (item mew\ \(Not\ Supported\))
+	  (item rmail\ \(Not\ Supported\)))
+  :tag "MUA")
+
+(defcustom patch-keywords-followup-to "XEmacs Beta <xemacs-beta@xemacs.org>"
+  "The address to put into the \"Mail-Followup-To:\" header.
+This is so that any further discussions relating to the submitted
+patch can take place in a separate forum."
+  :group 'patch-review
+  :type 'string
+  :tag "Followups Address")
+
+;; I use the bleeding edge Gnus (Oort 0.05), so consequently we have
+;; to define a couple of functions that aren't in the XEmacs package
+;; version of Gnus (5.8.8).  Later on they're wrapped in a version
+;; test.
+(defun patch-keywords-in-header-p ()
+  "Return t if point is in the header.
+Same as `message-point-in-header-p' which exists in Gnus Oort, but not
+in Gnus 5.8.8"
+  (save-excursion
+    (let ((p (point)))
+      (goto-char (point-min))
+      (not (re-search-forward
+ 	    (concat "^" (regexp-quote mail-header-separator) "\n")
+ 	    p t)))))
+
+(defun patch-keywords-message-beginning-of-line (&optional n)
+  "Move point to beginning of header value or to beginning of line.
+Optional argument N non-nil or 1, move forward N - 1 lines first.
+Same as `message-beginning-of-line' which exists in Gnus Oort, but not
+in Gnus 5.8.8."
+  (interactive "p")
+  (if (if (< (gnus-continuum-version gnus-version) 5.090004)
+	(patch-keywords-in-header-p)
+      (message-point-in-header-p))
+      (let* ((here (point))
+	     (bol (progn (beginning-of-line n) (point)))
+	     (eol (gnus-point-at-eol))
+	     (eoh (re-search-forward ": *" eol t)))
+	(if (or (not eoh) (equal here eoh))
+	    (goto-char bol)
+	  (goto-char eoh)))
+    (beginning-of-line n)))
+
+(defun patch-keywords-insert (patch-key)
+  "Insert the action keywords into patch followups.
+
+Argument PATCH-KEY A list of action keywords as defined in
+`patch-keywords'.  They may be chosen interactively via the
+history mechanism.
+
+Insert abbreviated (1st char) keywords at the beginning of the subject
+header.  Full keywords into the \"X-Reviewer-Action:\" header, if
+present, and also at the start of the message body.
+
+The \"X-Reviewer-Action:\" header can be easily inserted using
+`gnus-posting-styles'.
+
+This function also sets followups to xemacs-beta@xemacs.org."
+  (interactive
+   (let
+       ((hist patch-keywords)
+        key
+        keys)
+     (while (not
+             (string-equal
+              (setq key
+                    (read-string
+		     "Enter patch keywords (or RET to finish): " "" 'hist))
+              ""))
+       (setq keys (cons key keys)))
+     (list (mapconcat 'identity (reverse keys) " "))))
+  (if (string-equal patch-key "")
+      (error "Choose at least one patch-key from %s"
+             (mapconcat 'identity patch-keywords ", ")))
+  (save-excursion
+    ;; We need to preserve the original subject header so something
+    ;; like "fix for 21.5 not for 21.4" doesn't turn into "fix for
+    ;; 21.5not for 21.4"
+    (message-goto-subject)
+    (if (< (gnus-continuum-version gnus-version) 5.090004)
+	(patch-keywords-message-beginning-of-line)
+      (message-beginning-of-line))
+    (re-search-forward ".*$" (eolp) t)
+    (let ((oldsub (match-string 0))
+	  (keywords (concat "\\("
+			    (regexp-opt patch-keywords)
+			    "\\) ")))
+      ;; Clear the original subject (reinstate it later)
+      (if (< (gnus-continuum-version gnus-version) 5.090004)
+	  (patch-keywords-message-beginning-of-line)
+	(message-beginning-of-line))
+      (if (re-search-forward ".*$" (eolp) t)
+	  (replace-match ""))
+      ;; Insert the long patch keywords
+      (insert-string
+       (concat "[" patch-key " ]"))
+      (insert-string " ")
+      ;; Convert to abbreviated patch keywords
+      (if (< (gnus-continuum-version gnus-version) 5.090004)
+	  (patch-keywords-message-beginning-of-line)
+	(message-beginning-of-line))
+      (save-restriction
+        (narrow-to-region (point) (point-at-eol))
+        (while (re-search-forward keywords (eolp) t)
+          (let ((keyword (match-string 1)))
+            (if (save-match-data
+                  (string-match "\\`[.0-9]+\\'" keyword))
+                (replace-match (match-string 1))
+              (replace-match (substring (match-string 1) 0 1))))))
+      ;; Reinstate the original subject header after the keywords
+      (end-of-line)
+      (insert-string oldsub))
+    ;; Insert keywords into the 'X-Reviewer-Action:' header
+    (goto-line 0)
+    (if (re-search-forward "^X-Reviewer-Action: " nil t)
+	(insert-string patch-key))
+    ;; Set followups to go to xemacs-beta
+    (if (< (gnus-continuum-version gnus-version) 5.090004)
+	(message-position-on-field "Mail-Followup-To" "From")
+      (message-goto-mail-followup-to))
+    (insert-string patch-keywords-followup-to)
+    ;; Insert the keywords into the body of the message
+    (message-goto-body)
+    (insert-string patch-key)
+    (insert-string "\n\n")))
+
+;; Bind 'patch-keywords-insert' to M-p in 'message-mode'
+(define-key message-mode-map "\M-p" 'patch-keywords-insert)
+
+(provide 'patch-keywords)
+
+;;; patch-keywords.el ends here
+
+;Local Variables:
+;time-stamp-start: "Last-Modified:[ 	]+\\\\?[\"<]+"
+;time-stamp-end: "\\\\?[\">]"
+;time-stamp-line-limit: 10
+;time-stamp-format: "%4y-%02m-%02d %02H:%02M:%02S (%u)"
+;End: