Mercurial > emacs
changeset 65564:d84981e3d7d4
(glasses-make-readable): If glasses-separator differs from underscore,
put appropriate overlays over underscore characters.
(glasses-convert-to-unreadable): If glasses-separator differs from
underscore, try to convert glasses-separator characters to underscores.
author | Eli Zaretskii <eliz@gnu.org> |
---|---|
date | Sat, 17 Sep 2005 11:01:01 +0000 |
parents | 7e7ac593a360 |
children | 0133f0639bbc |
files | lisp/progmodes/glasses.el |
diffstat | 1 files changed, 17 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/lisp/progmodes/glasses.el Sat Sep 17 09:10:35 2005 +0000 +++ b/lisp/progmodes/glasses.el Sat Sep 17 11:01:01 2005 +0000 @@ -195,6 +195,16 @@ (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,6 +237,13 @@ (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)