[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] Changes to emacs/lisp/progmodes/glasses.el,v
From: |
Juanma Barranquero |
Subject: |
[Emacs-diffs] Changes to emacs/lisp/progmodes/glasses.el,v |
Date: |
Sun, 19 Nov 2006 16:54:33 +0000 |
CVSROOT: /cvsroot/emacs
Module name: emacs
Changes by: Juanma Barranquero <lektu> 06/11/19 16:54:33
Index: glasses.el
===================================================================
RCS file: /cvsroot/emacs/emacs/lisp/progmodes/glasses.el,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -b -r1.18 -r1.19
--- glasses.el 23 Feb 2006 16:35:41 -0000 1.18
+++ glasses.el 19 Nov 2006 16:54:33 -0000 1.19
@@ -110,6 +110,13 @@
:group 'glasses
:type 'boolean)
+(defcustom glasses-separate-parentheses-exceptions
+ '("^#[\t ]*define[\t ]*[A-Za-z0-9_-]* ?($")
+ "List of regexp that are exceptions for `glasses-separate-parentheses-p'.
+They are matched to the current line truncated to the point where the
+parenthesis expression starts."
+ :group 'glasses
+ :type '(repeat regexp))
(defcustom glasses-uncapitalize-p nil
"If non-nil, downcase embedded capital letters in identifiers.
@@ -153,6 +160,14 @@
;;; Utility functions
+(defun glasses-parenthesis-exception-p (beg end)
+ "Tell if (BEG, END) is an exception to `glasses-separate-parentheses-p'.
+See `glasses-separate-parentheses-exceptions'."
+ (save-match-data
+ (let ((str (buffer-substring beg end)))
+ (catch 'match
+ (dolist (re glasses-separate-parentheses-exceptions)
+ (and (string-match re str) (throw 'match t)))))))
(defun glasses-set-overlay-properties ()
"Set properties of glasses overlays.
@@ -232,8 +247,9 @@
(when glasses-separate-parentheses-p
(goto-char beg)
(while (re-search-forward "[a-zA-Z]_*\\(\(\\)" end t)
+ (unless (glasses-parenthesis-exception-p (point-at-bol) (match-end
1))
(glasses-make-overlay (match-beginning 1) (match-end 1)
- 'glasses-parenthesis)))))))
+ 'glasses-parenthesis))))))))
(defun glasses-make-unreadable (beg end)
@@ -247,11 +263,11 @@
"Convert current buffer to unreadable identifiers and return nil.
This function modifies buffer contents, it removes all the separators,
recognized according to the current value of the variable `glasses-separator'."
- (when (and glasses-convert-on-write-p
- (not (string= glasses-separator "")))
+ (when glasses-convert-on-write-p
(let ((case-fold-search nil)
(separator (regexp-quote glasses-separator)))
(save-excursion
+ (unless (string= glasses-separator "")
(goto-char (point-min))
(while (re-search-forward
(format "[a-z]\\(%s\\)[A-Z]\\|[A-Z]\\(%s\\)[A-Z][a-z]"
@@ -266,11 +282,12 @@
separator)
nil t)
(replace-match glasses-original-separator nil nil nil 1)
- (goto-char (match-beginning 1))))
+ (goto-char (match-beginning 1)))))
(when glasses-separate-parentheses-p
(goto-char (point-min))
(while (re-search-forward "[a-zA-Z]_*\\( \\)\(" nil t)
- (replace-match "" t nil nil 1))))))
+ (unless (glasses-parenthesis-exception-p (point-at-bol) (1+
(match-end 1)))
+ (replace-match "" t nil nil 1)))))))
;; nil must be returned to allow use in write file hooks
nil)
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Emacs-diffs] Changes to emacs/lisp/progmodes/glasses.el,v,
Juanma Barranquero <=