unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: frederik@ofb.net
To: Glenn Morris <rgm@gnu.org>
Cc: 25819@debbugs.gnu.org
Subject: bug#25819: 25.1; Added by Package.el. Added by Package.el. Added by Package.el. Added by Package.el.
Date: Tue, 21 Feb 2017 15:04:22 -0800	[thread overview]
Message-ID: <20170221230422.GJ1204@ofb.net> (raw)
In-Reply-To: <8ttw7n1925.fsf@fencepost.gnu.org>

On Tue, Feb 21, 2017 at 05:19:14PM -0500, Glenn Morris wrote:
> frederik@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!





  reply	other threads:[~2017-02-21 23:04 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-02-20 20:14 bug#25819: 25.1; Added by Package.el. Added by Package.el. Added by Package.el. Added by Package.el frederik
2017-02-21 22:19 ` Glenn Morris
2017-02-21 23:04   ` frederik [this message]
2017-02-22 19:28     ` Glenn Morris
2017-02-22 20:48       ` frederik
2017-02-23  2:28         ` npostavs
2017-02-23  6:23           ` frederik
2017-02-26 16:18             ` npostavs
2017-02-23  2:47         ` Glenn Morris
2017-02-23  6:39           ` frederik

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=20170221230422.GJ1204@ofb.net \
    --to=frederik@ofb.net \
    --cc=25819@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).