help-gnu-emacs
[Top][All Lists]
Advanced

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

Re: (copy-marker nil)


From: Andreas Röhler
Subject: Re: (copy-marker nil)
Date: Mon, 7 May 2018 16:20:41 +0200
User-agent: Mozilla/5.0 (X11; Linux i686; rv:52.0) Gecko/20100101 Thunderbird/52.7.0

On 07.05.2018 15:55, Noam Postavsky wrote:
On 7 May 2018 at 04:19, Andreas Röhler <andreas.roehler@easy-emacs.de> wrote:

being surprised WRT behavior of copy-marker:

(setq a (copy-marker nil)) -> #<marker in no buffer>
(markerp a) -> t
a -> #<marker in no buffer>

Is taking nil by copy-marker reasonable?

For most functions, passing nil for an &optional parameter is the same
as omitting it.

(copy-marker &optional MARKER TYPE)
[...]
If MARKER is not specified, the new marker does not point anywhere.


It's about the return value.

A marker pointing nowhere, might it be considered valid?
Expected such returning nil.

The use-case is the end-position of some object at point. Which will not exist, if there exists no one there. A useful info maybe.

Without marker, the end-position will be nil. However (setq end-position (copy-marker an-end-maybe)) makes it being something at any case.



reply via email to

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