all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Eli Zaretskii <eliz@gnu.org>
To: Po Lu <luangruo@yahoo.com>
Cc: 51716@debbugs.gnu.org
Subject: bug#51716: 29.0.50; [PATCH] Expose xwidget navigation history to Lisp code
Date: Tue, 09 Nov 2021 15:33:54 +0200	[thread overview]
Message-ID: <83a6id5u7x.fsf@gnu.org> (raw)
In-Reply-To: <871r3p8r05.fsf@yahoo.com> (bug-gnu-emacs@gnu.org)

> Date: Tue, 09 Nov 2021 20:15:06 +0800
> From:  Po Lu via "Bug reports for GNU Emacs,
>  the Swiss army knife of text editors" <bug-gnu-emacs@gnu.org>
> 
> I found it impossible to navigate the history of an Xwidget WebKit
> buffer after following about a dozen links, and clicking back several
> times.
> 
> This should lay the groundwork for a history navigator in Xwidget WebKit
> buffers.  I will probably work on that tomorrow.
> 
> Thanks.
> 
> >From d487e2689212d3dab108e043d49a8aa1787a7015 Mon Sep 17 00:00:00 2001
> From: Po Lu <luangruo@yahoo.com>
> Date: Tue, 9 Nov 2021 20:11:05 +0800
> Subject: [PATCH] Expose xwidget navigation history to Lisp code
> 
> * doc/lispref/display.texi (Xwidgets): Document changes.
> * etc/NEWS: Announce new function.
> * src/xwidget.c (Fxwidget_webkit_goto_history): Remove obsolete test.
> (Fxwidget_webkit_back_forward_list): New function.
> (syms_of_xwidget): Define new subr.
> ---
>  doc/lispref/display.texi |  26 ++++++++++
>  etc/NEWS                 |   5 ++
>  src/xwidget.c            | 102 +++++++++++++++++++++++++++++++++++++--
>  3 files changed, 130 insertions(+), 3 deletions(-)
> 
> diff --git a/doc/lispref/display.texi b/doc/lispref/display.texi
> index 3ccc755391..a953162ae9 100644
> --- a/doc/lispref/display.texi
> +++ b/doc/lispref/display.texi
> @@ -6953,6 +6953,32 @@ Xwidgets
>  @var{base-uri}, which defaults to @samp{about:blank}.
>  @end defun
>  
> +@defun xwidget-webkit-goto-history xwidget rel-pos
> +Make @var{xwidget}, a WebKit widget, load the @code{rel-pos}th element
> +in its navigation history.
> +
> +If @var{rel-pos} is zero, the current page will be reloaded instead.
> +@end defun
> +
> +@defun xwidget-webkit-back-forward-list xwidget &optional limit
> +Return the navigation history of @var{xwidget}, up to @var{limit}
> +items in each direction.  If not specified, @var{limit} defaults to
> +50.
> +
> +The returned value is a list of the form @code{(@var{back} @var{here}
> +@var{forward})}, where @var{here} is the current navigation item,
> +while @var{back} is a list of items containing the history behind the
> +current navigation item, and @var{forward} is a list of items in front
> +of the current navigation item.  @var{back}, @var{here} and
> +@var{forward} can all be @code{nil}.

Before I dive into the code, let me ask: why not use the usual Emacs
history machinery for this?  IOW, have some xwidget-specific history
variable that would store the browsing history, and use that variable
in conjunction with foo-prev and foo-next commands?  Why do we need to
reinvent the wheel for xwidgets, and why do that in C?





  reply	other threads:[~2021-11-09 13:33 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <871r3p8r05.fsf.ref@yahoo.com>
2021-11-09 12:15 ` bug#51716: 29.0.50; [PATCH] Expose xwidget navigation history to Lisp code Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
2021-11-09 13:33   ` Eli Zaretskii [this message]
2021-11-09 13:44     ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
2021-11-09 13:58       ` Eli Zaretskii
2021-11-09 14:06         ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
2021-11-09 14:10           ` Eli Zaretskii
2021-11-09 23:57             ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
2021-11-10 15:25   ` Eli Zaretskii
2021-11-11  1:03     ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
2021-11-13 15:02       ` Eli Zaretskii
2021-11-14  0:18         ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
2021-11-14  6:53           ` Eli Zaretskii
2021-11-14  6:58             ` Lars Ingebrigtsen
2021-11-14  6:59               ` Lars Ingebrigtsen
2021-11-14  7:11                 ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
2021-11-14  7:18                   ` Lars Ingebrigtsen
2021-11-14  7:20                     ` Lars Ingebrigtsen
2021-11-14  7:21                     ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
2021-11-14  7:29                   ` Eli Zaretskii
2021-11-14  7:33                     ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
2021-11-14  8:04                       ` Eli Zaretskii
2021-11-14  9:45                         ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
2021-11-14  7:20               ` Eli Zaretskii
2021-11-14 13:29   ` Po Lu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=83a6id5u7x.fsf@gnu.org \
    --to=eliz@gnu.org \
    --cc=51716@debbugs.gnu.org \
    --cc=luangruo@yahoo.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.