From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Visuwesh Newsgroups: gmane.emacs.bugs Subject: bug#58118: 29.0.50; Follow #target links in eww without re-rendering page Date: Tue, 27 Sep 2022 21:08:35 +0530 Message-ID: <87leq4rfno.fsf@gmail.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="5746"; mail-complaints-to="usenet@ciao.gmane.io" To: 58118@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Tue Sep 27 18:16:36 2022 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1odDG6-0001H5-K2 for geb-bug-gnu-emacs@m.gmane-mx.org; Tue, 27 Sep 2022 18:16:34 +0200 Original-Received: from localhost ([::1]:38622 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1odDG5-0006rf-LR for geb-bug-gnu-emacs@m.gmane-mx.org; Tue, 27 Sep 2022 12:16:33 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:33218) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1odCfm-0003BN-EF for bug-gnu-emacs@gnu.org; Tue, 27 Sep 2022 11:39:02 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:57488) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1odCfm-0006Vh-62 for bug-gnu-emacs@gnu.org; Tue, 27 Sep 2022 11:39:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1odCfl-0002iL-RZ for bug-gnu-emacs@gnu.org; Tue, 27 Sep 2022 11:39:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Visuwesh Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 27 Sep 2022 15:39:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 58118 X-GNU-PR-Package: emacs X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.166429313410415 (code B ref -1); Tue, 27 Sep 2022 15:39:01 +0000 Original-Received: (at submit) by debbugs.gnu.org; 27 Sep 2022 15:38:54 +0000 Original-Received: from localhost ([127.0.0.1]:56566 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1odCfe-0002hu-0l for submit@debbugs.gnu.org; Tue, 27 Sep 2022 11:38:54 -0400 Original-Received: from lists.gnu.org ([209.51.188.17]:42678) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1odCfZ-0002hk-R7 for submit@debbugs.gnu.org; Tue, 27 Sep 2022 11:38:52 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:35780) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1odCfZ-0002Z7-Ks for bug-gnu-emacs@gnu.org; Tue, 27 Sep 2022 11:38:49 -0400 Original-Received: from mail-pj1-x1043.google.com ([2607:f8b0:4864:20::1043]:56274) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1odCfW-0006Ug-Po for bug-gnu-emacs@gnu.org; Tue, 27 Sep 2022 11:38:49 -0400 Original-Received: by mail-pj1-x1043.google.com with SMTP id fs14so9651177pjb.5 for ; Tue, 27 Sep 2022 08:38:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:message-id:date:subject:to:from:from:to:cc:subject :date; bh=AYNY6SV5ra8TyuFKtqXidQlQJGz+E5c42xqbQYHIRco=; b=NpW96jQpiW1OTgpsooQLOSCKIR3u6La+52A6DQh1tPYPwaN9FVyxQSY3BoaTPNo9oN +GqjHSiPuPj9niDYS766vpPAJa712uQXp0XRThUt0tBODMSX5EGhXYUqWOxnOomGeMtU OpFz11OZXvQDoN4F6FgW+T/iGIVPeGFhtFmOzdWdWqj0Vs/xuQNyAKwWMtO46cuslPJt oSgldtelp0TVXs9MJTVbiGaxyZqOyf66kKT/aDM92bjqckvrfimPJbPnQ53ObCrlFktH 3y8Pxm62GU7kDlP6pMAQsA+T7T7+26WzeGfr1XCYXcAptT0KhU1XRj6DEUbrv4RBGeWI t9Mg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=mime-version:message-id:date:subject:to:from:x-gm-message-state :from:to:cc:subject:date; bh=AYNY6SV5ra8TyuFKtqXidQlQJGz+E5c42xqbQYHIRco=; b=ib5Uwu4WH1G+jbfldf1wbHeBM8uLs6UCtdO46S0rilgsZ4jf9rPSa7zIfwyRi7p/iC QVHMPxmzlxjDCqnqyY8YYI05D9e1piHAtBx7y2rr9Wue1OhGFWbf/H6T+LLB1fbbsqRu FChS1GSPjxQXDeeDHCqEsoDNxfaJHDGbM+pPxeLGap3epwdWZ8+cXpIT3HAGkxb+E01o uOAUXZuRJR+SKRj81+0IBkbK8JYcr/n/OVhtJ/tVkWH0vGroNyC5F5y9fkRpNWYdpc7b LIV90HE2U9DyM7rV6YmM7ka8iPWVoutMCic6gqUmNrQxih28kCkSwFv830JERB/djI+7 ribg== X-Gm-Message-State: ACrzQf2IHqko2/OF82NlKPGFrMPplAB2lMCXTKHoWrQPMuHfe1gDVMUN tIgVwoEypmVFyQg7pUy3mj/GuQtXeww= X-Google-Smtp-Source: AMsMyM4ROX3nnOqPXQy9Uy1ZkOyWUjEbEAVw3L4xIa29OolQuHwy+phY1LQRBerEfkQlHWJENNPOJA== X-Received: by 2002:a17:90a:67c1:b0:202:e10a:4f14 with SMTP id g1-20020a17090a67c100b00202e10a4f14mr5318891pjm.238.1664293124753; Tue, 27 Sep 2022 08:38:44 -0700 (PDT) Original-Received: from localhost ([118.185.152.162]) by smtp.gmail.com with ESMTPSA id y23-20020a17090264d700b00176a579fae8sm1661865pli.210.2022.09.27.08.38.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 27 Sep 2022 08:38:43 -0700 (PDT) Received-SPF: pass client-ip=2607:f8b0:4864:20::1043; envelope-from=visuweshm@gmail.com; helo=mail-pj1-x1043.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:243740 Archived-At: --=-=-= Content-Type: text/plain Severity: wishlist eww-follow-link currently follows #target links in the same URL by re-rendering the page. Whilst this is fine for small HTML files, the 1.9M HTML file that I'm currently visiting takes a couple seconds to render. I see that eww-display-html follows #target links by a text property search, why don't we do the same in eww-follow-link as well? I have one question though: what do we about non-existent #targets? Chrome and Firefox seem to not scroll when I add a non-existent #target to the current URL and say RET, and it seems to specially handle #top to mean to go to the top even if the HTML has no hits for "#top". Should we handle the special #top target? By non-existent targets, I mean to say that (goto-char (point-min)) (text-property-search-forward 'shr-target-id "invalid" #'member) returns nil for a non-existent "#invalid" target. Tentative patch attached, --=-=-= Content-Type: text/x-diff Content-Disposition: attachment; filename=eww-target.patch diff --git a/lisp/net/eww.el b/lisp/net/eww.el index 61b1b75068..6ac198099a 100644 --- a/lisp/net/eww.el +++ b/lisp/net/eww.el @@ -315,7 +315,8 @@ eww-accept-content-types (defvar-keymap eww-link-keymap :parent shr-map - "RET" #'eww-follow-link) + "RET" #'eww-follow-link + "" #'eww-follow-link) (defvar-keymap eww-image-link-keymap :parent shr-map @@ -1901,7 +1902,8 @@ eww-follow-link eww-mode) (mouse-set-point mouse-event) (let* ((orig-url (get-text-property (point) 'shr-url)) - (url (eww--transform-url orig-url))) + (url (eww--transform-url orig-url)) + target) (cond ((not url) (message "No link under point")) @@ -1913,12 +1915,17 @@ eww-follow-link (funcall browse-url-secondary-browser-function url) (shr--blink-link)) ;; This is a #target url in the same page as the current one. - ((and (url-target (url-generic-parse-url url)) + ((and (setq target (url-target (url-generic-parse-url url))) (eww-same-page-p url (plist-get eww-data :url))) - (let ((dom (plist-get eww-data :dom))) + (let ((dom (plist-get eww-data :dom)) + match) (eww-save-history) (plist-put eww-data :url url) - (eww-display-html 'utf-8 url dom nil (current-buffer)))) + (goto-char (point-min)) + (setq match (text-property-search-forward 'shr-target-id target #'member)) + (if match + (goto-char (prop-match-beginning match)) + (eww-display-html 'utf-8 url dom nil (current-buffer))))) (t (eww-browse-url orig-url external))))) --=-=-= Content-Type: text/plain In GNU Emacs 29.0.50 (build 31, x86_64-pc-linux-gnu, X toolkit, cairo version 1.16.0, Xaw scroll bars) of 2022-09-27 built on astatine Repository revision: 51ec68b3182914c6c95d6ddcd88ae75239ec2904 Repository branch: master Windowing system distributor 'The X.Org Foundation', version 11.0.12101004 System Description: Debian GNU/Linux bookworm/sid Configured using: 'configure --with-x-toolkit=lucid --without-xaw3d' Configured features: ACL CAIRO DBUS FREETYPE GIF GLIB GMP GNUTLS GPM GSETTINGS HARFBUZZ JPEG JSON LIBOTF LIBSELINUX LIBSYSTEMD LIBXML2 MODULES NOTIFY INOTIFY PDUMPER PNG RSVG SECCOMP SOUND SQLITE3 THREADS TIFF TOOLKIT_SCROLL_BARS WEBP X11 XDBE XIM XINPUT2 XPM LUCID ZLIB Important settings: value of $LC_MONETARY: ta_IN.UTF-8 value of $LC_NUMERIC: ta_IN.UTF-8 value of $LANG: en_GB.UTF-8 locale-coding-system: utf-8-unix Major mode: ELisp/l Minor modes in effect: shell-dirtrack-mode: t recentf-mode: t bug-reference-prog-mode: t paredit-mode: t eros-mode: t flymake-mode: t pdf-occur-global-minor-mode: t minibuffer-depth-indicate-mode: t repeat-mode: t display-time-mode: t display-battery-mode: t winner-mode: t vz/acme-tag-minor-mode: t delete-selection-mode: t xterm-mouse-mode: t straight-use-package-mode: t straight-package-neutering-mode: t tooltip-mode: t global-eldoc-mode: t eldoc-mode: t show-paren-mode: t electric-indent-mode: t mouse-wheel-mode: t use-hard-newlines: t tab-bar-mode: t file-name-shadow-mode: t global-font-lock-mode: t font-lock-mode: t undelete-frame-mode: t transient-mark-mode: t auto-composition-mode: t auto-encryption-mode: t auto-compression-mode: t abbrev-mode: t Load-path shadows: None found. Features: (shadow sort flyspell ispell ecomplete mail-extr emacsbug message yank-media rfc822 mml mml-sec epa epg rfc6068 epg-config mm-decode mm-bodies mm-encode mailabbrev gmm-utils mailheader sendmail sh-script smie files-x shell-command+ shell pcomplete gnutls network-stream url-http url-gw nsm shortdoc help-fns radix-tree textsec uni-scripts idna-mapping uni-confusable textsec-check ucs-normalize shr-color mail-parse rfc2231 rfc2047 rfc2045 ietf-drums url-cache url-auth eww xdg url-queue shr pixel-fill kinsoku url-file svg puny mm-url gnus nnheader gnus-util mail-utils range mm-util mail-prsvr executable recentf tree-widget vc-backup log-view pcvs-util vc diff pulse color avy misearch multi-isearch noutline outline vc-git diff-mode vc-dispatcher bug-reference cursor-sensor face-remap server paredit edmacro kmacro eros time-date checkdoc lisp-mnt flymake-proc flymake project warnings thingatpt wordel-autoloads sokoban-autoloads ement-autoloads svg-lib-autoloads taxy-magit-section-autoloads magit-section-autoloads dash-autoloads taxy-autoloads plz-autoloads nov-autoloads esxml-autoloads kv-autoloads transmission-autoloads lua-mode-autoloads nix-mode-autoloads gnuplot-autoloads racket-mode-autoloads eros-autoloads flymake-shellcheck-autoloads writegood-mode-autoloads siege-mode-autoloads paredit-autoloads puni-autoloads expand-region-autoloads filladapt-autoloads compose scroll-other-window org-pdftools-autoloads org-noter-autoloads change-env-autoloads math-delimiters-autoloads doct-autoloads ob-async-autoloads async-autoloads emacs-ob-racket-autoloads valign-autoloads cdlatex-autoloads auctex-autoloads tex-site pdf-occur ibuf-ext ibuffer ibuffer-loaddefs tablist advice tablist-filter semantic/wisent/comp semantic/wisent semantic/wisent/wisent semantic/util-modes semantic/util semantic semantic/tag semantic/lex semantic/fw mode-local find-func cedet pdf-isearch let-alist pdf-misc imenu pdf-tools package browse-url url url-proxy url-privacy url-expand url-methods url-history url-cookie generate-lisp-file url-domsuf url-util mailcap url-handlers url-parse auth-source eieio eieio-core json map byte-opt url-vars compile comint osc ansi-color cus-edit icons wid-edit pdf-view password-cache jka-compr pdf-cache pdf-info tq pdf-util pdf-macs image-mode dired-x dired dired-loaddefs exif pdf-tools-autoloads tablist-autoloads mb-depth repeat visual-fill-autoloads olivetti-autoloads time format-spec battery dbus filenotify xml dom tamil99 quail disp-table lacarte-autoloads shell-command-plus-autoloads winner ring delsel easy-mmode xt-mouse cus-load avy-autoloads finder-inf vc-backup-autoloads compat-autoloads icalendar diary-lib diary-loaddefs cal-menu calendar cal-loaddefs filecache imenu-xref-autoloads derived chemtable-autoloads molar-mass-autoloads rx saveplace-pdf-view saveplace bookmark text-property-search pp saveplace-pdf-view-autoloads pcase inspector-autoloads xr-autoloads straight-autoloads cl-seq info cl-extra help-mode straight subr-x cl-macs gv cl-loaddefs cl-lib bytecomp byte-compile cconv vz-nh-theme vz-options-theme rmc iso-transl tooltip eldoc paren electric uniquify ediff-hook vc-hooks lisp-float-type elisp-mode mwheel term/x-win x-win term/common-win x-dnd tool-bar dnd fontset image regexp-opt fringe tabulated-list replace newcomment text-mode lisp-mode prog-mode register page tab-bar menu-bar rfn-eshadow isearch easymenu timer select scroll-bar mouse jit-lock font-lock syntax font-core term/tty-colors frame minibuffer nadvice seq simple cl-generic indonesian philippine cham georgian utf-8-lang misc-lang vietnamese tibetan thai tai-viet lao korean japanese eucjp-ms cp51932 hebrew greek romanian slovak czech european ethiopic indian cyrillic chinese composite emoji-zwj charscript charprop case-table epa-hook jka-cmpr-hook help abbrev obarray oclosure cl-preloaded button loaddefs faces cus-face macroexp files window text-properties overlay sha1 md5 base64 format env code-pages mule custom widget keymap hashtable-print-readable backquote threads dbusbind inotify dynamic-setting system-font-setting font-render-setting cairo x-toolkit xinput2 x multi-tty make-network-process emacs) Memory information: ((conses 16 616972 46438) (symbols 48 23834 4) (strings 32 146028 7174) (string-bytes 1 13261806) (vectors 16 77190) (vector-slots 8 1720887 205584) (floats 8 378 535) (intervals 56 73815 211) (buffers 1000 37)) --=-=-=--