message.el (message-expand-name): Don't trust the return value of bbdb-complete-name.
authorStefan Monnier <monnier@iro.umontreal.ca>
Tue, 1 Feb 2011 23:41:48 +0000 (23:41 +0000)
committerKatsumi Yamaoka <yamaoka@jpl.org>
Tue, 1 Feb 2011 23:41:48 +0000 (23:41 +0000)
 (message-check-news-header-syntax): Remove unused var `start'.
 (message-idna-to-ascii-rhs-1): Remove unused vars `rhs' and `address'.
 (message-inhibit-body-encoding): Move to before first use.
 (mail-abbrev-mode-regexp, Expires, User-Agent, Lines, Distribution)
 (To, References, In-Reply-To, Newsgroups, Subject, Path, From)
 (Organization, Message-ID, Date, mh-previous-window-config):
 Defvar the vars using dynamic scoping.

lisp/ChangeLog
lisp/message.el

index c3a31de..1f8a385 100644 (file)
@@ -8,6 +8,18 @@
 
        * color.el (color-gradient): Add a color-gradient function.
 
+2011-02-01  Stefan Monnier  <monnier@iro.umontreal.ca>
+
+       * message.el (message-expand-name): Don't trust the return value of
+       bbdb-complete-name.
+       (message-check-news-header-syntax): Remove unused var `start'.
+       (message-idna-to-ascii-rhs-1): Remove unused vars `rhs' and `address'.
+       (message-inhibit-body-encoding): Move to before first use.
+       (mail-abbrev-mode-regexp, Expires, User-Agent, Lines, Distribution)
+       (To, References, In-Reply-To, Newsgroups, Subject, Path, From)
+       (Organization, Message-ID, Date, mh-previous-window-config):
+       Defvar the vars using dynamic scoping.
+
 2011-02-01  Lars Ingebrigtsen  <larsi@gnus.org>
 
        * shr.el (shr-render-td): Only do colours at the final rendering.
index b53a3f1..3f9199c 100644 (file)
@@ -4389,7 +4389,8 @@ This function could be useful in `message-setup-hook'."
        (tembuf (message-generate-new-buffer-clone-locals " message temp"))
        (curbuf (current-buffer))
        (id (message-make-message-id)) (n 1)
-       plist total  header required-mail-headers)
+        required-mail-headers           ;FIXME: Unused, right?  --Stef
+        plist total header)
     (while (not (eobp))
       (if (< (point-max) (+ p message-send-mail-partially-limit))
          (goto-char (point-max))
@@ -4721,6 +4722,8 @@ to find out how to use this."
     ;; should never happen
     (t   (error "qmail-inject reported unknown failure"))))
 
+(defvar mh-previous-window-config)
+
 (defun message-send-mail-with-mh ()
   "Send the prepared message buffer with mh."
   (let ((mh-previous-window-config nil)
@@ -4941,8 +4944,7 @@ Otherwise, generate and save a value for `canlock-password' first."
        t))
    ;; Check long header lines.
    (message-check 'long-header-lines
-     (let ((start (point))
-          (header nil)
+     (let ((header nil)
           (length 0)
           found)
        (while (and (not found)
@@ -4951,7 +4953,6 @@ Otherwise, generate and save a value for `canlock-password' first."
             (setq found t
                   length (- (point) (match-beginning 0)))
           (setq header (match-string-no-properties 1)))
-        (setq start (match-beginning 0))
         (forward-line 1))
        (if found
           (y-or-n-p (format "Your %s header is too long (%d).  Really post? "
@@ -5794,7 +5795,7 @@ subscribed address (and not the additional To and Cc header contents)."
 (defun message-idna-to-ascii-rhs-1 (header)
   "Interactively potentially IDNA encode domain names in HEADER."
   (let ((field (message-fetch-field header))
-       rhs ace  address)
+        ace)
     (when field
       (dolist (rhs
               (mm-delete-duplicates
@@ -5843,6 +5844,21 @@ See `message-idna-encode'."
        (message-idna-to-ascii-rhs-1 "Mail-Followup-To")
        (message-idna-to-ascii-rhs-1 "Cc")))))
 
+(defvar Date)
+(defvar Message-ID)
+(defvar Organization)
+(defvar From)
+(defvar Path)
+(defvar Subject)
+(defvar Newsgroups)
+(defvar In-Reply-To)
+(defvar References)
+(defvar To)
+(defvar Distribution)
+(defvar Lines)
+(defvar User-Agent)
+(defvar Expires)
+
 (defun message-generate-headers (headers)
   "Prepare article HEADERS.
 Headers already prepared in the buffer are not modified."
@@ -6803,7 +6819,8 @@ Useful functions to put in this list include:
   (interactive)
   (require 'gnus-sum)                  ; for gnus-list-identifiers
   (let ((cur (current-buffer))
-       from subject date reply-to to cc
+       from subject date
+        reply-to to cc               ;FIXME: These 3 seem to be unused?  --Stef
        references message-id follow-to
        (inhibit-point-motion-hooks t)
        (message-this-is-mail t)
@@ -7324,7 +7341,7 @@ Optional DIGEST will use digest to forward."
 (defun message-forward-make-body-digest-plain (forward-buffer)
   (insert
    "\n-------------------- Start of forwarded message --------------------\n")
-  (let ((b (point)) e)
+  (let ((b (point)) e)                  ;FIXME: Not used, right?  --Stef
     (mml-insert-buffer forward-buffer)
     (setq e (point))
     (insert
@@ -7448,6 +7465,8 @@ is for the internal use."
   (setq rmail-insert-mime-forwarded-message-function
        'message-forward-rmail-make-body))
 
+(defvar message-inhibit-body-encoding nil)
+
 ;;;###autoload
 (defun message-resend (address)
   "Resend the current article to ADDRESS."
@@ -7834,6 +7853,8 @@ those headers."
                    (lookup-key global-map "\t")
                    'indent-relative)))))
 
+(defvar mail-abbrev-mode-regexp)
+
 (defun message-completion-function ()
   (let ((alist message-completion-alist))
     (while (and alist
@@ -7911,7 +7932,12 @@ those headers."
         (eudc-expand-inline))
        ((and (memq 'bbdb message-expand-name-databases)
              (fboundp 'bbdb-complete-name))
-        (bbdb-complete-name))
+         (let ((starttick (buffer-modified-tick)))
+           (or (bbdb-complete-name)
+               ;; Apparently, bbdb-complete-name can return nil even when
+               ;; completion took place.  So let's double check the buffer was
+               ;; not modified.
+               (/= starttick (buffer-modified-tick)))))
        (t
         (expand-abbrev))))
 
@@ -7972,8 +7998,6 @@ regexp VARSTR."
 ;;; MIME functions
 ;;;
 
-(defvar message-inhibit-body-encoding nil)
-
 (defun message-encode-message-body ()
   (unless message-inhibit-body-encoding
     (let ((mail-parse-charset (or mail-parse-charset