all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* prevent function execution on Emacs startup if not connected to internet
@ 2014-04-18  7:27 Brady Trainor
  2014-04-18  7:50 ` Brady Trainor
       [not found] ` <mailman.19815.1397807453.10748.help-gnu-emacs@gnu.org>
  0 siblings, 2 replies; 6+ messages in thread
From: Brady Trainor @ 2014-04-18  7:27 UTC (permalink / raw)
  To: help-gnu-emacs

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




^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2014-04-24 17:09 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-04-18  7:27 prevent function execution on Emacs startup if not connected to internet Brady Trainor
2014-04-18  7:50 ` 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

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.