* bug#8524: New glasses.el customization option glasses-separate-capital-groups-p
@ 2011-04-20 6:46 Milan Zamazal
2011-05-04 2:07 ` Glenn Morris
0 siblings, 1 reply; 5+ messages in thread
From: Milan Zamazal @ 2011-04-20 6:46 UTC (permalink / raw)
To: 8524
[-- Attachment #1: Type: text/plain, Size: 219 bytes --]
This adds a new customization option for a feature requested by a
glasses.el user.
2011-04-20 Milan Zamazal <pdm@zamazal.org>
* progmodes/glasses.el (glasses-separate-capital-groups-p): New
customization option.
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: glasses.el.patch --]
[-- Type: text/x-diff, Size: 1222 bytes --]
--- glasses.el.orig 2011-01-08 18:45:14.000000000 +0100
+++ glasses.el 2011-04-18 21:45:03.482155846 +0200
@@ -117,6 +117,15 @@
:group 'glasses
:type '(repeat regexp))
+(defcustom glasses-separate-capital-groups-p t
+ "If non-nil, try to separate groups of capital letters.
+When the value is non-nil, HTMLSomething and IPv6 are displayed
+as HTML_Something and I_Pv6 respectively. Set the value to nil
+if you prefer to display them unchanged."
+ :group 'glasses
+ :type 'boolean
+ :version "23.4")
+
(defcustom glasses-uncapitalize-p nil
"If non-nil, downcase embedded capital letters in identifiers.
Only identifiers starting with lower case letters are affected, letters inside
@@ -213,8 +222,11 @@
'glasses-init))
;; Face + separator
(goto-char beg)
- (while (re-search-forward "[a-z]\\([A-Z]\\)\\|[A-Z]\\([A-Z]\\)[a-z]"
- end t)
+ (while (re-search-forward
+ (if glasses-separate-capital-groups-p
+ "[a-z]\\([A-Z]\\)\\|[A-Z]\\([A-Z]\\)[a-z]"
+ "[a-z]\\([A-Z]\\)")
+ end t)
(let* ((n (if (match-string 1) 1 2))
(o (glasses-make-overlay (match-beginning n) (match-end n))))
(goto-char (match-beginning n))
^ permalink raw reply [flat|nested] 5+ messages in thread
* bug#8524: New glasses.el customization option glasses-separate-capital-groups-p
2011-04-20 6:46 bug#8524: New glasses.el customization option glasses-separate-capital-groups-p Milan Zamazal
@ 2011-05-04 2:07 ` Glenn Morris
2011-05-04 12:40 ` Stefan Monnier
2011-05-04 13:32 ` Milan Zamazal
0 siblings, 2 replies; 5+ messages in thread
From: Glenn Morris @ 2011-05-04 2:07 UTC (permalink / raw)
To: Milan Zamazal; +Cc: 8524
Milan Zamazal wrote:
> +(defcustom glasses-separate-capital-groups-p t
I was going to say: boolean options should not have names ending in `-p'
(I see the existing glasses ones do, but no reason to continue doing
it). `-p' is the recommended suffix for a predicate *function*. `-flag'
was recommended for boolean options, but this recommendation has gone
away (eg because you might want to extend a boolean option to a 3-state
one in future). So an appropriate name for this option might be just
`glasses-separate-capital-groups'.
But then I noticed that several other files have options ending in `-p',
so maybe I'm wrong about this...
^ permalink raw reply [flat|nested] 5+ messages in thread
* bug#8524: New glasses.el customization option glasses-separate-capital-groups-p
2011-05-04 2:07 ` Glenn Morris
@ 2011-05-04 12:40 ` Stefan Monnier
2011-05-04 13:32 ` Milan Zamazal
1 sibling, 0 replies; 5+ messages in thread
From: Stefan Monnier @ 2011-05-04 12:40 UTC (permalink / raw)
To: Glenn Morris; +Cc: Milan Zamazal, 8524
>> +(defcustom glasses-separate-capital-groups-p t
> I was going to say: boolean options should not have names ending in `-p'
> (I see the existing glasses ones do, but no reason to continue doing
> it). `-p' is the recommended suffix for a predicate *function*. `-flag'
> was recommended for boolean options, but this recommendation has gone
> away (eg because you might want to extend a boolean option to a 3-state
> one in future). So an appropriate name for this option might be just
> `glasses-separate-capital-groups'.
> But then I noticed that several other files have options ending in `-p',
> so maybe I'm wrong about this...
No, you're absolutely right. These other files are wrong.
Stefan
^ permalink raw reply [flat|nested] 5+ messages in thread
* bug#8524: New glasses.el customization option glasses-separate-capital-groups-p
2011-05-04 2:07 ` Glenn Morris
2011-05-04 12:40 ` Stefan Monnier
@ 2011-05-04 13:32 ` Milan Zamazal
2011-05-05 3:27 ` Glenn Morris
1 sibling, 1 reply; 5+ messages in thread
From: Milan Zamazal @ 2011-05-04 13:32 UTC (permalink / raw)
To: Glenn Morris; +Cc: 8524
[-- Attachment #1: Type: text/plain, Size: 140 bytes --]
>>>>> "GM" == Glenn Morris <rgm@gnu.org> writes:
GM> boolean options should not have names ending in `-p'
Here is a corrected patch:
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: glasses.el.patch --]
[-- Type: text/x-diff, Size: 1218 bytes --]
--- glasses.el.orig 2011-01-08 18:45:14.000000000 +0100
+++ glasses.el 2011-04-18 21:45:03.482155846 +0200
@@ -117,6 +117,15 @@
:group 'glasses
:type '(repeat regexp))
+(defcustom glasses-separate-capital-groups t
+ "If non-nil, try to separate groups of capital letters.
+When the value is non-nil, HTMLSomething and IPv6 are displayed
+as HTML_Something and I_Pv6 respectively. Set the value to nil
+if you prefer to display them unchanged."
+ :group 'glasses
+ :type 'boolean
+ :version "23.4")
+
(defcustom glasses-uncapitalize-p nil
"If non-nil, downcase embedded capital letters in identifiers.
Only identifiers starting with lower case letters are affected, letters inside
@@ -213,8 +222,11 @@
'glasses-init))
;; Face + separator
(goto-char beg)
- (while (re-search-forward "[a-z]\\([A-Z]\\)\\|[A-Z]\\([A-Z]\\)[a-z]"
- end t)
+ (while (re-search-forward
+ (if glasses-separate-capital-groups
+ "[a-z]\\([A-Z]\\)\\|[A-Z]\\([A-Z]\\)[a-z]"
+ "[a-z]\\([A-Z]\\)")
+ end t)
(let* ((n (if (match-string 1) 1 2))
(o (glasses-make-overlay (match-beginning n) (match-end n))))
(goto-char (match-beginning n))
^ permalink raw reply [flat|nested] 5+ messages in thread
* bug#8524: New glasses.el customization option glasses-separate-capital-groups-p
2011-05-04 13:32 ` Milan Zamazal
@ 2011-05-05 3:27 ` Glenn Morris
0 siblings, 0 replies; 5+ messages in thread
From: Glenn Morris @ 2011-05-05 3:27 UTC (permalink / raw)
To: 8524-done
Version: 24.1
Thanks; applied.
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2011-05-05 3:27 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-04-20 6:46 bug#8524: New glasses.el customization option glasses-separate-capital-groups-p Milan Zamazal
2011-05-04 2:07 ` Glenn Morris
2011-05-04 12:40 ` Stefan Monnier
2011-05-04 13:32 ` Milan Zamazal
2011-05-05 3:27 ` Glenn Morris
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).