unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* Re: master 0883e98 1/3: New functions for getting and setting image properties
       [not found] ` <E1aX1a8-0006a1-FW@vcs.savannah.gnu.org>
@ 2016-02-20  7:28   ` Lars Ingebrigtsen
  2016-02-20 17:00     ` Michael Heerdegen
  0 siblings, 1 reply; 8+ messages in thread
From: Lars Ingebrigtsen @ 2016-02-20  7:28 UTC (permalink / raw)
  To: emacs-devel

Lars Ingebrigtsen <larsi@gnus.org> writes:

>     * lisp/image.el (image-set-property): New function.
>     (image-get-property): Ditto.

Should this be a defsetf instead, perhaps?  The reason I didn't is
because image.el is dumped with most Emacsen, and ... there seemed to be
issues with...  cl-lib.el in dumped Emacsen?  I'm just half-remembering
bug reports.

Why can't we use cl-lib, seq and map in files that are dumped with
Emacs, anyway?  It seems a pity that the most important parts of Emacs
have to be implemented in the most primitive manner.  :-)

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no



^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: master 0883e98 1/3: New functions for getting and setting image properties
  2016-02-20  7:28   ` master 0883e98 1/3: New functions for getting and setting image properties Lars Ingebrigtsen
@ 2016-02-20 17:00     ` Michael Heerdegen
  2016-02-21  2:29       ` Lars Ingebrigtsen
  0 siblings, 1 reply; 8+ messages in thread
From: Michael Heerdegen @ 2016-02-20 17:00 UTC (permalink / raw)
  To: emacs-devel

Lars Ingebrigtsen <larsi@gnus.org> writes:

> Lars Ingebrigtsen <larsi@gnus.org> writes:
>
> >     * lisp/image.el (image-set-property): New function.
> >     (image-get-property): Ditto.
>
> Should this be a defsetf instead, perhaps?  The reason I didn't is
> because image.el is dumped with most Emacsen, and ... there seemed to be
> issues with...  cl-lib.el in dumped Emacsen?  I'm just half-remembering
> bug reports.

AFAIK places stuff is implemented in gv.el now, and that doesn't depend
on cl-lib, I think.


Michael.




^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: master 0883e98 1/3: New functions for getting and setting image properties
  2016-02-20 17:00     ` Michael Heerdegen
@ 2016-02-21  2:29       ` Lars Ingebrigtsen
  2016-02-21 11:55         ` Michael Heerdegen
  0 siblings, 1 reply; 8+ messages in thread
From: Lars Ingebrigtsen @ 2016-02-21  2:29 UTC (permalink / raw)
  To: Michael Heerdegen; +Cc: emacs-devel

Michael Heerdegen <michael_heerdegen@web.de> writes:

> AFAIK places stuff is implemented in gv.el now, and that doesn't depend
> on cl-lib, I think.

Ah, I see.  gv doesn't seem to be loaded by loadup, either, though, so
is that something that can be used in dumped files?

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no



^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: master 0883e98 1/3: New functions for getting and setting image properties
  2016-02-21  2:29       ` Lars Ingebrigtsen
@ 2016-02-21 11:55         ` Michael Heerdegen
  2016-02-22  1:40           ` Lars Ingebrigtsen
  0 siblings, 1 reply; 8+ messages in thread
From: Michael Heerdegen @ 2016-02-21 11:55 UTC (permalink / raw)
  To: emacs-devel

Lars Ingebrigtsen <larsi@gnus.org> writes:

> Michael Heerdegen <michael_heerdegen@web.de> writes:
>
> > AFAIK places stuff is implemented in gv.el now, and that doesn't depend
> > on cl-lib, I think.
>
> Ah, I see.  gv doesn't seem to be loaded by loadup, either, though, so
> is that something that can be used in dumped files?

After reading the sources, AFAIK it's sufficient to load it when
compiling.

You can use the `gv-setter' declare spec in your defun.  Then the byte
compiler will autoload gv and put something like

  (put 'function 'gv-expander [byte code])

in the compiled file.  That doesn't depend on gv when loading.

OTOH when compiling, `setf' forms are expanded to something that doesn't
depend on gv either.

That's just how I think it works, but that stuff is used widely in the
sources.


Michael.




