From mboxrd@z Thu Jan  1 00:00:00 1970
Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail
From: Thierry Volpiatto <thievol@posteo.net>
Newsgroups: gmane.emacs.bugs
Subject: bug#66394: 29.1; Make register-read-with-preview more useful
Date: Tue, 24 Oct 2023 07:19:11 +0000
Message-ID: <87ttqgpjiz.fsf@posteo.net>
References: <87il7ib6cu.fsf@posteo.net> <87sf67qqmp.fsf@web.de>
 <875y3386ep.fsf@posteo.net> <87a5sddh14.fsf@web.de>
 <8734y5vnj7.fsf@posteo.net> <87bkcslr18.fsf@web.de>
 <87y1fwtyrl.fsf@posteo.net> <87y1fut1wp.fsf@web.de>
Mime-Version: 1.0
Content-Type: multipart/signed; boundary="=-=-=";
 micalg=pgp-sha512; protocol="application/pgp-signature"
Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214";
	logging-data="6994"; mail-complaints-to="usenet@ciao.gmane.io"
Cc: 66394@debbugs.gnu.org
To: Michael Heerdegen <michael_heerdegen@web.de>
Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Tue Oct 24 09:29:05 2023
Return-path: <bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org>
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 <bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org>)
	id 1qvBqa-0001bR-Kn
	for geb-bug-gnu-emacs@m.gmane-mx.org; Tue, 24 Oct 2023 09:29:04 +0200
Original-Received: from localhost ([::1] helo=lists1p.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.90_1)
	(envelope-from <bug-gnu-emacs-bounces@gnu.org>)
	id 1qvBq5-0001qJ-Sz; Tue, 24 Oct 2023 03:28:33 -0400
Original-Received: from eggs.gnu.org ([2001:470:142:3::10])
 by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <Debian-debbugs@debbugs.gnu.org>)
 id 1qvBq5-0001ps-1H
 for bug-gnu-emacs@gnu.org; Tue, 24 Oct 2023 03:28:33 -0400
Original-Received: from debbugs.gnu.org ([2001:470:142:5::43])
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)
 (Exim 4.90_1) (envelope-from <Debian-debbugs@debbugs.gnu.org>)
 id 1qvBq4-0005z3-L3
 for bug-gnu-emacs@gnu.org; Tue, 24 Oct 2023 03:28:32 -0400
Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2)
 (envelope-from <Debian-debbugs@debbugs.gnu.org>) id 1qvBqY-0001p9-1R
 for bug-gnu-emacs@gnu.org; Tue, 24 Oct 2023 03:29:02 -0400
X-Loop: help-debbugs@gnu.org
Resent-From: Thierry Volpiatto <thievol@posteo.net>
Original-Sender: "Debbugs-submit" <debbugs-submit-bounces@debbugs.gnu.org>
Resent-CC: bug-gnu-emacs@gnu.org
Resent-Date: Tue, 24 Oct 2023 07:29:01 +0000
Resent-Message-ID: <handler.66394.B66394.16981324996962@debbugs.gnu.org>
Resent-Sender: help-debbugs@gnu.org
X-GNU-PR-Message: followup 66394
X-GNU-PR-Package: emacs
Original-Received: via spool by 66394-submit@debbugs.gnu.org id=B66394.16981324996962
 (code B ref 66394); Tue, 24 Oct 2023 07:29:01 +0000
Original-Received: (at 66394) by debbugs.gnu.org; 24 Oct 2023 07:28:19 +0000
Original-Received: from localhost ([127.0.0.1]:52937 helo=debbugs.gnu.org)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <debbugs-submit-bounces@debbugs.gnu.org>)
 id 1qvBpr-0001o9-8f
 for submit@debbugs.gnu.org; Tue, 24 Oct 2023 03:28:19 -0400
Original-Received: from mout02.posteo.de ([185.67.36.66]:43291)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <thievol@posteo.net>) id 1qvBpn-0001nn-8Z
 for 66394@debbugs.gnu.org; Tue, 24 Oct 2023 03:28:18 -0400
