From: Glen P. <gl...@or...> - 2003-07-16 03:04:13
|
On Tue, 2003-07-15 at 11:26, xslide Support wrote: > Here's a plan: > > (defcustom xsl-indent-step 2 I like everything you suggest but I have 2 questions. 1.) Why do we need a separate xsl-tab-width and xsl-tab-indent-step? 2.) Can we inherit default values from global variables where appropriate. If I use 3-space indentation, I would like that to be my default for any mode unless I set it explicitly for that mode. Same for indent-tabs-mode. How do you make one variable inherit from another that may or not be defined? Is there any way to check to see if a variable is defined? If so, here's some pseudo code that shows an inheriting variation on what you propose: if xsl-tab-width is undefined if tab-width is defined setq xsl-tab-width tab-width else setq xsl-tab-width 2 (2 is the current default) if xsl-indent-tabs-mode is undefined if indent-tabs-mode is defined setq xsl-indent-tabs-mode indent-tabs-mode else setq xsl-indent-tabs-mode nil (nil is the current default) if xsl-tab-stop-list is undefined if tab-stop-list is defined setq xsl-tab-stop-list tab-stop-list (is this wise?) else generate xsl-tab-stop-list from xsl-tab-width Then set local variables to the xsl- ones. Having an xsl-tab-stop-list separate from the global tab-stop-list is a nice feature, but it's so far ahead of other emacs modes (many of which don't support tabs at all) that I'm not sure it's necessary. > Once this is implemented, it would probably be a good time to look at > implementing reading and writing local variable definitions in the XSL > files so you get rational-looking files when you open a stylesheet > written by somebody with very different settings for these variables. If indent-tabs-mode is nil, style sheets will look the same on every system. If indent-tabs-mode is t, the structure will be the same, but the size of the indent may be different (like smaller or larger stair steps). The above statements are true so long as tabs and spaces are not mixed in the same file. Either of these effects are (in my opinion) desirable. Spaces look the same on all systems. Tabs let everyone see the file with their own favorite indentation step width. Tabs are also sometimes used to reduce file sizes, but there is rarely a significant savings. Neither of these paradigms requires that extra display information be stored in the file. Mixing tabs and spaces only looks right if the author and reader have exactly the same tab-stops set. I've been thinking about one way to mix tabs and spaces that might look right on everyone's system but the explanation is rather lengthy and I'm not absolutely certain it would work in all cases, so you'll have to ask me about it if you are interested. It might be better to avoid this situation altogether than to embed emacs-specific display information in xsl files. -Glen |