From unknown Sat Aug 09 15:53:01 2025 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-Mailer: MIME-tools 5.509 (Entity 5.509) Content-Type: text/plain; charset=utf-8 From: bug#78927 <78927@debbugs.gnu.org> To: bug#78927 <78927@debbugs.gnu.org> Subject: Status: [PATCH] Update `fill-region-as-paragraph-semlf' to follow fill.el protocols Reply-To: bug#78927 <78927@debbugs.gnu.org> Date: Sat, 09 Aug 2025 22:53:01 +0000 retitle 78927 [PATCH] Update `fill-region-as-paragraph-semlf' to follow fil= l.el protocols reassign 78927 emacs submitter 78927 Roi Martin severity 78927 normal tag 78927 patch thanks From debbugs-submit-bounces@debbugs.gnu.org Mon Jun 30 07:10:26 2025 Received: (at submit) by debbugs.gnu.org; 30 Jun 2025 11:10:26 +0000 Received: from localhost ([127.0.0.1]:41136 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1uWCP2-0002YJ-0W for submit@debbugs.gnu.org; Mon, 30 Jun 2025 07:10:26 -0400 Received: from lists.gnu.org ([2001:470:142::17]:44464) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1uWCOx-0002Rv-86 for submit@debbugs.gnu.org; Mon, 30 Jun 2025 07:10:21 -0400 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 1uWCOr-0008Je-JR for bug-gnu-emacs@gnu.org; Mon, 30 Jun 2025 07:10:13 -0400 Received: from mail-wm1-x331.google.com ([2a00:1450:4864:20::331]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1uWCOm-00010T-Eu for bug-gnu-emacs@gnu.org; Mon, 30 Jun 2025 07:10:13 -0400 Received: by mail-wm1-x331.google.com with SMTP id 5b1f17b1804b1-453749aef9eso15016745e9.3 for ; Mon, 30 Jun 2025 04:10:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1751281806; x=1751886606; darn=gnu.org; h=mime-version:message-id:date:subject:to:from:from:to:cc:subject :date:message-id:reply-to; bh=dfPLaoc6kmee4KsmxmS7Y0jFDE66ZJq2v8PvLMtYAck=; b=OWdloqGxp09sHobr3MmKBqN+Scr/dDa35hp2z9eGCFxn3UgS+TgPetrpjIxNFBIjpS z3h1wREZL6ssYVB1lfY83tPJ1JeRg1guvVip8QeYN1Mk+yw1tAk0WvMAr0s+p+Fh8GpH ZQLRxPPRgJ/1t3OhIaSGYS5AwCWf87UZOv8K6eyUbzAPXuojg93cArjTaLKZenG5MwSi m/2XF/bcU78xDOi8BA86XIMRV1mBGOjwtECLwr/1EjMc7d352nknOQ9uc21Z/G4QtIkK tIR0UnwCvmlt0whyebC+ozIaDUzX1RPaY0HpAyZ9BGHmtpJrHwMi9IytCU29riHEUyb0 2FNQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1751281806; x=1751886606; h=mime-version:message-id:date:subject:to:from:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=dfPLaoc6kmee4KsmxmS7Y0jFDE66ZJq2v8PvLMtYAck=; b=YwDwUj/q9Xvfe1TghHSqdbHcgSmKFFaXQiRYsGEWxtBykxzwnjU5G9bcs+BpKW+n4K 4ik5J5XJgb3agXByYL+q9HNK+mGDm6WMbqpnDTY/uW/QmVBBxQEh99Wwbp6tWXu8PEIl qc6dA82NkSknaTI1NfMInWzeUbVYiIssjQGYNZKQ52bNfPZNdMBk1xNgZXlBOSUrx5zg Nhn1h1L5XkoMOL4EnUyIeRGIsE+7fQsTnyuFTdKI4e0x9mC7ZuHa9rYKpTyfkFW+UP9+ nEqMO3IBQB3NEUH2QpnfD0U2svbiTxxe6AFdD0S3Pz7tHL5/wp3Nsun2gV1MABBH+0r6 Ac1Q== X-Gm-Message-State: AOJu0YyPxP1ouWXo+eO1CRKLeeezLG2Vpxme+W6yX98IbNyZkHFE1hDs ovSOQsRt05+rekut/MIjA5jOCYzIYUb4UBVC0I8R9YUDDa6T+5wXIohPAHeXrw== X-Gm-Gg: ASbGnctogt280Z5ZttTHfSZv5KkVyXB45yf5SZzE6TKInuUoErwLmwKEhWuj9R8UO5+ YN/MOsVb9eAaWonm3frpjpXGHGXpEYlZIV1FsiiGeNP8bjDvIwIB8oK0xfuzd9wNy8vUs4kbDrv vPgYqgYy77aPeBiijDCYRsOWlsdsR6BqtbRgpgzpjwL5ayRFZTtRBG9Khe45sx9kSoFjyJqXEeN cgglrOpHDKIZB1/5/7SDhuJNMigctsoqgrbHm3ewHSLCviytZz2IBj3yJbTx8jXOLSGHogCzZYh fHxD9uGyEpNDU23RM0bXNSYYHS9srfANyvcemzBkFXfsonAtWKTLxkSrUCr4 X-Google-Smtp-Source: AGHT+IF17cLFeOrUJkE2zQQ/dk1s6AELo+vPQ8QFSjRKTcGygKnlHisWCSpSCfYeC4lD0Yd0/NbUcw== X-Received: by 2002:a05:600c:4e11:b0:453:7713:546a with SMTP id 5b1f17b1804b1-4538f758197mr126012545e9.14.1751281805773; Mon, 30 Jun 2025 04:10:05 -0700 (PDT) Received: from localhost ([84.79.192.255]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-453823c0812sm160689575e9.34.2025.06.30.04.10.04 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 30 Jun 2025 04:10:05 -0700 (PDT) From: Roi Martin To: bug-gnu-emacs@gnu.org Subject: [PATCH] Update `fill-region-as-paragraph-semlf' to follow fill.el protocols X-Debbugs-Cc: monnier@iro.umontreal.ca, eliz@gnu.org Date: Mon, 30 Jun 2025 13:09:57 +0200 Message-ID: <875xgdeb96.fsf@gmail.com> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Received-SPF: pass client-ip=2a00:1450:4864:20::331; envelope-from=jroi.martin@gmail.com; helo=mail-wm1-x331.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-Spam-Score: 1.0 (+) X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.0 (/) --=-=-= Content-Type: text/plain Tags: patch This patch updates the `fill-region-as-paragraph-semlf' function to follow the `fill-region-as-paragraph-function' protocol. This allows to delete the `fill-paragraph-semlf' function, which is replaced by `fill-paragraph' combined with assigning `fill-region-as-paragraph-semlf' to `fill-region-as-paragraph-function'. Stefan, I also took the opportunity to remove the `with-restriction' call from `fill-region-as-paragraph-semlf', as discussed in: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=78561#47 Given that `fill-paragraph-semlf' is not part of any stable release of GNU Emacs, I guess it is fine to remove it. Is this a fair assumption? Roi --=-=-= Content-Type: text/x-patch Content-Disposition: attachment; filename=0001-Update-fill-region-as-paragraph-semlf-to-follow-fill.patch >From 964fc161e32a05d8b252d09b0c6f5fabbc4aa19a Mon Sep 17 00:00:00 2001 From: Roi Martin Date: Tue, 17 Jun 2025 19:21:18 +0200 Subject: [PATCH] Update `fill-region-as-paragraph-semlf' to follow fill.el protocols Update the `fill-region-as-paragraph-semlf' function to follow the `fill-region-as-paragraph-function' protocol. This allows to delete the `fill-paragraph-semlf' function, which is replaced by `fill-paragraph' combined with assigning `fill-region-as-paragraph-semlf' to `fill-region-as-paragraph-function'. * lisp/textmodes/fill.el (fill-region-as-paragraph-semlf): Make this function compatible with `fill-region-as-paragraph-function'. Remove call to `with-restriction'. (fill-paragraph-semlf): Delete function. * test/lisp/textmodes/fill-tests.el (fill-tests--fill-paragraph-semlf): Add helper function. (fill-test-semlf-fill-region): Add test. (fill-test-fill-paragraph-semlf): Remove test. (fill-test-fill-paragraph-semlf-fill-paragraph-function) (fill-test-semlf-fill-paragraph, fill-test-fill-paragraph-semlf-justify) (fill-test-semlf-justify) (fill-test-fill-paragraph-semlf-sentence-end-double-space) (fill-test-semlf-sentence-end-double-space) (fill-test-fill-paragraph-semlf-fill-column, fill-test-semlf-fill-column) (fill-test-fill-paragraph-semlf-punctuation-marks) (fill-test-semlf-punctuation-marks, fill-test-fill-paragraph-semlf-twice) (fill-test-semlf-twice, fill-test-fill-paragraph-semlf-fill-prefix) (fill-test-semlf-fill-prefix) (fill-test-fill-paragraph-semlf-indented-block) (fill-test-semlf-indented-block, fill-test-fill-paragraph-semlf-revert) (fill-test-semlf-revert, fill-test-fill-paragraph-semlf-emacs-lisp-mode) (fill-test-semlf-emacs-lisp-mode, fill-test-fill-paragraph-semlf-c-mode) (fill-test-semlf-c-mode, fill-test-fill-paragraph-semlf-org-mode) (fill-test-semlf-org-mode, fill-test-fill-paragraph-semlf-markdown-mode) (fill-test-semlf-markdown-mode): Remove reference to `fill-paragraph-semlf' from test names. * test/lisp/textmodes/fill-resources/semlf-fill-region.erts: Add test data. * test/lisp/textmodes/fill-resources/semlf-fill-paragraph-function.erts: Delete file. * test/lisp/textmodes/fill-resources/semlf-emacs-lisp-mode.erts: Remove newlines around indented block. * doc/lispref/text.texi (Filling): Highlight that `fill-region-as-paragraph-function' changes the behavior of `fill-paragraph'. --- doc/lispref/text.texi | 9 +- lisp/textmodes/fill.el | 90 +++++---------- .../fill-resources/semlf-emacs-lisp-mode.erts | 8 +- .../semlf-fill-paragraph-function.erts | 12 -- .../fill-resources/semlf-fill-region.erts | 25 +++++ test/lisp/textmodes/fill-tests.el | 104 ++++++++++-------- 6 files changed, 122 insertions(+), 126 deletions(-) delete mode 100644 test/lisp/textmodes/fill-resources/semlf-fill-paragraph-function.erts create mode 100644 test/lisp/textmodes/fill-resources/semlf-fill-region.erts diff --git a/doc/lispref/text.texi b/doc/lispref/text.texi index fe3863db810d..b01df8512b72 100644 --- a/doc/lispref/text.texi +++ b/doc/lispref/text.texi @@ -1848,10 +1848,11 @@ Filling @defvar fill-region-as-paragraph-function This variable provides a way to override how functions like -@code{fill-region} fill text. Its value should be a function, which -should accept the arguments defined by @code{fill-region-as-paragraph} -and return the fill prefix used for filling. The default value of this -variable is @code{fill-region-as-paragraph-default}. +@code{fill-paragraph} and @code{fill-region} fill text. Its value +should be a function, which should accept the arguments defined by +@code{fill-region-as-paragraph} and return the fill prefix used for +filling. The default value of this variable is +@code{fill-region-as-paragraph-default}. @end defvar @defvar use-hard-newlines diff --git a/lisp/textmodes/fill.el b/lisp/textmodes/fill.el index bb10890141d6..87568c14c62b 100644 --- a/lisp/textmodes/fill.el +++ b/lisp/textmodes/fill.el @@ -1641,7 +1641,12 @@ fill-region-as-paragraph-semlf Return the `fill-prefix' used for filling. -For more details about semantic linefeeds, see `fill-paragraph-semlf'." +This function can be assigned to `fill-region-as-paragraph-function' to +override how functions like `fill-paragraph' and `fill-region' fill +text. + +For more details about semantic linefeeds, see `https://sembr.org/' and +`https://rhodesmill.org/brandon/2012/one-sentence-per-line/'." (interactive (progn (barf-if-buffer-read-only) (list (region-beginning) @@ -1651,67 +1656,32 @@ fill-region-as-paragraph-semlf (setq justify 'full)) (let ((from (min from to)) - (to (max from to)) + (to (copy-marker (max from to) t)) pfx) (goto-char from) - (with-restriction (line-beginning-position) to - (let ((fill-column (point-max))) - (setq pfx (or (save-excursion - (fill-region-as-paragraph-default (point) - (point-max) - nil - nosqueeze - squeeze-after)) - ""))) - (while (not (eobp)) - (let ((fill-prefix pfx)) - (fill-region-as-paragraph-default (point) - (progn (forward-sentence) (point)) - justify - nosqueeze - squeeze-after)) - (when (and (> (point) (line-beginning-position)) - (< (point) (line-end-position))) - (delete-horizontal-space) - (insert "\n") - (insert pfx)))) - (unless (eobp) (forward-char 1)) + (let ((fill-column (point-max))) + (setq pfx (or (save-excursion + (fill-region-as-paragraph-default (point) + (marker-position to) + nil + nosqueeze + squeeze-after)) + ""))) + (while (< (point) (marker-position to)) + (let ((fill-prefix pfx)) + (fill-region-as-paragraph-default (point) + (min (marker-position to) + (save-excursion + (forward-sentence) + (point))) + justify + t)) + (when (and (> (point) (line-beginning-position)) + (< (point) (line-end-position)) + (< (point) (marker-position to))) + (delete-horizontal-space) + (insert "\n") + (insert pfx))) pfx)) -(defun fill-paragraph-semlf (&optional justify) - "Fill paragraph at or after point using semantic linefeeds. -Refill text putting a newline character after each sentence, calling -`forward-sentence' to find the ends of sentences. If -`sentence-end-double-space' is non-nil, period followed by one space is -not the end of a sentence. - -If JUSTIFY is non-nil (interactively, with prefix argument), justify as -well. The variable `fill-column' controls the width for filling. - -Return the `fill-prefix' used for filling. - -You can use this function as the value of `fill-paragraph-function', so -`fill-paragraph' and other filling commands will use it. - -For more details about semantic linefeeds, see `https://sembr.org/' and -`https://rhodesmill.org/brandon/2012/one-sentence-per-line/'." - (interactive (progn - (barf-if-buffer-read-only) - (list (if current-prefix-arg 'full)))) - (unless (memq justify '(t nil none full center left right)) - (setq justify 'full)) - - (save-excursion - (let ((to (progn - (fill-forward-paragraph 1) - (backward-word) - (end-of-line) - (point))) - (from (progn - (fill-forward-paragraph -1) - (forward-word) - (beginning-of-line) - (point)))) - (fill-region-as-paragraph-semlf from to justify)))) - ;;; fill.el ends here diff --git a/test/lisp/textmodes/fill-resources/semlf-emacs-lisp-mode.erts b/test/lisp/textmodes/fill-resources/semlf-emacs-lisp-mode.erts index fe71ee32c1aa..1623b0dcf8aa 100644 --- a/test/lisp/textmodes/fill-resources/semlf-emacs-lisp-mode.erts +++ b/test/lisp/textmodes/fill-resources/semlf-emacs-lisp-mode.erts @@ -59,12 +59,12 @@ the comment. ;; eiusmod tempor. Incididunt ut labore et dolore magna aliqua. Ut ;; enim ad minim veniam, quis nostrud exercitation ullamco laboris ;; nisi ut. - +;; ;; |Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed ;; do eiusmod tempor. Incididunt ut labore et dolore magna ;; aliqua. Ut enim ad minim veniam, quis nostrud exercitation ;; ullamco laboris nisi ut. - +;; ;; Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do ;; eiusmod tempor. Incididunt ut labore et dolore magna aliqua. Ut ;; enim ad minim veniam, quis nostrud exercitation ullamco laboris @@ -74,12 +74,12 @@ the comment. ;; eiusmod tempor. Incididunt ut labore et dolore magna aliqua. Ut ;; enim ad minim veniam, quis nostrud exercitation ullamco laboris ;; nisi ut. - +;; ;; Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed ;; do eiusmod tempor. ;; Incididunt ut labore et dolore magna aliqua. Ut enim ad minim ;; veniam, quis nostrud exercitation ullamco laboris nisi ut. - +;; ;; Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do ;; eiusmod tempor. Incididunt ut labore et dolore magna aliqua. Ut ;; enim ad minim veniam, quis nostrud exercitation ullamco laboris diff --git a/test/lisp/textmodes/fill-resources/semlf-fill-paragraph-function.erts b/test/lisp/textmodes/fill-resources/semlf-fill-paragraph-function.erts deleted file mode 100644 index 467e7401cf50..000000000000 --- a/test/lisp/textmodes/fill-resources/semlf-fill-paragraph-function.erts +++ /dev/null @@ -1,12 +0,0 @@ -Name: fill-paragraph-function - -=-= -Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do -eiusmod tempor. Incididunt ut labore et dolore magna aliqua. Ut enim -ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut. -=-= -Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do -eiusmod tempor. -Incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, -quis nostrud exercitation ullamco laboris nisi ut. -=-=-= diff --git a/test/lisp/textmodes/fill-resources/semlf-fill-region.erts b/test/lisp/textmodes/fill-resources/semlf-fill-region.erts new file mode 100644 index 000000000000..231019a082a4 --- /dev/null +++ b/test/lisp/textmodes/fill-resources/semlf-fill-region.erts @@ -0,0 +1,25 @@ +Point-Char: | + +Name: fill-region-as-paragraph-function + +=-= +Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor. Incididunt ut labore et dolore magna aliqua. + +|Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor. Incididunt ut labore et dolore magna aliqua. + +Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor. Incididunt ut labore et dolore magna aliqua. + +Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor. Incididunt ut labore et dolore magna aliqua. +=-= +Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor. Incididunt ut labore et dolore magna aliqua. + +Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do +eiusmod tempor. +Incididunt ut labore et dolore magna aliqua. + +Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do +eiusmod tempor. +Incididunt ut labore et dolore magna aliqua. + +Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor. Incididunt ut labore et dolore magna aliqua. +=-=-= diff --git a/test/lisp/textmodes/fill-tests.el b/test/lisp/textmodes/fill-tests.el index 310d374a7adb..40ef907586fe 100644 --- a/test/lisp/textmodes/fill-tests.el +++ b/test/lisp/textmodes/fill-tests.el @@ -147,103 +147,115 @@ fill-test-fill-region-as-paragraph-semlf (beginning-of-line) (point)))))) -(ert-deftest fill-test-fill-paragraph-semlf () - "Test the `fill-paragraph-semlf' function." - (ert-test-erts-file (ert-resource-file "semlf.erts") +(ert-deftest fill-test-semlf-fill-region () + "Test `fill-region' with `fill-region-as-paragraph-semlf'." + (ert-test-erts-file (ert-resource-file "semlf-fill-region.erts") (lambda () - (fill-paragraph-semlf)))) + (setq-local fill-region-as-paragraph-function + #'fill-region-as-paragraph-semlf) + (fill-region + (point) + (progn + (goto-char (point-max)) + (forward-line -1) + (beginning-of-line) + (point)))))) -(ert-deftest fill-test-fill-paragraph-semlf-fill-paragraph-function () - "Test `fill-paragraph-semlf' as `fill-paragraph-function'." - (ert-test-erts-file (ert-resource-file "semlf-fill-paragraph-function.erts") +(defun fill-tests--fill-paragraph-semlf (&optional justify region) + "Call `fill-paragraph' using `fill-region-as-paragraph-semlf'." + (let ((fill-region-as-paragraph-function #'fill-region-as-paragraph-semlf)) + (fill-paragraph justify region))) + +(ert-deftest fill-test-semlf-fill-paragraph () + "Test `fill-paragraph' with `fill-region-as-paragraph-semlf'." + (ert-test-erts-file (ert-resource-file "semlf.erts") (lambda () - (setq-local fill-paragraph-function #'fill-paragraph-semlf) - (fill-paragraph)))) + (fill-tests--fill-paragraph-semlf)))) -(ert-deftest fill-test-fill-paragraph-semlf-justify () - "Test the JUSTIFY parameter of the `fill-paragraph-semlf' function." +(ert-deftest fill-test-semlf-justify () + "Test semantic-linefeed filling with text justification." (ert-test-erts-file (ert-resource-file "semlf-justify.erts") (lambda () - (fill-paragraph-semlf 'justify)))) + (fill-tests--fill-paragraph-semlf 'justify)))) -(ert-deftest fill-test-fill-paragraph-semlf-sentence-end-double-space () - "Test the `fill-paragraph-semlf' function with `sentence-end-double-space'." +(ert-deftest fill-test-semlf-sentence-end-double-space () + "Test semantic-linefeed filling with `sentence-end-double-space'." (ert-test-erts-file (ert-resource-file "semlf-sentence-end-double-space.erts") (lambda () (setq-local sentence-end-double-space nil) - (fill-paragraph-semlf)))) + (fill-tests--fill-paragraph-semlf)))) -(ert-deftest fill-test-fill-paragraph-semlf-fill-column () - "Test the `fill-paragraph-semlf' function with `fill-column'." +(ert-deftest fill-test-semlf-fill-column () + "Test semantic-linefeed filling with `fill-column'." (ert-test-erts-file (ert-resource-file "semlf-fill-column.erts") (lambda () (setq-local fill-column 35) - (fill-paragraph-semlf)))) + (fill-tests--fill-paragraph-semlf)))) -(ert-deftest fill-test-fill-paragraph-semlf-punctuation-marks () - "Test the `fill-paragraph-semlf' function with different punctuation marks." +(ert-deftest fill-test-semlf-punctuation-marks () + "Test semantic-linefeed filling with different punctuation marks." (ert-test-erts-file (ert-resource-file "semlf-punctuation-marks.erts") (lambda () - (fill-paragraph-semlf)))) + (fill-tests--fill-paragraph-semlf)))) -(ert-deftest fill-test-fill-paragraph-semlf-twice () - "Test to run the `fill-paragraph-semlf' function twice." +(ert-deftest fill-test-semlf-twice () + "Test filling the same text twice using semantic linefeeds." (ert-test-erts-file (ert-resource-file "semlf-twice.erts") (lambda () (goto-char (point-min)) - (fill-paragraph-semlf) + (fill-tests--fill-paragraph-semlf) (goto-char (point-min)) - (fill-paragraph-semlf)))) + (fill-tests--fill-paragraph-semlf)))) -(ert-deftest fill-test-fill-paragraph-semlf-fill-prefix () - "Test the `fill-paragraph-semlf' function with different fill prefixes." +(ert-deftest fill-test-semlf-fill-prefix () + "Test semantic-linefeed filling with different fill prefixes." (ert-test-erts-file (ert-resource-file "semlf-fill-prefix.erts") (lambda () - (fill-paragraph-semlf)))) + (fill-tests--fill-paragraph-semlf)))) -(ert-deftest fill-test-fill-paragraph-semlf-indented-block () - "Test the `fill-paragraph-semlf' function with an indented block." +(ert-deftest fill-test-semlf-indented-block () + "Test semantic-linefeed filling with an indented block." (ert-test-erts-file (ert-resource-file "semlf-indented-block.erts") (lambda () - (fill-paragraph-semlf)))) + (fill-tests--fill-paragraph-semlf)))) -(ert-deftest fill-test-fill-paragraph-semlf-revert () - "Test that the `fill-paragraph-semlf' function can be reverted." +(ert-deftest fill-test-semlf-revert () + "Test that semantic-linefeed filling can be reverted." (ert-test-erts-file (ert-resource-file "semlf-revert.erts") (lambda () (fill-paragraph) - (fill-paragraph-semlf) + (fill-tests--fill-paragraph-semlf) (fill-paragraph)))) -(ert-deftest fill-test-fill-paragraph-semlf-emacs-lisp-mode () - "Test the `fill-paragraph-semlf' function with `emacs-lisp-mode'." +(ert-deftest fill-test-semlf-emacs-lisp-mode () + "Test semantic-linefeed filling with `emacs-lisp-mode'." (ert-test-erts-file (ert-resource-file "semlf-emacs-lisp-mode.erts") (lambda () (emacs-lisp-mode) - (fill-paragraph-semlf)))) + (fill-tests--fill-paragraph-semlf)))) -(ert-deftest fill-test-fill-paragraph-semlf-c-mode () - "Test the `fill-paragraph-semlf' function with `c-mode'." +(ert-deftest fill-test-semlf-c-mode () + "Test semantic-linefeed filling with `c-mode'." (ert-test-erts-file (ert-resource-file "semlf-c-mode.erts") (lambda () (c-mode) - (fill-paragraph-semlf)))) + (fill-tests--fill-paragraph-semlf)))) -(ert-deftest fill-test-fill-paragraph-semlf-org-mode () - "Test the `fill-paragraph-semlf' function with `org-mode'." +(ert-deftest fill-test-semlf-org-mode () + "Test semantic-linefeed filling with `org-mode'." (ert-test-erts-file (ert-resource-file "semlf-org-mode.erts") (lambda () (org-mode) - (fill-paragraph-semlf)))) + (fill-tests--fill-paragraph-semlf)))) (declare-function markdown-mode "markdown-mode") -(ert-deftest fill-test-fill-paragraph-semlf-markdown-mode () - "Test the `fill-paragraph-semlf' function with `markdown-mode'." +(ert-deftest fill-test-semlf-markdown-mode () + "Test semantic-linefeed filling with `markdown-mode'." (skip-unless (functionp 'markdown-mode)) (ert-test-erts-file (ert-resource-file "semlf-markdown-mode.erts") (lambda () (markdown-mode) - (fill-paragraph-semlf)))) + (fill-tests--fill-paragraph-semlf)))) (provide 'fill-tests) -- 2.49.0 --=-=-=-- From debbugs-submit-bounces@debbugs.gnu.org Mon Jun 30 10:42:54 2025 Received: (at 78927) by debbugs.gnu.org; 30 Jun 2025 14:42:54 +0000 Received: from localhost ([127.0.0.1]:44998 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1uWFif-0007re-48 for submit@debbugs.gnu.org; Mon, 30 Jun 2025 10:42:54 -0400 Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:17245) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1uWFia-0007qQ-QZ for 78927@debbugs.gnu.org; Mon, 30 Jun 2025 10:42:50 -0400 Received: from pmg3.iro.umontreal.ca (localhost [127.0.0.1]) by pmg3.iro.umontreal.ca (Proxmox) with ESMTP id ADC23441AEC; Mon, 30 Jun 2025 10:42:42 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca; s=mail; t=1751294561; bh=WjBVWkafjww9XGNruq6dpevQ5nEap6QnvoN304u7yRk=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From; b=UvB0rw3Xwb1Azwo3TIQhfFOUC0cc/jwRY988sDRdobEfdpkE5+w2MFNG7bfSrUTj6 vMZxhjzcylxFTJzvy4dLdxVr3iEK6KQ1sRm7SYp8bjpArbMUzd8hhTDjKUd+I7f8j0 pxSp5x6PIbHEiJMHfKH234TfPc6iH2V/F5ElewmZcXRtvFV/BHiWJqj9bxJjOvauNS yD/Pp5DjFxHSWHeCMwv6N0Eak6xVKT0f5xpxZnuwisGk8T5Jl1XWLXrWZLc7VqPLAZ tdi5a5RXYZL5t8hDmwrEFRubm/TjGNRt2VaoRBs3ptMakP2H0UVWVDjCcxgpZo3Kdy N+mMT7RRlFNvQ== Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1]) by pmg3.iro.umontreal.ca (Proxmox) with ESMTP id 81DF2441ACB; Mon, 30 Jun 2025 10:42:41 -0400 (EDT) Received: from pastel (unknown [104.247.225.139]) by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id 566D812067A; Mon, 30 Jun 2025 10:42:41 -0400 (EDT) From: Stefan Monnier To: Roi Martin Subject: Re: bug#78927: [PATCH] Update `fill-region-as-paragraph-semlf' to follow fill.el protocols In-Reply-To: <875xgdeb96.fsf@gmail.com> Message-ID: References: <875xgdeb96.fsf@gmail.com> Date: Mon, 30 Jun 2025 10:42:34 -0400 User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: text/plain X-SPAM-INFO: Spam detection results: 0 ALL_TRUSTED -1 Passed through trusted hosts only via SMTP AWL -0.290 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% DKIM_SIGNED 0.1 Message has a DKIM or DK signature, not necessarily valid DKIM_VALID -0.1 Message has at least one valid DKIM or DK signature DKIM_VALID_AU -0.1 Message has a valid DKIM or DK signature from author's domain DKIM_VALID_EF -0.1 Message has a valid DKIM or DK signature from envelope-from domain X-SPAM-LEVEL: X-Spam-Score: -2.1 (--) X-Debbugs-Envelope-To: 78927 Cc: 78927@debbugs.gnu.org, eliz@gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.1 (---) > This patch updates the `fill-region-as-paragraph-semlf' function to > follow the `fill-region-as-paragraph-function' protocol. This allows to > delete the `fill-paragraph-semlf' function, which is replaced by > `fill-paragraph' combined with assigning > `fill-region-as-paragraph-semlf' to `fill-region-as-paragraph-function'. > > Stefan, I also took the opportunity to remove the `with-restriction' > call from `fill-region-as-paragraph-semlf', as discussed in: > > https://debbugs.gnu.org/cgi/bugreport.cgi?bug=78561#47 > > Given that `fill-paragraph-semlf' is not part of any stable release of > GNU Emacs, I guess it is fine to remove it. Is this a fair assumption? Thanks. This looks good to me. See minor comments below. Eli? Stefan > `fill-region-as-paragraph-function' protocol. This allows to delete the > `fill-paragraph-semlf' function, which is replaced by `fill-paragraph' [ I was taught that `allow` is a transitive verb so the above is apparently grammatically incorrect. You need "This allows *us* ...", "This allows deleting ...", or ... ] > Remove call to `with-restriction'. "Avoid narrowing"? > + (let ((fill-column (point-max))) > + (setq pfx (or (save-excursion > + (fill-region-as-paragraph-default (point) > + (marker-position to) > + nil > + nosqueeze > + squeeze-after)) > + ""))) > + (while (< (point) (marker-position to)) > + (let ((fill-prefix pfx)) > + (fill-region-as-paragraph-default (point) > + (min (marker-position to) > + (save-excursion > + (forward-sentence) > + (point))) > + justify > + t)) > + (when (and (> (point) (line-beginning-position)) > + (< (point) (line-end-position)) > + (< (point) (marker-position to))) > + (delete-horizontal-space) > + (insert "\n") > + (insert pfx))) > pfx)) I believe you can remove all the `marker-position` calls above since markers are automatically coerced to integers when needed. From debbugs-submit-bounces@debbugs.gnu.org Mon Jun 30 11:51:20 2025 Received: (at 78927) by debbugs.gnu.org; 30 Jun 2025 15:51:20 +0000 Received: from localhost ([127.0.0.1]:45863 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1uWGmu-0008TZ-1S for submit@debbugs.gnu.org; Mon, 30 Jun 2025 11:51:20 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:44196) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1uWGmq-0008Sq-Qj for 78927@debbugs.gnu.org; Mon, 30 Jun 2025 11:51:17 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1uWGmi-0002Qz-AG; Mon, 30 Jun 2025 11:51:11 -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=6XIvh7cFs01eELNSIRhLyxxUC29H3GmQrs+qAvv1Xks=; b=RZlD7WWwotQa WRbLTWYXZt2gSKeKGJpIX6QvyOQSwhKqlfahzLCswo+kAudgcw+u0ORtqOUwtbuYufdUZN46GWQtg pyAT2bdNdmZzuQZUPHN5YWkFblJrE8vKyfsMjferz4LuGNZu55h94idNpkuq1g0/HBx+xuejnR+I1 V/TyaigeWCZ0PaPvZLc14+rK70hbnHJbd2sbQTT/edOAQ7/2TRGjWHIJH54jn7ogOV/ghTC/h8T5+ WKXB44g4ujaggs2D5QpwF/GWPSSmnIRPfcu/rgnAIMPBbBPRprOl+8Ake96xn/o3Rl884Hj7HPLDE QeiAPAUzt07sySedhTI1YA==; Date: Mon, 30 Jun 2025 18:50:28 +0300 Message-Id: <861pr144aj.fsf@gnu.org> From: Eli Zaretskii To: Roi Martin In-Reply-To: <875xgdeb96.fsf@gmail.com> (message from Roi Martin on Mon, 30 Jun 2025 13:09:57 +0200) Subject: Re: bug#78927: [PATCH] Update `fill-region-as-paragraph-semlf' to follow fill.el protocols References: <875xgdeb96.fsf@gmail.com> X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 78927 Cc: 78927@debbugs.gnu.org, monnier@iro.umontreal.ca X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) > Cc: monnier@iro.umontreal.ca, eliz@gnu.org > From: Roi Martin > Date: Mon, 30 Jun 2025 13:09:57 +0200 > > This patch updates the `fill-region-as-paragraph-semlf' function to > follow the `fill-region-as-paragraph-function' protocol. This allows to > delete the `fill-paragraph-semlf' function, which is replaced by > `fill-paragraph' combined with assigning > `fill-region-as-paragraph-semlf' to `fill-region-as-paragraph-function'. fill-paragraph-semlf is a command. Removing it means that there will be no way for users to fill a paragraph interactively using semantic linefeeds. How much time will pass, do you think, before someone asks for such a command? The changes in this patch allow you to make fill-paragraph-semlf a very thin wrapper around fill-paragraph, but that is still many times more convenient than asking users to assign obscure values to obscure variables. So I suggest to leave the command, just reimplement it using fill-region-as-paragraph-function. From debbugs-submit-bounces@debbugs.gnu.org Mon Jun 30 11:52:14 2025 Received: (at 78927) by debbugs.gnu.org; 30 Jun 2025 15:52:14 +0000 Received: from localhost ([127.0.0.1]:45884 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1uWGnl-00007u-QN for submit@debbugs.gnu.org; Mon, 30 Jun 2025 11:52:14 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:44142) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1uWGnj-00007J-7P for 78927@debbugs.gnu.org; Mon, 30 Jun 2025 11:52:11 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1uWGnd-0002Y8-0d; Mon, 30 Jun 2025 11:52:05 -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=JUyafliPycm4kV5B6VY6UOckapbxbhO6xy5FcWqhxSU=; b=LEU3D9KzgpSX ICWRqQM8ZqGpl3pe7Daj8TqxQekNvQ5buTW97jgLpkJodNnEEEig21rYZrWkZJALdnxsFZHAPGRhG 6qh8Wud1RPX+rr6Qc7fGdgtqaG9guVoH6HF+HT0dGvPpYGzdI3RHabHWj+qqCL1Lluri5/1Cs6doo 2D9dViQp/G7b81ZzYvpaCCvYmFv2qAdZC7aGPhWpNaKkH5KobuNA7PFNADNImd1PS16KAZ0dJzuI6 f+X+RcQoe0j8kn2E4fx4/2zDS7Fa+wvCYBxqSWHY3RDa8djERfte4hhIa5Zn/t8+NV+KCq+bsGiXi biKNDVLVPBxCPyS2aVqSgQ==; Date: Mon, 30 Jun 2025 18:51:49 +0300 Message-Id: <86zfdp2pnu.fsf@gnu.org> From: Eli Zaretskii To: Stefan Monnier In-Reply-To: (message from Stefan Monnier on Mon, 30 Jun 2025 10:42:34 -0400) Subject: Re: bug#78927: [PATCH] Update `fill-region-as-paragraph-semlf' to follow fill.el protocols References: <875xgdeb96.fsf@gmail.com> X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 78927 Cc: 78927@debbugs.gnu.org, jroi.martin@gmail.com X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) > From: Stefan Monnier > Cc: 78927@debbugs.gnu.org, eliz@gnu.org > Date: Mon, 30 Jun 2025 10:42:34 -0400 > > > This patch updates the `fill-region-as-paragraph-semlf' function to > > follow the `fill-region-as-paragraph-function' protocol. This allows to > > delete the `fill-paragraph-semlf' function, which is replaced by > > `fill-paragraph' combined with assigning > > `fill-region-as-paragraph-semlf' to `fill-region-as-paragraph-function'. > > > > Stefan, I also took the opportunity to remove the `with-restriction' > > call from `fill-region-as-paragraph-semlf', as discussed in: > > > > https://debbugs.gnu.org/cgi/bugreport.cgi?bug=78561#47 > > > > Given that `fill-paragraph-semlf' is not part of any stable release of > > GNU Emacs, I guess it is fine to remove it. Is this a fair assumption? > > Thanks. This looks good to me. See minor comments below. > Eli? I'm okay with this, but I think we should not delete the command, see my other message. From debbugs-submit-bounces@debbugs.gnu.org Mon Jun 30 14:38:22 2025 Received: (at 78927) by debbugs.gnu.org; 30 Jun 2025 18:38:22 +0000 Received: from localhost ([127.0.0.1]:48131 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1uWJOV-0004Hl-65 for submit@debbugs.gnu.org; Mon, 30 Jun 2025 14:38:22 -0400 Received: from mail-wr1-x436.google.com ([2a00:1450:4864:20::436]:42057) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.84_2) (envelope-from ) id 1uWJOQ-0004GQ-DW for 78927@debbugs.gnu.org; Mon, 30 Jun 2025 14:38:17 -0400 Received: by mail-wr1-x436.google.com with SMTP id ffacd0b85a97d-3a4fd1ba177so3173697f8f.0 for <78927@debbugs.gnu.org>; Mon, 30 Jun 2025 11:38:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1751308688; x=1751913488; darn=debbugs.gnu.org; h=mime-version:message-id:date:references:in-reply-to:subject:cc:to :from:from:to:cc:subject:date:message-id:reply-to; bh=lkA4yz2NJHJjbgBVu/nhjkV5kp+RjxJ1Y0bX/K1amdE=; b=im2QEMa3Q8Y7JOUhXhcM149en082tOHdRRs0SnGBeWF3ba+O9mlfss5RKKs/1BZNcw f+jCZcmEBEmQrnETWQa+dGGKDwk74wFdqzlZPvPVk0zgHusOnL0hdN78o4s7GhRWsVOc BC8Nt/K/DQdT9//tvPWHNUpsBaq1a4jBwM5gHPhAu7nAQlnYLJNj2BsiByogqcJDVVQp C/oBK938lLP9t5JetTciUUAXLQOTdiCY91vwRF+jw0VoBHWszkrxQHLHI//XmzeZmuaE SSiGqznp5GxHADnWmUfqLT+hfXlT2TzQYXhZG06vOXuedLHDE/227CPMqmfeeOPIP8Or C33g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1751308688; x=1751913488; h=mime-version:message-id:date:references:in-reply-to:subject:cc:to :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=lkA4yz2NJHJjbgBVu/nhjkV5kp+RjxJ1Y0bX/K1amdE=; b=DGBjaSOCz5CsLA8dp7VVXYN5VJmVNAu5rhBqvlCe75IX+RuP3XE6ofe9upIIxjVPf/ pf1WvkIiIweO8rr8KofJr3gkAaLWDW8a5SiPvMK9som/AKxA9yF0WfHIdpJaQhfakY1x H+OceyRoTxsfEFmRsKH1zQacUG1EAgXaAEf18C9V/uBjUZFE06u4aCmqmG5ERxVQ/1DS V9WOYW306bUkjTaKLkPQFvq+PclSX6a8UZMpII3KgQB/SRDCD1uKgXkBspKqJBqK4N/w dHWMm3ogqGdIAkXPRgDsqgo7r2At3ROwWpg3AOs3j/y/rdTdc0gaL1hsOzHnKhEmTXyc NyvQ== X-Gm-Message-State: AOJu0Ywob+v//Fou97pFTf3NETHdsmsR03B9RkR9bRDBLy8MBimQ3k28 ZaAx/KIUgldWqB9N1vd2lV7XxsU/FtJH6pjwhFRfia8VVQ+Sb+SGhH1a X-Gm-Gg: ASbGnct+PsNhZjmM20mlYOUOGLtI00dGV755vvFeKzxyH2l/FYoyXh2TiaAbIdP8Vni eSXduXQHGqUZ5qEKKwyFDJTMtVelJ6BzOsd1qRd/q8kB0/N854KpVdM/RkZS/NL0N45ZPSAEtp7 EwE+xwThZmoSDObGuRMyVKFe7CO8CB5k64KN+aYRga4+AcTbIinFF/Mo0sdKhZh9an3iVyXeD+N 0yGvHMKedqu0uTLmHWRPyb16WtBQKbTcg+DsY3swuq2AjbqidoPNQUvTJiBEvF4IXzMPek87cWD MyOBs+wgw44gPyY88MRyxcAUpMNZ2ZCX9FlFCHdVtMUlES11cfjhXMuqOCjMA9RRoIIDbHI= X-Google-Smtp-Source: AGHT+IGopdLn0bROt0lqB/6QHr63XbILrXjGZfCFUM1GNpwu5KqHoiq205cMOtCxqYnKwY0kgBm6Zw== X-Received: by 2002:adf:9c91:0:b0:3a5:298a:3214 with SMTP id ffacd0b85a97d-3af0f33dd9fmr473308f8f.13.1751308687905; Mon, 30 Jun 2025 11:38:07 -0700 (PDT) Received: from localhost ([84.79.192.255]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-3a88c7fab7asm11068972f8f.24.2025.06.30.11.38.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 30 Jun 2025 11:38:07 -0700 (PDT) From: Roi Martin To: Eli Zaretskii , Stefan Monnier Subject: Re: bug#78927: [PATCH] Update `fill-region-as-paragraph-semlf' to follow fill.el protocols In-Reply-To: <86zfdp2pnu.fsf@gnu.org> References: <875xgdeb96.fsf@gmail.com> <86zfdp2pnu.fsf@gnu.org> Date: Mon, 30 Jun 2025 20:38:06 +0200 Message-ID: <871pr1dqi9.fsf@gmail.com> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 78927 Cc: 78927@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) --=-=-= Content-Type: text/plain Eli Zaretskii writes: >> Thanks. This looks good to me. See minor comments below. >> Eli? > > I'm okay with this, but I think we should not delete the command, see > my other message. I've attached a new version of the patch. It addresses Stefan's comments and reimplements the `fill-paragraph-semlf' function using `fill-paragraph' and `fill-region-as-paragraph-function'. Roi --=-=-= Content-Type: text/x-patch Content-Disposition: attachment; filename=0001-Update-fill-region-as-paragraph-semlf-to-follow-fill.patch >From 71f485ff7ad335b869186b26949230f57d0f5dd2 Mon Sep 17 00:00:00 2001 From: Roi Martin Date: Tue, 17 Jun 2025 19:21:18 +0200 Subject: [PATCH] Update `fill-region-as-paragraph-semlf' to follow fill.el protocols Update the `fill-region-as-paragraph-semlf' function to follow the `fill-region-as-paragraph-function' protocol. This allows us to reimplement the `fill-paragraph-semlf' function using `fill-paragraph' and `fill-region-as-paragraph-function'. * lisp/textmodes/fill.el (fill-region-as-paragraph-semlf): Make this function compatible with `fill-region-as-paragraph-function'. Avoid narrowing. (fill-paragraph-semlf): Reimplement using `fill-paragraph' and `fill-region-as-paragraph-function'. * test/lisp/textmodes/fill-tests.el (fill-test-semlf-fill-region): Add test. (fill-test-fill-paragraph-semlf-fill-paragraph-function): Remove test. (fill-test-fill-paragraph-semlf, fill-test-semlf) (fill-test-fill-paragraph-semlf-justify, fill-test-semlf-justify) (fill-test-fill-paragraph-semlf-sentence-end-double-space) (fill-test-semlf-sentence-end-double-space) (fill-test-fill-paragraph-semlf-fill-column, fill-test-semlf-fill-column) (fill-test-fill-paragraph-semlf-punctuation-marks) (fill-test-semlf-punctuation-marks, fill-test-fill-paragraph-semlf-twice) (fill-test-semlf-twice, fill-test-fill-paragraph-semlf-fill-prefix) (fill-test-semlf-fill-prefix) (fill-test-fill-paragraph-semlf-indented-block) (fill-test-semlf-indented-block, fill-test-fill-paragraph-semlf-revert) (fill-test-semlf-revert, fill-test-fill-paragraph-semlf-emacs-lisp-mode) (fill-test-semlf-emacs-lisp-mode, fill-test-fill-paragraph-semlf-c-mode) (fill-test-semlf-c-mode, fill-test-fill-paragraph-semlf-org-mode) (fill-test-semlf-org-mode, fill-test-fill-paragraph-semlf-markdown-mode) (fill-test-semlf-markdown-mode): User shorter function names consistent with erts file names. * test/lisp/textmodes/fill-resources/semlf-fill-region.erts: Add test data. * test/lisp/textmodes/fill-resources/semlf-fill-paragraph-function.erts: Delete file. * test/lisp/textmodes/fill-resources/semlf-emacs-lisp-mode.erts: Remove newlines around indented block. * doc/lispref/text.texi (Filling): Highlight that `fill-region-as-paragraph-function' changes the behavior of `fill-paragraph'. --- doc/lispref/text.texi | 9 +- lisp/textmodes/fill.el | 94 ++++++++----------- .../fill-resources/semlf-emacs-lisp-mode.erts | 8 +- .../semlf-fill-paragraph-function.erts | 12 --- .../fill-resources/semlf-fill-region.erts | 25 +++++ test/lisp/textmodes/fill-tests.el | 75 ++++++++------- 6 files changed, 115 insertions(+), 108 deletions(-) delete mode 100644 test/lisp/textmodes/fill-resources/semlf-fill-paragraph-function.erts create mode 100644 test/lisp/textmodes/fill-resources/semlf-fill-region.erts diff --git a/doc/lispref/text.texi b/doc/lispref/text.texi index fe3863db810d..b01df8512b72 100644 --- a/doc/lispref/text.texi +++ b/doc/lispref/text.texi @@ -1848,10 +1848,11 @@ Filling @defvar fill-region-as-paragraph-function This variable provides a way to override how functions like -@code{fill-region} fill text. Its value should be a function, which -should accept the arguments defined by @code{fill-region-as-paragraph} -and return the fill prefix used for filling. The default value of this -variable is @code{fill-region-as-paragraph-default}. +@code{fill-paragraph} and @code{fill-region} fill text. Its value +should be a function, which should accept the arguments defined by +@code{fill-region-as-paragraph} and return the fill prefix used for +filling. The default value of this variable is +@code{fill-region-as-paragraph-default}. @end defvar @defvar use-hard-newlines diff --git a/lisp/textmodes/fill.el b/lisp/textmodes/fill.el index bb10890141d6..4ab639497ec9 100644 --- a/lisp/textmodes/fill.el +++ b/lisp/textmodes/fill.el @@ -1641,77 +1641,63 @@ fill-region-as-paragraph-semlf Return the `fill-prefix' used for filling. -For more details about semantic linefeeds, see `fill-paragraph-semlf'." +This function can be assigned to `fill-region-as-paragraph-function' to +override how functions like `fill-paragraph' and `fill-region' fill +text. + +For more details about semantic linefeeds, see `https://sembr.org/' and +`https://rhodesmill.org/brandon/2012/one-sentence-per-line/'." (interactive (progn (barf-if-buffer-read-only) (list (region-beginning) (region-end) (if current-prefix-arg 'full)))) - (unless (memq justify '(t nil none full center left right)) - (setq justify 'full)) (let ((from (min from to)) - (to (max from to)) + (to (copy-marker (max from to) t)) pfx) (goto-char from) - (with-restriction (line-beginning-position) to - (let ((fill-column (point-max))) - (setq pfx (or (save-excursion - (fill-region-as-paragraph-default (point) - (point-max) - nil - nosqueeze - squeeze-after)) - ""))) - (while (not (eobp)) - (let ((fill-prefix pfx)) - (fill-region-as-paragraph-default (point) - (progn (forward-sentence) (point)) - justify - nosqueeze - squeeze-after)) - (when (and (> (point) (line-beginning-position)) - (< (point) (line-end-position))) - (delete-horizontal-space) - (insert "\n") - (insert pfx)))) - (unless (eobp) (forward-char 1)) + (let ((fill-column (point-max))) + (setq pfx (or (save-excursion + (fill-region-as-paragraph-default (point) + to + nil + nosqueeze + squeeze-after)) + ""))) + (while (< (point) to) + (let ((fill-prefix pfx)) + (fill-region-as-paragraph-default (point) + (min to + (save-excursion + (forward-sentence) + (point))) + justify + t)) + (when (and (> (point) (line-beginning-position)) + (< (point) (line-end-position)) + (< (point) to)) + (delete-horizontal-space) + (insert "\n") + (insert pfx))) pfx)) -(defun fill-paragraph-semlf (&optional justify) +(defun fill-paragraph-semlf (&optional justify region) "Fill paragraph at or after point using semantic linefeeds. -Refill text putting a newline character after each sentence, calling -`forward-sentence' to find the ends of sentences. If -`sentence-end-double-space' is non-nil, period followed by one space is -not the end of a sentence. +Refill text putting a newline character after each sentence. If JUSTIFY is non-nil (interactively, with prefix argument), justify as -well. The variable `fill-column' controls the width for filling. +well. The REGION argument is non-nil if called interactively; in that +case, if Transient Mark mode is enabled and the mark is active, fill the +active region. -Return the `fill-prefix' used for filling. - -You can use this function as the value of `fill-paragraph-function', so -`fill-paragraph' and other filling commands will use it. - -For more details about semantic linefeeds, see `https://sembr.org/' and -`https://rhodesmill.org/brandon/2012/one-sentence-per-line/'." +See `fill-paragraph' and `fill-region-as-paragraph-semlf' for more +details." (interactive (progn (barf-if-buffer-read-only) - (list (if current-prefix-arg 'full)))) - (unless (memq justify '(t nil none full center left right)) - (setq justify 'full)) + (list (if current-prefix-arg 'full) t))) - (save-excursion - (let ((to (progn - (fill-forward-paragraph 1) - (backward-word) - (end-of-line) - (point))) - (from (progn - (fill-forward-paragraph -1) - (forward-word) - (beginning-of-line) - (point)))) - (fill-region-as-paragraph-semlf from to justify)))) + (let ((fill-region-as-paragraph-function #'fill-region-as-paragraph-semlf)) + (fill-paragraph justify region))) ;;; fill.el ends here diff --git a/test/lisp/textmodes/fill-resources/semlf-emacs-lisp-mode.erts b/test/lisp/textmodes/fill-resources/semlf-emacs-lisp-mode.erts index fe71ee32c1aa..1623b0dcf8aa 100644 --- a/test/lisp/textmodes/fill-resources/semlf-emacs-lisp-mode.erts +++ b/test/lisp/textmodes/fill-resources/semlf-emacs-lisp-mode.erts @@ -59,12 +59,12 @@ the comment. ;; eiusmod tempor. Incididunt ut labore et dolore magna aliqua. Ut ;; enim ad minim veniam, quis nostrud exercitation ullamco laboris ;; nisi ut. - +;; ;; |Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed ;; do eiusmod tempor. Incididunt ut labore et dolore magna ;; aliqua. Ut enim ad minim veniam, quis nostrud exercitation ;; ullamco laboris nisi ut. - +;; ;; Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do ;; eiusmod tempor. Incididunt ut labore et dolore magna aliqua. Ut ;; enim ad minim veniam, quis nostrud exercitation ullamco laboris @@ -74,12 +74,12 @@ the comment. ;; eiusmod tempor. Incididunt ut labore et dolore magna aliqua. Ut ;; enim ad minim veniam, quis nostrud exercitation ullamco laboris ;; nisi ut. - +;; ;; Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed ;; do eiusmod tempor. ;; Incididunt ut labore et dolore magna aliqua. Ut enim ad minim ;; veniam, quis nostrud exercitation ullamco laboris nisi ut. - +;; ;; Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do ;; eiusmod tempor. Incididunt ut labore et dolore magna aliqua. Ut ;; enim ad minim veniam, quis nostrud exercitation ullamco laboris diff --git a/test/lisp/textmodes/fill-resources/semlf-fill-paragraph-function.erts b/test/lisp/textmodes/fill-resources/semlf-fill-paragraph-function.erts deleted file mode 100644 index 467e7401cf50..000000000000 --- a/test/lisp/textmodes/fill-resources/semlf-fill-paragraph-function.erts +++ /dev/null @@ -1,12 +0,0 @@ -Name: fill-paragraph-function - -=-= -Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do -eiusmod tempor. Incididunt ut labore et dolore magna aliqua. Ut enim -ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut. -=-= -Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do -eiusmod tempor. -Incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, -quis nostrud exercitation ullamco laboris nisi ut. -=-=-= diff --git a/test/lisp/textmodes/fill-resources/semlf-fill-region.erts b/test/lisp/textmodes/fill-resources/semlf-fill-region.erts new file mode 100644 index 000000000000..231019a082a4 --- /dev/null +++ b/test/lisp/textmodes/fill-resources/semlf-fill-region.erts @@ -0,0 +1,25 @@ +Point-Char: | + +Name: fill-region-as-paragraph-function + +=-= +Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor. Incididunt ut labore et dolore magna aliqua. + +|Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor. Incididunt ut labore et dolore magna aliqua. + +Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor. Incididunt ut labore et dolore magna aliqua. + +Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor. Incididunt ut labore et dolore magna aliqua. +=-= +Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor. Incididunt ut labore et dolore magna aliqua. + +Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do +eiusmod tempor. +Incididunt ut labore et dolore magna aliqua. + +Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do +eiusmod tempor. +Incididunt ut labore et dolore magna aliqua. + +Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor. Incididunt ut labore et dolore magna aliqua. +=-=-= diff --git a/test/lisp/textmodes/fill-tests.el b/test/lisp/textmodes/fill-tests.el index 310d374a7adb..e1839fd6884f 100644 --- a/test/lisp/textmodes/fill-tests.el +++ b/test/lisp/textmodes/fill-tests.el @@ -147,47 +147,54 @@ fill-test-fill-region-as-paragraph-semlf (beginning-of-line) (point)))))) -(ert-deftest fill-test-fill-paragraph-semlf () - "Test the `fill-paragraph-semlf' function." - (ert-test-erts-file (ert-resource-file "semlf.erts") +(ert-deftest fill-test-semlf-fill-region () + "Test `fill-region' with `fill-region-as-paragraph-semlf'." + (ert-test-erts-file (ert-resource-file "semlf-fill-region.erts") (lambda () - (fill-paragraph-semlf)))) + (setq-local fill-region-as-paragraph-function + #'fill-region-as-paragraph-semlf) + (fill-region + (point) + (progn + (goto-char (point-max)) + (forward-line -1) + (beginning-of-line) + (point)))))) -(ert-deftest fill-test-fill-paragraph-semlf-fill-paragraph-function () - "Test `fill-paragraph-semlf' as `fill-paragraph-function'." - (ert-test-erts-file (ert-resource-file "semlf-fill-paragraph-function.erts") +(ert-deftest fill-test-semlf () + "Test semantic-linefeed filling." + (ert-test-erts-file (ert-resource-file "semlf.erts") (lambda () - (setq-local fill-paragraph-function #'fill-paragraph-semlf) - (fill-paragraph)))) + (fill-paragraph-semlf)))) -(ert-deftest fill-test-fill-paragraph-semlf-justify () - "Test the JUSTIFY parameter of the `fill-paragraph-semlf' function." +(ert-deftest fill-test-semlf-justify () + "Test semantic-linefeed filling with text justification." (ert-test-erts-file (ert-resource-file "semlf-justify.erts") (lambda () (fill-paragraph-semlf 'justify)))) -(ert-deftest fill-test-fill-paragraph-semlf-sentence-end-double-space () - "Test the `fill-paragraph-semlf' function with `sentence-end-double-space'." +(ert-deftest fill-test-semlf-sentence-end-double-space () + "Test semantic-linefeed filling with `sentence-end-double-space'." (ert-test-erts-file (ert-resource-file "semlf-sentence-end-double-space.erts") (lambda () (setq-local sentence-end-double-space nil) (fill-paragraph-semlf)))) -(ert-deftest fill-test-fill-paragraph-semlf-fill-column () - "Test the `fill-paragraph-semlf' function with `fill-column'." +(ert-deftest fill-test-semlf-fill-column () + "Test semantic-linefeed filling with `fill-column'." (ert-test-erts-file (ert-resource-file "semlf-fill-column.erts") (lambda () (setq-local fill-column 35) (fill-paragraph-semlf)))) -(ert-deftest fill-test-fill-paragraph-semlf-punctuation-marks () - "Test the `fill-paragraph-semlf' function with different punctuation marks." +(ert-deftest fill-test-semlf-punctuation-marks () + "Test semantic-linefeed filling with different punctuation marks." (ert-test-erts-file (ert-resource-file "semlf-punctuation-marks.erts") (lambda () (fill-paragraph-semlf)))) -(ert-deftest fill-test-fill-paragraph-semlf-twice () - "Test to run the `fill-paragraph-semlf' function twice." +(ert-deftest fill-test-semlf-twice () + "Test filling the same text twice using semantic linefeeds." (ert-test-erts-file (ert-resource-file "semlf-twice.erts") (lambda () (goto-char (point-min)) @@ -195,50 +202,50 @@ fill-test-fill-paragraph-semlf-twice (goto-char (point-min)) (fill-paragraph-semlf)))) -(ert-deftest fill-test-fill-paragraph-semlf-fill-prefix () - "Test the `fill-paragraph-semlf' function with different fill prefixes." +(ert-deftest fill-test-semlf-fill-prefix () + "Test semantic-linefeed filling with different fill prefixes." (ert-test-erts-file (ert-resource-file "semlf-fill-prefix.erts") (lambda () (fill-paragraph-semlf)))) -(ert-deftest fill-test-fill-paragraph-semlf-indented-block () - "Test the `fill-paragraph-semlf' function with an indented block." +(ert-deftest fill-test-semlf-indented-block () + "Test semantic-linefeed filling with an indented block." (ert-test-erts-file (ert-resource-file "semlf-indented-block.erts") (lambda () (fill-paragraph-semlf)))) -(ert-deftest fill-test-fill-paragraph-semlf-revert () - "Test that the `fill-paragraph-semlf' function can be reverted." +(ert-deftest fill-test-semlf-revert () + "Test that semantic-linefeed filling can be reverted." (ert-test-erts-file (ert-resource-file "semlf-revert.erts") (lambda () (fill-paragraph) - (fill-paragraph-semlf) + (fill-paragraph-semlf) (fill-paragraph)))) -(ert-deftest fill-test-fill-paragraph-semlf-emacs-lisp-mode () - "Test the `fill-paragraph-semlf' function with `emacs-lisp-mode'." +(ert-deftest fill-test-semlf-emacs-lisp-mode () + "Test semantic-linefeed filling with `emacs-lisp-mode'." (ert-test-erts-file (ert-resource-file "semlf-emacs-lisp-mode.erts") (lambda () (emacs-lisp-mode) (fill-paragraph-semlf)))) -(ert-deftest fill-test-fill-paragraph-semlf-c-mode () - "Test the `fill-paragraph-semlf' function with `c-mode'." +(ert-deftest fill-test-semlf-c-mode () + "Test semantic-linefeed filling with `c-mode'." (ert-test-erts-file (ert-resource-file "semlf-c-mode.erts") (lambda () (c-mode) (fill-paragraph-semlf)))) -(ert-deftest fill-test-fill-paragraph-semlf-org-mode () - "Test the `fill-paragraph-semlf' function with `org-mode'." +(ert-deftest fill-test-semlf-org-mode () + "Test semantic-linefeed filling with `org-mode'." (ert-test-erts-file (ert-resource-file "semlf-org-mode.erts") (lambda () (org-mode) (fill-paragraph-semlf)))) (declare-function markdown-mode "markdown-mode") -(ert-deftest fill-test-fill-paragraph-semlf-markdown-mode () - "Test the `fill-paragraph-semlf' function with `markdown-mode'." +(ert-deftest fill-test-semlf-markdown-mode () + "Test semantic-linefeed filling with `markdown-mode'." (skip-unless (functionp 'markdown-mode)) (ert-test-erts-file (ert-resource-file "semlf-markdown-mode.erts") (lambda () -- 2.49.0 --=-=-=-- From debbugs-submit-bounces@debbugs.gnu.org Mon Jun 30 17:34:21 2025 Received: (at 78927-done) by debbugs.gnu.org; 30 Jun 2025 21:34:21 +0000 Received: from localhost ([127.0.0.1]:50540 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1uWM8q-0002lD-P1 for submit@debbugs.gnu.org; Mon, 30 Jun 2025 17:34:21 -0400 Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:62777) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1uWM8o-0002kE-3T for 78927-done@debbugs.gnu.org; Mon, 30 Jun 2025 17:34:18 -0400 Received: from pmg1.iro.umontreal.ca (localhost.localdomain [127.0.0.1]) by pmg1.iro.umontreal.ca (Proxmox) with ESMTP id 1CCB0100374; Mon, 30 Jun 2025 17:34:12 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca; s=mail; t=1751319247; bh=1NBClYza/0xVYrKX/WJKKUAl/0Gv0WoLZJcc6cAw1zQ=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From; b=TmDWzpuK0HL7eCxWOVghamkbOETfM9S4cEov09D4lHLidxkrbixniA9cohlt55VHU Uk8YC9Ue7c//6WjY9VwLTKXWbBfC8cVLa/m2MUJscw4X6wy8gqcA9fVzorn9plYyEp TsHRRyI9kxXuRxBtjnr54sPqFnYaV/Xl7vGaRwbOATWi1O4PNqjHOLKzBn5SWSrA2k oxl663BfCA2HTXJ11zbptsaVaORaqKyj13NAw0dOYjifdEwKMgpZEPggPwPg95TBYd vGv97LX9yn5cow0AQaW4mnKJ8OMgPX5AMpAguOtVrtTIom2Ej+LM40D/aKrDuITgSD 3FUQAAmSuMa0Q== Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1]) by pmg1.iro.umontreal.ca (Proxmox) with ESMTP id 01DB410002E; Mon, 30 Jun 2025 17:34:06 -0400 (EDT) Received: from lechazo (lechon.iro.umontreal.ca [132.204.27.242]) by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id E0FB71204B4; Mon, 30 Jun 2025 17:34:06 -0400 (EDT) From: Stefan Monnier To: Roi Martin Subject: Re: bug#78927: [PATCH] Update `fill-region-as-paragraph-semlf' to follow fill.el protocols In-Reply-To: <871pr1dqi9.fsf@gmail.com> Message-ID: References: <875xgdeb96.fsf@gmail.com> <86zfdp2pnu.fsf@gnu.org> <871pr1dqi9.fsf@gmail.com> Date: Mon, 30 Jun 2025 17:34:06 -0400 User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: text/plain X-SPAM-INFO: Spam detection results: 0 ALL_TRUSTED -1 Passed through trusted hosts only via SMTP AWL 0.096 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% DKIM_SIGNED 0.1 Message has a DKIM or DK signature, not necessarily valid DKIM_VALID -0.1 Message has at least one valid DKIM or DK signature DKIM_VALID_AU -0.1 Message has a valid DKIM or DK signature from author's domain DKIM_VALID_EF -0.1 Message has a valid DKIM or DK signature from envelope-from domain X-SPAM-LEVEL: X-Spam-Score: -2.1 (--) X-Debbugs-Envelope-To: 78927-done Cc: 78927-done@debbugs.gnu.org, Eli Zaretskii X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.1 (---) > I've attached a new version of the patch. It addresses Stefan's > comments and reimplements the `fill-paragraph-semlf' function using > `fill-paragraph' and `fill-region-as-paragraph-function'. Thanks, pushed, Stefan From debbugs-submit-bounces@debbugs.gnu.org Tue Jul 01 03:05:04 2025 Received: (at 78927) by debbugs.gnu.org; 1 Jul 2025 07:05:05 +0000 Received: from localhost ([127.0.0.1]:54237 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1uWV39-0004E4-4O for submit@debbugs.gnu.org; Tue, 01 Jul 2025 03:05:04 -0400 Received: from relay6-d.mail.gandi.net ([217.70.183.198]:39203) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1uWV35-0004CV-NY for 78927@debbugs.gnu.org; Tue, 01 Jul 2025 03:05:00 -0400 Received: by mail.gandi.net (Postfix) with ESMTPSA id 6E333442C3; Tue, 1 Jul 2025 07:04:50 +0000 (UTC) From: Juri Linkov To: Roi Martin Subject: Re: bug#78927: [PATCH] Update `fill-region-as-paragraph-semlf' to follow fill.el protocols In-Reply-To: <875xgdeb96.fsf@gmail.com> Organization: LINKOV.NET References: <875xgdeb96.fsf@gmail.com> Date: Tue, 01 Jul 2025 09:57:07 +0300 Message-ID: <8734bg5r6c.fsf@mail.linkov.net> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/31.0.50 (x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain X-GND-State: clean X-GND-Score: -100 X-GND-Cause: gggruggvucftvghtrhhoucdtuddrgeeffedrtdefgddufeelfecutefuodetggdotefrodftvfcurfhrohhfihhlvgemucfitefpfffkpdcuggftfghnshhusghstghrihgsvgenuceurghilhhouhhtmecufedtudenucesvcftvggtihhpihgvnhhtshculddquddttddmnecujfgurhephffvvefujghofhffkfgfgggtsehttdertddtredtnecuhfhrohhmpefluhhrihcunfhinhhkohhvuceojhhurhhisehlihhnkhhovhdrnhgvtheqnecuggftrfgrthhtvghrnhepffegteefveelhfeljeefueehieduiedtfffhuddtkeeffffghfevheetgeeukeehnecukfhppeeluddruddvledruddttddrjeejnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehinhgvthepledurdduvdelrddutddtrdejjedphhgvlhhopehmrghilhdrghgrnhguihdrnhgvthdpmhgrihhlfhhrohhmpehjuhhriheslhhinhhkohhvrdhnvghtpdhnsggprhgtphhtthhopeegpdhrtghpthhtohepvghlihiisehgnhhurdhorhhgpdhrtghpthhtohepmhhonhhnihgvrhesihhrohdruhhmohhnthhrvggrlhdrtggrpdhrtghpthhtohepjeekledvjeesuggvsggsuhhgshdrghhnuhdrohhrghdprhgtphhtthhopehjrhhoihdrmhgrrhhtihhnsehgmhgrihhlrdgtohhm X-GND-Sasl: juri@linkov.net X-Spam-Score: -0.5 (/) X-Debbugs-Envelope-To: 78927 Cc: 78927@debbugs.gnu.org, eliz@gnu.org, monnier@iro.umontreal.ca X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.5 (-) > Given that `fill-paragraph-semlf' is not part of any stable release of > GNU Emacs, I guess it is fine to remove it. Is this a fair assumption? Thanks, now I tried to change this setting in .dir-locals.el: (fill-paragraph-function . fill-paragraph-semlf) to (fill-region-as-paragraph-function . fill-region-as-paragraph-semlf) and everything works nicely with the default keybinding 'M-q'. Shouldn't this way of enabling the new feature be mentioned in etc/NEWS? From debbugs-submit-bounces@debbugs.gnu.org Tue Jul 01 04:44:28 2025 Received: (at 78927) by debbugs.gnu.org; 1 Jul 2025 08:44:29 +0000 Received: from localhost ([127.0.0.1]:54817 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1uWWbM-0002RT-FV for submit@debbugs.gnu.org; Tue, 01 Jul 2025 04:44:28 -0400 Received: from mail-wm1-x32e.google.com ([2a00:1450:4864:20::32e]:49520) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.84_2) (envelope-from ) id 1uWWbJ-0002Q9-U3 for 78927@debbugs.gnu.org; Tue, 01 Jul 2025 04:44:27 -0400 Received: by mail-wm1-x32e.google.com with SMTP id 5b1f17b1804b1-451d54214adso37157815e9.3 for <78927@debbugs.gnu.org>; Tue, 01 Jul 2025 01:44:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1751359460; x=1751964260; darn=debbugs.gnu.org; h=mime-version:message-id:date:references:in-reply-to:subject:cc:to :from:from:to:cc:subject:date:message-id:reply-to; bh=Kl65iO9IZFglhzv1TqLZc8aswo9WPTJ0l94TQajWuGo=; b=M6SnU16IKKj9hnACZuB0Ox8D1GBNbz6AMi2qVoYF+Tyu6lLceI+gKcF+UVPj5ZDw7q xyUiAgM50dDNSM+Z/Zo9rnQorFGPQ8z6ju72pCoabYY7DYKoPlU7hTLdBpJYS0F9JYC0 T+NiBGS+GTwWObJFsalB98s441DTX0/vv6MZn+h/+9oA5RcCiyGtszu5zjh4FHQyzZjk A0kzdyxZNsva+GqlNEnxDoPZdZi67tFmukZEWO8+8lsyVxptgUX0XmLaNf3yVkAJ18g8 g4s/ovg7dQa6x1z57DvxO9WCSxxFTqJsBAPdq6dDlV3oaULVwVBAeYJ3tq0AgcWSWvRn 7P1g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1751359460; x=1751964260; h=mime-version:message-id:date:references:in-reply-to:subject:cc:to :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=Kl65iO9IZFglhzv1TqLZc8aswo9WPTJ0l94TQajWuGo=; b=rDn/rRWvJyIOdgz54HlebqoYp1/rW71rZboDbujvTDIeXfm0yUpHSaO37VAZXMuU7c 0kIVM9kHBtJPAhaxGSjqtZs4PBFXW/UgJeOTa+6cBwi9NImm3/TJ/BqFiY+p68HkVKK6 aWwv91z/YdlWZ7pPlc1VN8dkndTLPe2Su7TmGh5BMx7hW6eLKrCXm5WH7nz9tH/dost/ S3X+BgbDYQAeT9jCbeDbNexgZxAmwjgT5EZfD19zHnzKqiQF7qSo1lzxm8fKcI0ZWAjj xXbo71C/rLLmqsolgUoNnU5nouVamfPLhgGZc2jqMhBlXfMOUweIYUo/sCo47ZdUbby6 Gx4g== X-Gm-Message-State: AOJu0YxozEVGc7cO7ZgspJpy+/Sbogal1ljQEeZ6si2LsCIy7/32LONE qK52+UK/JE5a26OccGqUdbOcyCwReuHrdBpsdEYLlXrHXmvJ4/PEyUTR X-Gm-Gg: ASbGncvDW5GZjQq2/DEBRY16cGsju/+TQwCZv7m+Gqr9952cp8OSwz9Z/GoG0w4iR7b gA1cLb0nKHksAnPKNRTZqd59p+VG8wGf8OjPuNma6PccMF5SYsXc0jfMH+i6vWVR73zS9ds/GNV IMdFbnSlJxMsnwg7hQrsfS2mXUoFgaSkqyreiWMNFtAcAmJ1xsngT3ERBkRk3KnHO7EmerILVLW nsZ0J0c2i7M2F9+lJxxqNZs9fXpOXEHnem/Y9DvU7s9yWZLBHUzNvTzvM56HRMm4pHztGqgjC0a KzkcZY9dB/8h/E3G0VVY7Q8UhmwwRSwjgsmwz+AZuWarazgAOdWlVPBMfcXP X-Google-Smtp-Source: AGHT+IEhbPlI+DTxcGugMGiX8sRyNe7b4oPAdR6zHHcMXxfGTYpSku5nzALT5bCZ2Bq7DqF+Ox9/7w== X-Received: by 2002:a05:600c:4f95:b0:453:23fe:ca86 with SMTP id 5b1f17b1804b1-4538ee50438mr173071435e9.4.1751359455936; Tue, 01 Jul 2025 01:44:15 -0700 (PDT) Received: from localhost ([84.79.192.255]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-453a85b3016sm12728685e9.0.2025.07.01.01.44.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 01 Jul 2025 01:44:15 -0700 (PDT) From: Roi Martin To: Juri Linkov Subject: Re: bug#78927: [PATCH] Update `fill-region-as-paragraph-semlf' to follow fill.el protocols In-Reply-To: <8734bg5r6c.fsf@mail.linkov.net> References: <875xgdeb96.fsf@gmail.com> <8734bg5r6c.fsf@mail.linkov.net> Date: Tue, 01 Jul 2025 10:44:11 +0200 Message-ID: <87ikkcwbac.fsf@gmail.com> MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 78927 Cc: 78927@debbugs.gnu.org, eliz@gnu.org, monnier@iro.umontreal.ca X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) Juri Linkov writes: > Thanks, now I tried to change this setting in .dir-locals.el: > > (fill-paragraph-function . fill-paragraph-semlf) > > to > > (fill-region-as-paragraph-function . fill-region-as-paragraph-semlf) > > and everything works nicely with the default keybinding 'M-q'. I'm glad to hear that! > Shouldn't this way of enabling the new feature be mentioned in etc/NEWS? I think so. I plan to send a new patch that updates the etc/NEWS file and also adds a small section about semantic-linefeed filling to the GNU Emacs manual. Something similar to what is described here: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=78561#5 But also explaining how to do it in Emacs. That will allow us to use the manual as reference in the doc strings of the semlf functions. Roi From debbugs-submit-bounces@debbugs.gnu.org Thu Jul 03 02:52:11 2025 Received: (at 78927) by debbugs.gnu.org; 3 Jul 2025 06:52:11 +0000 Received: from localhost ([127.0.0.1]:42188 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1uXDnl-0004Wh-OY for submit@debbugs.gnu.org; Thu, 03 Jul 2025 02:52:10 -0400 Received: from mail-wm1-x332.google.com ([2a00:1450:4864:20::332]:58706) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.84_2) (envelope-from ) id 1uXDnj-0004VQ-4D for 78927@debbugs.gnu.org; Thu, 03 Jul 2025 02:52:07 -0400 Received: by mail-wm1-x332.google.com with SMTP id 5b1f17b1804b1-451d6ade159so37023665e9.1 for <78927@debbugs.gnu.org>; Wed, 02 Jul 2025 23:52:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1751525520; x=1752130320; darn=debbugs.gnu.org; h=mime-version:message-id:date:references:in-reply-to:subject:cc:to :from:from:to:cc:subject:date:message-id:reply-to; bh=kFwd/wWLYfpUEUj9XKej7UA7pTQA3F8u4ZN24v3YsBw=; b=SUOc+4MnYrfD6SUub7/t8V36eupNO0R+DDVo/53ll2cUK+QNitD5507syq3lqHA989 Bo4ccnvPd2o274luMTOVu27OBHIWAfZGgZubXf0HyhU7KC66YIj+tIL5bMl0hzVsCw3H fqrYxaWlEk6q5L3Xbxj+LD5YV3kiXb6rXlZlZzeaHqAPeOAiMdBzL89twPq2wSDpBcH0 BQgv3lNuUQRr73n0Gkh2rBAJ+gb2wBlVANhwlcFUVbfR0ZuTzf+glrKExtTHH34F7MiZ 1Z3Nh+P8v88bha0i4qBg+MCtkJceix2k7RjKIDbqAVJ85VT1jqV/Esc6EpcfNAWNko9p 0zfg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1751525520; x=1752130320; h=mime-version:message-id:date:references:in-reply-to:subject:cc:to :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=kFwd/wWLYfpUEUj9XKej7UA7pTQA3F8u4ZN24v3YsBw=; b=sNLA95/we08VA5Z6dRq8oln1nvXvcpvvWJvx1xIAP4Chz5PXzZEfXPtIgBN8/1UU5W Q4nb4gybQGoFaC1pLnoeeYwsqGBOnwrDmJ3npzp9aEzAps9iaQfgZwCrHB2fJMpq5anr U1rL85KN+qZDtJSXISlvLPUxE0EWWQIbIMxuuF9NLiADvmaxJbXF8dDz1NhipikqDJvc Cpyo4OBXOW50LVZ9eik4jIJfZPQJ6b737zT4gIW/RXmABkiwGAqDn0H1okuCJe+N4IIZ H7U9/rtj1afaw5cJskxZY5uvWEXS0hAteACQoJ7qCL53ERsQrwrEfm4ur+6SmTrHZMkB sLGQ== X-Gm-Message-State: AOJu0YwOulvCQQOJmWBdybP8E7DnQ/fp6vfmTHSgZiMWz8kumF7YZ/d9 MUhmGbjYRP8GAYoYl7vQjGKjdhI8FE5ZjLZzQOafvrZ3IYc5lto1QATy X-Gm-Gg: ASbGncvKrJNqzTc48OBlcf+gPmFOBt5F5hl98/dysB3J3aYp3pLHWWjuxEajDESaovN 9y96FCHA/6T3SM1AyWim+Tg4Kf5LcbCS4lIY3egYbEPmsT9csEdLijz5XRM0RsuB8h6MC5Bs/r/ Z1jV/w3ymMTZmrbAp0sjI4uzc9wgrSBUl65rKnpzo5v6GcnsGe8XdCkPEaWWxdVsHYKGZLjFZnm v8On31RX0BOi0e7PLdCvWP0sI6AX3PT7xIrWLCH54Heq0ib7bNih6KYPgEjtj3UXUkzQRCVaXZf go3ZX4W8a4trDov5XY9E2ke1WkQSiC1ovFLRBkzrkKUihpHHpytKEboKn5wU X-Google-Smtp-Source: AGHT+IGOMV5sFkpsnu6gctHopYjy5j9pZ/m8bhEUMbk6JbOMi2zLWG19KpNapPzckQ/5T9HW6iuKWQ== X-Received: by 2002:a05:600c:c172:b0:442:e03b:589d with SMTP id 5b1f17b1804b1-454a37262cbmr58327725e9.24.1751525519888; Wed, 02 Jul 2025 23:51:59 -0700 (PDT) Received: from localhost ([84.79.192.255]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-454a9969a20sm17636165e9.1.2025.07.02.23.51.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 02 Jul 2025 23:51:59 -0700 (PDT) From: Roi Martin To: Juri Linkov Subject: Re: bug#78927: [PATCH] Update `fill-region-as-paragraph-semlf' to follow fill.el protocols In-Reply-To: <87ikkcwbac.fsf@gmail.com> References: <875xgdeb96.fsf@gmail.com> <8734bg5r6c.fsf@mail.linkov.net> <87ikkcwbac.fsf@gmail.com> Date: Thu, 03 Jul 2025 08:51:58 +0200 Message-ID: <878ql5wyup.fsf@gmail.com> MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 78927 Cc: 78927@debbugs.gnu.org, eliz@gnu.org, monnier@iro.umontreal.ca X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) Roi Martin writes: >> Shouldn't this way of enabling the new feature be mentioned in etc/NEWS? > > I think so. I plan to send a new patch that updates the etc/NEWS file > and also adds a small section about semantic-linefeed filling to the GNU > Emacs manual. For now I created Bug#78949 that updates etc/NEWS. Roi From unknown Sat Aug 09 15:53:01 2025 Received: (at fakecontrol) by fakecontrolmessage; To: internal_control@debbugs.gnu.org From: Debbugs Internal Request Subject: Internal Control Message-Id: bug archived. Date: Thu, 31 Jul 2025 11:24:06 +0000 User-Agent: Fakemail v42.6.9 # This is a fake control message. # # The action: # bug archived. thanks # This fakemail brought to you by your local debbugs # administrator