From: Gerd Moellmann Date: Thu, 4 May 2000 20:17:59 +0000 (+0000) Subject: (glasses-convert-to-unreadable): Use X-Git-Tag: emacs-pretest-21.0.90~4049 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=971c5b28319bf11841a43629eabf290c344b30a0;p=emacs.git (glasses-convert-to-unreadable): Use `glasses-separator' instead of the hard-wired "_". (glasses-mode): Call `glasses-make-unreadable' only in a single place. --- diff --git a/lisp/progmodes/glasses.el b/lisp/progmodes/glasses.el index 3a5e96a4618..9a4c18e19df 100644 --- a/lisp/progmodes/glasses.el +++ b/lisp/progmodes/glasses.el @@ -213,11 +213,14 @@ This function modifies buffer contents, it removes all the separators, recognized according to the current value of the variable `glasses-separator'." (when (and glasses-convert-on-write-p (not (string= glasses-separator ""))) - (let ((case-fold-search nil)) + (let ((case-fold-search nil) + (separator (regexp-quote glasses-separator))) (save-excursion (goto-char (point-min)) (while (re-search-forward - "[a-z]\\(_\\)[A-Z]\\|[A-Z]\\(_\\)[A-Z][a-z]" nil t) + (format "[a-z]\\(%s\\)[A-Z]\\|[A-Z]\\(%s\\)[A-Z][a-z]" + separator separator) + nil t) (let ((n (if (match-string 1) 1 2))) (replace-match "" t nil nil n) (goto-char (match-end n)))) @@ -260,17 +263,16 @@ at places they belong to." (save-excursion (save-restriction (widen) + ;; We erase the all overlays anyway, to avoid dual sight in some + ;; circumstances + (glasses-make-unreadable (point-min) (point-max)) (if new-flag (progn - ;; We erase the all overlays to avoid dual sight in some - ;; circumstances - (glasses-make-unreadable (point-min) (point-max)) (glasses-make-readable (point-min) (point-max)) (make-local-hook 'after-change-functions) (add-hook 'after-change-functions 'glasses-change nil t) (add-hook 'local-write-file-hooks 'glasses-convert-to-unreadable nil t)) - (glasses-make-unreadable (point-min) (point-max)) (remove-hook 'after-change-functions 'glasses-change t) (remove-hook 'local-write-file-hooks 'glasses-convert-to-unreadable t))))