From: Jambunathan K <kjambunathan@gmail.com>
To: 12217@debbugs.gnu.org
Subject: bug#12217: [PATCH] Re: 24.2.50; append-to-register: Provide a convenient key binding
Date: Fri, 17 Aug 2012 15:26:47 +0530 [thread overview]
Message-ID: <87sjbl6duo.fsf_-_@gmail.com> (raw)
In-Reply-To: <handler.12217.B.134519691317483.ack@debbugs.gnu.org> (GNU bug Tracking System's message of "Fri, 17 Aug 2012 09:49:02 +0000")
[-- Attachment #1: Type: text/plain, Size: 747 bytes --]
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@debian-6:~/src/emacs/trunk$ bzr version-info
| revision-id: rgm@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
`----
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: bug#12217-part-1.patch --]
[-- Type: text/x-diff, Size: 1890 bytes --]
=== modified file 'lisp/ChangeLog'
--- lisp/ChangeLog 2012-08-17 06:01:17 +0000
+++ lisp/ChangeLog 2012-08-17 09:45:08 +0000
@@ -1,3 +1,9 @@
+2012-08-17 Jambunathan K <kjambunathan@gmail.com>
+
+ * register.el (increment-register): If register contains a string,
+ call `append-to-register'. This way, `C-x r +' can be used to
+ invoke `append-to-register'. See (Bug#12217).
+
2012-08-17 Martin Rudalics <rudalics@gmx.at>
* window.el (delete-window): Fix last fix.
=== modified file 'lisp/register.el'
--- lisp/register.el 2012-07-29 04:45:48 +0000
+++ lisp/register.el 2012-08-17 09:05:29 +0000
@@ -192,13 +192,25 @@
(string-to-number (match-string 0)))
0))))
-(defun increment-register (number register)
- "Add NUMBER to the contents of register REGISTER.
-Interactively, NUMBER is the prefix arg."
- (interactive "p\ncIncrement register: ")
- (or (numberp (get-register register))
- (error "Register does not contain a number"))
- (set-register register (+ number (get-register register))))
+(defun increment-register (prefix register)
+ "Augment contents of REGISTER.
+Interactively, PREFIX is in raw form.
+
+If REGISTER contains a number, add `prefix-numeric-value' of
+PREFIX to it.
+
+If REGISTER is empty or if it contains a string, call
+`append-to-register' with `delete-flag' set to PREFIX."
+ (interactive "P\ncIncrement register: ")
+ (let ((register-val (get-register register)))
+ (unless (or (not register-val)
+ (numberp register-val)
+ (stringp register-val))
+ (error "Register does not contain a number or string"))
+ (if (numberp register-val)
+ (let ((number (prefix-numeric-value prefix)))
+ (set-register register (+ number register-val)))
+ (append-to-register register (region-beginning) (region-end) prefix))))
(defun view-register (register)
"Display what is contained in register named REGISTER.
next prev parent reply other threads:[~2012-08-17 9:56 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-08-17 9:39 bug#12217: 24.2.50; append-to-register: Provide a convenient key binding Jambunathan K
[not found] ` <handler.12217.B.134519691317483.ack@debbugs.gnu.org>
2012-08-17 9:56 ` Jambunathan K [this message]
2012-08-21 17:20 ` bug#12217: [PATCH] " Stefan Monnier
2012-09-08 18:26 ` Jambunathan K
2012-09-08 20:09 ` Stefan Monnier
2012-09-09 8:52 ` Jambunathan K
2012-09-09 7:45 ` Andreas Schwab
2012-09-09 8:45 ` Jambunathan K
2012-09-09 9:02 ` Jambunathan K
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=87sjbl6duo.fsf_-_@gmail.com \
--to=kjambunathan@gmail.com \
--cc=12217@debbugs.gnu.org \
/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.