From mboxrd@z Thu Jan 1 00:00:00 1970 From: Nicolas Goaziou Subject: Re: [PATCH] Improve message when file to include is missing Date: Fri, 24 Jan 2014 12:14:10 +0100 Message-ID: <87fvodvdh9.fsf@gmail.com> References: <86wqhpu021.fsf@somewhere.org> Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:44373) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1W6eiG-0002om-PM for emacs-orgmode@gnu.org; Fri, 24 Jan 2014 06:14:24 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1W6ei8-0003js-Ju for emacs-orgmode@gnu.org; Fri, 24 Jan 2014 06:14:16 -0500 Received: from plane.gmane.org ([80.91.229.3]:56523) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1W6ei8-0003jn-Cx for emacs-orgmode@gnu.org; Fri, 24 Jan 2014 06:14:08 -0500 Received: from public by plane.gmane.org with local (Exim 4.69) (envelope-from ) id 1W6ei6-0004SJ-Ho for emacs-orgmode@gnu.org; Fri, 24 Jan 2014 12:14:06 +0100 In-Reply-To: <86wqhpu021.fsf@somewhere.org> (Sebastien Vauban's message of "Fri, 24 Jan 2014 11:49:26 +0100") List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: Sebastien Vauban Cc: public-emacs-orgmode-mXXj517/zsQ@plane.gmane.org Hello, "Sebastien Vauban" writes: > When a SETUPFILE is missing, there is an error or message generated, but > we don't know in which file the bad reference is -- when all those files > are loaded during the agenda generation. > > Hence, a better message, specifying where to go and look for the bad > link. Thanks. > From 4c31c1cf649c2eb3487e61e56296f058a62d7c08 Mon Sep 17 00:00:00 2001 > From: "Sebastien Vauban" > Date: Fri, 24 Jan 2014 11:43:52 +0100 > Subject: [PATCH] Improve message when file to include is missing > > * org.el (org-file-contents): Improve message when linked file does not exist. > > --- > lisp/org.el | 6 ++++-- > 1 files changed, 4 insertions(+), 2 deletions(-) > > diff --git a/lisp/org.el b/lisp/org.el > index a225bae..787a09f 100644 > --- a/lisp/org.el > +++ b/lisp/org.el > @@ -5235,8 +5235,10 @@ Support for group tags is controlled by the option > (if (or (not file) > (not (file-readable-p file))) > (if noerror > - (message "Cannot read file \"%s\"" file) > - (error "Cannot read file \"%s\"" file)) > + (message "Cannot read file \"%s\" referenced in file \"%s\"" > + file (buffer-file-name)) > + (error "Cannot read file \"%s\" referenced in file \"%s\"" > + file (buffer-file-name))) What if `buffer-file-name' returns nil? Sure, the problem won't happen during agenda generation, but `org-file-contents' is used elsewhere. Also, it is better to use: (buffer-file-name (buffer-base-buffer)) since the current buffer may be an indirect one. Regards, -- Nicolas Goaziou