From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: =?UTF-8?B?Sm/Do28gVMOhdm9yYQ==?= Newsgroups: gmane.emacs.devel Subject: Re: master 78fc49407b8 1/3: Improve filling of ChangeLog entries Date: Wed, 31 Jan 2024 16:46:42 +0000 Message-ID: References: <170643232559.30479.16631610453249222615@vcs2.savannah.gnu.org> <20240128085846.187A2C1DAE4@vcs2.savannah.gnu.org> <540cc339-b7d4-4c1a-b084-c7f739ad4947@gutov.dev> <8734ue327d.fsf@gmail.com> <87a5omf1e8.fsf@yahoo.com> <878r45px71.fsf@yahoo.com> <87y1c5ob4h.fsf@yahoo.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="12759"; mail-complaints-to="usenet@ciao.gmane.io" Cc: Dmitry Gutov , Po Lu , emacs-devel@gnu.org To: Alan Mackenzie Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Wed Jan 31 17:47:47 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 1rVDkY-00033c-Th for ged-emacs-devel@m.gmane-mx.org; Wed, 31 Jan 2024 17:47:46 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rVDjp-0000HN-R3; Wed, 31 Jan 2024 11:47:01 -0500 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 1rVDjn-0000Gw-Tj for emacs-devel@gnu.org; Wed, 31 Jan 2024 11:46:59 -0500 Original-Received: from mail-lf1-x12f.google.com ([2a00:1450:4864:20::12f]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rVDjl-0005eD-Dw for emacs-devel@gnu.org; Wed, 31 Jan 2024 11:46:58 -0500 Original-Received: by mail-lf1-x12f.google.com with SMTP id 2adb3069b0e04-5100cb238bcso9823508e87.3 for ; Wed, 31 Jan 2024 08:46:57 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1706719615; x=1707324415; darn=gnu.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=MDo+06LkB9tCEibyIZWDLnd3e5jRxemI+GtU/sw43ZI=; b=CWFztF/ggUsnnosBXAptq7ixc3O//zkoX/o/Bu9gflNmiHjmVjVbGTVMspNHZGAxjv Dca21rjCoUdqXSfuASIza/MTjiONyG50lsd5rjhZ0VBizsTSiOHHigM9HIhpCbfcdVV2 +ZR5lTfc9y5wf2DfBPF+WS3jkmIhSYf/rq38oM0PJmBwaKD4SZ6LD+D2wjKw0wCCODLU 7jMNbRDeuOhO+dSK2fVatxKJQuT7y3afxLyosCZf+E9Igceqk+h/zjNWHfndXY5aQx2N J269zPhTdoEsDQYKcdd1NCZ2uYokm4kD7gOSqR+fQRzDS6alZur4apeoLN2vSBoEIo88 oTKQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1706719615; x=1707324415; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=MDo+06LkB9tCEibyIZWDLnd3e5jRxemI+GtU/sw43ZI=; b=uRCVNVEgwhwhPCtLtA0lrDsL87Ifz0sIdZZmyneU7hxA4lCRa/qfcCptn3zctenwXU 7Nc8C+KbCAliyByqQkS1j9v+OTjCS4Xl62EnaWdarFz+X4938ovSWPtVNXnlbtqa69sY ftDj55T4xy9HH/ulJM0XdP+SiUGlfz+CtDFxwV6gsSgtFDXUJre9weGVvQgB04bMNRMT YBYtqRWrdCoMG+1BS1R5tTYoI49voHoxp/mCbfUoZF0e31+OssGTYYJKKOCF64SWhApq MLu1+F0tqvRPlBsgJNB3xpxoq8ZYXES7Xx6gQ5jqATjRH6/xl6yS6rwP7LPffcVCw5C0 21Dw== X-Gm-Message-State: AOJu0YwRZq67rTuwpTsxkIchuGhmccs9GXXw2zmrjHWi7ORF6RWoei9Y yE6P+/kIwzdmVwad94OaR8La/4cl6j8T1x/8eXgcQQL9suJNaN6jpIyG8tZaGTyn/49/lQ8DyGd 6Wzzgo/lpP7Bb01ya23uWGbRqPwM= X-Google-Smtp-Source: AGHT+IH0p4cYU1g6Dw4FQEJpqpEPsf+sSR5YGNUUTYuFs4gKLBPJ1h++6Grk3Na5RzXwph9CqfNUVNx0PPMtK2vfvvE= X-Received: by 2002:ac2:5f85:0:b0:511:ecf:e5d5 with SMTP id r5-20020ac25f85000000b005110ecfe5d5mr17658lfe.6.1706719615314; Wed, 31 Jan 2024 08:46:55 -0800 (PST) In-Reply-To: Received-SPF: pass client-ip=2a00:1450:4864:20::12f; envelope-from=joaotavora@gmail.com; helo=mail-lf1-x12f.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, T_SCC_BODY_TEXT_LINE=-0.01 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:315674 Archived-At: On Wed, Jan 31, 2024 at 3:32=E2=80=AFPM Alan Mackenzie wrote: > > Was there a way to write it more succinctly, using some higher-level > > constructs? That is the subject. Dmitry, sometimes you don't even need higher-level constructs. You just need not to freak out over cl-loop, breathe slowly, and expand it to see what you get. > I think the discussion is over the advantages and disadvantages of > replacing obscure concise code with its equivalent in plain Lisp. Alan, here's a version of log-edit--insert-filled-defuns derived from the o= ne we had a few days ago, and which really didn't have "countless bugs". All "plain elisp" as far as I can tell. Spans one fourth of Po's. I got it by simply cleaning up the macroexpansion. (defun log-edit--insert-filled-defuns (func-names) "Insert FUNC-NAMES, following ChangeLog formatting." (if (not func-names) (insert ":") (unless (or (memq (char-before) '(?\n ?\s)) (> (current-column) fill-column)) (insert " ")) (let* ((first-fun t) (def nil)) (while (consp func-names) (setq def (pop func-names)) (when (> (+ (current-column) (string-width def) (if first-fun 1 2) (if (null func-names) 1 0)) fill-column) (unless first-fun (insert ")")) (unless (eq (char-before) ?\n) (insert "\n")) (setq first-fun t)) (insert (if first-fun "(" ", ") def) (setq first-fun nil))) (insert "):"))) Even if in Po's version the comments are not counted, this version is still less than half the length, less variables, less 'if', no 'delete-char', no 'format', doesn't 'cons', and much more closely resembles the original, passing all of Po's tests. Probably could use a comment to explain the line measuring arithmetic, or made even simpler if one really wanted to, but I think it's just short enough to be fine. Uses 'pop' and 'unless'. Dunno if that is "plain elisp" to you. I've never seen that defined anywhere, don't know why you get to say what it is, or why it's even a useful working concept. For the other rewritten function it's much of the same I've already shown how a one-line change would have fixed its bug (taking for granted that is was even a bug): - (beg (progn (goto-char beg) (line-beginning-position)))) + (beg (progn (goto-char beg) (skip-chars-backward "^ \n") (point))))