Subject: 24.5; More robust test for calls to `package-initialize' in init file
From: Phil Sainty <[email-masked]>
To: [email-masked]
Date: Tue, 08 Sep 2015 02:26:26 +1200
List-Id: <debbugs-submit.debbugs.gnu.org>

The code which checks the user's init file for calls to
`package-initialize' doesn't take the optional argument to
that function into account.

From e4031d15e635493b69e5402acec33861817303ad Mon Sep 17 00:00:00 2001
From: Phil Sainty <[email-masked]>
Date: Tue, 8 Sep 2015 02:15:53 +1200
Subject: [PATCH] More robust check for `package-initialize' calls in init
 file.

This function accepts an optional argument, but calls passing
an argument would not have been detected.
---
 lisp/emacs-lisp/package.el | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/lisp/emacs-lisp/package.el b/lisp/emacs-lisp/package.el
index 23247d7..45d66f6 100644
--- a/lisp/emacs-lisp/package.el
+++ b/lisp/emacs-lisp/package.el
@@ -1838,12 +1838,12 @@ add a call to it along with some explanatory comments."
                     (save-restriction
                       (widen)
                       (goto-char (point-min))
-                      (search-forward "(package-initialize)" nil 'noerror))))
+                      (re-search-forward "(package-initialize\\_>" nil 'noerror))))
               ;; Don't visit the file if we don't have to.
               (with-temp-buffer
                 (insert-file-contents user-init-file)
                 (goto-char (point-min))
-                (search-forward "(package-initialize)" nil 'noerror)))))
+                (re-search-forward "(package-initialize\\_>" nil 'noerror)))))
       (unless contains-init
         (with-current-buffer (or buffer
                                  (let ((delay-mode-hooks t))
-- 
2.1.0