Original-Received: from submission (posteo.de [185.67.36.169]) 
 by mout02.posteo.de (Postfix) with ESMTPS id C6137240101
 for <66394@debbugs.gnu.org>; Tue, 24 Oct 2023 09:27:39 +0200 (CEST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017;
 t=1698132459; bh=ccTYxRDO8AefTEGbPty59icoIj/ARACxX3ZOrnlULn0=;
 h=From:To:Cc:Subject:Date:Message-ID:MIME-Version:From;
 b=ozIjq6XEh31+6RyMwVShed344Ruph0jQv8b1L5+ukCdd0CY8WkMhH8Ml50d2Dcphf
 zF9XPPlfQWmqhkQK7tOJea3ppbXj7xfPITEbyaGBYaGe3A2dZp1GD+Wn0mbhduvKvx
 VZfMubwVugDlSGTGHrzbgQeK4+Z5u6m13qD3ildj1aQu49EGA+se3MHUCHcLN+Bkcq
 EpMv3KKGrNvcJaIYM3Plziufcfvjs/yLH3kXSi7rC+pFXXk/enBSfAALsslhhgLgtT
 U7drhJetO/zJOq8Pt7vX3fKw4oViM3glO336rDuNeRz/OMRC+Y2scLh03r8FFE0GGq
 ooHOCdW2nuVPw==
Original-Received: from customer (localhost [127.0.0.1])
 by submission (posteo.de) with ESMTPSA id 4SF3YQ6klrz9rxG;
 Tue, 24 Oct 2023 09:27:38 +0200 (CEST)
In-reply-to: <87y1fut1wp.fsf@web.de>
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" <bug-gnu-emacs.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/bug-gnu-emacs>,
 <mailto:bug-gnu-emacs-request@gnu.org?subject=unsubscribe>
List-Archive: <https://lists.gnu.org/archive/html/bug-gnu-emacs>
List-Post: <mailto:bug-gnu-emacs@gnu.org>
List-Help: <mailto:bug-gnu-emacs-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/bug-gnu-emacs>,
 <mailto:bug-gnu-emacs-request@gnu.org?subject=subscribe>
Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org
Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org
Xref: news.gmane.io gmane.emacs.bugs:273080
Archived-At: <http://permalink.gmane.org/gmane.emacs.bugs/273080>

--=-=-=
Content-Type: text/plain
Content-Transfer-Encoding: quoted-printable


Michael Heerdegen <michael_heerdegen@web.de> writes:

> It would not be good to carve the current register type system
> into stone.  Instead of your `register-type' function I would prefer
> something extensible, for the case of new register types being added
> (even a normal user might want to do this).  So, when one wants to add a
> new register type, it is necessary that one is able to declare, in some
> way, whether registers of this type should be included or not for
> `insert-register' (and maybe also `jump-to-register').

A possible solution for this is adding two vars, insert-register-types
and jump-to-register-types and define register-type like this (named
register--type here):

(defun register--type (register)
  ;; Call register/type against the register value.
  (register/type (if (consp (cdr register))
                     (cadr register)
                   (cdr register))))

(cl-defgeneric register/type (regval))

(cl-defmethod register/type ((regval string)) 'string)
(cl-defmethod register/type ((regval number)) 'number)
(cl-defmethod register/type ((regval marker)) 'marker)
(cl-defmethod register/type ((regval window-configuration)) 'window)
(cl-deftype frame-register () '(satisfies frameset-register-p))
(cl-defmethod register/type :extra "frame-register" (regval) 'frame)

;; set a new register and check its type like this:
(register--type (car register-alist))

So if one wants a new register type he has just to add the type to one
of insert-register-types or jump-to-register-types and add a new
defmethod for this type. If the new type in not one of cl-typep he may
have to define a new type like above.


=2D-=20
Thierry

--=-=-=
Content-Type: application/pgp-signature; name="signature.asc"

-----BEGIN PGP SIGNATURE-----

iQHHBAEBCgAxFiEEI9twfRN7r3nig/xwDsVtFB0W75MFAmU3ceQTHHRoaWV2b2xA
cG9zdGVvLm5ldAAKCRAOxW0UHRbvk7E8DACojdkNHaOcU+9LsTtd3xoZr+HfKrFW
DoLiUqMCJnL2qwQykHJkfxXxIBzIg+AyRA+7DIU2VxJFhpGUj+OTj2cHjaIXCtRF
DXpTsNaQmrZ3bzBoz/sJKOJh8N/fEPUWthLQh88cnFheApjofKdrdMz3ML1yiz2R
Nz4sKA4OF2xvdMGUfuTlYd5QIqTZsb0mwEc2ek0LSV6buGqejwvYJ/iZChlZo8Hj
liBVCO1vng3HR52PNYh/AZWNmAttRnLPiPEWWmpgQOUKKWKkwskIZT7q/9vlU1V9
+iPQk/1INvgAecUy4UHxGefJKvi7L+mpnHo+/3NU3/OLO9fMGr6yUrxKqbae18kP
j+qiexjMgPxEzA65R9M2/AdyxjTif1Rux5lUMaf9iR5ReVNmdIjPjlCRpI0ZEG1/
lpJdZfvHvmZQLxxdw88kMMeFCO0V8b35qZbfKusfQSUl8FEBFH9UYYYMtJY5WBZy
t8f8U+qAWjHhfauaOOlFVqfST7tAQvGx5Qk=
=VCS0
-----END PGP SIGNATURE-----
--=-=-=--