emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: [patch] minor patch for register.el


From: Drew Adams
Subject: RE: [patch] minor patch for register.el
Date: Mon, 11 Mar 2013 13:46:33 -0700

See my reply to Bastien.

If you or he wants to patch register.el along the lines I suggested before he
makes his more substantial (and welcome, IMO) changes, please feel free to do
so.

> [ BTW, I think "register is empty" is more correct than "no such
>   register". ]

It's all about the ambiguity of nil as the return value of `get-register'.  It
can mean that there is no such register or that the contents are empty (e.g.,
the register has an entry in `register-alist' but its value is (REGISTER .
nil)).

As long as we do not distinguish those two cases we cannot tell the user which
is the case for a given input char.

"Register is empty" really makes sense (is helpful) only if the register
previously was not empty.  Otherwise it can be misleading.

"No such register" is more useful in general, IMO, since there is no simple way
(see above) to tell whether a given register previously was non-empty.

When you type a character that has never been defined as a register, the message
should tell you that.  This is the more likely cause of a nil `get-register'
value, IMO: you hit the wrong char.  And in any case it is the more important
cause for a newbie.  The message should target this easy-to-make mistake.

Put differently, we do not distinguish an empty register from a non-existent
register.  And given that, it is more helpful for users, IMO, to speak of both
cases as non-existence.

Note that we already use more specific error msgs for an empty register when the
command is to insert ("Register doesn't contain text") or to jump ("Register
doesn't contain a buffer position or configuration") or to increment ("Register
doesn't contain a number or text").

That is helpful because it emphasizes what the command is for.

However, it could also be argued that these messages can also be misleading when
`get-register' returns nil, because they really suggest a type error, rather
than an empty or non-existent register.  Such a message makes more sense when
the contents are not empty but are of the wrong type - e.g., a number as content
when you try to `C-x r i'.

But again, please do whatever you like.  And I hope that Bastien will soon find
the time to finish his intended update.  That will be useful.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]