Function: glasses-make-readable
glasses-make-readable is a byte-compiled function defined in
glasses.el.gz.
Signature
(glasses-make-readable BEG END)
Documentation
Make identifiers in the region from BEG to END readable.
Source Code
;; Defined in /usr/src/emacs/lisp/progmodes/glasses.el.gz
(defun glasses-make-readable (beg end)
"Make identifiers in the region from BEG to END readable."
(let ((case-fold-search nil))
(save-excursion
(save-match-data
;; Face only
(goto-char beg)
(while (re-search-forward
"\\<\\([A-Z]\\)[a-zA-Z]*\\([a-z][A-Z]\\|[A-Z][a-z]\\)"
end t)
(glasses-make-overlay (match-beginning 1) (match-end 1)
'glasses-init))
;; Face + separator
(goto-char beg)
(while (re-search-forward
(if glasses-separate-capital-groups
"[a-z]\\([A-Z]\\)\\|[A-Z]\\([A-Z]\\)[a-z]"
"[a-z]\\([A-Z]\\)")
end t)
(let* ((n (if (match-string 1) 1 2))
(o (glasses-make-overlay (match-beginning n) (match-end n))))
(goto-char (match-beginning n))
(when (and glasses-uncapitalize-p
(save-match-data
(looking-at "[A-Z]\\($\\|[^A-Z]\\)"))
(save-excursion
(save-match-data
(re-search-backward "\\<.")
(looking-at glasses-uncapitalize-regexp))))
(overlay-put o 'display (downcase (match-string n))))))
;; Separator change
(when (and (not (string= glasses-original-separator glasses-separator))
(not (string= glasses-original-separator "")))
(goto-char beg)
(let ((original-regexp (regexp-quote glasses-original-separator)))
(while (re-search-forward
(format "[a-zA-Z0-9]\\(\\(%s\\)+\\)[a-zA-Z0-9]"
original-regexp)
end t)
(goto-char (match-beginning 1))
(while (looking-at original-regexp)
(let ((o (glasses-make-overlay (point) (1+ (point)))))
;; `concat' ensures the character properties won't merge
(overlay-put o 'display (concat glasses-separator)))
(goto-char (match-end 0))))))
;; Parentheses
(when glasses-separate-parentheses-p
(goto-char beg)
(while (re-search-forward "[a-zA-Z]_*\\((\\)" end t)
(unless (glasses-parenthesis-exception-p (line-beginning-position)
(match-end 1))
(glasses-make-overlay (match-beginning 1) (match-end 1)
'glasses-parenthesis))))))))