all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Drew Adams <drew.adams@oracle.com>
To: Eli Zaretskii <eliz@gnu.org>, Drew Adams <drew.adams@oracle.com>
Cc: 20625@debbugs.gnu.org
Subject: bug#20625: 25.0.50; doc of `define-error` is incorrect
Date: Sat, 23 May 2015 07:48:46 -0700 (PDT)	[thread overview]
Message-ID: <10eb5733-c84c-491d-86ca-2d6a05b80e7d@default> (raw)
In-Reply-To: <<83382n38et.fsf@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.

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.





       reply	other threads:[~2015-05-23 14:48 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <<b9eb3f53-8dec-4157-8a96-7634274687ac@default>
     [not found] ` <<83382n38et.fsf@gnu.org>
2015-05-23 14:48   ` Drew Adams [this message]
2015-05-23 14:57     ` bug#20625: 25.0.50; doc of `define-error` is incorrect Eli Zaretskii
2015-05-23 16:15     ` Stefan Monnier
2015-05-23 16:22       ` Drew Adams
     [not found] <<10eb5733-c84c-491d-86ca-2d6a05b80e7d@default>
     [not found] ` <<83oalb1gvn.fsf@gnu.org>
2015-05-23 16:02   ` Drew Adams
2015-05-21 21:04 Drew Adams
2015-05-23 10:17 ` Eli Zaretskii
2016-04-30 19:25 ` Lars Ingebrigtsen
2016-04-30 19:42   ` Drew Adams

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

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

  git send-email \
    --in-reply-to=10eb5733-c84c-491d-86ca-2d6a05b80e7d@default \
    --to=drew.adams@oracle.com \
    --cc=20625@debbugs.gnu.org \
    --cc=eliz@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 external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.