Commits

scop  committed f6262eb

Sync with upstream 0.2.2 <1060085377.24573.5.camel@bobcat.mine.nu>.

  • Participants
  • Parent commits b66dea9

Comments (0)

Files changed (10)

File CHANGELOG.TXT

-xslide Change Log
-=================
-$Id$
-
-Revision 0.2, 27 August 2001
-============================
-
-xslide.el
----------
-
-Added customising of `xsl-indent-attributes' and
-`xsl-indent-element-step'.
-
-Changed name completion based on bug fix by KURODA Akira.
-
-xslide-process.el
------------------
-
-Finally fixed Saxon process error regexp.
-
-xslide-font.el
---------------
-
-Changed some font-lock colours.
-
-Finally fixed bug where XSLT attributes were coloured as FO
-attributes.
-
-xslide-data.el
---------------
-
-Updated FO element and attribute names to match XSL PR.
-
-Makefile
---------
-
-Changed $(PRELOADS) to emulate version that works well with tdtd.
-
-README.TXT
-----------
-
-Added pronunciation note.
-
-Added note about "Xsl" Customize group.
-
-Added note that xslide should be installed on your Emacs load path.
-
-
-Revision 0.2b3, 7 April 2001
-============================
-
-xslide.el
----------
-
-Added xsl-element-indent-step variable.
-
-Added `xsl-open-line'.
-
-Revised `xsl-electric-greater-than' to optionally insert a matching
-end-tag.
-
-Added skipping of CDATA sections in `xsl-electic-slash'.
-
-Removed match on "<!" in `xsl-electric-tab'.
-
-Modified completion mechanism in `xsl-complete'.
-
-Added `xsl-insert-template'.
-
-Added "xsl:key" and "xsl:attribute-set" submenus to "Templates" menu.
-
-Added explanations of `xsl-process' and `xsl-grep' to `xsl-mode'
-documentation string.
-
-xslide-abbrev.el
-----------------
-
-Removed abbrevs for "selectors" that haven't even been in XSL since
-the second draft.
-
-xslide-data.el
---------------
-
-Updated copyright date and author email.
-
-xslide-font.el
---------------
-
-Added optional whitespace to regexps used when fontifying following
-bug fix by Simon Wright.
-
-Fiddled with face colours while trying to work out why XSLT attributes
-appear with FO colours.
-
-Reordered regexps for text and for "other" tags.
-
-Revised regexp for { and } in attribute values.
-
-Fiddled with attribute regexps.
-
-xslide-process.el
------------------
-
-Attempted improvement of Saxon process error regexp.
-
-dot_emacs
----------
-
-Added .fo files to auto-mode-alist.
-
-
-Revision 0.2b2, September 21, 2000
-==================================
-
-xslide.el
----------
-
-Changed version number to 0.2b2
-
-xslide-font.el
---------------
-
-Moved entity references regexp to later in font lock keywords
-
-Corrected error of using a number as argument to `concat'.
-
-
-Revision 0.2b1, September 12, 2000
-==================================
-
-xslide.el
----------
-
-Added imenu as "Templates" menu
-
-Added "xsl", "xsl-font", and "xsl-process" customize groups
-
-Added initial stylesheet that is inserted in empty buffers
-
-Improvements to insertion of end tags courtesy of Moritz Maass
-
-Revised indentation calculation courtesy of Lassi Tuura
-
-xslide-abbrev.el
-----------------
-
-Merged references to xsl-fo-attribute-symbol-alist-1 and -2
-
-xslide-data.el
---------------
-
-Updated element and attribute information courtesy of Norman Walsh and
-Lassi Tuura
-
-Merged xsl-fo-attribute-symbol-alist-1 and -2
-
-Renamed xsl-xsl-ns-prefix to xsl-xslt-ns-prefix.
-
-xslide-font.el
---------------
-
-Replaced use of `make-regexp' with Emacs' built-in `regexp-opt'
-
-Defined light and dark colours that can be customized
-
-xslide-initial.xsl
-------------------
-
-Added as default initial stylesheet inserted into empty buffers
-
-xslide-process.el
------------------
-
-Added xsl-process customize group contents
-
-Added input, stylesheet, and output %-sequences to xsl-process-command
-
-Added Saxon command line templates to xsl-process-command
-
-Added regexp for Saxon error messages to xsl-process-regexps
-
-Changed `xsl-process' to populate its command history if history is
-null or if prefix argument is used.
-
-
-Revision 0.1.3, March 1, 2000
-=============================
-
-xslide.el
----------
-
-Added control over electric tabs
-
-Changes to indentation calculation courtesy of Simon Brooke
-
-xslide-data.el
---------------
-
-Partial updates to match XSLT Recommendation and current XSL Working
-Draft
-
-xslide-font.el
---------------
-
-Added definition of font lock colours for light background
-
-Added "append" keyword to some regular expressions
-
-
-Revision 0.1.1, February 17, 1999
-=================================
-
-xslide.el
----------
-
-Added xsl-electric-quote and xsl-electric-apos.
-
-Added "'" to several regular expressions.
-
-Modified a regular expression in xsl-electric-slash
-
-xslide-font.el
---------------
-
-Replaced use of `font-lock-make-face' with code that works with Emacs
-20.
-
-Many constants moved to xslide-data.
-
-Moved comment pattern to later in list.
-
-Match on XML Declaration made more rigorous.
-
-More rigorous match on "{" and "}" in attribute values.
-
-xslide-data.el
---------------
-
-Added "xmlns" and "macro".
-
-xslide-process.el
------------------
-
-Moved ":" inside set of parenthesis in error regexp
-
+2003-08-05  Ville Skytt�  <scop@xemacs.org>
+
+	* Sync with upstream 0.2.2.  See ChangeLog.upstream.
+
 2003-06-28  Norbert Koch  <viteno@xemacs.org>
 
 	* Makefile (VERSION): XEmacs package 1.07 released.

File ChangeLog.upstream

+2003-08-04  Tony Graham  <tonygraham@users.sourceforge.net>
+
+	* === Released 0.2.2 ===.
+
+	* Makefile: Removed CHANGELOG.TXT from dist.
+
+	* NEWS: Updated for 0.2.2.
+
+	* README.TXT: Upped version number, added `xsl-if-to-choose' to
+	features.
+
+2003-08-03  Tony Graham  <tonygraham@users.sourceforge.net>
+
+	* README.TXT: Reworked byte-compiling instructions, added note to
+	ignore errors.
+
+2003-07-18  Tony Graham  <tonygraham@users.sourceforge.net>
+
+	* dot_emacs: Added commented-out autoloads of `xsl-grep' and
+	`xsl-process'.
+
+	* xslide.el: Removed one of two autoloads of
+	`reporter-submit-bug-report'.
+
+2003-07-14  Tony Graham  <tonygraham@users.sourceforge.net>
+
+	* xslide.el: Added `xsl-xemacs-p', `xsl-fsfemacs-p', and
+	`xsl-note-emacs-version' so can better handle Emacs/XEmacs
+	differences.  Used `xsl-fsfemacs-p' in `xsl-mode'.
+
+2003-07-14  Tony Graham  <tonygraham@users.sourceforge.net>
+
+	* xslide.el: Added `xsl-xemacs-p', `xsl-fsfemacs-p', and
+	`xsl-note-emacs-version' so can better handle Emacs/XEmacs
+	differences.  Used `xsl-fsfemacs-p' in `xsl-mode'.
+
+2003-07-02  Tony Graham  <tonygraham@users.sourceforge.net>
+
+	* xslide-font.el: Corrected a doc string.
+
+	* xslide.el: Added `xsl-if-to-choose', changed version to 0.2.2,
+	changed completions.
+
+2003-06-05  Tony Graham  <tonygraham@users.sourceforge.net>
+
+	* xslide.el: Fix docstring nits from patch 586138 (Ville Skytta).
+
+	* xslide-process.el: Added support for more XSLT processors from
+	patch 529922 (Ville Skytta).
+
+	* README.TXT: Updated instructions for byte-compiling without
+	using makefile.
+
 2003-05-26  Tony Graham  <tonygraham@users.sourceforge.net>
 
-	* === Released 0.2.1 ===
+	* === Released 0.2.1 ===.
 
 	* Makefile, README.TXT: 'makefile' is now 'Makefile' and other
 	files changed capitalisation.
 # Boston, MA 02111-1307, USA.
 
 VERSION = 1.07
-AUTHOR_VERSION = 0.2.1
+AUTHOR_VERSION = 0.2.2
 MAINTAINER = XEmacs Development Team <xemacs-beta@xemacs.org>
 PACKAGE = xslide
 PKG_TYPE = regular
 ELCS = xslide-data.elc xslide-abbrev.elc xslide-process.elc xslide-font.elc  \
 	xslide.elc
 
-EXTRA_SOURCES = CHANGELOG.TXT ChangeLog.upstream dot_emacs Makefile.upstream \
+EXTRA_SOURCES = ChangeLog.upstream dot_emacs Makefile.upstream \
 	README.TXT xslide-initial.xsl NEWS TODO
 
 PRELOADS = -l cus-face -l regexp-opt -l font-lock -l sendmail \

File Makefile.upstream

 
 FILES = \
 	ChangeLog \
-	CHANGELOG.TXT \
 	dot_emacs \
 	Makefile \
 	NEWS \
+Changes between 0.2.1 and 0.2.2
+
+* Added `xsl-if-to-choose' (Glen Petersen)
+* Added support for more XSLT processors (Ville Skytta)
+* Improved XEmacs compatibility
+* Minor bug fixes
+
 Changes between 0.2 and 0.2.1
 
 * Added ability to view or browse `xsl-process' output
 This package contains an Emacs major mode for editing XSL stylesheets.
-The current revision is 0.2.1, dated 26 May 2003.
+The current revision is 0.2.2, dated 4 August 2003.
 
 The xslide home page is http://www.menteith.com/xslide/
 
 xslide source code is also available at
 http://www.sourceforge.net/projects/xslide/.
 
+The xslide mailing list is xslide-list@lists.sourceforge.net.  See
+https://lists.sourceforge.net/lists/listinfo/xslide-list/.
+
 * MANIFEST
 
 File                    Contents
  - Automatic completion of end-tags;
 
  - Automatic indenting of elements with user-definable indentation
-   step; and
+   step;
+
+ - `xsl-if-to-choose' converts <xsl:if> to <xsl:choose> with
+   nested <xsl:when>; and
 
  - Comprehensive abbreviations table to further ease typing.
 
