Menu

#8 Fixes for indenting and auto-completion

open
nobody
None
5
2003-05-25
2003-05-25
No

Highlights:
-----------

- 3-step easy installation (from single tar.gzip file)

- tabs vs. spaces issue resolved: User can configure.

- auto-completion now generally happens when you hit
</ instead of >, but does slightly more than it used to
overall.

xslide.el:
----------

- Tabs vs. Spaces: I reverted my code to the original
defaults: 2-space indent using spaces (not tabs). I also
tried to encourage customization. Made indent-tabs-
mode a defcustom instead of a defvar to encourage
users to customize it. Greatly expanded the
documentation for xsl-element-indent-step to make sure
users set up their tabs mode properly.

- Changed defcustom booleans so that the choice menu
gives 0 for nil and 1 for t instead of the other way around.

- Tweaked auto-tag-completion in xsl-electric-greater-
than and xsl-electric-slash. I really liked the auto
completion and set out to fix some minor bugs. After
reworking several times, I realized that while my design
goals were in line with the original ones, my priorities
were reversed.

Old paradigm:
Primary goal: Reduce typing by auto-completing as
much as possible
Secondary goal: Don't auto-complete when the user
might not want it.

New paradigm:
Primary goal: Don't auto-complete when the user might
not want it.
Secondary goal: Reduce typing by auto-completing as
much as possible.

My reasoning: Even though it's probably no more
keystrokes overall between deleting auto-completes that
you don't want vs. typing the </ to start an end tag in
order to get an auto completion, it's annoying when an
editor inserts stuff you don't want.

I added additional auto-completion for <xsl:choose> and
for <table> tags in xsl-electric-greater-than. Other tags
do not auto-complete when you hit >. They wait until
you hit </, and then only outside of comments. Maybe
this could be improved with an xsl-electric-space that
auto-inserts required attributes when you finish writing
the tag name.

I modified xsl-electric-slash to fill in the close tag even if
it is looking at whitespace or the beginning of another
tag. I think this is fine because the only time you
wouldn't want that is if you are looking at a valid tag
name (because it might the name of the end-tag you are
about to auto-complete).

- Fixed bug where xsl-electric-less-than was inserting
spaces after the cursor instead of before.

- Improved xsl-electric-return to put you right under the
start of the previous line in comments.

- Added some constants for some regular expressions
that were used more than once.

xslide-font.el:
---------------

- No functional changes. Removed a stupid comment I
had copied from somewhere else. Added a commented-
out option for CDATA highlighting that might be cool. I
was thinking that since CDATA sections might not be
XML, and in fact, might be another language entirely
(JavaScript for instance), it seems logical to color the
whole thing one color. On the other hand, it is pretty
common to find xml-type languages in these sections,
so highlighting might be useful. Thoughts anyone?

Overall:
--------
Packaged as a tar/gzip for easier installation. Included
pre-built .elc files.

Installation:
-------------
- Download
- Unzip into your xslide directory using tar/gzip or
WinZip 8.0.
- open emacs and enjoy

Discussion

  • Glen Peterson

    Glen Peterson - 2003-06-02

    Logged In: YES
    user_id=750563

    2003-06-02: I made no real changes other than to use it for a
    week and fix some minor bugs, the most serious of which
    was that I left out a period in my regular expression for
    matching XML names.

    All my changes are in this file. Just unzip to your xslide
    directory and restart emacs.

     
  • Glen Peterson

    Glen Peterson - 2003-06-11

    Logged In: YES
    user_id=750563

    glensChanges2003-06-10.tar.gz contains two changes:

    1.) Added a new function: xsl-if-to-choose converts <xsl:if>
    to <xsl:choose>. Works on a single 'ifs' or on a region.
    So:

    <xsl:if test="isFive = 5"><p>It's five!</p></xsl:if>

    Becomes:
    <xsl:choose>
    <xsl:when test="isFive = 5"><p>It's five!</p></xsl:when>
    <xsl:otherwise></xsl:otherwise>
    </xsl:choose>

    If you put your cursor inside the open-tag of the if, it will
    work on that tag
    only. If you highlight a region, it will convert every 'if' whose
    start tag is
    within that region. It is very easy to convert consecutive 'if's
    to a single
    choose by deleting the appropriate lines after executing this
    command.

    Bound to C-c C-t by default.

    2.) Improved auto-completion and added some context-
    sensitive prompts (ever forget what the legal attributes are
    for xsl:sort?)

    Should be an unzip and restart sort of installation.

     
  • Glen Peterson

    Glen Peterson - 2003-06-11

    Logged In: YES
    user_id=750563

    glensChanges2003-06-11.tar.gz contains one change:

    I merged my changes with the latest files in the CVS tree.
    Use this version to patch xslide 0.2.1 and the previous version
    with 0.2.

     
  • Glen Peterson

    Glen Peterson - 2003-06-11

    Merged with 0.2.1

     
  • Glen Peterson

    Glen Peterson - 2003-06-12

    Logged In: YES
    user_id=750563

    I tried it out in gnu emacs on linux. These changes make it
    compile. I also eliminated my .elc files because they seem to
    be xemacs specific.

     
  • Glen Peterson

    Glen Peterson - 2003-08-29

    Merged with 0.2.3 code. Only tested on XEmacs.

     
  • Glen Peterson

    Glen Peterson - 2003-08-29

    Logged In: YES
    user_id=750563

    This file is basically the same as the above, but merged with
    the 0.2.3 (and compatible with 0.2.2) changes. It has only
    been fully tested on XEmacs under Windows. It was tested
    with GNU and X emacs under Linux a short while back, but
    parts of it have changed since then. I think it will be OK, but
    I can't promise.

    The 0.2.3 change was to make xslide work equally well with
    tabs or spaces. That change has not yet been merged at the
    time of this posting.

     
  • Glen Peterson

    Glen Peterson - 2003-09-05

    Fixed xsl:text indentation

     
  • Glen Peterson

    Glen Peterson - 2003-09-05

    Logged In: YES
    user_id=750563

    This file:

    glensChanges2003-09-04.tar.gz

    includes a change for indenting xsl:text better and includes
    scop's patch for a customizable variable. The xsl:text change
    is to address a RFE. I have tested this in XEmacs only but
    don't expect problems since the changes were not too far-
    reaching and another user took the previous version in GNU
    emacs on Linux and it worked for him.

     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.