Mercurial > emacs
comparison lisp/progmodes/glasses.el @ 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 | 18a818a2ee7c |
children | 8bcae2ee8374 fa0da9b57058 |
comparison
equal
deleted
inserted
replaced
65563:7e7ac593a360 | 65564:d84981e3d7d4 |
---|---|
193 (save-match-data | 193 (save-match-data |
194 (re-search-backward "\\<.") | 194 (re-search-backward "\\<.") |
195 (looking-at glasses-uncapitalize-regexp)))) | 195 (looking-at glasses-uncapitalize-regexp)))) |
196 (overlay-put o 'invisible t) | 196 (overlay-put o 'invisible t) |
197 (overlay-put o 'after-string (downcase (match-string n)))))) | 197 (overlay-put o 'after-string (downcase (match-string n)))))) |
198 ;; Separator change | |
199 (unless (string= glasses-separator "_") | |
200 (goto-char beg) | |
201 (while (re-search-forward "[a-zA-Z0-9]\\(_+\\)[a-zA-Z0-9]" end t) | |
202 (goto-char (match-beginning 1)) | |
203 (while (eql (char-after) ?\_) | |
204 (let ((o (glasses-make-overlay (point) (1+ (point))))) | |
205 ;; `concat' ensures the character properties won't merge | |
206 (overlay-put o 'display (concat glasses-separator))) | |
207 (forward-char)))) | |
198 ;; Parentheses | 208 ;; Parentheses |
199 (when glasses-separate-parentheses-p | 209 (when glasses-separate-parentheses-p |
200 (goto-char beg) | 210 (goto-char beg) |
201 (while (re-search-forward "[a-zA-Z]_*\\(\(\\)" end t) | 211 (while (re-search-forward "[a-zA-Z]_*\\(\(\\)" end t) |
202 (glasses-make-overlay (match-beginning 1) (match-end 1) | 212 (glasses-make-overlay (match-beginning 1) (match-end 1) |
225 separator separator) | 235 separator separator) |
226 nil t) | 236 nil t) |
227 (let ((n (if (match-string 1) 1 2))) | 237 (let ((n (if (match-string 1) 1 2))) |
228 (replace-match "" t nil nil n) | 238 (replace-match "" t nil nil n) |
229 (goto-char (match-end n)))) | 239 (goto-char (match-end n)))) |
240 (unless (string= glasses-separator "_") | |
241 (goto-char (point-min)) | |
242 (while (re-search-forward (format "[a-zA-Z0-9]\\(%s+\\)[a-zA-Z0-9]" | |
243 separator) | |
244 nil t) | |
245 (replace-match "_" nil nil nil 1) | |
246 (goto-char (match-beginning 1)))) | |
230 (when glasses-separate-parentheses-p | 247 (when glasses-separate-parentheses-p |
231 (goto-char (point-min)) | 248 (goto-char (point-min)) |
232 (while (re-search-forward "[a-zA-Z]_*\\( \\)\(" nil t) | 249 (while (re-search-forward "[a-zA-Z]_*\\( \\)\(" nil t) |
233 (replace-match "" t nil nil 1)))))) | 250 (replace-match "" t nil nil 1)))))) |
234 ;; nil must be returned to allow use in write file hooks | 251 ;; nil must be returned to allow use in write file hooks |