]> git.eshelyaron.com Git - emacs.git/commitdiff
Small addition to glasses.el (bug#8524)
authorMilan Zamazal <pdm@zamazal.org>
Thu, 5 May 2011 03:26:55 +0000 (20:26 -0700)
committerGlenn Morris <rgm@gnu.org>
Thu, 5 May 2011 03:26:55 +0000 (20:26 -0700)
* lisp/progmodes/glasses.el (glasses-separate-capital-groups): New option.
(glasses-make-readable): Use glasses-separate-capital-groups.

lisp/ChangeLog
lisp/progmodes/glasses.el

index cf120f8df8e1de1ede566292f22b9fa9b31758d7..a862509a6e97f5c0c052022596e5ab6f9d131d3c 100644 (file)
@@ -1,3 +1,8 @@
+2011-05-05  Milan Zamazal  <pdm@zamazal.org>
+
+       * progmodes/glasses.el (glasses-separate-capital-groups): New option.
+       (glasses-make-readable): Use glasses-separate-capital-groups.
+
 2011-05-05  Juanma Barranquero  <lekktu@gmail.com>
 
        * emacs-lisp/warnings.el (warning-level-aliases): Reflow docstring.
index 0d9359caa779ce66b6341af3caed9cd2f395f46d..6792e861888031f09f37552cbfd9559ce71fec34 100644 (file)
@@ -116,6 +116,15 @@ parenthesis expression starts."
   :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 "24.1")
+
 (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
@@ -212,8 +221,11 @@ CATEGORY is the overlay category.  If it is nil, use the `glasses' category."
                                '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))