GNU bug report logs -
#19528
25.0.50; Add electric-pair-local-mode
Previous Next
Reported by: Tom Willemse <tom <at> ryuslash.org>
Date: Wed, 7 Jan 2015 15:06:02 UTC
Severity: wishlist
Found in version 25.0.50
Done: joaotavora <at> gmail.com (João Távora)
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 19528 in the body.
You can then email your comments to 19528 AT debbugs.gnu.org in the normal way.
Toggle the display of automated, internal messages from the tracker.
Report forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#19528
; Package
emacs
.
(Wed, 07 Jan 2015 15:06:02 GMT)
Full text and
rfc822 format available.
Acknowledgement sent
to
Tom Willemse <tom <at> ryuslash.org>
:
New bug report received and forwarded. Copy sent to
bug-gnu-emacs <at> gnu.org
.
(Wed, 07 Jan 2015 15:06:02 GMT)
Full text and
rfc822 format available.
Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
Hello Emacs devs,
Attached is a patch to add `electric-pair-local-mode'. It's almost an
exact copy of `electric-indent-local-mode'. I like using
`electric-pair-mode', except in Lisp-like languages where I prefer
paredit, so having a local mode is useful to me.
I've tried mentioning it in the same places as
`electric-indent-local-mode', I hope I did it right.
Please let me know what you think.
[0001-Add-electric-pair-local-mode.patch (text/x-diff, inline)]
From b8fd61d4b380cddb8a5c51c392c6aa4ac9e3d1e5 Mon Sep 17 00:00:00 2001
From: Tom Willemse <tom <at> ryuslash.org>
Date: Wed, 7 Jan 2015 04:04:06 +0100
Subject: [PATCH] Add electric-pair-local-mode
* elec-pair.el (electric-pair-local-mode): New command.
(electric-pair-mode): Mention `electric-pair-local-mode' in the
docstring.
---
doc/emacs/programs.texi | 4 +++-
etc/NEWS | 5 +++++
lisp/ChangeLog | 6 ++++++
lisp/elec-pair.el | 16 +++++++++++++++-
4 files changed, 29 insertions(+), 2 deletions(-)
diff --git a/doc/emacs/programs.texi b/doc/emacs/programs.texi
index 8f6111d..248e72c 100644
--- a/doc/emacs/programs.texi
+++ b/doc/emacs/programs.texi
@@ -870,7 +870,9 @@ mode to skip whitespace forward before deciding whether to skip over
the closing delimiter.
@end itemize
-To toggle Electric Pair mode, type @kbd{M-x electric-pair-mode}.
+To toggle Electric Pair mode, type @kbd{M-x electric-pair-mode}. To
+toggle the mode in a single buffer, use @kbd{M-x
+electric-pair-local-mode}.
@node Comments
@section Manipulating Comments
diff --git a/etc/NEWS b/etc/NEWS
index 4d704ce..8709c39 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -469,6 +469,11 @@ As a result of the above, these commands are now obsolete:
`find-tag-other-window', `find-tag-other-frame', `find-tag-regexp',
`tags-apropos' and `tags-loop-continue'.
+** Electric Pair mode
+
++++
+*** New buffer-local `electric-pair-local-mode'.
+
** Obsolete packages
---
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 71889ce..646bd90 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,9 @@
+2015-01-07 Tom Willemse <tom <at> ryuslash.org>
+
+ * elec-pair.el (electric-pair-local-mode): New command.
+ (electric-pair-mode): Mention `electric-pair-local-mode' in the
+ docstring.
+
2015-01-06 Sam Steingold <sds <at> gnu.org>
* shell.el (shell-display-buffer-actions): Remove,
diff --git a/lisp/elec-pair.el b/lisp/elec-pair.el
index 2cede62..70f3a8a 100644
--- a/lisp/elec-pair.el
+++ b/lisp/elec-pair.el
@@ -557,7 +557,8 @@ (define-minor-mode electric-pair-mode
Electric Pair mode is a global minor mode. When enabled, typing
an open parenthesis automatically inserts the corresponding
-closing parenthesis. (Likewise for brackets, etc.)."
+closing parenthesis. (Likewise for brackets, etc.). To toggle
+the mode in a single buffer, use `electric-pair-local-mode'."
:global t :group 'electricity
(if electric-pair-mode
(progn
@@ -571,6 +572,19 @@ (define-minor-mode electric-pair-mode
(remove-hook 'self-insert-uses-region-functions
#'electric-pair-will-use-region)))
+;;;###autoload
+(define-minor-mode electric-pair-local-mode
+ "Toggle `electric-pair-mode' only in this buffer."
+ :variable (buffer-local-value 'electric-pair-mode (current-buffer))
+ (cond
+ ((eq electric-pair-mode (default-value 'electric-pair-mode))
+ (kill-local-variable 'electric-pair-mode))
+ ((not (default-value 'electric-pair-mode))
+ ;; Locally enabled, but globally disabled.
+ (electric-pair-mode 1) ; Setup the hooks.
+ (setq-default electric-pair-mode nil) ; But keep it globally disabled.
+ )))
+
(provide 'elec-pair)
;;; elec-pair.el ends here
--
2.2.1
Reply sent
to
joaotavora <at> gmail.com (João Távora)
:
You have taken responsibility.
(Sat, 28 Mar 2015 15:48:02 GMT)
Full text and
rfc822 format available.
Notification sent
to
Tom Willemse <tom <at> ryuslash.org>
:
bug acknowledged by developer.
(Sat, 28 Mar 2015 15:48:03 GMT)
Full text and
rfc822 format available.
Message #10 received at 19528-done <at> debbugs.gnu.org (full text, mbox):
Stefan Monnier <monnier <at> iro.umontreal.ca> writes:
> Tom Willemse <tom <at> ryuslash.org> writes:
>> Not to be a nuisance, but I wrote a patch for that some time ago and I'm
>> still waiting on a response:
>> http://debbugs.gnu.org/cgi/bugreport.cgi?bug=19528
>
> João, can you take a look at that?
Looks pretty good so I just pushed:
commit 40b3dcd2c06e30048be0bdc32861148a53660c90
Author: Tom Willemse <tom <at> ryuslash.org>
Date: Sat Mar 28 14:43:33 2015 +0000
New `electric-pair-local-mode'
Fixes: big#19528
* lisp/elec-pair.el (electric-pair-local-mode): New command.
(electric-pair-mode): Mention `electric-pair-local-mode' in the
docstring.
Didn't check for Tom's copyright assignment since I believe it counts as
a trivial patch (<15loc).
João
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#19528
; Package
emacs
.
(Sat, 28 Mar 2015 17:38:02 GMT)
Full text and
rfc822 format available.
Message #13 received at 19528 <at> debbugs.gnu.org (full text, mbox):
João Távora wrote:
> Didn't check for Tom's copyright assignment since I believe it counts as
> a trivial patch (<15loc).
It never works like that.
1) Add "(tiny change)" to the ChangeLog entry.
2) You always need to check for previous changes from the same author
(there are several) and estimate the total lines contributed so far.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#19528
; Package
emacs
.
(Sat, 28 Mar 2015 21:03:02 GMT)
Full text and
rfc822 format available.
Message #16 received at 19528 <at> debbugs.gnu.org (full text, mbox):
Glenn Morris <rgm <at> gnu.org> writes:
> João Távora wrote:
>
>> Didn't check for Tom's copyright assignment since I believe it counts as
>> a trivial patch (<15loc).
>
> It never works like that.
>
> 1) Add "(tiny change)" to the ChangeLog entry.
> 2) You always need to check for previous changes from the same author
> (there are several) and estimate the total lines contributed so far.
>
I'm very sorry, I didn't know it worked like that, I'm also currently
locked out of my fencepost account so I can't check the copyright file
(is there another way to check it?)
How do I decide once I've estimated the number of "total lines"? Does
that have to amount to 15loc max?
João
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#19528
; Package
emacs
.
(Tue, 14 Apr 2015 06:29:02 GMT)
Full text and
rfc822 format available.
Message #19 received at 19528 <at> debbugs.gnu.org (full text, mbox):
It's no big deal.
João Távora wrote:
> locked out of my fencepost account so I can't check the copyright file
> (is there another way to check it?)
Not AFAIK.
> How do I decide once I've estimated the number of "total lines"? Does
> that have to amount to 15loc max?
Yes, though that is a rough number. And it's not a literal line count.
Eg a purely mechanical s/foo/bar on 100 lines counts as 1 line, IMO.
Life is much easier if people complete assignments though. :)
bug archived.
Request was from
Debbugs Internal Request <help-debbugs <at> gnu.org>
to
internal_control <at> debbugs.gnu.org
.
(Tue, 12 May 2015 11:24:06 GMT)
Full text and
rfc822 format available.
This bug report was last modified 10 years and 45 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.