From: James Thomas Date: Mon, 10 Jun 2024 21:30:33 +0000 (+0530) Subject: Account for duplicate removal on restoring eww-history-position X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=01d5dd4d5a257356fb8b24e16a40718bb44e2902;p=emacs.git Account for duplicate removal on restoring eww-history-position * lisp/net/eww.el (eww-desktop-misc-data): Add :history-position (eww-restore-desktop): Use it. (desktop-locals-to-save): Remove the raw variable. (cherry picked from commit 65b7f87a31da2e78285c5eb1ee2b2b38fc349361) --- diff --git a/lisp/net/eww.el b/lisp/net/eww.el index 977210e9cc8..fd8f80065b1 100644 --- a/lisp/net/eww.el +++ b/lisp/net/eww.el @@ -2754,11 +2754,20 @@ Only the properties listed in `eww-desktop-data-save' are included. 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))) + (posn eww-history-position) rval) + (list :history + (if eww-desktop-remove-duplicates + (prog1 + (setq + rval (cl-remove-duplicates + history :test #'eww-desktop-history-duplicate)) + (setq posn + (cl-position + (elt history eww-history-position) + rval :test #'eq))) + history) + :history-position posn))) (defun eww-restore-desktop (file-name buffer-name misc-data) "Restore an eww buffer from its desktop file record. @@ -2772,7 +2781,8 @@ Otherwise, the restored buffer will contain a prompt to do so by using (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 +2794,6 @@ Otherwise, the restored buffer will contain a prompt to do so by using ;; . (current-buffer))) -(add-to-list 'desktop-locals-to-save - 'eww-history-position) (add-to-list 'desktop-buffer-mode-handlers '(eww-mode . eww-restore-desktop))