From: Lars Ingebrigtsen <larsi@gnus.org>
To: Josh <josh+gnu@nispio.net>
Cc: 23339@debbugs.gnu.org
Subject: bug#23339: 24.5; align-region assumes that match does not contain newline
Date: Wed, 02 Dec 2020 13:19:47 +0100 [thread overview]
Message-ID: <87zh2w1jto.fsf@gnus.org> (raw)
In-Reply-To: <CADe+TV=Kd8EuyagNXLpkxtMapusNAjA+6AakO5PxQwpY58SMqw@mail.gmail.com> (Josh's message of "Thu, 21 Apr 2016 23:20:19 -0700")
[-- Attachment #1: Type: text/plain, Size: 1188 bytes --]
Josh <josh+gnu@nispio.net> writes:
> The align-region function assumes that a matching regexp does not
> contain a newline. This causes unexpected behavior in cases where the
> first "column" being aligned contains only whitespace. The following
> script exhibits the unexpected behavior:
>
> emacs -Q --eval '(progn
> (switch-to-buffer "*test*")
> (text-mode)
> (setq indent-tabs-mode nil)
> (insert "lorem ipsum, dolor sit amet,\n ,,\n")
> (let ((table (make-syntax-table (syntax-table))))
> ;; (modify-syntax-entry ?\n ">" table) ; <= UNCOMMENT THIS LINE TO FIX
> (with-syntax-table table
> (align-regexp (point-min) (point-max) "\\(\\s-*\\)," 1 1 t))))'
>
> Uncommenting the seventh line and running again will show the expected
> behavior. The fix works around the problem by using a syntax map in
> which the newline character does not belong to the whitespace syntax
> class, thus preventing \s-* from matching the newline.
(This bug report unfortunately got no response at the time.)
You don't specify what the result is you're seeing, and what you expect
to see, so I'm not sure whether this is fixed or not. When I try your
recipe in Emacs 26.1-28, I get:
[-- Attachment #2: Type: image/png, Size: 7123 bytes --]
[-- Attachment #3: Type: text/plain, Size: 217 bytes --]
Which I think is correct behaviour?
Are you still seeing buggy behaviour here in more recent Emacs versions?
--
(domestic pets only, the antidote for overdose, milk.)
bloggy blog: http://lars.ingebrigtsen.no
next prev parent reply other threads:[~2020-12-02 12:19 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-04-22 6:20 bug#23339: 24.5; align-region assumes that match does not contain newline Josh
2020-12-02 12:19 ` Lars Ingebrigtsen [this message]
2021-01-19 7:32 ` Lars Ingebrigtsen
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87zh2w1jto.fsf@gnus.org \
--to=larsi@gnus.org \
--cc=23339@debbugs.gnu.org \
--cc=josh+gnu@nispio.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.