unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Juanma Barranquero <lekktu@gmail.com>
To: bug-gnu-emacs@gnu.org
Subject: bug#5338: [PATCH] Make a new fortune dat file in compile time if dat file not exist
Date: Fri, 8 Jan 2010 11:12:25 +0100	[thread overview]
Message-ID: <f7ccd24b1001080212x30b271cco5f9846989d601056@mail.gmail.com> (raw)
In-Reply-To: <1262917259-3368-1-git-send-email-catap@catap.ru>

Package: emacs
Severity: minor
tags: patch
X-Debbugs-CC: Kirill A. Korinskiy <catap@catap.ru>


---------- Forwarded message ----------
From: Kirill A. Korinskiy <catap@catap.ru>
Date: Fri, Jan 8, 2010 at 03:20
Subject: [PATCH] Make a new fortune dat file in compile time if dat
file not exist
To: emacs-devel@gnu.org
Cc: "Kirill A. Korinskiy" <catap@catap.ru>


---
 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







       reply	other threads:[~2010-01-08 10:12 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <1262917259-3368-1-git-send-email-catap@catap.ru>
2010-01-08 10:12 ` Juanma Barranquero [this message]
2011-07-03 19:33   ` bug#5338: [PATCH] Make a new fortune dat file in compile time if dat file not exist 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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=f7ccd24b1001080212x30b271cco5f9846989d601056@mail.gmail.com \
    --to=lekktu@gmail.com \
    --cc=5338@debbugs.gnu.org \
    --cc=bug-gnu-emacs@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).