First of all, thanks for TMDA; it's brilliant.  Although I'm still
new to it, I've already been able to bring its existence to the
attention to a few of my friends, who have thanked me hugely for the
favor -- so consider this your share of the limelight.  ;-}

   Please accept the following patch to contrib/tmda.el that does the
following:

   * Now runs in FSF emacs 21.3.
   * Fixes a macro error that stopped it from being compiled in any emacs.
   * Fixes five message calls with missing format-string.
   * Adds a new tmda-pending-backward-clear command.

Details are in the attached ChangeLog entry.  (The patch is to the 1.0.2
release of TMDA, but I notice that contrib/tmda.el last changed in CVS
17 months ago.)  I also tested this patch with xemacs 21.4, albeit
lightly.  Both emacsen were the versions shipped with SuSE 9.0.

   On somewhat larger scale, I find it unfortunate that there is no
tmda-pending-mode.  This would make C-h m work for documentation, not to
mention providing a place for customization hooks.  Is there any
interest in a tmda-pending-mode?  Is the original author still
maintaining this file?

   Thanks again,

                                        -- Bob Rogers
                                           http://rgrjr.dyndns.org/

2004-04-03  Bob Rogers  <[EMAIL PROTECTED]>

        * tmda.el (tmda-pending-buffer-kill):  FSF emacs `=' expects 2 args.
        (tmda-pending-command): Remove comma that prevented compilation.
        (tmda-pending-tag-command): FSF emacs delete-char needs an arg.
        (tmda-pending-changelist): FSF emacs has no copy-tree defaultly.
        (tmda-check-version): Fix logic error in versions >= 1.*.
        (tmda-add-to-list, tmda-generate-address, tmda-pending-apply-changes):
        supply missing format string (fixes a bug in processing of
        output that contains '%').

        * tmda.el (tmda-pending-backward-clear):  New command, bound to
        DEL.
--- tmda.el.orig        2002-11-13 23:35:14.000000000 -0500
+++ tmda.el     2004-04-25 12:21:41.000000000 -0400
@@ -458,14 +458,14 @@
                         "Blacklist sender wildcard in summary buffer.")
 
 (defun tmda-add-to-list (addr file)
-  (message (concat "Adding to " file " ..."))
+  (message "Adding to %s ..." file)
   (let ((require-final-newline t))
     (with-temp-buffer
       (insert-file-contents-literally file)
       (goto-char (point-min))
       (if (re-search-forward
           (concat "^" (regexp-quote addr) "$") nil t)
-         (message (concat addr " already in " file))
+         (message "%s already in %s" addr file)
        (goto-char (point-max))
        (insert addr)
        (write-file file)))))
@@ -571,7 +571,7 @@
                 nil))))
     (if string
        (progn
-         (message string)
+         (message "%s" string)
          (kill-new string))
       (message "Invalid syntax, please try again."))))
 
@@ -580,13 +580,11 @@
 (defun tmda-pending-buffer-kill ()
   (interactive)
   (let* ((changes (tmda-pending-changelist))
-         (dcount (length (cdr (assoc ?d changes))))
-         (rcount (length (cdr (assoc ?r changes))))
-        (quit
-         (if (not (= 0 dcount rcount))
-              (y-or-n-p
-               "Quit tmda-pending buffer without applying changes? ")
-           t)))
+        (quit (if (or (cdr (assoc ?d changes))
+                      (cdr (assoc ?r changes)))
+                  (y-or-n-p
+                   "Quit tmda-pending buffer without applying changes? ")
+                  t)))
     (when quit
       (kill-buffer tmda-pending-buffer))))
 
@@ -646,7 +644,7 @@
 
 (defmacro tmda-pending-command (&rest forms)
   "Make the tmda-pending commands a little easier to read."
-  `(let ((msg ,(tmda-pending-msg)))
+  `(let ((msg (tmda-pending-msg)))
      (if msg
         (progn
           ,@forms)
@@ -670,7 +668,7 @@
      (beginning-of-line)
      (forward-char)
      (toggle-read-only 0)
-     (delete-char)
+     (delete-char 1)
      (insert char)
      (toggle-read-only 1))
    (when tmda-pending-tag-auto-advance
@@ -688,18 +686,26 @@
   (interactive)
   (tmda-pending-tag-command " "))
 
+(defun tmda-pending-backward-clear ()
+  "Clear any tagged operation on the previous line."
+  (interactive)
+  (let ((tmda-pending-tag-auto-advance nil))
+    (if (tmda-pending-prev-msg)
+       (tmda-pending-tag-command " ")
+       (error "No previous message."))))
+
 (defun tmda-pending-changelist ()
   (save-excursion
     (goto-char (point-min))
     (let (msg
           (first t)
-          (changelist (copy-tree '((?d) (?r)))))
+          (changelist (mapcar (function list) '(?d ?r))))
       (while (or first (tmda-pending-next-msg))
        (when (setq msg (tmda-pending-msg))
-         (let ((tag (save-excursion (forward-char 1)
-                                    (char-after))))
-           (when (not (eq tag ? ))
-              (push msg (cdr (assoc tag changelist))))))
+         (let* ((tag (char-after (1+ (point))))
+                (cell (assoc tag changelist)))
+           (if cell
+               (setcdr cell (cons msg (cdr cell))))))
        (setq first nil))
       changelist)))
 
@@ -711,14 +717,14 @@
     (message "Processing...")
     (when (< 0 (length dels))
       (message "Processing...deletes")
-      (message (shell-command-to-string
-                (format "tmda-pending -b -d %s"
-                        (mapconcat 'identity dels " ")))))
+      (message "%s" (shell-command-to-string
+                    (format "tmda-pending -b -d %s"
+                            (mapconcat 'identity dels " ")))))
     (when (< 0 (length rels))
       (message "Processing...releases")
-      (message (shell-command-to-string
-                (format "tmda-pending -b -r %s"
-                        (mapconcat 'identity rels " "))))))
+      (message "%s" (shell-command-to-string
+                    (format "tmda-pending -b -r %s"
+                            (mapconcat 'identity rels " "))))))
   (sleep-for 0.5)
   (message "Processing...refreshing pending list")
   (tmda-pending-refresh-buffer)
@@ -748,6 +754,7 @@
   (local-set-key "d" 'tmda-pending-delete)
   (local-set-key "c" 'tmda-pending-clear-mark)
   (local-set-key " " 'tmda-pending-clear-mark)
+  (local-set-key "\C-?" 'tmda-pending-backward-clear)
   (local-set-key "x" 'tmda-pending-apply-changes)
   (local-set-key "n" 'tmda-pending-next-msg)
   (local-set-key "p" 'tmda-pending-prev-msg)
@@ -774,9 +781,12 @@
 
 (defun tmda-check-version ()
   (let ((ver (shell-command-to-string "tmda-keygen --version")))
-    (string-match "\\([0-9]+\\)\\.\\([0-9]+\\)" ver)
-    (and (>= (string-to-int (match-string 1 ver)) tmda-major-ver-req)
-        (>= (string-to-int (match-string 2 ver)) tmda-minor-ver-req))))
+    (and (string-match "\\([0-9]+\\)\\.\\([0-9]+\\)" ver)
+        (let ((major (string-to-int (match-string 1 ver))))
+          (or (> major tmda-major-ver-req)
+              (and (= major tmda-major-ver-req)
+                   (>= (string-to-int (match-string 2 ver))
+                       tmda-minor-ver-req)))))))
 
 ;; utility function to setup keybindings
 
_________________________________________________
tmda-workers mailing list ([EMAIL PROTECTED])
http://tmda.net/lists/listinfo/tmda-workers

Reply via email to