From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Bruno Barbier Newsgroups: gmane.emacs.help Subject: Re: Printing coloured strings in help-buffer Date: Sun, 14 Apr 2024 08:55:38 +0200 Message-ID: <661b7dec.050a0220.af06d.4a77@mx.google.com> References: Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="9663"; mail-complaints-to="usenet@ciao.gmane.io" Cc: Heime via Users list for the GNU Emacs text editor To: Heime , Heime Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Sun Apr 14 08:56:22 2024 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 1rvtmn-0002I0-Ml for geh-help-gnu-emacs@m.gmane-mx.org; Sun, 14 Apr 2024 08:56:21 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rvtmH-0008EZ-JK; Sun, 14 Apr 2024 02:55:49 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rvtmG-0008EP-7L for help-gnu-emacs@gnu.org; Sun, 14 Apr 2024 02:55:48 -0400 Original-Received: from mail-wm1-x329.google.com ([2a00:1450:4864:20::329]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rvtmC-0007s3-9a for help-gnu-emacs@gnu.org; Sun, 14 Apr 2024 02:55:46 -0400 Original-Received: by mail-wm1-x329.google.com with SMTP id 5b1f17b1804b1-41804f10c68so9119995e9.3 for ; Sat, 13 Apr 2024 23:55:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1713077741; x=1713682541; darn=gnu.org; h=mime-version:date:references:in-reply-to:subject:cc:to:from :message-id:from:to:cc:subject:date:message-id:reply-to; bh=gVHMQQhQ7O81+rBNmYpSKQ4OAYgKt97qGipXlZs3QMM=; b=azLEOCwERenYY3DuY4N+Q5qYYMpPsOh4+TV4FPRWFu/Q+3TRL1+MgFRkmwLceeMCkQ Wh7AZmJIxA/jOr0qezuD5jRXc7kZAZP6LVNDLlbVALpb4gVR3v8rzXw+gJj5vtnMnz7n /xMp89BkgQHMP/fEDWMMRsqL40pkyU2ok5BFIzdLUZv+xENAKRNXVJeiJYzaq1rmdhwU 16UTviQOhoIq36Z4jBGHTEi6d73JI9f/ncYQJEklqoyH5aqEuMtU3nJnIrV9HdcTkOdI rCNu/4VM8Ly/NKkC1lhXuhc0yxjWwfhP+2sP8WRDyJDiPTGtVLt2ls4xTPrR+uQuOxEa IHZw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1713077741; x=1713682541; h=mime-version:date:references:in-reply-to:subject:cc:to:from :message-id:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=gVHMQQhQ7O81+rBNmYpSKQ4OAYgKt97qGipXlZs3QMM=; b=umYA14N6yUD4E+7mc4TpuUhfxyn/7g0c0449ej0hxKPoLr6QbbQhpITf/v9vUWrs/8 u1UcnJXYC8zEMder5UDvrERqLjar8eWFZNCfepKzkVYwldoFr9UPWKDvgeDKWl5q16zH k0L5E0POsM+CVpQezxl8CMVUe9y8H3qTFs+ALloKLMYJgCc1dMa7EnGO0LvNDy9oKGxx pzDOJnJpqmyW3Xk6WEBW+8EIvWD/6EObz0NPvJibq2anxrXCcFFyoaQwByFVDGJWqzVy UY4HADjG1GCV0pFEFhHbUTc94GF7cpCCvnZCxbat11Qs41NvzAKC9b//AhUZFtjZw14B WzeA== X-Gm-Message-State: AOJu0YwQwwShVd7507B4C83zUlEoZvNaEnRmeo1/H7b1qk4TzJ7Fxl13 wwAaSQI6xJFNQco46jsDX/ljYglGTux4jMczrJ0i86wHbVr4eD4GH5pZ9g== X-Google-Smtp-Source: AGHT+IEmrSGIL37FFEtKWlXCmXkG0fw4B6YHR9PwW7fkEWW+nAzdQBWU+yyfg4iMXGGaoK7YlTRVzw== X-Received: by 2002:a05:600c:154b:b0:418:3072:d252 with SMTP id f11-20020a05600c154b00b004183072d252mr1800275wmg.2.1713077741181; Sat, 13 Apr 2024 23:55:41 -0700 (PDT) Original-Received: from keynux ([2a01:e0a:505:3460:1c18:688d:ece4:372e]) by smtp.gmail.com with ESMTPSA id i5-20020a05600c354500b004183e983d97sm1984656wmq.39.2024.04.13.23.55.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 13 Apr 2024 23:55:40 -0700 (PDT) Original-Received: by keynux (sSMTP sendmail emulation); Sun, 14 Apr 2024 08:55:39 +0200 In-Reply-To: Received-SPF: pass client-ip=2a00:1450:4864:20::329; envelope-from=brubar.cs@gmail.com; helo=mail-wm1-x329.google.com 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, MSGID_FROM_MTA_HEADER=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 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-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.help:146319 Archived-At: Heime writes: > Sent with Proton Mail secure email. > > On Sunday, April 14th, 2024 at 10:20 AM, Heime wrote: > >> How can I print text with colour? Have made the following and want >> vcname and vcfile to print in colour, in the help buffer. >> >> >> (defun gali-intro (vcname vcfile) >> "TODO" >> >> (princ >> (concat >> "`" vcname "' is a variable defined in` " vcfile "'.\n\n" >> "Its description is shown below.\n\n")) ) >> >> (defun gali-vconst () >> (with-help-window (help-buffer) >> (gali-intro "gali-minicompl" "gali.el" ))) > > Have made the following test but the colour is not being activated > > (defun sangali-defcon (vcname color) > (insert (propertize vcname 'face '(:foreground color))) ) If Font Lock mode is enabled, you need to use 'font-lock-face, see: (info "(elisp) Special Properties") The following works for me, in the scratch buffer: (with-current-buffer "*scratch*" (insert (propertize "hello" 'font-lock-face '(:foreground "blue")))) You can check what face is applied, calling `describe-char'. Bruno