(python-mode): font-lock-defaults must be make-local-variable'd

This commit is contained in:
Barry Warsaw 1996-09-04 14:14:10 +00:00
parent 2b88061c9c
commit 615d4a458f
1 changed files with 23 additions and 16 deletions

View File

@ -658,12 +658,31 @@ py-scroll-process-buffer\t\talways scroll Python process buffer
py-temp-directory\t\tdirectory used for temp files (if needed) py-temp-directory\t\tdirectory used for temp files (if needed)
py-beep-if-tab-change\t\tring the bell if tab-width is changed" py-beep-if-tab-change\t\tring the bell if tab-width is changed"
(interactive) (interactive)
;; set up local variables
(kill-all-local-variables) (kill-all-local-variables)
(make-local-variable 'font-lock-defaults)
(make-local-variable 'paragraph-separate)
(make-local-variable 'paragraph-start)
(make-local-variable 'require-final-newline)
(make-local-variable 'comment-start)
(make-local-variable 'comment-start-skip)
(make-local-variable 'comment-column)
(make-local-variable 'indent-region-function)
(make-local-variable 'indent-line-function)
;;
(set-syntax-table py-mode-syntax-table) (set-syntax-table py-mode-syntax-table)
(setq major-mode 'python-mode (setq major-mode 'python-mode
mode-name "Python" mode-name "Python"
local-abbrev-table python-mode-abbrev-table local-abbrev-table python-mode-abbrev-table
font-lock-defaults '(python-font-lock-keywords) font-lock-defaults '(python-font-lock-keywords)
paragraph-separate "^[ \t]*$"
paragraph-start "^[ \t]*$"
require-final-newline t
comment-start "# "
comment-start-skip "# *"
comment-column 40
indent-region-function py-indent-region
indent-line-function py-indent-line
) )
(use-local-map py-mode-map) (use-local-map py-mode-map)
;; add the menu ;; add the menu
@ -672,18 +691,6 @@ py-beep-if-tab-change\t\tring the bell if tab-width is changed"
;; Emacs 19 requires this ;; Emacs 19 requires this
(if (or py-this-is-lucid-emacs-p py-this-is-emacs-19-p) (if (or py-this-is-lucid-emacs-p py-this-is-emacs-19-p)
(setq comment-multi-line nil)) (setq comment-multi-line nil))
;; BAW -- style...
(mapcar (function (lambda (x)
(make-local-variable (car x))
(set (car x) (cdr x))))
'((paragraph-separate . "^[ \t]*$")
(paragraph-start . "^[ \t]*$")
(require-final-newline . t)
(comment-start . "# ")
(comment-start-skip . "# *")
(comment-column . 40)
(indent-region-function . py-indent-region)
(indent-line-function . py-indent-line)))
;; hack to allow overriding the tabsize in the file (see tokenizer.c) ;; hack to allow overriding the tabsize in the file (see tokenizer.c)
;; ;;
;; not sure where the magic comment has to be; to save time ;; not sure where the magic comment has to be; to save time