diff options
author | Eli Zaretskii <[email protected]> | 2005-09-17 11:02:11 +0000 |
---|---|---|
committer | Eli Zaretskii <[email protected]> | 2005-09-17 11:02:11 +0000 |
commit | debe64512f91495849160d6a586082125041be4e (patch) | |
tree | e1b84731e854353b6ce11959760464b0c1e22c60 | |
parent | cbf223e18aeef870b5621eb94d4d165556498f7c (diff) |
(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.
-rw-r--r-- | lisp/ChangeLog | 9 | ||||
-rw-r--r-- | lisp/progmodes/glasses.el | 17 |
2 files changed, 26 insertions, 0 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 9f774f8990..f64d4b0159 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,12 @@ +2005-09-17 Milan Zamazal <[email protected]> + + * progmodes/glasses.el (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. + 2005-09-16 Stefan Monnier <[email protected]> * calendar/diary-lib.el (mark-diary-entries): Don't move point. diff --git a/lisp/progmodes/glasses.el b/lisp/progmodes/glasses.el index b32c5eb6d4..2733cb407a 100644 --- a/lisp/progmodes/glasses.el +++ b/lisp/progmodes/glasses.el @@ -195,6 +195,16 @@ CATEGORY is the overlay category. If it is nil, use the `glasses' category." (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 @@ recognized according to the current value of the variable `glasses-separator'." (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) |