]> code.delx.au - gnu-emacs/blobdiff - lisp/progmodes/glasses.el
2012-01-05 Michael R. Mauger <mmaug@yahoo.com>
[gnu-emacs] / lisp / progmodes / glasses.el
index 90e6fbe3df357290d8a5162aad9980116f9f9f85..6792e861888031f09f37552cbfd9559ce71fec34 100644 (file)
@@ -1,6 +1,6 @@
 ;;; glasses.el --- make cantReadThis readable
 
-;; Copyright (C) 1999, 2000, 2001, 2005, 2006 Free Software Foundation, Inc.
+;; Copyright (C) 1999-2011  Free Software Foundation, Inc.
 
 ;; Author: Milan Zamazal <pdm@zamazal.org>
 ;; Maintainer: Milan Zamazal <pdm@zamazal.org>
@@ -8,10 +8,10 @@
 
 ;; This file is part of GNU Emacs.
 
-;; GNU Emacs is free software; you can redistribute it and/or modify
+;; GNU Emacs is free software: you can redistribute it and/or modify
 ;; it under the terms of the GNU General Public License as published by
-;; the Free Software Foundation; either version 2, or (at your option)
-;; any later version.
+;; the Free Software Foundation, either version 3 of the License, or
+;; (at your option) any later version.
 
 ;; GNU Emacs is distributed in the hope that it will be useful,
 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
@@ -19,9 +19,7 @@
 ;; GNU General Public License for more details.
 
 ;; You should have received a copy of the GNU General Public License
-;; along with GNU Emacs; see the file COPYING.  If not, write to the
-;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
-;; Boston, MA 02110-1301, USA.
+;; along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.
 
 ;;; Commentary:
 
@@ -118,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
@@ -214,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))
@@ -292,7 +302,7 @@ recognized according to the current value of the variable `glasses-separator'."
   nil)
 
 
-(defun glasses-change (beg end &optional old-len)
+(defun glasses-change (beg end &optional _old-len)
   "After-change function updating glass overlays."
   (let ((beg-line (save-excursion (goto-char beg) (line-beginning-position)))
        (end-line (save-excursion (goto-char end) (line-end-position))))
@@ -330,5 +340,4 @@ at places they belong to."
 (provide 'glasses)
 
 
-;; arch-tag: a3515167-c89e-484f-90a1-d85143e52b12
 ;;; glasses.el ends here