diff --git a/ChangeLog b/ChangeLog index 0d83e8ba..47a7e865 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +Sat Jun 23 19:36:31 CEST 2001 Daniel Veillard + + * doc/libxml-doc.el: a new version of libxml-doc.el. This new + version works with both libxml1 and libxml2 (it autodetects + the prefix of the html-files) from Felix Natter. + * doc/xml.html: updated doc accordingly + Sat Jun 23 18:30:28 CEST 2001 Daniel Veillard * xpath.c: fixed the bug generating a template loop in libxslt diff --git a/doc/libxml-doc.el b/doc/libxml-doc.el index 0ffec25a..634d008b 100644 --- a/doc/libxml-doc.el +++ b/doc/libxml-doc.el @@ -1,11 +1,9 @@ - ;;; libxml-doc.el - look up libxml-symbols and start browser on documentation +;;; libxml-doc.el - look up libxml-symbols and start browser on documentation -;; Author: Felix Natter +;; Author: Felix Natter , Geert Kloosterman ;; Created: Jun 21 2000 ;; Keywords: libxml documentation -;; 2001-05-31: Adapted by Geert Kloosterman - ;; This program is free software; you can redistribute it and/or ;; modify it under the terms of the GNU General Public License ;; as published by the Free Software Foundation; either version 2 @@ -26,19 +24,11 @@ ;; (using lynx within emacs by default; ;; ----- Installing ;; 1. add the following to ~/.emacs (adapt path and remove comments !) -;; (load ~/elisp/libxml-doc.el) -;; you can also load this conditionally in a c-mode-hook (preferred) -;; -;;(add-hook 'c-mode-hook (lambda() -;; (load-file "~/elisp/libxml-doc.el"))) -;; -;; or you can use this if you are using libxml2 -;;(add-hook 'c-mode-hook (lambda() -;; (save-excursion -;; (if (search-forward "#include , Geert Kloosterman : ;; - Now keeps the list of symbols between calls to speed things up. -;; Every filter gets it's own list of symbols. This way it's -;; possible to use different values of `libxmldoc-filter-regexp' in -;; different buffers. -;; - Fixed symbols for function pointers: now skips '*' when -;; fetching identifiers from the html files. +;; - filtering is only used when no symbol is passed and +;; thing-at-point does not match a symbol and "*" + thing-at-point +;; does not match a symbol (this is used to catch callbacks) and +;; libxmldoc-filter-regexp is non-nil. +;; Sat Jun 23 16:20:34 2001: update the docstrings +;; Sat Jun 23 16:22:54 2001 (Geert Kloosterman ): +;; update README: use autoload instead of load+c-mode-hook ;;; TODO: -;; use command-execute for libxml-browse-url +;; - use command-execute for libxmldoc-browse-url +;; - keep (match-string 1) in a variable (libxmldoc-get-list-of-symbols) +;; - check the (require ..)-statements ;;; Code: -(defvar libxmldoc-root "~/libxml/www.xmlsoft.org" +(provide 'libxmldoc) + +(require 'browse-url) +(require 'term) + +(defvar libxmldoc-root "~/src/libxml2-2.3.8/doc/html" "The root-directory of the libxml2-documentation (~ will be expanded).") -(defvar libxmldoc-filter-regexp "^html\\|^\\*\\|^[A-Z_]+\\|^$" +(defvar libxmldoc-filter-regexp "^html\\|^\\*\\|^[A-Z_]+" "Symbols that match this regular expression will be excluded when doing -completion. +completion and no symbol is specified. For example: callbacks: \"^\\\\*\" cpp-defines: \"[A-Z_]+\" xml-functions \"^xml\" html-functions \"^html\" sax-functions \".*SAX\" - By default, callbacks, cpp-defines and html* are excluded. If you redefine - this, you should include \"^$\" as alternative, which removes empty - tokens. i.e. removing \"^html\\\\|\" from the above regexp causes html* to - be shown.") +By default, callbacks, cpp-defines and html* are excluded. +Set this to nil if you don't want filtering.") (defvar libxmldoc-browse-url 'browse-url-lynx-emacs "Browser used for browsing documentation. Emacs/W3 4.0pre46 cannot handle -the html, so lynx-emacs is used by default.") +the html (and would be too slow), so lynx-emacs is used by default.") (defvar libxmldoc-symbol-history nil "History for looking up libxml-symbols.") - -;; GJK: Keep the results from libxmldoc-get-list-of-symbols between -;; calls to speed things up. -(defvar libxmldoc-symbols-alist nil - "Alist which stores a symbol list for each `libxmldoc-filter-regexp'. The -never matching regex \"$^\" is used as key when no filtering is needed.") +(defvar libxmldoc-symbols nil + "The list of libxml-symbols.") ;;;; public functions (defun libxmldoc-lookup-symbol(&optional symbol) "Look up xml-symbol." (interactive) - (let ((symbols) - (real-symbol symbol) - (url) - ;; We don't want filtering when there's a symbol specified. - ;; Use the never matching regex "$^" as a key when using no filter. - (filter (if symbol "$^" libxmldoc-filter-regexp)) - (no-filter (if symbol t nil))) - - ;; Build up a symbol list if neccesary. - (if (not (assoc filter libxmldoc-symbols-alist)) - (add-to-list 'libxmldoc-symbols-alist - (cons filter - (libxmldoc-get-list-of-symbols no-filter)))) + (let + ;; this is necessary so that filtering is done case-sensitively + ((case-fold-search nil)) - ;; Use the appropriate symbol list. - (setq symbols (cdr (assoc filter libxmldoc-symbols-alist))) + ;; Build up a symbol list if neccesary + (if (null libxmldoc-symbols) + (setq libxmldoc-symbols (libxmldoc-get-list-of-symbols))) + + (cond + ((not (null symbol)) ;; symbol is specified as argument + (if (not (assoc symbol libxmldoc-symbols)) + (setq symbol nil))) + ((assoc (thing-at-point 'symbol) libxmldoc-symbols) + (setq symbol (thing-at-point 'symbol))) + ;; this is needed to catch callbacks + ;; note: this could be rewritten to use (thing-at-point 'word) + ((assoc (concat "*" (thing-at-point 'symbol)) libxmldoc-symbols) + (setq symbol (concat "*" (thing-at-point 'symbol)))) + ) - (if (null real-symbol) - (if (assoc (thing-at-point 'symbol) symbols) - (setq real-symbol (thing-at-point 'symbol)) - (setq real-symbol (completing-read "Libxml: " symbols nil t "" - 'libxmldoc-symbol-history "" t)))) - (if (null (assoc real-symbol symbols)) - (error (concat "libxmldoc: '" real-symbol "' not found !"))) - (setq url (cdr (assoc real-symbol symbols))) -;; (minibuffer-message uri) - (apply libxmldoc-browse-url (list url)))) - -;;(defun libxmldoc-lookup-symbol-at-point() -;; "Look up libxml-symbol at point." (interactive) -;; (libxmldoc-lookup-symbol (thing-at-point 'word))) + ;; omit "" t) from call to completing-read for the sake of xemacs + (setq symbol + (completing-read "Libxml: " (if (or symbol + (null libxmldoc-filter-regexp)) + libxmldoc-symbols + (mapcar + '(lambda(key,value) + (if (null (string-match + libxmldoc-filter-regexp + (car key,value))) + key,value)) + libxmldoc-symbols)) + nil t symbol + 'libxmldoc-symbol-history)) + + + ;; start browser + (apply libxmldoc-browse-url + (list (cdr (assoc symbol libxmldoc-symbols)))))) ;;;; internal -(defun libxmldoc-get-list-of-symbols(&optional nofilter) +(defun libxmldoc-get-list-of-symbols() "Get the list of html-links in the libxml-documentation." - (let ((files (directory-files libxmldoc-root t - "^libxml-.*\\.html$" t)) + (let ((files + (directory-files + libxmldoc-root t + (concat "^" (if (file-exists-p (concat libxmldoc-root + "/libxml-parser.html")) + "libxml-" + "gnome-xml-") + ".*\\.html$") t)) (symbols ()) (case-fold-search t) - (symbol) (uri)) -;; (minibuffer-message "collecting libxml-symbols...") + (message "collecting libxml-symbols...") (while (car files) - (find-file (car files)) - (while (re-search-forward - "]*href[ \t\n]*=[ \t\n]*\"\\([^=>]*\\)\"[^>]*>" nil t nil) - (setq uri (concat "file://" - (expand-file-name (match-string 1) - libxmldoc-root))) - (if (not (re-search-forward "\\([^<]*\\)<" nil t nil)) ; GJK: no '*' - (error "regexp error while finding libxml-symbols..")) - (setq symbol (match-string 1)) - (setq case-fold-search nil) - (if (or nofilter - (null (string-match libxmldoc-filter-regexp symbol))) - (add-to-list 'symbols (cons symbol uri))) - (setq case-fold-search t) - ) - (kill-buffer (current-buffer)) - (setq files (cdr files))) - symbols)) + (with-temp-buffer + (insert-file-contents (car files)) + (goto-char (point-min)) + (while (re-search-forward + "]*href[ \t\n]*=[ \t\n]*\"\\([^=>]*\\)\"[^>]*>" nil t nil) + (setq uri (concat "file://" (expand-file-name libxmldoc-root) "/" + (match-string 1))) + (if (not (re-search-forward "\\([^<]*\\)<" nil t nil)) + (error "regexp error while getting libxml-symbols..")) + ;; this needs add-to-list because i.e. xmlChar appears often + (if (not (string-equal "" (match-string 1))) + (add-to-list 'symbols (cons (match-string 1) uri)))) + ;; (setq symbols (cons (cons (match-string 1) uri) symbols))) + ) + (setq files (cdr files))) + symbols)) ;;; libxml-doc.el ends here - + ;;; Local Variables: ;;; indent-tabs-mode: nil ;;; End: diff --git a/doc/xml.html b/doc/xml.html index 484da796..cfcc402b 100644 --- a/doc/xml.html +++ b/doc/xml.html @@ -1557,8 +1557,9 @@ Gnome CVS base under gnome-xml/example

href="http://axkit.org/download/">XML::LibXSLT, a perl wrapper for libxml2/libxslt as part of the AxKit XML application server -
  • Felix Natter provided an emacs module to lookup libxml functions +
  • Felix Natter and + Geert Kloosterman provide an emacs module to lookup libxml(2) functions documentation
  • Ziying Sherwin provided man pages (not yet @@ -1569,6 +1570,6 @@ Gnome CVS base under gnome-xml/example

    Daniel Veillard

    -

    $Id: xml.html,v 1.88 2001/06/17 14:50:34 veillard Exp $

    +

    $Id: xml.html,v 1.89 2001/06/22 16:03:51 veillard Exp $