GNU bug report logs - #12217
24.2.50; append-to-register: Provide a convenient key binding

Previous Next

Package: emacs;

Reported by: Jambunathan K <kjambunathan <at> gmail.com>

Date: Fri, 17 Aug 2012 09:49:02 UTC

Severity: wishlist

Tags: patch

Found in version 24.2.50

Done: Stefan Monnier <monnier <at> iro.umontreal.ca>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 12217 in the body.
You can then email your comments to 12217 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#12217; Package emacs. (Fri, 17 Aug 2012 09:49:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Jambunathan K <kjambunathan <at> gmail.com>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Fri, 17 Aug 2012 09:49:02 GMT) Full text and rfc822 format available.

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

From: Jambunathan K <kjambunathan <at> gmail.com>
To: bug-gnu-emacs <at> gnu.org
Subject: 24.2.50; append-to-register: Provide a convenient key binding
Date: Fri, 17 Aug 2012 15:09:49 +0530
Subject says it all.

24.2.50; append-to-register: Provide a convenient key binding





Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#12217; Package emacs. (Fri, 17 Aug 2012 10:06:01 GMT) Full text and rfc822 format available.

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

From: Jambunathan K <kjambunathan <at> gmail.com>
To: 12217 <at> debbugs.gnu.org
Subject: [PATCH] Re: 24.2.50;
	append-to-register: Provide a convenient key binding
Date: Fri, 17 Aug 2012 15:26:47 +0530
[Message part 1 (text/plain, inline)]
See attached patch.

Once patch goes through, I will submit a second part which updates
regs.texi.

Some context:

I usually to use M-x append-to-register (and with this patch `C-x r +')
to collect sexps.  I think it will be convenient to have the collected
snippets separated by a suitable separator. Is it OK if a default "\n"
be used? WDYT.  Note that this will be a departure from current
behaviour where the snippets are blindly concatenated.

ps: Patch should apply cleanly to below bzr version.

,----
| kjambunathan <at> debian-6:~/src/emacs/trunk$ bzr version-info
| revision-id: rgm <at> gnu.org-20120817072823-0zjgqf10g1d0vcf1
| date: 2012-08-17 00:28:23 -0700
| build-date: 2012-08-17 15:17:41 +0530
| revno: 109655
| branch-nick: trunk
`----

[bug#12217-part-1.patch (text/x-diff, attachment)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#12217; Package emacs. (Wed, 22 Aug 2012 01:20:02 GMT) Full text and rfc822 format available.

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

From: Stefan Monnier <monnier <at> IRO.UMontreal.CA>
To: Jambunathan K <kjambunathan <at> gmail.com>
Cc: 12217 <at> debbugs.gnu.org
Subject: Re: bug#12217: [PATCH] Re: 24.2.50;
	append-to-register: Provide a convenient key binding
Date: Tue, 21 Aug 2012 13:20:13 -0400
> Once patch goes through, I will submit a second part which updates
> regs.texi.

I think the change is OK.  I would prefer a single `cond' form with the
`error' in the last branch (instead of unless+if) so as to avoid
a redundant `numberp' check (not as a matter of efficiency, of course,
but maintenance).
If you send such an updated patch with the corresponding regs.texi
change, we'll install it.

> I usually to use M-x append-to-register (and with this patch `C-x r +')
> to collect sexps.  I think it will be convenient to have the collected
> snippets separated by a suitable separator. Is it OK if a default "\n"
> be used? WDYT.

I think I'd rather not add any separator by default.  In many cases
adding such a separator would render the command inconvenient, and in
many others the user can easily make sure the text he appends includes
an appropriate separator.

I can see cases where adding a separator could be handy, but I'm not
sure hardcoding "\n" would solve enough of those cases.  Maybe you could
prompt for a separator if the user provided a C-u prefix?


        Stefan




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#12217; Package emacs. (Sat, 08 Sep 2012 18:27:02 GMT) Full text and rfc822 format available.

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

From: Jambunathan K <kjambunathan <at> gmail.com>
To: Stefan Monnier <monnier <at> IRO.UMontreal.CA>
Cc: 12217 <at> debbugs.gnu.org
Subject: Re: bug#12217: [PATCH] Re: 24.2.50;
	append-to-register: Provide a convenient key binding
Date: Sat, 08 Sep 2012 23:56:20 +0530
[Message part 1 (text/plain, inline)]
Attaching modified patch.  Patch is generated against revno: 109935.

>> Once patch goes through, I will submit a second part which updates
>> regs.texi.
>
> I think the change is OK.  I would prefer a single `cond' form with the
> `error' in the last branch (instead of unless+if) so as to avoid
> a redundant `numberp' check (not as a matter of efficiency, of course,
> but maintenance).
> If you send such an updated patch with the corresponding regs.texi
> change, we'll install it.

Done.

>> I usually to use M-x append-to-register (and with this patch `C-x r +')
>> to collect sexps.  I think it will be convenient to have the collected
>> snippets separated by a suitable separator. Is it OK if a default "\n"
>> be used? WDYT.
>
> I think I'd rather not add any separator by default.  

> In many cases adding such a separator would render the command
> inconvenient, and in many others the user can easily make sure the
> text he appends includes an appropriate separator.

> I can see cases where adding a separator could be handy, but I'm not
> sure hardcoding "\n" would solve enough of those cases.  

> Maybe you could prompt for a separator if the user provided a C-u
> prefix?

Prefix is used as a `delete-flag' already ...

I have introduced an extra indirection via a `separator-register' (which
is nil by default) Now what gets used as a separator - a newline, a
double newline, a comma or a tab - is under user control.

There is already one user - that is me - who will find this feature
useful.

[bug-12217.patch (text/x-diff, attachment)]

Reply sent to Stefan Monnier <monnier <at> iro.umontreal.ca>:
You have taken responsibility. (Sat, 08 Sep 2012 20:11:01 GMT) Full text and rfc822 format available.

Notification sent to Jambunathan K <kjambunathan <at> gmail.com>:
bug acknowledged by developer. (Sat, 08 Sep 2012 20:11:02 GMT) Full text and rfc822 format available.

Message #19 received at 12217-done <at> debbugs.gnu.org (full text, mbox):

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: Jambunathan K <kjambunathan <at> gmail.com>
Cc: 12217-done <at> debbugs.gnu.org
Subject: Re: bug#12217: [PATCH] Re: 24.2.50;
	append-to-register: Provide a convenient key binding
Date: Sat, 08 Sep 2012 16:09:53 -0400
>> Maybe you could prompt for a separator if the user provided a C-u
>> prefix?
> Prefix is used as a `delete-flag' already ...

The way I read the current binding of C-x r + (increment-register), it
only uses the prefix to specify the number to add to the register, which
in the case of string concatenation is of no use.

So we can use the prefix of C-x + either the way you do in your current
patch (i.e. to specify the delete-flag of append-to-register) or we can
use it to specify the separator.

I understand that deleting the text is a common need, but you can do
that with C-x + C-w instead of C-u C-x +, so maybe it's OK to use C-u
for the separator.

> I have introduced an extra indirection via a `separator-register' (which
> is nil by default) Now what gets used as a separator - a newline, a
> double newline, a comma or a tab - is under user control.

