unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Juri Linkov <juri@linkov.net>
To: Glenn Morris <rgm@gnu.org>
Cc: 33055@debbugs.gnu.org
Subject: bug#33055: 27.0.50; load-prefer-newer loads wrong file
Date: Wed, 17 Oct 2018 01:44:52 +0300	[thread overview]
Message-ID: <87r2gpmryz.fsf@mail.linkov.net> (raw)
In-Reply-To: <gz7eiieq7o.fsf@fencepost.gnu.org> (Glenn Morris's message of "Mon, 15 Oct 2018 19:37:47 -0400")

> Perhaps it would be cleaner for the load statement to use the precise
> filename that it wants to load (ie, explicitly add the .el suffix)?

In a new patch I used the same variable names as in the function
smtpmail-send-it that creates these files.  But now I realized
this fix might be needed for emacs-26.  Maybe, Eli knows for sure?

diff --git a/lisp/mail/smtpmail.el b/lisp/mail/smtpmail.el
index 8bc3cc78d9..8607f9fa9c 100644
--- a/lisp/mail/smtpmail.el
+++ b/lisp/mail/smtpmail.el
@@ -404,21 +404,22 @@ smtpmail-send-queued-mail
   (with-temp-buffer
     ;; Get index, get first mail, send it, update index, get second
     ;; mail, send it, etc...
-    (let ((file-msg "")
+    (let (file-data file-elisp
           (qfile (expand-file-name smtpmail-queue-index-file
                                    smtpmail-queue-dir))
 	  result)
       (insert-file-contents qfile)
       (goto-char (point-min))
       (while (not (eobp))
-	(setq file-msg (buffer-substring (point) (line-end-position)))
-	(load file-msg)
+	(setq file-data (buffer-substring (point) (line-end-position)))
+	(setq file-elisp (concat file-data ".el"))
+	(load file-elisp)
 	;; Insert the message literally: it is already encoded as per
 	;; the MIME headers, and code conversions might guess the
 	;; encoding wrongly.
 	(with-temp-buffer
 	  (let ((coding-system-for-read 'no-conversion))
-	    (insert-file-contents file-msg))
+	    (insert-file-contents file-data))
           (let ((smtpmail-mail-address
                  (or (and mail-specify-envelope-from (mail-envelope-from))
                      user-mail-address)))
@@ -428,8 +429,8 @@ smtpmail-send-queued-mail
 				    (current-buffer)))
 		  (error "Sending failed: %s" result))
               (error "Sending failed; no recipients"))))
-	(delete-file file-msg)
-	(delete-file (concat file-msg ".el"))
+	(delete-file file-data)
+	(delete-file file-elisp)
 	(delete-region (point-at-bol) (point-at-bol 2)))
       (write-region (point-min) (point-max) qfile))))
 





  reply	other threads:[~2018-10-16 22:44 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-10-15 22:43 bug#33055: 27.0.50; load-prefer-newer loads wrong file Juri Linkov
2018-10-15 23:37 ` Glenn Morris
2018-10-16 22:44   ` Juri Linkov [this message]
2018-10-17 16:14     ` Eli Zaretskii
2018-10-17 22:25       ` Juri Linkov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87r2gpmryz.fsf@mail.linkov.net \
    --to=juri@linkov.net \
    --cc=33055@debbugs.gnu.org \
    --cc=rgm@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).