-xsl-mode was tested using Emacs 20.7.1.
+xsl-mode was tested using Emacs 21.2.1 and XEmacs 21.4.
 
 
 * BUG REPORTS/ENCHANCEMENTS
 SourceForge site.
 
 
-* MAILING LIST
-
-xslide-list@lists.sourceforge.net is the xslide mailing list.  See
-https://lists.sourceforge.net/lists/listinfo/xslide-list/.
-
-
 * INSTALLATION
 
 1. Unzip the distribution.
    /usr/local/lib/emacs/site-lisp) or some other directory that is on
    your Emacs load path.
 
-3. Byte compile the .el files using M-x byte-compile-file and
-   supplying the path name of each file.
-
-   The provided makefile also has rules for byte-compiling the files.
+3. Byte-compile the .el files, if you want.
 
    If you byte-compiled a previous version of the files, you must
    byte-compile the new files (or remove the old .elc files) so that
    autoload loads the correct versions.
 
-4. Add the elisp code in dot_emacs to your .emacs file.
+   If there are any byte compiler warning, ignore them.  They probably
+   can't be avoided with code that is run on multiple Emacs versions
+   [1].
+
+   There are two easy ways to byte-compile the .el files:
+
+   a. Byte-compile from within Emacs:
+
+      Load xslide.el (M-x load-file RET xslide.el) then byte
+      compile the .el files using C-0 M-x byte-recompile-directory and
+      supplying the path name of the directory containing the .el
+      files.
+
+   or
+
+   b. Byte-compile using the provided Makefile:
+
+      First, review the values of EMACS and SHELL in the Makefile.
+      Second, run 'make' without arguments to byte-compile the files.      
+
+4. Add the elisp code in dot_emacs to your .emacs file.  Uncomment any
+   portions that you want to also use.
 
 5. Restart Emacs (or, if it's easier for you, evaluate the code that
    you just added to your .emacs file).
 8. To customize xsl-mode font-lock colours, etc., browse the `Xsl'
    Customize group after loading xsl-mode.
 
+
+Notes:
+[1] Originally noted by the VM mail reader by Kyle Jones.
+
 -----
 $Id$
 ;; XSL mode
 (autoload 'xsl-mode "xslide" "Major mode for XSL stylesheets." t)
 
+;; Uncomment if you want to use `xsl-grep' outside of XSL files.
+;(autoload 'xsl-grep "xslide" "Grep for PATTERN in files matching FILESPEC." t)
+
+;; Uncomment if you want to use `xslide-process' in `xml-mode'.
+;(autoload 'xsl-process "xslide-process" "Process an XSL stylesheet." t)
+;(add-hook 'xml-mode-hook
+;	  (lambda ()
+;	    (define-key xml-mode-map [(control c) (meta control p)]
+;	      'xsl-process)))
+
 ;; Turn on font lock when in XSL mode
 (add-hook 'xsl-mode-hook
 	  'turn-on-font-lock)
        auto-mode-alist))
 
 ;; Uncomment if using abbreviations
-;; (abbrev-mode t)
+;(abbrev-mode t)

File xslide-font.el

     (re-search-backward "^[ \t]*<" (point-min) 'limit 5)))
 
 (defun xsl-font-lock-region-point-min ()
-  "Return the start point of the region to fontify"
+  "Return the start point of the region to fontify."
   (save-excursion
     (re-search-backward "^[ \t]*<" (point-min) 'limit 5)
     (point)))
 
 (defun xsl-font-lock-region-point-max ()
-  "Return the start point of the region to fontify"
+  "Return the end point of the region to fontify."
   (save-excursion
     (re-search-forward ">[ \t]*$" (point-max) 'limit 5)
     (point)))
 ;;;; xslide.el --- XSL Integrated Development Environment
 ;; $Id$
 
-;; Copyright (C) 1998, 1999, 2000, 2001 Tony Graham
+;; Copyright (C) 1998, 1999, 2000, 2001, 2003 Tony Graham
 
 ;; Author: Tony Graham <tkg@menteith.com>
 ;; Contributors: Simon Brooke, Girard Milmeister, Norman Walsh,
 ;;               Moritz Maass, Lassi Tuura, Simon Wright, KURODA Akira,
-;;               Ville Skytt�
+;;               Ville Skytt�, Glen Peterson
 ;; Created: 21 August 1998
 ;; Version: $Revision$
 ;; Keywords: languages, xsl, xml
 (require 'xslide-font "xslide-font")
 (require 'xslide-process "xslide-process")
 
+;; Work out if using XEmacs or Emacs
+;; Inspired by 'vm'
+(defconst xsl-xemacs-p nil)
+(defconst xsl-fsfemacs-p nil)
+(defun xsl-xemacs-p () xsl-xemacs-p)
+(defun xsl-fsfemacs-p () xsl-fsfemacs-p)
+(defun xsl-note-emacs-version ()
+  (setq xsl-xemacs-p (string-match "XEmacs" emacs-version)
+	xsl-fsfemacs-p (not xsl-xemacs-p)))
+(xsl-note-emacs-version)
 
 ;; Define core `xsl' group.
 (defgroup xsl nil
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 ;; Version information
 
-(defconst xslide-version "0.2.1"
+(defconst xslide-version "0.2.2"
   "Version number of xslide XSL mode.")
 
 (defun xslide-version ()
   (define-key xsl-mode-map [(control o)]
 				   	  'xsl-open-line)
   (define-key xsl-mode-map "\C-c<"  	  'xsl-insert-tag)
+  (define-key xsl-mode-map "\C-c\C-t"     'xsl-if-to-choose)
 ;;  (define-key xsl-mode-map [(control m)]	  'xsl-electric-return)
 ;;  (define-key xsl-mode-map \10	  'xsl-electric-return)
   (define-key xsl-mode-map "\177"	  'backward-delete-char-untabify)
 ;;  (define-key xsl-mode-map "\M-\C-h" 'mark-xsl-rule)
 )
 
+(defun 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."
+  (interactive)
+  (let
+    (
+      (single-if (not (mark)))
+      (the-start (point))
+      (the-end (if (mark) (mark) (point)))
+    )
+    (if (and (not (null (mark)))
+             (< (mark) (point)))
+      (progn
+        (exchange-point-and-mark)
+        (setq the-start (point))
+        (setq the-end (mark))
+      )
+    )
+    (save-excursion
+      (if single-if
+        (progn
+          (search-backward "<" nil t)
+;          (message "xsl-if-to-choose: single if mode")
+          (xsl-convert-if-to-choose-slave)
+        )
+        (save-excursion
+;          (message
+;            (concat "xsl-if-to-choose: Region mode: "
+;                    (int-to-string the-start)
+;                    " "
+;                    (int-to-string the-end)
+;            )
+;          )
+          (goto-char the-end)
+          (if (save-excursion (search-backward "<xsl:if" the-start t))
+            (while (search-backward "<xsl:if" the-start t)
+              (xsl-convert-if-to-choose-slave)
+            )
+            (message "xsl-if-to-choose error: There's no <xsl:if> within the selected region.")            
+          )
+        )
+      )
+    )
+  )
+)
+
+(defun xsl-convert-if-to-choose-slave ()
+  (if (looking-at "<xsl:if")
+    (let
+      ( (start (save-excursion (beginning-of-line) (point))) )      
+      (delete-char 7)
+      (insert "<xsl:choose>\n<xsl:when")
+      (search-forward "</xsl:if>" nil t)
+      (backward-delete-char 9)
+      (insert "</xsl:when>\n<xsl:otherwise></xsl:otherwise>\n</xsl:choose>")
+      (indent-region start (point) nil)
+    )
+      (message "xsl-if-to-choose error: point is not within the start tag of an <xsl:if>.")
+  )
+)
+
 (defun xsl-electric-greater-than (arg)
   "Insert a \">\" and, optionally, insert a matching end-tag.
 
 			((looking-at "<!--[^-]*\\(-[^-]+\\)*-->"))
 			;; skip CDATA sections
 			((looking-at "<!\\[CDATA\\["))
-			;; ...and the XML declaration, DOCTYPE and ENTITY stuff
+			;; XEmacs Change: and the XMLdecl, DOCTYPE and ENTITYs
 			((looking-at
                           "<\\(\\?xml\\|!\\(DOCTYPE\\|ENTITY\\)\\)[ \t\n\r]"))
 			((looking-at "<\\([^/> \n\t]+\\)")
        ;; other tags/char data or a complete meta tag => stay put
        ((save-excursion
  	  (or (looking-at (concat "</" name ">"))
+ 	      ;; XEmacs change: grok whitespace before />.
  	      (re-search-forward (concat element "[ \t\n]*/>") limit t)
  	      (re-search-forward (concat element ">[ \t]*[^\n]") limit t)
  	      (re-search-forward (concat meta ">[ \t]*\n") limit t)))
 	       (insert completion))
 	      (t
 	       (goto-char here)
-	       (let ((res (completing-read
-			   "xsl-complete: " tab nil t pattern)))
-		 (insert
-		  ;; insert completed strings(res) after pattern
-		  (substring res (length pattern))))))))))
+	       (message "Making completion list...")
+	       (let ((list (all-completions pattern tab)))
+		 (with-output-to-temp-buffer " *Completions*"
+		   (display-completion-list list)))
+	       (message "Making completion list...%s" "done")))))))
 
 (defun xsl-insert-tag (tag)
   "Insert a tag, reading tag name in minibuffer with completion."
 Font lock mode:
 
 Turning on font lock mode causes various XSL syntactic structures to be
-hightlighted. To turn this on whenever you visit an XSL file, add
+highlighted. To turn this on whenever you visit an XSL file, add
 the following to your .emacs file:
   \(add-hook 'xsl-mode-hook 'turn-on-font-lock\)
 
   ;; comment stuff
 ;;  (make-local-variable 'comment-column)
 ;;  (setq comment-column 32)
+  ;; XEmacs change: make `comment-region' work.
   (make-local-variable 'comment-start)
   (setq comment-start "<!-- ")
   (make-local-variable 'comment-end)
 ;;  (xsl-font-make-faces)
   (make-local-variable 'font-lock-defaults)
   (setq font-lock-defaults '(xsl-font-lock-keywords t))
-  (setq font-lock-mark-block-function 'xsl-font-lock-mark-block-function)
+  (if (xsl-fsfemacs-p)
+      (progn
+	(make-local-variable 'font-lock-mark-block-function)
+	(setq font-lock-mark-block-function
+	      'xsl-font-lock-mark-block-function)))
   (make-local-variable 'indent-line-function)
   (setq indent-line-function 'xsl-electric-tab)
 ;;  (make-local-variable 'font-lock-defaults)
 ;;	      compilation-error-regexp-alist))
 
   (set-syntax-table xsl-mode-syntax-table)
-  (make-local-variable 'indent-line-function)
-  (setq indent-line-function 'xsl-electric-tab)
   ;; Maybe insert space characters when user hits "Tab" key
   (setq indent-tabs-mode xsl-indent-tabs-mode)
   (if (and
 
 ;;;; Bug reporting
 
-(eval-and-compile
-  (autoload 'reporter-submit-bug-report "reporter"))
-
 (defun xsl-submit-bug-report ()
-  "Submit via mail a bug report on XSLIDE."
+  "Submit via mail a bug report on 'xslide'."
   (interactive)
+  (require 'reporter)
   (and (y-or-n-p "Do you really want to submit a report on XSL mode? ")
        (reporter-submit-bug-report
 	xslide-maintainer-address
       (beginning-of-line)
       (delete-region (point) (progn (forward-line) (point)))
       (insert
-       "Subject: XSLIDE version " xslide-version " is wonderful but...\n"))))
+       "Subject: xslide " xslide-version " is wonderful but...\n"))))
 
 
+(autoload 'reporter-submit-bug-report "reporter")
+
 ;;;; Last provisions
 ;;;(provide 'xslide)
 
+;; XEmacs change
 ;;;###autoload(add-to-list 'auto-mode-alist '("\\.\\(?:xsl\\|fo\\)$" . xsl-mode))
 
 ;;; xslide.el ends here