Explorar el Código

emacs.el: Do not download libraries for test

pull/2/head
10sr hace 10 años
padre
commit
f14ef46d6c
Se han modificado 2 ficheros con 19 adiciones y 4 borrados
  1. +2
    -2
      Makefile
  2. +17
    -2
      emacs.el

+ 2
- 2
Makefile Ver fichero

@@ -90,5 +90,5 @@ $(test_shs): test_%: %
sh -exc 'for sh in $(shrc_loadables); do $$sh -n $<; done'

test_el: emacs.el
$(emacs) -q --debug-init --batch --eval "(setq debug-on-error t)" \
--load $< --kill
EMACS_EL_DRY_RUN=t $(emacs) -q --debug-init --batch \
--eval "(setq debug-on-error t)" --load $< --kill

+ 17
- 2
emacs.el Ver fichero

@@ -44,17 +44,25 @@
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; download library from web

(defvar fetch-library-enabled-p t
"Set nil to skip downloading with `fetch-library'.")
(defun fetch-library (url &optional byte-compile-p force-download-p)
"Download a library from URL and locate it in \"~/emacs.d/lisp/\".
Return nil if library unfound and failed to download,
otherwise the path where the library installed.
If BYTE-COMPILE-P is t byte compile the file after downloading.
If FORCE-DOWNLOAD-P it t ignore exisiting library and always download."
If FORCE-DOWNLOAD-P it t ignore exisiting library and always download.

This function also checks the value of `fetch-library-enabled-p' and do not
fetch libraries if this value is nil. In this case all arguments (including
FORCE-DOWNLOAD-P) will be ignored."
(let* ((dir (expand-file-name (concat user-emacs-directory "lisp/")))
(lib (file-name-sans-extension (file-name-nondirectory url)))
(lpath (concat dir lib ".el"))
(locate-p (locate-library lib)))
(if (or force-download-p (not locate-p))
(if (and fetch-library-enabled-p
(or force-download-p
(not locate-p)))
(if (progn (message "Downloading %s..."
url)
(download-file url
@@ -76,6 +84,13 @@ If FORCE-DOWNLOAD-P it t ignore exisiting library and always download."
(message "Downloading %s...failed"
url))))
(locate-library lib)))
;; If EMACS_EL_DRY_RUN is set and it is not an empty string, fetch-library
;; does not actually fetch library.
(setq fetch-library-enabled-p
(let ((dryrun (getenv "EMACS_EL_DRY_RUN")))
(not (and dryrun
(eq 0
(length dryrun))))))

(defun download-file (url path &optional ok-if-already-exists)
"Download file from URL and output to PATH.


Cargando…
Cancelar
Guardar