|
View:
New views
6 Messages
—
Rating Filter:
Alert me
|
|
|
Access "I" given "I.buffer"Hi
I'm currently writing some stuff for the soon useful Wikipedia mode, but I have a peculiar problem. The $enable function in the define_page_mode receives only the buffer of the window, but I need to access I.local.headings_xpath. How do I do that? -- Deniz Dogan _______________________________________________ Conkeror mailing list Conkeror@... https://www.mozdev.org/mailman/listinfo/conkeror |
|
|
Re: Access "I" given "I.buffer"Deniz Dogan <deniz.a.m.dogan@...> writes:
> Hi > I'm currently writing some stuff for the soon useful Wikipedia mode, > but I have a peculiar problem. The $enable function in the > define_page_mode receives only the buffer of the window, but I need to > access I.local.headings_xpath. How do I do that? Looking at the definition of I.local in interative.js should give you your answer. You might also try asking retroj since he wrote the current version of local variable support. -- Jeremy Maitin-Shepard _______________________________________________ Conkeror mailing list Conkeror@... https://www.mozdev.org/mailman/listinfo/conkeror |
|
|
Re: Access "I" given "I.buffer"2009/8/11 Jeremy Maitin-Shepard <jeremy@...>:
> Deniz Dogan <deniz.a.m.dogan@...> writes: > >> Hi >> I'm currently writing some stuff for the soon useful Wikipedia mode, >> but I have a peculiar problem. The $enable function in the >> define_page_mode receives only the buffer of the window, but I need to >> access I.local.headings_xpath. How do I do that? > > Looking at the definition of I.local in interative.js should give you > your answer. You might also try asking retroj since he wrote the > current version of local variable support. > The code in interactive.js made me no wiser, only more confused. When is `interactive_context' called? Should I call it myself to get the interactive context for the given buffer? Because that didn't seem to work. What is `this' in `interactive_context'? -- Deniz Dogan _______________________________________________ Conkeror mailing list Conkeror@... https://www.mozdev.org/mailman/listinfo/conkeror |
|
|
Re: Access "I" given "I.buffer"Deniz Dogan <deniz.a.m.dogan@...> writes:
> 2009/8/11 Jeremy Maitin-Shepard <jeremy@...>: >> Deniz Dogan <deniz.a.m.dogan@...> writes: >> >>> Hi >>> I'm currently writing some stuff for the soon useful Wikipedia mode, >>> but I have a peculiar problem. The $enable function in the >>> define_page_mode receives only the buffer of the window, but I need to >>> access I.local.headings_xpath. How do I do that? >> >> Looking at the definition of I.local in interative.js should give you >> your answer. You might also try asking retroj since he wrote the >> current version of local variable support. >> > The code in interactive.js made me no wiser, only more confused. When > is `interactive_context' called? Should I call it myself to get the > interactive context for the given buffer? Because that didn't seem to > work. What is `this' in `interactive_context'? interactive_context is used for interactive commands. It probably shouldn't be used anywhere else. You can find the places that create interactive_context objects by looking for calls to call_interactively. Basically it just stores the buffer on which the command was invoked, any additional information that was recorded while entering the command (e.g. a prefix argument or browser object class), and then also has some convenience properties that provide a shorter syntax for things related to the various state that it encapsulates. The "local" property is one such convenience accessor. Generally interactive_context should not be the primary point of definition of any facilities except if they are solely useful when dealing with interactive commands. Certainly buffer/page-local variables are not solely related to interactive commands, so the primary accessor for them should not be defined in interactive_context, but instead should probably be defined in the buffer class. If it isn't already, it would probably be a good idea to add such a definition. interactive_context could still provide a convenience accessor as well, though. -- Jeremy Maitin-Shepard _______________________________________________ Conkeror mailing list Conkeror@... https://www.mozdev.org/mailman/listinfo/conkeror |
|
|
Re: Access "I" given "I.buffer"2009/8/12 Jeremy Maitin-Shepard <jeremy@...>:
> Deniz Dogan <deniz.a.m.dogan@...> writes: > >> 2009/8/11 Jeremy Maitin-Shepard <jeremy@...>: >>> Deniz Dogan <deniz.a.m.dogan@...> writes: >>> >>>> Hi >>>> I'm currently writing some stuff for the soon useful Wikipedia mode, >>>> but I have a peculiar problem. The $enable function in the >>>> define_page_mode receives only the buffer of the window, but I need to >>>> access I.local.headings_xpath. How do I do that? >>> >>> Looking at the definition of I.local in interative.js should give you >>> your answer. You might also try asking retroj since he wrote the >>> current version of local variable support. >>> > >> The code in interactive.js made me no wiser, only more confused. When >> is `interactive_context' called? Should I call it myself to get the >> interactive context for the given buffer? Because that didn't seem to >> work. What is `this' in `interactive_context'? > > interactive_context is used for interactive commands. It probably > shouldn't be used anywhere else. You can find the places that create > interactive_context objects by looking for calls to call_interactively. > Basically it just stores the buffer on which the command was invoked, > any additional information that was recorded while entering the command > (e.g. a prefix argument or browser object class), and then also has some > convenience properties that provide a shorter syntax for things related > to the various state that it encapsulates. The "local" property is one > such convenience accessor. Generally interactive_context should not be > the primary point of definition of any facilities except if they are > solely useful when dealing with interactive commands. Certainly > buffer/page-local variables are not solely related to interactive > commands, so the primary accessor for them should not be defined in > interactive_context, but instead should probably be defined in the > buffer class. If it isn't already, it would probably be a good idea to > add such a definition. interactive_context could still provide a > convenience accessor as well, though. > Okay, now I'm *barely* following... :) interactive_context is for interactive commands, so what good is it for my $enable function in my page mode? -- Deniz Dogan _______________________________________________ Conkeror mailing list Conkeror@... https://www.mozdev.org/mailman/listinfo/conkeror |
|
|
Re: Access "I" given "I.buffer"Deniz Dogan <deniz.a.m.dogan@...> writes:
> Okay, now I'm *barely* following... :) interactive_context is for > interactive commands, so what good is it for my $enable function in my > page mode? It isn't good at all. That's why I suggested that if something equivalent to I.local isn't already defined somewhere else (for general purpose use), you should consider adding it, and then using it. -- Jeremy Maitin-Shepard _______________________________________________ Conkeror mailing list Conkeror@... https://www.mozdev.org/mailman/listinfo/conkeror |
| Free embeddable forum powered by Nabble | Forum Help |