GNU bug report logs - #8524
New glasses.el customization option glasses-separate-capital-groups-p

Previous Next

Package: emacs;

Reported by: Milan Zamazal <pdm <at> zamazal.org>

Date: Wed, 20 Apr 2011 07:37:01 UTC

Severity: wishlist

Tags: patch

Found in version 23.3

Fixed in version 24.1

Done: Glenn Morris <rgm <at> gnu.org>

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 8524 in the body.
You can then email your comments to 8524 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 owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org:
bug#8524; Package emacs. (Wed, 20 Apr 2011 07:37:01 GMT) Full text and rfc822 format available.

Acknowledgement sent to Milan Zamazal <pdm <at> zamazal.org>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Wed, 20 Apr 2011 07:37:01 GMT) Full text and rfc822 format available.

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

From: Milan Zamazal <pdm <at> zamazal.org>
To: bug-gnu-emacs <at> gnu.org
Subject: New glasses.el customization option glasses-separate-capital-groups-p
Date: Wed, 20 Apr 2011 08:46:58 +0200
[Message part 1 (text/plain, inline)]
This adds a new customization option for a feature requested by a
glasses.el user.

2011-04-20  Milan Zamazal  <pdm <at> zamazal.org>

	* progmodes/glasses.el (glasses-separate-capital-groups-p): New
	customization option.

[glasses.el.patch (text/x-diff, inline)]
--- 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))

Information forwarded to owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org:
bug#8524; Package emacs. (Wed, 04 May 2011 02:08:02 GMT) Full text and rfc822 format available.

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

From: Glenn Morris <rgm <at> gnu.org>
To: Milan Zamazal <pdm <at> zamazal.org>
Cc: 8524 <at> debbugs.gnu.org
Subject: Re: bug#8524: New glasses.el customization option
	glasses-separate-capital-groups-p
Date: Tue, 03 May 2011 22:07:42 -0400
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...




Information forwarded to owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org:
bug#8524; Package emacs. (Wed, 04 May 2011 12:41:02 GMT) Full text and rfc822 format available.

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

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: Glenn Morris <rgm <at> gnu.org>
Cc: Milan Zamazal <pdm <at> zamazal.org>, 8524 <at> debbugs.gnu.org
Subject: Re: bug#8524: New glasses.el customization option
	glasses-separate-capital-groups-p
Date: Wed, 04 May 2011 09:40:30 -0300
>> +(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




Information forwarded to owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org:
bug#8524; Package emacs. (Wed, 04 May 2011 13:34:01 GMT) Full text and rfc822 format available.

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

From: Milan Zamazal <pdm <at> zamazal.org>
To: Glenn Morris <rgm <at> gnu.org>
Cc: 8524 <at> debbugs.gnu.org
Subject: Re: bug#8524: New glasses.el customization option
	glasses-separate-capital-groups-p
Date: Wed, 04 May 2011 15:32:49 +0200
[Message part 1 (text/plain, inline)]
>>>>> "GM" == Glenn Morris <rgm <at> gnu.org> writes:

    GM> boolean options should not have names ending in `-p'

Here is a corrected patch:

[glasses.el.patch (text/x-diff, inline)]
--- 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))

Reply sent to Glenn Morris <rgm <at> gnu.org>:
You have taken responsibility. (Thu, 05 May 2011 03:28:01 GMT) Full text and rfc822 format available.

Notification sent to Milan Zamazal <pdm <at> zamazal.org>:
bug acknowledged by developer. (Thu, 05 May 2011 03:28:02 GMT) Full text and rfc822 format available.

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

From: Glenn Morris <rgm <at> gnu.org>
To: 8524-done <at> debbugs.gnu.org
Subject: Re: bug#8524: New glasses.el customization option
	glasses-separate-capital-groups-p
Date: Wed, 04 May 2011 23:27:07 -0400
Version: 24.1

Thanks; applied.




bug Marked as found in versions 23.3. Request was from Glenn Morris <rgm <at> gnu.org> to control <at> debbugs.gnu.org. (Thu, 05 May 2011 17:44:02 GMT) Full text and rfc822 format available.

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

This bug report was last modified 14 years and 20 days ago.

Previous Next


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