From beb7fba1b2d253902e53559f7c2cb54bd9461939 Mon Sep 17 00:00:00 2001 From: Juanma Barranquero Date: Sun, 3 Jul 2011 21:27:53 +0200 Subject: [PATCH] * play/fortune.el (fortune-compile): Make a new fortune dat file compile time if the dat file does not exist. Fixes: debbugs:5338 --- lisp/ChangeLog | 5 +++++ lisp/play/fortune.el | 24 +++++++++++++++--------- 2 files changed, 20 insertions(+), 9 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 6949d776821..0881f9f5982 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,8 @@ +2011-07-03 Juanma Barranquero + + * play/fortune.el (fortune-compile): Make a new fortune dat file + compile time if the dat file does not exist (bug#5338). + 2011-07-03 Richard Kim (tiny change) * textmodes/texnfo-upd.el (texinfo-insert-menu): Don't insert diff --git a/lisp/play/fortune.el b/lisp/play/fortune.el index 55b0a564fef..e675302755c 100644 --- a/lisp/play/fortune.el +++ b/lisp/play/fortune.el @@ -244,15 +244,21 @@ the value of `fortune-file'. This currently cannot handle directories." (let* ((fortune-file (expand-file-name (substitute-in-file-name file))) (fortune-dat (expand-file-name (substitute-in-file-name - (concat fortune-file fortune-database-extension))))) - (cond ((file-exists-p fortune-file) - (if (file-exists-p fortune-dat) - (cond ((file-newer-than-file-p fortune-file fortune-dat) - (message "Compiling new fortune database %s" fortune-dat) - (shell-command - (concat fortune-strfile fortune-strfile-options - " " fortune-file fortune-quiet-strfile-options)))))) - (t (error "Can't compile fortune file %s" fortune-file))))) + (concat fortune-file fortune-database-extension)))) + (fortune-file-exist (file-exists-p fortune-file)) + (fortune-dat-exist (file-exists-p fortune-dat)) + (fortune-file-newer (file-newer-than-file-p + fortune-file fortune-dat))) + (cond + (fortune-file-exist + (if (or (not fortune-dat-exist) + (and fortune-dat-exist + fortune-file-newer)) + (message "Compiling new fortune database %s" fortune-dat) + (shell-command + (concat fortune-strfile fortune-strfile-options + " " fortune-file fortune-quiet-strfile-options)))) + (t (error "Can't compile fortune file %s" fortune-file))))) ;;; ************** -- 2.11.4.GIT