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: Tue, 18 Feb 2014 21:21:54 +0100 Message-ID: <87ppmk2mu5.fsf@gmail.com> References: <86wqhpu021.fsf@somewhere.org> <87fvodvdh9.fsf@gmail.com> <86bny4o4gz.fsf@somewhere.org> Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:40969) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WFrB0-0001yD-Ny for emacs-orgmode@gnu.org; Tue, 18 Feb 2014 15:22:06 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WFrAs-0006ek-Kb for emacs-orgmode@gnu.org; Tue, 18 Feb 2014 15:21:58 -0500 Received: from plane.gmane.org ([80.91.229.3]:55216) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WFrAs-0006cs-DT for emacs-orgmode@gnu.org; Tue, 18 Feb 2014 15:21:50 -0500 Received: from public by plane.gmane.org with local (Exim 4.69) (envelope-from ) id 1WFrAp-0002a3-Hl for emacs-orgmode@gnu.org; Tue, 18 Feb 2014 21:21:47 +0100 In-Reply-To: <86bny4o4gz.fsf@somewhere.org> (Sebastien Vauban's message of "Tue, 18 Feb 2014 15:55:24 +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: > This should answer your (fruitful) comments. Thank you for the update. It looks good. AFAIC, you can push it. > + (if (or (not file) (not (file-readable-p file))) > + (if (not noerror) > + (error "Cannot read file \"%s\"%s" file info-from-file) > + (message "Cannot read file \"%s\"%s" file info-from-file)) > + (with-temp-buffer > + (insert-file-contents file) > + (buffer-string))))) Minor stylistic issue: I find the following a bit easier to understand. (if (and file (file-readable-p file)) (with-temp-buffer (insert-file-contents file) (buffer-string)) (funcall (if noerror #'message #'error) "Cannot read file \"%s\"%s" file info-from-file)) Regards, -- Nicolas Goaziou