--- html-helper-mode-3.0.4kilo.orig/keybindings.html
+++ html-helper-mode-3.0.4kilo/keybindings.html
@@ -0,0 +1,196 @@
+
Keybindings for html-helper-mode version 1.34
+Keybindings for html-helper-mode version 1.34
+
+Note - this list might well not be up to date. Your best bet is to
+look at the mode help for html-helper-mode, C-hm from within the
+mode.
+
+Every keysequence here inserts some HTML or HTML+ cookie. The point is
+then placed where you want to type in the information for that
+cookie. If you call the command with a prefix argument (by typing
+C-u first), then instead the cookie is placed around the
+current region.
+
+
+Mode bindings
+
+TAB indent line
+RET insert newline and indent
+
+M-TAB complete tag at point
+M-C-f move forward one mark
+M-C-b move backward one mark
+
+M-C-t insert the timestamp delimiter
+
+
+
+
Common insertions
+
+M-RET html-paragraph <p>
+C-c- html-horizontal-rule <hr>
+C-cC-t# html-header-# <h#></h#>
+
+C-cC-al html-anchor <a href=""></a>
+
+C-cC-lu html-unordered-list <ul><li></ul>
+C-cC-ld html-definition-list <dl><dt><dd></dl>
+C-cC-li html-smart-insert-item <li> or <dt><dd> depending on context
+
+
+
+HTML insertion commands
+
+Every HTML and HTML+ cookie should have an insertion command. These
+commands can be used in two ways: by typing the beginning of the
+cookie and hitting M-TAB, for completion, or by typing it's
+somewhat-mnemonic keybinding.
+
+The keybindings aren't very good - I am constrained by emacs style to
+binding things only to C-cC-<letter>. Each class of HTML cookie is
+assigned to some particular C-cC-<letter>, and then within that map
+different letters insert different cookies.
+
+
+Prefix Cookie class
+------ ------------
+C-cC-b head element ("begin")
+C-cC-t headers ("title" - sorry, C-cC-h has a special meaning in emacs)
+C-cC-a anchors
+C-cC-s logical styles ("styles")
+C-cC-p physical styles
+C-cC-l lists
+C-cC-n annotations ("notes")
+C-cC-f forms
+C-cC-i images
+special text elements
+special entities
+
+
+Head elements - C-cC-b
+
+key template inserted text
+--- -------- -------------
+t html-title <title></title>
+i html-isindex <isindex>
+n html-nextid <nextid>
+l html-link <link href="">
+b html-base <base href="">
+
+Headers - C-cC-t
+
+1 html-header-1 <h1></h1>
+2 html-header-2 <h2></h2>
+3 html-header-3 <h3></h3>
+4 html-header-4 <h4></h4>
+5 html-header-5 <h5></h5>
+6 html-header-6 <h6></h6>
+
+
+Anchors - C-cC-a
+
+n html-target-anchor <a name=""></a>
+l html-anchor <a href=""></a>
+
+
+Logical styles - C-cC-s
+
+p html-preformatted <pre></pre>
+b html-blockquote <blockquote></blockquote>
+e html-emphasized <em></em>
+s html-strong <strong></strong>
+c html-code <code></code>
+x html-sample <samp></samp>
+r html-citation <cite></cite>
+k html-keyboard <kbd></kbd>
+v html-variable <var></var>
+d html-definition <dfn></dfn>
+a html-address <address></address>
+q html-quote <q></q>
+n html-person <person></person>
+y html-acronym <acronym></acronym>
+. html-abbrev <abbrev></abbrev>
+m html-cmd <cmd></cmd>
+g html-arg <arg></arg>
+l html-lit <lit></lit>
+
+
+Physical styles - C-cC-p
+
+b html-bold <b></b>
+i html-italic <i></i>
+u html-underline <u></u>
+f html-fixed <tt></tt>
+x html-strikethru <s></s>
+^ html-superscript <sup></sup>
+_ html-subscript <sub></sub>
+r html-render <render tag="" style="">
+
+
+Lists - C-cC-l
+
+o html-ordered-list <ol><li></ol>
+u html-unordered-list <ul><li></ul>
+r html-directory <dir><li></dir>
+m html-menu <menu><li></menu>
+d html-definition-list <dl><dt><dd></dl>
+i html-smart-insert-item <li> or <dt><dd> depending on context
+l html-item <li>
+t html-definition-item <dt><dd>
+
+
+Annotations - C-cC-n
+
+a html-abstract <abstract></abstract>
+n html-note <note role=""></note>
+f html-footnote <footnote></footnote>
+m html-margin <margin></margin>
+
+
+Forms - C-cC-f
+
+f html-form <form action=""></form>
+t html-input-text <input name="" size="">
+i html-input-int <input type="INT" name="" size="">
+. html-input-float <input type="FLOAT" name="" size="">
+d html-input-date <input type="DATE" name="" size="">
+u html-input-url <input type="URL" name="" size="">
+c html-input-check <input type="CHECKBOX" name="">
+r html-input-radio <input type="RADIO" name="">
+g html-input-image <input type="IMAGE" name="" src="">
+s html-input-scribble <input type="SCRIBBLE" name="" size="">
+a html-input-audio <input type="AUDIO" name="">
+b html-input-submit <input type="SUBMIT" value="">
+x html-input-reset <input type="RESET" value="">
+p html-input-textarea <textarea name="" rows= cols=></textarea>
+c html-input-select <select name=""></select>
+
+
+Images - C-cC-i
+
+i html-image <img src="">
+t html-alt-image <img alt="" src="">
+a html-align-image <img align="" src="">
+e html-align-alt-image <img align="" src="" alt="">
+
+
+Text Elements
+
+M-RET html-paragraph <p>
+C-c- html-horizontal-rule <hr>
+C-cRET html-break <br>
+
+
+Entities
+
+C-c& html-ampersand &
+C-c< html-less-than <
+C-c> html-greater-than >
+C-cSPC html-nonbreaking-space
+
+
+
+
+Last modified: Wed Feb 1 14:16:33 1995
+
+Nelson Minar <nelson@santafe.edu>
--- html-helper-mode-3.0.4kilo.orig/differences.html
+++ html-helper-mode-3.0.4kilo/differences.html
@@ -0,0 +1,52 @@
+Differences between html-mode and html-helper-mode
+Differences between html-mode and html-helper-mode
+
+There are several similarities between html-helper-mode and html-mode
+This isn't surprising, since my mode was inspired by
+html-mode. Here's an (incomplete) list of the differences:
+
+
+ - Insertion philosophy
+
- html-mode frequently prompts the user in the minibuffer for
+ the data to fill in fields like titles or headers.
+ In html-helper-mode, prompting is a user-controlled option.
+
+
- Modifying regions
+
- In html-helper-mode, every command will instead
+ modify the region if it is called with a prefix argument.
+
+
- Automatic text insertion
+
- html-helper-mode can automatically insert skeletons for
+ new documents and also maintain timestamps.
+
+
- Minimal syntax support
+
- html-helper-mode does its best to tell emacs about the syntax
+ of HTML documents.
+
+
- Indentation
+
- html-helper-mode indents nested lists
+
+
- Highlighting
+
- HTML cookies are coloured nicely with hilit19.
+
+
- Keymap
+
- A few obsolete cookies
+ have been removed, a few new cookies have been added, and
+ the keybindings have been completely rearranged to be compliant with
+ emacs standards.
+
+
- Completion
+
- HTML cookies can be completed in the buffer with M-TAB.
+
+
+
- Missing features
+
- Some features of html-mode are not included. These include the
+ ability to quotify old-style HREFs and automatic naming of anchors
+
+
+
+
+
+Last modified: Wed Feb 1 14:16:27 1995
+
+Nelson Minar <nelson@santafe.edu>
--- html-helper-mode-3.0.4kilo.orig/changelog.html
+++ html-helper-mode-3.0.4kilo/changelog.html
@@ -0,0 +1,196 @@
+
+Changes in html-helper-mode
+
+
+
+Changes in html-helper-mode
+
+I haven't been very careful about keeping this up to date. Sorry!
+
+
+1.13 - Original beta release
+
+
+1.34 - Second beta release
+New features:
+
+ - switched from boilerplate to tempo.
+
+ - cookies can now be more powerful (see tempo.el)
+
- optional prompting for fields
+
- M-C-b and M-C-f move between fields
+
- completion of cookies on M-TAB
+
- hook called on insertion
+
+ - indentation of lists
+
- HTML+ cookies (courtesy of David Kågedal)
+
- user control over what sort of timestamp is inserted
+
+
+Changes:
+
+ - New timestamp format (use M-C-t to insert the new delimiter)
+
- New keybindings, compliant with
+ emacs coding standards but awkward to type.
+
- more HTML compliant initial skeleton
+
+
+
+2.0 - first official release
+Changes:
+
+ - Added more image cookie options
+
+Post 2.0 betas
+2.2 - rms cleanups
+
+ - Improved docstrings, (provide 'html-mode) for 14 character filenames
+
+
+2.3 - menus
+
+ - Updated my location to @santafe.edu
+
- Added menu support (using easymenu)
+
- Changed format of cookie database a bit, renamed a few cookies
+
- Added timezone to timestamp
+
+
+2.4 - stupid bug fixes
+
+2.5 - modularization
+
+
+ - Added quot and # entities
+ - Made <p>, <li>, <dd>, <dt> containers. Bleah!
+ - Removed extraneous whitespace from <li>, etc. Changed default
+ indentation to account for this.
+ - Removed emacs18 support (sorry! Time for you to upgrade.)
+ - Reworked the keymap and menu scheme so types are modular, you
+ can add them later.. Lots
+ or reorganization of code, reordered cookie database, etc.
+
+
+2.6 - emacs18 added in again
+
+ - Added back in emacs18 support, grudgingly.
+ emacs18ers need auc-menu.el installed as "easymenu.el", and
+ some version of the add-hook function.
+ - Changed the paragraph tag to include a newline
+
+
+2.7 - HTML/2.0 compliance
+
+ - Added full HTML/2.0 compliance: removed old tags, added in new ones.
+ Thanks, Marc!
+
+
+2.8 - new indentation code
+
+ - Added in html-helper-htmldtd-version for the skeleton
+ - moved headers to C-cC-h to make C-cC-t free (why not before?)
+ - run text-mode-hook, html-mode-hook, html-load-hook
+ - change indentation logic around to make it clearer
+ - new type of list item, end of items
+ - give <select> and <option> stuff indentation like lists
+ - new form cookies, courtesy of Marc
+
+
+2.9 - menu cleanups
+
+ - Added in a novice menu, on by default.
+ - Cleaned up the menu presentation
+ - MAJOR CHANGE in the cookie format: the 3rd argument is
+ now the menu string (it is also coerced into a symbol to make
+ the function.)
+
+
+2.10
+
+ - a bit more hilit19 code: headers, titles, forms (no logical styles)
+ - move headers back from C-cC-h to C-cC-t. Sorry.
+ - Update tempo insertions from (p . foo) to (p foo)
+ - now looks in features to check for hilit19
+ - if you have 'browse-url loaded (forthcoming code) then
+ M-C-q and a menu item will bring up your current file in your
+ browser. There's also url-at-point, but we'll leave that to the
+ user to bind. Should we save file first? Probably no.
+
+ - skeletons and timestamps now on by default
+
+
+2.11
+
+ - More hilit19 changes: do comments right, change <h#> colouring
+ - Moved timestamp-delimiter to C-cC-zt and
+ browse-url-of-file to C-cC-zv to make things better.
+
+ - Mucked with menus: verbified, added in timestamps and toggling
+ to expert menu.
+
+
+2.12
+
+ - Better loading of easymenu and/or auc-menu
+ - Change logic for checking if browse-url, hilit19 are loaded
+ - Bind 'browse-url-at-point into keymap and menu
+ - More hilit19 regexp changes
+ - Call (easy-menu-add) and (easy-menu-remove) at the right times.
+
+
+2.13
+
+ - Changed all references to "cookie" into "tag"
+ - Cleaned up doc strings
+ - Fixed dumb easy-menu bug (affects XEmacs)
+ - Look at html-helper-user-menu when building expert menu, allow
+ users to add things in.
+
+
+2.14
+
+ - Got rid of </p>, </li>, </dd>, </dt>.
+ Best as I can tell, these are optional and too confusing. I
+ might make them into an add-on package.
+
+
+2.15
+
+ - Added in Ulrik Dickow's font-lock support. Many thanks to him
+ for his great work and infinite patience.
+
+
+2.16
+
+ - Updated Ulriks' font-lock code.
+
+
+2.17
+
+ - Added table indentation
+
+
+2.18
+
+ - small change to hilit19 entity pattern
+
- changed
html-helper-htmldtd-version
meaning to
+ include the entire comment.
+
+
+2.19
+
+ - Added
html-helper-mode-version
, changed the version
+ identification in the comments.
+
+
+2.19.1
+
+ - Included some font-lock regexp changes.
+
+
+
+
+
+(14 Nov 2000 at 15:57 CST)
+
+Nelson Minar <nelson@santafe.edu>
+
--- html-helper-mode-3.0.4kilo.orig/tempo.el
+++ html-helper-mode-3.0.4kilo/tempo.el
@@ -0,0 +1,688 @@
+;;; tempo.el --- Flexible template insertion
+;; Copyright (C) 1994 Free Software Foundation, Inc.
+
+;; Author: David K}gedal
+;; Created: 16 Feb 1994
+;; Version: 1.2.2
+;; Keywords: extensions, languages, tools
+;; $Revision: 1.32 $
+
+;; This file is part of GNU Emacs.
+
+;; GNU Emacs 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.
+
+;; GNU Emacs 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 GNU Emacs; see the file COPYING. If not, write to
+;; the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+
+;;; Commentary:
+
+;; This file provides a simple way to define powerful templates, or
+;; macros, if you wish. It is mainly intended for, but not limited to,
+;; other programmers to be used for creating shortcuts for editing
+;; certain kind of documents. It was originally written to be used by
+;; a HTML editing mode written by Nelson Minar ,
+;; and his html-helper-mode.el is probably the best example of how to
+;; use this program.
+
+;; A template is defined as a list of items to be inserted in the
+;; current buffer at point. Some of the items can be simple strings,
+;; while other can control formatting or define special points of
+;; interest in the inserted text.
+
+;; If a template defines a "point of interest" that point is inserted
+;; in a buffer-local list of "points of interest" that the user can
+;; jump between with the commands `tempo-backward-mark' and
+;; `tempo-forward-mark'. If the template definer provides a prompt for
+;; the point, and the variable `tempo-interactive' is non-nil, the
+;; user will be prompted for a string to be inserted in the buffer,
+;; using the minibuffer.
+
+;; The template can also define one point to be replaced with the
+;; current region if the template command is called with a prefix (or
+;; a non-nil argument).
+
+;; More flexible templates can be created by including lisp symbols,
+;; which will be evaluated as variables, or lists, which will will be
+;; evaluated as lisp expressions.
+
+;; See the documentation for tempo-define-template for the different
+;; items that can be used to define a tempo template.
+
+;; One of the more powerful features of tempo templates are automatic
+;; completion. With every template can be assigned a special tag that
+;; should be recognized by `tempo-complete-tag' and expanded to the
+;; complete template. By default the tags are added to a global list
+;; of template tags, and are matched against the last word before
+;; point. But if you assign your tags to a specific list, you can also
+;; specify another method for matching text in the buffer against the
+;; tags. In the HTML mode, for instance, the tags are matched against
+;; the text between the last `<' and point.
+
+;; When defining a template named `foo', a symbol named
+;; `tempo-template-foo' will be created whose value as a variable will
+;; be the template definition, and its function value will be an
+;; interactive function that inserts the template at the point.
+
+;; The latest tempo.el distribution can be fetched from
+;; ftp.lysator.liu.se in the directory /pub/emacs
+
+;;; Known bugs:
+
+;; If the 'o is the first element in a template, strange things can
+;; happen when the template is inserted at the beginning of a
+;; line. This is due to strange behaviour in open-line. But it should
+;; be easily avoided.
+
+;; The 'o tag is also a problem when including the region. This will
+;; be looked into.
+
+;; Clicking mouse-2 in the completion buffer gives strange results.
+
+;; There is a bug in some emacs versions that prevents completion from
+;; working. If it doesn't work for you, send me a note indicating your
+;; emacs version and your problems.
+
+;;; Contributors:
+
+;; These people have given me importand feedback and new ideas for
+;; tempo.el. Thanks.
+
+;; Nelson Minar
+;; Richard Stallman
+;; Lars Lindberg
+;; Glen Whitney
+
+;;; Code:
+
+;; (provide 'tempo)
+
+;;; User options
+
+(defvar tempo-interactive nil
+ "*Prompt user for strings in templates.
+If this variable is non-nil, `tempo-insert' prompts the
+user for text to insert in the templates")
+
+(defvar tempo-insert-region nil
+ "*Automatically insert current region when there is a `r' in the template
+If this variable is NIL, `r' elements will be treated just like `p'
+elements, unless the template function is given a prefix (or a non-nil
+argument). If this variable is non-NIL, the behaviour is reversed.
+
+In Transient Mark mode, this option is unused.")
+
+(defvar tempo-show-completion-buffer t
+ "*If non-NIL, show a buffer with possible completions, when only
+a partial completion can be found")
+
+(defvar tempo-leave-completion-buffer nil
+ "*If NIL, a completion buffer generated by \\[tempo-complete-tag]
+disappears at the next keypress; otherwise, it remains forever.")
+
+;;; Internal variables
+
+(defvar tempo-insert-string-functions nil
+ "List of functions to run when inserting a string.
+Each function is called with a single arg, STRING." )
+
+(defvar tempo-tags nil
+ "An association list with tags and corresponding templates")
+
+(defvar tempo-local-tags '((tempo-tags . nil))
+ "A list of locally installed tag completion lists.
+It is a association list where the car of every element is a symbol
+whose varable value is a template list. The cdr part, if non-nil, is a
+function or a regexp that defines the string to match. See the
+documentation for the function `tempo-complete-tag' for more info.
+
+`tempo-tags' is always in the last position in this list.")
+
+(defvar tempo-collection nil
+ "A collection of all the tags defined for the current buffer.")
+
+(defvar tempo-dirty-collection t
+ "Indicates if the tag collection needs to be rebuilt.")
+
+(defvar tempo-marks nil
+ "A list of marks to jump to with `\\[tempo-forward-mark]' and `\\[tempo-backward-mark]'.")
+
+(defvar tempo-match-finder "\\b\\([^\\b]+\\)\\="
+ "The regexp or function used to find the string to match against tags.
+
+If `tempo-match-finder is a string, it should contain a regular
+expression with at least one \\( \\) pair. When searching for tags,
+`tempo-complete-tag' calls `re-search-backward' with this string, and
+the string between the first \\( and \\) is used for matching against
+each string in the tag list. If one is found, the whole text between
+the first \\( and the point is replaced with the inserted template.
+
+You will probably want to include \\ \= at the end of the regexp to
+make sure that the string is matched only against text adjacent to the
+point.
+
+If `tempo-match-finder' is a symbol, it should be a function that
+returns a pair of the form (STRING . POS), where STRING is the string
+used for matching and POS is the buffer position after which text
+should be replaced with a template.")
+
+(defvar tempo-user-elements nil
+ "Element handlers for user-defined elements.
+A list of symbols which are bound to functions that take one argument.
+This function should return somthing to be sent to `tempo-insert' if
+it recognizes the argument, and NIL otherwise")
+
+(defvar tempo-named-insertions nil
+ "Temporary storage for named insertions")
+
+(defvar tempo-region-start (make-marker)
+ "Region start when inserting around the region")
+
+(defvar tempo-region-stop (make-marker)
+ "Region stop when inserting around the region")
+
+;; Make some variables local to every buffer
+
+(make-variable-buffer-local 'tempo-marks)
+(make-variable-buffer-local 'tempo-local-tags)
+(make-variable-buffer-local 'tempo-match-finder)
+(make-variable-buffer-local 'tempo-collection)
+(make-variable-buffer-local 'tempo-dirty-collection)
+
+;;; Functions
+
+;;; First some useful functions and macros
+
+(defun tempo-mapc (fun lst)
+ (if (null lst) nil
+ (funcall fun (car lst))
+ (tempo-mapc fun (cdr lst))))
+
+(defmacro tempo-dolist (il &rest forms)
+ (let ((i (car il))
+ (l (car (cdr il))))
+ (list 'tempo-mapc
+ (list 'function (append (list 'lambda
+ (list i))
+ forms))
+ (car (cdr il)))))
+(put 'tempo-dolist 'lisp-indent-function 1)
+
+;;
+;; tempo-define-template
+
+(defun tempo-define-template (name elements &optional tag documentation taglist)
+ "Define a template.
+This function creates a template variable `tempo-template-NAME' and an
+interactive function `tempo-template-NAME' that inserts the template
+at the point. The created function is returned.
+
+NAME is a string that contains the name of the template, ELEMENTS is a
+list of elements in the template, TAG is the tag used for completion,
+DOCUMENTATION is the documentation string for the insertion command
+created, and TAGLIST (a symbol) is the tag list that TAG (if provided)
+should be added to). If TAGLIST is nil and TAG is non-nil, TAG is
+added to `tempo-tags'
+
+The elements in ELEMENTS can be of several types:
+
+ - A string. It is sent to the hooks in `tempo-insert-string-functions',
+ and the result is inserted.
+ - The symbol 'p. This position is saved in `tempo-marks'.
+ - The symbol 'r. If `tempo-insert' is called with ON-REGION non-nil
+ the current region is placed here. Otherwise it works like 'p.
+ - (p PROMPT ) If `tempo-interactive' is non-nil, the user is
+ prompted in the minbuffer with PROMPT for a string to be inserted.
+ If the optional parameter NAME is non-nil, the text is saved for
+ later insertion with the `s' tag.
+ If `tempo-interactive' is nil, it works like 'p.
+ - (r PROMPT) like the previous, but if `tempo-interactive' is nil
+ and `tempo-insert' is called with ON-REGION non-nil, the current
+ region is placed here. This usually happens when you call the
+ template function with a prefix argument.
+ - (s NAME) Inserts text previously read with the (p ..) construct.
+ Finds the insertion saved under NAME and inserts it. Acts like 'p
+ if tempo-interactive is nil.
+ - '& If there is only whitespace between the line start and point,
+ nothing happens. Otherwise a newline is inserted.
+ - '% If there is only whitespace between point and end-of-line
+ nothing happens. Otherwise a newline is inserted.
+ - 'n inserts a newline.
+ - '> The line is indented using `indent-according-to-mode'. Note that
+ you often should place this item after the text you want on the
+ line.
+ - 'n> Inserts a newline and indents line.
+ - 'o Like '% but leaves the point before the newline.
+ - nil. It is ignored.
+ - Anything else. It is evaluated and the result is parsed again."
+
+ (let* ((template-name (intern (concat "tempo-template-"
+ name)))
+ (command-name template-name))
+ (set template-name elements)
+ (fset command-name (list 'lambda (list '&optional 'arg)
+ (or documentation
+ (concat "Insert a " name "."))
+ (list 'interactive "*P")
+ (list 'tempo-insert-template (list 'quote
+ template-name)
+ (list 'if 'tempo-insert-region
+ (list 'not 'arg) 'arg))))
+ (and tag
+ (tempo-add-tag tag template-name taglist))
+ command-name))
+
+;;;
+;;; tempo-insert-template
+
+(defun tempo-insert-template (template on-region)
+ "Insert a template.
+TEMPLATE is the template to be inserted. If ON-REGION is non-nil the
+`r' elements are replaced with the current region. In Transient Mark
+mode, ON-REGION is ignored and assumed true if the region is active."
+ (if (and (boundp 'transient-mark-mode)
+ transient-mark-mode
+ mark-active)
+ (setq on-region t))
+ (and on-region
+ (set-marker tempo-region-start (min (mark) (point)))
+ (set-marker tempo-region-stop (max (mark) (point))))
+ (if on-region
+ (goto-char tempo-region-start))
+ (save-excursion
+ (tempo-insert-mark (point-marker))
+ (mapcar (function (lambda (elt)
+ (tempo-insert elt on-region)))
+ (symbol-value template))
+ (tempo-insert-mark (point-marker)))
+ (tempo-forward-mark)
+ (tempo-forget-insertions)
+ (and (boundp 'transient-mark-mode)
+ transient-mark-mode
+ (deactivate-mark)))
+
+;;;
+;;; tempo-insert
+
+(defun tempo-insert (element on-region)
+ "Insert a template element.
+Insert one element from a template. If ON-REGION is non-nil the `r'
+elements are replaced with the current region.
+
+See documentation for `tempo-define-template' for the kind of elements
+possible."
+ (cond ((stringp element) (tempo-process-and-insert-string element))
+ ((and (consp element) (eq (car element) 'p))
+ (tempo-insert-prompt (cdr element)))
+ ((and (consp element) (eq (car element) 'P))
+ (let ((tempo-interactive t))
+ (tempo-insert-prompt (cdr element))))
+ ((and (consp element) (eq (car element) 'r))
+ (if on-region
+ (goto-char tempo-region-stop)
+ (tempo-insert-prompt (cdr element))))
+ ((and (consp element) (eq (car element) 's))
+ (tempo-insert-named (car (cdr element))))
+ ((and (consp element) (eq (car element) 'l))
+ (mapcar (function (lambda (elt) (tempo-insert elt on-region)))
+ (cdr element)))
+ ((eq element 'p) (tempo-insert-mark (point-marker)))
+ ((eq element 'r) (if on-region
+ (goto-char tempo-region-stop)
+ (tempo-insert-mark (point-marker))))
+ ((eq element 'r>) (if on-region
+ (progn
+ (goto-char tempo-region-stop)
+ (indent-region (mark) (point) nil))
+ (tempo-insert-mark (point-marker))))
+ ((eq element '>) (indent-according-to-mode))
+ ((eq element '&) (if (not (or (= (current-column) 0)
+ (save-excursion
+ (re-search-backward
+ "^\\s-*\\=" nil t))))
+ (insert "\n")))
+ ((eq element '%) (if (not (or (eolp)
+ (save-excursion
+ (re-search-forward
+ "\\=\\s-*$" nil t))))
+ (insert "\n")))
+ ((eq element 'n) (insert "\n"))
+ ((eq element 'n>) (insert "\n") (indent-according-to-mode))
+ ;; Bug: If the 'o is the first element in a template, strange
+ ;; things can happen when the template is inserted at the
+ ;; beginning of a line.
+ ((eq element 'o) (if (not (or on-region
+ (eolp)
+ (save-excursion
+ (re-search-forward
+ "\\=\\s-*$" nil t))))
+ (open-line 1)))
+ ((null element))
+ (t (tempo-insert (or (tempo-is-user-element element)
+ (eval element))
+ on-region))))
+
+;;;
+;;; tempo-insert-prompt
+
+(defun tempo-insert-prompt (prompt)
+ "Prompt for a text string and insert it in the current buffer.
+If the variable `tempo-interactive' is non-nil the user is prompted
+for a string in the minibuffer, which is then inserted in the current
+buffer. If `tempo-interactive' is nil, the current point is placed on
+`tempo-mark'.
+
+PROMPT is the prompt string or a list containing the prompt string and
+a name to save the inserted text under."
+ (if tempo-interactive
+ (let ((prompt-string (if (listp prompt)
+ (car prompt)
+ prompt))
+ (save-name (and (listp prompt) (nth 1 prompt)))
+ inserted-text)
+
+ (progn
+ (sit-for 0)
+ (setq inserted-text (read-string prompt-string))
+ (insert inserted-text)
+ (if save-name
+ (tempo-remember-insertion save-name inserted-text))))
+ (tempo-insert-mark (point-marker))))
+
+;;;
+;;; tempo-is-user-element
+
+(defun tempo-is-user-element (element)
+ "Tries all the user-defined element handlers in
+`tempo-user-elements'"
+ ;; Sigh... I need (some list)
+ (catch 'found
+ (mapcar (function (lambda (handler)
+ (let ((result (funcall handler element)))
+ (if result (throw 'found result)))))
+ tempo-user-elements)
+ (throw 'found nil)))
+
+;;;
+;;; tempo-remember-insertion
+
+(defun tempo-remember-insertion (save-name string)
+ "Save the text in STRING under the name SAVE-NAME for later retrieval."
+ (setq tempo-named-insertions (cons (cons save-name string)
+ tempo-named-insertions)))
+
+;;;
+;;; tempo-forget-insertions
+
+(defun tempo-forget-insertions ()
+ "Forget all the saved named insertions."
+ (setq tempo-named-insertions nil))
+
+;;;
+;;; tempo-insert-named
+
+(defun tempo-insert-named (name)
+ "Insert the previous insertion saved under a named specified in NAME.
+If there is no such name saved, a tempo mark is inserted."
+ (let* ((insertion (cdr (assq name tempo-named-insertions))))
+ (if insertion
+ (insert insertion)
+ (tempo-insert-mark (point-marker)))))
+
+;;;
+;;; tempo-process-and-insert-string
+
+(defun tempo-process-and-insert-string (string)
+ "Insert a string from a template.
+Run a string through the preprocessors in `tempo-insert-string-functions'
+and insert the results."
+ (cond ((null tempo-insert-string-functions)
+ nil)
+ ((symbolp tempo-insert-string-functions)
+ (setq string
+ (funcall tempo-insert-string-functions string)))
+ ((listp tempo-insert-string-functions)
+ (tempo-dolist (fn tempo-insert-string-functions)
+ (setq string (funcall fn string))))
+ (t
+ (error "Bogus value in tempo-insert-string-functions: %s"
+ tempo-insert-string-functions)))
+ (insert string))
+
+;;;
+;;; tempo-insert-mark
+
+(defun tempo-insert-mark (mark)
+ "Insert a mark `tempo-marks' while keeping it sorted"
+ (cond ((null tempo-marks) (setq tempo-marks (list mark)))
+ ((< mark (car tempo-marks)) (setq tempo-marks (cons mark tempo-marks)))
+ (t (let ((lp tempo-marks))
+ (while (and (cdr lp)
+ (<= (car (cdr lp)) mark))
+ (setq lp (cdr lp)))
+ (if (not (= mark (car lp)))
+ (setcdr lp (cons mark (cdr lp))))))))
+
+;;;
+;;; tempo-forward-mark
+
+(defun tempo-forward-mark ()
+ "Jump to the next mark in `tempo-forward-mark-list'."
+ (interactive)
+ (let ((next-mark (catch 'found
+ (mapcar
+ (function
+ (lambda (mark)
+ (if (< (point) mark)
+ (throw 'found mark))))
+ tempo-marks)
+ ;; return nil if not found
+ nil)))
+ (if next-mark
+ (goto-char next-mark))))
+
+;;;
+;;; tempo-backward-mark
+
+(defun tempo-backward-mark ()
+ "Jump to the previous mark in `tempo-back-mark-list'."
+ (interactive)
+ (let ((prev-mark (catch 'found
+ (let (last)
+ (mapcar
+ (function
+ (lambda (mark)
+ (if (<= (point) mark)
+ (throw 'found last))
+ (setq last mark)))
+ tempo-marks)
+ last))))
+ (if prev-mark
+ (goto-char prev-mark))))
+
+;;;
+;;; tempo-add-tag
+
+(defun tempo-add-tag (tag template &optional tag-list)
+ "Add a template tag.
+Add the TAG, that should complete to TEMPLATE to the list in TAG-LIST,
+or to `tempo-tags' if TAG-LIST is nil."
+
+ (interactive "sTag: \nCTemplate: ")
+ (if (null tag-list)
+ (setq tag-list 'tempo-tags))
+ (if (not (assoc tag (symbol-value tag-list)))
+ (set tag-list (cons (cons tag template) (symbol-value tag-list))))
+ (tempo-invalidate-collection))
+
+;;;
+;;; tempo-use-tag-list
+
+(defun tempo-use-tag-list (tag-list &optional completion-function)
+ "Install TAG-LIST to be used for template completion in the current buffer.
+TAG-LIST is a symbol whose variable value is a tag list created with
+`tempo-add-tag'.
+
+COMPLETION-FUNCTION is an obsolete option for specifyingis an optional
+function or string that is used by `\\[tempo-complete-tag]' to find a
+string to match the tag against. It has the same definition as the
+variable `tempo-match-finder'. In this version, supplying a
+COMPLETION-FUNCTION just sets `tempo-match-finder' locally."
+ (let ((old (assq tag-list tempo-local-tags)))
+ (if old
+ (setcdr old completion-function)
+ (setq tempo-local-tags (cons (cons tag-list completion-function)
+ tempo-local-tags))))
+ (if completion-function
+ (setq tempo-match-finder completion-function))
+ (tempo-invalidate-collection))
+
+;;;
+;;; tempo-invalidate-collection
+
+(defun tempo-invalidate-collection ()
+ "Marks the tag collection as obsolete.
+Whenever it is needed again it will be rebuilt."
+ (setq tempo-dirty-collection t))
+
+;;;
+;;; tempo-build-collection
+
+(defun tempo-build-collection ()
+ "Build a collection of all the tags and return it.
+If `tempo-dirty-collection' is NIL, the old collection is reused."
+ (prog1
+ (or (and (not tempo-dirty-collection)
+ tempo-collection)
+ (setq tempo-collection
+ (apply (function append)
+ (mapcar (function (lambda (tag-list)
+ ; If the format for
+ ; tempo-local-tags changes,
+ ; change this
+ (eval (car tag-list))))
+ tempo-local-tags))))
+ (setq tempo-dirty-collection nil)))
+
+;;;
+;;; tempo-find-match-string
+
+(defun tempo-find-match-string (finder)
+ "Find a string to be matched against a tag list.
+FINDER is a function or a string. Returns (STRING . POS), or nil
+if no reasonable string is found."
+ (cond ((stringp finder)
+ (let (successful)
+ (save-excursion
+ (or (setq successful (re-search-backward finder nil t))
+ 0))
+ (if successful
+ (cons (buffer-substring (match-beginning 1)
+ (match-end 1)) ; This seems to be a
+ ; bug in emacs
+ (match-beginning 1))
+ nil)))
+ (t
+ (funcall finder))))
+
+;;;
+;;; tempo-complete-tag
+
+(defun tempo-complete-tag (&optional silent)
+ "Look for a tag and expand it.
+All the tags in the tag lists in `tempo-local-tags'
+ (this includes `tempo-tags') are searched for a match for the text
+before the point. The way the string to match for is determined can
+be altered with the variable `tempo-match-finder'. If
+`tempo-match-finder' returns nil, then the results are the same as
+no match at all.
+
+If a single match is found, the corresponding template is expanded in
+place of the matching string.
+
+If a partial completion or no match at all is found, and SILENT is
+non-NIL, the function will give a signal.
+
+If a partial completion is found and `tempo-show-completion-buffer' is
+non-NIL, a buffer containing possible completions is displayed."
+
+ ;; This function may look like a hack, but this is how I want it to
+ ;; work.
+ (interactive "*")
+ (let* ((collection (tempo-build-collection))
+ (match-info (tempo-find-match-string tempo-match-finder))
+ (match-string (car match-info))
+ (match-start (cdr match-info))
+ (exact (assoc match-string collection))
+ (compl (or (car exact)
+ (and match-info (try-completion match-string collection)))))
+ (if compl (delete-region match-start (point)))
+ (cond ((null match-info) (or silent (ding)))
+ ((null compl) (or silent (ding)))
+ ((eq compl t) (tempo-insert-template
+ (cdr (assoc match-string
+ collection))
+ nil))
+ (t (if (setq exact (assoc compl collection))
+ (tempo-insert-template (cdr exact) nil)
+ (insert compl)
+ (or silent (ding))
+ (if tempo-show-completion-buffer
+ (tempo-display-completions match-string
+ collection)))))))
+
+
+;;;
+;;; tempo-display-completions
+
+(defun tempo-display-completions (string tag-list)
+ "Show a buffer containing possible completions for STRING."
+ (if tempo-leave-completion-buffer
+ (with-output-to-temp-buffer "*Completions*"
+ (display-completion-list
+ (all-completions string tag-list)))
+ (save-window-excursion
+ (with-output-to-temp-buffer "*Completions*"
+ (display-completion-list
+ (all-completions string tag-list)))
+ (sit-for 32767))))
+
+;;;
+;;; tempo-expand-if-complete
+
+(defun tempo-expand-if-complete ()
+ "Expand the tag before point if it is complete.
+Returns non-nil if an expansion was made and nil otherwise.
+
+This could as an example be used in a command that is bound to the
+space bar, and looks something like this:
+
+(defun tempo-space ()
+ (interactive \"*\")
+ (or (tempo-expand-if-complete)
+ (insert \" \")))"
+
+ (interactive "*")
+ (let* ((collection (tempo-build-collection))
+ (match-info (tempo-find-match-string tempo-match-finder))
+ (match-string (car match-info))
+ (match-start (cdr match-info))
+ (exact (assoc match-string collection)))
+ (if exact
+ (progn
+ (delete-region match-start (point))
+ (tempo-insert-template (cdr exact) nil)
+ t)
+ nil)))
+
+(provide 'tempo)
+
+;;; tempo.el ends here
--- html-helper-mode-3.0.4kilo.orig/index.html
+++ html-helper-mode-3.0.4kilo/index.html
@@ -0,0 +1,107 @@
+
+html-helper-mode
+
+
+
+html-helper-mode
+
+(Please note: This is the documentation for the last "release" version
+of html-helper-mode. Information about this "beta" release can be
+found in index-beta.html.)
+
+html-helper-mode is an emacs mode to make editing HTML
+files easier, inspired by Marc Andreessen's html-mode. html-helper-mode does
+most of the things that html-mode does, but with a slightly different
+interface and lots of new features.
+
+To use this mode, you need two lisp files:
+
+
+You might also like to try this user-contributed code by
+Ulrik Dickow for
+font-lock support.
+
+
+
+Put these files in your load-path and byte compile them (if
+you want). Then arrange for html-helper-mode to be loaded: the easiest
+way is to put this in your .emacs:
+
+
+ (autoload 'html-helper-mode "html-helper-mode" "Yay HTML" t)
+ (setq auto-mode-alist (cons '("\\.html$" . html-helper-mode) auto-mode-alist))
+
+Alternately, you can get an entire distribution of html-helper-mode,
+including these HTML documents, as
+html-helper-mode.tar.gz.
+
+
+
+
+NEW: the version of tempo.el I am now distributing is version 1.2.
+There are lots of new things in this version: the relevant change here is
+the completion code has been updated to be consistent with post emacs-19.26
+definitions of the \= regexp token. If completion wasn't working
+before, try this version. I still have version 1.0
+around if you need it.
+
+
+
+You can get there from here
+
+
+
+Acknowledgements
+Many thanks to David
+Kågedal <davidk@lysator.liu.se> for coming along at just
+the right time with tempo.el, the basic template code that underlies
+html-helper-mode. Many of the neat features like completion and field
+support are because of his good design and programming.
+
+Thanks to Ulrik Dickow for his font-lock code.
+
+Thanks to the author of cc-mode, Barry Warsaw <baw@anthem.nlm.nih.gov>,
+his code provided a useful guide in writing this mode (not to
+mention saving me many hours of formatting C, C++, and Objective C!)
+
+My appreciation to Marc Andreessen <marca@netscape.com>, the
+author of the original html-mode.
+
+And finally, many thanks to the various people on the net who have been
+offering encouragement, suggestions, and example code. Y'all're the main
+reason I'm writing this, and the main reason it's usable.
+
+
+New HTML document writers should read something like the
+HTML
+primer. The references at the bottom of the primer are all worth
+following. Yahoo has
+a good index of
+HTML info
+on the Web.
+
+
+Comments and suggestions are highly encouraged.
+
Nelson Minar <nelson@santafe.edu>
+
+Last modified: Tue Feb 28 10:32:13 1995
+
+
--- html-helper-mode-3.0.4kilo.orig/index-beta.html
+++ html-helper-mode-3.0.4kilo/index-beta.html
@@ -0,0 +1,274 @@
+
+HTML helper mode beta
+
+
+
+HTML helper mode beta
+
+This is technically beta code, but is quite stable. Don't let the
+"beta" scare you. For news and documentation for 2.19.1.1, see the main web page for hhm.
+
+News 5/17/00 Ben Tindale has kindly contributed
+
+code for JSP tags.
+
+
+
+DOWNLOADING NOTE: some browsers (notably lynx, and some versions
+of netscape) have trouble saving html-helper-mode correctly: they
+corrupt files with long lines. You'll have better luck if you can save
+the file to disk without displaying it first (shift-click in Netscape,
+capital D in lynx). Sorry about that, can't help buggy browsers.
+
+
+
+Major new features
+See change log below for more detail.
+
+ - Font-lock support, thanks to
+ Ulrik Dickow!
+
+
- Menus. Yes, I've finally done menus.
+
+ - User-extensible tag database!
+ See the accompanying documentation
+ for information, as well as the
+ user contributed extensions.
+
+
- HTML 2.0 compliance
+
+ - Integration with
+ browse-url.
+ Load or autoload browse-url first, then C-cC-zv will load the
+ current buffer up in your browser. Previewing!
+
+
+Todo
+
+ - consider using write-contents-hooks
+
- fix indentation code to handle tag attributes
+ (quick fix - match "<li" instead of "<li>", but that has bad
+ potential consequences).
+
- decide about doctype string (2.0, 3.0, some hybrid?)
+
- decide about </li> and </p>
+
- update docs
+
+ - Document new features (Based on changelog): configuration, et al.
+ - how to deal with browse-url
+ - explain how to do upcasing of tags (ick)
+
- explain which HTML spec we're using.
+
- hints for European character sets (iso-acc mode, no need
+ to do anything HTML specific). Link
+ http://ppewww.ph.gla.ac.uk/%7Eflavell/iso8859/iso8859-pointers.html
+
+
+
+
+Notes for various emacsen
+
+
+ - GNU emacs 19
+ - I develop this code under emacs 19.29, so it should work fine
+ there. It should work fine on most modern emacs 19s, although
+ some not-so-old versions had a different completion behaviour.
+
+ Note if you save your files with C-xC-w (write-file)
+ then local-write-file-hooks
isn't run, which means
+ timestamps don't update. (Even worse, the variable is cleared!).
+ C-xC-s (save-file) does run
+ the hook and the timestamps are updated. I don't understand why
+ write-file
+ doesn't run the local-write-file-hooks, but I recommend using
+ save-file instead.
+
+
+ - XEmacs 19
+ - I intend this code to work under XEmacs, and I've heard
+ occasional reports that it works.
+
+
+ - GNU emacs 18
+ - I think this code still works under emacs 18, but you should
+ definitely upgrade to 19. Now that the FSF boycott of Apple is
+ over, some enterprising person should get cracking on porting
+ emacs 19 to the Macintosh. To run under emacs 18, you will need
+ to have a definition of
+ add-hook
+ loaded, and you will need to have
+ auc-menu.el
+ installed.
+
+
+
+Special Menu Note: there are two packages that provide the same
+menuing interfaces: auc-menu and easymenu. Unfortunately, they don't
+all work the same. Recent versions of GNU emacs 19 and XEmacs 19 both
+come with easymenu as part of the standard lisp library. If you are
+having menu troubles, verify that the shipped easymenu is being
+loaded: not any versions of auc-menu or easymenu that you might have
+lying around elsewhere (from auc-tex, in particular). Emacs 18 people
+still need to use auc-menu (which just stubs the functions so they do nothing).
+
+
Changes
+
+2.2 - rms cleanups
+
+ - Improved docstrings, (provide 'html-mode) for 14 character filenames
+
+
+2.3 - menus
+
+ - Updated my location to @santafe.edu
+
- Added menu support (using easymenu)
+
- Changed format of cookie database a bit, renamed a few cookies
+
- Added timezone to timestamp
+
+
+2.4 - stupid bug fixes
+
+2.5 - modularization
+
+
+ - Added quot and # entities
+ - Made <p>, <li>, <dd>, <dt> containers. Bleah!
+ - Removed extraneous whitespace from <li>, etc. Changed default
+ indentation to account for this.
+ - Removed emacs18 support (sorry! Time for you to upgrade.)
+ - Reworked the keymap and menu scheme so types are modular, you
+ can add them later.. Lots
+ or reorganization of code, reordered cookie database, etc.
+
+
+2.6 - emacs18 added in again
+
+ - Added back in emacs18 support, grudgingly.
+ emacs18ers need auc-menu.el installed as "easymenu.el", and
+ some version of the add-hook function.
+ - Changed the paragraph tag to include a newline
+
+
+2.7 - HTML/2.0 compliance
+
+ - Added full HTML/2.0 compliance: removed old tags, added in new ones.
+ Thanks, Marc!
+
+
+2.8 - new indentation code
+
+ - Added in html-helper-htmldtd-version for the skeleton
+ - moved headers to C-cC-h to make C-cC-t free (why not before?)
+ - run text-mode-hook, html-mode-hook, html-load-hook
+ - change indentation logic around to make it clearer
+ - new type of list item, end of items
+ - give <select> and <option> stuff indentation like lists
+ - new form cookies, courtesy of Marc
+
+
+2.9 - menu cleanups
+
+ - Added in a novice menu, on by default.
+ - Cleaned up the menu presentation
+ - MAJOR CHANGE in the cookie format: the 3rd argument is
+ now the menu string (it is also coerced into a symbol to make
+ the function.)
+
+
+2.10
+
+ - a bit more hilit19 code: headers, titles, forms (no logical styles)
+ - move headers back from C-cC-h to C-cC-t. Sorry.
+ - Update tempo insertions from (p . foo) to (p foo)
+ - now looks in features to check for hilit19
+ - if you have 'browse-url loaded (forthcoming code) then
+ M-C-q and a menu item will bring up your current file in your
+ browser. There's also url-at-point, but we'll leave that to the
+ user to bind. Should we save file first? Probably no.
+
+ - skeletons and timestamps now on by default
+
+
+2.11
+
+ - More hilit19 changes: do comments right, change <h#> colouring
+ - Moved timestamp-delimiter to C-cC-zt and
+ browse-url-of-file to C-cC-zv to make things better.
+
+ - Mucked with menus: verbified, added in timestamps and toggling
+ to expert menu.
+
+
+2.12
+
+ - Better loading of easymenu and/or auc-menu
+ - Change logic for checking if browse-url, hilit19 are loaded
+ - Bind 'browse-url-at-point into keymap and menu
+ - More hilit19 regexp changes
+ - Call (easy-menu-add) and (easy-menu-remove) at the right times.
+
+
+2.13
+
+ - Changed all references to "cookie" into "tag"
+ - Cleaned up doc strings
+ - Fixed dumb easy-menu bug (affects XEmacs)
+ - Look at html-helper-user-menu when building expert menu, allow
+ users to add things in.
+
+
+2.14
+
+ - Got rid of </p>, </li>, </dd>, </dt>.
+ Best as I can tell, these are optional and too confusing. I
+ might make them into an add-on package.
+
+
+2.15
+
+ - Added in Ulrik Dickow's font-lock support. Many thanks to him
+ for his great work and infinite patience.
+
+
+2.16
+
+ - Updated Ulriks' font-lock code.
+
+
+2.17
+
+ - Added table indentation
+
+
+2.18
+
+ - small change to hilit19 entity pattern
+
- changed
html-helper-htmldtd-version
meaning to
+ include the entire comment.
+
+
+2.19
+
+ - Added
html-helper-mode-version
, changed the version
+ identification in the comments.
+
+
+2.19.1
+
+ - Included some font-lock regexp changes.
+
+
+
+
+
--- html-helper-mode-3.0.4kilo.orig/visual-basic-mode.el
+++ html-helper-mode-3.0.4kilo/visual-basic-mode.el
@@ -0,0 +1,858 @@
+;; visual-basic-mode.el --- A mode for editing Visual Basic programs.
+
+;; Copyright (C) 1996 Fred White
+
+;; Author: Fred White
+;; Version: 1.3 (May 1, 1996)
+;; Keywords: languages basic
+
+;; (Old) LCD Archive Entry:
+;; basic-mode|Fred White|fwhite@alum.mit.edu|
+;; A mode for editing Visual Basic programs.|
+;; 18-Apr-96|1.0|~/modes/basic-mode.el.Z|
+
+;; This file is NOT part of GNU Emacs but the same permissions apply.
+;;
+;; GNU Emacs 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.
+;;
+;; GNU Emacs 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 GNU Emacs; see the file COPYING. If not, write to the
+;; Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+;; 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 of the
+;; License, or (at your option) any later version.
+
+
+;; Purpose of this package:
+;; This is a mode for editing programs written in The World's Most
+;; Successful Programming Language. It features automatic
+;; indentation, font locking, keyword capitalization, and some minor
+;; convenience functions.
+
+;; Installation instructions
+;; Put basic-mode.el somewhere in your path, compile it, and add the
+;; following to your init file:
+
+;; (autoload 'visual-basic-mode "visual-basic-mode" "Visual Basic mode." t)
+;; (setq auto-mode-alist (append '(("\\.\\(frm\\|bas\\|cls\\)$" .
+;; visual-basic-mode)) auto-mode-alist))
+
+;; Of course, under Windows 3.1, you'll have to name this file
+;; something shorter than visual-basic-mode.el
+
+;; Revisions:
+;; 1.0 18-Apr-96 Initial version
+;; 1.1 Accomodate emacs 19.29+ font-lock-defaults
+;; Simon Marshall
+; 1.2 Rename to visual-basic-mode
+;; 1.3 Fix some indentation bugs.
+;; changes by G.U. Lauri
+;; 1.4 Added automatic header comment construction.
+;; vorking out origina code coming from NTEmacs Mailing List
+
+;; Known bugs:
+;; Doesn't know about ":" separated stmts
+;; Doesn't know about single-line IF stmts
+
+
+;; todo:
+;; fwd/back-compound-statement
+;; completion over OCX methods and properties.
+;; ensure Then at the end of IF statements.
+;; IDE integration
+;; etc.
+
+
+(provide 'visual-basic-mode)
+
+(defvar visual-basic-xemacs-p (string-match "XEmacs\\|Lucid" (emacs-version)))
+(defvar visual-basic-winemacs-p (string-match "Win-Emacs" (emacs-version)))
+(defvar visual-basic-win32-p (eq window-system 'win32))
+
+;; Variables you may want to customize.
+(defvar visual-basic-mode-indent 4 "*Default indentation per nesting level")
+(defvar visual-basic-fontify-p t "*Whether to fontify Basic buffers.")
+(defvar visual-basic-capitalize-keywords-p t
+ "*Whether to capitalize BASIC keywords.")
+(defvar visual-basic-wild-files "*.frm *.bas *.cls"
+ "*Wildcard pattern for BASIC source files")
+(defvar visual-basic-ide-pathname nil
+ "*The full pathname of your Visual Basic exe file, if any.")
+
+
+(defvar visual-basic-keywords-to-highlight
+ '("Dim" "If" "Then" "Else" "ElseIf" "End If")
+ "*A list of keywords to highlight in Basic mode, or T, meaning all keywords")
+
+(defvar visual-basic-defn-templates
+ (list "Public Sub ()\nEnd Sub\n\n"
+ "Public Function () As Variant\nEnd Function\n\n"
+ "Public Property Get ()\nEnd Property\n\n")
+ "*List of function templates though which visual-basic-new-sub cycles.")
+
+
+
+(defvar visual-basic-mode-syntax-table nil)
+(if visual-basic-mode-syntax-table
+ ()
+ (setq visual-basic-mode-syntax-table (make-syntax-table))
+ (modify-syntax-entry ?\' "\<" visual-basic-mode-syntax-table) ; Comment starter
+ (modify-syntax-entry ?\n ">" visual-basic-mode-syntax-table)
+ (modify-syntax-entry ?\\ "w" visual-basic-mode-syntax-table)
+ (modify-syntax-entry ?_ "w" visual-basic-mode-syntax-table))
+
+
+(defvar visual-basic-mode-map nil)
+(if visual-basic-mode-map
+ ()
+ (setq visual-basic-mode-map (make-sparse-keymap))
+ (define-key visual-basic-mode-map "\t" 'visual-basic-indent-line)
+ (define-key visual-basic-mode-map "\r" 'visual-basic-newline-and-indent)
+ (define-key visual-basic-mode-map "\M-\C-a" 'visual-basic-beginning-of-defun)
+ (define-key visual-basic-mode-map "\M-\C-e" 'visual-basic-end-of-defun)
+ (define-key visual-basic-mode-map "\M-\C-h" 'visual-basic-mark-defun)
+ (define-key visual-basic-mode-map "\M-\C-\\" 'visual-basic-indent-region)
+ (define-key visual-basic-mode-map "\M-q" 'visual-basic-fill-or-indent)
+ (define-key visual-basic-mode-map "\M-\C-q" 'visual-basic-comment-function)
+ (cond (visual-basic-winemacs-p
+ (define-key visual-basic-mode-map '(control C) 'visual-basic-start-ide))
+ (visual-basic-win32-p
+ (define-key visual-basic-mode-map (read "[?\\S-\\C-c]") 'visual-basic-start-ide)))
+ (if visual-basic-xemacs-p
+ (progn
+ (define-key visual-basic-mode-map "\M-G" 'visual-basic-grep)
+ (define-key visual-basic-mode-map '(meta backspace) 'backward-kill-word)
+ (define-key visual-basic-mode-map '(control meta /) 'visual-basic-new-sub))))
+
+
+;; These abbrevs are valid only in a code context.
+(defvar visual-basic-mode-abbrev-table nil)
+
+(defvar visual-basic-mode-hook ())
+
+
+;; Is there a way to case-fold all regexp matches?
+
+(defconst visual-basic-defun-start-regexp
+ (concat
+ "^[ \t]*\\([Pp]ublic \\|[Pp]rivate \\|[Ss]tatic \\)*"
+ "\\([Ss]ub\\|[Ff]unction\\|[Pp]roperty +[GgSsLl]et\\|[Tt]ype\\)"
+ "[ \t]+\\(\\w+\\)[ \t]*(?"))
+
+(defconst visual-basic-defun-end-regexp
+ "^[ \t]*[Ee]nd \\([Ss]ub\\|[Ff]unction\\|[Pp]roperty\\|[Tt]ype\\)")
+
+
+;; Includes the compile-time #if variation.
+(defconst visual-basic-if-regexp "^[ \t]*#?[Ii]f")
+(defconst visual-basic-else-regexp "^[ \t]*#?[Ee]lse\\([Ii]f\\)?")
+(defconst visual-basic-endif-regexp "[ \t]*#?[Ee]nd[ \t]*[Ii]f")
+
+(defconst visual-basic-continuation-regexp "^.*\\_[ \t]*$")
+(defconst visual-basic-label-regexp "^[ \t]*[a-zA-Z0-9_]+:$")
+
+(defconst visual-basic-select-regexp "^[ \t]*[Ss]elect[ \t]+[Cc]ase")
+(defconst visual-basic-case-regexp "^[ \t]*[Cc]ase")
+(defconst visual-basic-select-end-regexp "^[ \t]*[Ee]nd[ \t]+[Ss]elect")
+
+(defconst visual-basic-for-regexp "^[ \t]*[Ff]or\\b")
+(defconst visual-basic-next-regexp "^[ \t]*[Nn]ext\\b")
+
+(defconst visual-basic-do-regexp "^[ \t]*[Dd]o\\b")
+(defconst visual-basic-loop-regexp "^[ \t]*[Ll]oop\\b")
+
+(defconst visual-basic-while-regexp "^[ \t]*[Ww]hile\\b")
+(defconst visual-basic-wend-regexp "^[ \t]*[Ww]end\\b")
+
+(defconst visual-basic-with-regexp "^[ \t]*[Ww]ith\\b")
+(defconst visual-basic-end-with-regexp "^[ \t]*[Ee]nd[ \t]+[Ww]ith\\b")
+
+(defconst visual-basic-blank-regexp "^[ \t]*$")
+(defconst visual-basic-comment-regexp "^[ \t]*\\s<.*$")
+
+
+;; This is some approximation of the set of reserved words in Visual Basic.
+(defconst visual-basic-all-keywords
+ '("Aggregate" "And" "App" "AppActivate" "Application" "Array" "As"
+ "Asc" "AscB" "Atn" "Beep" "BeginTrans" "Boolean" "ByVal" "CBool"
+ "CByte" "CCur"
+ "CDate" "CDbl" "CInt" "CLng" "CSng" "CStr" "CVErr" "CVar" "Call"
+ "Case" "ChDir" "ChDrive" "Character" "Choose" "Chr" "ChrB"
+ "ClassModule" "Clipboard" "Close" "Collection" "Column" "Columns"
+ "Command" "CommitTrans" "CompactDatabase" "Component" "Components"
+ "Const" "Container" "Containers" "Cos" "CreateDatabase" "CreateObject"
+ "CurDir" "Currency" "DBEngine" "DDB" "Data" "Database" "Databases"
+ "Date" "DateAdd" "DateDiff" "DatePart" "DateSerial" "DateValue" "Day"
+ "Debug" "Declare" "Deftype" "DeleteSetting" "Dim" "Dir" "Do" "Domain"
+ "Double" "Dynaset" "EOF" "Each" "Else" "ElseIf" "End" "Environ"
+ "Erase" "Err"
+ "Error" "Exit" "Exp" "FV" "False" "Field" "Fields" "FileAttr"
+ "FileCopy" "FileDateTime" "FileLen" "Fix" "Font" "For" "Form"
+ "FormTemplate" "Format" "Forms" "FreeFile" "FreeLocks" "Function"
+ "Get" "GetAllSettings" "GetAttr" "GetObject" "GetSetting" "GoSub"
+ "GoTo" "Group" "Groups" "Hex" "Hour" "IIf" "IMEStatus" "IPmt" "IRR"
+ "If" "InStr" "Input" "Int" "Integer" "Is" "IsArray" "IsDate" "IsEmpty"
+ "IsError" "IsMissing" "IsNull" "IsNumeric" "IsObject" "Kill" "LBound"
+ "LCase" "LOF" "LSet" "LTrim" "Left" "Len" "Let" "Like" "Line" "Load"
+ "LoadPicture" "LoadResData" "LoadResPicture" "LoadResString" "Loc"
+ "Lock" "Log" "Long" "Loop" "MDIForm" "MIRR" "Me" "MenuItems"
+ "MenuLine" "Mid" "Minute" "MkDir" "Month" "MsgBox" "NPV" "NPer" "Name"
+ "New" "Next" "Now" "Oct" "On" "Open" "OpenDatabase" "Operator"
+ "Option" "PPmt" "PV" "Parameter" "Parameters" "Partition" "Picture"
+ "Pmt" "Print" "Printer" "Printers" "Private" "ProjectTemplate"
+ "Properties" "Public" "Put" "QBColor" "QueryDef" "QueryDefs"
+ "RSet" "RTrim" "Randomize" "Rate" "ReDim" "Recordset" "Recordsets"
+ "RegisterDatabase" "Relation" "Relations" "Rem" "RepairDatabase"
+ "Reset" "Resume" "Return" "Right" "RmDir" "Rnd" "Rollback" "RowBuffer"
+ "SLN" "SYD" "SavePicture" "SaveSetting" "Screen" "Second" "Seek"
+ "SelBookmarks" "Select" "SelectedComponents" "SendKeys" "Set"
+ "SetAttr" "SetDataAccessOption" "SetDefaultWorkspace" "Sgn" "Shell"
+ "Sin" "Single" "Snapshot" "Space" "Spc" "Sqr" "Static" "Stop" "Str"
+ "StrComp" "StrConv" "String" "Sub" "SubMenu" "Switch" "Tab" "Table"
+ "TableDef" "TableDefs" "Tan" "Then" "Time" "TimeSerial" "TimeValue"
+ "Timer" "To" "Trim" "True" "Type" "TypeName" "UBound" "UCase" "Unload"
+ "Unlock" "Val" "VarType" "Verb" "Weekday" "Wend"
+ "While" "Width" "With" "Workspace" "Workspaces" "Write" "Year"))
+
+
+(defun visual-basic-word-list-regexp (keys)
+ (let ((re "\\b\\(")
+ (key nil))
+ (while keys
+ (setq key (car keys)
+ keys (cdr keys))
+ (setq re (concat re key (if keys "\\|" ""))))
+ (concat re "\\)\\b")))
+
+(defun visual-basic-keywords-to-highlight ()
+ (if t
+ visual-basic-all-keywords
+ visual-basic-keywords-to-highlight))
+
+
+(defvar visual-basic-font-lock-keywords
+ (list
+ ;; Names of functions.
+ (list visual-basic-defun-start-regexp 3 'font-lock-function-name-face)
+
+ ;; Statement labels
+ (cons visual-basic-label-regexp 'font-lock-reference-face)
+
+ ;; Case values
+ ;; String-valued cases get font-lock-string-face regardless.
+ (list "^[ \t]*[Cc]ase[ \t]+\\([^'\n]+\\)" 1 'font-lock-keyword-face t)
+
+ ;; Any keywords you like.
+ (cons (visual-basic-word-list-regexp (visual-basic-keywords-to-highlight))
+ 'font-lock-keyword-face)))
+
+
+(put 'visual-basic-mode 'font-lock-keywords 'visual-basic-font-lock-keywords)
+
+(defun visual-basic-mode ()
+ "A mode for editing Microsoft Visual Basic programs.
+Features automatic indentation, font locking, keyword capitalization,
+and some minor convenience functions.
+Commands:
+\\{visual-basic-mode-map}"
+ (interactive)
+ (kill-all-local-variables)
+ (use-local-map visual-basic-mode-map)
+ (setq major-mode 'visual-basic-mode)
+ (setq mode-name "Visual Basic")
+ (set-syntax-table visual-basic-mode-syntax-table)
+
+ (add-hook 'write-file-hooks 'visual-basic-untabify)
+
+ (setq local-abbrev-table visual-basic-mode-abbrev-table)
+ (if visual-basic-capitalize-keywords-p
+ (progn
+ (make-local-variable 'pre-abbrev-expand-hook)
+ (add-hook 'pre-abbrev-expand-hook 'visual-basic-pre-abbrev-expand-hook)
+ (abbrev-mode 1)))
+
+ (make-local-variable 'comment-start)
+ (setq comment-start "' ")
+ (make-local-variable 'comment-start-skip)
+ (setq comment-start-skip "'+ *")
+ (make-local-variable 'comment-column)
+ (setq comment-column 40)
+ (make-local-variable 'comment-end)
+ (setq comment-end "")
+
+ (make-local-variable 'indent-line-function)
+ (setq indent-line-function 'visual-basic-indent-line)
+
+ (if visual-basic-fontify-p
+ (visual-basic-enable-font-lock))
+
+ (run-hooks 'visual-basic-mode-hook))
+
+
+(defun visual-basic-enable-font-lock ()
+ ;; Emacs 19.29 requires a window-system else font-lock-mode errs out.
+ (cond ((or visual-basic-xemacs-p window-system)
+
+ ;; In win-emacs this sets font-lock-keywords back to nil!
+ (if visual-basic-winemacs-p
+ (font-lock-mode 1))
+
+ ;; Accomodate emacs 19.29+
+ ;; From: Simon Marshall
+ (cond ((boundp 'font-lock-defaults)
+ (make-local-variable 'font-lock-defaults)
+ (setq font-lock-defaults '(visual-basic-font-lock-keywords)))
+ (t
+ (make-local-variable 'font-lock-keywords)
+ (setq font-lock-keywords visual-basic-font-lock-keywords)))
+
+ (if visual-basic-winemacs-p
+ (font-lock-fontify-buffer)
+ (font-lock-mode 1)))))
+
+
+(defun visual-basic-construct-keyword-abbrev-table ()
+ (if visual-basic-mode-abbrev-table
+ nil
+ (let ((words visual-basic-all-keywords)
+ (word nil)
+ (list nil))
+ (while words
+ (setq word (car words)
+ words (cdr words))
+ (setq list (cons (list (downcase word) word) list)))
+
+ (define-abbrev-table 'visual-basic-mode-abbrev-table list))))
+
+;; Would like to do this at compile-time.
+(visual-basic-construct-keyword-abbrev-table)
+
+
+(defun visual-basic-in-code-context-p ()
+ (if (fboundp 'buffer-syntactic-context) ; XEmacs function.
+ (null (buffer-syntactic-context))
+ ;; Attempt to simulate buffer-syntactic-context
+ ;; I don't know how reliable this is.
+ (let* ((beg (save-excursion
+ (beginning-of-line)
+ (point)))
+ (list
+ (parse-partial-sexp beg (point))))
+ (and (null (nth 3 list)) ; inside string.
+ (null (nth 4 list)))))) ; inside cocmment
+
+(defun visual-basic-pre-abbrev-expand-hook ()
+ ;; Allow our abbrevs only in a code context.
+ (setq local-abbrev-table
+ (if (visual-basic-in-code-context-p)
+ visual-basic-mode-abbrev-table)))
+
+
+
+(defun visual-basic-newline-and-indent (&optional count)
+ "Insert a newline, updating indentation."
+ (interactive)
+ (expand-abbrev)
+ (save-excursion
+ (visual-basic-indent-line))
+ (call-interactively 'newline-and-indent))
+
+(defun visual-basic-beginning-of-defun ()
+ (interactive)
+ (re-search-backward visual-basic-defun-start-regexp))
+
+(defun visual-basic-end-of-defun ()
+ (interactive)
+ (re-search-forward visual-basic-defun-end-regexp))
+
+(defun visual-basic-mark-defun ()
+ (interactive)
+ (beginning-of-line)
+ (visual-basic-end-of-defun)
+ (set-mark (point))
+ (visual-basic-beginning-of-defun)
+ (if visual-basic-xemacs-p
+ (zmacs-activate-region)))
+
+(defun visual-basic-indent-defun ()
+ (interactive)
+ (save-excursion
+ (visual-basic-mark-defun)
+ (call-interactively 'visual-basic-indent-region)))
+
+
+(defun visual-basic-fill-long-comment ()
+ "Fills block of comment lines around point."
+ ;; Derived from code in ilisp-ext.el.
+ (interactive)
+ (save-excursion
+ (beginning-of-line)
+ (let ((comment-re "^[ \t]*\\s<+[ \t]*"))
+ (if (looking-at comment-re)
+ (let ((fill-prefix
+ (buffer-substring
+ (progn (beginning-of-line) (point))
+ (match-end 0))))
+
+ (while (and (not (bobp))
+ (looking-at visual-basic-comment-regexp))
+ (forward-line -1))
+ (if (not (bobp)) (forward-line 1))
+
+ (let ((start (point)))
+
+ ;; Make all the line prefixes the same.
+ (while (and (not (eobp))
+ (looking-at comment-re))
+ (replace-match fill-prefix)
+ (forward-line 1))
+
+ (if (not (eobp))
+ (beginning-of-line))
+
+ ;; Fill using fill-prefix
+ (fill-region-as-paragraph start (point))))))))
+
+
+(defun visual-basic-fill-or-indent ()
+ "Fill long comment around point, if any, else indent current definition."
+ (interactive)
+ (cond ((save-excursion
+ (beginning-of-line)
+ (looking-at visual-basic-comment-regexp))
+ (visual-basic-fill-long-comment))
+ (t
+ (visual-basic-indent-defun))))
+
+
+(defun visual-basic-new-sub ()
+ "Insert template for a new subroutine. Repeat to cycle through alternatives."
+ (interactive)
+ (beginning-of-line)
+ (let ((templates (cons visual-basic-blank-regexp
+ visual-basic-defn-templates))
+ (tem nil)
+ (bound (point)))
+ (while templates
+ (setq tem (car templates)
+ templates (cdr templates))
+ (cond ((looking-at tem)
+ (replace-match (or (car templates)
+ ""))
+ (setq templates nil))))
+
+ (search-backward "()" bound t)))
+
+
+(defun visual-basic-untabify ()
+ "Do not allow any tabs into the file"
+ (if (eq major-mode 'visual-basic-mode)
+ (untabify (point-min) (point-max)))
+ nil)
+
+(defun visual-basic-default-tag ()
+ (if (and (not (bobp))
+ (save-excursion
+ (backward-char 1)
+ (looking-at "\\w")))
+ (backward-word 1))
+ (let ((s (point))
+ (e (save-excursion
+ (forward-word 1)
+ (point))))
+ (buffer-substring s e)))
+
+(defun visual-basic-grep (tag)
+ "Search BASIC source files in current directory for tag."
+ (interactive
+ (list (let* ((def (visual-basic-default-tag))
+ (tag (read-string
+ (format "Grep for [%s]: " def))))
+ (if (string= tag "") def tag))))
+ (grep (format "grep -n %s %s" tag visual-basic-wild-files)))
+
+
+;;; IDE Connection.
+
+(defun visual-basic-buffer-project-file ()
+ "Return a guess as to the project file associated with the current buffer."
+ (car (directory-files (file-name-directory (buffer-file-name)) t "\\.vbp")))
+
+(defun visual-basic-start-ide ()
+ "Start Visual Basic (or your favorite IDE, (after Emacs, of course))
+on the first project file in the current directory.
+Note: it's not a good idea to leave Visual Basic running while you
+are editing in emacs, since Visual Basic has no provision for reloading
+changed files."
+ (interactive)
+ (let (file)
+ (cond ((null visual-basic-ide-pathname)
+ (error "No pathname set for Visual Basic. See visual-basic-ide-pathname"))
+ ((null (setq file (visual-basic-buffer-project-file)))
+ (error "No project file found."))
+ ((fboundp 'win-exec)
+ (iconify-emacs)
+ (win-exec visual-basic-ide-pathname 'win-show-normal file))
+ ((fboundp 'start-process)
+ (iconify-frame (selected-frame))
+ (start-process "*VisualBasic*" nil visual-basic-ide-pathname file))
+ (t
+ (error "No way to spawn process!")))))
+
+
+
+;;; Indentation-related stuff.
+
+(defun visual-basic-indent-region (start end)
+ "Perform visual-basic-indent-line on each line in region."
+ (interactive "r")
+ (save-excursion
+ (goto-char start)
+ (beginning-of-line)
+ (while (and (not (eobp))
+ (< (point) end))
+ (if (not (looking-at visual-basic-blank-regexp))
+ (visual-basic-indent-line))
+ (forward-line 1)))
+
+ (cond ((fboundp 'zmacs-deactivate-region)
+ (zmacs-deactivate-region))
+ ((fboundp 'deactivate-mark)
+ (deactivate-mark))))
+
+
+
+(defun visual-basic-previous-line-of-code ()
+ (if (not (bobp))
+ (forward-line -1)) ; previous-line depends on goal column
+ (while (and (not (bobp))
+ (or (looking-at visual-basic-blank-regexp)
+ (looking-at visual-basic-comment-regexp)))
+ (forward-line -1)))
+
+
+(defun visual-basic-find-original-statement ()
+ ;; If the current line is a continuation from the previous, move
+ ;; back to the original stmt.
+ (let ((here (point)))
+ (visual-basic-previous-line-of-code)
+ (while (and (not (bobp))
+ (looking-at visual-basic-continuation-regexp))
+ (setq here (point))
+ (visual-basic-previous-line-of-code))
+ (goto-char here)))
+
+(defun visual-basic-find-matching-stmt (open-regexp close-regexp)
+ ;; Searching backwards
+ (let ((level 0))
+ (while (and (>= level 0) (not (bobp)))
+ (visual-basic-previous-line-of-code)
+ (visual-basic-find-original-statement)
+ (cond ((looking-at close-regexp)
+ (setq level (+ level 1)))
+ ((looking-at open-regexp)
+ (setq level (- level 1)))))))
+
+(defun visual-basic-find-matching-if ()
+ (visual-basic-find-matching-stmt visual-basic-if-regexp visual-basic-endif-regexp))
+
+(defun visual-basic-find-matching-select ()
+ (visual-basic-find-matching-stmt visual-basic-select-regexp visual-basic-select-end-regexp))
+
+(defun visual-basic-find-matching-for ()
+ (visual-basic-find-matching-stmt visual-basic-for-regexp visual-basic-next-regexp))
+
+(defun visual-basic-find-matching-do ()
+ (visual-basic-find-matching-stmt visual-basic-do-regexp visual-basic-loop-regexp))
+
+(defun visual-basic-find-matching-while ()
+ (visual-basic-find-matching-stmt visual-basic-while-regexp visual-basic-wend-regexp))
+
+(defun visual-basic-find-matching-with ()
+ (visual-basic-find-matching-stmt visual-basic-with-regexp visual-basic-end-with-regexp))
+
+
+(defun visual-basic-calculate-indent ()
+ (let ((original-point (point)))
+ (save-excursion
+ (beginning-of-line)
+ ;; Some cases depend only on where we are now.
+ (cond ((or (looking-at visual-basic-defun-start-regexp)
+ (looking-at visual-basic-label-regexp)
+ (looking-at visual-basic-defun-end-regexp))
+ 0)
+
+ ;; The outdenting stmts, which simply match their original.
+ ((or (looking-at visual-basic-else-regexp)
+ (looking-at visual-basic-endif-regexp))
+ (visual-basic-find-matching-if)
+ (current-indentation))
+
+ ;; All the other matching pairs act alike.
+ ((looking-at visual-basic-next-regexp) ; for/next
+ (visual-basic-find-matching-for)
+ (current-indentation))
+
+ ((looking-at visual-basic-loop-regexp) ; do/loop
+ (visual-basic-find-matching-do)
+ (current-indentation))
+
+ ((looking-at visual-basic-wend-regexp) ; while/wend
+ (visual-basic-find-matching-while)
+ (current-indentation))
+
+ ((looking-at visual-basic-end-with-regexp) ; with/end with
+ (visual-basic-find-matching-with)
+ (current-indentation))
+
+ ((looking-at visual-basic-select-end-regexp) ; select case/end select
+ (visual-basic-find-matching-select)
+ (current-indentation))
+
+ ;; A case of a select is somewhat special.
+ ((looking-at visual-basic-case-regexp)
+ (visual-basic-find-matching-select)
+ (+ (current-indentation) visual-basic-mode-indent))
+
+ (t
+ ;; Other cases which depend on the previous line.
+ (visual-basic-previous-line-of-code)
+
+ ;; Skip over label lines, which always have 0 indent.
+ (while (looking-at visual-basic-label-regexp)
+ (visual-basic-previous-line-of-code))
+
+ (cond
+ ((looking-at visual-basic-continuation-regexp)
+ (visual-basic-find-original-statement)
+ ;; Indent continuation line under matching open paren,
+ ;; or else one word in.
+ (let* ((orig-stmt (point))
+ (matching-open-paren
+ (condition-case ()
+ (save-excursion
+ (goto-char original-point)
+ (beginning-of-line)
+ (backward-up-list 1)
+ ;; Only if point is now w/in cont. block.
+ (if (<= orig-stmt (point))
+ (current-column)))
+ (error nil))))
+ (cond (matching-open-paren
+ (1+ matching-open-paren))
+ (t
+ ;; Else, after first word on original line.
+ (back-to-indentation)
+ (forward-word 1)
+ (while (looking-at "[ \t]")
+ (forward-char 1))
+ (current-column)))))
+ (t
+ (visual-basic-find-original-statement)
+
+ (let ((indent (current-indentation)))
+ ;; All the various +indent regexps.
+ (cond ((looking-at visual-basic-defun-start-regexp)
+ (+ indent visual-basic-mode-indent))
+
+ ((or (looking-at visual-basic-if-regexp)
+ (looking-at visual-basic-else-regexp))
+ (+ indent visual-basic-mode-indent))
+
+ ((or (looking-at visual-basic-select-regexp)
+ (looking-at visual-basic-case-regexp))
+ (+ indent visual-basic-mode-indent))
+
+ ((or (looking-at visual-basic-do-regexp)
+ (looking-at visual-basic-for-regexp)
+ (looking-at visual-basic-while-regexp)
+ (looking-at visual-basic-with-regexp))
+ (+ indent visual-basic-mode-indent))
+
+ (t
+ ;; By default, just copy indent from prev line.
+ indent))))))))))
+
+(defun visual-basic-indent-to-column (col)
+ (let* ((bol (save-excursion
+ (beginning-of-line)
+ (point)))
+ (point-in-whitespace
+ (<= (point) (+ bol (current-indentation))))
+ (blank-line-p
+ (save-excursion
+ (beginning-of-line)
+ (looking-at visual-basic-blank-regexp))))
+
+ (cond ((/= col (current-indentation))
+ (save-excursion
+ (beginning-of-line)
+ (back-to-indentation)
+ (delete-region bol (point))
+ (indent-to col))))
+
+ ;; If point was in the whitespace, move back-to-indentation.
+ (cond (blank-line-p
+ (end-of-line))
+ (point-in-whitespace
+ (back-to-indentation)))))
+
+
+(defun visual-basic-indent-line ()
+ "Indent current line for BASIC"
+ (interactive)
+ (visual-basic-indent-to-column (visual-basic-calculate-indent)))
+
+
+(defun visual-basic-function-arg-start (pos endpos)
+ (while (and (< pos endpos) (not (char-equal (char-after pos) 40))
+ (not (char-equal (char-after pos) 44)))
+ (setq pos (+ pos 1)))
+ (setq pos (+ pos 1))
+ (while (and (< pos endpos) (or
+ (char-equal (char-after pos) 95)
+ (char-equal (char-after pos) 10)
+ (char-equal (char-after pos) 13)
+ (char-equal (char-after pos) 9)
+ (char-equal (char-after pos) 32))
+ (setq pos (+ pos 1))))
+ (if (< pos endpos)
+ pos
+ nil))
+
+
+(defun visual-basic-skip-parens (pos endpos)
+ (let ((parcount 0))
+ (while (and (< pos endpos) (or (> parcount 0)
+ (char-equal (char-after pos) 40)))
+ (if (char-equal (char-after pos) 40)
+ (setq parcount (+ parcount 1)))
+ (if (char-equal (char-after pos) 41)
+ (setq parcount (- parcount 1)))
+ (setq pos (+ pos 1)))
+ pos))
+
+
+(defun visual-basic-function-arg-end (pos endpos)
+ (if (and pos endpos)
+ ((lambda ()
+ (while (and (<= pos endpos) (not (char-equal (char-after pos) 41))
+ (not (char-equal (char-after pos) 44)))
+ (if (char-equal (char-after pos) 40)
+ (setq pos (visual-basic-skip-parens pos endpos))
+ (setq pos (+ pos 1))))
+ (if (<= pos endpos)
+ ((lambda ()
+ (setq pos (- pos 1))
+ (while (char-equal (char-after pos) 32)
+ (setq pos (- pos 1)))
+ (+ pos 1)))
+ nil))
+ )
+ nil))
+
+
+(defun visual-basic-function-get-arguments (pos endpos)
+ (let* ((arg-start (visual-basic-function-arg-start pos endpos))
+ (arg-end (visual-basic-function-arg-end arg-start endpos)))
+ (if (and arg-start arg-end)
+ (cons (buffer-substring arg-start arg-end)
+ (visual-basic-function-get-arguments arg-end endpos))
+ nil)))
+
+
+(defun visual-basic-comment-function-arguments (prefix argument-list)
+ (let ((argument (car argument-list))
+ (pos (length prefix)))
+ (insert prefix)
+ (while (< pos 12)
+ (insert " ")
+ (setq pos (+ pos 1)))
+ (insert argument)
+ (backward-kill-word 2) ; As type
+ (setq pos (+ pos (length argument)))
+ (while (< pos 40)
+ (insert " ")
+ (setq pos (+ pos 1)))
+ (insert "\n")
+ (if (cdr argument-list)
+ (visual-basic-comment-function-arguments "'" (cdr argument-list)))))
+
+(defun visual-basic-string-equal (left right)
+ (setq visual-basic-previous-buffer (current-buffer))
+ (switch-to-buffer "*visual-basic-comment-scratch*")
+ (insert left)
+ (insert " ")
+ (insert right)
+ (beginning-of-line)
+ (downcase-word 1)
+ (backward-word 1)
+ (setq visual-basic-string-equal-retval (current-word))
+ (forward-word 1)
+ (downcase-word 1)
+ (backward-word 1)
+ (setq visual-basic-string-equal-retval
+ (string-equal visual-basic-string-equal-retval
+ (current-word)))
+ (kill-buffer "*visual-basic-comment-scratch*")
+ (switch-to-buffer visual-basic-previous-buffer)
+ visual-basic-string-equal-retval
+ )
+
+(defun visual-basic-end-of-defun ()
+ (interactive)
+ (setq end-ps ((lambda ()
+ (end-of-line)
+ (point)
+ )))
+ (beginning-of-line)
+ (while (search-forward-regexp "_[ \t]*$" end-ps 1)
+ (forward-char 1)
+ (setq end-ps ((lambda ()
+ (end-of-line)
+ (point)
+ )))
+ (beginning-of-line)))
+
+(defun visual-basic-comment-function ()
+ "Adds a VISUAL-BASIC function comment header"
+ (interactive)
+ (let* ((start-pos ((lambda () (beginning-of-line) (point))))
+ (end-pos ((lambda ()
+ (visual-basic-end-of-defun)
+ (search-backward-regexp ")[A-Za-z \t_]*$")
+ (point))))
+ )
+ (goto-char start-pos)
+ (setq case-fold-search t)
+ (search-forward "(")
+ (backward-char 1)
+ (setq arguments (visual-basic-function-get-arguments (point) end-pos))
+ (goto-char end-pos)
+ (forward-word 1)
+ (current-word)
+ (setq is-a-function (visual-basic-string-equal
+ (current-word) "as"))
+ (goto-char start-pos)
+ (insert "' ")
+ (setq visual-basic-return-point-ch (point))
+ (insert "\n")
+ (cond (arguments
+ (insert "'\n' Parametri:\n'\n")
+ (visual-basic-comment-function-arguments "'" arguments))
+ )
+ (insert "'\n")
+ (if is-a-function (insert "' Ritorna :\n'\n"))
+ (goto-char visual-basic-return-point-ch)
+))
+
+;(global-set-key "\M-\C-q" 'visual-basic-comment-function)
--- html-helper-mode-3.0.4kilo.orig/debian/dirs
+++ html-helper-mode-3.0.4kilo/debian/dirs
@@ -0,0 +1,3 @@
+usr/share/emacs/site-lisp/html-helper-mode
+etc/emacs/site-start.d
+
--- html-helper-mode-3.0.4kilo.orig/debian/docs
+++ html-helper-mode-3.0.4kilo/debian/docs
@@ -0,0 +1,7 @@
+changelog.html
+configuring.html
+differences.html
+documentation.html
+index-beta.html
+index.html
+keybindings.html
--- html-helper-mode-3.0.4kilo.orig/debian/doc-base.html-helper-mode
+++ html-helper-mode-3.0.4kilo/debian/doc-base.html-helper-mode
@@ -0,0 +1,10 @@
+Document: html-helper-mode
+Title: Debian html-helper-mode Manual
+Author: Nelson Minar
+Abstract: This manual describes what html-helper-mode is
+ and how it can be used to edit HTML files in various incarnations of Emacs.
+Section: Apps/Editors
+
+Format: HTML
+Index: /usr/share/doc/html-helper-mode/index.html
+Files: /usr/share/doc/html-helper-mode/*.html
--- html-helper-mode-3.0.4kilo.orig/debian/emacsen-install
+++ html-helper-mode-3.0.4kilo/debian/emacsen-install
@@ -0,0 +1,45 @@
+#! /bin/sh -e
+# /usr/lib/emacsen-common/packages/install/html-helper-mode
+
+# Written by Jim Van Zandt , borrowing heavily
+# from the install scripts for gettext by Santiago Vila
+# and octave by Dirk Eddelbuettel .
+
+FLAVOR=$1
+PACKAGE=html-helper-mode
+
+if [ ${FLAVOR} = emacs ]; then exit 0; fi
+
+echo install/${PACKAGE}: Handling install for emacsen flavor ${FLAVOR}
+
+#FLAVORTEST=`echo $FLAVOR | cut -c-6`
+#if [ ${FLAVORTEST} = xemacs ] ; then
+# SITEFLAG="-no-site-file"
+#else
+# SITEFLAG="--no-site-file"
+#fi
+FLAGS="${SITEFLAG} -q -batch -l path.el -f batch-byte-compile"
+
+ELDIR=/usr/share/emacs/site-lisp/${PACKAGE}
+ELCDIR=/usr/share/${FLAVOR}/site-lisp/${PACKAGE}
+
+# Install-info-altdir does not actually exist.
+# Maybe somebody will write it.
+if test -x /usr/sbin/install-info-altdir; then
+ echo install/${PACKAGE}: install Info links for ${FLAVOR}
+ install-info-altdir --quiet --section "" "" --dirname=${FLAVOR} /usr/info/${PACKAGE}.info.gz
+fi
+
+install -m 755 -d ${ELCDIR}
+cd ${ELDIR}
+FILES=`echo *.el`
+cp ${FILES} ${ELCDIR}
+cd ${ELCDIR}
+
+cat << EOF > path.el
+(setq load-path (cons "." load-path) byte-compile-warnings nil)
+EOF
+${FLAVOR} ${FLAGS} ${FILES}
+rm -f *.el path.el
+
+exit 0
--- html-helper-mode-3.0.4kilo.orig/debian/compat
+++ html-helper-mode-3.0.4kilo/debian/compat
@@ -0,0 +1 @@
+4
--- html-helper-mode-3.0.4kilo.orig/debian/README.Debian
+++ html-helper-mode-3.0.4kilo/debian/README.Debian
@@ -0,0 +1,24 @@
+html-helper-mode for Debian
+---------------------------
+
+This package is set to autoload for the following file extensions:
+
+.htm, .html Standard HTML files
+.shtml SSI (server-side includes)
+.php PHP
+.asp ASP (Active Server Pages)
+.jsp JSP (Java Server Pages)
+
+You may want to edit /etc/emacs/site-start.d/50html-helper-mode.el and
+comment out the lines that do that.
+
+You may also want to enable the customization code in hhm-config.el; I
+may do this by default in a future release (and once it doesn't say
+ALPHA at the top ;-)
+
+The following was changed to retain compatibility with 2.19.1.1:
+
+ - A trailing space on the html-helper-timestamp-start delimeter was
+ removed.
+
+ -- Chris Lawrence , Mon Jan 19 11:11:58 2004
--- html-helper-mode-3.0.4kilo.orig/debian/emacsen-remove
+++ html-helper-mode-3.0.4kilo/debian/emacsen-remove
@@ -0,0 +1,15 @@
+#!/bin/sh -e
+# /usr/lib/emacsen-common/packages/remove/html-helper-mode
+
+FLAVOR=$1
+PACKAGE=html-helper-mode
+
+if [ ${FLAVOR} != emacs ]; then
+ if test -x /usr/sbin/install-info-altdir; then
+ echo remove/${PACKAGE}: removing Info links for ${FLAVOR}
+ install-info-altdir --quiet --remove --dirname=${FLAVOR} /usr/info/html-helper-mode.info.gz
+ fi
+
+ echo remove/${PACKAGE}: purging byte-compiled files for ${FLAVOR}
+ rm -rf /usr/share/${FLAVOR}/site-lisp/${PACKAGE}
+fi
--- html-helper-mode-3.0.4kilo.orig/debian/watch
+++ html-helper-mode-3.0.4kilo/debian/watch
@@ -0,0 +1,2 @@
+version=3
+http://download.savannah.gnu.org/releases/baol-hth/html-helper-mode_\(.*\).tar.gz debian uupdate
--- html-helper-mode-3.0.4kilo.orig/debian/copyright
+++ html-helper-mode-3.0.4kilo/debian/copyright
@@ -0,0 +1,30 @@
+This package was debianized by Chris Lawrence on
+Mon, 13 Nov 2000 16:12:27 -0600.
+
+It was downloaded from http://www.nongnu.org/baol-hth/index.html
+
+Upstream Author: Gian Uberto "Saint" Lauri
+
+Copyright:
+
+;; Copyright (C) 1994 Nelson Minar
+;; Copyright (C) 1995 Nelson Minar and Ulrik Dickow
+;; Copyright (C) 1999 Nelson Minar, Ulrik Dickow and Gian Uberto Lauri
+
+;; 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 GNU Emacs; see the file COPYING. If not, write to
+;; the Free Software Foundation, 51 Franklin St, Fifth Floor, Boston,
+;; MA 02110-1301, USA.
+
+A copy of this license can be found on Debian systems in
+/usr/share/common-licenses/GPL.
--- html-helper-mode-3.0.4kilo.orig/debian/rules
+++ html-helper-mode-3.0.4kilo/debian/rules
@@ -0,0 +1,75 @@
+#!/usr/bin/make -f
+# Sample debian/rules that uses debhelper.
+# GNU copyright 1997 to 1999 by Joey Hess.
+
+# Uncomment this to turn on verbose mode.
+#export DH_VERBOSE=1
+
+configure: configure-stamp
+configure-stamp:
+ dh_testdir
+ # Add here commands to configure the package.
+
+ touch configure-stamp
+
+build: configure-stamp build-stamp
+build-stamp:
+ dh_testdir
+
+ touch build-stamp
+
+clean:
+ dh_testdir
+ dh_testroot
+ rm -f build-stamp configure-stamp ChangeLog
+
+ # Add here commands to clean up after the build process.
+ -$(MAKE) clean
+
+ dh_clean
+
+install: build
+ dh_testdir
+ dh_testroot
+ dh_clean -k
+ dh_installdirs
+
+ # Add here commands to install the package into debian/tmp.
+ cp *.el debian/html-helper-mode/usr/share/emacs/site-lisp/html-helper-mode
+
+# Build architecture-independent files here.
+binary-indep: build install
+# We have nothing to do by default.
+
+# Build architecture-dependent files here.
+binary-arch: build install
+# dh_testversion
+ dh_testdir
+ dh_testroot
+# dh_installdebconf
+ dh_installdocs
+ dh_installexamples
+ dh_installmenu
+ dh_installemacsen
+# dh_installpam
+# dh_installinit
+ dh_installcron
+# dh_installmanpages
+ dh_installinfo
+# dh_undocumented
+ dh_installchangelogs hhm-changelog
+ dh_link
+ dh_strip
+ dh_compress
+ dh_fixperms
+ # You may want to make some executables suid here.
+# dh_makeshlibs
+ dh_installdeb
+# dh_perl
+ dh_shlibdeps
+ dh_gencontrol
+ dh_md5sums
+ dh_builddeb
+
+binary: binary-indep binary-arch
+.PHONY: build clean binary-indep binary-arch binary install configure
--- html-helper-mode-3.0.4kilo.orig/debian/control
+++ html-helper-mode-3.0.4kilo/debian/control
@@ -0,0 +1,19 @@
+Source: html-helper-mode
+Section: editors
+Priority: extra
+Maintainer: Chris Lawrence
+Build-Depends: debhelper (>> 4)
+Standards-Version: 3.7.2
+
+Package: html-helper-mode
+Architecture: all
+Depends: emacs21 | emacsen, css-mode
+Description: A popular HTML editing mode for emacs
+ html-helper-mode has historically been a popular mode for editing
+ HTML files in various flavors of Emacs. It includes font-lock mode
+ support, menu support, and support for editing pages with embedded
+ JSP, PHP, and ASP tags.
+ .
+ Current Home Page: http://www.nongnu.org/baol-hth/index.html
+ .
+ Old Home Page: http://www.santafe.edu/~nelson/tools/
--- html-helper-mode-3.0.4kilo.orig/debian/changelog
+++ html-helper-mode-3.0.4kilo/debian/changelog
@@ -0,0 +1,130 @@
+html-helper-mode (3.0.4kilo-2) unstable; urgency=low
+
+ * Fix parentheses in emacsen-startup. (Closes: #374851)
+ * Add to magic-mode-alist on emacs-snapshot. (Closes: #370051)
+
+ -- Chris Lawrence Wed, 21 Jun 2006 15:29:08 -0400
+
+html-helper-mode (3.0.4kilo-1) unstable; urgency=low
+
+ * New upstream release.
+ * Require css-mode also, since it is used when editing inside