From: Josh <josh+gnu@nispio.net>
To: 23339@debbugs.gnu.org
Subject: bug#23339: 24.5; align-region assumes that match does not contain newline
Date: Thu, 21 Apr 2016 23:20:19 -0700 [thread overview]
Message-ID: <CADe+TV=Kd8EuyagNXLpkxtMapusNAjA+6AakO5PxQwpY58SMqw@mail.gmail.com> (raw)
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.
In GNU Emacs 24.5.1 (x86_64-apple-darwin13.4.0, NS apple-appkit-1265.21)
of 2015-04-10 on builder10-9.porkrind.org
Windowing system distributor `Apple', version 10.3.1348
Configured using:
`configure --with-ns '--enable-locallisppath=/Library/Application
Support/Emacs/${version}/site-lisp:/Library/Application
Support/Emacs/site-lisp''
Important settings:
value of $LANG: en_US.UTF-8
locale-coding-system: utf-8-unix
Major mode: Text
Minor modes in effect:
tooltip-mode: t
electric-indent-mode: t
mouse-wheel-mode: t
tool-bar-mode: t
menu-bar-mode: t
file-name-shadow-mode: t
global-font-lock-mode: t
font-lock-mode: t
blink-cursor-mode: t
auto-composition-mode: t
auto-encryption-mode: t
auto-compression-mode: t
line-number-mode: t
transient-mark-mode: t
Recent messages:
For information about GNU Emacs and the GNU system, type C-h C-a.
Load-path shadows:
None found.
Features:
(shadow sort gnus-util mail-extr emacsbug message format-spec rfc822 mml
easymenu mml-sec mm-decode mm-bodies mm-encode mail-parse rfc2231
mailabbrev gmm-utils mailheader sendmail rfc2047 rfc2045 ietf-drums
mm-util help-fns mail-prsvr mail-utils align time-date tooltip electric
uniquify ediff-hook vc-hooks lisp-float-type mwheel ns-win tool-bar dnd
fontset image regexp-opt fringe tabulated-list newcomment lisp-mode
prog-mode register page menu-bar rfn-eshadow timer select scroll-bar
mouse jit-lock font-lock syntax facemenu font-core frame cham georgian
utf-8-lang misc-lang vietnamese tibetan thai tai-viet lao korean
japanese hebrew greek romanian slovak czech european ethiopic indian
cyrillic chinese case-table epa-hook jka-cmpr-hook help simple abbrev
minibuffer nadvice loaddefs button faces cus-face macroexp files
text-properties overlay sha1 md5 base64 format env code-pages mule
custom widget hashtable-print-readable backquote make-network-process
cocoa ns multi-tty emacs)
Memory information:
((conses 16 72780 5795)
(symbols 48 17281 0)
(miscs 40 39 123)
(strings 32 10041 4622)
(string-bytes 1 277927)
(vectors 16 9051)
(vector-slots 8 373020 18497)
(floats 8 53 150)
(intervals 56 167 0)
(buffers 960 12))
next reply other threads:[~2016-04-22 6:20 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-04-22 6:20 Josh [this message]
2020-12-02 12:19 ` bug#23339: 24.5; align-region assumes that match does not contain newline Lars Ingebrigtsen
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='CADe+TV=Kd8EuyagNXLpkxtMapusNAjA+6AakO5PxQwpY58SMqw@mail.gmail.com' \
--to=josh+gnu@nispio.net \
--cc=23339@debbugs.gnu.org \
/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.