From: James Thomas via "Bug reports for GNU Emacs, the Swiss army knife of text editors" <bug-gnu-emacs@gnu.org>
To: 71450@debbugs.gnu.org
Cc: jporterbugs@gmail.com
Subject: bug#71450: [PATCH] Wrong eww-history-position after desktop restore if within history
Date: Sun, 09 Jun 2024 17:53:29 +0530 [thread overview]
Message-ID: <86h6e21f0e.fsf@outlook.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 2370 bytes --]
- emacs -Q
- M-x eww RET <any website> RET
- RET (on any link)
- l
- M-x desktop-save RET <any directory> RET
- C-x C-c (exit)
- emacs -Q
- M-x desktop-read RET <the above directory> RET
- g (to reload the webpage)
- RET (on any link) fails
In GNU Emacs 30.0.50 (build 1, x86_64-pc-linux-gnu, GTK+ Version
3.24.38, cairo version 1.18.0) of 2024-06-09 built on
user-Inspiron-3493
Repository revision: e9a0256a556622474bcbb015f88d790666db2cc9
Repository branch: master
Windowing system distributor 'The X.Org Foundation', version 11.0.12101007
System Description: Ubuntu 23.10
Configured using:
'configure --with-native-compilation=aot'
Configured features:
ACL CAIRO DBUS FREETYPE GIF GLIB GMP GNUTLS GPM GSETTINGS HARFBUZZ JPEG
LCMS2 LIBOTF LIBSELINUX LIBSYSTEMD LIBXML2 M17N_FLT MODULES NATIVE_COMP
NOTIFY INOTIFY PDUMPER PNG RSVG SECCOMP SOUND SQLITE3 THREADS TIFF
TOOLKIT_SCROLL_BARS TREE_SITTER WEBP X11 XDBE XIM XINPUT2 XPM GTK3 ZLIB
Important settings:
value of $LANG: en_IN
value of $XMODIFIERS: @im=ibus
locale-coding-system: iso-latin-1-unix
Major mode: VC dir
Minor modes in effect:
rcirc-track-minor-mode: t
display-time-mode: t
pdf-occur-global-minor-mode: t
vc-dir-git-mode: t
global-git-commit-mode: t
magit-auto-revert-mode: t
desktop-environment-mode: t
server-mode: t
erc-track-mode: t
erc-ring-mode: t
erc-netsplit-mode: t
erc-menu-mode: t
erc-match-mode: t
erc-log-mode: t
erc-list-mode: t
erc-irccontrols-mode: t
erc-noncommands-mode: t
erc-move-to-prompt-mode: t
erc-readonly-mode: t
erc-button-mode: t
erc-fill-mode: t
erc-stamp-mode: t
erc-autojoin-mode: t
savehist-mode: t
midnight-mode: t
icomplete-mode: t
fido-mode: t
erc-networks-mode: t
display-battery-mode: t
desktop-save-mode: t
override-global-mode: t
tooltip-mode: t
global-eldoc-mode: t
show-paren-mode: t
electric-indent-mode: t
mouse-wheel-mode: t
tool-bar-mode: t
menu-bar-mode: t
file-name-shadow-mode: t
global-font-lock-mode: t
font-lock-mode: t
blink-cursor-mode: t
minibuffer-regexp-mode: t
buffer-read-only: t
line-number-mode: t
indent-tabs-mode: t
transient-mark-mode: t
auto-composition-mode: t
auto-encryption-mode: t
auto-compression-mode: t
This is a patch that I think is simple enough to forgo the extensive
testing which it hasn't been subjected to.
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: [PATCH] Correct eww-history-position in desktop restore --]
[-- Type: text/x-patch, Size: 2454 bytes --]
From c5a9be613fb2c0a96db0dadb11ff2584c4ebbc8c Mon Sep 17 00:00:00 2001
From: James Thomas <jimjoe@gmx.net>
Date: Sun, 9 Jun 2024 17:35:21 +0530
Subject: [PATCH] Correct eww-history-position in desktop restore
Account for duplicate removal from eww-history.
* lisp/net/eww.el (eww-desktop-misc-data): Add :history-position
(eww-restore-desktop): Use it.
(desktop-locals-to-save): Remove the raw variable.
---
lisp/net/eww.el | 21 +++++++++++++--------
1 file changed, 13 insertions(+), 8 deletions(-)
diff --git a/lisp/net/eww.el b/lisp/net/eww.el
index 977210e9cc8..bd63e52ee77 100644
--- a/lisp/net/eww.el
+++ b/lisp/net/eww.el
@@ -2754,11 +2754,17 @@ eww-desktop-misc-data
Generally, the list should not include the (usually overly large)
:dom, :source and :text properties."
(let ((history (mapcar #'eww-desktop-data-1
- (cons eww-data eww-history))))
- (list :history (if eww-desktop-remove-duplicates
- (cl-remove-duplicates
- history :test #'eww-desktop-history-duplicate)
- history))))
+ (cons eww-data eww-history)))
+ rval)
+ (list :history
+ (setq rval (if eww-desktop-remove-duplicates
+ (cl-remove-duplicates
+ history :test #'eww-desktop-history-duplicate)
+ history))
+ :history-position
+ (cl-position
+ (elt history eww-history-position)
+ rval :test #'eww-desktop-history-duplicate))))
(defun eww-restore-desktop (file-name buffer-name misc-data)
"Restore an eww buffer from its desktop file record.
@@ -2772,7 +2778,8 @@ eww-restore-desktop
(setq eww-history (cdr (plist-get misc-data :history))
eww-data (or (car (plist-get misc-data :history))
;; backwards compatibility
- (list :url (plist-get misc-data :uri))))
+ (list :url (plist-get misc-data :uri)))
+ eww-history-position (plist-get misc-data :history-position))
(unless file-name
(when (plist-get eww-data :url)
(cl-case eww-restore-desktop
@@ -2784,8 +2791,6 @@ eww-restore-desktop
;; .
(current-buffer)))
-(add-to-list 'desktop-locals-to-save
- 'eww-history-position)
(add-to-list 'desktop-buffer-mode-handlers
'(eww-mode . eww-restore-desktop))
--
2.40.1
next reply other threads:[~2024-06-09 12:23 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-06-09 12:23 James Thomas via Bug reports for GNU Emacs, the Swiss army knife of text editors [this message]
2024-06-09 21:20 ` bug#71450: [PATCH] Wrong eww-history-position after desktop restore if within history Jim Porter
2024-06-09 23:33 ` James Thomas via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-06-10 21:36 ` James Thomas via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-06-16 0:01 ` Jim Porter
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
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=86h6e21f0e.fsf@outlook.com \
--to=bug-gnu-emacs@gnu.org \
--cc=71450@debbugs.gnu.org \
--cc=jimjoe@gmx.net \
--cc=jporterbugs@gmail.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 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).