;;; xhtml-help.el --- Browse XHTML reference sites ;; ;; Author: Lennart Borgman (lennart O borgman A gmail O com) ;; Created: 2005-08-16 ;; Last-Updated: Wed Aug 01 14:24:07 2007 (7200 +0200) (defconst xhtml-help:version "0.57") ;; Version: ;; Keywords: languages ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; ;;; Commentary: ;; ;; Use when editing XHTML file to get tag references or CSS property ;; name references (like background-color) from web sources. ;; ;; Usage: ;; ;; (require 'fmode) ;; ;; Then call `xhtml-help-show-tag-ref' or `xhtml-help-show-css-ref'. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; ;;; History: ;; ;; 2005-12-02: Corrected fetching margin-*. ;; 2006-01-08: Prompt for tag and property name before fetching help. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; ;; This file is not part of Emacs ;; ;; 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, or (at ;; your option) any later version. ;; ;; This program is distributed in the hope that it will be useful, but ;; WITHOUT ANY WARRANTY; without even the implied warranty of ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ;; General Public License for more details. ;; ;; You should have received a copy of the GNU General Public License ;; along with this program; see the file COPYING. If not, write to ;; the Free Software Foundation, Inc., 59 Temple Place - Suite 330, ;; Boston, MA 02111-1307, USA. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; ;;; Code: (defun xhtml-help-css-prop-at-point () "Get possible css name property at point." (save-excursion (let ((ch (char-after)) (in-word)) (when (and (not (bolp)) (or (not ch) (member ch '(10 9 32 ?\:)))) (backward-char) (setq ch (char-after))) (while (string-match "[a-z-]" (char-to-string ch)) (setq in-word t) (backward-char) (setq ch (char-after))) (when in-word (forward-char) (when (looking-at "[a-z-]+") (match-string-no-properties 0)))))) ;;;###autoload (defun xhtml-help-show-css-ref () "Show CSS reference for CSS property name at point." (interactive) (let ((css-prop (xhtml-help-css-prop-at-point))) (setq css-prop (read-from-minibuffer "Get help for CSS property: " css-prop)) (when css-prop (xhtml-help-browse-css css-prop)))) ;;;###autoload (defun xhtml-help-tag-at-point () "Get xhtml tag name at or before point." (save-excursion (when (eq (following-char) ?<) (forward-char)) (when (and (search-backward "<" nil t) (looking-at "