Mercurial > emacs
comparison lisp/progmodes/glasses.el @ 28810:4756047a4398
(glasses-convert-to-unreadable): Use
`glasses-separator' instead of the hard-wired "_".
(glasses-mode): Call `glasses-make-unreadable' only in a single
place.
author | Gerd Moellmann <gerd@gnu.org> |
---|---|
date | Thu, 04 May 2000 20:17:59 +0000 |
parents | 809168962c9b |
children | 87bca20b7a83 |
comparison
equal
deleted
inserted
replaced
28809:5d50c2e42c58 | 28810:4756047a4398 |
---|---|
211 "Convert current buffer to unreadable identifiers and return nil. | 211 "Convert current buffer to unreadable identifiers and return nil. |
212 This function modifies buffer contents, it removes all the separators, | 212 This function modifies buffer contents, it removes all the separators, |
213 recognized according to the current value of the variable `glasses-separator'." | 213 recognized according to the current value of the variable `glasses-separator'." |
214 (when (and glasses-convert-on-write-p | 214 (when (and glasses-convert-on-write-p |
215 (not (string= glasses-separator ""))) | 215 (not (string= glasses-separator ""))) |
216 (let ((case-fold-search nil)) | 216 (let ((case-fold-search nil) |
217 (separator (regexp-quote glasses-separator))) | |
217 (save-excursion | 218 (save-excursion |
218 (goto-char (point-min)) | 219 (goto-char (point-min)) |
219 (while (re-search-forward | 220 (while (re-search-forward |
220 "[a-z]\\(_\\)[A-Z]\\|[A-Z]\\(_\\)[A-Z][a-z]" nil t) | 221 (format "[a-z]\\(%s\\)[A-Z]\\|[A-Z]\\(%s\\)[A-Z][a-z]" |
222 separator separator) | |
223 nil t) | |
221 (let ((n (if (match-string 1) 1 2))) | 224 (let ((n (if (match-string 1) 1 2))) |
222 (replace-match "" t nil nil n) | 225 (replace-match "" t nil nil n) |
223 (goto-char (match-end n)))) | 226 (goto-char (match-end n)))) |
224 (when glasses-separate-parentheses-p | 227 (when glasses-separate-parentheses-p |
225 (goto-char (point-min)) | 228 (goto-char (point-min)) |
258 (> (prefix-numeric-value arg) 0)))) | 261 (> (prefix-numeric-value arg) 0)))) |
259 (unless (eq new-flag glasses-mode) | 262 (unless (eq new-flag glasses-mode) |
260 (save-excursion | 263 (save-excursion |
261 (save-restriction | 264 (save-restriction |
262 (widen) | 265 (widen) |
266 ;; We erase the all overlays anyway, to avoid dual sight in some | |
267 ;; circumstances | |
268 (glasses-make-unreadable (point-min) (point-max)) | |
263 (if new-flag | 269 (if new-flag |
264 (progn | 270 (progn |
265 ;; We erase the all overlays to avoid dual sight in some | |
266 ;; circumstances | |
267 (glasses-make-unreadable (point-min) (point-max)) | |
268 (glasses-make-readable (point-min) (point-max)) | 271 (glasses-make-readable (point-min) (point-max)) |
269 (make-local-hook 'after-change-functions) | 272 (make-local-hook 'after-change-functions) |
270 (add-hook 'after-change-functions 'glasses-change nil t) | 273 (add-hook 'after-change-functions 'glasses-change nil t) |
271 (add-hook 'local-write-file-hooks | 274 (add-hook 'local-write-file-hooks |
272 'glasses-convert-to-unreadable nil t)) | 275 'glasses-convert-to-unreadable nil t)) |
273 (glasses-make-unreadable (point-min) (point-max)) | |
274 (remove-hook 'after-change-functions 'glasses-change t) | 276 (remove-hook 'after-change-functions 'glasses-change t) |
275 (remove-hook 'local-write-file-hooks | 277 (remove-hook 'local-write-file-hooks |
276 'glasses-convert-to-unreadable t)))) | 278 'glasses-convert-to-unreadable t)))) |
277 (setq glasses-mode new-flag)))) | 279 (setq glasses-mode new-flag)))) |
278 | 280 |