From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: "Kirill A. Korinskiy" Newsgroups: gmane.emacs.devel Subject: [PATCH] Make a new fortune dat file in compile time if dat file not exist Date: Fri, 8 Jan 2010 05:20:59 +0300 Message-ID: <1262917259-3368-1-git-send-email-catap@catap.ru> NNTP-Posting-Host: lo.gmane.org X-Trace: ger.gmane.org 1262928756 22344 80.91.229.12 (8 Jan 2010 05:32:36 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 8 Jan 2010 05:32:36 +0000 (UTC) Cc: "Kirill A. Korinskiy" To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Fri Jan 08 06:32:28 2010 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1NT7SW-0004bP-B1 for ged-emacs-devel@m.gmane.org; Fri, 08 Jan 2010 06:32:28 +0100 Original-Received: from localhost ([127.0.0.1]:56478 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NT7SW-0006B4-Rh for ged-emacs-devel@m.gmane.org; Fri, 08 Jan 2010 00:32:28 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1NT4X1-0004bT-My for emacs-devel@gnu.org; Thu, 07 Jan 2010 21:24:55 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1NT4X0-0004ae-M6 for emacs-devel@gnu.org; Thu, 07 Jan 2010 21:24:55 -0500 Original-Received: from [199.232.76.173] (port=54148 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NT4X0-0004aa-I5 for emacs-devel@gnu.org; Thu, 07 Jan 2010 21:24:54 -0500 Original-Received: from mx.catap.ru ([85.25.165.176]:42202) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1NT4X0-00059E-1U for emacs-devel@gnu.org; Thu, 07 Jan 2010 21:24:54 -0500 Original-Received: from pppoe47067.mv.ru ([95.68.175.219] helo=satellite.home.catap.ru) by mx.catap.ru with esmtpsa (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.69) (envelope-from ) id 1NT4Ty-0003kv-42; Fri, 08 Jan 2010 05:21:46 +0300 Original-Received: from catap by satellite.home.catap.ru with local (Exim 4.69) (envelope-from ) id 1NT4TD-0000t1-K3; Fri, 08 Jan 2010 05:20:59 +0300 X-Mailer: git-send-email 1.6.2 X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6 (newer, 2) X-Mailman-Approved-At: Fri, 08 Jan 2010 00:31:31 -0500 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:119646 Archived-At: --- 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