all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Stefan Monnier <monnier@iro.umontreal.ca>
To: Leo <sdl.web@gmail.com>
Cc: Davis Herring <herring@lanl.gov>,
	8415@debbugs.gnu.org,
	Daniel Colascione <dan.colascione@gmail.com>
Subject: bug#8415: 23.3.50; Extensible Emacs Registers
Date: Mon, 04 Apr 2011 10:29:11 -0400	[thread overview]
Message-ID: <jwv7hba2k2b.fsf-monnier+emacs@gnu.org> (raw)
In-Reply-To: <m17hbb4iy9.fsf@th041156.ip.tsinghua.edu.cn> (Leo's message of "Sun, 03 Apr 2011 20:29:02 +0800")

> 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





  parent reply	other threads:[~2011-04-04 14:29 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-04-03 12:29 bug#8415: 23.3.50; Extensible Emacs Registers Leo
2011-04-03 17:21 ` Daniel Colascione
2011-04-04  1:29   ` Leo
2011-04-04 14:29 ` Stefan Monnier [this message]
2011-04-04 17:37   ` Leo
2011-04-04 22:19     ` Stefan Monnier
2011-04-04 22:27       ` Daniel Colascione
2011-04-05  1:41         ` Stefan Monnier
2011-04-05  1:49           ` Daniel Colascione
2011-04-05  3:07             ` Stefan Monnier
2011-04-05  5:42               ` Leo
2011-04-05 13:50                 ` Stefan Monnier
2011-04-06  5:00                   ` Leo
2011-04-06 15:38                     ` Stefan Monnier
2011-04-07  3:13                       ` Leo
2011-04-09  1:25                         ` Stefan Monnier
2011-06-23  8:11                           ` Leo
2011-06-25 13:19                             ` Stefan Monnier
2011-06-26  6:42                               ` Leo

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

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=jwv7hba2k2b.fsf-monnier+emacs@gnu.org \
    --to=monnier@iro.umontreal.ca \
    --cc=8415@debbugs.gnu.org \
    --cc=dan.colascione@gmail.com \
    --cc=herring@lanl.gov \
    --cc=sdl.web@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 external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.