From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: "T.V Raman" Newsgroups: gmane.emacs.devel Subject: Re: Faces for strong, emph and friends in Info? Date: Mon, 8 Apr 2024 15:02:28 -0700 Message-ID: <26132.26996.471153.564625@google.com> References: <86o7ajyk6v.fsf@gnu.org> <87o7ajssgp.fsf@gmail.com> 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="7230"; mail-complaints-to="usenet@ciao.gmane.io" Cc: eliz@gnu.org, raman@google.com, emacs-devel@gnu.org To: rpluim@gmail.com Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Tue Apr 09 00:03:23 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 1rtx5H-0001go-Ks for ged-emacs-devel@m.gmane-mx.org; Tue, 09 Apr 2024 00:03:23 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rtx4X-0003yr-Rw; Mon, 08 Apr 2024 18:02:37 -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 1rtx4W-0003yg-3E for emacs-devel@gnu.org; Mon, 08 Apr 2024 18:02:36 -0400 Original-Received: from mail-pl1-x629.google.com ([2607:f8b0:4864:20::629]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rtx4U-00033E-Bu for emacs-devel@gnu.org; Mon, 08 Apr 2024 18:02:35 -0400 Original-Received: by mail-pl1-x629.google.com with SMTP id d9443c01a7336-1e3ff14f249so11402855ad.1 for ; Mon, 08 Apr 2024 15:02:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1712613752; x=1713218552; darn=gnu.org; h=references:in-reply-to:subject:cc:to:date:message-id :content-transfer-encoding:mime-version:from:from:to:cc:subject:date :message-id:reply-to; bh=tPeHsW9kKJaOcsYAWOQlOq+VthrpjvsGmSGbu1n/tAY=; b=36KPqHVCJmhcHfuyTNKFwIXwWXhwU2kwmlXVQOld9Jol4y2TnWUysswgVnHiCVp0nZ oq2wT/AyBQLK4feYEXo0pFnX0i7tyUCtBNEeGo+GzkEOUDnvcz9Un4ntxwPsGX1vA9+e Tix0Btctpb1WyJZRfl8cXy/tPZxHrifcSxr2moD5Lkmr9ZiVO9qyxmwTfDEWH6kDo2ct +4xbSd+J3kEga5GME3FwtDNnRuMLJjONViUCojGE4t06/4hD3OnwYx5O6HkD7aR+nTj4 dpjdxgSmdzHIRHmDZHmxQrEsMkIcfvKmKMsnI3TpHUR7SmTpIcDR8xGocVGc0yHhWYa3 cXdA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712613752; x=1713218552; h=references:in-reply-to:subject:cc:to:date:message-id :content-transfer-encoding:mime-version:from:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=tPeHsW9kKJaOcsYAWOQlOq+VthrpjvsGmSGbu1n/tAY=; b=upvwukXqwj7CO4ctPvrdjv54tl5FUQN4Lx6ABGQPT6M05u6J2zVrkt3IlsTw1+Erp6 BtOVWly9ZuqGRsOI4glWH4dDbAZzYzJuRmxzqYbI48+IqMIgOrneULWJJT9IDTi7j6+W BmvaVdhSbRkdzgtLjWfCs6QtupsTdza4mBtpAfdbH9rZDbBSz5EbFE7tA8hd07JLz+WM dfRCeJrnZn0GrWh1lmfTHLkpY9ELCWvA4BzTi6PVITs327IQkyUK9ZIYLvzPe5TKAvPK BgeK8leOmP9S6DqgjkyDJvMsCddzv3dnQVJ6QADh1MKW3Ws87iiFQ5rnvDUTx9dmLF+c tEqg== X-Forwarded-Encrypted: i=1; AJvYcCU8nBNmquMGdWJPV+q97BfKB/b4whGthTpAPQ1mbrpevAoUXpGELYMO6dM5zGN8Myis+oUs5HJeFphWk7yru4nHL1zY X-Gm-Message-State: AOJu0Yzdaw9Mr8pO3OLrmUB1fomJpz+SIPrcx/5p2EQ7lQR1/z9nczgn apN93/DkRAuxnLnv1o0456/xyJKSa6u28H1bqrrIAQ9Dw6eKeNgVBn0pM24N8hXv27Y2cFUY2e3 SAw== X-Google-Smtp-Source: AGHT+IEjf3PuVtepQU2lOg50UyhBFTRc9xOM28wASxHKKZs3HjpcJInzwOUO6WidJlMUT+DDNQWVfw== X-Received: by 2002:a17:902:ea01:b0:1e0:c3b5:196 with SMTP id s1-20020a170902ea0100b001e0c3b50196mr1237164plg.20.1712613752012; Mon, 08 Apr 2024 15:02:32 -0700 (PDT) Original-Received: from raman9 (c-98-45-12-92.hsd1.ca.comcast.net. [98.45.12.92]) by smtp.gmail.com with ESMTPSA id x9-20020a170902a38900b001e42f215f33sm2546865pla.85.2024.04.08.15.02.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 08 Apr 2024 15:02:31 -0700 (PDT) In-Reply-To: <87o7ajssgp.fsf@gmail.com> X-Mailer: VM 8.1.1 under 30.0.50 (x86_64-pc-linux-gnu) Received-SPF: pass client-ip=2607:f8b0:4864:20::629; envelope-from=raman@google.com; helo=mail-pl1-x629.google.com X-Spam_score_int: -186 X-Spam_score: -18.7 X-Spam_bar: ------------------ X-Spam_report: (-18.7 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_MED=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, ENV_AND_HDR_SPF_MATCH=-0.5, NICE_REPLY_A=-1.071, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, USER_IN_DEF_DKIM_WL=-7.5, USER_IN_DEF_SPF_WL=-7.5 autolearn=unavailable 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:317628 Archived-At: Applied your patch, works like a charm! Wish I had asked for this a long time ago -- it's a huge time-saver when using speech output. Robert Pluim writes: > >>>>> On Mon, 08 Apr 2024 17:59:20 +0300, Eli Zaretskii said: > >> info.el defines faces for various structural contructs but th= ere > >> appears to be no info-strong and info-emph -- is that intenti= onal or > >> just a lay-over from the time we didn't have font faces=3F >=20 > Eli> I think it's just that no one has written the code to show = *foo* and > Eli> =5Ffoo=5F as italics and bold (and hide the =5F and * chara= cters). Of > Eli> course, this will cause some lines be shorter or longer tha= n they are > Eli> supposed to be, but maybe this is a worthwhile price to pay= =2E >=20 > Eli> Patches welcome. >=20 > How robust do you want this to be=3F (I took a quick look at using > font-lock for this, but I don=CA=BCt think that supports hiding stuf= f) >=20 > Probably needs (yet another) config variable as well. >=20 >=20 > 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 =5Femphasis=5F elements." > + :version "30.1") > + > ;; We deliberately fontify only =E2=80=98..=E2=80=99 quoting, and n= ot `..', 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 =5Ffoo=5F and hide the marker characte= rs. > + (goto-char (point-min)) > + (while (re-search-forward "\\([*=5F]\\)\\([^*=5F\n]+\\)\\([*=5F= ]\\)" 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-= nonsticky t)) > + (add-text-properties (match-beginning 3) (match-end 3) > + '(invisible t front-sticky nil rear-= nonsticky 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 >=20 >=20 > Robert > --=20 --=20 --