From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: goncholden Newsgroups: gmane.emacs.help Subject: Re: font-lock for comments Date: Tue, 15 Feb 2022 11:32:08 +0000 Message-ID: References: <878rucmm3k.fsf@zoho.eu> Reply-To: goncholden Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="2016"; mail-complaints-to="usenet@ciao.gmane.io" Cc: help-gnu-emacs@gnu.org To: Emanuel Berg Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Tue Feb 15 12:33:10 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 1nJw50-0000Ko-FR for geh-help-gnu-emacs@m.gmane-mx.org; Tue, 15 Feb 2022 12:33:10 +0100 Original-Received: from localhost ([::1]:51558 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nJw4y-0006Ix-Qk for geh-help-gnu-emacs@m.gmane-mx.org; Tue, 15 Feb 2022 06:33:08 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:33100) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nJw4D-0006IE-Gg for help-gnu-emacs@gnu.org; Tue, 15 Feb 2022 06:32:21 -0500 Original-Received: from mail-4318.protonmail.ch ([185.70.43.18]:49761) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nJw49-0004gB-1R for help-gnu-emacs@gnu.org; Tue, 15 Feb 2022 06:32:19 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=protonmail.com; s=protonmail3; t=1644924730; bh=+BK2HO6nVtLhHJwGU5O2fKm4Ir5sDeI73oFDqOzjQIE=; h=Date:To:From:Cc:Reply-To:Subject:Message-ID:In-Reply-To: References:From:To:Cc:Date:Subject:Reply-To:Feedback-ID: Message-ID; b=mqlN4A52byU3AteZVH9DTvKy1YQS+aWl71eYxXG6nciZWrfHODkgeMZpsJN4GTu44 Z2NU7BITwM2rU7+jjBJe0bjKcF/GW2Kaz4SU/qjuMC91g/VOhrKndAFTE7A0rVaCtV 3ijA1lnVLXIztXx67v+yhpnLLilyZBEoFdqmNqTX+ExNAsf+vXrAQncnYNoaQGN3J4 SdeMlMQmDp+mL8jDwPvJZhn0r1s1Gb4/aJB+QlDXFxalMhxsDwT7Uo2rhe34D1efFY 9wPH9nypzyrJC8k7eW3xF6oNRxDOK7UlNWhdivaqeJVFw7LafKQnEht72rtaiY/IDy D9CoOitHNiRUw== In-Reply-To: <878rucmm3k.fsf@zoho.eu> Received-SPF: pass client-ip=185.70.43.18; envelope-from=goncholden@protonmail.com; helo=mail-4318.protonmail.ch X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham 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:135962 Archived-At: ------- Original Message ------- On Tuesday, February 15th, 2022 at 10:59 AM, Emanuel Berg via Users list fo= r the GNU Emacs text editor wrote: > 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) )) I failed to understand how the code helps me.