^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: master 0883e98 1/3: New functions for getting and setting image properties
  2016-02-21 11:55         ` Michael Heerdegen
@ 2016-02-22  1:40           ` Lars Ingebrigtsen
  2016-02-22 13:15             ` Michael Heerdegen
  0 siblings, 1 reply; 8+ messages in thread
From: Lars Ingebrigtsen @ 2016-02-22  1:40 UTC (permalink / raw)
  To: Michael Heerdegen; +Cc: emacs-devel

Michael Heerdegen <michael_heerdegen@web.de> writes:

> After reading the sources, AFAIK it's sufficient to load it when
> compiling.
>
> You can use the `gv-setter' declare spec in your defun.  Then the byte
> compiler will autoload gv and put something like
>
>   (put 'function 'gv-expander [byte code])
>
> in the compiled file.  That doesn't depend on gv when loading.
>
> OTOH when compiling, `setf' forms are expanded to something that doesn't
> depend on gv either.

Great!  I'll rewrite those two getter/setter functions to be more
setf-ey.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no



^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: master 0883e98 1/3: New functions for getting and setting image properties
  2016-02-22  1:40           ` Lars Ingebrigtsen
@ 2016-02-22 13:15             ` Michael Heerdegen
  2016-02-22 16:37               ` Michael Heerdegen
  0 siblings, 1 reply; 8+ messages in thread
From: Michael Heerdegen @ 2016-02-22 13:15 UTC (permalink / raw)
  To: Lars Ingebrigtsen; +Cc: emacs-devel

Lars Ingebrigtsen <larsi@gnus.org> writes:

> Great!  I'll rewrite those two getter/setter functions to be more
> setf-ey.

Looks ok.  Nitpick: according to the doc of `gv-define-simple-setter',
to "preserve the semantics of setf" `image--set-property' should either
return the VALUE.  Or use

  (declare (gv-setter image--set-property t))
                                          ^

Hmm, this DTRT, though it's not documented in

 (info "(elisp) Declare Form")

Will file a bug report...


Regards,

Michael.



^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: master 0883e98 1/3: New functions for getting and setting image properties
  2016-02-22 13:15             ` Michael Heerdegen
@ 2016-02-22 16:37               ` Michael Heerdegen
  2016-02-23  1:26                 ` Lars Ingebrigtsen
  0 siblings, 1 reply; 8+ messages in thread
From: Michael Heerdegen @ 2016-02-22 16:37 UTC (permalink / raw)
  To: Lars Ingebrigtsen; +Cc: emacs-devel

Michael Heerdegen <michael_heerdegen@web.de> writes:

> Looks ok.  Nitpick: according to the doc of `gv-define-simple-setter',
> to "preserve the semantics of setf" `image--set-property' should either
> return the VALUE.  Or use
>
>   (declare (gv-setter image--set-property t))
>                                           ^
>
> Hmm, this DTRT, though it's not documented in
>
>  (info "(elisp) Declare Form")
>
> Will file a bug report...


Done - see bug#22766: 25.0.91; (info "(elisp) Declare Form"): gv-setter:
mention FIX-RETURN arg

Stefan suggests to change `image--set-property' to return the VALUE
instead of using the undocumented optional second arg of the gv-setter
declare form.


Michael.



^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: master 0883e98 1/3: New functions for getting and setting image properties
  2016-02-22 16:37               ` Michael Heerdegen
@ 2016-02-23  1:26                 ` Lars Ingebrigtsen
  0 siblings, 0 replies; 8+ messages in thread
From: Lars Ingebrigtsen @ 2016-02-23  1:26 UTC (permalink / raw)
  To: Michael Heerdegen; +Cc: emacs-devel

Michael Heerdegen <michael_heerdegen@web.de> writes:

> Stefan suggests to change `image--set-property' to return the VALUE
> instead of using the undocumented optional second arg of the gv-setter
> declare form.

I've now fixed this.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no



^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2016-02-23  1:26 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <20160220070344.25183.28197@vcs.savannah.gnu.org>
     [not found] ` <E1aX1a8-0006a1-FW@vcs.savannah.gnu.org>
2016-02-20  7:28   ` master 0883e98 1/3: New functions for getting and setting image properties Lars Ingebrigtsen
2016-02-20 17:00     ` Michael Heerdegen
2016-02-21  2:29       ` Lars Ingebrigtsen
2016-02-21 11:55         ` Michael Heerdegen
2016-02-22  1:40           ` Lars Ingebrigtsen
2016-02-22 13:15             ` Michael Heerdegen
2016-02-22 16:37               ` Michael Heerdegen
2016-02-23  1:26                 ` Lars Ingebrigtsen

Code repositories for project(s) associated with this public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).