Subject: bug#17155: 24.3; ELPA files should not appear in recentf

From: Dmitry Gutov <[email-masked]>
Date: Tue, 20 May 2014 16:04:38 +0300

On 20.05.2014 09:16, Glenn Morris wrote:

> I don't like the idea of using an undocumented subroutine of
> basic-save-buffer outside of basic-save-buffer itself.
> (I see ruby-mode is the only other file to do so.)
> Will plain write-region not work?

Okay, this also seems to work fine. Should it be installed in emacs-24?

=== modified file 'lisp/emacs-lisp/package.el'
--- lisp/emacs-lisp/package.el	2014-03-28 22:47:46 +0000
+++ lisp/emacs-lisp/package.el	2014-05-20 12:16:25 +0000
@@ -1244,10 +1244,7 @@
        ;; may fetch a URL redirect page).
        (when (listp (read (current-buffer)))
  	(make-directory dir t)
-	(setq buffer-file-name (expand-file-name file dir))
-	(let ((version-control 'never)
-              (require-final-newline nil))
-	  (save-buffer))))
+        (write-region nil nil (expand-file-name file dir) nil 'silent)))
      (when good-signatures
        ;; Write out good signatures into archive-contents.signed file.
        (write-region (mapconcat #'epg-signature-to-string 
good-signatures "\n")
@@ -1493,11 +1490,13 @@
                       (package--with-work-buffer
                           (package-archive-base desc)
                           (format "%s-readme.txt" name)
-                       (setq buffer-file-name
-                             (expand-file-name readme package-user-dir))
-                       (let ((version-control 'never)
-                             (require-final-newline t))
-                         (save-buffer))
+                       (save-excursion
+                         (goto-char (point-max))
+                         (unless (bolp)
+                           (insert ?\n)))
+                       (write-region nil nil
+                                     (expand-file-name readme 
package-user-dir)
+                                     nil 'silent)
                         (setq readme-string (buffer-string))
                         t))
  		 (error nil))