I've renamed it to register-separator, because I'd rather that
register.el move (ever so slowly) to obey the "register-" prefix.


        Stefan "Installed, thank you!"




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#12217; Package emacs. (Sun, 09 Sep 2012 07:46:01 GMT) Full text and rfc822 format available.

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

From: Andreas Schwab <schwab <at> linux-m68k.org>
To: Jambunathan K <kjambunathan <at> gmail.com>
Cc: Stefan Monnier <monnier <at> IRO.UMontreal.CA>, 12217 <at> debbugs.gnu.org
Subject: Re: bug#12217: [PATCH] Re: 24.2.50;
	append-to-register: Provide a convenient key binding
Date: Sun, 09 Sep 2012 09:45:22 +0200
Jambunathan K <kjambunathan <at> gmail.com> writes:

> I have introduced an extra indirection via a `separator-register' (which
> is nil by default) Now what gets used as a separator - a newline, a
> double newline, a comma or a tab - is under user control.

Why the extra indirection?  Why not just make it a string and use it
directly?

Andreas.

-- 
Andreas Schwab, schwab <at> linux-m68k.org
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#12217; Package emacs. (Sun, 09 Sep 2012 08:46:02 GMT) Full text and rfc822 format available.

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

From: Jambunathan K <kjambunathan <at> gmail.com>
To: Andreas Schwab <schwab <at> linux-m68k.org>
Cc: Stefan Monnier <monnier <at> IRO.UMontreal.CA>, 12217 <at> debbugs.gnu.org
Subject: Re: bug#12217: [PATCH] Re: 24.2.50;
	append-to-register: Provide a convenient key binding
Date: Sun, 09 Sep 2012 14:15:32 +0530
Andreas Schwab <schwab <at> linux-m68k.org> writes:

> Jambunathan K <kjambunathan <at> gmail.com> writes:
>
>> I have introduced an extra indirection via a `separator-register'
>> (which is nil by default) Now what gets used as a separator - a
>> newline, a double newline, a comma or a tab - is under user control.
>
> Why the extra indirection?  Why not just make it a string and use it
> directly?

