[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
glasses.el enhancement
From: |
Milan Zamazal |
Subject: |
glasses.el enhancement |
Date: |
Thu, 15 Sep 2005 09:48:03 +0200 |
2005-09-15 Milan Zamazal <address@hidden>
* progmodes/glasses.el (glasses-make-readable): If
glasses-separator differs from underscore, put appropriate
overlays over underscore separators.
(glasses-convert-to-unreadable): If glasses-separator differs from
underscore, try to convert corresponding separators to
underscores.
*** glasses.el.orig Mon Jul 4 18:59:19 2005
--- glasses.el Thu Sep 15 09:36:55 2005
***************
*** 195,200 ****
--- 195,210 ----
(looking-at glasses-uncapitalize-regexp))))
(overlay-put o 'invisible t)
(overlay-put o 'after-string (downcase (match-string n))))))
+ ;; Separator change
+ (unless (string= glasses-separator "_")
+ (goto-char beg)
+ (while (re-search-forward "[a-zA-Z0-9]\\(_+\\)[a-zA-Z0-9]" end t)
+ (goto-char (match-beginning 1))
+ (while (eql (char-after) ?\_)
+ (let ((o (glasses-make-overlay (point) (1+ (point)))))
+ ;; `concat' ensures the character properties won't merge
+ (overlay-put o 'display (concat glasses-separator)))
+ (forward-char))))
;; Parentheses
(when glasses-separate-parentheses-p
(goto-char beg)
***************
*** 227,232 ****
--- 237,249 ----
(let ((n (if (match-string 1) 1 2)))
(replace-match "" t nil nil n)
(goto-char (match-end n))))
+ (unless (string= glasses-separator "_")
+ (goto-char (point-min))
+ (while (re-search-forward (format "[a-zA-Z0-9]\\(%s+\\)[a-zA-Z0-9]"
+ separator)
+ nil t)
+ (replace-match "_" nil nil nil 1)
+ (goto-char (match-beginning 1))))
(when glasses-separate-parentheses-p
(goto-char (point-min))
(while (re-search-forward "[a-zA-Z]_*\\( \\)\(" nil t)
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- glasses.el enhancement,
Milan Zamazal <=