From: Gerd Moellmann Date: Sun, 12 Dec 1999 13:18:54 +0000 (+0000) Subject: Fix for when font-lock mode is active. X-Git-Tag: emacs-pretest-21.0.90~5794 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=b0622822866c30c0e6103b5728d74ec21b8aae5d;p=emacs.git Fix for when font-lock mode is active. (sh-font-lock-unfontify-region-function): New function. --- diff --git a/lisp/progmodes/sh-script.el b/lisp/progmodes/sh-script.el index e1f636f8238..5d00037484a 100644 --- a/lisp/progmodes/sh-script.el +++ b/lisp/progmodes/sh-script.el @@ -1247,6 +1247,7 @@ with your script for an edit-interpret-debug cycle." (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 @@ with your script for an edit-interpret-debug cycle." 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 @@ Return values: 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