GNU bug report logs - #8415
23.3.50; Extensible Emacs Registers

Previous Next

Package: emacs;

Reported by: Leo <sdl.web <at> gmail.com>

Date: Sun, 3 Apr 2011 12:30:03 UTC

Severity: wishlist

Tags: patch

Found in version 23.3.50

Fixed in version 24.1

Done: Glenn Morris <rgm <at> gnu.org>

Bug is archived. No further changes may be made.

Full log


Message #16 received at 8415 <at> debbugs.gnu.org (full text, mbox):

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: Leo <sdl.web <at> gmail.com>
Cc: Davis Herring <herring <at> lanl.gov>,
	Daniel Colascione <dan.colascione <at> gmail.com>, 8415 <at> debbugs.gnu.org
Subject: Re: bug#8415: 23.3.50; Extensible Emacs Registers
Date: Mon, 04 Apr 2011 10:29:11 -0400
> I would like to propose the following patch that makes the register
> system easier to hook into. With this change, for example, if one wants
> to make a command to save a keyboard macro to a register. There is no
> need to change register.el. 3rd party libraries such as undo-tree.el can
> add registers of undo state that one can jump to with C-x r j.

Sounds good.

> -(defvar register-alist nil
> -  "Alist of elements (NAME . CONTENTS), one for each Emacs register.
> -NAME is a character (a number).  CONTENTS is a string, number, marker or list.
> +;;; in-memeory persistency

Please capitalize your comments and add a closing ".".
Why "memeory"?  ;-)

> +(defvar register-hash-table (make-hash-table))

Why change it to a hash-table?

> +;;; immutable register object
> +(defstruct
> +  (register (:constructor nil)
> +	    (:constructor register--make (name &optional value print-func
> +					       jump-func insert-func extra))
> +	    (:copier nil)
> +	    (:type list)
> +	    :named)
> +  (name	       nil :read-only t)
> +  (value       nil :read-only t)
> +  (print-func  nil :read-only t)
> +  (jump-func   nil :read-only t)
> +  (insert-func nil :read-only t)
> +  (extra       nil :read-only t))

Remove `extra': it's unused, undocumented, and doesn't seem to be any
use (there's already `value').

> +VALUE may be a string, number, marker or list.

IIUC this is not true any more, it can be any value.

> +(define-obsolete-function-alias 'set-register 'register-make "24.1")
> +(make-obsolete 'get-register "use `register-find' and `register-value'." "24.1")

A more backward-compatible change would be to not use register-structs
for pre-existing cases (i.e. markers, strings, lists of string, and
win-confs).  I.e. only add register structs as a new accepted kind
of value (and move `name' out of the struct).

The patch would most likely be a lot smaller.


        Stefan




This bug report was last modified 13 years and 323 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.