]> code.delx.au - gnu-emacs/blobdiff - lisp/gnus/message.el
Merge branch 'master' of git.sv.gnu.org:/srv/git/emacs
[gnu-emacs] / lisp / gnus / message.el
index d4313e0b2f9e07299a29c1b6533108a817413e71..03ce789e9eb1229303e87d800f31c5660fd087c2 100644 (file)
@@ -48,6 +48,7 @@
 (require 'dired)
 (require 'mm-util)
 (require 'rfc2047)
+(require 'puny)
 
 (autoload 'mailclient-send-it "mailclient")
 
@@ -1756,25 +1757,9 @@ no, only reply back to the author."
   :type '(radio (const :format "%v  " nil)
                (string :format "FQDN: %v")))
 
-(defcustom message-use-idna
-  (and (or (mm-coding-system-p 'utf-8)
-          (condition-case nil
-              (let (mucs-ignore-version-incompatibilities)
-                (require 'un-define))
-            (error)))
-       (condition-case nil
-          (require 'idna)
-        (file-error)
-        (invalid-operation))
-       idna-program
-       (executable-find idna-program)
-       (string= (idna-to-ascii "räksmörgås") "xn--rksmrgs-5wao1o")
-       t)
-  "Whether to encode non-ASCII in domain names into ASCII according to IDNA.
-GNU Libidn, and in particular the elisp package \"idna.el\" and
-the external program \"idn\", must be installed for this
-functionality to work."
-  :version "22.1"
+(defcustom message-use-idna t
+  "Whether to encode non-ASCII in domain names into ASCII according to IDNA."
+  :version "25.2"
   :group 'message-headers
   :link '(custom-manual "(message)IDNA")
   :type '(choice (const :tag "Ask" ask)
@@ -1926,7 +1911,6 @@ You must have the \"hashcash\" binary installed, see `hashcash-path'."
 (autoload 'gnus-output-to-rmail "gnus-util")
 (autoload 'gnus-request-post "gnus-int")
 (autoload 'gnus-server-string "gnus")
-(autoload 'idna-to-ascii "idna")
 (autoload 'message-setup-toolbar "messagexmas")
 (autoload 'mh-new-draft-name "mh-comp")
 (autoload 'mh-send-letter "mh-comp")
@@ -3879,8 +3863,13 @@ This function uses `mail-citation-hook' if that is non-nil."
 (defun message-insert-formatted-citation-line (&optional from date tz)
   "Function that inserts a formatted citation line.
 The optional FROM, and DATE are strings containing the contents of
-the From header and the Date header respectively.  The optional TZ
-is a number of seconds, overrides the time zone of DATE.
+the From header and the Date header respectively.
+
+The optional TZ is omitted or nil for Emacs local time, t for
+Universal Time, `wall' for system wall clock time, or a string as
+in the TZ environment variable.  It can also be a list (as from
+`current-time-zone') or an integer (as from `decode-time')
+applied without consideration for daylight saving time.
 
 See `message-citation-line-format'."
   ;; The optional args are for testing/debugging.  They will disappear later.
@@ -3971,7 +3960,7 @@ See `message-citation-line-format'."
                               (>= i ?a)))
                  (push i lst)
                  (push (condition-case nil
-                           (gmm-format-time-string (format "%%%c" i) time tz)
+                           (format-time-string (format "%%%c" i) time tz)
                          (error (format ">%c<" i)))
                        lst))
                (setq i (1+ i)))
@@ -4556,7 +4545,7 @@ This function could be useful in `message-setup-hook'."
          (setq message-options options)
          ;; Avoid copying text props (except hard newlines).
          (insert (with-current-buffer mailbuf
-                   (mml-buffer-substring-no-properties-except-hard-newlines
+                   (mml-buffer-substring-no-properties-except-some
                     (point-min) (point-max))))
          ;; Remove some headers.
          (message-encode-message-body)
@@ -4920,7 +4909,7 @@ Otherwise, generate and save a value for `canlock-password' first."
              ;; Avoid copying text props (except hard newlines).
              (insert
               (with-current-buffer messbuf
-                (mml-buffer-substring-no-properties-except-hard-newlines
+                (mml-buffer-substring-no-properties-except-some
                  (point-min) (point-max))))
              (message-encode-message-body)
              ;; Remove some headers.
@@ -5862,7 +5851,7 @@ subscribed address (and not the additional To and Cc header contents)."
        ;; the domain part, i.e., if it is a local user's address.
        (setq ace (if (string-match "\\`[[:ascii:]]*\\'" rhs)
                      rhs
-                   (downcase (idna-to-ascii rhs))))
+                   (downcase (puny-encode-domain rhs))))
        (when (and (not (equal rhs ace))
                   (or (not (eq message-use-idna 'ask))
                       (y-or-n-p (format "Replace %s with %s in %s:? "
@@ -7637,6 +7626,9 @@ is for the internal use."
             (let ((case-fold-search t))
               (re-search-forward "^mime-version:" nil t)))
            (message-inhibit-ecomplete t)
+           ;; We don't want smtpmail.el to encode anything, either.
+           (sendmail-coding-system 'raw-text)
+           (select-safe-coding-system-function nil)
            message-required-mail-headers
            message-generate-hashcash
            rfc2047-encode-encoded-words)
@@ -8394,30 +8386,32 @@ Used in `message-simplify-recipients'."
 (defun message-toggle-image-thumbnails ()
   "For any included image files, insert a thumbnail of that image."
   (interactive)
-  (let ((overlays (overlays-in (point-min) (point-max)))
-       (displayed nil))
-    (while overlays
-      (let ((overlay (car overlays)))
-       (when (overlay-get overlay 'put-image)
-         (delete-overlay overlay)
-         (setq displayed t)))
-      (setq overlays (cdr overlays)))
+  (let ((displayed nil))
+    (save-excursion
+      (goto-char (point-min))
+      (while (not (eobp))
+       (when-let ((props (get-text-property (point) 'display)))
+         (when (and (consp props)
+                    (eq (car props) 'image))
+           (put-text-property (point) (1+ (point)) 'display nil)
+           (setq displayed t)))))
     (unless displayed
       (save-excursion
        (goto-char (point-min))
-       (while (re-search-forward "<img.*src=\"\\([^\"]+\\)" nil t)
-         (let ((file (match-string 1))
+       (while (re-search-forward "<img.*src=\"\\([^\"]+\\).*>" nil t)
+         (let ((string (match-string 0))
+               (file (match-string 1))
                (edges (window-inside-pixel-edges
                        (get-buffer-window (current-buffer)))))
-           (put-image
+           (delete-region (match-beginning 0) (match-end 0))
+           (insert-image
             (create-image
              file 'imagemagick nil
              :max-width (truncate
                          (* 0.7 (- (nth 2 edges) (nth 0 edges))))
              :max-height (truncate
                           (* 0.5 (- (nth 3 edges) (nth 1 edges)))))
-            (match-beginning 0)
-            " ")))))))
+            string)))))))
 
 (provide 'message)