all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* [PATCH] Make a new fortune dat file in compile time if dat file not exist
@ 2010-01-08  2:20 Kirill A. Korinskiy
  2010-01-08 10:12 ` bug#5338: " Juanma Barranquero
  0 siblings, 1 reply; 7+ messages in thread
From: Kirill A. Korinskiy @ 2010-01-08  2:20 UTC (permalink / raw
  To: emacs-devel; +Cc: Kirill A. Korinskiy

---
 lisp/play/fortune.el |   24 +++++++++++++++---------
 1 files changed, 15 insertions(+), 9 deletions(-)

diff --git a/lisp/play/fortune.el b/lisp/play/fortune.el
index 3b895c7..0f92085 100644
--- a/lisp/play/fortune.el
+++ b/lisp/play/fortune.el
@@ -245,15 +245,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)))))
 
 
 ;;; **************
-- 
1.6.2





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

end of thread, other threads:[~2013-02-13  8:11 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-01-08  2:20 [PATCH] Make a new fortune dat file in compile time if dat file not exist Kirill A. Korinskiy
2010-01-08 10:12 ` bug#5338: " Juanma Barranquero
2011-07-03 19:33   ` Lars Magne Ingebrigtsen
2011-07-04  2:40     ` Chong Yidong
2011-07-04  7:53       ` Kirill A. Korinskiy
2011-07-04  9:38         ` Lars Magne Ingebrigtsen
2013-02-13  8:11         ` Glenn Morris

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.