From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Robert Pluim Newsgroups: gmane.emacs.devel Subject: Re: Faces for strong, emph and friends in Info? Date: Mon, 08 Apr 2024 18:57:10 +0200 Message-ID: <87o7ajssgp.fsf@gmail.com> References: <86o7ajyk6v.fsf@gnu.org> 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="11156"; mail-complaints-to="usenet@ciao.gmane.io" Cc: "T.V Raman" , emacs-devel@gnu.org To: Eli Zaretskii Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Mon Apr 08 18:57:32 2024 Return-path: Envelope-to: ged-emacs-devel@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 1rtsJI-0002kE-Jl for ged-emacs-devel@m.gmane-mx.org; Mon, 08 Apr 2024 18:57:32 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rtsJ5-0006Bu-Ne; Mon, 08 Apr 2024 12:57:19 -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 1rtsJ2-00069S-Np for emacs-devel@gnu.org; Mon, 08 Apr 2024 12:57:17 -0400 Original-Received: from mail-lf1-x12d.google.com ([2a00:1450:4864:20::12d]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rtsJ0-0003tu-UA; Mon, 08 Apr 2024 12:57:16 -0400 Original-Received: by mail-lf1-x12d.google.com with SMTP id 2adb3069b0e04-516d6898bebso3329789e87.3; Mon, 08 Apr 2024 09:57:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1712595432; x=1713200232; darn=gnu.org; h=content-transfer-encoding:mime-version:message-id:date :gmane-reply-to-list:references:in-reply-to:subject:cc:to:from:from :to:cc:subject:date:message-id:reply-to; bh=DE/CmReCUOebRwmvVapoaD1DYtxoYDKYgv1cfSyYcQw=; b=axuRAoJGHqxozmjeDjUyBrDisVkr+L0Gy+lIzAQJRxnxvzo9PZDYl9GfPYP/aE/mrR etXY7TJyB5e09xjI3wBJzR+S9RuCqqxeCEe5cEj6FzkSsKWgQCtPdeU4tbdG93uLaxzd YTFy5XYl/2jQ8hzYDnLtgkI8BXZ2ijVfRqs1HSWXurGzOmGjs8fZPJBmeonsIh6i2SXD eZNpvGTx74i2B/ZKFs56l7/qmYmYrr2R4DjRrwMG4pbTe23XYuychEYpbzm3a99EhsXq 2Hsa76Ek+xAD+DQeFy4KA73Tf/r9c8iifCGXleFf8kmZvnMeEkRUqQNB7uhEouCxdm6c yH9Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712595432; x=1713200232; h=content-transfer-encoding:mime-version:message-id:date :gmane-reply-to-list:references:in-reply-to:subject:cc:to:from :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=DE/CmReCUOebRwmvVapoaD1DYtxoYDKYgv1cfSyYcQw=; b=HwIDdnmBIabihS6ugpUAe1tQaDejnb3QNgtta3OcQvlb8WVKMToBWmlV+5g67vNvsR MSw2meqLy7L7i+f/cEpiJwIEDncftq309MSGSQU3bQhQtvWurtSkvd84tNGzJqb62s2Y iS+LsgvP+jDM8OAEyko9tOwrqJCQrBT6Ugi4E2+1Yyv8c1GaotzGF6Pb+mIzVuRkkda8 t+wc3ajS8udBbKUjuAN+0RG0KSu8qlicQzIYRhkW3bwvfQYroUbGsnCIHg1pYd/cCWfZ 4lNT5TXkDKGEtv9E3kpBAWHWRc1KA0n+CIbjA2LHb4RIqKB7eDVGNqKNVe3Jdcdtt+Iw uF5g== X-Forwarded-Encrypted: i=1; AJvYcCWTHXrxC0xZcbkGbyEbbraJEyigwTVlK+Tvr82InBqDRzXN9uxHZCvqw/ntieDt00R3v4+jLqWy+HA+f6vDzeMkvoV+ X-Gm-Message-State: AOJu0Yylw53KBmIxramhKSxDWj0jLumciol94EPq3zl+VJ3s6+e//IWK Rv+/bw0K3vh5ubKHDCciM/oysq13q9O1f3t8REiDiq644iMmOgFrZqYjJrqm X-Google-Smtp-Source: AGHT+IH8fLlLykD5Idg53NgIDK4gXE2lHuqapO6OT9Tl1m33ZOahcpu+0cVgOQ94BawTGp+sJrTIfw== X-Received: by 2002:a2e:854c:0:b0:2d6:b11a:3a49 with SMTP id u12-20020a2e854c000000b002d6b11a3a49mr6075086ljj.9.1712595432119; Mon, 08 Apr 2024 09:57:12 -0700 (PDT) Original-Received: from rltb ([82.66.8.55]) by smtp.gmail.com with ESMTPSA id f14-20020a05600c154e00b0041552dbc539sm14045705wmg.11.2024.04.08.09.57.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 08 Apr 2024 09:57:11 -0700 (PDT) In-Reply-To: <86o7ajyk6v.fsf@gnu.org> (Eli Zaretskii's message of "Mon, 08 Apr 2024 17:59:20 +0300") Gmane-Reply-To-List: yes Received-SPF: pass client-ip=2a00:1450:4864:20::12d; envelope-from=rpluim@gmail.com; helo=mail-lf1-x12d.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, 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: emacs-devel@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.devel:317617 Archived-At: >>>>> On Mon, 08 Apr 2024 17:59:20 +0300, Eli Zaretskii said: >> info.el defines faces for various structural contructs but there >> appears to be no info-strong and info-emph -- is that intentional or >> just a lay-over from the time we didn't have font faces? Eli> I think it's just that no one has written the code to show *foo* a= nd Eli> _foo_ as italics and bold (and hide the _ and * characters). Of Eli> course, this will cause some lines be shorter or longer than they = are Eli> supposed to be, but maybe this is a worthwhile price to pay. Eli> Patches welcome. How robust do you want this to be? (I took a quick look at using font-lock for this, but I don=CA=BCt think that supports hiding stuff) Probably needs (yet another) config variable as well. diff --git a/lisp/info.el b/lisp/info.el index 176bc9c0033..14ed026a568 100644 --- a/lisp/info.el +++ b/lisp/info.el @@ -4491,6 +4491,16 @@ Info-quoted '((t :inherit fixed-pitch-serif)) "Face used for quoted elements.") =20 +(defface Info-strong + '((t :inherit bold)) + "Face used for *strong* elements." + :version "30.1") + +(defface Info-emphasis + '((t :inherit italic)) + "Face used for _emphasis_ elements." + :version "30.1") + ;; We deliberately fontify only =E2=80=98..=E2=80=99 quoting, and not `..'= , because ;; the former can be done much more reliably, i.e. without risking ;; false positives. @@ -5134,6 +5144,20 @@ Info-fontify-node (push (set-marker (make-marker) start) paragraph-markers)))))) =20 + ;; Font-lock *foo* and _foo_ and hide the marker characters. + (goto-char (point-min)) + (while (re-search-forward "\\([*_]\\)\\([^*_\n]+\\)\\([*_]\\)" nil t) + (when (string=3D (match-string 1) (match-string 3)) + (add-text-properties (match-beginning 1) (match-end 1) + '(invisible t front-sticky nil rear-nonstic= ky t)) + (add-text-properties (match-beginning 3) (match-end 3) + '(invisible t front-sticky nil rear-nonstic= ky t)) + (put-text-property (match-beginning 2) (match-end 2) + 'font-lock-face + (if (string=3D (match-string 1) "*") + 'Info-strong + 'Info-emphasis)))) + ;; Refill paragraphs (experimental feature) (when (and not-fontified-p Info-refill-paragraphs Robert --=20