From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Emanuel Berg via Users list for the GNU Emacs text editor Newsgroups: gmane.emacs.help Subject: Re: font-lock for comments Date: Tue, 15 Feb 2022 11:59:43 +0100 Message-ID: <878rucmm3k.fsf@zoho.eu> References: Reply-To: Emanuel Berg Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="4648"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux) To: help-gnu-emacs@gnu.org Cancel-Lock: sha1:tN5IbY8lC3cRzXFwAgDcMYCexR0= Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Tue Feb 15 12:02:22 2022 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1nJvbB-000128-WE for geh-help-gnu-emacs@m.gmane-mx.org; Tue, 15 Feb 2022 12:02:22 +0100 Original-Received: from localhost ([::1]:49536 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nJvbA-0000yX-9t for geh-help-gnu-emacs@m.gmane-mx.org; Tue, 15 Feb 2022 06:02:20 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:48972) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nJvYt-0000y8-3w for help-gnu-emacs@gnu.org; Tue, 15 Feb 2022 05:59:59 -0500 Original-Received: from ciao.gmane.io ([116.202.254.214]:43412) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nJvYm-00068j-CM for help-gnu-emacs@gnu.org; Tue, 15 Feb 2022 05:59:58 -0500 Original-Received: from list by ciao.gmane.io with local (Exim 4.92) (envelope-from ) id 1nJvYk-0008P0-8O for help-gnu-emacs@gnu.org; Tue, 15 Feb 2022 11:59:50 +0100 X-Injected-Via-Gmane: http://gmane.org/ Mail-Followup-To: help-gnu-emacs@gnu.org Mail-Copies-To: never Received-SPF: pass client-ip=116.202.254.214; envelope-from=geh-help-gnu-emacs@m.gmane-mx.org; helo=ciao.gmane.io X-Spam_score_int: -16 X-Spam_score: -1.7 X-Spam_bar: - X-Spam_report: (-1.7 / 5.0 requ) BAYES_00=-1.9, HEADER_FROM_DIFFERENT_DOMAINS=0.25, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "help-gnu-emacs" Xref: news.gmane.io gmane.emacs.help:135961 Archived-At: goncholden via Users list for the GNU Emacs text editor wrote: > I want to change font for comments to bold. Should I change > both font-lock-comment-delimiter-face and > font-lock-comment-delimiter-face ? Test this: ;;; -*- lexical-binding: t -*- ;;; ;;; this file: ;;; http://user.it.uu.se/~embe8573/emacs-init/test-face.el ;;; https://dataswamp.org/~incal/emacs-init/test-face.el (defun insert-colored-text (str color bright) "Insert STR at point, in COLOR, and sometimes BRIGHT." (interactive (list (read-string "string: ") (read-string "color: ") (y-or-n-p "bright? ") )) (insert (propertize str 'font-lock-face `(:weight ,(if bright 'bold 'normal) :foreground ,color) ))) (defun test-all-faces () "Print a test string in every color, normal and bright." (interactive) (forward-line) (let ((str "this is what it looks like")) (dolist (bold '(nil t)) (dolist (color '("black" "red" "green" "yellow" "blue" "magenta" "cyan" "white") ) (insert-colored-text (format "%s in %s (that is %sbold)\n" str color (if bold "" "not ")) color bold) )))) ;; (test-all-faces) (when nil (progn (goto-char (point-max)) (insert "The French flag is ") (insert-colored-text "blue, " "blue" t) (insert-colored-text "white, " "white" t) (insert "and" ) (insert-colored-text " red." "red" nil) )) ;^ eval me -- underground experts united https://dataswamp.org/~incal