From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs Subject: bug#20625: 25.0.50; doc of `define-error` is incorrect Date: Sat, 23 May 2015 17:57:16 +0300 Message-ID: <83oalb1gvn.fsf@gnu.org> References: <10eb5733-c84c-491d-86ca-2d6a05b80e7d@default> Reply-To: Eli Zaretskii NNTP-Posting-Host: plane.gmane.org X-Trace: ger.gmane.org 1432393106 10819 80.91.229.3 (23 May 2015 14:58:26 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sat, 23 May 2015 14:58:26 +0000 (UTC) Cc: 20625@debbugs.gnu.org To: Drew Adams Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sat May 23 16:58:14 2015 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1YwAsQ-0002zn-6o for geb-bug-gnu-emacs@m.gmane.org; Sat, 23 May 2015 16:58:14 +0200 Original-Received: from localhost ([::1]:37843 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YwAsP-0004R6-JG for geb-bug-gnu-emacs@m.gmane.org; Sat, 23 May 2015 10:58:13 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:46828) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YwAsJ-0004Qp-1Z for bug-gnu-emacs@gnu.org; Sat, 23 May 2015 10:58:10 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YwAsF-0006eL-AE for bug-gnu-emacs@gnu.org; Sat, 23 May 2015 10:58:06 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:44071) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YwAsF-0006e4-79 for bug-gnu-emacs@gnu.org; Sat, 23 May 2015 10:58:03 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.80) (envelope-from ) id 1YwAsE-0003m4-Hp for bug-gnu-emacs@gnu.org; Sat, 23 May 2015 10:58:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 23 May 2015 14:58:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 20625 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 20625-submit@debbugs.gnu.org id=B20625.143239305114469 (code B ref 20625); Sat, 23 May 2015 14:58:02 +0000 Original-Received: (at 20625) by debbugs.gnu.org; 23 May 2015 14:57:31 +0000 Original-Received: from localhost ([127.0.0.1]:54046 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1YwArf-0003lE-J6 for submit@debbugs.gnu.org; Sat, 23 May 2015 10:57:31 -0400 Original-Received: from mtaout21.012.net.il ([80.179.55.169]:36815) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1YwAra-0003kx-1T for 20625@debbugs.gnu.org; Sat, 23 May 2015 10:57:26 -0400 Original-Received: from conversion-daemon.a-mtaout21.012.net.il by a-mtaout21.012.net.il (HyperSendmail v2007.08) id <0NOT000004VKWX00@a-mtaout21.012.net.il> for 20625@debbugs.gnu.org; Sat, 23 May 2015 17:57:15 +0300 (IDT) Original-Received: from HOME-C4E4A596F7 ([87.69.4.28]) by a-mtaout21.012.net.il (HyperSendmail v2007.08) with ESMTPA id <0NOT000TP5JEVM30@a-mtaout21.012.net.il>; Sat, 23 May 2015 17:57:15 +0300 (IDT) In-reply-to: <10eb5733-c84c-491d-86ca-2d6a05b80e7d@default> X-012-Sender: halo1@inter.net.il X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 140.186.70.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:103108 Archived-At: > Date: Sat, 23 May 2015 07:48:46 -0700 (PDT) > From: Drew Adams > Cc: 20625@debbugs.gnu.org > > > > MESSAGE is not necessarily a string. It is a requiredargument, > > > but the code explicitly makes use of the case where it is nil. > > > And existing code delivered with Emacs (e.g. bookmark.el) makes > > > use of a nil MESSAGE. That case should be documented. > > > > AFAICS, users of this property will yield strange messages if > > MESSAGE is nil. So shouldn't we at least advise that it's a string? > > > > Also, what exactly is the purpose of bookmark.el's using nil there? > > I'm no expert in this, and I wasn't the one who changed bookmark.el > (in 24.4) to use `define-error'. > > But it seems that what is meant is that `bookmark-errors' is being > declared to be an error condition, but with no definition: no > message and no parent (other than the default, `error'). > > This is the Emacs 24.3 code: > > (put 'bookmark-error-no-filename > 'error-conditions > '(error bookmark-errors bookmark-error-no-filename)) > (put 'bookmark-error-no-filename > 'error-message > "Bookmark has no associated file (or directory)") > > And this is the 24.4+ code: > > (define-error 'bookmark-errors nil) > (define-error 'bookmark-error-no-filename > "Bookmark has no associated file (or directory)" > 'bookmark-errors) > > In both cases, `bookmark-errors' is presumably being declared > as an error condition, but it is not defined in any way. It > is presumably there to provide a more general category than > `bookmark-error-no-filename'. That makes sense to me. I've grepped all the uses of 'error-message property in the Emacs sources, and I only see uses that expect the value to be a string. > If my interpretation is correct, then something like that > explanation should be added to the doc, I think. Before > `define-error', things were clear enough with the doc for > property `error-conditions'. It seems that the doc for > `define-error' should cover the same cases. > > I believe that means that with nil MESSAGE, property > `error-conditions' is applied (using MESSAGE), and property > `error-message' is not (absent or nil value). > > In fact, I think that the right change would be not only > to say what nil MESSAGE means but to make MESSAGE an > &optional parameter. I cannot describe in the docs something I don't understand. I hope someone who will would either fix the docs or post here what it means for that property to have a nil value, and then I can put that in the docs.