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

From: Dmitry Gutov <[email-masked]>
Date: Tue, 20 May 2014 05:58:20 +0300

Glenn Morris <[email-masked]> writes:

> I think this is because package.el uses `save-buffer'.
>
> Unless it really needs to do that, I think it should use something more
> low-level.

The patch below seems to work okay:

=== 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 02:53:29 +0000
@@ -1245,9 +1245,7 @@
       (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))))
+	(basic-save-buffer-1)))
     (when good-signatures
       ;; Write out good signatures into archive-contents.signed file.
       (write-region (mapconcat #'epg-signature-to-string good-signatures "\n")
@@ -1495,9 +1493,11 @@
                          (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)))
+                       (basic-save-buffer-1)
                        (setq readme-string (buffer-string))
                        t))
 		 (error nil))