[Top][All Lists]

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

bug#21195: 25.0.50; Let MARKER arg to `set-marker' be a number

From: Drew Adams
Subject: bug#21195: 25.0.50; Let MARKER arg to `set-marker' be a number
Date: Sat, 30 Apr 2016 17:05:08 -0800 (GMT-08:00)

> > Minor enhancement request.  Let `set-marker' (aka `move-marker') accept
> > a buffer position that is just a number as its first arg.  IOW, give
> > `set-marker' this behavior:
> >
> > (defun new-set-marker (num-or-marker position &optional buffer)
> >   "..."
> >   (unless (markerp num-or-marker)
> >     (setq num-or-marker  (with-current-buffer buffer
> >                            (copy-marker num-or-marker))))
> >   (set-marker num-or-marker position buffer))
> Hm...  Well, I don't really see the point.  `set-marker' is so
> conceptually clean.  And saying `(set-marker (make-marker) ...)' is so
> easy.  Closing.

Well, I said it was minor.  Consider funcalling, applying, or
mapping over positions, which can be markers.

Sure, you can use an anonymous function that does just what
you need (test with markerp, copy-marker if not a marker)...
But why shouldn't `set-marker' do this?  It's trivial and
costs only a call to `markerp' for doing what `set-marker'
does now.

reply via email to

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