unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* Re: master 6924320: Take care of a FIXME in cus-edit-tests.el
       [not found] ` <20201120213806.0C179209DE@vcs0.savannah.gnu.org>
@ 2020-11-20 21:57   ` Stefan Monnier
  2020-11-20 22:16     ` Mauro Aranda
  0 siblings, 1 reply; 2+ messages in thread
From: Stefan Monnier @ 2020-11-20 21:57 UTC (permalink / raw)
  To: Mauro Aranda; +Cc: emacs-devel

> -    (customize-saved)
> -    (should (search-forward cus-edit-tests--obsolete-option-tag nil t))))
> +    (unwind-protect
> +        (progn
> +          (put 'cus-edit-tests--obsolete-option-tag 'saved-value '(t))
> +          (customize-saved)
> +          (should (search-forward cus-edit-tests--obsolete-option-tag nil t)))
> +      (put 'cus-edit-tests--obsolete-option-tag 'saved-value nil))))

These are (fairly rare) good use-cases for `cl-letf`:

    (cl-letf (((get 'cus-edit-tests--obsolete-option-tag 'saved-value) '(t)))
      (customize-saved)
      (should (search-forward cus-edit-tests--obsolete-option-tag nil t)))


-- Stefan




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

* Re: master 6924320: Take care of a FIXME in cus-edit-tests.el
  2020-11-20 21:57   ` master 6924320: Take care of a FIXME in cus-edit-tests.el Stefan Monnier
@ 2020-11-20 22:16     ` Mauro Aranda
  0 siblings, 0 replies; 2+ messages in thread
From: Mauro Aranda @ 2020-11-20 22:16 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: emacs-devel

[-- Attachment #1: Type: text/plain, Size: 830 bytes --]

> > -    (customize-saved)
> > -    (should (search-forward cus-edit-tests--obsolete-option-tag nil
t))))
> > +    (unwind-protect
> > +        (progn
> > +          (put 'cus-edit-tests--obsolete-option-tag 'saved-value '(t))
> > +          (customize-saved)
> > +          (should (search-forward cus-edit-tests--obsolete-option-tag
nil t)))
> > +      (put 'cus-edit-tests--obsolete-option-tag 'saved-value nil))))
>
> These are (fairly rare) good use-cases for `cl-letf`:
>
>     (cl-letf (((get 'cus-edit-tests--obsolete-option-tag 'saved-value)
'(t)))
>       (customize-saved)
>       (should (search-forward cus-edit-tests--obsolete-option-tag nil t)))

Indeed.  I didn't know about cl-letf, thanks.

BTW, C-h f cl-letf RET
shows a link to the info node (cl) Function Bindings.  Maybe a better
link is (cl) Modify Macros.

[-- Attachment #2: Type: text/html, Size: 1055 bytes --]

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

end of thread, other threads:[~2020-11-20 22:16 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <20201120213804.8196.42565@vcs0.savannah.gnu.org>
     [not found] ` <20201120213806.0C179209DE@vcs0.savannah.gnu.org>
2020-11-20 21:57   ` master 6924320: Take care of a FIXME in cus-edit-tests.el Stefan Monnier
2020-11-20 22:16     ` Mauro Aranda

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).