# HG changeset patch # User Gerd Moellmann # Date 945004734 0 # Node ID da094b0ffe3cdc4404b70d158d871c1423a244dd # Parent 7afb74b5999e7e8db0fbf74d5c883968240217fc Fix for when font-lock mode is active. (sh-font-lock-unfontify-region-function): New function. diff -r 7afb74b5999e -r da094b0ffe3c lisp/progmodes/sh-script.el --- a/lisp/progmodes/sh-script.el Sun Dec 12 13:15:07 1999 +0000 +++ b/lisp/progmodes/sh-script.el Sun Dec 12 13:18:54 1999 +0000 @@ -1247,6 +1247,7 @@ (make-local-variable 'imenu-generic-expression) (make-local-variable 'sh-electric-rparen-needed-here) (make-local-variable 'sh-indent-supported-here) + (make-local-variable 'font-lock-unfontify-region-function) (setq major-mode 'sh-mode mode-name "Shell-script" ;; not very clever, but enables wrapping skeletons around regions @@ -1272,6 +1273,8 @@ nil nil ((?/ . "w") (?~ . "w") (?. . "w") (?- . "w") (?_ . "w")) nil (font-lock-syntactic-keywords . sh-font-lock-syntactic-keywords)) + font-lock-unfontify-region-function + 'sh-font-lock-unfontify-region-function skeleton-pair-alist '((?` _ ?`)) skeleton-pair-filter 'sh-quoted-p skeleton-further-elements '((< '(- (min sh-indentation @@ -3195,6 +3198,17 @@ Otherwise, we fontify something and font-lock overwrites it." ) +;; The default font-lock-unfontify-region-function removes +;; syntax-table properties, and so removes our information. +(defun sh-font-lock-unfontify-region-function (beg end) + (let* ((modified (buffer-modified-p)) (buffer-undo-list t) + (inhibit-read-only t) (inhibit-point-motion-hooks t) + before-change-functions after-change-functions + deactivate-mark buffer-file-name buffer-file-truename) + (remove-text-properties beg end '(face nil)) + (when (and (not modified) (buffer-modified-p)) + (set-buffer-modified-p nil)))) + (defun sh-set-char-syntax (where new-prop) "Set the character's syntax table property at WHERE to be NEW-PROP." (or where