]> git.eshelyaron.com Git - emacs.git/commitdiff
(glasses-convert-to-unreadable): Use
authorGerd Moellmann <gerd@gnu.org>
Thu, 4 May 2000 20:17:59 +0000 (20:17 +0000)
committerGerd Moellmann <gerd@gnu.org>
Thu, 4 May 2000 20:17:59 +0000 (20:17 +0000)
`glasses-separator' instead of the hard-wired "_".
(glasses-mode): Call `glasses-make-unreadable' only in a single
place.

lisp/progmodes/glasses.el

index 3a5e96a46180aae91d8346482f37d12b1dce59f9..9a4c18e19df911cf9a4f17ccb65f07e3cfd571bf 100644 (file)
@@ -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))))