GNU bug report logs -
#25819
25.1; Added by Package.el. Added by Package.el. Added by Package.el. Added by Package.el.
Previous Next
Reported by: frederik <at> ofb.net
Date: Mon, 20 Feb 2017 20:16:01 UTC
Severity: minor
Tags: fixed, patch
Merged with 24643
Found in version 25.1
Fixed in version 26.1
Done: npostavs <at> users.sourceforge.net
Bug is archived. No further changes may be made.
Full log
Message #11 received at 25819 <at> debbugs.gnu.org (full text, mbox):
On Tue, Feb 21, 2017 at 05:19:14PM -0500, Glenn Morris wrote:
> frederik <at> ofb.net wrote:
>
> > In my ~/.emacs file, I get repeating lines like this:
> [...]
> > (package-initialize)
> >
> > (package-initialize)
> >
> > (package-initialize)
>
> The function package--ensure-init-file adds this line, but it takes care
> to only do so if it's not already there. So it's hard to see how you can
> end up with multiple copies. Can you find a reproducible sequence that
> causes an extra copy to be added; or can you edebug
> package--ensure-init-file to see why it adds multiple copies?
>
Thanks for the reply. Well, you prompted me to find a reproducible
sequence. It turns out that the problem comes from when I start emacs
as "root". (This happens automatically in ~/.xinitrc, for better or
worse, where I create a screen session with an emacs running as root,
which starts a server so that I can edit files using emacsclient as
root) My /root/.emacs looks something like this:
(setenv "HOME" "/home/frederik/")
(setq savehist-file "/root/.emacs-history")
(load "~/.emacs")
(setenv "HOME" "/root/")
Obviously this does not contain a "(package-initialize)" line, so the
following test in package--ensure-init-file fails:
;; Don't visit the file if we don't have to.
(with-temp-buffer
(insert-file-contents user-init-file)
(goto-char (point-min))
(re-search-forward "(package-initialize\\_>" nil 'noerror))
(by the way what's with the unnecessary optimization in the lines
previous to these? ugh)
I wasn't able to figure out why the "(package-initialize)" lines then
get inserted in ~/.emacs rather than /root/.emacs, but I hope the
above clues provide a good enough place for someone else to start
debugging this.
Thank you!
This bug report was last modified 8 years and 85 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.