unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* nnoo.el: how to update server variables
@ 2015-07-11 19:45 Nikolaus Rath
  2015-12-24 16:55 ` Lars Ingebrigtsen
  0 siblings, 1 reply; 4+ messages in thread
From: Nikolaus Rath @ 2015-07-11 19:45 UTC (permalink / raw)
  To: emacs-devel

Hello,

I am trying to update a server variable from one of (Gnus') backend
functions. My first attempt was

(defvoo nnimap-my-state nil)
(deffoo nnimap-request-list (&optional server)
  (nnoo-change-server 'nnimap server nil)
  (message "Old state: %s" nnimap-my-state)
  (setq nnimap-my-state 42))

but that did not work (successive invocations would all run with
nnimap-my-state being nil). After studying the nnoo.el sources for a
bit, I concluded that nnoo-change-server updates the declared server
variables to the per-server values, but does not copy any changes back.

However, I wasn't able to figure out how to manually perform these
changes. Can someone point me in the right direction?

Best,
-Nikolaus

-- 
GPG encrypted emails preferred. Key id: 0xD113FCAC3C4E599F
Fingerprint: ED31 791B 2C5C 1613 AF38 8B8A D113 FCAC 3C4E 599F

             »Time flies like an arrow, fruit flies like a Banana.«



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

* Re: nnoo.el: how to update server variables
  2015-07-11 19:45 nnoo.el: how to update server variables Nikolaus Rath
@ 2015-12-24 16:55 ` Lars Ingebrigtsen
  2015-12-27  4:09   ` Nikolaus Rath
  0 siblings, 1 reply; 4+ messages in thread
From: Lars Ingebrigtsen @ 2015-12-24 16:55 UTC (permalink / raw)
  To: emacs-devel

Nikolaus Rath <Nikolaus@rath.org> writes:

> I am trying to update a server variable from one of (Gnus') backend
> functions. My first attempt was
>
> (defvoo nnimap-my-state nil)
> (deffoo nnimap-request-list (&optional server)
>   (nnoo-change-server 'nnimap server nil)
>   (message "Old state: %s" nnimap-my-state)
>   (setq nnimap-my-state 42))
>
> but that did not work (successive invocations would all run with
> nnimap-my-state being nil). After studying the nnoo.el sources for a
> bit, I concluded that nnoo-change-server updates the declared server
> variables to the per-server values, but does not copy any changes back.

I don't think that's correct.  When you change the server, nnoo will
stash all the values of all the "defvoo" values, and will copy them back
again when you change back to the original server.

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



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

* Re: nnoo.el: how to update server variables
  2015-12-24 16:55 ` Lars Ingebrigtsen
@ 2015-12-27  4:09   ` Nikolaus Rath
  2015-12-27  6:08     ` Lars Ingebrigtsen
  0 siblings, 1 reply; 4+ messages in thread
From: Nikolaus Rath @ 2015-12-27  4:09 UTC (permalink / raw)
  To: emacs-devel

On Dec 24 2015, Lars Ingebrigtsen <larsi@gnus.org> wrote:
> Nikolaus Rath <Nikolaus@rath.org> writes:
>
>> I am trying to update a server variable from one of (Gnus') backend
>> functions. My first attempt was
>>
>> (defvoo nnimap-my-state nil)
>> (deffoo nnimap-request-list (&optional server)
>>   (nnoo-change-server 'nnimap server nil)
>>   (message "Old state: %s" nnimap-my-state)
>>   (setq nnimap-my-state 42))
>>
>> but that did not work (successive invocations would all run with
>> nnimap-my-state being nil). After studying the nnoo.el sources for a
>> bit, I concluded that nnoo-change-server updates the declared server
>> variables to the per-server values, but does not copy any changes back.
>
> I don't think that's correct.  When you change the server, nnoo will
> stash all the values of all the "defvoo" values, and will copy them back
> again when you change back to the original server.

Ok, so why doesn't the above work then?

Best,
-Nikolaus

-- 
GPG encrypted emails preferred. Key id: 0xD113FCAC3C4E599F
Fingerprint: ED31 791B 2C5C 1613 AF38 8B8A D113 FCAC 3C4E 599F

             »Time flies like an arrow, fruit flies like a Banana.«



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

* Re: nnoo.el: how to update server variables
  2015-12-27  4:09   ` Nikolaus Rath
@ 2015-12-27  6:08     ` Lars Ingebrigtsen
  0 siblings, 0 replies; 4+ messages in thread
From: Lars Ingebrigtsen @ 2015-12-27  6:08 UTC (permalink / raw)
  To: emacs-devel

Nikolaus Rath <Nikolaus@rath.org> writes:

> Ok, so why doesn't the above work then?

I don't know.  Have you tried edebugging `nnoo-push-server to see
what happens to your variable?

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



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

end of thread, other threads:[~2015-12-27  6:08 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-07-11 19:45 nnoo.el: how to update server variables Nikolaus Rath
2015-12-24 16:55 ` Lars Ingebrigtsen
2015-12-27  4:09   ` Nikolaus Rath
2015-12-27  6:08     ` 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).