From: Brady Trainor <algebrat@uw.edu>
To: help-gnu-emacs@gnu.org
Subject: prevent function execution on Emacs startup if not connected to internet
Date: Fri, 18 Apr 2014 00:27:01 -0700 [thread overview]
Message-ID: <liqk46$6go$1@ger.gmane.org> (raw)
Hi, I have the following lines of code in my my init files:
if an uninstalled package is not in the list, refresh list
#+BEGIN_SRC emacs-lisp
(setq n 0) ; set n as 0
(dolist (pkg pkgs-2b-present) ; for each pkg in list
(unless (or ; unless
(package-installed-p pkg) ; pkg is installed or
(assoc pkg ; pkg is in the archive list
package-archive-contents))
(setq n (+ n 1)))) ; add one to n
(when (> n 0) ; if n > 0,
(package-refresh-contents)) ; refresh packages
#+END_SRC
install any uninstalled packages that are in the list
#+BEGIN_SRC emacs-lisp
(dolist (pkg pkgs-2b-present) ; for each pkg in list
(when ; if pkg is
(and
(not (package-installed-p pkg)) ; not installed
(assoc pkg package-archive-contents) ; and in the archive list
)
(package-install pkg))) ; then install it
#+END_SRC
I think the `package-refresh-contents' or the `package-install'
functions will create an error and prevent my init files from finishing
loading.
I would guess that I am not the first one to have this problem, or
someone can tell me what would fix this.
Brady
next reply other threads:[~2014-04-18 7:27 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-04-18 7:27 Brady Trainor [this message]
2014-04-18 7:50 ` prevent function execution on Emacs startup if not connected to internet Brady Trainor
[not found] ` <mailman.19815.1397807453.10748.help-gnu-emacs@gnu.org>
2014-04-18 12:13 ` Pascal J. Bourguignon
2014-04-22 4:45 ` Brady Trainor
2014-04-24 2:22 ` Brady Trainor
2014-04-24 17:09 ` John Mastro
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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='liqk46$6go$1@ger.gmane.org' \
--to=algebrat@uw.edu \
--cc=help-gnu-emacs@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 external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.