hooks, functions and features of interactive

View: New views
3 Messages — Rating Filter:   Alert me  

hooks, functions and features of interactive

by David Kettler-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

There are various places in conkeror (some user variables and hooks)
where the user specifies a function.  Some of the features of
interactive commands would be useful for those functions; I wonder if it
would be useful to have a callback() function (analogous to interactive)
to define such functions.  In particular, they could be given
documentation in this way (although its not clear how that documentation
should be presented).

Another feature of interactive that would be useful is the alternates
mechanism.  For instance I usually want url_remoting_fn to
OPEN_NEW_BUFFER.  But sometimes I want OPEN_NEW_BUFFER_BACKGROUND.  I
currently use the code below, but alternates would be nicer.

Does this sound like something worth pursuing?

Examples of variables, other than hooks, that are expected to be set to
a function:
    media_scrapers
    read_url_handler_list
    run_external_editor_function
    url_remoting_fn

Current code that would be neater with alternates:

/* For url_remoting_fn; load in a new buffer.  If -uu is given on the
 * command line, do so in the background. */
function load_url_in_new_buffer_perhaps_bg(url, ctx) {
    create_buffer_in_current_window(
        buffer_creator(content_buffer, $load = url,
                       $configuration = ctx.config),
        ctx.prefix_argument ? OPEN_NEW_BUFFER_BACKGROUND : OPEN_NEW_BUFFER,
        !ctx.prefix_argument);
}

url_remoting_fn = load_url_in_new_buffer_perhaps_bg;

regards, David
_______________________________________________
Conkeror mailing list
Conkeror@...
https://www.mozdev.org/mailman/listinfo/conkeror

Re: hooks, functions and features of interactive

by John J. Foerch :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

David Kettler <kettler@...> writes:

> Another feature of interactive that would be useful is the alternates
> mechanism.  For instance I usually want url_remoting_fn to
> OPEN_NEW_BUFFER.  But sometimes I want OPEN_NEW_BUFFER_BACKGROUND.  I
> currently use the code below, but alternates would be nicer.
>
> Does this sound like something worth pursuing?
>
> Current code that would be neater with alternates:
>
> /* For url_remoting_fn; load in a new buffer.  If -uu is given on the
>  * command line, do so in the background. */
> function load_url_in_new_buffer_perhaps_bg(url, ctx) {
>     create_buffer_in_current_window(
>         buffer_creator(content_buffer, $load = url,
>                        $configuration = ctx.config),
>         ctx.prefix_argument ? OPEN_NEW_BUFFER_BACKGROUND : OPEN_NEW_BUFFER,
>         !ctx.prefix_argument);
> }
>
> url_remoting_fn = load_url_in_new_buffer_perhaps_bg;

Hi David,

  This is very much like what I would like to do, but messier than I
want to do it.  You have noticed the existence of the command-line
switch `-uu' which allows you to give a universal-arg prefix to a
command called by the `-f' switch.  I do intend to extend this behavior
to urls passed on the command line, so that `alternates' can be used.
However, to accomplish that, I would like to deprecate the variable
`url_remoting_fn' and replace it by something along the lines of
`default_remoting_command'.  Its value will be the name of an
interactive command instead of a function.  That command will respect
-uu.  This change requires a modification to the interactive system to
remove the assumption (for some commands) that an existing window is
available.

  Incidentally, the reason that -uu has such a funny name is that `-u'
is already consumed by Mozilla.  I was also thinking of changing it to
`+u' to get around that limitation, but using `+' as a switch prefix
will require a little adjustment of the command-line module, and I
haven't gotten around to it.

  It's going to take me a long time to catch up with all the outstanding
patches on the mailing list, but I am mindful of them and appreciate
your patience.  I'll try to address each item individually.

--
John Foerch

_______________________________________________
Conkeror mailing list
Conkeror@...
https://www.mozdev.org/mailman/listinfo/conkeror

Re: hooks, functions and features of interactive

by David Kettler-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

J Foerch <jjfoerch@...> writes:

 > I would like to deprecate the variable `url_remoting_fn' and replace
 > it by something along the lines of `default_remoting_command'.  Its
 > value will be the name of an interactive command instead of a
 > function.  That command will respect -uu.

That sounds good.

 > This change requires a modification to the interactive system to
 > remove the assumption (for some commands) that an existing window is
 > available.

Is that necesary?  The command_line_handler for "uu" has this code:
         if (! ctx.window)
             ctx.window = window_watcher.activeWindow;
Provided that the conkeror server always has a window open, won't that
suffice?  If so, changing to default_remoting_command will be
straightforward.

 >   It's going to take me a long time to catch up with all the outstanding
 > patches on the mailing list, but I am mindful of them and appreciate
 > your patience.  I'll try to address each item individually.

Thanks, David
_______________________________________________
Conkeror mailing list
Conkeror@...
https://www.mozdev.org/mailman/listinfo/conkeror