Re: [xslt] xsl:include thing



>>>>> "Daniel" == Daniel Veillard <veillard@redhat.com> writes:

    >> The damn diff obviously also contains few differences which have nothing to
    >> do with the code. My xemacs has a different indenting scheme and a different
    >> tab size than what Daniel used to make this file. I am still not that
    >> familiar with the tool to be able to teach it new identing :-) I am
    >> learning.

    >   I use VI , more precisely vim with a tab setting set to 8

Emacs's default indentation-style is "gnu", which is probably not what
you want.  I've adapted the k&r style to meet Daniel's layout.  I've
put it in a seperate style called libxml.

To enable this put the following in your .emacs/.xemacs:

;;----------------------------------------------------------------------
;; set up c-mode for libxml2/libxslt
;; GJK, Wed May 15 02:29:50 CEST 2002

;; like k&r but with `c-basic-offset' set to 4 and
;; `arglist-cont-nonempty' set to ++.
(defconst libxml-c-style
  '((c-basic-offset . 4)
    (c-comment-only-line-offset . 0)
    (c-offsets-alist . ((statement-block-intro . +)
                        (knr-argdecl-intro . 0)
                        (substatement-open . 0)
                        (label . 0)
                        (statement-cont . +)
                        (arglist-cont-nonempty . ++)))
    )
  "The Libxml Coding Style")

(add-hook 'c-mode-common-hook 
          '(lambda () 
             (setq tab-width        8   ; make sure tab behaviour
                   indent-tabs-mode t)  ; is correct
             ;; add style and set it for the current buffer
             (c-add-style "libxml" libxml-c-style t)))

;;----------------------------------------------------------------------

I've had Emacs reindent keys.c from libxslt and this left the file
totally intact, so I guess it works ok.

This mimics Daniel's style as close as I can get.  You might want to
remove the `(arglist-cont-nonempty . ++)' however:

This is the way Daniel continues an argument list most of the time:

    if (cur == NULL) {
        xsltPrintErrorContext(NULL, NULL, NULL);
        xsltGenericError(xsltGenericErrorContext,
                "xsltNewKeyTable : malloc failed\n");
        return(NULL);
    }

Emacs does this automatically with the elisp code shown above.  When
`(arglist-cont-nonempty . ++)' is removed from the code the arguments
line up neatly:

    if (cur == NULL) {
        xsltPrintErrorContext(NULL, NULL, NULL);
        xsltGenericError(xsltGenericErrorContext,
                         "xsltNewKeyTable : malloc failed\n");
        return(NULL);
    }

See for yourself what you like the most.

Hope this helps,

Geert



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