unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* Emacs 21.2 align.el - Perl hash element alignment bug
@ 2002-12-23 19:54 Jari Aalto+mail.emacs
  2002-12-23 21:54 ` John Wiegley
  0 siblings, 1 reply; 2+ messages in thread
From: Jari Aalto+mail.emacs @ 2002-12-23 19:54 UTC (permalink / raw)



(emacs-version)
"GNU Emacs 21.2.1 (i386-msvc-nt5.0.2195) of 2002-03-19 on buffy"

    1) M-x cperl-mode
    2) load-library align
    3) Write the above tests

    align.el behaves incorrectly in cperl-mode where the code reads:

        %hash =  ( one => 1
                  , amnMore  => 2
                  , hm => 3
                  , likeThisOne  => 4-!-
                  );               
 
    Position cursor (-!-) anywhere at the end of the above lines and
    call M-x align-newline-and-indent. The problem is that align.el
    seeks first "=":

                %hash           =  ( one => 1
                  , amnMore     => 2
                  , hm          => 3
                  , likeThisOne => 4
                           
                  );

                   
    It should be smarter and align according to "=>". I studied the
    code, but I do not undertand the syntax rules used there enough to
    make any suggestions.

        %hash =  ( one           => 1
                  , andMore      => 2
                  , hm           => 3
                  , likeThisOne  => 4
                  );               

    Jari


-- 
http://tiny-tools.sourceforge.net/
Swatch  @time http://www.ryanthiessen.com/swatch/resources.htm
Convert @time http://www.mir.com.my/iTime/itime.htm

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Emacs 21.2 align.el - Perl hash element alignment bug
  2002-12-23 19:54 Emacs 21.2 align.el - Perl hash element alignment bug Jari Aalto+mail.emacs
@ 2002-12-23 21:54 ` John Wiegley
  0 siblings, 0 replies; 2+ messages in thread
From: John Wiegley @ 2002-12-23 21:54 UTC (permalink / raw)


>>>>> On Mon Dec 23, Jari writes:

> It should be smarter and align according to "=>". I studied the
> code, but I do not undertand the syntax rules used there enough to
> make any suggestions.

Align is not smart enough to maintain "state", and thus make
intelligent decisions about alignment priority, or what should and
what shouldn't be aligned.  These are just line-by-line regexps,
after all.

In cases like this where is definite confusion, you, the human, will
have to step in.  Simply type M-x align-regexp on the region, and
then type "=>".  This will do exactly what you want.

John

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2002-12-23 21:54 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-12-23 19:54 Emacs 21.2 align.el - Perl hash element alignment bug Jari Aalto+mail.emacs
2002-12-23 21:54 ` John Wiegley

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).