emacs-bug-tracker
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#68185: closed ([PATCH] Ensure indent-region argument order is correc


From: GNU bug Tracking System
Subject: bug#68185: closed ([PATCH] Ensure indent-region argument order is correct)
Date: Thu, 04 Jan 2024 11:19:02 +0000

Your message dated Thu, 04 Jan 2024 13:18:16 +0200
with message-id <83zfxlwdmv.fsf@gnu.org>
and subject line Re: bug#68185: [PATCH] Ensure indent-region argument order is 
correct
has caused the debbugs.gnu.org bug report #68185,
regarding [PATCH] Ensure indent-region argument order is correct
to be marked as done.

(If you believe you have received this mail in error, please contact
help-debbugs@gnu.org.)


-- 
68185: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=68185
GNU Bug Tracking System
Contact help-debbugs@gnu.org with problems
--- Begin Message --- Subject: [PATCH] Ensure indent-region argument order is correct Date: Sun, 31 Dec 2023 21:20:11 +0000 User-agent: Gnus/5.13 (Gnus v5.13)
Tags: patch

The attached patch fixes an issue with Tempo template insertion, where
the region start is assumed to be a position before the region end.  If
the user selects a region in a backwards direction the correct
indentation will not be applied:

  (require 'tempo)
  (tempo-define-template "indent-region-test" '(r>))

  (with-temp-buffer
    (emacs-lisp-mode)
    (insert "    one\n    two\n    three")
    (goto-char (point-min))
    (set-mark-command nil)
    (goto-char (point-max))
    (tempo-template-indent-region-test)
    (buffer-string))

  ;; => "one\ntwo\nthree"

  (with-temp-buffer
    (emacs-lisp-mode)
    (insert "    one\n    two\n    three")
    (goto-char (point-max))
    (set-mark-command nil)
    (goto-char (point-min))
    (tempo-template-indent-region-test)
    (buffer-string))

  ;; => "    one\n    two\nthree"

The start and end positions are already identified and stored using
separate variables, so the patch just uses these values instead of
assuming the point and mark order.  I've also removed passing nil as the
third argument since the argument is optional.

In GNU Emacs 29.1 (build 1, x86_64-pc-linux-gnu, X toolkit, cairo
 version 1.16.0, Xaw3d scroll bars) of 2023-07-31 built on inspiron
Windowing system distributor 'The X.Org Foundation', version 11.0.12101007
System Description: Debian GNU/Linux 12 (bookworm)

Configured using:
 'configure --with-native-compilation --with-cairo --with-json
 --with-xml2 --with-x-toolkit=lucid'

Attachment: 0001-Ensure-indent-region-argument-order-is-correct.patch
Description: Text Data


--- End Message ---
--- Begin Message --- Subject: Re: bug#68185: [PATCH] Ensure indent-region argument order is correct Date: Thu, 04 Jan 2024 13:18:16 +0200
> From: Morgan Willcock <morgan@ice9.digital>
> Date: Sun, 31 Dec 2023 21:20:11 +0000
> 
> The attached patch fixes an issue with Tempo template insertion, where
> the region start is assumed to be a position before the region end.  If
> the user selects a region in a backwards direction the correct
> indentation will not be applied:

Thanks, installed on the master branch, and closing the bug.


--- End Message ---

reply via email to

[Prev in Thread] Current Thread [Next in Thread]