In short, Function before form and it is also about some workflows being
less intrusive than others.

Let's look at some use-cases.

Use-case-1 (A concrete one)

    I find myself collecting sexps.  (This is going to happen more as I
    plan to explore more new codebases.)

    When I look at existing code - with an intention to prepare some
    patch - I find myself collecting recipes from 2 or 3 places.  I then
    "insert" it in to target location and put them together.  Since the
    recipes are collected from 2 or 3 places, they need to be visually
    separated.  Going forward I will store "double newline" (read
    paragraph) as separator for these recipe blocks.

    Note: Org exporters are moving to new framework.  Now when I am
    re-implementing some features in my (own) org-e-odt.el, I find
    myself collecting recipes from org-export.el, org-e-latex.el and
    felt sorry that the sexps are not visually separated.

Use-case-2 (Contrived one)

    Now let's say I am a language learner and I am looking at a French
    article from within Emacs.  As I read through the article, I see
    some words that need to be looked up.  Instead of immediate lookup,
    I may store the word or a phrase in a register and later insert in
    to my language notes for further refinement.  In this case, I may
    want to separate them with a newline or even better something like
    an Org-table.

    In that case, in my scratch buffer I will type something like this
    in scratch buffer, C-x r s + it and then collect away.  I can then
    paste that in to my Notes buffer and then re-align it using Org.


    --8<---------------cut here---------------start------------->8---
    |
    |
    --8<---------------cut here---------------end--------------->8---


    This is how the collected table looks like

    ,----
    | Now|
    | |looked|
    | |immediate|
    | |further
    `----

A string or a separator register
================================

It is easy for me to do "C-x r s" a separator rather to do a "M: (setq
separator "")".  There is lesser context switch.  A separator register
"guarantees" that the words are separated.  This frees one from
remembering to store the surrounding separator and just focus on
collection process.




> Andreas.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#12217; Package emacs. (Sun, 09 Sep 2012 08:53:01 GMT) Full text and rfc822 format available.

Message #28 received at 12217-done <at> debbugs.gnu.org (full text, mbox):

From: Jambunathan K <kjambunathan <at> gmail.com>
To: Stefan Monnier <monnier <at> iro.umontreal.ca>
Cc: 12217-done <at> debbugs.gnu.org
Subject: Re: bug#12217: [PATCH] Re: 24.2.50;
	append-to-register: Provide a convenient key binding
Date: Sun, 09 Sep 2012 14:22:15 +0530
> I've renamed it to register-separator, because I'd rather that
> register.el move (ever so slowly) to obey the "register-" prefix.

Looks like you failed to mark some files in work-area
before the commmit.

I still see references to separator-register in *.el file, NEWS and
Changelog files.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#12217; Package emacs. (Sun, 09 Sep 2012 09:03:01 GMT) Full text and rfc822 format available.

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

From: Jambunathan K <kjambunathan <at> gmail.com>
To: Andreas Schwab <schwab <at> linux-m68k.org>
Cc: Stefan Monnier <monnier <at> IRO.UMontreal.CA>, 12217 <at> debbugs.gnu.org
Subject: Re: bug#12217: [PATCH] Re: 24.2.50;
	append-to-register: Provide a convenient key binding
Date: Sun, 09 Sep 2012 14:32:21 +0530
Andreas Schwab <schwab <at> linux-m68k.org> writes:

> Jambunathan K <kjambunathan <at> gmail.com> writes:
>
>> I have introduced an extra indirection via a `separator-register' (which
>> is nil by default) Now what gets used as a separator - a newline, a
>> double newline, a comma or a tab - is under user control.
>
> Why the extra indirection?  Why not just make it a string and use it
> directly?

Why registers when there is a kill ring? A text register is but a kill
ring.

Register is a framework and hence abstract.  

The original authors needed it badly, took trouble to implement it, but
unfortunately failed to document what new workflows they enable.  (I see
some references to number registers being used in conjunction with
macros - just about it.)  Now a user is left to his own device to
contrive how a register should be used.  It is like an incomplete
sentence begging for ....

Btw, no registers were killed in the preparation of the patch.

> Andreas.




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Sun, 07 Oct 2012 11:24:03 GMT) Full text and rfc822 format available.

This bug report was last modified 12 years and 256 days ago.

Previous Next


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