From: Stefan Kangas Date: Fri, 5 Feb 2021 00:14:17 +0000 (+0100) Subject: Assume font-lock-mode variable is not void X-Git-Tag: emacs-28.0.90~3932 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=bbe88cd82e4bbfd76df06223614ab74d1022c119;p=emacs.git Assume font-lock-mode variable is not void * lisp/align.el (align-rules-list): * lisp/cedet/semantic/idle.el (semantic-idle-summary-useful-context-p): * lisp/org/org-table.el (org-table-edit-field): * lisp/org/org.el (org-restart-font-lock): * lisp/progmodes/antlr-mode.el (antlr-language-option-extra): * lisp/progmodes/idlwave.el (idlwave-choose): * lisp/progmodes/sql.el (sql-product-font-lock): * lisp/progmodes/verilog-mode.el (verilog-save-font-no-change-functions, verilog-preprocess): * lisp/vc/cvs-status.el: * lisp/vc/smerge-mode.el (smerge-mode): * lisp/woman.el (woman-decode-buffer): Assume font-lock-mode variable is not void; it is preloaded. --- diff --git a/lisp/align.el b/lisp/align.el index 4d783931157..1a1d3dd7ec1 100644 --- a/lisp/align.el +++ b/lisp/align.el @@ -424,7 +424,7 @@ The possible settings for `align-region-separate' are: (backward-word 1) (looking-at "\\(goto\\|return\\|new\\|delete\\|throw\\)")) - (if (and (boundp 'font-lock-mode) font-lock-mode) + (if font-lock-mode (eq (get-text-property (point) 'face) 'font-lock-comment-face) (eq (caar (c-guess-basic-syntax)) 'c))))))) diff --git a/lisp/cedet/semantic/idle.el b/lisp/cedet/semantic/idle.el index 73954f0266b..9f1bcfa6916 100644 --- a/lisp/cedet/semantic/idle.el +++ b/lisp/cedet/semantic/idle.el @@ -716,8 +716,7 @@ specific to a major mode. For example, in jde mode: (defun semantic-idle-summary-useful-context-p () "Non-nil if we should show a summary based on context." - (if (and (boundp 'font-lock-mode) - font-lock-mode + (if (and font-lock-mode (memq (get-text-property (point) 'face) semantic-idle-summary-out-of-context-faces)) ;; The best I can think of at the moment is to disable diff --git a/lisp/org/org-table.el b/lisp/org/org-table.el index ef4672e1b96..1248efabc15 100644 --- a/lisp/org/org-table.el +++ b/lisp/org/org-table.el @@ -2008,7 +2008,7 @@ toggle `org-table-follow-field-mode'." (let ((b (save-excursion (skip-chars-backward "^|") (point))) (e (save-excursion (skip-chars-forward "^|\r\n") (point)))) (remove-text-properties b e '(invisible t intangible t)) - (if (and (boundp 'font-lock-mode) font-lock-mode) + (if font-lock-mode (font-lock-fontify-block)))) (t (let ((pos (point-marker)) diff --git a/lisp/org/org.el b/lisp/org/org.el index 2d21a44fb48..e6a5cca9391 100644 --- a/lisp/org/org.el +++ b/lisp/org/org.el @@ -5520,7 +5520,7 @@ highlighting was done, nil otherwise." (defun org-restart-font-lock () "Restart `font-lock-mode', to force refontification." - (when (and (boundp 'font-lock-mode) font-lock-mode) + (when font-lock-mode (font-lock-mode -1) (font-lock-mode 1))) diff --git a/lisp/progmodes/antlr-mode.el b/lisp/progmodes/antlr-mode.el index 527cb03cfbe..e5b9ac0a537 100644 --- a/lisp/progmodes/antlr-mode.el +++ b/lisp/progmodes/antlr-mode.el @@ -2047,7 +2047,7 @@ Called in PHASE `after-insertion', see `antlr-options-alists'." (let ((new-language (antlr-language-option t))) (or (null new-language) (eq new-language antlr-language) - (let ((font-lock (and (boundp 'font-lock-mode) font-lock-mode))) + (let ((font-lock font-lock-mode)) (if font-lock (font-lock-mode 0)) (antlr-mode) (and font-lock (null font-lock-mode) (font-lock-mode 1))))))) diff --git a/lisp/progmodes/idlwave.el b/lisp/progmodes/idlwave.el index c11892492de..e8e55ae96d1 100644 --- a/lisp/progmodes/idlwave.el +++ b/lisp/progmodes/idlwave.el @@ -6876,7 +6876,6 @@ sort the list before displaying." (let ((completion-ignore-case t)) ; install correct value (apply function args)) (if (and (derived-mode-p 'idlwave-shell-mode) - (boundp 'font-lock-mode) (not font-lock-mode)) ;; For the shell, remove the fontification of the word before point (let ((beg (save-excursion diff --git a/lisp/progmodes/sql.el b/lisp/progmodes/sql.el index 4d027f3df53..f1f4d61324b 100644 --- a/lisp/progmodes/sql.el +++ b/lisp/progmodes/sql.el @@ -2829,9 +2829,7 @@ configured." ;; Force font lock to reinitialize if it is already on ;; Otherwise, we can wait until it can be started. - (when (and (fboundp 'font-lock-mode) - (boundp 'font-lock-mode) - font-lock-mode) + (when font-lock-mode (font-lock-mode-internal nil) (font-lock-mode-internal t)) diff --git a/lisp/progmodes/verilog-mode.el b/lisp/progmodes/verilog-mode.el index e5c2c807534..f934ef7a80e 100644 --- a/lisp/progmodes/verilog-mode.el +++ b/lisp/progmodes/verilog-mode.el @@ -3442,7 +3442,7 @@ For insignificant changes, see instead `verilog-save-buffer-state'." (verilog-run-hooks 'verilog-before-save-font-hook) (let* ((verilog-save-font-mod-hooked (- (point-max) (point-min))) ;; Significant speed savings with no font-lock properties - (fontlocked (when (and (boundp 'font-lock-mode) font-lock-mode) + (fontlocked (when font-lock-mode (font-lock-mode 0) t))) (run-hook-with-args 'before-change-functions (point-min) (point-max)) @@ -5535,7 +5535,7 @@ FILENAME to find directory to run in, or defaults to `buffer-file-name'." default nil nil 'verilog-preprocess-history default))))) (unless command (setq command (verilog-expand-command verilog-preprocessor))) - (let* ((fontlocked (and (boundp 'font-lock-mode) font-lock-mode)) + (let* ((fontlocked font-lock-mode) (dir (file-name-directory (or filename buffer-file-name))) (cmd (concat "cd " dir "; " command))) (with-output-to-temp-buffer "*Verilog-Preprocessed*" diff --git a/lisp/vc/cvs-status.el b/lisp/vc/cvs-status.el index ff3a2944a17..26fb6206c80 100644 --- a/lisp/vc/cvs-status.el +++ b/lisp/vc/cvs-status.el @@ -356,9 +356,8 @@ the list is a three-string list TAG, KIND, REV." (defvar font-lock-mode) ;; (defun cvs-refontify (beg end) -;; (when (and (boundp 'font-lock-mode) -;; font-lock-mode -;; (fboundp 'font-lock-fontify-region)) +;; (when (and font-lock-mode +;; (fboundp 'font-lock-fontify-region)) ;; (font-lock-fontify-region (1- beg) (1+ end)))) (defun cvs-status-trees () diff --git a/lisp/vc/smerge-mode.el b/lisp/vc/smerge-mode.el index f50b2540c55..c66a4fb2d6a 100644 --- a/lisp/vc/smerge-mode.el +++ b/lisp/vc/smerge-mode.el @@ -1410,7 +1410,7 @@ with a \\[universal-argument] prefix, makes up a 3-way conflict." \\{smerge-mode-map}" :group 'smerge :lighter " SMerge" - (when (and (boundp 'font-lock-mode) font-lock-mode) + (when font-lock-mode (save-excursion (if smerge-mode (font-lock-add-keywords nil smerge-font-lock-keywords 'append) diff --git a/lisp/woman.el b/lisp/woman.el index 1d3c8d16903..9a03d30bb7f 100644 --- a/lisp/woman.el +++ b/lisp/woman.el @@ -2114,7 +2114,7 @@ No external programs are used." (interactive) ; mainly for testing (WoMan-log-begin) (run-hooks 'woman-pre-format-hook) - (and (boundp 'font-lock-mode) font-lock-mode (font-lock-mode -1)) + (and font-lock-mode (font-lock-mode -1)) ;; (fundamental-mode) (let ((start-time (current-time)) time)