1

[Note to folks with itchy 'close' fingers: this is not a duplicate of Noninteractively upgrade all packages, since those answers rely on code or package in one's init.el, which would suffer from the following problem described below.]

I'm currently-unpackaged, but migrating there now. I'm also not much of an Org user now, but hope to increase my usage soon. I noticed this open issue on Eric Schulte's popular ESK, which says (edited to collapse nested blockquote)

As people will quickly tell you when you ask about weird Org issues,
"when installing from ELPA, please do so from a fresh Emacs session
where no Org function has been called."

OTOH, ESK is not the only Emacs config out there that uses literately-programmed tangled Org, so I'm guessing "there's gotta be a way" to, e.g., run package updates (at least for Org) offline. Perhaps with a one-liner like

emacsclient -c -a '' -e '(unknown-package-update-magic)'

? (I'm guessing one must use -e since I'm not seeing any equivalent of --no-init-file for emacsclient, at least for my version=24.4--am I missing something?)

Specifically I'd like to know:

1. Does the above instruction still apply? I.e., should (at least, to avoid "weird issues") one still update Org packages from a never-Org'ed session?

If so,

2. When referring to an Emacs session in this context, how does running emacs --daemon (either directly after host boot, or indirectly via, e.g., emacsclient -c -a '' -e) change the situation? E.g., if I close my Emacs client (with C-x C-c), but leave the daemon running, and then startup a new client, am I still in the same "Emacs session" until I kill/restart the daemon, or should I do something else to make a running daemon start a fresh Emacs session?

3. How to create a fresh Emacs session in which no Org function has been called if one's init.el (or code called by one's init.el) calls Org functions? For extra credit, show how to create an Emacs session (after answering the previous question :-) that can programmatically update all one's packages (or at least one package name provided by the user) and then exit.

1

You have mixed a lot of orthogonal questions into one problem. I will try to untangle them.

It's generally no problem, if you update packages after you have used functions from the package. The problem with org-mode is, that it's part of emacs. So if you call some org-mode function before initializing the elpa-repo, the internal package will be used and you don't get your newly installed org-mode. This is true for every emacs startup not just when upgrading the package.

Some times it is a problem, if you try to compile a package that is already loaded, because there may be symbols that have changed in the new version, but are still present in your running instance. This may lead to weird effects and so these package are better compiled in a fresh instance of emacs like paradox-upgrade-packages do in async mode.

Starting emacs in daemon-mode means, that it starts with no console and frame attached, starts a server and then waits for clients to attach. A client is now able to open a new frame (or reuse an existing one) and when this frame is closed, the server is still running in the back. emacsclient -a "" is just an easy way to connect to a running daemon that has started a server or starting one if not.

Q1: If you have started the right org-mode, you can update org-mode and restart in the same session with org-reload. Only if you get weird results, try an async compile i.e. compile in a fresh emacs and just restart your running session.

Q2: The daemon changes nothing to the better for upgrading, but sometimes to the worse. The daemon keeps running and emacsclient -a "" just ignores the -a cause the server is still there. So if you come into trouble, start a new emacs without --daemon (you don't have to stop your current session), resolve your problems and then restart your daemon.

Q3: Make sure your first org-mode function is used after the elpa packages are initialized (or your load-path is set to the local org-mode installation). And if you want to be on the safe side, do every package-install inside a clean emacs.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.