[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: how can frame-parameter proxy for make-variable-frame-local?
From: |
Johan Bockgård |
Subject: |
Re: how can frame-parameter proxy for make-variable-frame-local? |
Date: |
Sat, 29 Mar 2008 11:37:20 +0100 |
User-agent: |
Gnus/5.110007 (No Gnus v0.7) Emacs/23.0.60 (gnu/linux) |
lovecraftian@mac.com writes:
> Is this correct? Can you think of a macro that will make this process
> as neat as a simple `setq' (to set) and a simple token (to access)?
> Or am I just fantasizing?
Something like
(require 'cl)
(defmacro with-frame-parameters (vars &rest body)
(declare (indent 1) (debug ((&rest symbolp) body)))
`(symbol-macrolet ,(mapcar (lambda (v) `(,v (frame-parameter nil ',v)))
vars)
,@body))
(macroexpand
'(with-frame-parameters (foo bar)
(setq foo 0)
(setq bar 1)
foo))
=>
(progn
(set-frame-parameter nil 'foo 0)
(set-frame-parameter nil 'bar 1)
(frame-parameter nil 'foo))
--
Johan Bockgård