* message.el (message-make-overlay): Defalias it to make-overlay.
[gnus] / lisp / message.el
index 13a2aec..eb1ab4e 100644 (file)
@@ -1288,8 +1288,13 @@ no, only reply back to the author."
   :link '(custom-manual "(message)News Headers")
   :type 'string)
 
-(defcustom message-use-idna 'ask
+(defcustom message-use-idna (and (condition-case nil (require 'idna)
+                                  (file-error))
+                                (fboundp 'coding-system-p)
+                                (coding-system-p 'utf-8)
+                                'ask)
   "Whether to encode non-ASCII in domain names into ASCII according to IDNA."
+  :group 'message-headers
   :type '(choice (const :tag "Ask" ask)
                 (const :tag "Never" nil)
                 (const :tag "Always" t)))
@@ -3906,7 +3911,7 @@ Otherwise, generate and save a value for `canlock-password' first."
    ;; Check "Shoot me".
    (message-check 'shoot
      (if (re-search-forward
-         "Message-ID.*.i-did-not-set--mail-host-address--so-shoot-me" nil t)
+         "Message-ID.*.i-did-not-set--mail-host-address--so-tickle-me" nil t)
         (y-or-n-p "You appear to have a misconfigured system.  Really post? ")
        t))
    ;; Check for Approved.
@@ -4651,9 +4656,11 @@ I.e., calling it on a Subject: header is useless."
        (incf paren))
       (and (= (% dquote 2) 1) (= (% paren 2) 1)))))
 
+(autoload 'idna-to-ascii "idna")
+
 (defun message-idna-to-ascii-rhs-1 (header)
   "Interactively potentially IDNA encode domain names in HEADER."
-  (let (rhs ace start end startpos endpos)
+  (let (rhs ace start end startpos endpos ovl)
     (goto-char (point-min))
     (setq start (re-search-forward (concat "^" header) nil t)
          end (or (save-excursion (re-search-forward "^[ \t]" nil t))
@@ -4670,11 +4677,13 @@ I.e., calling it on a Subject: header is useless."
                     (if (eq message-use-idna 'ask)
                         (unwind-protect
                             (progn
-                              (replace-highlight startpos endpos)
+                              (setq ovl (message-make-overlay startpos
+                                                              endpos))
+                              (message-overlay-put ovl 'face 'highlight)
                               (y-or-n-p
                                (format "Replace with `%s'? " ace)))
                           (message "")
-                          (replace-dehighlight))
+                          (message-delete-overlay ovl))
                       message-use-idna)))
          (replace-match (concat "@" ace)))))))
 
@@ -4682,7 +4691,7 @@ I.e., calling it on a Subject: header is useless."
   "Possibly IDNA encode non-ASCII domain names in From:, To: and Cc: headers.
 See `message-idna-encode'."
   (interactive)
-  (when (condition-case nil (require 'idna) (file-error))
+  (when message-use-idna
     (save-excursion
       (save-restriction
        (message-narrow-to-head)
@@ -6129,6 +6138,9 @@ which specify the range to operate on."
            (delete-char -2))))))
 
 (defalias 'message-exchange-point-and-mark 'exchange-point-and-mark)
+(defalias 'message-make-overlay 'make-overlay)
+(defalias 'message-delete-overlay 'delete-overlay)
+(defalias 'message-overlay-put 'overlay-put)
 
 ;; Support for toolbar
 (eval-when-compile