* how can frame-parameter proxy for make-variable-frame-local?
@ 2008-03-28 21:44 Scott Heftler
2008-03-29 4:25 ` Stefan Monnier
0 siblings, 1 reply; 4+ messages in thread
From: Scott Heftler @ 2008-03-28 21:44 UTC (permalink / raw)
To: Emacs-devel
I've written an elisp program that depends on frame-local variables.
But now when I compile my module, I get ...
Warning: `make-variable-frame-local' is an obsolete
function (as of Emacs 22.2); use a frame-parameter instead.
OK. So what's the most elegant way to do this? Here's my dumb way:
(1) To init VAR to VAL and make it frame-local for the current frame,
I do
(modify-frame-parameters nil '(VAR . VAL))
And then *every time* I want to reset its value, I have to do this
again?
(2) And *every time* I want to simply access its value, I have to do
(frame-parameter nil 'VAR)
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? :thinking:
--
View this message in context: http://www.nabble.com/how-can-frame-parameter-proxy-for-make-variable-frame-local--tp16361122p16361122.html
Sent from the Emacs - Dev mailing list archive at Nabble.com.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: how can frame-parameter proxy for make-variable-frame-local?
2008-03-28 21:44 how can frame-parameter proxy for make-variable-frame-local? Scott Heftler
@ 2008-03-29 4:25 ` Stefan Monnier
0 siblings, 0 replies; 4+ messages in thread
From: Stefan Monnier @ 2008-03-29 4:25 UTC (permalink / raw)
To: Scott Heftler; +Cc: Emacs-devel
> I've written an elisp program that depends on frame-local variables.
> But now when I compile my module, I get ...
> Warning: `make-variable-frame-local' is an obsolete
> function (as of Emacs 22.2); use a frame-parameter instead.
> OK. So what's the most elegant way to do this? Here's my dumb way:
> (1) To init VAR to VAL and make it frame-local for the current frame,
> I do
> (modify-frame-parameters nil '(VAR . VAL))
Try (set-frame-parameter nil 'VAR VAL)
> And then *every time* I want to reset its value, I have to do this
> again?
> (2) And *every time* I want to simply access its value, I have to do
> (frame-parameter nil 'VAR)
> 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)?
No. Why is it a problem?
> Or am I just fantasizing? :thinking:
Of course, you can also live with the warning.
Stefan
^ permalink raw reply [flat|nested] 4+ messages in thread
* how can frame-parameter proxy for make-variable-frame-local?
@ 2008-03-28 20:01 lovecraftian
2008-03-29 10:37 ` Johan Bockgård
0 siblings, 1 reply; 4+ messages in thread
From: lovecraftian @ 2008-03-28 20:01 UTC (permalink / raw)
To: bug-gnu-emacs
I've written an elisp program that depends on frame-local variables.
But now when I compile my module, I get ...
Warning: `make-variable-frame-local' is an obsolete
function (as of Emacs 22.2); use a frame-parameter instead.
OK. So what's the most elegant way to do this? Here's my dumb way:
(1) To init VAR to VAL and make it frame-local for the current frame,
I do
(modify-frame-parameters nil '(VAR . VAL))
And then *every time* I want to reset its value, I have to do
this again?
(2) And *every time* I want to simply access its value, I have to do
(frame-parameter nil 'VAR)
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?
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: how can frame-parameter proxy for make-variable-frame-local?
2008-03-28 20:01 lovecraftian
@ 2008-03-29 10:37 ` Johan Bockgård
0 siblings, 0 replies; 4+ messages in thread
From: Johan Bockgård @ 2008-03-29 10:37 UTC (permalink / raw)
To: bug-gnu-emacs
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
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2008-03-29 10:37 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-03-28 21:44 how can frame-parameter proxy for make-variable-frame-local? Scott Heftler
2008-03-29 4:25 ` Stefan Monnier
-- strict thread matches above, loose matches on Subject: below --
2008-03-28 20:01 lovecraftian
2008-03-29 10:37 ` Johan Bockgård
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.