comparison lisp/progmodes/glasses.el @ 90228:fa0da9b57058

Revision: miles@gnu.org--gnu-2005/emacs--unicode--0--patch-82 Merge from emacs--cvs-trunk--0 Patches applied: * emacs--cvs-trunk--0 (patch 542-553) - Update from CVS - Merge from gnus--rel--5.10 * gnus--rel--5.10 (patch 116-121) - Merge from emacs--cvs-trunk--0 - Update from CVS
author Miles Bader <miles@gnu.org>
date Mon, 19 Sep 2005 10:20:33 +0000
parents f9a65d7ebd29 d84981e3d7d4
children 7beb78bc1f8e
comparison
equal deleted inserted replaced
90227:10fe5fadaf89 90228:fa0da9b57058
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