Subject: Re: bug#59381: Should xref--marker-ring be per-window?

From: Dmitry Gutov <[email-masked]>
Date: Thu, 24 Nov 2022 05:28:59 +0200

On 22/11/22 04:46, Ackerley Tng wrote:
> Here's a patch for review!

It's reasonable, but what if we turn xref-storage-type into a variable 
that gets set to a function? One that knows how to retrieve and set the 
value. E.g.:

(defcustom xref-storage-type 'xref-window-local-history
   ...)

(defun xref-window-local-history (&optional new-value)
   (let ((w (selected-window)))
     (if new-value
         (set-window-parameter w 'xref--history new-value)
       (or (window-parameter w 'xref--history)
           (cons nil nil)))))

(defun xref-global-history (&optional new-value)
   (if new-value
       (setq xref--history new-value)
     xref--history))

Then it will be trivial to extend with new storage mechanisms.

> I made 'window-local the default storage so that we would hopefully
> get more feedback, do let me know if I should leave the default as
> 'global.

That's not how we introduce changes here, with rare exceptions.

window-local storage is going to be disruptive (I'm fairly sure), so 
let's keep the current behavior as default.