From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.devel Subject: Re: [PATCH v2] Font lock long Git commit summary lines Date: Mon, 05 Sep 2022 21:23:47 +0300 Message-ID: <83mtbdk7d8.fsf@gnu.org> References: <20220903170308.301805-1-spwhitton@spwhitton.name> <871qsq2096.fsf@melete.silentflame.com> <8335d6koru.fsf@gnu.org> <87sfl5zo1o.fsf@melete.silentflame.com> Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="662"; mail-complaints-to="usenet@ciao.gmane.io" Cc: emacs-devel@gnu.org To: Sean Whitton Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Mon Sep 05 20:27:20 2022 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 1oVGoa-000AYy-Cs for ged-emacs-devel@m.gmane-mx.org; Mon, 05 Sep 2022 20:27:20 +0200 Original-Received: from localhost ([::1]:41178 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oVGoY-0007QP-OX for ged-emacs-devel@m.gmane-mx.org; Mon, 05 Sep 2022 14:27:18 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:45192) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oVGlV-00034o-Vx for emacs-devel@gnu.org; Mon, 05 Sep 2022 14:24:11 -0400 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]:59234) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oVGlU-0002Dn-Ey; Mon, 05 Sep 2022 14:24:08 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=r16zXDKXVGgKUkfpNWBBBlUZowW+S2PdMK/iDMQi9tc=; b=Y0+c/HzkTMIw /s1G3T7AJY+YGykElIh6dYyP3mnfoSyoOnF+lqzIcwu6pD/6XoCR7teAUyMolE+YCLDYxwJEw0ftd m3NCmrJFMpCsFvVtSykH+TOtlZtEpCLE8xu2CaL7N4CIl2q0uGaiMiV4sWcRl9/FkPDAZ4ukpIr/x iGZA2lVk+ay5KdOlll07NpBJ0PkpG4SGYvVBuVqWHP8yXXatuZ1L/ofCYzPHAgQ9cR1qWvIpzX4t+ nvI1x6Vgc9i+zmvfEGr2ZnDBxr8++MPlkLrSfyo1r2SlheCMwAN7E6MwR+3EU2Q3p3sfJa8Tfu9pO LLXKF6OClr+ErY3d1XDgiA==; Original-Received: from [87.69.77.57] (port=3902 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oVGlT-0004rh-RH; Mon, 05 Sep 2022 14:24:08 -0400 In-Reply-To: <87sfl5zo1o.fsf@melete.silentflame.com> (message from Sean Whitton on Mon, 05 Sep 2022 11:14:27 -0700) 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" Xref: news.gmane.io gmane.emacs.devel:294757 Archived-At: > From: Sean Whitton > Date: Mon, 05 Sep 2022 11:14:27 -0700 > > >> +(defun vc-git--log-edit-summary-check (limit) > >> + (and (re-search-forward "^Summary: " limit t) > >> + (when-let ((regex > >> + (cond ((and vc-git-log-edit-summary-max > >> + vc-git-log-edit-summary-target) > > > > Should this test using numberp? > > > >> + (vc-git-log-edit-summary-max > >> + (format ".\\{,%d\\}\\(?2:.*\\)" > >> + vc-git-log-edit-summary-max)) > >> + (vc-git-log-edit-summary-target > >> + (format ".\\{,%d\\}\\(.*\\)" > >> + vc-git-log-edit-summary-target))))) > > > > Likewise here. > > I put calls to natnump in, but I'm not sure about it. Is it really most > useful to silently fail to highlight the characters if somehow something > other than a number has ended up in the variables? I'm new to working > with font lock so would be grateful for more input. In similar cases we document this, something like ... any other value is treated as nil. This is IMO less fragile in the face of users doing silly things with the value. Thanks.