diff options
115 files changed, 2404 insertions, 19216 deletions
diff --git a/.svn.ignore b/.svn.ignore deleted file mode 100644 index 6cf7816..0000000 --- a/.svn.ignore +++ /dev/null @@ -1 +0,0 @@ -semantic.cache diff --git a/app-emacs/else-mode/Manifest b/app-emacs/else-mode/Manifest deleted file mode 100644 index 735c302..0000000 --- a/app-emacs/else-mode/Manifest +++ /dev/null @@ -1,17 +0,0 @@ -MD5 2e5d2862e31b95268fa468cb504fe9fa else-mode-1.20.ebuild 799 -MD5 8ccb76306406ddabb96bcf25b696c00d files/Emacs-Lisp.lse 40640 -MD5 9ea68bee4243a3f8e4428854bc22bd90 files/C.lse 29175 -MD5 d1a18e0b61fcdec55a7d95d2f4f3b3cb files/50else-mode-gentoo.el 135 -MD5 8dbc706c76de6f32f55f13d5e2e27df8 files/C-cust.lse 11630 -MD5 f711cbb3f6a2407278a6f886f71201df files/Template-cust.lse 11330 -MD5 56afc00dd0f5dad97290b1d31625c73e files/LaTeX-cust.lse 4755 -MD5 ec9daf849b952be50901e9644161ef5c files/LaTeX.lse 15398 -MD5 01e370c5241e0cc91a989c5835f30c59 files/Python-cust.lse 6999 -MD5 f7d5120d3535264b1efc4333842b0bc4 files/Python.lse 27885 -MD5 d41d8cd98f00b204e9800998ecf8427e files/digest-else-1.20 0 -MD5 30d4479283c8dbf63f2521d54525b8cf files/Template.lse 15915 -MD5 3a0fe9a5d6ed4bce7beffaf1df61d1fb files/semantic.cache 439 -MD5 ec7a68fc6bfb504caccfa4d070bf2d14 files/else-mode.el 198411 -MD5 be2f6dac99d16adb6567aad75fa089cd files/else.info 133204 -MD5 63c1fd52d0e634f474b3bf66584a6324 files/setnu.el 16650 -MD5 d41d8cd98f00b204e9800998ecf8427e files/digest-else-mode-1.20 0 diff --git a/app-emacs/else-mode/else-mode-1.20.ebuild b/app-emacs/else-mode/else-mode-1.20.ebuild deleted file mode 100644 index 699fb0b..0000000 --- a/app-emacs/else-mode/else-mode-1.20.ebuild +++ /dev/null @@ -1,50 +0,0 @@ -# Copyright 1999-2005 Gentoo Foundation -# Distributed under the terms of the GNU General Public License v2 -# $Header: $ - -inherit elisp - -DESCRIPTION="ELSE provides templates to generate code in several different languages" -HOMEPAGE="http://www.zipworld.com.au/~peterm/" -SRC_URI="" - -LICENSE="GPL-2" -SLOT="0" -KEYWORDS="~x86" - -IUSE="" - -DEPEND="virtual/emacs" - -SITEFILE=50else-mode-gentoo.el - -S=${WORKDIR} - -src_unpack() { - cd ${S} - cp ${FILESDIR}/{else-mode,setnu}.el . -} - -src_compile() { - elisp-compile *.el || die -} - -src_install() { - - doinfo ${FILESDIR}/else.info - - mkdir ${D}/usr/share/${PN} - insinto /usr/share/${PN} - doins ${FILESDIR}/*.lse - - elisp-install ${PN} *.el *.elc - elisp-site-file-install ${FILESDIR}/${SITEFILE} -} - -pkg_postinst() { - elisp-site-regen -} - -pkg_postrm() { - elisp-site-regen -} diff --git a/app-emacs/else-mode/files/50else-mode-gentoo.el b/app-emacs/else-mode/files/50else-mode-gentoo.el deleted file mode 100644 index 1ecc18e..0000000 --- a/app-emacs/else-mode/files/50else-mode-gentoo.el +++ /dev/null @@ -1,5 +0,0 @@ -(add-to-list 'load-path "/usr/share/emacs/site-lisp/else-mode") -(add-to-list 'load-path "/usr/share/else-mode") - -(require 'else-mode) - diff --git a/app-emacs/else-mode/files/C-cust.lse b/app-emacs/else-mode/files/C-cust.lse deleted file mode 100644 index 2ff473d..0000000 --- a/app-emacs/else-mode/files/C-cust.lse +++ /dev/null @@ -1,443 +0,0 @@ -;; Copyright (C) 2001, 2004 Peter Milliken
-;;
-;; Author: Peter Milliken <peterm@resmed.com.au>,
-;; <peterm@unwired.com.au>
-;;
-;; Keywords: language sensitive abbreviation template placeholder token
-;;
-;; 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, Inc., 59 Temple Place - Suite 330,
-;; Boston, MA 02111-1307, USA.
-
-;;******************************************************************************
-;; These definitions are my personal customisations for the language. This is
-;; where you should place YOUR customisations.
-;;
-;; Sometimes there is a definition(s) in here that override definitions in the
-;; main language template file that are here to make that definition more
-;; "usable" - this is because I (primarily) try and generate/maintain the main
-;; .lse files from EBNF definitions of the language. Sometimes I just can't
-;; express the appropriate customisation in the EBNF and so I am forced to
-;; override the placeholder definition in this file.
-;;
-;; This entries in this file should be used as an example of how to create your
-;; own customisations. I would caution that you don't delete any definitions
-;; though until you are sure that your edit sessions will not be adversely
-;; affected. The best way to check out the effects of a delete is to "compile"
-;; (else-compile-buffer) the "delete" command for that definition (this will
-;; remove it from your edit session and you can nolonger access the definition
-;; until next you load language template files) and then see whether anything
-;; has been "lost" in your code generation ability i.e. say you think you don't
-;; need the definition for placeholder XXX, just place the following lines at
-;; the end of one of your source files (when ELSE is enabled for that buffer)
-;; and perform a compile (M-x else-compile-buffer) with the cursor positioned at
-;; the beginning of the line:
-;;
-;; DELETE PLACEHOLDER XXX -
-;; /LANGUAGE = "C" -
-;;
-;; This will delete definition XXX from memory.
-;;
-;;******************************************************************************
-DELETE PLACEHOLDER COMPILATION_UNIT -
- /LANGUAGE="C" -
-DEFINE PLACEHOLDER COMPILATION_UNIT -
- /LANGUAGE="C" -
- /NOAUTO_SUBSTITUTE -
- /DESCRIPTION="" -
- /DUPLICATION=CONTEXT_DEPENDENT -
- /SEPARATOR="" -
- /TYPE=NONTERMINAL -
-
- "[module_level_comments]"
- "[{include_files}...]"
- " "
- "[{data_types_or_declarations}...]"
- " "
- "[{function_definition}...]"
- " "
- "[main_function]"
-
-END DEFINE
-
-DELETE PLACEHOLDER #INCLUDE -
- /LANGUAGE="C" -
-DEFINE PLACEHOLDER #INCLUDE -
- /LANGUAGE="C" -
- /NOAUTO_SUBSTITUTE -
- /DESCRIPTION="" -
- /DUPLICATION=VERTICAL -
- /SEPARATOR="" -
- /TYPE=MENU
-
- "#include <{file_name}>"
- "#include "{file_name}""
-
-END DEFINE
-
-DELETE PLACEHOLDER FILE_NAME -
- /LANGUAGE="C" -
-DEFINE PLACEHOLDER FILE_NAME -
- /LANGUAGE="C" -
- /NOAUTO_SUBSTITUTE -
- /DESCRIPTION="" -
- /DUPLICATION=CONTEXT_DEPENDENT -
- /SEPARATOR="" -
- /TYPE=TERMINAL
-
- "Enter the name of the include file here i.e. stdio.h"
-
-END DEFINE
-
-
-DELETE PLACEHOLDER MODULE_LEVEL_COMMENTS -
- /LANGUAGE="C" -
-DEFINE PLACEHOLDER MODULE_LEVEL_COMMENTS -
- /LANGUAGE="C" -
- /NOAUTO_SUBSTITUTE -
- /DESCRIPTION=""
- /DUPLICATION=CONTEXT_DEPENDENT -
- /SEPARATOR="" -
- /TYPE=NONTERMINAL -
-
- "/* ===[ {module} ]=============================================================="
- ""
- "@@Description: {text}"
- ""
- "@@Revisions:"
- ""
- "@@@@REV DATE BY DESCRIPTION"
- "@@------ --------- --- ------------------------------------------------"
- "@@[text] [text] [text] [text]"
- "@@-----------------------------------------------------------------------------"
- ""
- "@@@@This item is the property of ResMed Ltd, and contains confidential and trade"
- "@@@@secret information. It may not be transfered from the custody or control of"
- "@@@@ResMed except as authorised in writing by an officer of ResMed. Neither this"
- "@@@@item nor the information it contains may be used, transfered, reproduced,"
- "@@@@published, or disclosed, in whole or in part, and directly or indirectly,"
- "@@@@except as expressly authorised by an officer of ResMed, pursuant to written"
- "@@@@agreement."
- ""
- "@@@@Copyright (c) 2004 ResMed Ltd. All rights reserved."
- "@@===========================================================================*/"
- ""
-
-END DEFINE
-
-DELETE PLACEHOLDER MODULE -
- /LANGUAGE="C" -
-DEFINE PLACEHOLDER MODULE -
- /LANGUAGE="C" -
- /NOAUTO_SUBSTITUTE -
- /DESCRIPTION="" -
- /DUPLICATION=CONTEXT_DEPENDENT -
- /SEPARATOR="" -
- /TYPE=TERMINAL
-
- "Enter the name of the module i.e. gs_lib.c"
-
-END DEFINE
-
-DELETE PLACEHOLDER FUNCTION_DEFINITION -
- /LANGUAGE="C" -
-DEFINE PLACEHOLDER FUNCTION_DEFINITION -
- /LANGUAGE="C" -
- /NOAUTO_SUBSTITUTE -
- /DESCRIPTION="" -
- /DUPLICATION=CONTEXT_DEPENDENT -
- /SEPARATOR="" -
- /TYPE=NONTERMINAL -
-
- "[declaration_specifiers] {declarator}"
- "[declaration]..."
- "{"
- " [declaration]..."
- " [statement]..."
- "}"
-
-END DEFINE
-
-DELETE TOKEN MAIN_FUNCTION_DEF -
- /LANGUAGE="C" -
-DEFINE TOKEN MAIN_FUNCTION_DEF -
- /LANGUAGE="C" -
- /DESCRIPTION="defines a main function"
-
- "[function_level_comments]"
- "{main() OR main function that accept arguments from the command line}"
- "{"
- " [block_decl]..."
- ""
- " {statement}..."
- "}"
-
-END DEFINE
-
-DELETE PLACEHOLDER FUNCTION_LEVEL_COMMENTS -
- /LANGUAGE="C" -
-DEFINE PLACEHOLDER FUNCTION_LEVEL_COMMENTS -
- /LANGUAGE="C" -
- /NOAUTO_SUBSTITUTE -
- /DESCRIPTION=""
- /DUPLICATION=CONTEXT_DEPENDENT -
- /SEPARATOR="" -
- /TYPE=NONTERMINAL -
-
- "/* ===[ {text} ]==============================================="
- ""
- "@@@Summary: {text}"
- ""
- "@@@Description: {text}"
- ""
- "@@@Return Value: {text} always returns P_SUCCESS"
- ""
- "@@@========================================================================== */"
-
-END DEFINE
-
-DELETE PLACEHOLDER CONDITIONAL_EXPRESSION -
- /LANGUAGE="C" -
-DEFINE PLACEHOLDER CONDITIONAL_EXPRESSION -
- /LANGUAGE="C" -
- /NOAUTO_SUBSTITUTE -
- /DESCRIPTION="" -
- /DUPLICATION=CONTEXT_DEPENDENT -
- /SEPARATOR="" -
- /TYPE=MENU -
-
- "logical_or_expression"/PLACEHOLDER
- "{logical_or_expression} ? {expression} : {conditional_expression}"
-
-END DEFINE
-
-DELETE PLACEHOLDER CASE_PART -
- /LANGUAGE="C" -
-DEFINE PLACEHOLDER CASE_PART -
- /LANGUAGE="C" -
- /NOAUTO_SUBSTITUTE -
- /DESCRIPTION=""
- /DUPLICATION=VERTICAL -
- /SEPARATOR="" -
- /TYPE=NONTERMINAL -
-
- "case {constant_expression}:"
- "[case {constant_expression}:]..."
- " [statement]..."
- " break;"
-
-END DEFINE
-
-DELETE PLACEHOLDER DEFAULT_PART -
- /LANGUAGE="C" -
-DEFINE PLACEHOLDER DEFAULT_PART -
- /LANGUAGE="C" -
- /NOAUTO_SUBSTITUTE -
- /DESCRIPTION=""
- /DUPLICATION=CONTEXT_DEPENDENT -
- /SEPARATOR="" -
- /TYPE=NONTERMINAL -
-
- "default :"
- " [statement]..."
- " break;"
-
-END DEFINE
-
-DELETE PLACEHOLDER WHILE_STATEMENT -
- /LANGUAGE="C" -
-DEFINE PLACEHOLDER WHILE_STATEMENT -
- /LANGUAGE="C" -
- /NOAUTO_SUBSTITUTE -
- /DESCRIPTION=""
- /DUPLICATION=CONTEXT_DEPENDENT -
- /SEPARATOR="" -
- /TYPE=NONTERMINAL -
-
- "while ({expression})"
- "{"
- " {statement}..."
- "}"
-
-END DEFINE
-
-
-DELETE PLACEHOLDER IF_STATEMENT -
- /LANGUAGE="C" -
-DEFINE PLACEHOLDER IF_STATEMENT -
- /LANGUAGE="C" -
- /NOAUTO_SUBSTITUTE -
- /DESCRIPTION=""
- /DUPLICATION=CONTEXT_DEPENDENT -
- /SEPARATOR="" -
- /TYPE=NONTERMINAL -
-
- "if ({expression})"
- "{"
- " {statement}..."
- "}"
- "[elsif_part]..."
- "[else_part]"
-
-END DEFINE
-
-DELETE PLACEHOLDER ELSIF_PART -
- /LANGUAGE="C" -
-DEFINE PLACEHOLDER ELSIF_PART -
- /LANGUAGE="C" -
- /NOAUTO_SUBSTITUTE -
- /DESCRIPTION=""
- /DUPLICATION=VERTICAL -
- /SEPARATOR="" -
- /TYPE=NONTERMINAL -
-
- "else if ({expression})"
- "{"
- " {statement}..."
- "}"
-
-END DEFINE
-
-DELETE PLACEHOLDER ELSE_PART -
- /LANGUAGE="C" -
-DEFINE PLACEHOLDER ELSE_PART -
- /LANGUAGE="C" -
- /NOAUTO_SUBSTITUTE -
- /DESCRIPTION=""
- /DUPLICATION=CONTEXT_DEPENDENT -
- /SEPARATOR="" -
- /TYPE=NONTERMINAL -
-
- "else"
- "{"
- " {statement}..."
- "}"
-
-END DEFINE
-
-DELETE PLACEHOLDER SWITCH_STATEMENT -
- /LANGUAGE="C" -
-DEFINE PLACEHOLDER SWITCH_STATEMENT -
- /LANGUAGE="C" -
- /NOAUTO_SUBSTITUTE -
- /DESCRIPTION=""
- /DUPLICATION=CONTEXT_DEPENDENT -
- /SEPARATOR="" -
- /TYPE=NONTERMINAL -
-
- "switch ({expression})"
- "{"
- " [case_part]..."
- " [default_part]"
- "}"
-
-END DEFINE
-
-DELETE PLACEHOLDER DO_STATEMENT -
- /LANGUAGE="C" -
-DEFINE PLACEHOLDER DO_STATEMENT -
- /LANGUAGE="C" -
- /NOAUTO_SUBSTITUTE -
- /DESCRIPTION=""
- /DUPLICATION=CONTEXT_DEPENDENT -
- /SEPARATOR="" -
- /TYPE=NONTERMINAL -
-
- "do"
- "{"
- " {statement}..."
- "} while ({expression});"
-
-END DEFINE
-
-DELETE PLACEHOLDER DEFAULT_PART -
- /LANGUAGE="C" -
-DEFINE PLACEHOLDER DEFAULT_PART -
- /LANGUAGE="C" -
- /NOAUTO_SUBSTITUTE -
- /DESCRIPTION=""
- /DUPLICATION=CONTEXT_DEPENDENT -
- /SEPARATOR="" -
- /TYPE=NONTERMINAL -
- /RUN_CODE=eut-test1/BEFORE
- /RUN_CODE=eut-test2/AFTER
- /RUN_CODE=eut-test3/ONINSERT
-
- "default :"
- " [statement]..."
- " break;"
-
-END DEFINE
-
-
-DELETE PLACEHOLDER FOR_STATEMENT -
- /LANGUAGE="C" -
-DEFINE PLACEHOLDER FOR_STATEMENT -
- /LANGUAGE="C" -
- /NOAUTO_SUBSTITUTE -
- /DESCRIPTION=""
- /DUPLICATION=CONTEXT_DEPENDENT -
- /SEPARATOR="" -
- /TYPE=NONTERMINAL -
-
- "for ([loop_init]; [loop_control]; [expression])"
- "{"
- " {statement}..."
- "}"
-
-END DEFINE
-
-
-DELETE PLACEHOLDER PROTOTYPE_DECLARATION -
- /LANGUAGE="C" -
-DEFINE PLACEHOLDER PROTOTYPE_DECLARATION -
- /LANGUAGE="C" -
- /NOAUTO_SUBSTITUTE -
- /DESCRIPTION=""
- /DUPLICATION=CONTEXT_DEPENDENT -
- /SEPARATOR="" -
- /TYPE=NONTERMINAL -
-
- "[function_level_comments]"
- "[static_or_extern] {data_type_specifier} [*]{function_name} ([{parameter_declaration}...[, ...]]);"
-
-END DEFINE
-
-DELETE TOKEN COMMENT -
- /LANGUAGE="C" -
-DEFINE TOKEN COMMENT -
- /LANGUAGE="C" -
- /PLACEHOLDER=COMMENT_STATEMENT
-
-END DEFINE
-
-DELETE TOKEN C -
- /LANGUAGE="C" -
-DEFINE TOKEN C -
- /LANGUAGE="C" -
-
- "/* {text} */"
-
-END DEFINE
-
-DELETE TOKEN P -
- /LANGUAGE="C" -
-DEFINE TOKEN P -
- /LANGUAGE="C" -
- /RUN_CODE=eut-test2/AFTER
-
- "p_report_format(0, rinfo_p, str);"
-
-END DEFINE
-
diff --git a/app-emacs/else-mode/files/C.lse b/app-emacs/else-mode/files/C.lse deleted file mode 100644 index da0d8e9..0000000 --- a/app-emacs/else-mode/files/C.lse +++ /dev/null @@ -1,1355 +0,0 @@ -;; Copyright (C) 2001, 2004 Peter Milliken -;; -;; Author: Peter Milliken <peterm@resmed.com.au>, -;; <peterm@unwired.com.au> -;; -;; Keywords: language sensitive abbreviation template placeholder token -;; -;; 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, Inc., 59 Temple Place - Suite 330, -;; Boston, MA 02111-1307, USA. -DELETE LANGUAGE C - -DEFINE LANGUAGE C - - /INITIAL_STRING="{compilation_unit}" - - /PUNCTUATION_CHARACTERS="*.;()," - - /SELF_INSERT_CHARACTERS=" `~!@#$%^&*(),.<>/?;:'[]{}=\-+|" - /VALID_IDENTIFIER_CHARACTERS="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_0123456789" - /INDENT_SIZE=2 - - /VERSION=1.14 - -END DEFINE - -DELETE PLACEHOLDER - - /LANGUAGE="C" - -DEFINE PLACEHOLDER - - /LANGUAGE="C" - - /NOAUTO_SUBSTITUTE - - /DESCRIPTION="" - - /DUPLICATION=CONTEXT_DEPENDENT - - /SEPARATOR="" - - /TYPE=NONTERMINAL - - - -END DEFINE - -DELETE PLACEHOLDER BREAK; - - /LANGUAGE="C" - -DEFINE PLACEHOLDER BREAK; - - /LANGUAGE="C" - - /NOAUTO_SUBSTITUTE - - /DESCRIPTION="" - - /DUPLICATION=CONTEXT_DEPENDENT - - /SEPARATOR="" - - /TYPE=NONTERMINAL - - - "break;" - -END DEFINE - -DELETE PLACEHOLDER TEXT - - /LANGUAGE="C" - -DEFINE PLACEHOLDER TEXT - - /LANGUAGE="C" - - /NOAUTO_SUBSTITUTE - - /DESCRIPTION="" - - /DUPLICATION=CONTEXT_DEPENDENT - - /SEPARATOR="" - - /TYPE=TERMINAL - - - ""Just enter some text please."" - -END DEFINE - -DELETE PLACEHOLDER "= {CONSTANT_EXPRESSION}" - - /LANGUAGE="C" - -DEFINE PLACEHOLDER = {CONSTANT_EXPRESSION} - - /LANGUAGE="C" - - /NOAUTO_SUBSTITUTE - - /DESCRIPTION="" - - /DUPLICATION=CONTEXT_DEPENDENT - - /SEPARATOR="" - - /TYPE=NONTERMINAL - - - "= {constant_expression}" - -END DEFINE - -DELETE PLACEHOLDER ITERATION_STATEMENT - - /LANGUAGE="C" - -DEFINE PLACEHOLDER ITERATION_STATEMENT - - /LANGUAGE="C" - - /NOAUTO_SUBSTITUTE - - /DESCRIPTION="" - - /DUPLICATION=CONTEXT_DEPENDENT - - /SEPARATOR="" - - /TYPE=MENU - - - "while_statement"/PLACEHOLDER - "do_statement"/PLACEHOLDER - "for_statement"/PLACEHOLDER - -END DEFINE - -DELETE PLACEHOLDER {INCLUDE_FILES}... - - /LANGUAGE="C" - -DEFINE PLACEHOLDER {INCLUDE_FILES}... - - /LANGUAGE="C" - - /NOAUTO_SUBSTITUTE - - /DESCRIPTION="" - - /DUPLICATION=CONTEXT_DEPENDENT - - /SEPARATOR="" - - /TYPE=NONTERMINAL - - - "{include_files}..." - -END DEFINE - -DELETE PLACEHOLDER WHILE_STATEMENT - - /LANGUAGE="C" - -DEFINE PLACEHOLDER WHILE_STATEMENT - - /LANGUAGE="C" - - /NOAUTO_SUBSTITUTE - - /DESCRIPTION="" - - /DUPLICATION=CONTEXT_DEPENDENT - - /SEPARATOR="" - - /TYPE=NONTERMINAL - - - "while ({expression}) {" - " {statement}..." - "}" - -END DEFINE - -DELETE PLACEHOLDER ARRAY_DECLARATOR - - /LANGUAGE="C" - -DEFINE PLACEHOLDER ARRAY_DECLARATOR - - /LANGUAGE="C" - - /NOAUTO_SUBSTITUTE - - /DESCRIPTION="" - - /DUPLICATION=CONTEXT_DEPENDENT - - /SEPARATOR="" - - /TYPE=NONTERMINAL - - - "{identifier}[[constant_expression]]" - -END DEFINE - -DELETE PLACEHOLDER UNION_SPECIFIER - - /LANGUAGE="C" - -DEFINE PLACEHOLDER UNION_SPECIFIER - - /LANGUAGE="C" - - /NOAUTO_SUBSTITUTE - - /DESCRIPTION="" - - /DUPLICATION=CONTEXT_DEPENDENT - - /SEPARATOR="" - - /TYPE=NONTERMINAL - - - "union [identifier] [{{struct_declaration}...}]" - -END DEFINE - -DELETE PLACEHOLDER [TYPE_QUALIFIER]... - - /LANGUAGE="C" - -DEFINE PLACEHOLDER [TYPE_QUALIFIER]... - - /LANGUAGE="C" - - /NOAUTO_SUBSTITUTE - - /DESCRIPTION="" - - /DUPLICATION=CONTEXT_DEPENDENT - - /SEPARATOR="" - - /TYPE=NONTERMINAL - - - "[type_qualifier]..." - -END DEFINE - -DELETE PLACEHOLDER FOR_STATEMENT - - /LANGUAGE="C" - -DEFINE PLACEHOLDER FOR_STATEMENT - - /LANGUAGE="C" - - /NOAUTO_SUBSTITUTE - - /DESCRIPTION="" - - /DUPLICATION=CONTEXT_DEPENDENT - - /SEPARATOR="" - - /TYPE=NONTERMINAL - - - "for ([loop_init]; [loop_control]; [expression]) {" - " {statement}..." - "}" - -END DEFINE - -DELETE PLACEHOLDER ENUMERATOR - - /LANGUAGE="C" - -DEFINE PLACEHOLDER ENUMERATOR - - /LANGUAGE="C" - - /NOAUTO_SUBSTITUTE - - /DESCRIPTION="" - - /DUPLICATION=CONTEXT_DEPENDENT - - /SEPARATOR=", " - - /TYPE=NONTERMINAL - - - "{identifier} [= {constant_expression}]" - -END DEFINE - -DELETE PLACEHOLDER STATIC_OR_EXTERN - - /LANGUAGE="C" - -DEFINE PLACEHOLDER STATIC_OR_EXTERN - - /LANGUAGE="C" - - /NOAUTO_SUBSTITUTE - - /DESCRIPTION="" - - /DUPLICATION=CONTEXT_DEPENDENT - - /SEPARATOR="" - - /TYPE=MENU - - - "static" - "extern" - -END DEFINE - -DELETE PLACEHOLDER COMPILATION_UNIT - - /LANGUAGE="C" - -DEFINE PLACEHOLDER COMPILATION_UNIT - - /LANGUAGE="C" - - /NOAUTO_SUBSTITUTE - - /DESCRIPTION="" - - /DUPLICATION=CONTEXT_DEPENDENT - - /SEPARATOR="" - - /TYPE=NONTERMINAL - - - "[{include_files}...]" - " " - "[{data_types_or_declarations}...]" - " " - "[{function_definition}...]" - " " - "[main_function]" - -END DEFINE - -DELETE PLACEHOLDER ELSE_PART - - /LANGUAGE="C" - -DEFINE PLACEHOLDER ELSE_PART - - /LANGUAGE="C" - - /NOAUTO_SUBSTITUTE - - /DESCRIPTION="" - - /DUPLICATION=CONTEXT_DEPENDENT - - /SEPARATOR="" - - /TYPE=NONTERMINAL - - - "else {" - " {statement}..." - "}" - -END DEFINE - -DELETE PLACEHOLDER "= {INITIALIZER}" - - /LANGUAGE="C" - -DEFINE PLACEHOLDER = {INITIALIZER} - - /LANGUAGE="C" - - /NOAUTO_SUBSTITUTE - - /DESCRIPTION="" - - /DUPLICATION=CONTEXT_DEPENDENT - - /SEPARATOR="" - - /TYPE=NONTERMINAL - - - "= {initializer}" - -END DEFINE - -DELETE PLACEHOLDER LABELED_STATEMENT - - /LANGUAGE="C" - -DEFINE PLACEHOLDER LABELED_STATEMENT - - /LANGUAGE="C" - - /NOAUTO_SUBSTITUTE - - /DESCRIPTION="" - - /DUPLICATION=CONTEXT_DEPENDENT - - /SEPARATOR="" - - /TYPE=NONTERMINAL - - - "{identifier} :" - " {statement}..." - -END DEFINE - -DELETE PLACEHOLDER DECLARATION_LIST - - /LANGUAGE="C" - -DEFINE PLACEHOLDER DECLARATION_LIST - - /LANGUAGE="C" - - /NOAUTO_SUBSTITUTE - - /DESCRIPTION="" - - /DUPLICATION=CONTEXT_DEPENDENT - - /SEPARATOR="" - - /TYPE=NONTERMINAL - - - "{declaration}..." - -END DEFINE - -DELETE PLACEHOLDER INIT_DECLARATOR - - /LANGUAGE="C" - -DEFINE PLACEHOLDER INIT_DECLARATOR - - /LANGUAGE="C" - - /NOAUTO_SUBSTITUTE - - /DESCRIPTION="" - - /DUPLICATION=CONTEXT_DEPENDENT - - /SEPARATOR=", " - - /TYPE=NONTERMINAL - - - "{declarator} [= {initializer}]" - -END DEFINE - -DELETE PLACEHOLDER DIRECT_ABSTRACT_DECLARATOR - - /LANGUAGE="C" - -DEFINE PLACEHOLDER DIRECT_ABSTRACT_DECLARATOR - - /LANGUAGE="C" - - /NOAUTO_SUBSTITUTE - - /DESCRIPTION="" - - /DUPLICATION=CONTEXT_DEPENDENT - - /SEPARATOR="" - - /TYPE=MENU - - - "({abstract_declarator})" - "[ ]" - "[ {constant_expression} ]" - "{direct_abstract_declarator} [ ]" - "{direct_abstract_declarator} [ {constant_expression} ]" - "()" - "({parameter_declaration}...[, ...])" - "{direct_abstract_declarator} ()" - "{direct_abstract_declarator} ({parameter_declaration}...[, ...])" - -END DEFINE - -DELETE PLACEHOLDER PROTOTYPE_DECLARATION - - /LANGUAGE="C" - -DEFINE PLACEHOLDER PROTOTYPE_DECLARATION - - /LANGUAGE="C" - - /NOAUTO_SUBSTITUTE - - /DESCRIPTION="" - - /DUPLICATION=CONTEXT_DEPENDENT - - /SEPARATOR="" - - /TYPE=NONTERMINAL - - - "[static_or_extern] {data_type_specifier} [*]{function_name} ([{parameter_declaration}...[, ...]]);" - -END DEFINE - -DELETE PLACEHOLDER IDENTIFIER - - /LANGUAGE="C" - -DEFINE PLACEHOLDER IDENTIFIER - - /LANGUAGE="C" - - /NOAUTO_SUBSTITUTE - - /DESCRIPTION="" - - /DUPLICATION=CONTEXT_DEPENDENT - - /SEPARATOR=", " - - /TYPE=TERMINAL - - - "Please enter a valid identifier" - -END DEFINE - -DELETE PLACEHOLDER INITIALIZER - - /LANGUAGE="C" - -DEFINE PLACEHOLDER INITIALIZER - - /LANGUAGE="C" - - /NOAUTO_SUBSTITUTE - - /DESCRIPTION="" - - /DUPLICATION=CONTEXT_DEPENDENT - - /SEPARATOR="" - - /TYPE=MENU - - - "constant_expression"/PLACEHOLDER - "{{init_expression}...}" - ""{string_literal}"" - -END DEFINE - -DELETE PLACEHOLDER OBJECT_DECLARATION - - /LANGUAGE="C" - -DEFINE PLACEHOLDER OBJECT_DECLARATION - - /LANGUAGE="C" - - /NOAUTO_SUBSTITUTE - - /DESCRIPTION="" - - /DUPLICATION=CONTEXT_DEPENDENT - - /SEPARATOR="" - - /TYPE=NONTERMINAL - - - "[storage_class_specifier] [[type_qualifier]...] {data_type_specifier} {init_declarator};" - -END DEFINE - -DELETE PLACEHOLDER {{STRUCT_DECLARATION}...} - - /LANGUAGE="C" - -DEFINE PLACEHOLDER {{STRUCT_DECLARATION}...} - - /LANGUAGE="C" - - /NOAUTO_SUBSTITUTE - - /DESCRIPTION="" - - /DUPLICATION=CONTEXT_DEPENDENT - - /SEPARATOR="" - - /TYPE=NONTERMINAL - - - "{{struct_declaration}...}" - -END DEFINE - -DELETE PLACEHOLDER SWITCH_STATEMENT - - /LANGUAGE="C" - -DEFINE PLACEHOLDER SWITCH_STATEMENT - - /LANGUAGE="C" - - /NOAUTO_SUBSTITUTE - - /DESCRIPTION="" - - /DUPLICATION=CONTEXT_DEPENDENT - - /SEPARATOR="" - - /TYPE=NONTERMINAL - - - "switch ({expression}) {" - " [case_part]..." - " [default_part]" - "}" - -END DEFINE - -DELETE PLACEHOLDER TYPE_SPECIFIER - - /LANGUAGE="C" - -DEFINE PLACEHOLDER TYPE_SPECIFIER - - /LANGUAGE="C" - - /NOAUTO_SUBSTITUTE - - /DESCRIPTION="" - - /DUPLICATION=CONTEXT_DEPENDENT - - /SEPARATOR="" - - /TYPE=TERMINAL - - - "Please enter a valid type_specifier" - -END DEFINE - -DELETE PLACEHOLDER COMPOUND_STATEMENT - - /LANGUAGE="C" - -DEFINE PLACEHOLDER COMPOUND_STATEMENT - - /LANGUAGE="C" - - /NOAUTO_SUBSTITUTE - - /DESCRIPTION="" - - /DUPLICATION=CONTEXT_DEPENDENT - - /SEPARATOR="" - - /TYPE=NONTERMINAL - - - "{" - " [data_types_or_declarations]..." - " " - " [statement]..." - "}" - -END DEFINE - -DELETE PLACEHOLDER POINTER - - /LANGUAGE="C" - -DEFINE PLACEHOLDER POINTER - - /LANGUAGE="C" - - /NOAUTO_SUBSTITUTE - - /DESCRIPTION="" - - /DUPLICATION=CONTEXT_DEPENDENT - - /SEPARATOR="" - - /TYPE=NONTERMINAL - - - "* [type_qualifier_list] [pointer]" - -END DEFINE - -DELETE PLACEHOLDER TYPE_QUALIFIER_LIST - - /LANGUAGE="C" - -DEFINE PLACEHOLDER TYPE_QUALIFIER_LIST - - /LANGUAGE="C" - - /NOAUTO_SUBSTITUTE - - /DESCRIPTION="" - - /DUPLICATION=CONTEXT_DEPENDENT - - /SEPARATOR="" - - /TYPE=NONTERMINAL - - - "{type_qualifier}..." - -END DEFINE - -DELETE PLACEHOLDER DATA_TYPES_OR_DECLARATIONS - - /LANGUAGE="C" - -DEFINE PLACEHOLDER DATA_TYPES_OR_DECLARATIONS - - /LANGUAGE="C" - - /NOAUTO_SUBSTITUTE - - /DESCRIPTION="" - - /DUPLICATION=VERTICAL - - /SEPARATOR="" - - /TYPE=MENU - - - "object_declaration"/PLACEHOLDER - "prototype_declaration"/PLACEHOLDER - "typedef_declaration"/PLACEHOLDER - -END DEFINE - -DELETE PLACEHOLDER STRING_LITERAL - - /LANGUAGE="C" - -DEFINE PLACEHOLDER STRING_LITERAL - - /LANGUAGE="C" - - /NOAUTO_SUBSTITUTE - - /DESCRIPTION="" - - /DUPLICATION=CONTEXT_DEPENDENT - - /SEPARATOR="" - - /TYPE=TERMINAL - - - ""Enter a literal string i.e. "abc""" - -END DEFINE - -DELETE PLACEHOLDER DECLARATOR - - /LANGUAGE="C" - -DEFINE PLACEHOLDER DECLARATOR - - /LANGUAGE="C" - - /NOAUTO_SUBSTITUTE - - /DESCRIPTION="" - - /DUPLICATION=CONTEXT_DEPENDENT - - /SEPARATOR=", " - - /TYPE=MENU - - - "identifier"/PLACEHOLDER - "({declarator})" - "array_declarator"/PLACEHOLDER - "function_declarator"/PLACEHOLDER - -END DEFINE - -DELETE PLACEHOLDER INCLUDE_FILES - - /LANGUAGE="C" - -DEFINE PLACEHOLDER INCLUDE_FILES - - /LANGUAGE="C" - - /NOAUTO_SUBSTITUTE - - /DESCRIPTION="" - - /DUPLICATION=CONTEXT_DEPENDENT - - /SEPARATOR="" - - /TYPE=MENU - - - "#include <{file_name}>" - "#include "{string_literal}"" - -END DEFINE - -DELETE PLACEHOLDER STRUCT_DECLARATOR - - /LANGUAGE="C" - -DEFINE PLACEHOLDER STRUCT_DECLARATOR - - /LANGUAGE="C" - - /NOAUTO_SUBSTITUTE - - /DESCRIPTION="" - - /DUPLICATION=CONTEXT_DEPENDENT - - /SEPARATOR="" - - /TYPE=NONTERMINAL - - - "[declarator]... : {constant_expression}" - -END DEFINE - -DELETE PLACEHOLDER FUNCTION_DECLARATOR - - /LANGUAGE="C" - -DEFINE PLACEHOLDER FUNCTION_DECLARATOR - - /LANGUAGE="C" - - /NOAUTO_SUBSTITUTE - - /DESCRIPTION="" - - /DUPLICATION=CONTEXT_DEPENDENT - - /SEPARATOR="" - - /TYPE=NONTERMINAL - - - "{identifier} ([{parameter_declaration}...[, ...]])" - -END DEFINE - -DELETE PLACEHOLDER TYPE_QUALIFIER - - /LANGUAGE="C" - -DEFINE PLACEHOLDER TYPE_QUALIFIER - - /LANGUAGE="C" - - /NOAUTO_SUBSTITUTE - - /DESCRIPTION="" - - /DUPLICATION=CONTEXT_DEPENDENT - - /SEPARATOR=" " - - /TYPE=MENU - - - "const" - "volatile" - -END DEFINE - -DELETE PLACEHOLDER DEFAULT_PART - - /LANGUAGE="C" - -DEFINE PLACEHOLDER DEFAULT_PART - - /LANGUAGE="C" - - /NOAUTO_SUBSTITUTE - - /DESCRIPTION="" - - /DUPLICATION=CONTEXT_DEPENDENT - - /SEPARATOR="" - - /TYPE=NONTERMINAL - - - "default :" - " [statement]..." - -END DEFINE - -DELETE PLACEHOLDER EXPRESSION - - /LANGUAGE="C" - -DEFINE PLACEHOLDER EXPRESSION - - /LANGUAGE="C" - - /NOAUTO_SUBSTITUTE - - /DESCRIPTION="" - - /DUPLICATION=CONTEXT_DEPENDENT - - /SEPARATOR="" - - /TYPE=TERMINAL - - - ""Just type in standard expression"" - -END DEFINE - -DELETE PLACEHOLDER TYPEDEF_DECLARATION - - /LANGUAGE="C" - -DEFINE PLACEHOLDER TYPEDEF_DECLARATION - - /LANGUAGE="C" - - /NOAUTO_SUBSTITUTE - - /DESCRIPTION="" - - /DUPLICATION=CONTEXT_DEPENDENT - - /SEPARATOR="" - - /TYPE=NONTERMINAL - - - "typedef [type_qualifier]... {data_type_specifier} {declarator}...;" - -END DEFINE - -DELETE PLACEHOLDER STORAGE_CLASS_SPECIFIER - - /LANGUAGE="C" - -DEFINE PLACEHOLDER STORAGE_CLASS_SPECIFIER - - /LANGUAGE="C" - - /NOAUTO_SUBSTITUTE - - /DESCRIPTION="" - - /DUPLICATION=CONTEXT_DEPENDENT - - /SEPARATOR="" - - /TYPE=MENU - - - "extern" - "static" - "auto" - "register" - -END DEFINE - -DELETE PLACEHOLDER TYPE_NAME - - /LANGUAGE="C" - -DEFINE PLACEHOLDER TYPE_NAME - - /LANGUAGE="C" - - /NOAUTO_SUBSTITUTE - - /DESCRIPTION="" - - /DUPLICATION=CONTEXT_DEPENDENT - - /SEPARATOR="" - - /TYPE=NONTERMINAL - - - "{specifier_qualifier_list} [abstract_declarator]" - -END DEFINE - -DELETE PLACEHOLDER "CASE {CONSTANT_EXPRESSION}:" - - /LANGUAGE="C" - -DEFINE PLACEHOLDER CASE {CONSTANT_EXPRESSION}: - - /LANGUAGE="C" - - /NOAUTO_SUBSTITUTE - - /DESCRIPTION="" - - /DUPLICATION=CONTEXT_DEPENDENT - - /SEPARATOR="" - - /TYPE=NONTERMINAL - - - "case {constant_expression}:" - -END DEFINE - -DELETE PLACEHOLDER ABSTRACT_DECLARATOR - - /LANGUAGE="C" - -DEFINE PLACEHOLDER ABSTRACT_DECLARATOR - - /LANGUAGE="C" - - /NOAUTO_SUBSTITUTE - - /DESCRIPTION="" - - /DUPLICATION=CONTEXT_DEPENDENT - - /SEPARATOR="" - - /TYPE=NONTERMINAL - - - "[pointer] [direct_abstract_declarator]" - -END DEFINE - -DELETE PLACEHOLDER {DATA_TYPES_OR_DECLARATIONS}... - - /LANGUAGE="C" - -DEFINE PLACEHOLDER {DATA_TYPES_OR_DECLARATIONS}... - - /LANGUAGE="C" - - /NOAUTO_SUBSTITUTE - - /DESCRIPTION="" - - /DUPLICATION=CONTEXT_DEPENDENT - - /SEPARATOR="" - - /TYPE=NONTERMINAL - - - "{data_types_or_declarations}..." - -END DEFINE - -DELETE PLACEHOLDER MAIN_FUNCTION_DECLARATOR - - /LANGUAGE="C" - -DEFINE PLACEHOLDER MAIN_FUNCTION_DECLARATOR - - /LANGUAGE="C" - - /NOAUTO_SUBSTITUTE - - /DESCRIPTION="" - - /DUPLICATION=CONTEXT_DEPENDENT - - /SEPARATOR="" - - /TYPE=MENU - - - "{data_type_specifier} main()" - "{data_type_specifier} main(int argc, char *argv[])" - "{data_type_specifier} main(int argc, char *argv[], char *envp[])" - -END DEFINE - -DELETE PLACEHOLDER * - - /LANGUAGE="C" - -DEFINE PLACEHOLDER * - - /LANGUAGE="C" - - /NOAUTO_SUBSTITUTE - - /DESCRIPTION="" - - /DUPLICATION=CONTEXT_DEPENDENT - - /SEPARATOR="" - - /TYPE=NONTERMINAL - - - "*" - -END DEFINE - -DELETE PLACEHOLDER STATEMENT - - /LANGUAGE="C" - -DEFINE PLACEHOLDER STATEMENT - - /LANGUAGE="C" - - /NOAUTO_SUBSTITUTE - - /DESCRIPTION="" - - /DUPLICATION=VERTICAL - - /SEPARATOR="" - - /TYPE=MENU - - - "labeled_statement"/PLACEHOLDER - "compound_statement"/PLACEHOLDER - "{assignment_expression};" - "selection_statement"/PLACEHOLDER - "iteration_statement"/PLACEHOLDER - "jump_statement"/PLACEHOLDER - "comment_statement"/PLACEHOLDER - -END DEFINE - -DELETE PLACEHOLDER CONSTANT_EXPRESSION - - /LANGUAGE="C" - -DEFINE PLACEHOLDER CONSTANT_EXPRESSION - - /LANGUAGE="C" - - /NOAUTO_SUBSTITUTE - - /DESCRIPTION="" - - /DUPLICATION=CONTEXT_DEPENDENT - - /SEPARATOR="" - - /TYPE=TERMINAL - - - ""Just enter a constant expression"" - -END DEFINE - -DELETE PLACEHOLDER FUNCTION_NAME - - /LANGUAGE="C" - -DEFINE PLACEHOLDER FUNCTION_NAME - - /LANGUAGE="C" - - /NOAUTO_SUBSTITUTE - - /DESCRIPTION="" - - /DUPLICATION=CONTEXT_DEPENDENT - - /SEPARATOR="" - - /TYPE=TERMINAL - - - "Please enter a valid function_name" - -END DEFINE - -DELETE PLACEHOLDER LOOP_INIT - - /LANGUAGE="C" - -DEFINE PLACEHOLDER LOOP_INIT - - /LANGUAGE="C" - - /NOAUTO_SUBSTITUTE - - /DESCRIPTION="" - - /DUPLICATION=CONTEXT_DEPENDENT - - /SEPARATOR="" - - /TYPE=NONTERMINAL - - - "{expression}" - -END DEFINE - -DELETE PLACEHOLDER CASE_PART - - /LANGUAGE="C" - -DEFINE PLACEHOLDER CASE_PART - - /LANGUAGE="C" - - /NOAUTO_SUBSTITUTE - - /DESCRIPTION="" - - /DUPLICATION=VERTICAL - - /SEPARATOR="" - - /TYPE=NONTERMINAL - - - "case {constant_expression}:" - "[case {constant_expression}:]..." - " [statement]..." - " [break;]" - -END DEFINE - -DELETE PLACEHOLDER PRIMARY_EXPRESSION - - /LANGUAGE="C" - -DEFINE PLACEHOLDER PRIMARY_EXPRESSION - - /LANGUAGE="C" - - /NOAUTO_SUBSTITUTE - - /DESCRIPTION="" - - /DUPLICATION=CONTEXT_DEPENDENT - - /SEPARATOR="" - - /TYPE=MENU - - - "identifier"/PLACEHOLDER - "constant"/PLACEHOLDER - "string_literal"/PLACEHOLDER - "({expression})" - -END DEFINE - -DELETE PLACEHOLDER DECLARATION - - /LANGUAGE="C" - -DEFINE PLACEHOLDER DECLARATION - - /LANGUAGE="C" - - /NOAUTO_SUBSTITUTE - - /DESCRIPTION="" - - /DUPLICATION=VERTICAL - - /SEPARATOR="" - - /TYPE=NONTERMINAL - - - "[type_qualifier] [storage_class_specifier] {data_type_specifier} {init_declarator}...;" - -END DEFINE - -DELETE PLACEHOLDER JUMP_STATEMENT - - /LANGUAGE="C" - -DEFINE PLACEHOLDER JUMP_STATEMENT - - /LANGUAGE="C" - - /NOAUTO_SUBSTITUTE - - /DESCRIPTION="" - - /DUPLICATION=CONTEXT_DEPENDENT - - /SEPARATOR="" - - /TYPE=MENU - - - "goto {identifier};" - "continue;" - "break;" - "return [expression];" - -END DEFINE - -DELETE PLACEHOLDER STRUCT_SPECIFIER - - /LANGUAGE="C" - -DEFINE PLACEHOLDER STRUCT_SPECIFIER - - /LANGUAGE="C" - - /NOAUTO_SUBSTITUTE - - /DESCRIPTION="" - - /DUPLICATION=CONTEXT_DEPENDENT - - /SEPARATOR="" - - /TYPE=NONTERMINAL - - - "struct [identifier] [{{struct_declaration}...}]" - -END DEFINE - -DELETE PLACEHOLDER MAIN_FUNCTION - - /LANGUAGE="C" - -DEFINE PLACEHOLDER MAIN_FUNCTION - - /LANGUAGE="C" - - /NOAUTO_SUBSTITUTE - - /DESCRIPTION="" - - /DUPLICATION=CONTEXT_DEPENDENT - - /SEPARATOR="" - - /TYPE=NONTERMINAL - - - "{main_function_declarator}" - "{" - " {data_types_or_declarations}..." - " " - " {statement}..." - "}" - -END DEFINE - -DELETE PLACEHOLDER CONSTANT - - /LANGUAGE="C" - -DEFINE PLACEHOLDER CONSTANT - - /LANGUAGE="C" - - /NOAUTO_SUBSTITUTE - - /DESCRIPTION="" - - /DUPLICATION=CONTEXT_DEPENDENT - - /SEPARATOR="" - - /TYPE=TERMINAL - - - "Please enter a valid constant" - -END DEFINE - -DELETE PLACEHOLDER FILE_NAME - - /LANGUAGE="C" - -DEFINE PLACEHOLDER FILE_NAME - - /LANGUAGE="C" - - /NOAUTO_SUBSTITUTE - - /DESCRIPTION="" - - /DUPLICATION=CONTEXT_DEPENDENT - - /SEPARATOR="" - - /TYPE=TERMINAL - - - "Please enter a valid file_name" - -END DEFINE - -DELETE PLACEHOLDER LOOP_CONTROL - - /LANGUAGE="C" - -DEFINE PLACEHOLDER LOOP_CONTROL - - /LANGUAGE="C" - - /NOAUTO_SUBSTITUTE - - /DESCRIPTION="" - - /DUPLICATION=CONTEXT_DEPENDENT - - /SEPARATOR="" - - /TYPE=NONTERMINAL - - - "{expression}" - -END DEFINE - -DELETE PLACEHOLDER ", ..." - - /LANGUAGE="C" - -DEFINE PLACEHOLDER , ... - - /LANGUAGE="C" - - /NOAUTO_SUBSTITUTE - - /DESCRIPTION="" - - /DUPLICATION=CONTEXT_DEPENDENT - - /SEPARATOR="" - - /TYPE=NONTERMINAL - - - ", ..." - -END DEFINE - -DELETE PLACEHOLDER STRUCT_DECLARATION - - /LANGUAGE="C" - -DEFINE PLACEHOLDER STRUCT_DECLARATION - - /LANGUAGE="C" - - /NOAUTO_SUBSTITUTE - - /DESCRIPTION="" - - /DUPLICATION=VERTICAL - - /SEPARATOR="; " - - /TYPE=NONTERMINAL - - - "{data_type_specifier} {declarator}" - -END DEFINE - -DELETE PLACEHOLDER INIT_EXPRESSION - - /LANGUAGE="C" - -DEFINE PLACEHOLDER INIT_EXPRESSION - - /LANGUAGE="C" - - /NOAUTO_SUBSTITUTE - - /DESCRIPTION="" - - /DUPLICATION=CONTEXT_DEPENDENT - - /SEPARATOR=", " - - /TYPE=NONTERMINAL - - - "{initializer}" - -END DEFINE - -DELETE PLACEHOLDER "{PARAMETER_DECLARATION}...[, ...]" - - /LANGUAGE="C" - -DEFINE PLACEHOLDER {PARAMETER_DECLARATION}...[, ...] - - /LANGUAGE="C" - - /NOAUTO_SUBSTITUTE - - /DESCRIPTION="" - - /DUPLICATION=CONTEXT_DEPENDENT - - /SEPARATOR="" - - /TYPE=NONTERMINAL - - - "{parameter_declaration}...[, ...]" - -END DEFINE - -DELETE PLACEHOLDER SELECTION_STATEMENT - - /LANGUAGE="C" - -DEFINE PLACEHOLDER SELECTION_STATEMENT - - /LANGUAGE="C" - - /NOAUTO_SUBSTITUTE - - /DESCRIPTION="" - - /DUPLICATION=CONTEXT_DEPENDENT - - /SEPARATOR="" - - /TYPE=MENU - - - "if_statement"/PLACEHOLDER - "switch_statement"/PLACEHOLDER - -END DEFINE - -DELETE PLACEHOLDER DO_STATEMENT - - /LANGUAGE="C" - -DEFINE PLACEHOLDER DO_STATEMENT - - /LANGUAGE="C" - - /NOAUTO_SUBSTITUTE - - /DESCRIPTION="" - - /DUPLICATION=CONTEXT_DEPENDENT - - /SEPARATOR="" - - /TYPE=NONTERMINAL - - - "do {" - " {statement}..." - "} while ({expression});" - -END DEFINE - -DELETE PLACEHOLDER PARAMETER_DECLARATION - - /LANGUAGE="C" - -DEFINE PLACEHOLDER PARAMETER_DECLARATION - - /LANGUAGE="C" - - /NOAUTO_SUBSTITUTE - - /DESCRIPTION="" - - /DUPLICATION=CONTEXT_DEPENDENT - - /SEPARATOR=", " - - /TYPE=NONTERMINAL - - - "{data_type_specifier} {declarator}" - -END DEFINE - -DELETE PLACEHOLDER IF_STATEMENT - - /LANGUAGE="C" - -DEFINE PLACEHOLDER IF_STATEMENT - - /LANGUAGE="C" - - /NOAUTO_SUBSTITUTE - - /DESCRIPTION="" - - /DUPLICATION=CONTEXT_DEPENDENT - - /SEPARATOR="" - - /TYPE=NONTERMINAL - - - "if ({expression}) {" - " {statement}..." - "}" - "[elsif_part]..." - "[else_part]" - -END DEFINE - -DELETE PLACEHOLDER COMMENT_STATEMENT - - /LANGUAGE="C" - -DEFINE PLACEHOLDER COMMENT_STATEMENT - - /LANGUAGE="C" - - /NOAUTO_SUBSTITUTE - - /DESCRIPTION="" - - /DUPLICATION=CONTEXT_DEPENDENT - - /SEPARATOR="" - - /TYPE=NONTERMINAL - - - "/* {text} */" - -END DEFINE - -DELETE PLACEHOLDER ASSIGNMENT_EXPRESSION - - /LANGUAGE="C" - -DEFINE PLACEHOLDER ASSIGNMENT_EXPRESSION - - /LANGUAGE="C" - - /NOAUTO_SUBSTITUTE - - /DESCRIPTION="" - - /DUPLICATION=CONTEXT_DEPENDENT - - /SEPARATOR="" - - /TYPE=TERMINAL - - - "Please enter a valid assignment_expression" - -END DEFINE - -DELETE PLACEHOLDER ELSIF_PART - - /LANGUAGE="C" - -DEFINE PLACEHOLDER ELSIF_PART - - /LANGUAGE="C" - - /NOAUTO_SUBSTITUTE - - /DESCRIPTION="" - - /DUPLICATION=VERTICAL - - /SEPARATOR="" - - /TYPE=NONTERMINAL - - - "else if ({expression}) {" - " {statement}..." - "}" - -END DEFINE - -DELETE PLACEHOLDER IDENTIFIER_LIST - - /LANGUAGE="C" - -DEFINE PLACEHOLDER IDENTIFIER_LIST - - /LANGUAGE="C" - - /NOAUTO_SUBSTITUTE - - /DESCRIPTION="" - - /DUPLICATION=CONTEXT_DEPENDENT - - /SEPARATOR="" - - /TYPE=NONTERMINAL - - - "{identifier}..." - -END DEFINE - -DELETE PLACEHOLDER {FUNCTION_DEFINITION}... - - /LANGUAGE="C" - -DEFINE PLACEHOLDER {FUNCTION_DEFINITION}... - - /LANGUAGE="C" - - /NOAUTO_SUBSTITUTE - - /DESCRIPTION="" - - /DUPLICATION=CONTEXT_DEPENDENT - - /SEPARATOR="" - - /TYPE=NONTERMINAL - - - "{function_definition}..." - -END DEFINE - -DELETE PLACEHOLDER FUNCTION_DEFINITION - - /LANGUAGE="C" - -DEFINE PLACEHOLDER FUNCTION_DEFINITION - - /LANGUAGE="C" - - /NOAUTO_SUBSTITUTE - - /DESCRIPTION="" - - /DUPLICATION=CONTEXT_DEPENDENT - - /SEPARATOR="" - - /TYPE=NONTERMINAL - - - "[static_or_extern] {data_type_specifier} [*]{function_name} ([{parameter_declaration}...[, ...]])" - "{" - " [declaration]..." - " " - " [statement]..." - "}" - -END DEFINE - -DELETE PLACEHOLDER ENUM_SPECIFIER - - /LANGUAGE="C" - -DEFINE PLACEHOLDER ENUM_SPECIFIER - - /LANGUAGE="C" - - /NOAUTO_SUBSTITUTE - - /DESCRIPTION="" - - /DUPLICATION=CONTEXT_DEPENDENT - - /SEPARATOR="" - - /TYPE=NONTERMINAL - - - "enum [identifier] {{enumerator}...}" - -END DEFINE - -DELETE PLACEHOLDER SPECIFIER_QUALIFIER_LIST - - /LANGUAGE="C" - -DEFINE PLACEHOLDER SPECIFIER_QUALIFIER_LIST - - /LANGUAGE="C" - - /NOAUTO_SUBSTITUTE - - /DESCRIPTION="" - - /DUPLICATION=CONTEXT_DEPENDENT - - /SEPARATOR="" - - /TYPE=MENU - - - "{type_specifier} {specifier_qualifier_list}" - "type_specifier"/PLACEHOLDER - "{type_qualifier} {specifier_qualifier_list}" - "type_qualifier"/PLACEHOLDER - -END DEFINE - -DELETE PLACEHOLDER DATA_TYPE_SPECIFIER - - /LANGUAGE="C" - -DEFINE PLACEHOLDER DATA_TYPE_SPECIFIER - - /LANGUAGE="C" - - /NOAUTO_SUBSTITUTE - - /DESCRIPTION="" - - /DUPLICATION=CONTEXT_DEPENDENT - - /SEPARATOR="" - - /TYPE=MENU - - - "void" - "char" - "int" - "float" - "double" - "unsigned char" - "signed char" - "unsigned short int" - "signed short int" - "short int" - "unsigned int" - "signed int" - "unsigned long int" - "signed long int" - "long int" - "struct_specifier"/PLACEHOLDER - "union_specifier"/PLACEHOLDER - "enum_specifier"/PLACEHOLDER - "type_name"/PLACEHOLDER - -END DEFINE - -The following tokens are generated automatically: -DELETE TOKEN CASE - - /LANGUAGE="C" - -DEFINE TOKEN CASE - - /LANGUAGE="C" - - /PLACEHOLDER=CASE_PART - - -END DEFINE - -DELETE TOKEN DO - - /LANGUAGE="C" - -DEFINE TOKEN DO - - /LANGUAGE="C" - - /PLACEHOLDER=DO_STATEMENT - - -END DEFINE - -DELETE TOKEN TYPEDEF - - /LANGUAGE="C" - -DEFINE TOKEN TYPEDEF - - /LANGUAGE="C" - - /PLACEHOLDER=TYPEDEF_DECLARATION - - -END DEFINE - -DELETE TOKEN CONST - - /LANGUAGE="C" - -DEFINE TOKEN CONST - - /LANGUAGE="C" - - /PLACEHOLDER=TYPE_QUALIFIER - - -END DEFINE - -DELETE TOKEN GOTO - - /LANGUAGE="C" - -DEFINE TOKEN GOTO - - /LANGUAGE="C" - - /PLACEHOLDER=JUMP_STATEMENT - - -END DEFINE - -DELETE TOKEN FOR - - /LANGUAGE="C" - -DEFINE TOKEN FOR - - /LANGUAGE="C" - - /PLACEHOLDER=FOR_STATEMENT - - -END DEFINE - -DELETE TOKEN DEFAULT - - /LANGUAGE="C" - -DEFINE TOKEN DEFAULT - - /LANGUAGE="C" - - /PLACEHOLDER=DEFAULT_PART - - -END DEFINE - -DELETE TOKEN UNION - - /LANGUAGE="C" - -DEFINE TOKEN UNION - - /LANGUAGE="C" - - /PLACEHOLDER=UNION_SPECIFIER - - -END DEFINE - -DELETE TOKEN VOID - - /LANGUAGE="C" - -DEFINE TOKEN VOID - - /LANGUAGE="C" - - /PLACEHOLDER=DATA_TYPE_SPECIFIER - - -END DEFINE - -DELETE TOKEN ENUM - - /LANGUAGE="C" - -DEFINE TOKEN ENUM - - /LANGUAGE="C" - - /PLACEHOLDER=ENUM_SPECIFIER - - -END DEFINE - -DELETE TOKEN WHILE - - /LANGUAGE="C" - -DEFINE TOKEN WHILE - - /LANGUAGE="C" - - /PLACEHOLDER=WHILE_STATEMENT - - -END DEFINE - -DELETE TOKEN STRUCT - - /LANGUAGE="C" - -DEFINE TOKEN STRUCT - - /LANGUAGE="C" - - /PLACEHOLDER=STRUCT_SPECIFIER - - -END DEFINE - -DELETE TOKEN ELSE - - /LANGUAGE="C" - -DEFINE TOKEN ELSE - - /LANGUAGE="C" - - /PLACEHOLDER=ELSE_PART - - -END DEFINE - -DELETE TOKEN #INCLUDE - - /LANGUAGE="C" - -DEFINE TOKEN #INCLUDE - - /LANGUAGE="C" - - /PLACEHOLDER=INCLUDE_FILES - - -END DEFINE - -DELETE TOKEN SWITCH - - /LANGUAGE="C" - -DEFINE TOKEN SWITCH - - /LANGUAGE="C" - - /PLACEHOLDER=SWITCH_STATEMENT - - -END DEFINE - -DELETE TOKEN STATIC - - /LANGUAGE="C" - -DEFINE TOKEN STATIC - - /LANGUAGE="C" - - /PLACEHOLDER=STATIC_OR_EXTERN - - -END DEFINE - -DELETE TOKEN EXTERN - - /LANGUAGE="C" - -DEFINE TOKEN EXTERN - - /LANGUAGE="C" - - /PLACEHOLDER=STORAGE_CLASS_SPECIFIER - - -END DEFINE - -DELETE TOKEN IF - - /LANGUAGE="C" - -DEFINE TOKEN IF - - /LANGUAGE="C" - - /PLACEHOLDER=IF_STATEMENT - - -END DEFINE - diff --git a/app-emacs/else-mode/files/Emacs-Lisp.lse b/app-emacs/else-mode/files/Emacs-Lisp.lse deleted file mode 100644 index 1fc10d5..0000000 --- a/app-emacs/else-mode/files/Emacs-Lisp.lse +++ /dev/null @@ -1,1849 +0,0 @@ -;; Copyright (C) 1997,1998,1999,2000,2001,2002,2003 Peter Milliken -;; -;; Author: Peter Milliken <peterm@resmed.com.au>, -;; <peterm@unwired.com.au> -;; -;; Keywords: language sensitive abbreviation template placeholder token -;; -;; 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, Inc., 59 Temple Place - Suite 330, -;; Boston, MA 02111-1307, USA. - -DELETE LANGUAGE "Emacs-Lisp" - -DEFINE LANGUAGE "Emacs-Lisp" - - /INITIAL_STRING="{compilation_unit}" - - /PUNCTUATION_CHARACTERS=",;()*.'" - - /SELF_INSERT_CHARACTERS=" `~!@#$%^&*(),.<>/?;:'[]{}=\-+|"" - /VALID_IDENTIFIER_CHARACTERS="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_0123456789" - /INDENT_SIZE=2 - /VERSION=1.9 - -END DEFINE - -DELETE PLACEHOLDER COMPILATION_UNIT - - /LANGUAGE="Emacs-Lisp" - -DEFINE PLACEHOLDER COMPILATION_UNIT - - /LANGUAGE="Emacs-Lisp" - - /NOAUTO_SUBSTITUTE - - /DESCRIPTION="" - - /DUPLICATION=CONTEXT_DEPENDENT - - /SEPARATOR="" - - /TYPE=NONTERMINAL - - "[file_header]" - "[def]..." - "[defun]..." - "[defcustom]..." - -END DEFINE - -DELETE PLACEHOLDER FILE_HEADER - - /LANGUAGE="Emacs-Lisp" - -DEFINE PLACEHOLDER FILE_HEADER - - /LANGUAGE="Emacs-Lisp" - - /NOAUTO_SUBSTITUTE - - /DESCRIPTION="" - - /DUPLICATION=CONTEXT_DEPENDENT - - /SEPARATOR="" - - /TYPE=NONTERMINAL - - ";;; {file-name}.el --- {package-name}" - "" - ";; Copyright (C) {year}... {author-name}" - ";;" - ";; Author: {author-name} [email-address]" - ";;" - ";; $Date[please_expand_me]$" - ";; Version: {text}" - ";; Keywords: {text}..." - ";;" - ";;" - ";; 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, Inc., 59 Temple Place - Suite 330," - ";; Boston, MA 02111-1307, USA." - "" - ";;; Commentary:" - "" - ";; {text}" - "" - ";;; Change Log:" - "" - ";;; Code:" - "" - -END DEFINE - -DELETE PLACEHOLDER PACKAGE-NAME - - /LANGUAGE="Emacs-Lisp" - -DEFINE PLACEHOLDER PACKAGE-NAME - - /LANGUAGE="Emacs-Lisp" - - /NOAUTO_SUBSTITUTE - - /DESCRIPTION="" - - /DUPLICATION=CONTEXT_DEPENDENT - - /SEPARATOR="" - - /TYPE=TERMINAL - - "Enter the name of the package" - -END DEFINE - -DELETE PLACEHOLDER YEAR - - /LANGUAGE="Emacs-Lisp" - -DEFINE PLACEHOLDER YEAR - - /LANGUAGE="Emacs-Lisp" - - /NOAUTO_SUBSTITUTE - - /DESCRIPTION="" - - /DUPLICATION=CONTEXT_DEPENDENT - - /SEPARATOR=", " - - /TYPE=TERMINAL - - "Enter the year of the copyright" - -END DEFINE - -DELETE PLACEHOLDER EMAIL-ADDRESS - - /LANGUAGE="Emacs-Lisp" - -DEFINE PLACEHOLDER EMAIL-ADDRESS - - /LANGUAGE="Emacs-Lisp" - - /NOAUTO_SUBSTITUTE - - /DESCRIPTION="" - - /DUPLICATION=CONTEXT_DEPENDENT - - /SEPARATOR="" - - /TYPE=TERMINAL - - "Enter your email address" - -END DEFINE - -DELETE PLACEHOLDER PLEASE_EXPAND_ME - - /LANGUAGE="Emacs-Lisp" - -DEFINE PLACEHOLDER PLEASE_EXPAND_ME - - /LANGUAGE="Emacs-Lisp" - - /TYPE=NONTERMINAL - - ":" - -END DEFINE - -DELETE PLACEHOLDER AUTHOR-NAME - - /LANGUAGE="Emacs-Lisp" - -DEFINE PLACEHOLDER AUTHOR-NAME - - /LANGUAGE="Emacs-Lisp" - - /AUTO_SUBSTITUTE - - /DESCRIPTION="" - - /DUPLICATION=CONTEXT_DEPENDENT - - /SEPARATOR="" - - /TYPE=TERMINAL - - "Enter the name of the author" - -END DEFINE - - -DELETE PLACEHOLDER FILE-NAME - - /LANGUAGE="Emacs-Lisp" - -DEFINE PLACEHOLDER FILE-NAME - - /LANGUAGE="Emacs-Lisp" - - /NOAUTO_SUBSTITUTE - - /DESCRIPTION="" - - /DUPLICATION=CONTEXT_DEPENDENT - - /SEPARATOR="" - - /TYPE=TERMINAL - - "Please enter the name of the file" - -END DEFINE - -DELETE PLACEHOLDER DEF - - /LANGUAGE="Emacs-Lisp" - -DEFINE PLACEHOLDER DEF - - /LANGUAGE="Emacs-Lisp" - - /NOAUTO_SUBSTITUTE - - /DESCRIPTION="" - - /DUPLICATION=CONTEXT_DEPENDENT - - /SEPARATOR="" - - /TYPE=MENU - - "defmacro"/PLACEHOLDER - "defvar"/PLACEHOLDER - "defadvice"/PLACEHOLDER - "defalias"/PLACEHOLDER - "defconst"/TOKEN - -END DEFINE - -DELETE PLACEHOLDER DEFUN - - /LANGUAGE="Emacs-Lisp" - -DEFINE PLACEHOLDER DEFUN - - /LANGUAGE="Emacs-Lisp" - - /NOAUTO_SUBSTITUTE - - /DESCRIPTION="Define a lisp function" - - /DUPLICATION=CONTEXT_DEPENDENT - - /SEPARATOR="" - - /TYPE=NONTERMINAL - - "(defun {identifier} ([defun_arguments]...)" - " [Documentation]" - " [interactive]" - " {statement}...)" - -END DEFINE - -DELETE PLACEHOLDER DEFUN_ARGUMENTS - - /LANGUAGE="Emacs-Lisp" - -DEFINE PLACEHOLDER DEFUN_ARGUMENTS - - /LANGUAGE="Emacs-Lisp" - - /NOAUTO_SUBSTITUTE - - /DESCRIPTION="lisp defun arguments" - - /DUPLICATION=CONTEXT_DEPENDENT - - /SEPARATOR="" - - /TYPE=NONTERMINAL - /PLACEHOLDER=IDENTIFIER - -END DEFINE - -DELETE PLACEHOLDER DEFVAR - - /LANGUAGE="Emacs-Lisp" - -DEFINE PLACEHOLDER DEFVAR - - /LANGUAGE="Emacs-Lisp" - - /NOAUTO_SUBSTITUTE - - /DESCRIPTION="Define a variable" - - /DUPLICATION=CONTEXT_DEPENDENT - - /SEPARATOR="" - - /TYPE=NONTERMINAL - - "(defvar {identifier} [value]" - " [Documentation])" - -END DEFINE - -DELETE PLACEHOLDER IDENTIFIER - - /LANGUAGE="Emacs-Lisp" - -DEFINE PLACEHOLDER IDENTIFIER - - /LANGUAGE="Emacs-Lisp" - - /NOAUTO_SUBSTITUTE - - /DESCRIPTION="" - - /DUPLICATION=CONTEXT_DEPENDENT - - /SEPARATOR=" " - - /TYPE=TERMINAL - - "Just type in a legal Elisp identifier" - -END DEFINE - -DELETE PLACEHOLDER DOCUMENTATION - - /LANGUAGE="Emacs-Lisp" - -DEFINE PLACEHOLDER DOCUMENTATION - - /LANGUAGE="Emacs-Lisp" - - /NOAUTO_SUBSTITUTE - - /DESCRIPTION="lisp function Documentation" - - /DUPLICATION=CONTEXT_DEPENDENT - - /SEPARATOR="" - - /TYPE=NONTERMINAL - - ""[text]"" - -END DEFINE - -DELETE PLACEHOLDER TEXT - - /LANGUAGE="Emacs-Lisp" - -DEFINE PLACEHOLDER TEXT - - /LANGUAGE="Emacs-Lisp" - - /NOAUTO_SUBSTITUTE - - /DESCRIPTION="lisp function template" - - /DUPLICATION=CONTEXT_DEPENDENT - - /SEPARATOR=" " - - /TYPE=TERMINAL - - "Just type some text" - -END DEFINE - -DELETE PLACEHOLDER LOCAL_DEFINITIONS - - /LANGUAGE="Emacs-Lisp" - -DEFINE PLACEHOLDER LOCAL_DEFINITIONS - - /LANGUAGE="Emacs-Lisp" - - /NOAUTO_SUBSTITUTE - - /DESCRIPTION="lisp local argument" - - /DUPLICATION=VERTICAL - - /SEPARATOR="" - - /TYPE=NONTERMINAL - - "({identifier} [value])" - -END DEFINE - -DELETE PLACEHOLDER VALUE - - /LANGUAGE="Emacs-Lisp" - -DEFINE PLACEHOLDER VALUE - - /LANGUAGE="Emacs-Lisp" - - /NOAUTO_SUBSTITUTE - - /DESCRIPTION="lisp local argument initialisation value" - - /DUPLICATION=CONTEXT_DEPENDENT - - /SEPARATOR="" - - /TYPE=TERMINAL - - "Type a valid initialisation value that you want to use" - -END DEFINE - -DELETE PLACEHOLDER STATEMENT - - /LANGUAGE="Emacs-Lisp" - -DEFINE PLACEHOLDER STATEMENT - - /LANGUAGE="Emacs-Lisp" - - /NOAUTO_SUBSTITUTE - - /DESCRIPTION="lisp statement menu" - - /DUPLICATION=CONTEXT_DEPENDENT - - /SEPARATOR="" - - /TYPE=MENU - - "let_statement"/PLACEHOLDER - "if_statement"/PLACEHOLDER - "progn_statement"/PLACEHOLDER - "plain_statement"/PLACEHOLDER - "cond_statement"/PLACEHOLDER - "while_statement"/PLACEHOLDER - "setq_stmt"/PLACEHOLDER - "catch_stmt"/PLACEHOLDER - "throw"/TOKEN - "unless"/TOKEN - "when"/TOKEN - "dolist"/TOKEN - "dotimes"/TOKEN - "error"/TOKEN - "signal"/TOKEN - "condition-case"/PLACEHOLDER - "unwind-protect"/PLACEHOLDER - "property-list-stmt"/PLACEHOLDER/NOFOLLOW - "symbols"/PLACEHOLDER/NOFOLLOW - "sequences"/PLACEHOLDER/NOFOLLOW - "association_lists"/PLACEHOLDER/NOFOLLOW - "boolean-vectors"/PLACEHOLDER/NOFOLLOW - "arrays"/PLACEHOLDER/NOFOLLOW - "lists-sets"/PLACEHOLDER/NOFOLLOW - "string-stmts"/PLACEHOLDER/NOFOLLOW - -END DEFINE - -DELETE PLACEHOLDER IF_STATEMENT - - /LANGUAGE="Emacs-Lisp" - -DEFINE PLACEHOLDER IF_STATEMENT - - /LANGUAGE="Emacs-Lisp" - - /NOAUTO_SUBSTITUTE - - /DESCRIPTION="if statement" - - /DUPLICATION=CONTEXT_DEPENDENT - - /SEPARATOR="" - - /TYPE=NONTERMINAL - - "(if {condition}" - " {statement}" - " [statement]...)" - -END DEFINE - -DELETE PLACEHOLDER LET_STATEMENT - - /LANGUAGE="Emacs-Lisp" - -DEFINE PLACEHOLDER LET_STATEMENT - - /LANGUAGE="Emacs-Lisp" - - /NOAUTO_SUBSTITUTE - - /DESCRIPTION="let statement" - - /DUPLICATION=CONTEXT_DEPENDENT - - /SEPARATOR="" - - /TYPE=NONTERMINAL - - "(let ([local_definitions]...)" - " {statement}...)" - -END DEFINE - -DELETE PLACEHOLDER PROGN_STATEMENT - - /LANGUAGE="Emacs-Lisp" - -DEFINE PLACEHOLDER PROGN_STATEMENT - - /LANGUAGE="Emacs-Lisp" - - /NOAUTO_SUBSTITUTE - - /DESCRIPTION="progn statement" - - /DUPLICATION=CONTEXT_DEPENDENT - - /SEPARATOR="" - - /TYPE=NONTERMINAL - - "(progn" - " {statement}...)" - -END DEFINE - -DELETE PLACEHOLDER PLAIN_STATEMENT - - /LANGUAGE="Emacs-Lisp" - -DEFINE PLACEHOLDER PLAIN_STATEMENT - - /LANGUAGE="Emacs-Lisp" - - /NOAUTO_SUBSTITUTE - - /DESCRIPTION="plain statement" - - /DUPLICATION=CONTEXT_DEPENDENT - - /SEPARATOR="" - - /TYPE=NONTERMINAL - - "({function} [fun_arguments]...)" - -END DEFINE - -DELETE PLACEHOLDER FUN_ARGUMENTS - - /LANGUAGE="Emacs-Lisp" - -DEFINE PLACEHOLDER FUN_ARGUMENTS - - /LANGUAGE="Emacs-Lisp" - - /NOAUTO_SUBSTITUTE - - /DESCRIPTION="arguments to a function call" - - /DUPLICATION=CONTEXT_DEPENDENT - - /SEPARATOR="" - - /PLACEHOLDER=IDENTIFIER - -END DEFINE - -DELETE PLACEHOLDER FUNCTION - - /LANGUAGE="Emacs-Lisp" - -DEFINE PLACEHOLDER FUNCTION - - /LANGUAGE="Emacs-Lisp" - - /NOAUTO_SUBSTITUTE - - /DESCRIPTION="function call" - - /DUPLICATION=CONTEXT_DEPENDENT - - /SEPARATOR="" - - /TYPE=TERMINAL - - "Type in a Lisp function name ie setq, assoc etc" - -END DEFINE - - -DELETE PLACEHOLDER COND_STATEMENT - - /LANGUAGE="Emacs-Lisp" - -DEFINE PLACEHOLDER COND_STATEMENT - - /LANGUAGE="Emacs-Lisp" - - /NOAUTO_SUBSTITUTE - - /DESCRIPTION="cond statement" - - /DUPLICATION=CONTEXT_DEPENDENT - - /SEPARATOR="" - - /TYPE=NONTERMINAL - - "(cond {cond_alternative}...)" - -END DEFINE - -DELETE PLACEHOLDER COND_ALTERNATIVE - - /LANGUAGE="Emacs-Lisp" - -DEFINE PLACEHOLDER COND_ALTERNATIVE - - /LANGUAGE="Emacs-Lisp" - - /NOAUTO_SUBSTITUTE - - /DESCRIPTION="cond alternative statement" - - /DUPLICATION=VERTICAL - - /SEPARATOR="" - - /TYPE=NONTERMINAL - - "({condition}" - " {statement}...)" - -END DEFINE - -DELETE PLACEHOLDER WHILE_STATEMENT - - /LANGUAGE="Emacs-Lisp" - -DEFINE PLACEHOLDER WHILE_STATEMENT - - /LANGUAGE="Emacs-Lisp" - - /NOAUTO_SUBSTITUTE - - /DESCRIPTION="While statement" - - /DUPLICATION=CONTEXT_DEPENDENT - - /SEPARATOR="" - - /TYPE=NONTERMINAL - - "(while {condition}" - " {statement}...)" - -END DEFINE - -DELETE PLACEHOLDER CONDITION - - /LANGUAGE="Emacs-Lisp" - -DEFINE PLACEHOLDER CONDITION - - /LANGUAGE="Emacs-Lisp" - - /NOAUTO_SUBSTITUTE - - /DESCRIPTION="" - - /DUPLICATION=CONTEXT_DEPENDENT - - /SEPARATOR=" " - - /TYPE=TERMINAL - - "Just type a condition" - -END DEFINE - -DELETE PLACEHOLDER DEFADVICE - - /LANGUAGE="Emacs-Lisp" - -DEFINE PLACEHOLDER DEFADVICE - - /LANGUAGE="Emacs-Lisp" - - /NOAUTO_SUBSTITUTE - - /DESCRIPTION="lisp advice template" - - /DUPLICATION=CONTEXT_DEPENDENT - - /SEPARATOR="" - - /TYPE=NONTERMINAL - - "(defadvice {identifier} ({ad_type} {identifier} [ad_flag]...)" - " [Documentation]" - " [interactive]" - " {statement}...)" - -END DEFINE - -DELETE PLACEHOLDER DEFMACRO - - /LANGUAGE="Emacs-Lisp" - -DEFINE PLACEHOLDER DEFMACRO - - /LANGUAGE="Emacs-Lisp" - - /NOAUTO_SUBSTITUTE - - /DESCRIPTION="Define a macro" - - /DUPLICATION=CONTEXT_DEPENDENT - - /SEPARATOR="" - - /TYPE=NONTERMINAL - - "(defmacro {identifier} ([fun_arguments])" - " [Documentation]" - " [interactive]" - " {statement}...)" - -END DEFINE - -DELETE PLACEHOLDER DEFALIAS - - /LANGUAGE="Emacs-Lisp" - -DEFINE PLACEHOLDER DEFALIAS - - /LANGUAGE="Emacs-Lisp" - - /NOAUTO_SUBSTITUTE - - /DESCRIPTION="Define an alias" - - /DUPLICATION=CONTEXT_DEPENDENT - - /SEPARATOR="" - - /TYPE=NONTERMINAL - - "(defalias '{identifier} '{identifier})" - -END DEFINE - -DELETE PLACEHOLDER AD_FLAG - - /LANGUAGE="Emacs-Lisp" - -DEFINE PLACEHOLDER AD_FLAG - - /LANGUAGE="Emacs-Lisp" - - /NOAUTO_SUBSTITUTE - - /DESCRIPTION="lisp advice type menu" - - /DUPLICATION=CONTEXT_DEPENDENT - - /SEPARATOR=" " - - /TYPE=MENU - - "activate" - "protect" - "compile" - "preactivate" - "disable" - - -END DEFINE - -DELETE PLACEHOLDER INTERACTIVE - - /LANGUAGE="Emacs-Lisp" - -DEFINE PLACEHOLDER INTERACTIVE - - /LANGUAGE="Emacs-Lisp" - - /NOAUTO_SUBSTITUTE - - /DESCRIPTION="lisp interactive statement" - - /DUPLICATION=CONTEXT_DEPENDENT - - /SEPARATOR="" - - /TYPE=NONTERMINAL - - "(interactive [interactive_string])" - -END DEFINE - -DELETE PLACEHOLDER INTERACTIVE_STRING - - /LANGUAGE="Emacs-Lisp" - -DEFINE PLACEHOLDER INTERACTIVE_STRING - - /LANGUAGE="Emacs-Lisp" - - /NOAUTO_SUBSTITUTE - - /DESCRIPTION="lisp function Documentation" - - /DUPLICATION=CONTEXT_DEPENDENT - - /SEPARATOR="" - - /TYPE=NONTERMINAL - - ""[text]"" - -END DEFINE - -DELETE PLACEHOLDER AD_TYPE - - /LANGUAGE="Emacs-Lisp" - -DEFINE PLACEHOLDER AD_TYPE - - /LANGUAGE="Emacs-Lisp" - - /NOAUTO_SUBSTITUTE - - /DESCRIPTION="lisp advice type menu" - - /DUPLICATION=CONTEXT_DEPENDENT - - /SEPARATOR="" - - /TYPE=MENU - - "before" - "around" - "after" - -END DEFINE - -DELETE TOKEN DEFUN - - /LANGUAGE="Emacs-Lisp" - -DEFINE TOKEN DEFUN - - /LANGUAGE="Emacs-Lisp" - - /PLACEHOLDER=DEFUN - -END DEFINE - -DELETE TOKEN DEFVAR - - /LANGUAGE="Emacs-Lisp" - -DEFINE TOKEN DEFVAR - - /LANGUAGE="Emacs-Lisp" - - /PLACEHOLDER=DEFVAR - -END DEFINE - -DELETE TOKEN DEFCONST - - /LANGUAGE="Emacs-Lisp" - -DEFINE TOKEN DEFCONST - - /LANGUAGE="Emacs-Lisp" - - /DESCRIPTION="Define a const expression" - - "(defconst {identifier} [value]" - " [Documentation])" - -END DEFINE - -DELETE TOKEN DEFMACRO - - /LANGUAGE="Emacs-Lisp" - -DEFINE TOKEN DEFMACRO - - /LANGUAGE="Emacs-Lisp" - - /PLACEHOLDER=DEFMACRO - -END DEFINE - -DELETE TOKEN DEFADVICE - - /LANGUAGE="Emacs-Lisp" - -DEFINE TOKEN DEFADVICE - - /LANGUAGE="Emacs-Lisp" - - /PLACEHOLDER=DEFADVICE - -END DEFINE - -DELETE TOKEN DEFALIAS - - /LANGUAGE="Emacs-Lisp" - -DEFINE TOKEN DEFALIAS - - /LANGUAGE="Emacs-Lisp" - - /PLACEHOLDER=DEFALIAS - -END DEFINE - -DELETE TOKEN DF - - /LANGUAGE="Emacs-Lisp" - -DEFINE TOKEN DF - - /LANGUAGE="Emacs-Lisp" - - /PLACEHOLDER=DEFUN - -END DEFINE - -DELETE TOKEN DV - - /LANGUAGE="Emacs-Lisp" - -DEFINE TOKEN DV - - /LANGUAGE="Emacs-Lisp" - - /PLACEHOLDER=DEFVAR - -END DEFINE - -DELETE TOKEN DA - - /LANGUAGE="Emacs-Lisp" - -DEFINE TOKEN DA - - /LANGUAGE="Emacs-Lisp" - - /PLACEHOLDER=DEFADVICE - -END DEFINE - -DELETE TOKEN IF - - /LANGUAGE="Emacs-Lisp" - -DEFINE TOKEN IF - - /LANGUAGE="Emacs-Lisp" - - /PLACEHOLDER=IF_STATEMENT - -END DEFINE - -DELETE TOKEN PROGN - - /LANGUAGE="Emacs-Lisp" - -DEFINE TOKEN PROGN - - /LANGUAGE="Emacs-Lisp" - - /PLACEHOLDER=PROGN_STATEMENT - -END DEFINE - -DELETE TOKEN COND - - /LANGUAGE="Emacs-Lisp" - -DEFINE TOKEN COND - - /LANGUAGE="Emacs-Lisp" - - /PLACEHOLDER=COND_STATEMENT - -END DEFINE - -DELETE TOKEN WHILE - - /LANGUAGE="Emacs-Lisp" - -DEFINE TOKEN WHILE - - /LANGUAGE="Emacs-Lisp" - - /PLACEHOLDER=WHILE_STATEMENT - -END DEFINE - -DELETE PLACEHOLDER CATCH_STMT - - /LANGUAGE="Emacs-Lisp" - -DEFINE PLACEHOLDER CATCH_STMT - - /LANGUAGE="Emacs-Lisp" - - /NOAUTO_SUBSTITUTE - - /DESCRIPTION="" - - /DUPLICATION=CONTEXT_DEPENDENT - - /SEPARATOR="" - - /TYPE=NONTERMINAL - - "(catch '{catch-name}" - " {statement}...)" - -END DEFINE - -DELETE PLACEHOLDER CATCH-NAME - - /LANGUAGE="Emacs-Lisp" - -DEFINE PLACEHOLDER CATCH-NAME - - /LANGUAGE="Emacs-Lisp" - - /NOAUTO_SUBSTITUTE - - /DESCRIPTION="" - - /DUPLICATION=CONTEXT_DEPENDENT - - /SEPARATOR="" - - /TYPE=TERMINAL - - "Enter a valid Elisp name for the throw to identify" - -END DEFINE - -DELETE TOKEN CATCH - - /LANGUAGE="Emacs-Lisp" - -DEFINE TOKEN CATCH - - /LANGUAGE="Emacs-Lisp" - - /PLACEHOLDER=CATCH_STMT - -END DEFINE - -DELETE PLACEHOLDER SETQ_STMT - - /LANGUAGE="Emacs-Lisp" - -DEFINE PLACEHOLDER SETQ_STMT - - /LANGUAGE="Emacs-Lisp" - - /NOAUTO_SUBSTITUTE - - /DESCRIPTION="" - - /DUPLICATION=CONTEXT_DEPENDENT - - /SEPARATOR="" - - /TYPE=NONTERMINAL - - "(setq {variable} {statement})" - -END DEFINE - -DELETE PLACEHOLDER VARIABLE - - /LANGUAGE="Emacs-Lisp" - -DEFINE PLACEHOLDER VARIABLE - - /LANGUAGE="Emacs-Lisp" - - /NOAUTO_SUBSTITUTE - - /DESCRIPTION="" - - /DUPLICATION=CONTEXT_DEPENDENT - - /SEPARATOR="" - - /TYPE=TERMINAL - - "Enter an elisp variable name." - -END DEFINE - -DELETE TOKEN SET - - /LANGUAGE="Emacs-Lisp" - -DEFINE TOKEN SET - - /LANGUAGE="Emacs-Lisp" - - /PLACEHOLDER=SETQ_STMT - - -END DEFINE - -DELETE PLACEHOLDER DEFCUSTOM - - /LANGUAGE="Emacs-Lisp" - -DEFINE PLACEHOLDER DEFCUSTOM - - /LANGUAGE="Emacs-Lisp" - - /NOAUTO_SUBSTITUTE - - /DESCRIPTION="" - - /DUPLICATION=CONTEXT_DEPENDENT - - /SEPARATOR="" - - /TYPE=NONTERMINAL - - "(defcustom {variable} {default-value}" - " "{documentation}"" - " {custom-type}..." - " :group {group-name})" - -END DEFINE - -DELETE PLACEHOLDER COMPOSITE-TYPE - - /LANGUAGE="Emacs-Lisp" - -DEFINE PLACEHOLDER COMPOSITE-TYPE - - /LANGUAGE="Emacs-Lisp" - - /NOAUTO_SUBSTITUTE - - /DESCRIPTION="" - - /DUPLICATION=CONTEXT_DEPENDENT - - /SEPARATOR="" - - /TYPE=MENU - - "(restricted-sexp :match-alternatives ({criteria}))" - "(cons {car-type} {cdr-type}" - "(list {element-types}...)" - "(vector {element-types}...)" - "(choice {alternative-types}...)" - "(" - -END DEFINE - -DELETE PLACEHOLDER CDR-TYPE - - /LANGUAGE="Emacs-Lisp" - -DEFINE PLACEHOLDER CDR-TYPE - - /LANGUAGE="Emacs-Lisp" - - /NOAUTO_SUBSTITUTE - - /DESCRIPTION="" - - /DUPLICATION=CONTEXT_DEPENDENT - - /SEPARATOR="" - - /TYPE=TERMINAL - /PLACEHOLDER=simple-type - - "Enter a valid CDR Type i.e. symbol" - -END DEFINE - - -DELETE PLACEHOLDER CAR-TYPE - - /LANGUAGE="Emacs-Lisp" - -DEFINE PLACEHOLDER CAR-TYPE - - /LANGUAGE="Emacs-Lisp" - - /NOAUTO_SUBSTITUTE - - /DESCRIPTION="" - - /DUPLICATION=CONTEXT_DEPENDENT - - /SEPARATOR="" - - /TYPE=TERMINAL - - "Enter a car type i.e. string, integer etc" - -END DEFINE - - -DELETE PLACEHOLDER CRITERIA - - /LANGUAGE="Emacs-Lisp" - -DEFINE PLACEHOLDER CRITERIA - - /LANGUAGE="Emacs-Lisp" - - /NOAUTO_SUBSTITUTE - - /DESCRIPTION="" - - /DUPLICATION=CONTEXT_DEPENDENT - - /SEPARATOR="" - - /TYPE=TERMINAL - - "This should be a list and each element should be one of these possibilities:" - " " - "predicate - that is, a function of one argument that has no" - " side effects, and returns either `nil' or non-`nil' according" - " to the argument. Using a predicate in the list says that" - " objects for which the predicate returns non-`nil' are" - " acceptable." - "" - "quoted constant--that is, `'OBJECT'. This sort of element" - " in the list says that OBJECT itself is an acceptable value." - " For example," - "" - " (restricted-sexp :match-alternatives" - " (integerp 't 'nil))" - "" - " allows integers, `t' and `nil' as legitimate values." - -END DEFINE - -DELETE PLACEHOLDER ELEMENT-TYPES - - /LANGUAGE="Emacs-Lisp" - -DEFINE PLACEHOLDER ELEMENT-TYPES - - /LANGUAGE="Emacs-Lisp" - - /PLACEHOLDER=SIMPLE-TYPE - -END DEFINE - -DELETE PLACEHOLDER ALTERNATIVE-TYPES - - /LANGUAGE="Emacs-Lisp" - -DEFINE PLACEHOLDER ALTERNATIVE-TYPES - - /LANGUAGE="Emacs-Lisp" - - /NOAUTO_SUBSTITUTE - - /DESCRIPTION="" - - /DUPLICATION=VERTICAL - - /SEPARATOR="" - - /TYPE=MENU - - "alternative"/PLACEHOLDER - "simple-type"/PLACEHOLDER - "constant"/PLACEHOLDER - -END DEFINE - -DELETE PLACEHOLDER ALTERNATIVE - - /LANGUAGE="Emacs-Lisp" - -DEFINE PLACEHOLDER ALTERNATIVE - - /LANGUAGE="Emacs-Lisp" - - /NOAUTO_SUBSTITUTE - - /DESCRIPTION="" - - /DUPLICATION=CONTEXT_DEPENDENT - - /SEPARATOR="" - - /TYPE=NONTERMINAL - - "({simple-type} :tag "[text]")" - -END DEFINE - -DELETE PLACEHOLDER CONSTANT - - /LANGUAGE="Emacs-Lisp" - -DEFINE PLACEHOLDER CONSTANT - - /STLANGUAGE="Emacs-Lisp" - - /NOAUTO_SUBSTITUTE - - /DESCRIPTION="" - - /DUPLICATION=CONTEXT_DEPENDENT - - /SEPARATOR="" - - /TYPE=MENU - - "(const {value})" - "(const :tag "[text]" {value})" - "(other :tag "[text]" {value})" - "(function-item {function})" - "(variable-item {variable})" - "(set {elements}...)" - "(repeat {element-type})" - -END DEFINE - -DELETE PLACEHOLDER VALUE - - /LANGUAGE="Emacs-Lisp" - -DEFINE PLACEHOLDER VALUE - - /LANGUAGE="Emacs-Lisp" - - /NOAUTO_SUBSTITUTE - - /DESCRIPTION="" - - /DUPLICATION=CONTEXT_DEPENDENT - - /SEPARATOR="" - - /TYPE=TERMINAL - - "Enter a value such as nil or t or 'anything else'" - -END DEFINE - - -DELETE PLACEHOLDER SIMPLE-TYPE - - /LANGUAGE="Emacs-Lisp" - -DEFINE PLACEHOLDER SIMPLE-TYPE - - /LANGUAGE="Emacs-Lisp" - - /NOAUTO_SUBSTITUTE - - /DESCRIPTION="" - - /DUPLICATION=CONTEXT_DEPENDENT - - /SEPARATOR="" - - /TYPE=MENU - - "'(integer)" - "'(boolean)" - "'(sexp)" - "'(number)" - "'(string)" - "'(regexp)" - "'(character)" - "'(file)" - "'(file :must-match t)" - "'(directory)" - "'(hook)" - "'(symbol)" - "'(function)" - "'(variable)" - "'(face)" - -END DEFINE - - -DELETE PLACEHOLDER C-TYPE - - /LANGUAGE="Emacs-Lisp" - -DEFINE PLACEHOLDER C-TYPE - - /LANGUAGE="Emacs-Lisp" - - /NOAUTO_SUBSTITUTE - - /DESCRIPTION="" - - /DUPLICATION=CONTEXT_DEPENDENT - - /SEPARATOR="" - - /TYPE=MENU - - "simple-type"/PLACEHOLDER - "composite-type"/PLACEHOLDER - "type-keywords"/PLACEHOLDER - -END DEFINE - - -DELETE PLACEHOLDER CUSTOM-TYPE - - /LANGUAGE="Emacs-Lisp" - -DEFINE PLACEHOLDER CUSTOM-TYPE - - /LANGUAGE="Emacs-Lisp" - - /NOAUTO_SUBSTITUTE - - /DESCRIPTION="" - - /DUPLICATION=VERTICAL - - /SEPARATOR="" - - /TYPE=NONTERMINAL - - ":type {c-type}" - -END DEFINE - - -DELETE PLACEHOLDER DEFAULT-VALUE - - /LANGUAGE="Emacs-Lisp" - -DEFINE PLACEHOLDER DEFAULT-VALUE - - /LANGUAGE="Emacs-Lisp" - - /NOAUTO_SUBSTITUTE - - /DESCRIPTION="" - - /DUPLICATION=CONTEXT_DEPENDENT - - /SEPARATOR="" - - /TYPE=TERMINAL - - "Enter a default value i.e. t, nil, "diff"" - -END DEFINE - - -DELETE PLACEHOLDER VARIABLE - - /LANGUAGE="Emacs-Lisp" - -DEFINE PLACEHOLDER VARIABLE - - /LANGUAGE="Emacs-Lisp" - - /NOAUTO_SUBSTITUTE - - /DESCRIPTION="" - - /DUPLICATION=CONTEXT_DEPENDENT - - /SEPARATOR="" - - /TYPE=TERMINAL - - "Enter a variable name" - -END DEFINE - - -DELETE TOKEN UNLESS - - /LANGUAGE="Emacs-Lisp" - -DEFINE TOKEN UNLESS - - /LANGUAGE="Emacs-Lisp" - - /DESCRIPTION="" - - - "(unless {condition}" - " {statement}...)" - -END DEFINE - -DELETE TOKEN WHEN - - /LANGUAGE="Emacs-Lisp" - -DEFINE TOKEN WHEN - - /LANGUAGE="Emacs-Lisp" - - /DESCRIPTION="" - - - "(when {condition}" - " {statement}...)" - -END DEFINE - -DELETE TOKEN DOLIST - - /LANGUAGE="Emacs-Lisp" - -DEFINE TOKEN DOLIST - - /LANGUAGE="Emacs-Lisp" - - /DESCRIPTION="Iterate over a list" - - - "(dolist ({var} {list} [result])" - " {statement}...)" - -END DEFINE - -DELETE PLACEHOLDER VAR - - /LANGUAGE="Emacs-Lisp" - -DEFINE PLACEHOLDER VAR - - /LANGUAGE="Emacs-Lisp" - - /NOAUTO_SUBSTITUTE - - /DESCRIPTION="" - - /DUPLICATION=CONTEXT_DEPENDENT - - /SEPARATOR="" - - /TYPE=TERMINAL - - "Enter a variable name" - -END DEFINE - -DELETE PLACEHOLDER LIST - - /LANGUAGE="Emacs-Lisp" - -DEFINE PLACEHOLDER LIST - - /LANGUAGE="Emacs-Lisp" - - /NOAUTO_SUBSTITUTE - - /DESCRIPTION="" - - /DUPLICATION=CONTEXT_DEPENDENT - - /SEPARATOR="" - - /TYPE=TERMINAL - - "Enter the name of a list or an actual list i.e. (2 3)" - -END DEFINE - -DELETE PLACEHOLDER RESULT - - /LANGUAGE="Emacs-Lisp" - -DEFINE PLACEHOLDER RESULT - - /LANGUAGE="Emacs-Lisp" - - /NOAUTO_SUBSTITUTE - - /DESCRIPTION="" - - /DUPLICATION=CONTEXT_DEPENDENT - - /SEPARATOR="" - - /TYPE=MENU - - "nil" - "var"/PLACEHOLDER - "expression"/PLACEHOLDER - -END DEFINE - -DELETE TOKEN DOTIMES - - /LANGUAGE="Emacs-Lisp" - -DEFINE TOKEN DOTIMES - - /LANGUAGE="Emacs-Lisp" - - /DESCRIPTION="Repeat a set of statements a fixed number of times." - - - "(dotimes ({var} {count} [result])" - " {statement}...)" - -END DEFINE - -DELETE PLACEHOLDER COUNT - - /LANGUAGE="Emacs-Lisp" - -DEFINE PLACEHOLDER COUNT - - /LANGUAGE="Emacs-Lisp" - - /NOAUTO_SUBSTITUTE - - /DESCRIPTION="" - - /DUPLICATION=CONTEXT_DEPENDENT - - /SEPARATOR="" - - /TYPE=TERMINAL - - "Enter the number of times the loop should repeat." - -END DEFINE - -DELETE TOKEN THROW - - /LANGUAGE="Emacs-Lisp" - -DEFINE TOKEN THROW - - /LANGUAGE="Emacs-Lisp" - - /DESCRIPTION="" - - - "(throw {catch-name} {result})" - -END DEFINE - -DELETE TOKEN ERROR - - /LANGUAGE="Emacs-Lisp" - -DEFINE TOKEN ERROR - - /LANGUAGE="Emacs-Lisp" - - /DESCRIPTION="Error Statement" - - - "(error {format-string} [rest_args])" - -END DEFINE - -DELETE PLACEHOLDER FORMAT-STRING - - /LANGUAGE="Emacs-Lisp" - -DEFINE PLACEHOLDER FORMAT-STRING - - /LANGUAGE="Emacs-Lisp" - - /NOAUTO_SUBSTITUTE - - /DESCRIPTION="String format" - - /DUPLICATION=CONTEXT_DEPENDENT - - /SEPARATOR="" - - /TYPE=NONTERMINAL - - ""{text}"" - -END DEFINE - -DELETE TOKEN SIGNAL - - /LANGUAGE="Emacs-Lisp" - -DEFINE TOKEN SIGNAL - - /LANGUAGE="Emacs-Lisp" - - /DESCRIPTION="Signal an error" - - - "(signal {err-symbol} {data})" - -END DEFINE - -DELETE PLACEHOLDER ERR-SYMBOL - - /LANGUAGE="Emacs-Lisp" - -DEFINE PLACEHOLDER ERR-SYMBOL - - /LANGUAGE="Emacs-Lisp" - - /NOAUTO_SUBSTITUTE - - /DESCRIPTION="Error Symbol i.e. 'wrong-number-of-arguments" - - /DUPLICATION=CONTEXT_DEPENDENT - - /SEPARATOR="" - - /TYPE=TERMINAL - - "Enter an error symbol i.e. 'wong-number-of-arguments." - -END DEFINE - -DELETE PLACEHOLDER DATA - - /LANGUAGE="Emacs-Lisp" - -DEFINE PLACEHOLDER DATA - - /LANGUAGE="Emacs-Lisp" - - /NOAUTO_SUBSTITUTE - - /DESCRIPTION="List of addition Lisp objects relevant to the error." - - /DUPLICATION=CONTEXT_DEPENDENT - - /SEPARATOR="" - - /TYPE=TERMINAL - - "Enter a list of additional Lisp objects relevant to the error" - "i.e. '(x y) or '("My unknown error condition")" - -END DEFINE - -DELETE PLACEHOLDER CONDITION-CASE - - /LANGUAGE="Emacs-Lisp" - -DEFINE PLACEHOLDER CONDITION-CASE - - /LANGUAGE="Emacs-Lisp" - - /NOAUTO_SUBSTITUTE - - /DESCRIPTION="Establish error handlers around protected forms" - - /DUPLICATION=CONTEXT_DEPENDENT - - /SEPARATOR="" - - /TYPE=NONTERMINAL - - "(condition-case [var]" - " {protected-forms}" - " {handlers}...)" - -END DEFINE - -DELETE PLACEHOLDER PROTECTED-FORMS - - /LANGUAGE="Emacs-Lisp" - -DEFINE PLACEHOLDER PROTECTED-FORMS - - /LANGUAGE="Emacs-Lisp" - - /PLACEHOLDER=STATEMENT - -END DEFINE - -DELETE PLACEHOLDER HANDLERS - - /LANGUAGE="Emacs-Lisp" - -DEFINE PLACEHOLDER HANDLERS - - /LANGUAGE="Emacs-Lisp" - - /NOAUTO_SUBSTITUTE - - /DESCRIPTION="condition-case handlers" - - /DUPLICATION=CONTEXT_DEPENDENT - - /SEPARATOR="" - - /TYPE=NONTERMINAL - - "(({error-cond-name}...)" - " {statement}...)" - -END DEFINE - -DELETE PLACEHOLDER ERROR-COND-NAME - - /LANGUAGE="Emacs-Lisp" - -DEFINE PLACEHOLDER ERROR-COND-NAME - - /LANGUAGE="Emacs-Lisp" - - /NOAUTO_SUBSTITUTE - - /DESCRIPTION="Name of the error condition" - - /DUPLICATION=CONTEXT_DEPENDENT - - /SEPARATOR="" - - /TYPE=TERMINAL - - "Enter the name of an error condition i.e. arith-error, file-error" - -END DEFINE - -DELETE PLACEHOLDER REST_ARGS - - /LANGUAGE="Emacs-Lisp" - -DEFINE PLACEHOLDER REST_ARGS - - /LANGUAGE="Emacs-Lisp" - - /NOAUTO_SUBSTITUTE - - /DESCRIPTION="" - - /DUPLICATION=CONTEXT_DEPENDENT - - /SEPARATOR="" - - /TYPE=TERMINAL - - "Enter the arguments for the format string." - -END DEFINE - -DELETE PLACEHOLDER UNWIND-PROTECT - - /LANGUAGE="Emacs-Lisp" - -DEFINE PLACEHOLDER UNWIND-PROTECT - - /LANGUAGE="Emacs-Lisp" - - /NOAUTO_SUBSTITUTE - - /DESCRIPTION="Return a data structure to a consistant state in the event of an error" - - /DUPLICATION=CONTEXT_DEPENDENT - - /SEPARATOR="" - - /TYPE=NONTERMINAL - - "(unwind-protect" - " {statement}..." - " {cleanup-forms})" - -END DEFINE - -DELETE PLACEHOLDER CLEANUP-FORMS - - /LANGUAGE="Emacs-Lisp" - -DEFINE PLACEHOLDER CLEANUP-FORMS - - /LANGUAGE="Emacs-Lisp" - - /PLACEHOLDER=STATEMENT - -END DEFINE - -DELETE PLACEHOLDER PROPERTY-LIST-STMT - - /LANGUAGE="Emacs-Lisp" - -DEFINE PLACEHOLDER PROPERTY-LIST-STMT - - /LANGUAGE="Emacs-Lisp" - - /NOAUTO_SUBSTITUTE - - /DESCRIPTION="Property List Statements" - - /DUPLICATION=CONTEXT_DEPENDENT - - /SEPARATOR="" - - /TYPE=MENU - - "(symbol-plist {symbol})" - "(setplist {symbol} {plist})" - "(get {symbol} {property})" - "(put {symbol} {property} {value})" - -END DEFINE - -DELETE PLACEHOLDER SYMBOL - - /LANGUAGE="Emacs-Lisp" - -DEFINE PLACEHOLDER SYMBOL - - /LANGUAGE="Emacs-Lisp" - - /NOAUTO_SUBSTITUTE - - /DESCRIPTION="Emacs variable" - - /DUPLICATION=CONTEXT_DEPENDENT - - /SEPARATOR="" - - /TYPE=TERMINAL - - "Enter the name of a symbol i.e. 'foo" - -END DEFINE - -DELETE PLACEHOLDER PLIST - - /LANGUAGE="Emacs-Lisp" - -DEFINE PLACEHOLDER PLIST - - /LANGUAGE="Emacs-Lisp" - - /NOAUTO_SUBSTITUTE - - /DESCRIPTION="Property List" - - /DUPLICATION=CONTEXT_DEPENDENT - - /SEPARATOR="" - - /TYPE=TERMINAL - - "Enter a property list i.e. '(a 1 b (2 3) c nil)" - -END DEFINE - -DELETE PLACEHOLDER PROPERTY - - /LANGUAGE="Emacs-Lisp" - -DEFINE PLACEHOLDER PROPERTY - - /LANGUAGE="Emacs-Lisp" - - /NOAUTO_SUBSTITUTE - - /DESCRIPTION="Property" - - /DUPLICATION=CONTEXT_DEPENDENT - - /SEPARATOR="" - - /TYPE=TERMINAL - - "Enter the name of a property i.e. the property list is " - "'(a 1 b (2 3) c nil) then a property of this property list" - "would be 'a" - -END DEFINE - -DELETE PLACEHOLDER SYMBOLS - - /LANGUAGE="Emacs-Lisp" - -DEFINE PLACEHOLDER SYMBOLS - - /LANGUAGE="Emacs-Lisp" - - /NOAUTO_SUBSTITUTE - - /DESCRIPTION="Statements dealing with Symbols i.e. intern, make-symbol etc" - - /DUPLICATION=CONTEXT_DEPENDENT - - /SEPARATOR="" - - /TYPE=MENU - - "(symbol-name {symbol})" - "(make-symbol {string})" - "(intern {symbol} [obarray])" - "(intern-soft {symbol} [obarray])" - "(mapatoms {function} [obarray])" - "(unintern {symbol} [obarray])" - -END DEFINE - -DELETE PLACEHOLDER OBARRAY - - /LANGUAGE="Emacs-Lisp" - -DEFINE PLACEHOLDER OBARRAY - - /LANGUAGE="Emacs-Lisp" - - /NOAUTO_SUBSTITUTE - - /DESCRIPTION="Name of an obarray" - - /DUPLICATION=CONTEXT_DEPENDENT - - /SEPARATOR="" - - /TYPE=TERMINAL - - "Enter the name of an obarray (declared using make-vector)" - -END DEFINE - -DELETE PLACEHOLDER FUNCTION - - /LANGUAGE="Emacs-Lisp" - -DEFINE PLACEHOLDER FUNCTION - - /LANGUAGE="Emacs-Lisp" - - /NOAUTO_SUBSTITUTE - - /DESCRIPTION="" - - /DUPLICATION=CONTEXT_DEPENDENT - - /SEPARATOR="" - - /TYPE=TERMINAL - - "Enter a function name i.e. 'foo" - -END DEFINE - -DELETE PLACEHOLDER NAME - - /LANGUAGE="Emacs-Lisp" - -DEFINE PLACEHOLDER NAME - - /LANGUAGE="Emacs-Lisp" - - /PLACEHOLDER=TEXT - -END DEFINE - -DELETE PLACEHOLDER SEQUENCES - - /LANGUAGE="Emacs-Lisp" - -DEFINE PLACEHOLDER SEQUENCES - - /LANGUAGE="Emacs-Lisp" - - /NOAUTO_SUBSTITUTE - - /DESCRIPTION="Commands that operate on sequences i.e. length, elt" - - /DUPLICATION=CONTEXT_DEPENDENT - - /SEPARATOR="" - - /TYPE=MENU - - "length"/TOKEN - "elt"/TOKEN - "(copy-sequence {var})" - -END DEFINE - -DELETE TOKEN LENGTH - - /LANGUAGE="Emacs-Lisp" - -DEFINE TOKEN LENGTH - - /LANGUAGE="Emacs-Lisp" - - /DESCRIPTION="Return the length of the sequence" - - - "(length {var})" - -END DEFINE - -DELETE TOKEN ELT - - /LANGUAGE="Emacs-Lisp" - -DEFINE TOKEN ELT - - /LANGUAGE="Emacs-Lisp" - - /DESCRIPTION="Return the 'index item from the sequence" - - - "(elt {var} {index})" - -END DEFINE - -DELETE PLACEHOLDER INDEX - - /LANGUAGE="Emacs-Lisp" - -DEFINE PLACEHOLDER INDEX - - /LANGUAGE="Emacs-Lisp" - - /NOAUTO_SUBSTITUTE - - /DESCRIPTION="" - - /DUPLICATION=CONTEXT_DEPENDENT - - /SEPARATOR="" - - /TYPE=TERMINAL - - "Index into the list/sequence - 0 is the first element" - -END DEFINE - -DELETE PLACEHOLDER ASSOCIATION_LISTS - - /LANGUAGE="Emacs-Lisp" - -DEFINE PLACEHOLDER ASSOCIATION_LISTS - - /LANGUAGE="Emacs-Lisp" - - /NOAUTO_SUBSTITUTE - - /DESCRIPTION="Association List commands i.e. assoc, copy-alist" - - /DUPLICATION=CONTEXT_DEPENDENT - - /SEPARATOR="" - - /TYPE=MENU - - "assoc"/TOKEN - "rassoc"/TOKEN - "assq"/TOKEN - "rassq"/TOKEN - "assoc-default"/TOKEN - "copy-alist"/TOKEN - "assq-delete-all"/TOKEN - -END DEFINE - -DELETE TOKEN ASSQ-DELETE-ALL - - /LANGUAGE="Emacs-Lisp" - -DEFINE TOKEN ASSQ-DELETE-ALL - - /LANGUAGE="Emacs-Lisp" - - /DESCRIPTION="Delete from alist all elements whose CAR is key, return alist" - - - "(assq-delete-all {key} {alist})" - -END DEFINE - -DELETE TOKEN COPY-ALIST - - /LANGUAGE="Emacs-Lisp" - -DEFINE TOKEN COPY-ALIST - - /LANGUAGE="Emacs-Lisp" - - /DESCRIPTION="Copy the alist" - - - "(copy-alist {alist})" - -END DEFINE - -DELETE TOKEN ASSOC-DEFAULT - - /LANGUAGE="Emacs-Lisp" - -DEFINE TOKEN ASSOC-DEFAULT - - /LANGUAGE="Emacs-Lisp" - - /DESCRIPTION="Search alist for key using optional test function" - - - "(assoc-default {key} {alist} [{function} {default-value}])" - -END DEFINE - -DELETE TOKEN RASSQ - - /LANGUAGE="Emacs-Lisp" - -DEFINE TOKEN RASSQ - - /LANGUAGE="Emacs-Lisp" - - /DESCRIPTION="Similar to RASSOC except eq used instead of equal" - - - "(rassq {value} {alist})" - -END DEFINE - -DELETE TOKEN ASSQ - - /LANGUAGE="Emacs-Lisp" - -DEFINE TOKEN ASSQ - - /LANGUAGE="Emacs-Lisp" - - /DESCRIPTION="Similar to ASSOC except eq used" - - - "(assq {key} {alist})" - -END DEFINE - -DELETE TOKEN RASSOC - - /LANGUAGE="Emacs-Lisp" - -DEFINE TOKEN RASSOC - - /LANGUAGE="Emacs-Lisp" - - /DESCRIPTION="return the first association with a value of value in the alist" - - - "(rassoc {value} {alist})" - -END DEFINE - -DELETE TOKEN ASSOC - - /LANGUAGE="Emacs-Lisp" - -DEFINE TOKEN ASSOC - - /LANGUAGE="Emacs-Lisp" - - /DESCRIPTION="Return the first association for key in the alist using equal" - - - "(assoc {key} {alist})" - -END DEFINE - -DELETE PLACEHOLDER ALIST - - /LANGUAGE="Emacs-Lisp" - -DEFINE PLACEHOLDER ALIST - - /LANGUAGE="Emacs-Lisp" - - /NOAUTO_SUBSTITUTE - - /DESCRIPTION="" - - /DUPLICATION=CONTEXT_DEPENDENT - - /SEPARATOR="" - - /TYPE=TERMINAL - - "Association list of the form ((a . 1) ("b" (2 3)))" - -END DEFINE - -DELETE PLACEHOLDER KEY - - /LANGUAGE="Emacs-Lisp" - -DEFINE PLACEHOLDER KEY - - /LANGUAGE="Emacs-Lisp" - - /NOAUTO_SUBSTITUTE - - /DESCRIPTION="Key to an alist" - - /DUPLICATION=CONTEXT_DEPENDENT - - /SEPARATOR="" - - /TYPE=TERMINAL - - "Enter a key to an alist i.e. 'yellow" - -END DEFINE - -DELETE PLACEHOLDER STRING - - /LANGUAGE="Emacs-Lisp" - -DEFINE PLACEHOLDER STRING - - /LANGUAGE="Emacs-Lisp" - - /NOAUTO_SUBSTITUTE - - /DESCRIPTION="" - - /DUPLICATION=CONTEXT_DEPENDENT - - /SEPARATOR="" - - /TYPE=NONTERMINAL - - ""{text}"" - -END DEFINE - -DELETE PLACEHOLDER BOOLEAN-VECTORS - - /LANGUAGE="Emacs-Lisp" - -DEFINE PLACEHOLDER BOOLEAN-VECTORS - - /LANGUAGE="Emacs-Lisp" - - /NOAUTO_SUBSTITUTE - - /DESCRIPTION="Boolean vector commands" - - /DUPLICATION=CONTEXT_DEPENDENT - - /SEPARATOR="" - - /TYPE=MENU - - "make-bool-vector"/TOKEN - "bool-vector-p"/TOKEN - -END DEFINE - -DELETE TOKEN MAKE-BOOL-VECTOR - - /LANGUAGE="Emacs-Lisp" - -DEFINE TOKEN MAKE-BOOL-VECTOR - - /LANGUAGE="Emacs-Lisp" - - /DESCRIPTION="" - - - "(make-bool-vector {vect-length} {initial})" - -END DEFINE - -DELETE PLACEHOLDER INITIAL - - /LANGUAGE="Emacs-Lisp" - -DEFINE PLACEHOLDER INITIAL - - /LANGUAGE="Emacs-Lisp" - - /NOAUTO_SUBSTITUTE - - /DESCRIPTION="" - - /DUPLICATION=CONTEXT_DEPENDENT - - /SEPARATOR="" - - /TYPE=TERMINAL - - "Enter the initial value for each boolean element i.e. t or nil" - -END DEFINE - - -DELETE PLACEHOLDER VECT-LENGTH - - /LANGUAGE="Emacs-Lisp" - -DEFINE PLACEHOLDER VECT-LENGTH - - /LANGUAGE="Emacs-Lisp" - - /NOAUTO_SUBSTITUTE - - /DESCRIPTION="" - - /DUPLICATION=CONTEXT_DEPENDENT - - /SEPARATOR="" - - /TYPE=TERMINAL - - "Enter a length for the vector" - -END DEFINE - -DELETE PLACEHOLDER ARRAYS - - /LANGUAGE="Emacs-Lisp" - -DEFINE PLACEHOLDER ARRAYS - - /LANGUAGE="Emacs-Lisp" - - /NOAUTO_SUBSTITUTE - - /DESCRIPTION="Array commands" - - /DUPLICATION=CONTEXT_DEPENDENT - - /SEPARATOR="" - - /TYPE=MENU - - "arrayp"/TOKEN - "aref"/TOKEN - "aset"/TOKEN - "fillarray"/TOKEN - -END DEFINE - -DELETE TOKEN FILLARRAY - - /LANGUAGE="Emacs-Lisp" - -DEFINE TOKEN FILLARRAY - - /LANGUAGE="Emacs-Lisp" - - /DESCRIPTION="Fill array with object" - - - "(fillarray {array} {object})" - -END DEFINE - -DELETE TOKEN ASET - - /LANGUAGE="Emacs-Lisp" - -DEFINE TOKEN ASET - - /LANGUAGE="Emacs-Lisp" - - /DESCRIPTION="set the indexth element of array to object" - - - "(aset {array} {index} {object})" - -END DEFINE - -DELETE TOKEN ARRAYP - - /LANGUAGE="Emacs-Lisp" - -DEFINE TOKEN ARRAYP - - /LANGUAGE="Emacs-Lisp" - - /DESCRIPTION="Test if an array" - - - "(arrayp {object})" - -END DEFINE - -DELETE TOKEN AREF - - /LANGUAGE="Emacs-Lisp" - -DEFINE TOKEN AREF - - /LANGUAGE="Emacs-Lisp" - - /DESCRIPTION="return the indexth element of array" - - - "(aref {array} {index})" - -END DEFINE - -DELETE PLACEHOLDER ARRAY - - /LANGUAGE="Emacs-Lisp" - -DEFINE PLACEHOLDER ARRAY - - /LANGUAGE="Emacs-Lisp" - - /NOAUTO_SUBSTITUTE - - /DESCRIPTION="" - - /DUPLICATION=CONTEXT_DEPENDENT - - /SEPARATOR="" - - /TYPE=TERMINAL - - "Enter an array name" - -END DEFINE - - -DELETE PLACEHOLDER OBJECT - - /LANGUAGE="Emacs-Lisp" - -DEFINE PLACEHOLDER OBJECT - - /LANGUAGE="Emacs-Lisp" - - /NOAUTO_SUBSTITUTE - - /DESCRIPTION="" - - /DUPLICATION=CONTEXT_DEPENDENT - - /SEPARATOR="" - - /TYPE=TERMINAL - - "Enter an object name i.e. foo" - -END DEFINE - - -DELETE PLACEHOLDER LISTS-SETS - - /LANGUAGE="Emacs-Lisp" - -DEFINE PLACEHOLDER LISTS-SETS - - /LANGUAGE="Emacs-Lisp" - - /NOAUTO_SUBSTITUTE - - /DESCRIPTION="Using lists as sets" - - /DUPLICATION=CONTEXT_DEPENDENT - - /SEPARATOR="" - - /TYPE=MENU - - "memq"/TOKEN - "member"/TOKEN - "member-ignore-case"/TOKEN - "delq"/TOKEN - "delete"/TOKEN - "remove"/TOKEN - [menu placeholder body line]... - -END DEFINE - -DELETE TOKEN REMOVE - - /LANGUAGE="Emacs-Lisp" - -DEFINE TOKEN REMOVE - - /LANGUAGE="Emacs-Lisp" - - /DESCRIPTION="non-destructively remove all objects in sequence" - - - "(remove {object} {sequence})" - -END DEFINE - -DELETE TOKEN DELETE - - /LANGUAGE="Emacs-Lisp" - -DEFINE TOKEN DELETE - - /LANGUAGE="Emacs-Lisp" - - /DESCRIPTION="Destructively delete all object in sequence" - - - "(delete {object} {sequence})" - -END DEFINE - -DELETE PLACEHOLDER SEQUENCE - - /LANGUAGE="Emacs-Lisp" - -DEFINE PLACEHOLDER SEQUENCE - - /LANGUAGE="Emacs-Lisp" - - /NOAUTO_SUBSTITUTE - - /DESCRIPTION="" - - /DUPLICATION=CONTEXT_DEPENDENT - - /SEPARATOR="" - - /TYPE=TERMINAL - - "Enter the name of a sequence i.e. 'foo" - -END DEFINE - - -DELETE TOKEN MEMBER - - /LANGUAGE="Emacs-Lisp" - -DEFINE TOKEN MEMBER - - /LANGUAGE="Emacs-Lisp" - - /DESCRIPTION="Test for membership using equal" - - - "(member {object} {list})" - -END DEFINE - -DELETE TOKEN DELQ - - /LANGUAGE="Emacs-Lisp" - -DEFINE TOKEN DELQ - - /LANGUAGE="Emacs-Lisp" - - /DESCRIPTION="Delete all object in the set/list using eq" - - - "(delq {object} {list})" - -END DEFINE - -DELETE TOKEN MEMBER-IGNORE-CASE - - /LANGUAGE="Emacs-Lisp" - -DEFINE TOKEN MEMBER-IGNORE-CASE - - /LANGUAGE="Emacs-Lisp" - - /DESCRIPTION="Ignore case when testing for membership (strings)" - - - "(member-ignore-case {object} {list})" - -END DEFINE - -DELETE TOKEN MEMQ - - /LANGUAGE="Emacs-Lisp" - -DEFINE TOKEN MEMQ - - /LANGUAGE="Emacs-Lisp" - - /DESCRIPTION="Test if object is a member of list" - - - "(memq {object} {list})" - -END DEFINE - -DELETE LANGUAGE Template - - /LANGUAGE=Template - -[token_definition]...
\ No newline at end of file diff --git a/app-emacs/else-mode/files/LaTeX-cust.lse b/app-emacs/else-mode/files/LaTeX-cust.lse deleted file mode 100644 index dea1fc6..0000000 --- a/app-emacs/else-mode/files/LaTeX-cust.lse +++ /dev/null @@ -1,128 +0,0 @@ -;; Copyright (C) 1997,1998,1999,2000,2001 Peter Milliken -;; -;; Author: Peter Milliken <peterm@resmed.com.au>, -;; <peterm@unwired.com.au> -;; $Date: 2003/12/22 20:53:05 $ -;; Version: 1.7 -;; Keywords: language sensitive abbreviation template placeholder token -;; - -;; 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, Inc., 59 Temple Place - Suite 330, -;; Boston, MA 02111-1307, USA. - -;;****************************************************************************** -;; These definitions are my personal customisations for the language. This is -;; where you should place YOUR customisations. -;; -;; Sometimes there is a definition(s) in here that override definitions in the -;; main language template file that are here to make that definition more -;; "usable" - this is because I (primarily) try and generate/maintain the main -;; .lse files from EBNF definitions of the language. Sometimes I just can't -;; express the appropriate customisation in the EBNF and so I am forced to -;; override the placeholder definition in this file. -;; -;; This entries in this file should be used as an example of how to create your -;; own customisations. I would caution that you don't delete any definitions -;; though until you are sure that your edit sessions will not be adversely -;; affected. The best way to check out the effects of a delete is to "compile" -;; (else-compile-buffer) the "delete" command for that definition (this will -;; remove it from your edit session and you can nolonger access the definition -;; until next you load language template files) and then see whether anything -;; has been "lost" in your code generation ability i.e. say you think you don't -;; need the definition for placeholder XXX, just place the following lines at -;; the end of one of your source files (when ELSE is enabled for that buffer) -;; and perform a compile (M-x else-compile-buffer) with the cursor positioned at -;; the beginning of the line: -;; -;; DELETE PLACEHOLDER XXX - -;; /LANGUAGE = "LaTeX" - -;; -;; This will delete definition XXX from memory. -;; -;;****************************************************************************** - -DELETE PLACEHOLDER COMPILATION_UNIT - - /LANGUAGE="LaTeX" - -DEFINE PLACEHOLDER COMPILATION_UNIT - - /LANGUAGE="LaTeX" - - /NOAUTO_SUBSTITUTE - - /DESCRIPTION="" - - /DUPLICATION=CONTEXT_DEPENDENT - - /SEPARATOR="" - - /TYPE=NONTERMINAL - - "% $RCSfile[please_expand_me]$ $Revision[please_expand_me]$ $Date[please_expand_me]$" - "% $Source[please_expand_me]$ - "\documentclass[[options]...]{article}" - "\usepackage[left=1.5cm,right=2.0cm,top=1.5cm,bottom=1.5cm]{geometry}" - "\usepackage{float,tabularx,lastpage,fancyhdr}" - "\usepackage[toc,page,title,titletoc,header]{appendix}" - "% The first page is spat out using the ``plain'' pagestyle, so re-define it so" - "% it print what we want on page 1." - "\fancypagestyle{plain}{%" - "\fancyhf{}" - "\fancyfoot[C]{\thepage\ of \pageref{LastPage}}" - "\fancyfoot[R]{Issue: {Issue_no} printed: \today}" - "\renewcommand{\headrulewidth}{0pt}" - "\renewcommand{\footrulewidth}{0pt}}" - "% Do this to make sure pages 2 - n do it as well :-)" - "\pagestyle{fancy}" - "\cfoot{\thepage\ of \pageref{LastPage}}" - "\rfoot{Issue: {Issue_No} printed: \today}" - "\newcommand{\ie}{i.e.\ }" - "\newcommand{\eg}{e.g.\ }" - "\newcommand{\smiley}{:-)}" - "{style}" - -END DEFINE - -DELETE PLACEHOLDER PLEASE_EXPAND_ME - - /LANGUAGE="LaTeX" - -DEFINE PLACEHOLDER PLEASE_EXPAND_ME - - /LANGUAGE="LaTeX" - - /TYPE=NONTERMINAL - - ":" - -END DEFINE - -DELETE PLACEHOLDER AUTHOR_TEXT - - /LANGUAGE="LaTeX" - -DEFINE PLACEHOLDER AUTHOR_TEXT - - /LANGUAGE="LaTeX" - - /NOAUTO_SUBSTITUTE - - /DESCRIPTION="" - - /DUPLICATION=CONTEXT_DEPENDENT - - /SEPARATOR="" - - /TYPE=NONTERMINAL - - "Peter Milliken" - -END DEFINE - -DELETE PLACEHOLDER ISSUE_NO - - /LANGUAGE="LaTeX" - -DEFINE PLACEHOLDER ISSUE_NO - - /LANGUAGE="LaTeX" - - /AUTO_SUBSTITUTE - - /DESCRIPTION="" - - /DUPLICATION=CONTEXT_DEPENDENT - - /SEPARATOR="" - - /TYPE=TERMINAL - - "Enter an Issue No. of some kind ie Draft 01" - -END DEFINE - diff --git a/app-emacs/else-mode/files/LaTeX.lse b/app-emacs/else-mode/files/LaTeX.lse deleted file mode 100644 index 0ebdc35..0000000 --- a/app-emacs/else-mode/files/LaTeX.lse +++ /dev/null @@ -1,738 +0,0 @@ -;; Copyright (C) 1997,1998,1999,2000,2001,2002,2003 Peter Milliken -;; -;; Author: Peter Milliken <peterm@resmed.com.au>, -;; <peterm@unwired.com.au> -;; -;; Keywords: language sensitive abbreviation template placeholder token -;; - -;; 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, Inc., 59 Temple Place - Suite 330, -;; Boston, MA 02111-1307, USA. - - -DELETE LANGUAGE "LaTeX" - -DEFINE LANGUAGE "LaTeX" - - /INITIAL_STRING="{compilation_unit}" - - /PUNCTUATION_CHARACTERS=",;()*.'" - - /SELF_INSERT_CHARACTERS=" `~!@#$%^&*(),.<>/?;:'[]{}=\-+|"" - /VALID_IDENTIFIER_CHARACTERS="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_0123456789" - /INDENT_SIZE=2 - /VERSION=1.10 - -END DEFINE - -DELETE PLACEHOLDER STATEMENT - - /LANGUAGE="LaTeX" - -DEFINE PLACEHOLDER STATEMENT - - /LANGUAGE="LaTeX" - - /NOAUTO_SUBSTITUTE - - /DESCRIPTION="" - /DUPLICATION=CONTEXT_DEPENDENT - - /SEPARATOR="" - - /TYPE=MENU - - - "list"/PLACEHOLDER - "section"/PLACEHOLDER - "subsection"/PLACEHOLDER - "subsubsection"/PLACEHOLDER - "verbatim_"/PLACEHOLDER - "quote"/PLACEHOLDER - "figure_"/PLACEHOLDER - "marginal_note"/PLACEHOLDER - "footnote"/PLACEHOLDER - "footnotemark"/PLACEHOLDER - "footnotetext"/PLACEHOLDER - "footnoterule"/PLACEHOLDER - "general_label"/PLACEHOLDER - "symbols"/PLACEHOLDER - -END DEFINE - -DELETE PLACEHOLDER COMPILATION_UNIT - - /LANGUAGE="LaTeX" - -DEFINE PLACEHOLDER COMPILATION_UNIT - - /LANGUAGE="LaTeX" - - /NOAUTO_SUBSTITUTE - - /DESCRIPTION="" - - /DUPLICATION=CONTEXT_DEPENDENT - - /SEPARATOR="" - - /TYPE=NONTERMINAL - - "\documentclass[[options]...]{article}" - "\newcommand{\ie}{i.e.\ }" - "\newcommand{\eg}{e.g.\ }" - "\newcommand{\smiley}{:-)}" - "{style}" - -END DEFINE - -DELETE PLACEHOLDER STYLE - - /LANGUAGE="LaTeX" - -DEFINE PLACEHOLDER STYLE - - /LANGUAGE="LaTeX" - - /NOAUTO_SUBSTITUTE - - /DESCRIPTION="" - - /DUPLICATION=CONTEXT_DEPENDENT - - /SEPARATOR="" - - /TYPE=MENU - - "title"/PLACEHOLDER - "notitle"/PLACEHOLDER - -END DEFINE - -DELETE PLACEHOLDER TITLE - - /LANGUAGE="LaTeX" - -DEFINE PLACEHOLDER TITLE - - /LANGUAGE="LaTeX" - - /NOAUTO_SUBSTITUTE - - /DESCRIPTION="" - - /DUPLICATION=CONTEXT_DEPENDENT - - /SEPARATOR="" - - /TYPE=NONTERMINAL - - "\title{{title_text}}" - "\author{{author_text}}" - "\date{{date_text}}" - "\begin{document}" - "\maketitle" - "{statement}..." - "\end{document}" - -END DEFINE - -DELETE PLACEHOLDER NOTITLE - - /LANGUAGE="LaTeX" - -DEFINE PLACEHOLDER NOTITLE - - /LANGUAGE="LaTeX" - - /NOAUTO_SUBSTITUTE - - /DESCRIPTION="" - - /DUPLICATION=CONTEXT_DEPENDENT - - /SEPARATOR="" - - /TYPE=NONTERMINAL - - "\begin{document}" - "{statement}..." - "\end{document}" - -END DEFINE - -DELETE PLACEHOLDER TEXT - - /LANGUAGE="LaTeX" - -DEFINE PLACEHOLDER TEXT - - /LANGUAGE="LaTeX" - - /NOAUTO_SUBSTITUTE - - /DESCRIPTION="" - - /DUPLICATION=CONTEXT_DEPENDENT - - /SEPARATOR="" - - /TYPE=TERMINAL - - "Just type some text here, please" - -END DEFINE - -DELETE PLACEHOLDER OPTIONS - - /LANGUAGE="LaTeX" - -DEFINE PLACEHOLDER OPTIONS - - /LANGUAGE="LaTeX" - - /NOAUTO_SUBSTITUTE - - /DESCRIPTION="" - - /DUPLICATION=HORIZONTAL - - /SEPARATOR=", " - - /TYPE=MENU - - "a4paper" - "12pt" - -END DEFINE - -DELETE PLACEHOLDER SECTION - - /LANGUAGE="LaTeX" - -DEFINE PLACEHOLDER SECTION - - /LANGUAGE="LaTeX" - - /NOAUTO_SUBSTITUTE - - /DESCRIPTION="" - - /DUPLICATION=CONTEXT_DEPENDENT - - /SEPARATOR="" - - /TYPE=NONTERMINAL - - "\section{{section_text}}" - -END DEFINE - -DELETE PLACEHOLDER SUBSECTION - - /LANGUAGE="LaTeX" - -DEFINE PLACEHOLDER SUBSECTION - - /LANGUAGE="LaTeX" - - /NOAUTO_SUBSTITUTE - - /DESCRIPTION="" - - /DUPLICATION=CONTEXT_DEPENDENT - - /SEPARATOR="" - - /TYPE=NONTERMINAL - - "\subsection{{section_text}}" - -END DEFINE - -DELETE PLACEHOLDER SUBSUBSECTION - - /LANGUAGE="LaTeX" - -DEFINE PLACEHOLDER SUBSUBSECTION - - /LANGUAGE="LaTeX" - - /NOAUTO_SUBSTITUTE - - /DESCRIPTION="" - /DUPLICATION=CONTEXT_DEPENDENT - - /SEPARATOR="" - - /TYPE=NONTERMINAL - - - "\subsubsection{{section_text}}" - -END DEFINE - -DELETE PLACEHOLDER TITLE_TEXT - - /LANGUAGE="LaTeX" - -DEFINE PLACEHOLDER TITLE_TEXT - - /LANGUAGE="LaTeX" - - /NOAUTO_SUBSTITUTE - - /DESCRIPTION="" - - /DUPLICATION=CONTEXT_DEPENDENT - - /SEPARATOR="" - - /TYPE=TERMINAL - - "Enter some title text, spaces are allowed" - -END DEFINE - -DELETE PLACEHOLDER SECTION_TEXT - - /LANGUAGE="LaTeX" - -DEFINE PLACEHOLDER SECTION_TEXT - - /LANGUAGE="LaTeX" - - /NOAUTO_SUBSTITUTE - - /DESCRIPTION="" - - /DUPLICATION=CONTEXT_DEPENDENT - - /SEPARATOR="" - - /TYPE=TERMINAL - - "Enter some text for the section title, spaces are allowed" - -END DEFINE - -DELETE PLACEHOLDER AUTHOR_TEXT - - /LANGUAGE="LaTeX" - -DEFINE PLACEHOLDER AUTHOR_TEXT - - /LANGUAGE="LaTeX" - - /NOAUTO_SUBSTITUTE - - /DESCRIPTION="" - - /DUPLICATION=CONTEXT_DEPENDENT - - /SEPARATOR="" - - /TYPE=TERMINAL - - "Either type your name here or redefine the placeholder to insert your name." - -END DEFINE - -DELETE PLACEHOLDER DATE_TEXT - - /LANGUAGE="LaTeX" - -DEFINE PLACEHOLDER DATE_TEXT - - /LANGUAGE="LaTeX" - - /NOAUTO_SUBSTITUTE - - /DESCRIPTION="" - - /DUPLICATION=CONTEXT_DEPENDENT - - /SEPARATOR="" - - /TYPE=TERMINAL - - "Enter the date ie 8th August 1997" - -END DEFINE - -DELETE PLACEHOLDER LIST - - /LANGUAGE="LaTeX" - -DEFINE PLACEHOLDER LIST - - /LANGUAGE="LaTeX" - - /NOAUTO_SUBSTITUTE - - /DESCRIPTION="" - - /DUPLICATION=CONTEXT_DEPENDENT - - /SEPARATOR="" - - /TYPE=MENU - - "description_list"/PLACEHOLDER - "enumeration_list"/PLACEHOLDER - "itemise_list"/PLACEHOLDER - -END DEFINE - -DELETE PLACEHOLDER DESCRIPTION_LIST - - /LANGUAGE="LaTeX" - -DEFINE PLACEHOLDER DESCRIPTION_LIST - - /LANGUAGE="LaTeX" - - /NOAUTO_SUBSTITUTE - - /DESCRIPTION="" - - /DUPLICATION=CONTEXT_DEPENDENT - - /SEPARATOR="" - - /TYPE=NONTERMINAL - - "\begin{description}" - "{desc_list_item}..." - "\end{description}" - "" - -END DEFINE - - -DELETE PLACEHOLDER DESC_LIST_ITEM - - /LANGUAGE="LaTeX" - -DEFINE PLACEHOLDER DESC_LIST_ITEM - - /LANGUAGE="LaTeX" - - /NOAUTO_SUBSTITUTE - - /DESCRIPTION="" - - /DUPLICATION=CONTEXT_DEPENDENT - - /SEPARATOR="" - - /TYPE=NONTERMINAL - - "\item [{text}] {text}" - "" - -END DEFINE - -DELETE PLACEHOLDER ENUMERATION_LIST - - /LANGUAGE="LaTeX" - -DEFINE PLACEHOLDER ENUMERATION_LIST - - /LANGUAGE="LaTeX" - - /NOAUTO_SUBSTITUTE - - /DESCRIPTION="" - - /DUPLICATION=CONTEXT_DEPENDENT - - /SEPARATOR="" - - /TYPE=NONTERMINAL - - "\begin{enumerate}" - "[item]..." - "\end{enumerate}" - "" - -END DEFINE - -DELETE PLACEHOLDER ITEM - - /LANGUAGE="LaTeX" - -DEFINE PLACEHOLDER ITEM - - /LANGUAGE="LaTeX" - - /NOAUTO_SUBSTITUTE - - /DESCRIPTION="" - - /DUPLICATION=CONTEXT_DEPENDENT - - /SEPARATOR="" - - /TYPE=NONTERMINAL - - "\item {text}" - "" - -END DEFINE - -DELETE PLACEHOLDER ITEMISE_LIST - - /LANGUAGE="LaTeX" - -DEFINE PLACEHOLDER ITEMISE_LIST - - /LANGUAGE="LaTeX" - - /NOAUTO_SUBSTITUTE - - /DESCRIPTION="" - - /DUPLICATION=CONTEXT_DEPENDENT - - /SEPARATOR="" - - /TYPE=NONTERMINAL - - "\begin{itemize}" - "[item]..." - "\end{itemize}" - -END DEFINE - -DELETE PLACEHOLDER VERBATIM_ - - /LANGUAGE="LaTeX" - -DEFINE PLACEHOLDER VERBATIM_ - - /LANGUAGE="LaTeX" - - /NOAUTO_SUBSTITUTE - - /DESCRIPTION="Provide the verbatim construct" - - /DUPLICATION=CONTEXT_DEPENDENT - - /SEPARATOR="" - - /TYPE=NONTERMINAL - - "\begin{verbatim}" - "{text}" - "\end{verbatim}"{language_name} - -END DEFINE - -DELETE PLACEHOLDER FIGURE_ - - /LANGUAGE="LaTeX" - -DEFINE PLACEHOLDER FIGURE_ - - /LANGUAGE="LaTeX" - - /NOAUTO_SUBSTITUTE - - /DESCRIPTION="" - - /DUPLICATION=CONTEXT_DEPENDENT - - /SEPARATOR="" - - /TYPE=NONTERMINAL - - "\begin{figure} [position]" - "[statement]..." - "[caption]" - "\end{figure}" - -END DEFINE - -DELETE PLACEHOLDER TABLE_ - - /LANGUAGE="LaTeX" - -DEFINE PLACEHOLDER TABLE_ - - /LANGUAGE="LaTeX" - - /NOAUTO_SUBSTITUTE - - /DESCRIPTION="" - /DUPLICATION=CONTEXT_DEPENDENT - - /SEPARATOR="" - - /TYPE=NONTERMINAL - - - "\begin{table} [position]" - "\begin{tabularx}{{width}}{{preamble}} - "[statement]..." - "[caption]" - "\end{table}" - -END DEFINE - -DELETE PLACEHOLDER CAPTION - - /LANGUAGE="LaTeX" - -DEFINE PLACEHOLDER CAPTION - - /LANGUAGE="LaTeX" - - /NOAUTO_SUBSTITUTE - - /DESCRIPTION="" - - /DUPLICATION=CONTEXT_DEPENDENT - - /SEPARATOR="" - - /TYPE=NONTERMINAL - - "\caption[text]{{text}} [general_label]" - -END DEFINE - -DELETE PLACEHOLDER GENERAL_LABEL - - /LANGUAGE="LaTeX" - -DEFINE PLACEHOLDER GENERAL_LABEL - - /LANGUAGE="LaTeX" - - /NOAUTO_SUBSTITUTE - - /DESCRIPTION="Used to generate \label{text}" - - /DUPLICATION=CONTEXT_DEPENDENT - - /SEPARATOR="" - - /TYPE=NONTERMINAL - - "\label{{text}}" - -END DEFINE - -DELETE PLACEHOLDER POSITION - - /LANGUAGE="LaTeX" - -DEFINE PLACEHOLDER POSITION - - /LANGUAGE="LaTeX" - - /NOAUTO_SUBSTITUTE - - /DESCRIPTION="" - - /DUPLICATION=CONTEXT_DEPENDENT - - /SEPARATOR="" - - /TYPE=MENU - - "[h]" - "[ht]" - "[t]" - "[b]" - "[hb]" - "[H]" - "[p]" - -END DEFINE - -DELETE PLACEHOLDER MARGINAL_NOTE - - /LANGUAGE="LaTeX" - -DEFINE PLACEHOLDER MARGINAL_NOTE - - /LANGUAGE="LaTeX" - - /NOAUTO_SUBSTITUTE - - /DESCRIPTION="Generate a marginal note." - - /DUPLICATION=CONTEXT_DEPENDENT - - /SEPARATOR="" - - /TYPE=NONTERMINAL - - "\marginpar{{text}}" - -END DEFINE - -DELETE PLACEHOLDER FOOTNOTE - - /LANGUAGE="LaTeX" - -DEFINE PLACEHOLDER FOOTNOTE - - /LANGUAGE="LaTeX" - - /NOAUTO_SUBSTITUTE - - /DESCRIPTION="Generate a foot note" - - /DUPLICATION=CONTEXT_DEPENDENT - - /SEPARATOR="" - - /TYPE=NONTERMINAL - - "\footnote[footnotenum]{{text}}" - -END DEFINE - -DELETE PLACEHOLDER FOOTNOTENUM - - /LANGUAGE="LaTeX" - -DEFINE PLACEHOLDER FOOTNOTENUM - - /LANGUAGE="LaTeX" - - /NOAUTO_SUBSTITUTE - - /DESCRIPTION="The number of the footnote" - - /DUPLICATION=CONTEXT_DEPENDENT - - /SEPARATOR="" - - /TYPE=NONTERMINAL - - "[{foot_number}]" - -END DEFINE - -DELETE PLACEHOLDER FOOT_NUMBER - - /LANGUAGE="LaTeX" - -DEFINE PLACEHOLDER FOOT_NUMBER - - /LANGUAGE="LaTeX" - - /NOAUTO_SUBSTITUTE - - /DESCRIPTION="" - - /DUPLICATION=CONTEXT_DEPENDENT - - /SEPARATOR="" - - /TYPE=TERMINAL - - "Enter a footnote number." - -END DEFINE - -DELETE PLACEHOLDER FOOTNOTEMARK - - /LANGUAGE="LaTeX" - -DEFINE PLACEHOLDER FOOTNOTEMARK - - /LANGUAGE="LaTeX" - - /NOAUTO_SUBSTITUTE - - /DESCRIPTION="Generate a foot note mark. Used with footnotetext." - - /DUPLICATION=CONTEXT_DEPENDENT - - /SEPARATOR="" - - /TYPE=NONTERMINAL - - "\footnotemark[footnotenum]" - -END DEFINE - -DELETE PLACEHOLDER FOOTNOTETEXT - - /LANGUAGE="LaTeX" - -DEFINE PLACEHOLDER FOOTNOTETEXT - - /LANGUAGE="LaTeX" - - /NOAUTO_SUBSTITUTE - - /DESCRIPTION="Used with footnotemark to footnote text." - - /DUPLICATION=CONTEXT_DEPENDENT - - /SEPARATOR="" - - /TYPE=NONTERMINAL - - "\footnotetext[footnotenum]{{text}}" - -END DEFINE - -DELETE PLACEHOLDER FOOTNOTERULE - - /LANGUAGE="LaTeX" - -DEFINE PLACEHOLDER FOOTNOTERULE - - /LANGUAGE="LaTeX" - - /NOAUTO_SUBSTITUTE - - /DESCRIPTION="Draws line separating footnote text from main text." - - /DUPLICATION=CONTEXT_DEPENDENT - - /SEPARATOR="" - - /TYPE=NONTERMINAL - - "\footnoterule" - -END DEFINE - -DELETE PLACEHOLDER SYMBOLS - - /LANGUAGE="LaTeX" - -DEFINE PLACEHOLDER SYMBOLS - - /LANGUAGE="LaTeX" - - /NOAUTO_SUBSTITUTE - - /DESCRIPTION="Special symbols" - - /DUPLICATION=CONTEXT_DEPENDENT - - /SEPARATOR="" - - /TYPE=MENU - - "copyright"/PLACEHOLDER - -END DEFINE - -DELETE PLACEHOLDER COPYRIGHT - - /LANGUAGE="LaTeX" - -DEFINE PLACEHOLDER COPYRIGHT - - /LANGUAGE="LaTeX" - - /NOAUTO_SUBSTITUTE - - /DESCRIPTION="Copyright symbol" - - /DUPLICATION=CONTEXT_DEPENDENT - - /SEPARATOR="" - - /TYPE=NONTERMINAL - - "\copyright" - -END DEFINE - -DELETE PLACEHOLDER WIDTH - - /LANGUAGE="LaTeX" - -DEFINE PLACEHOLDER WIDTH - - /LANGUAGE="LaTeX" - - /NOAUTO_SUBSTITUTE - - /DESCRIPTION="" - - /DUPLICATION=CONTEXT_DEPENDENT - - /SEPARATOR="" - - /TYPE=TERMINAL - - "Enter a width parameter." - -END DEFINE - -DELETE PLACEHOLDER PREAMBLE - - /LANGUAGE="LaTeX" - -DEFINE PLACEHOLDER PREAMBLE - - /LANGUAGE="LaTeX" - - /NOAUTO_SUBSTITUTE - - /DESCRIPTION="" - - /DUPLICATION=CONTEXT_DEPENDENT - - /SEPARATOR="|" - - /TYPE=TERMINAL - - "Enter a preamble." - -END DEFINE - -[placeholder_definition]... - - -END DEFINE - -DELETE PLACEHOLDER LABEL - - /LANGUAGE="LaTeX" - -DEFINE PLACEHOLDER LABEL - - /LANGUAGE="LaTeX" - - /NOAUTO_SUBSTITUTE - - /DESCRIPTION="" - - /DUPLICATION=CONTEXT_DEPENDENT - - /SEPARATOR="" - - /TYPE=NONTERMINAL - - "[{label_text}]" - -END DEFINE - -DELETE PLACEHOLDER LABEL_TEXT - - /LANGUAGE="LaTeX" - -DEFINE PLACEHOLDER LABEL_TEXT - - /LANGUAGE="LaTeX" - - /NOAUTO_SUBSTITUTE - - /DESCRIPTION="" - - /DUPLICATION=CONTEXT_DEPENDENT - - /SEPARATOR="" - - /TYPE=TERMINAL - - "This is the preliminary stuff followed by the style" - "ie EX i - will generate lists with 'EX' and then a Roman numeral" - -END DEFINE - -DELETE PLACEHOLDER QUOTE - - /LANGUAGE="LaTeX" - -DEFINE PLACEHOLDER QUOTE - - /LANGUAGE="LaTeX" - - /NOAUTO_SUBSTITUTE - - /DESCRIPTION="Provide a quote construct" - - /DUPLICATION=CONTEXT_DEPENDENT - - /SEPARATOR="" - - /TYPE=NONTERMINAL - - "\begin{quote}" - "``[text]''" - "\end{quote}" - "" - -END DEFINE - -DELETE TOKEN QU - - /LANGUAGE="LaTeX" - -DEFINE TOKEN QU - - /LANGUAGE="LaTeX" - - /PLACEHOLDER=QUOTE - -END DEFINE - -DELETE TOKEN LD - - /LANGUAGE="LaTeX" - -DEFINE TOKEN LD - - /LANGUAGE="LaTeX" - - /PLACEHOLDER=DESCRIPTION_LIST - -END DEFINE - -DELETE TOKEN LE - - /LANGUAGE="LaTeX" - -DEFINE TOKEN LE - - /LANGUAGE="LaTeX" - - /PLACEHOLDER=ENUMERATION_LIST - -END DEFINE - -DELETE TOKEN LI - - /LANGUAGE="LaTeX" - -DEFINE TOKEN LI - - /LANGUAGE="LaTeX" - - /PLACEHOLDER=ITEMISE_LIST - -END DEFINE - -DELETE TOKEN VB - - /LANGUAGE="LaTeX" - -DEFINE TOKEN VB - - /LANGUAGE="LaTeX" - - /PLACEHOLDER=VERBATIM_ - -END DEFINE - -DELETE TOKEN IT - - /LANGUAGE="LaTeX" - -DEFINE TOKEN IT - - /LANGUAGE="LaTeX" - - /DESCRIPTION="" - - - - "\textit{{text}}" - -END DEFINE - -DELETE TOKEN BF - - /LANGUAGE="LaTeX" - -DEFINE TOKEN BF - - /LANGUAGE="LaTeX" - - /DESCRIPTION="" - - - - "\textbf{{text}}" - -END DEFINE - -DELETE TOKEN FIG - - /LANGUAGE="LaTeX" - -DEFINE TOKEN FIG - - /LANGUAGE="LaTeX" - - /PLACEHOLDER=FIGURE_ - -END DEFINE - -[token_definition]... -[placeholder_definition]... - -DELETE TOKEN TB - - /LANGUAGE="LaTeX" - -DEFINE TOKEN TB - - /LANGUAGE="LaTeX" - - /PLACEHOLDER=TABLE_ - -END DEFINE - diff --git a/app-emacs/else-mode/files/Python-cust.lse b/app-emacs/else-mode/files/Python-cust.lse deleted file mode 100644 index 15624cc..0000000 --- a/app-emacs/else-mode/files/Python-cust.lse +++ /dev/null @@ -1,254 +0,0 @@ -;; Copyright (C) 2000,2001,2002,2003 Peter Milliken -;; -;; Author: Peter Milliken <peterm@resmed.com.au>, -;; <peterm@unwired.com.au> -;; Version: 1.1 -;; Keywords: language sensitive abbreviation template placeholder token -;; -;; 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, Inc., 59 Temple Place - Suite 330, -;; Boston, MA 02111-1307, USA. - -;;****************************************************************************** -;; These definitions are my personal customisations for the language. This is -;; where you should place YOUR customisations. -;; -;; Sometimes there is a definition(s) in here that override definitions in the -;; main language template file that are here to make that definition more -;; "usable" - this is because I (primarily) try and generate/maintain the main -;; .lse files from EBNF definitions of the language. Sometimes I just can't -;; express the appropriate customisation in the EBNF and so I am forced to -;; override the placeholder definition in this file. -;; -;; This entries in this file should be used as an example of how to create your -;; own customisations. I would caution that you don't delete any definitions -;; though until you are sure that your edit sessions will not be adversely -;; affected. The best way to check out the effects of a delete is to "compile" -;; (else-compile-buffer) the "delete" command for that definition (this will -;; remove it from your edit session and you can nolonger access the definition -;; until next you load language template files) and then see whether anything -;; has been "lost" in your code generation ability i.e. say you think you don't -;; need the definition for placeholder XXX, just place the following lines at -;; the end of one of your source files (when ELSE is enabled for that buffer) -;; and perform a compile (M-x else-compile-buffer) with the cursor positioned at -;; the beginning of the line: -;; -;; DELETE PLACEHOLDER XXX - -;; /LANGUAGE = "Python" - -;; -;; This will delete definition XXX from memory. -;; -;;****************************************************************************** - - -DEFINE LANGUAGE Python - - /VALID_IDENTIFIER_CHARACTERS="#abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_0123456789" - /INDENT_SIZE=2 - -END DEFINE - -DELETE PLACEHOLDER ", IDENTIFIER" - - /LANGUAGE="Python" - -DEFINE PLACEHOLDER ", IDENTIFIER" - - /LANGUAGE="Python" - - /NOAUTO_SUBSTITUTE - - /DESCRIPTION="" - - /DUPLICATION=CONTEXT_DEPENDENT - - /SEPARATOR="" - - /TYPE=NONTERMINAL - - ", {identifier}" - -END DEFINE - - -DELETE PLACEHOLDER CALL_STMT - - /LANGUAGE="Python" - -DEFINE PLACEHOLDER CALL_STMT - - /LANGUAGE="Python" - - /NOAUTO_SUBSTITUTE - - /DESCRIPTION="" - /DUPLICATION=CONTEXT_DEPENDENT - - /SEPARATOR="" - - /TYPE=NONTERMINAL - - - "{primary} ([parameter_association]...);" - -END DEFINE - -DELETE PLACEHOLDER FUNCDEF - - /LANGUAGE="Python" - -DEFINE PLACEHOLDER FUNCDEF - - /LANGUAGE="Python" - - /NOAUTO_SUBSTITUTE - - /DESCRIPTION="" - /DUPLICATION=CONTEXT_DEPENDENT - - /SEPARATOR="" - - /TYPE=NONTERMINAL - - - "def {identifier} ([defparameter]...):" - " [document_string]" - " {statement}..." - "" - -END DEFINE - -DELETE PLACEHOLDER CLASSDEF - - /LANGUAGE="Python" - -DEFINE PLACEHOLDER CLASSDEF - - /LANGUAGE="Python" - - /NOAUTO_SUBSTITUTE - - /DESCRIPTION="" - /DUPLICATION=CONTEXT_DEPENDENT - - /SEPARATOR="" - - /TYPE=NONTERMINAL - - - "class {classname} [inheritance]:" - " [init_def]" - " " - " [class_funcdef]..." - " " - -END DEFINE - -DELETE PLACEHOLDER INIT_DEF - - /LANGUAGE="Python" - -DEFINE PLACEHOLDER INIT_DEF - - /LANGUAGE="Python" - - /NOAUTO_SUBSTITUTE - - /DESCRIPTION="Provides an __init__ def." - - /DUPLICATION=CONTEXT_DEPENDENT - - /SEPARATOR="" - - /TYPE=NONTERMINAL - - "def __init__ (self, [defparameter]...):" - " [document_string]" - " {statement}..." - "" - -END DEFINE - -DELETE PLACEHOLDER CLASS_FUNCDEF - - /LANGUAGE="Python" - -DEFINE PLACEHOLDER CLASS_FUNCDEF - - /LANGUAGE="Python" - - /NOAUTO_SUBSTITUTE - - /DESCRIPTION="Function definition when within a class" - - /DUPLICATION=CONTEXT_DEPENDENT - - /SEPARATOR="" - - /TYPE=NONTERMINAL - - "def {identifier} (self, [defparameter]...):" - " [document_string]" - " {statement}..." - " " - -END DEFINE - - -DELETE PLACEHOLDER MY_CLASSDEF - - /LANGUAGE="Python" - -DEFINE PLACEHOLDER MY_CLASSDEF - - /LANGUAGE="Python" - - /NOAUTO_SUBSTITUTE - - /DESCRIPTION="" - /DUPLICATION=CONTEXT_DEPENDENT - - /SEPARATOR="" - - /TYPE=NONTERMINAL - - - "class {classname} ({superclass}...):" - "" - " def __init__(self):" - " {superclass}._init_(self)" - " [class_funcdef]..." - " " - -END DEFINE - -DELETE PLACEHOLDER SUPERCLASS - - /LANGUAGE="Python" - -DEFINE PLACEHOLDER SUPERCLASS - - /LANGUAGE="Python" - - /AUTO_SUBSTITUTE - - /DESCRIPTION="" - - /DUPLICATION=CONTEXT_DEPENDENT - - /SEPARATOR="" - - /TYPE=TERMINAL - - - "Type in the name of the superclass." - -END DEFINE - -DELETE PLACEHOLDER COMPILATION_UNIT - - /LANGUAGE="Python" - -DEFINE PLACEHOLDER COMPILATION_UNIT - - /LANGUAGE="Python" - - /NOAUTO_SUBSTITUTE - - /DESCRIPTION="" - /DUPLICATION=CONTEXT_DEPENDENT - - /SEPARATOR="" - - /TYPE=NONTERMINAL - - - """"[text]..."""" - "[import_stmt]..." - "{statement}..." - "[test_statement]" - -END DEFINE - -DELETE TOKEN CD - - /LANGUAGE="Python" - -DEFINE TOKEN CD - - /LANGUAGE="Python" - - /DESCRIPTION="" - - - "def {member_name} (self, value = None):" - " [document_string]" - " if value == {member_name}:" - " return self.{member_name}" - " else:" - " self.{member_name} = value" - " self.Dump()" - -END DEFINE - -DELETE PLACEHOLDER MEMBER_NAME - - /LANGUAGE="Python" - -DEFINE PLACEHOLDER MEMBER_NAME - - /LANGUAGE="Python" - - /AUTO_SUBSTITUTE - - /SUBSTITUTE_COUNT=4 - /DESCRIPTION="" - /DUPLICATION=CONTEXT_DEPENDENT - - /SEPARATOR="" - - /TYPE=TERMINAL - - "Enter the member name of the class" - -END DEFINE - -DELETE PLACEHOLDER TEST_STATEMENT - - /LANGUAGE="Python" - -DEFINE PLACEHOLDER TEST_STATEMENT - - /LANGUAGE="Python" - - /NOAUTO_SUBSTITUTE - - /DESCRIPTION="" - - /DUPLICATION=CONTEXT_DEPENDENT - - /SEPARATOR="" - - /TYPE=NONTERMINAL - - "if __name__ == '__main__':" - " {statement}..." - -END DEFINE diff --git a/app-emacs/else-mode/files/Python.lse b/app-emacs/else-mode/files/Python.lse deleted file mode 100644 index 0c88167..0000000 --- a/app-emacs/else-mode/files/Python.lse +++ /dev/null @@ -1,1307 +0,0 @@ -;; Copyright (C) 1997,1998,1999,2000,2001,2002,2003 Peter Milliken -;; -;; Author: Peter Milliken <peterm@resmed.com.au>, -;; <peterm@unwired.com.au> -;; -;; Keywords: language sensitive abbreviation template placeholder token -;; - -;; 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, Inc., 59 Temple Place - Suite 330, -;; Boston, MA 02111-1307, USA. - -DELETE LANGUAGE Python - -DEFINE LANGUAGE Python - - /INITIAL_STRING="{compilation_unit}" - - /PUNCTUATION_CHARACTERS="*,()" - - /SELF_INSERT_CHARACTERS=" `~!@#$%^&*(),.<>/?;:'[]{}=\-+|" - /VALID_IDENTIFIER_CHARACTERS="#abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_0123456789" - /INDENT_SIZE=2 - - /VERSION=1.10 - - -END DEFINE - -DELETE PLACEHOLDER FORMAL_PARAMETER_NAME - - /LANGUAGE="Python" - -DEFINE PLACEHOLDER FORMAL_PARAMETER_NAME - - /LANGUAGE="Python" - - /NOAUTO_SUBSTITUTE - - /DESCRIPTION="" - - /DUPLICATION=CONTEXT_DEPENDENT - - /SEPARATOR="" - - /TYPE=TERMINAL - - - "Please enter a valid formal_parameter_name" - -END DEFINE - -DELETE PLACEHOLDER TRY_FIN_STMT - - /LANGUAGE="Python" - -DEFINE PLACEHOLDER TRY_FIN_STMT - - /LANGUAGE="Python" - - /NOAUTO_SUBSTITUTE - - /DESCRIPTION="" - - /DUPLICATION=CONTEXT_DEPENDENT - - /SEPARATOR="" - - /TYPE=NONTERMINAL - - - "try:" - " {statement}..." - "finally:" - " {statement}..." - -END DEFINE - -DELETE PLACEHOLDER TRY_STMT - - /LANGUAGE="Python" - -DEFINE PLACEHOLDER TRY_STMT - - /LANGUAGE="Python" - - /NOAUTO_SUBSTITUTE - - /DESCRIPTION="" - - /DUPLICATION=CONTEXT_DEPENDENT - - /SEPARATOR="" - - /TYPE=MENU - - - "try_exc_stmt"/PLACEHOLDER - "try_fin_stmt"/PLACEHOLDER - -END DEFINE - -DELETE PLACEHOLDER "{EXPRESSION}... [, {IDENTIFIER}]" - - /LANGUAGE="Python" - -DEFINE PLACEHOLDER {EXPRESSION}... [, {IDENTIFIER}] - - /LANGUAGE="Python" - - /NOAUTO_SUBSTITUTE - - /DESCRIPTION="" - - /DUPLICATION=CONTEXT_DEPENDENT - - /SEPARATOR="" - - /TYPE=NONTERMINAL - - - "{expression}... [, {identifier}]" - -END DEFINE - -DELETE PLACEHOLDER IMPORTS - - /LANGUAGE="Python" - -DEFINE PLACEHOLDER IMPORTS - - /LANGUAGE="Python" - - /NOAUTO_SUBSTITUTE - - /DESCRIPTION="" - - /DUPLICATION=CONTEXT_DEPENDENT - - /SEPARATOR="" - - /TYPE=NONTERMINAL - - - "{import_stmt}..." - -END DEFINE - -DELETE PLACEHOLDER TEXT - - /LANGUAGE="Python" - -DEFINE PLACEHOLDER TEXT - - /LANGUAGE="Python" - - /NOAUTO_SUBSTITUTE - - /DESCRIPTION="" - - /DUPLICATION=VERTICAL - - /SEPARATOR="" - - /TYPE=TERMINAL - - - "Please enter a valid text" - -END DEFINE - -DELETE PLACEHOLDER SUBLIST - - /LANGUAGE="Python" - -DEFINE PLACEHOLDER SUBLIST - - /LANGUAGE="Python" - - /NOAUTO_SUBSTITUTE - - /DESCRIPTION="" - - /DUPLICATION=CONTEXT_DEPENDENT - - /SEPARATOR="" - - /TYPE=NONTERMINAL - - - "{parameter}..." - -END DEFINE - -DELETE PLACEHOLDER MODULE - - /LANGUAGE="Python" - -DEFINE PLACEHOLDER MODULE - - /LANGUAGE="Python" - - /NOAUTO_SUBSTITUTE - - /DESCRIPTION="" - - /DUPLICATION=CONTEXT_DEPENDENT - - /SEPARATOR="" - - /TYPE=TERMINAL - - - "Please enter a valid module" - -END DEFINE - -DELETE PLACEHOLDER IF_STMT - - /LANGUAGE="Python" - -DEFINE PLACEHOLDER IF_STMT - - /LANGUAGE="Python" - - /NOAUTO_SUBSTITUTE - - /DESCRIPTION="" - - /DUPLICATION=CONTEXT_DEPENDENT - - /SEPARATOR="" - - /TYPE=NONTERMINAL - - - "if {expression}:" - " {statement}..." - "[elif_part]..." - "[else_part]" - -END DEFINE - -DELETE PLACEHOLDER CLASSNAME - - /LANGUAGE="Python" - -DEFINE PLACEHOLDER CLASSNAME - - /LANGUAGE="Python" - - /NOAUTO_SUBSTITUTE - - /DESCRIPTION="" - - /DUPLICATION=CONTEXT_DEPENDENT - - /SEPARATOR="" - - /TYPE=NONTERMINAL - - /PLACEHOLDER=IDENTIFIER - - -END DEFINE - -DELETE PLACEHOLDER TRY_EXC_STMT - - /LANGUAGE="Python" - -DEFINE PLACEHOLDER TRY_EXC_STMT - - /LANGUAGE="Python" - - /NOAUTO_SUBSTITUTE - - /DESCRIPTION="" - - /DUPLICATION=CONTEXT_DEPENDENT - - /SEPARATOR="" - - /TYPE=NONTERMINAL - - - "try:" - " {statement}..." - "[except_part]..." - "[else_part]" - -END DEFINE - -DELETE PLACEHOLDER RETURN_STMT - - /LANGUAGE="Python" - -DEFINE PLACEHOLDER RETURN_STMT - - /LANGUAGE="Python" - - /NOAUTO_SUBSTITUTE - - /DESCRIPTION="" - - /DUPLICATION=CONTEXT_DEPENDENT - - /SEPARATOR="" - - /TYPE=NONTERMINAL - - - "return [expression]..." - -END DEFINE - -DELETE PLACEHOLDER "= {EXPRESSION}" - - /LANGUAGE="Python" - -DEFINE PLACEHOLDER = {EXPRESSION} - - /LANGUAGE="Python" - - /NOAUTO_SUBSTITUTE - - /DESCRIPTION="" - - /DUPLICATION=CONTEXT_DEPENDENT - - /SEPARATOR="" - - /TYPE=NONTERMINAL - - - "= {expression}" - -END DEFINE - -DELETE PLACEHOLDER ENCLOSURE - - /LANGUAGE="Python" - -DEFINE PLACEHOLDER ENCLOSURE - - /LANGUAGE="Python" - - /NOAUTO_SUBSTITUTE - - /DESCRIPTION="" - - /DUPLICATION=CONTEXT_DEPENDENT - - /SEPARATOR="" - - /TYPE=MENU - - - "parenth_form"/PLACEHOLDER - "list_display"/PLACEHOLDER - "dict_display"/PLACEHOLDER - "string_conversion"/PLACEHOLDER - -END DEFINE - -DELETE PLACEHOLDER DEFPARAMETER - - /LANGUAGE="Python" - -DEFINE PLACEHOLDER DEFPARAMETER - - /LANGUAGE="Python" - - /NOAUTO_SUBSTITUTE - - /DESCRIPTION="" - - /DUPLICATION=CONTEXT_DEPENDENT - - /SEPARATOR=", " - - /TYPE=MENU - - - "{parameter} [= {expression}]" - "*{identifier}" - "**{identifier}" - -END DEFINE - -DELETE PLACEHOLDER "{FORMAL_PARAMETER_NAME} =" - - /LANGUAGE="Python" - -DEFINE PLACEHOLDER {FORMAL_PARAMETER_NAME} = - - /LANGUAGE="Python" - - /NOAUTO_SUBSTITUTE - - /DESCRIPTION="" - - /DUPLICATION=CONTEXT_DEPENDENT - - /SEPARATOR="" - - /TYPE=NONTERMINAL - - - "{formal_parameter_name} =" - -END DEFINE - -DELETE PLACEHOLDER BREAK_STMT - - /LANGUAGE="Python" - -DEFINE PLACEHOLDER BREAK_STMT - - /LANGUAGE="Python" - - /NOAUTO_SUBSTITUTE - - /DESCRIPTION="" - - /DUPLICATION=CONTEXT_DEPENDENT - - /SEPARATOR="" - - /TYPE=NONTERMINAL - - - "break" - -END DEFINE - -DELETE PLACEHOLDER IMPORT_STMT - - /LANGUAGE="Python" - -DEFINE PLACEHOLDER IMPORT_STMT - - /LANGUAGE="Python" - - /NOAUTO_SUBSTITUTE - - /DESCRIPTION="" - - /DUPLICATION=VERTICAL - - /SEPARATOR="" - - /TYPE=MENU - - - "import {module} [as {name}], [module_as_name]..." - "from {module} import {identifier} [as {name}], [identifier_as_name]..." - "from {module} import *" - -END DEFINE - -DELETE PLACEHOLDER COMMENT_STMT - - /LANGUAGE="Python" - -DEFINE PLACEHOLDER COMMENT_STMT - - /LANGUAGE="Python" - - /NOAUTO_SUBSTITUTE - - /DESCRIPTION="" - - /DUPLICATION=CONTEXT_DEPENDENT - - /SEPARATOR="" - - /TYPE=NONTERMINAL - - - "# {text}" - -END DEFINE - -DELETE PLACEHOLDER FLOATNUMBER - - /LANGUAGE="Python" - -DEFINE PLACEHOLDER FLOATNUMBER - - /LANGUAGE="Python" - - /NOAUTO_SUBSTITUTE - - /DESCRIPTION="" - - /DUPLICATION=CONTEXT_DEPENDENT - - /SEPARATOR="" - - /TYPE=TERMINAL - - - "Please enter a valid floatnumber" - -END DEFINE - -DELETE PLACEHOLDER ELIF_PART - - /LANGUAGE="Python" - -DEFINE PLACEHOLDER ELIF_PART - - /LANGUAGE="Python" - - /NOAUTO_SUBSTITUTE - - /DESCRIPTION="" - - /DUPLICATION=VERTICAL - - /SEPARATOR="" - - /TYPE=NONTERMINAL - - - "elif {expression}:" - " {statement}..." - -END DEFINE - -DELETE PLACEHOLDER CONTINUE_STMT - - /LANGUAGE="Python" - -DEFINE PLACEHOLDER CONTINUE_STMT - - /LANGUAGE="Python" - - /NOAUTO_SUBSTITUTE - - /DESCRIPTION="" - - /DUPLICATION=CONTEXT_DEPENDENT - - /SEPARATOR="" - - /TYPE=NONTERMINAL - - - "continue" - -END DEFINE - -DELETE PLACEHOLDER EXCEPT_PART - - /LANGUAGE="Python" - -DEFINE PLACEHOLDER EXCEPT_PART - - /LANGUAGE="Python" - - /NOAUTO_SUBSTITUTE - - /DESCRIPTION="" - - /DUPLICATION=VERTICAL - - /SEPARATOR="" - - /TYPE=NONTERMINAL - - - "except [exception_arguments]:" - " {statement}..." - -END DEFINE - -DELETE PLACEHOLDER NAME - - /LANGUAGE="Python" - -DEFINE PLACEHOLDER NAME - - /LANGUAGE="Python" - - /NOAUTO_SUBSTITUTE - - /DESCRIPTION="" - - /DUPLICATION=CONTEXT_DEPENDENT - - /SEPARATOR="" - - /TYPE=TERMINAL - - - "Please enter a valid name" - -END DEFINE - -DELETE PLACEHOLDER PRINT_STMT - - /LANGUAGE="Python" - -DEFINE PLACEHOLDER PRINT_STMT - - /LANGUAGE="Python" - - /NOAUTO_SUBSTITUTE - - /DESCRIPTION="" - - /DUPLICATION=CONTEXT_DEPENDENT - - /SEPARATOR="" - - /TYPE=NONTERMINAL - - - "print [expression]..." - -END DEFINE - -DELETE PLACEHOLDER LITERAL - - /LANGUAGE="Python" - -DEFINE PLACEHOLDER LITERAL - - /LANGUAGE="Python" - - /NOAUTO_SUBSTITUTE - - /DESCRIPTION="" - - /DUPLICATION=CONTEXT_DEPENDENT - - /SEPARATOR="" - - /TYPE=MENU - - - "stringliteral"/PLACEHOLDER - "integer"/PLACEHOLDER - "longinteger"/PLACEHOLDER - "floatnumber"/PLACEHOLDER - "imagnumber"/PLACEHOLDER - -END DEFINE - -DELETE PLACEHOLDER ASSIGNMENT_STMT - - /LANGUAGE="Python" - -DEFINE PLACEHOLDER ASSIGNMENT_STMT - - /LANGUAGE="Python" - - /NOAUTO_SUBSTITUTE - - /DESCRIPTION="" - - /DUPLICATION=CONTEXT_DEPENDENT - - /SEPARATOR="" - - /TYPE=NONTERMINAL - - - "{target} = {expression}..." - -END DEFINE - -DELETE PLACEHOLDER EXPRESSION_STMT - - /LANGUAGE="Python" - -DEFINE PLACEHOLDER EXPRESSION_STMT - - /LANGUAGE="Python" - - /NOAUTO_SUBSTITUTE - - /DESCRIPTION="" - - /DUPLICATION=CONTEXT_DEPENDENT - - /SEPARATOR="" - - /TYPE=NONTERMINAL - - - "{expression}..." - -END DEFINE - -DELETE PLACEHOLDER ARGUMENT_LIST - - /LANGUAGE="Python" - -DEFINE PLACEHOLDER ARGUMENT_LIST - - /LANGUAGE="Python" - - /NOAUTO_SUBSTITUTE - - /DESCRIPTION="" - - /DUPLICATION=CONTEXT_DEPENDENT - - /SEPARATOR="" - - /TYPE=NONTERMINAL - - - "{parameter_association}..." - -END DEFINE - -DELETE PLACEHOLDER STATEMENT - - /LANGUAGE="Python" - -DEFINE PLACEHOLDER STATEMENT - - /LANGUAGE="Python" - - /NOAUTO_SUBSTITUTE - - /DESCRIPTION="" - - /DUPLICATION=VERTICAL - - /SEPARATOR="" - - /TYPE=MENU - - - "if_stmt"/PLACEHOLDER - "while_stmt"/PLACEHOLDER - "for_stmt"/PLACEHOLDER - "try_stmt"/PLACEHOLDER - "funcdef"/PLACEHOLDER - "classdef"/PLACEHOLDER - "call_stmt"/PLACEHOLDER - "expression_stmt"/PLACEHOLDER - "assert_stmt"/PLACEHOLDER - "assignment_stmt"/PLACEHOLDER - "pass_stmt"/PLACEHOLDER - "del_stmt"/PLACEHOLDER - "print_stmt"/PLACEHOLDER - "return_stmt"/PLACEHOLDER - "yield_stmt"/PLACEHOLDER - "raise_stmt"/PLACEHOLDER - "break_stmt"/PLACEHOLDER - "continue_stmt"/PLACEHOLDER - "import_stmt"/PLACEHOLDER - "global_stmt"/PLACEHOLDER - "exec_stmt"/PLACEHOLDER - "comment_stmt"/PLACEHOLDER - -END DEFINE - -DELETE PLACEHOLDER STRING_CONVERSION - - /LANGUAGE="Python" - -DEFINE PLACEHOLDER STRING_CONVERSION - - /LANGUAGE="Python" - - /NOAUTO_SUBSTITUTE - - /DESCRIPTION="" - - /DUPLICATION=CONTEXT_DEPENDENT - - /SEPARATOR="" - - /TYPE=TERMINAL - - - "Please enter a valid string_conversion" - -END DEFINE - -DELETE PLACEHOLDER SUBSCRIPTION - - /LANGUAGE="Python" - -DEFINE PLACEHOLDER SUBSCRIPTION - - /LANGUAGE="Python" - - /NOAUTO_SUBSTITUTE - - /DESCRIPTION="" - - /DUPLICATION=CONTEXT_DEPENDENT - - /SEPARATOR="" - - /TYPE=TERMINAL - - - "Please enter a valid subscription" - -END DEFINE - -DELETE PLACEHOLDER PARAMETER - - /LANGUAGE="Python" - -DEFINE PLACEHOLDER PARAMETER - - /LANGUAGE="Python" - - /NOAUTO_SUBSTITUTE - - /DESCRIPTION="" - - /DUPLICATION=CONTEXT_DEPENDENT - - /SEPARATOR=", " - - /TYPE=MENU - - - "identifier"/PLACEHOLDER - "({sublist})" - -END DEFINE - -DELETE PLACEHOLDER IMAGNUMBER - - /LANGUAGE="Python" - -DEFINE PLACEHOLDER IMAGNUMBER - - /LANGUAGE="Python" - - /NOAUTO_SUBSTITUTE - - /DESCRIPTION="" - - /DUPLICATION=CONTEXT_DEPENDENT - - /SEPARATOR="" - - /TYPE=TERMINAL - - - "Please enter a valid imagnumber" - -END DEFINE - -DELETE PLACEHOLDER EXEC_STMT - - /LANGUAGE="Python" - -DEFINE PLACEHOLDER EXEC_STMT - - /LANGUAGE="Python" - - /NOAUTO_SUBSTITUTE - - /DESCRIPTION="" - - /DUPLICATION=CONTEXT_DEPENDENT - - /SEPARATOR="" - - /TYPE=NONTERMINAL - - - "exec {expression} [in {expression}...]" - -END DEFINE - -DELETE PLACEHOLDER PARAMETER_ASSOCIATION - - /LANGUAGE="Python" - -DEFINE PLACEHOLDER PARAMETER_ASSOCIATION - - /LANGUAGE="Python" - - /NOAUTO_SUBSTITUTE - - /DESCRIPTION="" - - /DUPLICATION=CONTEXT_DEPENDENT - - /SEPARATOR=", " - - /TYPE=NONTERMINAL - - - "[{formal_parameter_name} =] {expression}" - -END DEFINE - -DELETE PLACEHOLDER ATTRIBUTEREF - - /LANGUAGE="Python" - -DEFINE PLACEHOLDER ATTRIBUTEREF - - /LANGUAGE="Python" - - /NOAUTO_SUBSTITUTE - - /DESCRIPTION="" - - /DUPLICATION=CONTEXT_DEPENDENT - - /SEPARATOR="" - - /TYPE=TERMINAL - - - "Please enter a valid attributeref" - -END DEFINE - -DELETE PLACEHOLDER LONGINTEGER - - /LANGUAGE="Python" - -DEFINE PLACEHOLDER LONGINTEGER - - /LANGUAGE="Python" - - /NOAUTO_SUBSTITUTE - - /DESCRIPTION="" - - /DUPLICATION=CONTEXT_DEPENDENT - - /SEPARATOR="" - - /TYPE=TERMINAL - - - "Please enter a valid longinteger" - -END DEFINE - -DELETE PLACEHOLDER PARENTH_FORM - - /LANGUAGE="Python" - -DEFINE PLACEHOLDER PARENTH_FORM - - /LANGUAGE="Python" - - /NOAUTO_SUBSTITUTE - - /DESCRIPTION="" - - /DUPLICATION=CONTEXT_DEPENDENT - - /SEPARATOR="" - - /TYPE=NONTERMINAL - - - "([expression]...)" - -END DEFINE - -DELETE PLACEHOLDER CALL_STMT - - /LANGUAGE="Python" - -DEFINE PLACEHOLDER CALL_STMT - - /LANGUAGE="Python" - - /NOAUTO_SUBSTITUTE - - /DESCRIPTION="" - - /DUPLICATION=CONTEXT_DEPENDENT - - /SEPARATOR="" - - /TYPE=NONTERMINAL - - - "{primary} [parameter_list]" - -END DEFINE - -DELETE PLACEHOLDER IDENTIFIER_AS_NAME - - /LANGUAGE="Python" - -DEFINE PLACEHOLDER IDENTIFIER_AS_NAME - - /LANGUAGE="Python" - - /NOAUTO_SUBSTITUTE - - /DESCRIPTION="" - - /DUPLICATION=HORIZONTAL - - /SEPARATOR=", " - - /TYPE=NONTERMINAL - - - "{identifier} [as {name}]" - -END DEFINE - -DELETE PLACEHOLDER CLASSDEF - - /LANGUAGE="Python" - -DEFINE PLACEHOLDER CLASSDEF - - /LANGUAGE="Python" - - /NOAUTO_SUBSTITUTE - - /DESCRIPTION="" - - /DUPLICATION=CONTEXT_DEPENDENT - - /SEPARATOR="" - - /TYPE=NONTERMINAL - - - "class {classname}[inheritance]:" - " {statement}..." - -END DEFINE - -DELETE PLACEHOLDER COMPILATION_UNIT - - /LANGUAGE="Python" - -DEFINE PLACEHOLDER COMPILATION_UNIT - - /LANGUAGE="Python" - - /NOAUTO_SUBSTITUTE - - /DESCRIPTION="" - - /DUPLICATION=CONTEXT_DEPENDENT - - /SEPARATOR="" - - /TYPE=NONTERMINAL - - - "[import_stmt]..." - "{statement}..." - -END DEFINE - -DELETE PLACEHOLDER PRIMARY - - /LANGUAGE="Python" - -DEFINE PLACEHOLDER PRIMARY - - /LANGUAGE="Python" - - /NOAUTO_SUBSTITUTE - - /DESCRIPTION="" - - /DUPLICATION=CONTEXT_DEPENDENT - - /SEPARATOR="" - - /TYPE=TERMINAL - - - "Please enter a valid primary" - -END DEFINE - -DELETE PLACEHOLDER ELSE_PART - - /LANGUAGE="Python" - -DEFINE PLACEHOLDER ELSE_PART - - /LANGUAGE="Python" - - /NOAUTO_SUBSTITUTE - - /DESCRIPTION="" - - /DUPLICATION=CONTEXT_DEPENDENT - - /SEPARATOR="" - - /TYPE=NONTERMINAL - - - "else:" - " {statement}..." - -END DEFINE - -DELETE PLACEHOLDER TARGET_LIST - - /LANGUAGE="Python" - -DEFINE PLACEHOLDER TARGET_LIST - - /LANGUAGE="Python" - - /NOAUTO_SUBSTITUTE - - /DESCRIPTION="" - - /DUPLICATION=CONTEXT_DEPENDENT - - /SEPARATOR="" - - /TYPE=NONTERMINAL - - - "{target}..." - -END DEFINE - -DELETE PLACEHOLDER FOR_STMT - - /LANGUAGE="Python" - -DEFINE PLACEHOLDER FOR_STMT - - /LANGUAGE="Python" - - /NOAUTO_SUBSTITUTE - - /DESCRIPTION="" - - /DUPLICATION=CONTEXT_DEPENDENT - - /SEPARATOR="" - - /TYPE=NONTERMINAL - - - "for {target_list} in {expression}...:" - " {statement}..." - "[else_part]" - -END DEFINE - -DELETE PLACEHOLDER "IN {EXPRESSION}..." - - /LANGUAGE="Python" - -DEFINE PLACEHOLDER IN {EXPRESSION}... - - /LANGUAGE="Python" - - /NOAUTO_SUBSTITUTE - - /DESCRIPTION="" - - /DUPLICATION=CONTEXT_DEPENDENT - - /SEPARATOR="" - - /TYPE=NONTERMINAL - - - "in {expression}..." - -END DEFINE - -DELETE PLACEHOLDER "AS {NAME}" - - /LANGUAGE="Python" - -DEFINE PLACEHOLDER AS {NAME} - - /LANGUAGE="Python" - - /NOAUTO_SUBSTITUTE - - /DESCRIPTION="" - - /DUPLICATION=CONTEXT_DEPENDENT - - /SEPARATOR="" - - /TYPE=NONTERMINAL - - - "as {name}" - -END DEFINE - -DELETE PLACEHOLDER ATOM - - /LANGUAGE="Python" - -DEFINE PLACEHOLDER ATOM - - /LANGUAGE="Python" - - /NOAUTO_SUBSTITUTE - - /DESCRIPTION="" - - /DUPLICATION=CONTEXT_DEPENDENT - - /SEPARATOR="" - - /TYPE=MENU - - - "identifier"/PLACEHOLDER - "literal"/PLACEHOLDER - "enclosure"/PLACEHOLDER - -END DEFINE - -DELETE PLACEHOLDER FUNCDEF - - /LANGUAGE="Python" - -DEFINE PLACEHOLDER FUNCDEF - - /LANGUAGE="Python" - - /NOAUTO_SUBSTITUTE - - /DESCRIPTION="" - - /DUPLICATION=CONTEXT_DEPENDENT - - /SEPARATOR="" - - /TYPE=NONTERMINAL - - - "def {identifier}([defparameter]...):" - " [document_string]" - " {statement}..." - -END DEFINE - -DELETE PLACEHOLDER INTEGER - - /LANGUAGE="Python" - -DEFINE PLACEHOLDER INTEGER - - /LANGUAGE="Python" - - /NOAUTO_SUBSTITUTE - - /DESCRIPTION="" - - /DUPLICATION=CONTEXT_DEPENDENT - - /SEPARATOR="" - - /TYPE=TERMINAL - - - "Please enter a valid integer" - -END DEFINE - -DELETE PLACEHOLDER RAISE_STMT - - /LANGUAGE="Python" - -DEFINE PLACEHOLDER RAISE_STMT - - /LANGUAGE="Python" - - /NOAUTO_SUBSTITUTE - - /DESCRIPTION="" - - /DUPLICATION=CONTEXT_DEPENDENT - - /SEPARATOR="" - - /TYPE=NONTERMINAL - - - "raise [expression]..." - -END DEFINE - -DELETE PLACEHOLDER PASS_STMT - - /LANGUAGE="Python" - -DEFINE PLACEHOLDER PASS_STMT - - /LANGUAGE="Python" - - /NOAUTO_SUBSTITUTE - - /DESCRIPTION="" - - /DUPLICATION=CONTEXT_DEPENDENT - - /SEPARATOR="" - - /TYPE=NONTERMINAL - - - "pass" - -END DEFINE - -DELETE PLACEHOLDER ASSERT_STMT - - /LANGUAGE="Python" - -DEFINE PLACEHOLDER ASSERT_STMT - - /LANGUAGE="Python" - - /NOAUTO_SUBSTITUTE - - /DESCRIPTION="" - - /DUPLICATION=CONTEXT_DEPENDENT - - /SEPARATOR="" - - /TYPE=NONTERMINAL - - - "assert {expression}..." - -END DEFINE - -DELETE PLACEHOLDER DICT_DISPLAY - - /LANGUAGE="Python" - -DEFINE PLACEHOLDER DICT_DISPLAY - - /LANGUAGE="Python" - - /NOAUTO_SUBSTITUTE - - /DESCRIPTION="" - - /DUPLICATION=CONTEXT_DEPENDENT - - /SEPARATOR="" - - /TYPE=TERMINAL - - - "Please enter a valid dict_display" - -END DEFINE - -DELETE PLACEHOLDER TARGET - - /LANGUAGE="Python" - -DEFINE PLACEHOLDER TARGET - - /LANGUAGE="Python" - - /NOAUTO_SUBSTITUTE - - /DESCRIPTION="" - - /DUPLICATION=CONTEXT_DEPENDENT - - /SEPARATOR=", " - - /TYPE=MENU - - - "identifier"/PLACEHOLDER - "({target_list})" - "[{target_list}]" - "attributeref"/PLACEHOLDER - "subscription"/PLACEHOLDER - "slicing"/PLACEHOLDER - -END DEFINE - -DELETE PLACEHOLDER PARAMETER_LIST - - /LANGUAGE="Python" - -DEFINE PLACEHOLDER PARAMETER_LIST - - /LANGUAGE="Python" - - /NOAUTO_SUBSTITUTE - - /DESCRIPTION="" - - /DUPLICATION=CONTEXT_DEPENDENT - - /SEPARATOR="" - - /TYPE=NONTERMINAL - - - "({argument_list})" - -END DEFINE - -DELETE PLACEHOLDER GLOBAL_STMT - - /LANGUAGE="Python" - -DEFINE PLACEHOLDER GLOBAL_STMT - - /LANGUAGE="Python" - - /NOAUTO_SUBSTITUTE - - /DESCRIPTION="" - - /DUPLICATION=CONTEXT_DEPENDENT - - /SEPARATOR="" - - /TYPE=NONTERMINAL - - - "global {identifier}..." - -END DEFINE - -DELETE PLACEHOLDER ", {IDENTIFIER}" - - /LANGUAGE="Python" - -DEFINE PLACEHOLDER , {IDENTIFIER} - - /LANGUAGE="Python" - - /NOAUTO_SUBSTITUTE - - /DESCRIPTION="" - - /DUPLICATION=CONTEXT_DEPENDENT - - /SEPARATOR="" - - /TYPE=NONTERMINAL - - - ", {identifier}" - -END DEFINE - -DELETE PLACEHOLDER LIST_DISPLAY - - /LANGUAGE="Python" - -DEFINE PLACEHOLDER LIST_DISPLAY - - /LANGUAGE="Python" - - /NOAUTO_SUBSTITUTE - - /DESCRIPTION="" - - /DUPLICATION=CONTEXT_DEPENDENT - - /SEPARATOR="" - - /TYPE=NONTERMINAL - - - "[[expression]...]" - -END DEFINE - -DELETE PLACEHOLDER STRINGLITERAL - - /LANGUAGE="Python" - -DEFINE PLACEHOLDER STRINGLITERAL - - /LANGUAGE="Python" - - /NOAUTO_SUBSTITUTE - - /DESCRIPTION="" - - /DUPLICATION=CONTEXT_DEPENDENT - - /SEPARATOR="" - - /TYPE=TERMINAL - - - "Please enter a valid stringliteral" - -END DEFINE - -DELETE PLACEHOLDER DEL_STMT - - /LANGUAGE="Python" - -DEFINE PLACEHOLDER DEL_STMT - - /LANGUAGE="Python" - - /NOAUTO_SUBSTITUTE - - /DESCRIPTION="" - - /DUPLICATION=CONTEXT_DEPENDENT - - /SEPARATOR="" - - /TYPE=NONTERMINAL - - - "del {target}..." - -END DEFINE - -DELETE PLACEHOLDER WHILE_STMT - - /LANGUAGE="Python" - -DEFINE PLACEHOLDER WHILE_STMT - - /LANGUAGE="Python" - - /NOAUTO_SUBSTITUTE - - /DESCRIPTION="" - - /DUPLICATION=CONTEXT_DEPENDENT - - /SEPARATOR="" - - /TYPE=NONTERMINAL - - - "while {expression}:" - " {statement}..." - "[else_part]" - -END DEFINE - -DELETE PLACEHOLDER LAMBDA_FORM - - /LANGUAGE="Python" - -DEFINE PLACEHOLDER LAMBDA_FORM - - /LANGUAGE="Python" - - /NOAUTO_SUBSTITUTE - - /DESCRIPTION="" - - /DUPLICATION=CONTEXT_DEPENDENT - - /SEPARATOR="" - - /TYPE=TERMINAL - - - "Please enter a valid lambda_form" - -END DEFINE - -DELETE PLACEHOLDER INHERITANCE - - /LANGUAGE="Python" - -DEFINE PLACEHOLDER INHERITANCE - - /LANGUAGE="Python" - - /NOAUTO_SUBSTITUTE - - /DESCRIPTION="" - - /DUPLICATION=CONTEXT_DEPENDENT - - /SEPARATOR="" - - /TYPE=NONTERMINAL - - - "([expression]...)" - -END DEFINE - -DELETE PLACEHOLDER EXCEPTION_ARGUMENTS - - /LANGUAGE="Python" - -DEFINE PLACEHOLDER EXCEPTION_ARGUMENTS - - /LANGUAGE="Python" - - /NOAUTO_SUBSTITUTE - - /DESCRIPTION="" - - /DUPLICATION=CONTEXT_DEPENDENT - - /SEPARATOR="" - - /TYPE=NONTERMINAL - - - "[{expression}... [, {identifier}]]" - -END DEFINE - -DELETE PLACEHOLDER DOCUMENT_STRING - - /LANGUAGE="Python" - -DEFINE PLACEHOLDER DOCUMENT_STRING - - /LANGUAGE="Python" - - /NOAUTO_SUBSTITUTE - - /DESCRIPTION="" - - /DUPLICATION=CONTEXT_DEPENDENT - - /SEPARATOR="" - - /TYPE=NONTERMINAL - - - """"{text}..."""" - -END DEFINE - -DELETE PLACEHOLDER MODULE_AS_NAME - - /LANGUAGE="Python" - -DEFINE PLACEHOLDER MODULE_AS_NAME - - /LANGUAGE="Python" - - /NOAUTO_SUBSTITUTE - - /DESCRIPTION="" - - /DUPLICATION=HORIZONTAL - - /SEPARATOR=", " - - /TYPE=NONTERMINAL - - - "{module} [as {name}]" - -END DEFINE - -DELETE PLACEHOLDER SLICING - - /LANGUAGE="Python" - -DEFINE PLACEHOLDER SLICING - - /LANGUAGE="Python" - - /NOAUTO_SUBSTITUTE - - /DESCRIPTION="" - - /DUPLICATION=CONTEXT_DEPENDENT - - /SEPARATOR="" - - /TYPE=TERMINAL - - - "Please enter a valid slicing" - -END DEFINE - -DELETE PLACEHOLDER IDENTIFIER - - /LANGUAGE="Python" - -DEFINE PLACEHOLDER IDENTIFIER - - /LANGUAGE="Python" - - /NOAUTO_SUBSTITUTE - - /DESCRIPTION="" - - /DUPLICATION=CONTEXT_DEPENDENT - - /SEPARATOR=", " - - /TYPE=TERMINAL - - - ""Please enter a valid Python identifier."" - -END DEFINE - -DELETE PLACEHOLDER EXPRESSION - - /LANGUAGE="Python" - -DEFINE PLACEHOLDER EXPRESSION - - /LANGUAGE="Python" - - /NOAUTO_SUBSTITUTE - - /DESCRIPTION="" - - /DUPLICATION=CONTEXT_DEPENDENT - - /SEPARATOR=", " - - /TYPE=MENU - - - "or_test"/PLACEHOLDER - "lambda_form"/PLACEHOLDER - -END DEFINE - -DELETE PLACEHOLDER YIELD_STMT - - /LANGUAGE="Python" - -DEFINE PLACEHOLDER YIELD_STMT - - /LANGUAGE="Python" - - /NOAUTO_SUBSTITUTE - - /DESCRIPTION="" - - /DUPLICATION=CONTEXT_DEPENDENT - - /SEPARATOR="" - - /TYPE=NONTERMINAL - - - "yield [expression]..." - -END DEFINE - -DELETE PLACEHOLDER OR_TEST - - /LANGUAGE="Python" - -DEFINE PLACEHOLDER OR_TEST - - /LANGUAGE="Python" - - /NOAUTO_SUBSTITUTE - - /DESCRIPTION="" - - /DUPLICATION=CONTEXT_DEPENDENT - - /SEPARATOR="" - - /TYPE=TERMINAL - - - "Please enter a valid or_test" - -END DEFINE - -The following tokens are generated automatically: -DELETE TOKEN ELIF - - /LANGUAGE="Python" - -DEFINE TOKEN ELIF - - /LANGUAGE="Python" - - /PLACEHOLDER=ELIF_PART - - -END DEFINE - -DELETE TOKEN RETURN - - /LANGUAGE="Python" - -DEFINE TOKEN RETURN - - /LANGUAGE="Python" - - /PLACEHOLDER=RETURN_STMT - - -END DEFINE - -DELETE TOKEN EXEC - - /LANGUAGE="Python" - -DEFINE TOKEN EXEC - - /LANGUAGE="Python" - - /PLACEHOLDER=EXEC_STMT - - -END DEFINE - -DELETE TOKEN GLOBAL - - /LANGUAGE="Python" - -DEFINE TOKEN GLOBAL - - /LANGUAGE="Python" - - /PLACEHOLDER=GLOBAL_STMT - - -END DEFINE - -DELETE TOKEN ELSE - - /LANGUAGE="Python" - -DEFINE TOKEN ELSE - - /LANGUAGE="Python" - - /PLACEHOLDER=ELSE_PART - - -END DEFINE - -DELETE TOKEN BREAK - - /LANGUAGE="Python" - -DEFINE TOKEN BREAK - - /LANGUAGE="Python" - - /PLACEHOLDER=BREAK_STMT - - -END DEFINE - -DELETE TOKEN PASS - - /LANGUAGE="Python" - -DEFINE TOKEN PASS - - /LANGUAGE="Python" - - /PLACEHOLDER=PASS_STMT - - -END DEFINE - -DELETE TOKEN CLASS - - /LANGUAGE="Python" - -DEFINE TOKEN CLASS - - /LANGUAGE="Python" - - /PLACEHOLDER=CLASSDEF - - -END DEFINE - -DELETE TOKEN IF - - /LANGUAGE="Python" - -DEFINE TOKEN IF - - /LANGUAGE="Python" - - /PLACEHOLDER=IF_STMT - - -END DEFINE - -DELETE TOKEN ASSERT - - /LANGUAGE="Python" - -DEFINE TOKEN ASSERT - - /LANGUAGE="Python" - - /PLACEHOLDER=ASSERT_STMT - - -END DEFINE - -DELETE TOKEN # - - /LANGUAGE="Python" - -DEFINE TOKEN # - - /LANGUAGE="Python" - - /PLACEHOLDER=COMMENT_STMT - - -END DEFINE - -DELETE TOKEN RAISE - - /LANGUAGE="Python" - -DEFINE TOKEN RAISE - - /LANGUAGE="Python" - - /PLACEHOLDER=RAISE_STMT - - -END DEFINE - -DELETE TOKEN FOR - - /LANGUAGE="Python" - -DEFINE TOKEN FOR - - /LANGUAGE="Python" - - /PLACEHOLDER=FOR_STMT - - -END DEFINE - -DELETE TOKEN EXCEPT - - /LANGUAGE="Python" - -DEFINE TOKEN EXCEPT - - /LANGUAGE="Python" - - /PLACEHOLDER=EXCEPT_PART - - -END DEFINE - -DELETE TOKEN YIELD - - /LANGUAGE="Python" - -DEFINE TOKEN YIELD - - /LANGUAGE="Python" - - /PLACEHOLDER=YIELD_STMT - - -END DEFINE - -DELETE TOKEN TRY - - /LANGUAGE="Python" - -DEFINE TOKEN TRY - - /LANGUAGE="Python" - - /PLACEHOLDER=TRY_EXC_STMT - - -END DEFINE - -DELETE TOKEN WHILE - - /LANGUAGE="Python" - -DEFINE TOKEN WHILE - - /LANGUAGE="Python" - - /PLACEHOLDER=WHILE_STMT - - -END DEFINE - -DELETE TOKEN CONTINUE - - /LANGUAGE="Python" - -DEFINE TOKEN CONTINUE - - /LANGUAGE="Python" - - /PLACEHOLDER=CONTINUE_STMT - - -END DEFINE - -DELETE TOKEN DEL - - /LANGUAGE="Python" - -DEFINE TOKEN DEL - - /LANGUAGE="Python" - - /PLACEHOLDER=DEL_STMT - - -END DEFINE - -DELETE TOKEN PRINT - - /LANGUAGE="Python" - -DEFINE TOKEN PRINT - - /LANGUAGE="Python" - - /PLACEHOLDER=PRINT_STMT - - -END DEFINE - -DELETE TOKEN IMPORT - - /LANGUAGE="Python" - -DEFINE TOKEN IMPORT - - /LANGUAGE="Python" - - /PLACEHOLDER=IMPORT_STMT - - -END DEFINE - -DELETE TOKEN DEF - - /LANGUAGE="Python" - -DEFINE TOKEN DEF - - /LANGUAGE="Python" - - /PLACEHOLDER=FUNCDEF - - -END DEFINE diff --git a/app-emacs/else-mode/files/Template-cust.lse b/app-emacs/else-mode/files/Template-cust.lse deleted file mode 100644 index 6dca3e6..0000000 --- a/app-emacs/else-mode/files/Template-cust.lse +++ /dev/null @@ -1,398 +0,0 @@ -;; These are customization Templates for the TEMPLATE language
-;; for use with the Emacs Language Sensitive Editor (ELSE).
-;;
-;; Created 2003 Douglas Harter
-;;
-;; Author: Douglas Harter <dharter46@comcast.net> and
-;; Peter Milliken <peterm@unwired.com.au>
-;;
-;; $Revision: 1.4 $
-;;
-;;******************************************************************************
-;; These definitions are my personal customisations for the language. This is
-;; where you should place YOUR customisations.
-;;
-;; Sometimes there is a definition(s) in here that override definitions in the
-;; main language template file that are here to make that definition more
-;; "usable" - this is because I (primarily) try and generate/maintain the main
-;; .lse files from EBNF definitions of the language. Sometimes I just can't
-;; express the appropriate customisation in the EBNF and so I am forced to
-;; override the placeholder definition in this file.
-;;
-;; This entries in this file should be used as an example of how to create your
-;; own customisations. I would caution that you don't delete any definitions
-;; though until you are sure that your edit sessions will not be adversely
-;; affected. The best way to check out the effects of a delete is to "compile"
-;; (else-compile-buffer) the "delete" command for that definition (this will
-;; remove it from your edit session and you can nolonger access the definition
-;; until next you load language template files) and then see whether anything
-;; has been "lost" in your code generation ability i.e. say you think you don't
-;; need the definition for placeholder XXX, just place the following lines at
-;; the end of one of your source files (when ELSE is enabled for that buffer)
-;; and perform a compile (M-x else-compile-buffer) with the cursor positioned at
-;; the beginning of the line:
-;;
-;; DELETE PLACEHOLDER XXX -
-;; /LANGUAGE = "Template" -
-;;
-;; This will delete definition XXX from memory.
-;;
-;;******************************************************************************
-
-DELETE PLACEHOLDER LANGUAGE_DEFINITION -
- /LANGUAGE="Template" -
-DEFINE PLACEHOLDER LANGUAGE_DEFINITION -
- /LANGUAGE="Template" -
- /NOAUTO_SUBSTITUTE -
- /DESCRIPTION="" -
- /DUPLICATION=CONTEXT_DEPENDENT -
- /SEPARATOR="" -
- /TYPE=NONTERMINAL
-
- "DELETE LANGUAGE {language_name} -"
- "DEFINE LANGUAGE {language_name} -"
- " /INITIAL_STRING="{compilation_unit}" -"
- " /PUNCTUATION_CHARACTERS="{punctuation_characters}" -"
- " /SELF_INSERT_CHARACTERS="{self_insert_characters}" -"
- " /VALID_IDENTIFIER_CHARACTERS="{valid_identifier_characters}" -"
- " /INDENT_SIZE={indent_number} -"
- ""
- "END DEFINE"
- ""
-
-DELETE PLACEHOLDER indent_number -
- /LANGUAGE="Template" -
-DEFINE PLACEHOLDER indent_number -
- /LANGUAGE="Template" -
- /NOAUTO_SUBSTITUTE -
- /DESCRIPTION="" -
- /DUPLICATION=CONTEXT_DEPENDENT -
- /SEPARATOR="" -
- /TYPE=TERMINAL
-
- "Enter a numerical value for the indentation of each line of code."
-
-END DEFINE
-
-DELETE PLACEHOLDER substitute_number -
- /LANGUAGE="Template" -
-DEFINE PLACEHOLDER substitute_number -
- /LANGUAGE="Template" -
- /NOAUTO_SUBSTITUTE -
- /DESCRIPTION="" -
- /DUPLICATION=CONTEXT_DEPENDENT -
- /SEPARATOR="" -
- /TYPE=TERMINAL
-
- "Enter a numerical value for the *maximum* number of times this"
- "placeholder repeats."
-
-END DEFINE
-
-
-DELETE PLACEHOLDER TYPE_TYPE -
- /LANGUAGE="Template" -
-DEFINE PLACEHOLDER TYPE_TYPE -
- /LANGUAGE="Template" -
- /NOAUTO_SUBSTITUTE -
- /DESCRIPTION="" -
- /DUPLICATION=CONTEXT_DEPENDENT -
- /SEPARATOR="" -
- /TYPE=MENU
-
- "NONTERMINAL"
- "TERMINAL"
-
-END DEFINE
-
-DELETE PLACEHOLDER punctuation_characters -
- /LANGUAGE="Template" -
-DEFINE PLACEHOLDER punctuation_characters -
- /LANGUAGE="Template" -
- /NOAUTO_SUBSTITUTE -
- /DESCRIPTION="" -
- /DUPLICATION=CONTEXT_DEPENDENT -
- /SEPARATOR="" -
- /TYPE=MENU
-
- "default_punctuation"/PLACEHOLDER
- "user_punctuation"/PLACEHOLDER
-
-END DEFINE
-
-DELETE PLACEHOLDER default_punctuation -
- /LANGUAGE="Template" -
-DEFINE PLACEHOLDER default_punctuation -
- /LANGUAGE="Template" -
- /NOAUTO_SUBSTITUTE -
- /DESCRIPTION="" -
- /DUPLICATION=CONTEXT_DEPENDENT -
- /SEPARATOR="" -
- /TYPE=NONTERMINAL
-
- ",;()*.'-"
-
-END DEFINE
-
-DELETE PLACEHOLDER user_punctuation -
- /LANGUAGE="Template" -
-DEFINE PLACEHOLDER user_punctuation -
- /LANGUAGE="Template" -
- /NOAUTO_SUBSTITUTE -
- /DESCRIPTION="" -
- /DUPLICATION=CONTEXT_DEPENDENT -
- /SEPARATOR="" -
- /TYPE=TERMINAL
-
- "Enter the punctuation characters for the language being defined. "
- "The defaults are: ,;()*.'-"
-
-END DEFINE
-
-DELETE PLACEHOLDER self_insert_characters -
- /LANGUAGE="Template" -
-DEFINE PLACEHOLDER self_insert_characters -
- /LANGUAGE="Template" -
- /NOAUTO_SUBSTITUTE -
- /DESCRIPTION="" -
- /DUPLICATION=CONTEXT_DEPENDENT -
- /SEPARATOR="" -
- /TYPE=MENU
-
- "default_self_insert"/PLACEHOLDER
- "user_self_insert"/PLACEHOLDER
-
-END DEFINE
-
-DELETE PLACEHOLDER default_self_insert -
- /LANGUAGE="Template" -
-DEFINE PLACEHOLDER default_self_insert -
- /LANGUAGE="Template" -
- /NOAUTO_SUBSTITUTE -
- /DESCRIPTION="" -
- /DUPLICATION=CONTEXT_DEPENDENT -
- /SEPARATOR="" -
- /TYPE=NONTERMINAL
-
- " `~!@#$%^&*(),.<>/?;:'[]{}=\-+|""
-
-END DEFINE
-
-DELETE PLACEHOLDER user_self_insert -
- /LANGUAGE="Template" -
-DEFINE PLACEHOLDER user_self_insert -
- /LANGUAGE="Template" -
- /NOAUTO_SUBSTITUTE -
- /DESCRIPTION="" -
- /DUPLICATION=CONTEXT_DEPENDENT -
- /SEPARATOR="" -
- /TYPE=TERMINAL
-
- "Enter the characters that check to see if ELSE is within a placeholder"
- "for self insert."
- "The defaults are: `~!@#$%^&*(),.<>/?;:'[]{}=\-+|""
-
-END DEFINE
-
-DELETE PLACEHOLDER valid_identifier_characters -
- /LANGUAGE="Template" -
-DEFINE PLACEHOLDER valid_identifier_characters -
- /LANGUAGE="Template" -
- /NOAUTO_SUBSTITUTE -
- /DESCRIPTION="" -
- /DUPLICATION=CONTEXT_DEPENDENT -
- /SEPARATOR="" -
- /TYPE=MENU
-
- "default_valid_identifier"/PLACEHOLDER
- "user_valid_identifier"/PLACEHOLDER
-
-END DEFINE
-
-DELETE PLACEHOLDER default_valid_identifier -
- /LANGUAGE="Template" -
-DEFINE PLACEHOLDER default_valid_identifier -
- /LANGUAGE="Template" -
- /NOAUTO_SUBSTITUTE -
- /DESCRIPTION="" -
- /DUPLICATION=CONTEXT_DEPENDENT -
- /SEPARATOR="" -
- /TYPE=NONTERMINAL
-
- "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_0123456789"
-
-END DEFINE
-
-DELETE PLACEHOLDER user_valid_identifier -
- /LANGUAGE="Template" -
-DEFINE PLACEHOLDER user_valid_identifier -
- /LANGUAGE="Template" -
- /NOAUTO_SUBSTITUTE -
- /DESCRIPTION="" -
- /DUPLICATION=CONTEXT_DEPENDENT -
- /SEPARATOR="" -
- /TYPE=TERMINAL
-
- "Enter the characters that check to see if ELSE is within a placeholder"
- "for valid identifier."
- "The defaults are:"
- "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_0123456789"
-
-END DEFINE
-
-DELETE PLACEHOLDER PLACEHOLDER_DEFINITION -
- /LANGUAGE="Template" -
-DEFINE PLACEHOLDER PLACEHOLDER_DEFINITION -
- /LANGUAGE="Template" -
- /NOAUTO_SUBSTITUTE -
- /DESCRIPTION="" -
- /DUPLICATION=CONTEXT_DEPENDENT -
- /SEPARATOR="" -
- /TYPE=NONTERMINAL
-
- "DELETE PLACEHOLDER {place_name} -"
- " /LANGUAGE="{language_name}" -"
- "DEFINE PLACEHOLDER [place_name] -"
- " /LANGUAGE="{language_name}" -"
- "{placeholder_type}"
- ""
- "END DEFINE"
- ""
-
-END DEFINE
-
-DELETE PLACEHOLDER placeholder_type -
- /LANGUAGE="Template" -
-DEFINE PLACEHOLDER placeholder_type -
- /LANGUAGE="Template" -
- /NOAUTO_SUBSTITUTE -
- /DESCRIPTION="Type of placeholder" -
- /DUPLICATION=CONTEXT_DEPENDENT -
- /SEPARATOR="" -
- /TYPE=MENU
-
- "nonterminal|terminal_placeholder"/PLACEHOLDER
- "menu_placeholder"/PLACEHOLDER
- "cross_ref_placeholder"/PLACEHOLDER
-
-END DEFINE
-
-DELETE PLACEHOLDER CROSS_REF_PLACEHOLDER -
- /LANGUAGE="Template" -
-DEFINE PLACEHOLDER CROSS_REF_PLACEHOLDER -
- /LANGUAGE="Template" -
- /NOAUTO_SUBSTITUTE -
- /DESCRIPTION="/PLACEHOLDER={place_name}" -
- /DUPLICATION=CONTEXT_DEPENDENT -
- /SEPARATOR="" -
- /TYPE=NONTERMINAL
-
- "/PLACEHOLDER=[place_name]"
-
-END DEFINE
-
-DELETE PLACEHOLDER nonterminal|terminal_placeholder -
- /LANGUAGE="Template" -
-DEFINE PLACEHOLDER nonterminal|terminal_placeholder -
- /LANGUAGE="Template" -
- /NOAUTO_SUBSTITUTE -
- /DESCRIPTION="Templates for NONTERMINAL and TERMINAL types" -
- /DUPLICATION=CONTEXT_DEPENDENT -
- /SEPARATOR="" -
- /TYPE=NONTERMINAL
-
- " /{substitute}"
- " [substitute_count]"
- " /DESCRIPTION={descriptive_text} -"
- " /DUPLICATION={dup_type}"
- " /SEPARATOR={separator_text}"
- " /TYPE={type_type}"
- ""
- " {line_of_text}..."
-
-END DEFINE
-
-DELETE PLACEHOLDER menu_placeholder -
- /LANGUAGE="Template" -
-DEFINE PLACEHOLDER menu_placeholder -
- /LANGUAGE="Template" -
- /NOAUTO_SUBSTITUTE -
- /DESCRIPTION="Template for a MENU type -
- /DUPLICATION=CONTEXT_DEPENDENT -
- /SEPARATOR="" -
- /TYPE=NONTERMINAL
-
- " /{substitute}"
- " [substitute_count]"
- " /DESCRIPTION={descriptive_text} -"
- " /DUPLICATION={dup_type}"
- " /SEPARATOR={separator_text}"
- " /TYPE=MENU"
- ""
- "{menu placeholder body line}..."
-
-END DEFINE
-
-DELETE PLACEHOLDER "menu placeholder body line" -
- /LANGUAGE="Template" -
-DEFINE PLACEHOLDER "menu placeholder body line" -
- /LANGUAGE="Template" -
- /NOAUTO_SUBSTITUTE -
- /DESCRIPTION="" -
- /DUPLICATION=VERTICAL -
- /SEPARATOR="" -
- /TYPE=NONTERMINAL
-
- ""{menu body item}"[menu body qualifier]"
-
-END DEFINE
-
-DELETE PLACEHOLDER "menu body item" -
- /LANGUAGE="Template" -
-DEFINE PLACEHOLDER "menu body item" -
- /LANGUAGE="Template" -
- /NOAUTO_SUBSTITUTE -
- /DESCRIPTION="" -
- /DUPLICATION=CONTEXT_DEPENDENT -
- /SEPARATOR="" -
- /TYPE=TERMINAL
-
- "In a Menu Placeholder, you may have a string, a placeholder name, or"
- "a token. Placeholders and Tokens must be followed by the appropriate"
- "qualifier."
-
-END DEFINE
-
-DELETE PLACEHOLDER "menu body qualifier" -
- /LANGUAGE="Template" -
-DEFINE PLACEHOLDER "menu body qualifier" -
- /LANGUAGE="Template" -
- /NOAUTO_SUBSTITUTE -
- /DESCRIPTION="" -
- /DUPLICATION=CONTEXT_DEPENDENT -
- /SEPARATOR="" -
- /TYPE=MENU
-
- "/PLACEHOLDER"
- "/TOKEN"
-
-END DEFINE
-
-DELETE PLACEHOLDER PLACEHOLDER_REFERENCE -
- /LANGUAGE="Template" -
-DEFINE PLACEHOLDER PLACEHOLDER_REFERENCE -
- /LANGUAGE="Template" -
- /NOAUTO_SUBSTITUTE -
- /DESCRIPTION="Token that references a placeholder definition" -
- /DUPLICATION=CONTEXT_DEPENDENT -
- /SEPARATOR="" -
- /TYPE=NONTERMINAL
-
- "DELETE TOKEN {token_name} -"
- " /LANGUAGE="{language_name}" -"
- "DEFINE TOKEN [token_name] -"
- " /LANGUAGE="{language_name}" -"
- " /PLACEHOLDER={place_name}"
- ""
- "END DEFINE"
- ""
diff --git a/app-emacs/else-mode/files/Template.lse b/app-emacs/else-mode/files/Template.lse deleted file mode 100644 index 1176749..0000000 --- a/app-emacs/else-mode/files/Template.lse +++ /dev/null @@ -1,648 +0,0 @@ -;; Copyright (C) 1997,1998,1999,2000,2001,2002,2003 Peter Milliken -;; -;; Author: Peter Milliken <peterm@resmed.com.au>, -;; <peterm@unwired.com.au> -;; Douglas Harter <dharter46@comcast.net> -;; -;; -;; Keywords: language sensitive abbreviation template placeholder token -;; - -;; 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, Inc., 59 Temple Place - Suite 330, -;; Boston, MA 02111-1307, USA. - -DELETE LANGUAGE "Template" - -DEFINE LANGUAGE "Template" - - /INITIAL_STRING="{compilation_unit}" - - /PUNCTUATION_CHARACTERS=",;()*.'-" - - /SELF_INSERT_CHARACTERS=" `~!@#$%^&*(),.<>/?;:'[]{}=\-+|"" - - /VALID_IDENTIFIER_CHARACTERS="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_0123456789" - - /INDENT_SIZE="4" - - /VERSION="1.10" - - -END DEFINE - -DELETE PLACEHOLDER COMPILATION_UNIT - - /LANGUAGE="Template" - -DEFINE PLACEHOLDER COMPILATION_UNIT - - /LANGUAGE="Template" - - /NOAUTO_SUBSTITUTE - - /DESCRIPTION="" - /DUPLICATION=CONTEXT_DEPENDENT - - /SEPARATOR="" - - /TYPE=NONTERMINAL - - - "{language_definition}" - "{placeholder_definition}..." - "{token_definition}..." - -END DEFINE - -DELETE PLACEHOLDER CROSS_REF_PLACEHOLDER - - /LANGUAGE="Template" - -DEFINE PLACEHOLDER CROSS_REF_PLACEHOLDER - - /LANGUAGE="Template" - - /NOAUTO_SUBSTITUTE - - /DESCRIPTION="/PLACEHOLDER={place_name}" - /DUPLICATION=CONTEXT_DEPENDENT - - /SEPARATOR="" - - /TYPE=NONTERMINAL - - - " /PLACEHOLDER=[place_name]" - -END DEFINE - -DELETE PLACEHOLDER DESCRIPTIVE_TEXT - - /LANGUAGE="Template" - -DEFINE PLACEHOLDER DESCRIPTIVE_TEXT - - /LANGUAGE="Template" - - /NOAUTO_SUBSTITUTE - - /DESCRIPTION="" - /DUPLICATION=CONTEXT_DEPENDENT - - /SEPARATOR="" - - /TYPE=NONTERMINAL - - - """" - -END DEFINE - -DELETE PLACEHOLDER DUP_TYPE - - /LANGUAGE="Template" - -DEFINE PLACEHOLDER DUP_TYPE - - /LANGUAGE="Template" - - /NOAUTO_SUBSTITUTE - - /DESCRIPTION="" - /DUPLICATION=CONTEXT_DEPENDENT - - /SEPARATOR="" - - /TYPE=MENU - - - "CONTEXT_DEPENDENT -" - "VERTICAL -" - "HORIZONTAL -" - -END DEFINE - -DELETE PLACEHOLDER LANGUAGE_DEFINITION - - /LANGUAGE="Template" - -DEFINE PLACEHOLDER LANGUAGE_DEFINITION - - /LANGUAGE="Template" - - /NOAUTO_SUBSTITUTE - - /DESCRIPTION="" - /DUPLICATION=CONTEXT_DEPENDENT - - /SEPARATOR="" - - /TYPE=NONTERMINAL - - - "DELETE LANGUAGE {language_name} -" - "DEFINE LANGUAGE {language_name} -" - " /INITIAL_STRING="{compilation_unit}" -" - " /PUNCTUATION_CHARACTERS="{punctuation_characters}" -" - " /SELF_INSERT_CHARACTERS="{self_insert_characters}" -" - " /VALID_IDENTIFIER_CHARACTERS="{valid_identifier_characters}" -" - " /INDENT_SIZE={indent_number} -" - " /VERSION={version_number}" - "" - "END DEFINE" - "" - -END DEFINE - -DELETE PLACEHOLDER LANGUAGE_NAME - - /LANGUAGE="Template" - -DEFINE PLACEHOLDER LANGUAGE_NAME - - /LANGUAGE="Template" - - /AUTO_SUBSTITUTE - - /SUBSTITUTE_COUNT=1 - - /DESCRIPTION="" - /DUPLICATION=CONTEXT_DEPENDENT - - /SEPARATOR="" - - /TYPE=TERMINAL - - - "Change this definition to be the language name i.e. use else-extract-placeholder" - "make the change and then re-compiler the definition using else-compile-buffer" - -END DEFINE - -DELETE PLACEHOLDER LINE_OF_TEXT - - /LANGUAGE="Template" - -DEFINE PLACEHOLDER LINE_OF_TEXT - - /LANGUAGE="Template" - - /NOAUTO_SUBSTITUTE - - /DESCRIPTION="" - /DUPLICATION=VERTICAL - - /SEPARATOR="" - - /TYPE=NONTERMINAL - - - ""{text}"" - -END DEFINE - -DELETE PLACEHOLDER NUMBER - - /LANGUAGE="Template" - -DEFINE PLACEHOLDER NUMBER - - /LANGUAGE="Template" - - /NOAUTO_SUBSTITUTE - - /DESCRIPTION="" - /DUPLICATION=CONTEXT_DEPENDENT - - /SEPARATOR="" - - /TYPE=TERMINAL - - - "Enter a numerical value for the *maximum* number of times this placeholder repeats" - -END DEFINE - -DELETE PLACEHOLDER PLACEHOLDER_DEFINITION - - /LANGUAGE="Template" - -DEFINE PLACEHOLDER PLACEHOLDER_DEFINITION - - /LANGUAGE="Template" - - /NOAUTO_SUBSTITUTE - - /DESCRIPTION="" - /DUPLICATION=CONTEXT_DEPENDENT - - /SEPARATOR="" - - /TYPE=NONTERMINAL - - - "DELETE PLACEHOLDER {place_name} -" - " /LANGUAGE="{language_name}" -" - "DEFINE PLACEHOLDER [place_name] -" - " /LANGUAGE="{language_name}" -" - "{placeholder_type}" - "" - "END DEFINE" - "" - -END DEFINE - -DELETE PLACEHOLDER PLACEHOLDER_REFERENCE - - /LANGUAGE="Template" - -DEFINE PLACEHOLDER PLACEHOLDER_REFERENCE - - /LANGUAGE="Template" - - /NOAUTO_SUBSTITUTE - - /DESCRIPTION="Token that references a placeholder definition" - /DUPLICATION=CONTEXT_DEPENDENT - - /SEPARATOR="" - - /TYPE=NONTERMINAL - - - "DELETE TOKEN {token_name} -" - " /LANGUAGE="{language_name}" -" - "DEFINE TOKEN [token_name] -" - " /LANGUAGE="{language_name}" -" - " /PLACEHOLDER={place_name}" - "" - "END DEFINE" - "" - -END DEFINE - -DELETE PLACEHOLDER PLACE_NAME - - /LANGUAGE="Template" - -DEFINE PLACEHOLDER PLACE_NAME - - /LANGUAGE="Template" - - /AUTO_SUBSTITUTE - - /SUBSTITUTE_COUNT=1 - - /DESCRIPTION="" - /DUPLICATION=CONTEXT_DEPENDENT - - /SEPARATOR="" - - /TYPE=TERMINAL - - - "Just type the name." - -END DEFINE - -DELETE PLACEHOLDER SEPARATOR_TEXT - - /LANGUAGE="Template" - -DEFINE PLACEHOLDER SEPARATOR_TEXT - - /LANGUAGE="Template" - - /AUTO_SUBSTITUTE - - /SUBSTITUTE_COUNT=1 - - /DESCRIPTION="" - /DUPLICATION=CONTEXT_DEPENDENT - - /SEPARATOR="" - - /TYPE=NONTERMINAL - - - """ -" - -END DEFINE - -DELETE PLACEHOLDER STANDALONE_TOKEN_DEF - - /LANGUAGE="Template" - -DEFINE PLACEHOLDER STANDALONE_TOKEN_DEF - - /LANGUAGE="Template" - - /NOAUTO_SUBSTITUTE - - /DESCRIPTION="Token that contains the definition in the body" - /DUPLICATION=CONTEXT_DEPENDENT - - /SEPARATOR="" - - /TYPE=NONTERMINAL - - - "DELETE TOKEN {token_name} -" - " /LANGUAGE="{language_name}" -" - "DEFINE TOKEN [token_name] -" - " /LANGUAGE="{language_name}" -" - " /DESCRIPTION={descriptive_text} -" - "" - " {line_of_text}..." - "" - "END DEFINE" - -END DEFINE - -DELETE PLACEHOLDER SUBSTITUTE - - /LANGUAGE="Template" - -DEFINE PLACEHOLDER SUBSTITUTE - - /LANGUAGE="Template" - - /NOAUTO_SUBSTITUTE - - /DESCRIPTION="substitute menu" - /DUPLICATION=CONTEXT_DEPENDENT - - /SEPARATOR="" - - /TYPE=MENU - - - "NOAUTO_SUBSTITUTE -" - "AUTO_SUBSTITUTE -" - -END DEFINE - -DELETE PLACEHOLDER SUBSTITUTE_COUNT - - /LANGUAGE="Template" - -DEFINE PLACEHOLDER SUBSTITUTE_COUNT - - /LANGUAGE="Template" - - /NOAUTO_SUBSTITUTE - - /DESCRIPTION="" - /DUPLICATION=CONTEXT_DEPENDENT - - /SEPARATOR="" - - /TYPE=NONTERMINAL - - - "/SUBSTITUTE_COUNT={number}" - -END DEFINE - -DELETE PLACEHOLDER TEXT - - /LANGUAGE="Template" - -DEFINE PLACEHOLDER TEXT - - /LANGUAGE="Template" - - /NOAUTO_SUBSTITUTE - - /DESCRIPTION="" - /DUPLICATION=CONTEXT_DEPENDENT - - /SEPARATOR="" - - /TYPE=TERMINAL - - - "Type something, anything will do" - -END DEFINE - -DELETE PLACEHOLDER TOKEN_DEFINITION - - /LANGUAGE="Template" - -DEFINE PLACEHOLDER TOKEN_DEFINITION - - /LANGUAGE="Template" - - /NOAUTO_SUBSTITUTE - - /DESCRIPTION="" - /DUPLICATION=CONTEXT_DEPENDENT - - /SEPARATOR="" - - /TYPE=MENU - - - "placeholder_reference"/PLACEHOLDER - "standalone_token_def"/PLACEHOLDER - -END DEFINE - -DELETE PLACEHOLDER TOKEN_NAME - - /LANGUAGE="Template" - -DEFINE PLACEHOLDER TOKEN_NAME - - /LANGUAGE="Template" - - /AUTO_SUBSTITUTE - - /SUBSTITUTE_COUNT=1 - - /DESCRIPTION="" - /DUPLICATION=CONTEXT_DEPENDENT - - /SEPARATOR="" - - /TYPE=TERMINAL - - - "Enter the name of the token, note that quotes must be used when" - "the name contains embedded spaces." - -END DEFINE - -DELETE PLACEHOLDER TYPE_TYPE - - /LANGUAGE="Template" - -DEFINE PLACEHOLDER TYPE_TYPE - - /LANGUAGE="Template" - - /NOAUTO_SUBSTITUTE - - /DESCRIPTION="" - /DUPLICATION=CONTEXT_DEPENDENT - - /SEPARATOR="" - - /TYPE=MENU - - - "NONTERMINAL" - "TERMINAL" - -END DEFINE - -DELETE PLACEHOLDER default_punctuation - - /LANGUAGE="Template" - -DEFINE PLACEHOLDER default_punctuation - - /LANGUAGE="Template" - - /NOAUTO_SUBSTITUTE - - /DESCRIPTION="" - /DUPLICATION=CONTEXT_DEPENDENT - - /SEPARATOR="" - - /TYPE=NONTERMINAL - - - ",;()*.'-" - -END DEFINE - -DELETE PLACEHOLDER default_self_insert - - /LANGUAGE="Template" - -DEFINE PLACEHOLDER default_self_insert - - /LANGUAGE="Template" - - /NOAUTO_SUBSTITUTE - - /DESCRIPTION="" - /DUPLICATION=CONTEXT_DEPENDENT - - /SEPARATOR="" - - /TYPE=NONTERMINAL - - - " `~!@#$%^&*(),.<>/?;:'[]{}=\-+|"" - -END DEFINE - -DELETE PLACEHOLDER default_valid_identifier - - /LANGUAGE="Template" - -DEFINE PLACEHOLDER default_valid_identifier - - /LANGUAGE="Template" - - /NOAUTO_SUBSTITUTE - - /DESCRIPTION="" - /DUPLICATION=CONTEXT_DEPENDENT - - /SEPARATOR="" - - /TYPE=NONTERMINAL - - - "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_0123456789" - -END DEFINE - -DELETE PLACEHOLDER indent_number - - /LANGUAGE="Template" - -DEFINE PLACEHOLDER indent_number - - /LANGUAGE="Template" - - /NOAUTO_SUBSTITUTE - - /DESCRIPTION="" - /DUPLICATION=CONTEXT_DEPENDENT - - /SEPARATOR="" - - /TYPE=TERMINAL - - - "Enter a numerical value for the indentation of each line of code." - -END DEFINE - -DELETE PLACEHOLDER VERSION_NUMBER - - /LANGUAGE="Template" - -DEFINE PLACEHOLDER VERSION_NUMBER - - /LANGUAGE="Template" - - /NOAUTO_SUBSTITUTE - - /DESCRIPTION="" - - /DUPLICATION=CONTEXT_DEPENDENT - - /SEPARATOR="" - - /TYPE=TERMINAL - - "Enter a version number i.e. 1.8" - -END DEFINE - - -DELETE PLACEHOLDER "menu body item" - - /LANGUAGE="Template" - -DEFINE PLACEHOLDER "menu body item" - - /LANGUAGE="Template" - - /NOAUTO_SUBSTITUTE - - /DESCRIPTION="" - /DUPLICATION=CONTEXT_DEPENDENT - - /SEPARATOR="" - - /TYPE=TERMINAL - - - "In a Menu Placeholder, you may have a string, a placeholder name, or" - "a token. Placeholders and Tokens must be followed by the appropriate" - "qualifier." - -END DEFINE - -DELETE PLACEHOLDER "menu body qualifier" - - /LANGUAGE="Template" - -DEFINE PLACEHOLDER "menu body qualifier" - - /LANGUAGE="Template" - - /NOAUTO_SUBSTITUTE - - /DESCRIPTION="" - /DUPLICATION=CONTEXT_DEPENDENT - - /SEPARATOR="" - - /TYPE=MENU - - - "/PLACEHOLDER" - "/TOKEN" - "/FOLLOW" - "/NOFOLLOW" - -END DEFINE - -DELETE PLACEHOLDER "menu placeholder body line" - - /LANGUAGE="Template" - -DEFINE PLACEHOLDER "menu placeholder body line" - - /LANGUAGE="Template" - - /NOAUTO_SUBSTITUTE - - /DESCRIPTION="" - /DUPLICATION=VERTICAL - - /SEPARATOR="" - - /TYPE=NONTERMINAL - - - ""{menu body item}"[menu body qualifier]" - -END DEFINE - -DELETE PLACEHOLDER menu_placeholder - - /LANGUAGE="Template" - -DEFINE PLACEHOLDER menu_placeholder - - /LANGUAGE="Template" - - /NOAUTO_SUBSTITUTE - - /DESCRIPTION="" - /DUPLICATION=CONTEXT_DEPENDENT - - /SEPARATOR="" - - /TYPE=NONTERMINAL - - - " /{substitute}" - " [substitute_count]" - " /DESCRIPTION={descriptive_text} -" - " /DUPLICATION={dup_type}" - " /SEPARATOR={separator_text}" - " /TYPE=MENU" - "" - " {menu placeholder body line}..." - -END DEFINE - -DELETE PLACEHOLDER nonterminal|terminal_placeholder - - /LANGUAGE="Template" - -DEFINE PLACEHOLDER nonterminal|terminal_placeholder - - /LANGUAGE="Template" - - /NOAUTO_SUBSTITUTE - - /DESCRIPTION="Templates for NONTERMINAL and TERMINAL types" - /DUPLICATION=CONTEXT_DEPENDENT - - /SEPARATOR="" - - /TYPE=NONTERMINAL - - - " /{substitute}" - " [substitute_count]" - " /DESCRIPTION={descriptive_text} -" - " /DUPLICATION={dup_type}" - " /SEPARATOR={separator_text}" - " /TYPE={type_type}" - "" - " {line_of_text}..." - -END DEFINE - -DELETE PLACEHOLDER placeholder_type - - /LANGUAGE="Template" - -DEFINE PLACEHOLDER placeholder_type - - /LANGUAGE="Template" - - /NOAUTO_SUBSTITUTE - - /DESCRIPTION="Type of placeholder" - /DUPLICATION=CONTEXT_DEPENDENT - - /SEPARATOR="" - - /TYPE=MENU - - - "nonterminal|terminal_placeholder"/PLACEHOLDER - "menu_placeholder"/PLACEHOLDER - "cross_ref_placeholder"/PLACEHOLDER - -END DEFINE - -DELETE PLACEHOLDER punctuation_characters - - /LANGUAGE="Template" - -DEFINE PLACEHOLDER punctuation_characters - - /LANGUAGE="Template" - - /NOAUTO_SUBSTITUTE - - /DESCRIPTION="" - /DUPLICATION=CONTEXT_DEPENDENT - - /SEPARATOR="" - - /TYPE=MENU - - - "default_punctuation"/PLACEHOLDER - "user_punctuation"/PLACEHOLDER - -END DEFINE - -DELETE PLACEHOLDER self_insert_characters - - /LANGUAGE="Template" - -DEFINE PLACEHOLDER self_insert_characters - - /LANGUAGE="Template" - - /NOAUTO_SUBSTITUTE - - /DESCRIPTION="" - /DUPLICATION=CONTEXT_DEPENDENT - - /SEPARATOR="" - - /TYPE=MENU - - - "default_self_insert"/PLACEHOLDER - "user_self_insert"/PLACEHOLDER - -END DEFINE - -DELETE PLACEHOLDER substitute_number - - /LANGUAGE="Template" - -DEFINE PLACEHOLDER substitute_number - - /LANGUAGE="Template" - - /NOAUTO_SUBSTITUTE - - /DESCRIPTION="" - /DUPLICATION=CONTEXT_DEPENDENT - - /SEPARATOR="" - - /TYPE=TERMINAL - - - "Enter a numerical value for the *maximum* number of times this" - "placeholder repeats." - -END DEFINE - -DELETE PLACEHOLDER user_punctuation - - /LANGUAGE="Template" - -DEFINE PLACEHOLDER user_punctuation - - /LANGUAGE="Template" - - /NOAUTO_SUBSTITUTE - - /DESCRIPTION="" - /DUPLICATION=CONTEXT_DEPENDENT - - /SEPARATOR="" - - /TYPE=TERMINAL - - - "Enter the punctuation characters for the language being defined. " - "The defaults are: ,;()*.'-" - -END DEFINE - -DELETE PLACEHOLDER user_self_insert - - /LANGUAGE="Template" - -DEFINE PLACEHOLDER user_self_insert - - /LANGUAGE="Template" - - /NOAUTO_SUBSTITUTE - - /DESCRIPTION="" - /DUPLICATION=CONTEXT_DEPENDENT - - /SEPARATOR="" - - /TYPE=TERMINAL - - - "Enter the characters that check to see if ELSE is within a placeholder" - "for self insert." - "The defaults are: `~!@#$%^&*(),.<>/?;:'[]{}=\-+|"" - -END DEFINE - -DELETE PLACEHOLDER user_valid_identifier - - /LANGUAGE="Template" - -DEFINE PLACEHOLDER user_valid_identifier - - /LANGUAGE="Template" - - /NOAUTO_SUBSTITUTE - - /DESCRIPTION="" - /DUPLICATION=CONTEXT_DEPENDENT - - /SEPARATOR="" - - /TYPE=TERMINAL - - - "Enter the characters that check to see if ELSE is within a placeholder" - "for valid identifier." - "The defaults are:" - "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_0123456789" - -END DEFINE - -DELETE PLACEHOLDER valid_identifier_characters - - /LANGUAGE="Template" - -DEFINE PLACEHOLDER valid_identifier_characters - - /LANGUAGE="Template" - - /NOAUTO_SUBSTITUTE - - /DESCRIPTION="" - /DUPLICATION=CONTEXT_DEPENDENT - - /SEPARATOR="" - - /TYPE=MENU - - - "default_valid_identifier"/PLACEHOLDER - "user_valid_identifier"/PLACEHOLDER - -END DEFINE - -DELETE TOKEN PLACE - - /LANGUAGE="Template" - -DEFINE TOKEN PLACE - - /LANGUAGE="Template" - - /PLACEHOLDER=PLACEHOLDER_DEFINITION - -END DEFINE - -DELETE TOKEN TOKEN - - /LANGUAGE="Template" - -DEFINE TOKEN TOKEN - - /LANGUAGE="Template" - - /PLACEHOLDER=TOKEN_DEFINITION - -END DEFINE - - diff --git a/app-emacs/else-mode/files/else-mode.el b/app-emacs/else-mode/files/else-mode.el deleted file mode 100644 index 033c3d5..0000000 --- a/app-emacs/else-mode/files/else-mode.el +++ /dev/null @@ -1,4716 +0,0 @@ -;;; else-mode.el --- Emacs Language Sensitive Editor (ELSE) -;; -;; Copyright (C) 1997,1998,1999,2000,2001,2002,2003, 2004 Peter Milliken -;; -;; Author: Peter Milliken <peterm@resmed.com.au> -;; <peterm@unwired.com.au> -;; Version: 1.20 -;; Keywords: language sensitive abbreviation template placeholder token -;; -;; 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, Inc., 59 Temple Place - Suite 330, -;; Boston, MA 02111-1307, USA. - -;;; Commentary: - -;; This facility is documented in the accompanying distribution file(s). - -;;; Change Log: - -;;; Code: - -;; This package provides line-numbering to the menu buffer (if enabled - see -;; else-enable-lineno custom variable). Encase the conditional load within an -;; error handling struct so that ELSE doesn't blow up on loading. -(condition-case nil - (require 'setnu) - (error nil)) - -;; The following constants are associated keys into the data structure which -;; records the definition of a placeholder/token/language definition. Use the -;; property list of a symbol to store the individual attributes of a -;; definition. The following constants are the "keys" into the property list -;; (see else-read-a-definition) for the setting of the property list -;; information). -;; -(defconst else-placeholder-ref 0) -(defconst else-type-ref 1) -(defconst else-separator-ref 2) -(defconst else-substitute-ref 3) -(defconst else-duplication-ref 4) -(defconst else-topic-ref 5) ;; Not used -(defconst else-description-ref 6) -(defconst else-body-ref 7) -(defconst else-substitute-count-ref 8) -(defconst else-Language-Name 9) -(defconst else-Punctuation-ref 10) -(defconst else-Punctuation-Length-ref 11) -(defconst else-Initial-String-ref 12) -(defconst else-Self-Insert-Characters-ref 13) -(defconst else-Self-Insert-Characters-Length-ref 14) -(defconst else-Valid-Idents-ref 15) -(defconst else-Valid-Idents-Length-ref 16) -(defconst else-tab-size-ref 17) -(defconst else-original-name 18) -(defconst else-language-version-ref 19) -(defconst else-elisp-action 20) - - -(defconst else-before-key "/BEFORE" - "association list key into the run-time action sequences.") - -(defconst else-after-key "/AFTER" - "association list key into the run-time action sequences.") - -(defconst else-oninsert-key "/ONINSERT" - "association list key into the run-time action sequences.") - -(defconst else-Extract-Column 4) - -(defconst else-Placeholder-Vector-Size 1023) -(defconst else-Token-Vector-Size 512) - -;; XEmacs behaves differently in the before/after change functions than FSF -;; Emacs. The following three variables are used in the XEmacs code. All XEmacs -;; code is differentiated using a 'cond' statement and the -;; 'else-in-xemacs variable setting. -(defvar else-move-change nil) -(defvar else-move-to-position nil) -(defvar else-in-xemacs (integerp (string-match "XEmacs\\|Lucid" (emacs-version)))) - -;; Do some compatability between XEmacs and FSF Emacs - hopefully can -;; remove this one day when XEmacs matches FSF? If not, then it -;; doesn't matter as the issue will work either way. -(unless (boundp 'undo-in-progress) - (defvar undo-in-progress nil - "Indicate that an indo is in progress to before/after change fns.") - (defadvice undo-more (around else-undo-more activate compile) - (let ((undo-in-progress t)) ad-do-it))) - -;; The following constants define the offsets for the nth and nthcdr -;; functions into the data element which records each line of the 'body' of a -;; placeholder/token definition. The meanings are: -;; -;; else-body-type-ref - if menu line then /placeholder or /token (?p -;; ?t or nil) -;; else-body-indent-ref - indentation 'level' -;; else-body-text-ref - actual text of line -;; else-body-menu-follow-on-ref - if an item is a menu then the user can -;; selectively disable/enable follow-on in the -;; menu display. See also else-follow-menus. -(defconst else-body-type-ref 0) -(defconst else-body-indent-ref 1) -(defconst else-body-text-ref 2) -(defconst else-body-menu-follow-on-ref 3) - -;; The following constants are the regular expressions and the corresponding -;; `match-data' offsets that are used in else. These are general expressions -;; that are constructed as follows: -;; `defining' construct: -;; Each `defining' construct is one of (where []'s represent alternatives and -;; (digit) represent the match-data offset): -;; -;; [LANGUAGE ] -;; DELETE]____[TOKEN ]_____["some text enclosed by quotes" -;; DEFINE] [PLACEHOLDER] [text not enclosed by quotes (no spaces). -;; (1) (2) (3) -;; -;; Examples are: -;; -;; (a) DEFINE PLACEHOLDER "THIS IS A TEMPLATE" -;; or -;; (b) DELETE LANGUAGE ADA -;; -;; For example (a), the match-data would be (1) "DEFINE" -;; (2) "PLACEHOLDER" -;; (3) "\"THIS IS A TEMPLATE\"" -;; -;; (b), the match-data would be (1) "DELETE" -;; (2) "LANGUAGE" -;; (3) "ADA" -;; -;; `body' construct: -;; Each `body' construct is one of (where []'s represent alternatives and -;; (digit) represent the match-data offset): -;; -;; ]/text=]_____________________________["some text in quotes" -;; ] ] [text not enclosed by quotes -;; ] ]_____________________________["some text in quotes" ]____________/text -;; ] ] [text not enclosed by quotes] -;; ] -;; ]"some text enclosed by quotes"______[/text -;; ] [or nothing. -;; ]/text- -;; ] -;; END DEFINE -;; (1), (3), (5) or (6) (2) or (4) -;; -;; -;; Examples are: -;; -;; (a) /LANGUAGE=ADA - -;; -;; (b) /NOAUTOSUBSTITUTE - -;; -;; (c) /SEPARATOR=", " - -;; -;; (d) "null"/PLACEHOLDER -;; -;; (e) "enter a valid number" -;; -;; (f) END DEFINE -;; -;; For example (a), the match-data would be (1) "/LANGUAGE=" -;; (2) "ADA" -;; (3) nil -;; (4) nil -;; (5) nil -;; (6) nil -;; -;; For example (b), the match-data would be (1) nil -;; (2) nil -;; (3) nil -;; (4) nil -;; (5) "/NOAUTOSUBSTITUTE" -;; (6) nil -;; -;; For example (c), the match-data would be (1) "/SEPARATOR=" -;; (2) ", " -;; (3) nil -;; (4) nil -;; (5) nil -;; (6) nil -;; -;; For example (d), the match-data would be (1) nil -;; (2) nil -;; (3) "null" -;; (4) "/PLACEHOLDER" -;; (5) nil -;; (6) nil -;; -;; For example (e), the match-data would be (1) nil -;; (2) nil -;; (3) "enter a valid number" -;; (4) nil -;; (5) nil -;; (6) nil -;; -;; For example (f), the match-data would be (1) nil -;; (2) nil -;; (3) nil -;; (4) nil -;; (5) nil -;; (6) END DEFINE -;; - -(defconst else-defining-string - "\\(DELETE\\|DEFINE\\) +\\(TOKEN\\|PLACEHOLDER\\|LANGUAGE\\) +\\(\".*\"\\|[ -~]+\\) +-") -(defconst else-defining-command 1) -(defconst else-defining-type 2) -(defconst else-defining-name 3) - -(defconst else-body-string - "\\(/[A-Z_]+ *= *\\)\\(\".*\"\\|[-a-zA-Z_0-9\\.]+\\)\\([/A-Z_]+\\)*\\|\\(/[A-Z_]+ *-\\)\\|\\(\".*\"\\)\\(/[A-Z_]+\\)?\\(/NOFOLLOW\\|/FOLLOW\\)?\\|\\(END *DEFINE\\)") - -(defconst else-body-command-1 1) -(defconst else-body-command-2 2) -(defconst else-body-command-3 3) -(defconst else-body-command-4 4) -(defconst else-body-text-1 5) -(defconst else-body-text-2 6) -(defconst else-body-text-3 7) -(defconst else-body-end 8) - -(defconst else-template-comment "^;;.*" - "Comment lines must start at the line beginning with ;;") - -(defvar else-deleted-string nil) ; The last placeholder text that is - ; currently being processed. -(defvar else-definition-name nil) ; string of the definition being - ; processed i.e. identifier. -(defvar else-fallback-text nil) ; The full original deleted text. -(defvar else-deleted-column 0) ; Column from which the deleted string -(defvar else-please-duplicate nil) ; t when the placeholder was followed - ; by ellipses. - -;; This is a flag which is used by the before and after change functions. It -;; transfers information about whether the "auto-substitute" mode has just gone -;; active to the after change function. This is because the after change -;; function receives a confusing begin/end pair (because the before change -;; function has deleted the placeholder) so it can't work out what has -;; happened. This flag being set t means that it interprets the change as a -;; single character insert. -(defvar else-sub-active-toggle nil) - -(defvar else-Mandatory-Placeholder nil) ; Flag used to indicate if current - ; placeholder is mandatory {} or - ; optional []. - -(defvar else-placeholder-start 0 - "Start position of the placeholder/token being processed") - -(defvar else-placeholder-end 0 - "End position of the placeholder/token being processed") - -(defvar else-definition-type nil - "Definition type of the element bounded by else-placeholder-start/end") - -(defvar else-Auto-Sub-Active nil - "Used to determine if an auto-substitute string is Active") - -(defvar else-Auto-Sub-Marker-List nil - "A list of paired Auto Sub Markers, this list grows or shrinks as required.") - -(defvar else-Language-Definitions '(("Empty" . nil)) - "alist containing all the language definitions.") - -(defvar else-Current-Language nil - "Holds the Language Identification string for the current buffer ie \"Ada\"") - -(defvar else-menu-mode-map - (let ((map (make-keymap))) - (suppress-keymap map t) - (define-key map "q" 'else-menu-quit) - (define-key map "s" 'else-menu-select) - (define-key map "Q" 'else-menu-quit) - (define-key map "S" 'else-menu-select) - (define-key map " " 'else-menu-next-line) - (define-key map "n" 'else-menu-next-line) - (define-key map "p" 'else-menu-previous-line) - (define-key map "N" 'else-menu-next-line) - (define-key map "P" 'else-menu-previous-line) - (define-key map "?" 'else-summary) - (define-key map "\r" 'else-menu-select) - map ) - "Local keymap for else-mode.") - -(defvar else-mode-key-map - (let ((mode-map (make-sparse-keymap)) - (prefix-map (make-sparse-keymap)) - (command-map (make-sparse-keymap))) - (define-key mode-map "\C-c" prefix-map) - (define-key prefix-map "/" command-map) - (define-key command-map "e" 'else-expand-placeholder) - (define-key command-map "k" 'else-kill-placeholder) - (define-key command-map "n" 'else-next-placeholder) - (define-key command-map "p" 'else-previous-placeholder) - (define-key command-map "i" 'else-insert-placeholder) - (define-key command-map "c" 'else-comment-placeholders) - (define-key command-map "u" 'else-uncomment-placeholders) - mode-map)) - -(defvar else-selected-text nil - "string selected by the user when multiple choices in the LSE word function are -available" ) - -(defvar else-type-of-item-being-expanded ?p - "'type' of item being expanded ie either a placeholder or a token") - -(defvar else-mode nil - "The minor mode flag") - -(defvar else-current-definition nil - "Current definition as found by else-in-placeholder") - -;; The following variables need to be local to each buffer in which they are -;; used. -(make-variable-buffer-local 'else-Auto-Sub-Active) -(make-variable-buffer-local 'else-Auto-Sub-Marker-List) -(make-variable-buffer-local 'else-Current-Language) -(make-variable-buffer-local 'else-mode) -(make-variable-buffer-local 'else-move-change) -(make-variable-buffer-local 'else-move-to-position) -(make-variable-buffer-local 'else-current-definition) -(make-variable-buffer-local 'else-please-duplicate) -(make-variable-buffer-local 'else-deleted-column) -(make-variable-buffer-local 'else-deleted-string) -(make-variable-buffer-local 'else-definition-type) -(make-variable-buffer-local 'else-definition-name) -(make-variable-buffer-local 'else-Mandatory-Placeholder) - -(setq-default else-mode nil) - -(defvar Placeholder () - "Array holding the `placeholder' tokens for the current language") -(defvar Token () - "Array holding the `token' tokens for the current language" ) -(defvar Language-Specifics () - "Structure that holds the language definition information for the current -language") - -(defvar Language-Self-Insert-Characters-Vector - "Vector to look-up whether a character is 'self-insert'. -Contains True or False (t or nil) and is indexed by character code") - -(defvar Language-Valid-Identifier-Characters-Vector - "Vector to look-up whether a character is a 'valid identifier'. -Contains True or False (t or nil) and is indexed by character code") - -(defvar Language-Punctuation-Characters-Vector - "Vector to look-up whether a character is a 'punctuation' character. -Contains True or False (t or nil) and is indexed by character code") - - -(defconst else-character-vector-length 256 - "Language character vectors length") - - -;;; Now make these variables buffer local. At the moment, these are just -;;; buffer local copies that refer to the full language templates, ideally, we -;;; would want to offer the facility of being able to customise the templates -;;; of a language for each buffer ie in one program you might be doing a lot -;;; of case statements and in another buffer there may be more 'if' statements -;;; so the user may decide it would be nice to have two versions of the -;;; STATEMENT placeholder. This is currently not available but could easily be -;;; added. At the moment, change one and all buffers are affected. -(make-variable-buffer-local 'Placeholder) -(make-variable-buffer-local 'Token) -(make-variable-buffer-local 'Language-Specifics) -(make-variable-buffer-local 'Language-Self-Insert-Characters-Vector) -(make-variable-buffer-local 'Language-Valid-Identifier-Characters-Vector) -(make-variable-buffer-local 'Language-Punctuation-Characters-Vector) - -;; The following variables are used purely for the fast save/load process -;; (else-compile-fast-load and else-restore). - -;; This variable is used to communicate the "type" of symbols being processed -;; during an ELSE compile for fast loading operation ie else-compile-fast-load -;; and else-store-element use this variable to communicate what the element -;; type that is being "stored". This is only necessary because the mapatoms -;; process doesn't allow more that the one argument to the called routine. -(defvar else-type-of-symbols ?p) - -;; This is the marker that tracks the "read" process used by -;; else-compile-fast-load and else-restore. We use a marker into the restore -;; file because the 'read' function automatically increments the marker as it -;; reads each line. Again, the variable is only required to be global because -;; of the use of 'mapatoms'. -(defvar else-read-marker nil) - -(defconst else-lse-ext "\.lse") -(defconst else-esl-ext "\.esl") - -(defvar else-placeholder-overlay nil - "Placeholder overlay is used by the Voice Coder modifications to ELSE.") - -;; This is the after change function. Its primary purpose is to act in -;; situations where the auto-substitute function is active and the change has -;; occurred in the specified region. It must repeat the change into each of the -;; auto-substitute "pair"s. -(defun else-after-change (begin end length) - (let ((marker-index) - (move-text) - (local-begin begin) - (local-end end)) - - ;; Only duplicate any changes if the change has occurred within the auto-sub - ;; area. - (setq else-after-var (append (list begin end length - (symbol-name this-command)) - else-after-var)) - ;; Xemacs changes here - (cond (else-in-xemacs - (if else-move-change - (progn - (setq local-begin (marker-position else-move-to-position)) - (setq local-end (+ local-begin (- end begin))) - (goto-char local-begin) - (setq move-text (buffer-substring begin end)) - (delete-region begin end) - ;; At this point we need to 'modify' the undo list for the - ;; buffer i.e. to allow the user to perform a seamless undo, we - ;; have to delete the events that have just occurred e.g. the - ;; insert of text into the buffer at the 'wrong' place and the - ;; subsequent deleting of that text. The only event we wish to - ;; remain in the undo list is the insertion of the text into - ;; the 'correct' place in the buffer (which will be - ;; accomplished directly after we remove the two mentioned - ;; events). - (setq buffer-undo-list (cdr (cdr buffer-undo-list))) - ;; Now insert the text where it should have originally - ;; gone. Note that this is the event that will be recorded in - ;; the buffer unto list. - (insert move-text) - (setq else-move-change nil) - ) - ) - ) - ) - - (if (and (not undo-in-progress) - else-Auto-Sub-Active - (>= local-begin (marker-position (car (nth 1 else-Auto-Sub-Marker-List)))) - (< local-end (marker-position (cdr (nth 1 else-Auto-Sub-Marker-List))))) - (progn - (save-excursion - (if else-sub-active-toggle - (progn - (setq else-sub-active-toggle nil) - ) - ) - ;; want to iterate over all of the active markers in the marker - ;; list. This starts at the second entry in the marker list. - (setq marker-index 2) - (while (and (marker-position - (car (nth marker-index - else-Auto-Sub-Marker-List))) - (<= marker-index (car else-Auto-Sub-Marker-List))) - (delete-region (marker-position - (car (nth marker-index - else-Auto-Sub-Marker-List))) - (1- (marker-position - (cdr (nth marker-index - else-Auto-Sub-Marker-List))))) - (goto-char (marker-position - (car (nth marker-index - else-Auto-Sub-Marker-List)))) - (insert (buffer-substring (marker-position - (car (nth 1 - else-Auto-Sub-Marker-List))) - (1- (marker-position - (cdr (nth 1 - else-Auto-Sub-Marker-List)))))) - (setq marker-index (1+ marker-index)) - ) - ) - ) - ) - ) - ) - -(defun else-after-token () - "Test if string preceeding point is a valid token." - (let ((here (point)) - (result nil)) - (save-excursion -;; (if (else-scan-for-match "\\( \\|\t\\)\\|\\(^\\)" nil t) - (setq match-scan (format "\\([^%s]+\\)\\|\\(^\\)" - (cdr (assoc else-Valid-Idents-ref - Language-Specifics)))) - (if (else-scan-for-match match-scan nil t) - (if (not (= (point) here)) - (progn - ;; We have found a (potential) token string, have to make a - ;; small adjustment here for detected white-space. Note that no - ;; adjustment required if we matched the beginning of line (^) - ;; (that's why I used the \\( groupings) - (if (match-string 1) - (forward-char) - ) - (if (else-look-up (buffer-substring - (point) - here) ?t) - (progn - ;; We have a valid token, so save the start and end of the - ;; text that was matched. - (setq else-placeholder-start (point)) - (setq else-placeholder-end here) - (setq else-definition-type ?t) - ;; No duplication possible.... - (setq else-please-duplicate nil) - - (setq else-definition-name (buffer-substring - (point) here)) - - ;; Get the definition while we are here.... - (setq else-current-definition (else-look-up - else-definition-name - else-definition-type)) - (setq result t) - ) - ) - ) - ) - ) - ) - result - ) - ) - -;; These variables are used for diagnostic purposes only. They will eventually -;; (?) disappear once I am convinced the before and after change code has all -;; the wrinkles removed. -(defvar else-before-var nil) -(defvar else-after-var nil) -(defvar zero-diff 0) -(defvar zero-begin 0) -(defvar zero-end 0) - -;; The Placeholder and Token variables are obarrays of considerable -;; length. Rather than take up space in Emacs memory when ELSE is not active, -;; I don't bother initialising them until they are required. This routine is -;; called by the language loading procedures. -(defun else-check-and-init-globals (language) - "If language doesn't exist, create a set of variables for it." - (let ((result t)) - (if (not (assoc language else-Language-Definitions)) - (progn - (setq result nil) - (setq Placeholder - (make-vector else-Placeholder-Vector-Size 0)) - (setq Token (make-vector else-Token-Vector-Size 0)) - (setq Language-Specifics - (list (cons else-Language-Name "") - (cons else-Punctuation-ref "") - (cons else-Punctuation-Length-ref 0) - (cons else-Initial-String-ref "") - (cons else-Self-Insert-Characters-ref "") - (cons else-Self-Insert-Characters-Length-ref 0) - (cons else-Valid-Idents-ref "") - (cons else-Valid-Idents-Length-ref 0) - (cons else-tab-size-ref 4) - (cons else-language-version-ref ""))) - ;; Put the new variable set into the global structure. - (setq else-Language-Definitions - (cons - (cons language - (list Placeholder Token Language-Specifics)) - else-Language-Definitions)) - ) - ) - result - ) - ) - -;; -;; Function that runs as part of the before change functions. Its main job is -;; to determine whether the command is a "self-insert" and if so, whether the -;; cursor is within a placeholder, if these conditions are true then it must -;; delete the placeholder before allowing the command to proceed. It also -;; checks whether the placeholder is part of an auto-substitute pairing and if -;; so, sets up the appropriate global variables for use by the after change -;; function. -(defun else-before-change (begin end) - (let ((data (match-data)) - (is-auto-sub) - (this-pos) - (this-column) - (vert-dup) - (valid-search) - (action-struct) - (marker-index) - (sub-marker-counter) - (sub-marker-counter-limit)) - (progn - (cond (else-in-xemacs - ;; Make sure that the flag is reset i.e. it is possible - ;; (but unlikely) that the variable was not cleared for - ;; some reason by the after change function. This is just - ;; a precaution... - (setq else-move-change nil))) - (save-excursion - ;; Ideally we want to detect any advertised-undo commands at - ;; this point so that we don't try and duplicate changes in - ;; the after-change function. Unfortunately, command - ;; processing has apparently set the "this-command" variable - ;; to "t" ie it is useless to detect the change here - we will - ;; use the undo-in-progress flag in the after-change-function - ;; to handle things - thanks to Stefan Monnier for this tip. - (setq else-before-var (append (list begin end - (symbol-name this-command)) - else-before-var)) - (setq zero-begin (append (list begin end) zero-begin)) - (if (equal 0 (- end begin)) - (progn - (setq zero-diff (+ 1 zero-diff)) - (setq zero-begin 0))) - - ;; check if the change is a keystroke i.e. a "self-insert" - ;; character/command. We detect this by checking if the length of the - ;; keystrokes is 1 e.g. a single keypress will result in a single length - ;; key vector from the "this-command-keys-vector" function. This is a - ;; "safe" test because any "and" will "short-circuit" on the first - ;; "evaluation" that equates to "nil". i.e. the compare-strings won't - ;; "happen" unless the length of the key vector is 1. - (setq zero-diff (1+ zero-diff)) - - ;; Only process changes in a placeholder if the change region is not - ;; exactly the boundaries of an existing placeholder i.e. commands such - ;; as insert register etc will delineate begin/end as being outside the - ;; start/end of a placeholder whereas a simple insert will have a - ;; begin/end pairing within these boundaries. Innocuous changes such as - ;; text properties on a placeholder will have the begin/end pair - ;; matching the else-placeholder-start/else-placeholder-end and so we - ;; should(?) ignore them. - (if (and (else-in-placeholder) - (not (= begin else-placeholder-start)) - (not (= end else-placeholder-end))) - (progn - ;; Check if the template definition contains an "oninsert" elisp - ;; action - call it if it does. - (condition-case err - (progn - (setq action-struct (get else-current-definition - 'else-elisp-action)) - (if (assoc else-oninsert-key action-struct) - (funcall (intern-soft - (cdr (assoc else-oninsert-key - action-struct)))))) - (void-function - (message "Symbol's function definition is void: %s" - (cdr (assoc else-oninsert-key action-struct)))) - (error - (message "%s" (error-message-string err)))) - - (setq zero-diff (1+ zero-diff)) - (setq is-auto-sub (char-equal (get else-current-definition - 'else-substitute-ref) - ?a)) - ;; In a placeholder it is either an auto-substitute or - ;; not, in either case clear out the substitution - ;; markers. - (setq sub-marker-counter-limit - (car else-Auto-Sub-Marker-List)) - (setq sub-marker-counter 1) - (while (< sub-marker-counter sub-marker-counter-limit) - (set-marker (car (nth sub-marker-counter - else-Auto-Sub-Marker-List)) - nil) - (set-marker (cdr (nth sub-marker-counter - else-Auto-Sub-Marker-List)) - nil) - (setq sub-marker-counter (1+ sub-marker-counter))) - ;; The markers aren't "active" yet, must make sure that - ;; the secondary markers/placeholders are present! - (setq else-Auto-Sub-Active nil) - (if is-auto-sub - (progn - (set-marker (car (nth 1 else-Auto-Sub-Marker-List)) - else-placeholder-start) - (set-marker (cdr (nth 1 else-Auto-Sub-Marker-List)) - (1+ else-placeholder-end)))) - - ;; XEmacs change - once again not guarded because harmless to FSF - ;; operation. XEmacs has different behaviour wrt a before-change - ;; function altering a buffer. The FSF Emacs seems to perform the - ;; change at the position that 'point' is after exiting the - ;; before-change-function (despite whatever changes occurred in the - ;; function) but XEmacs does not i.e. if you delete X characters - ;; then the point at which a self-insert character is placed will - ;; be "offset" by that length i.e. it will go into the buffer at - ;; the wrong place which is the offset from 'point from the start - ;; of the placeholder. So we provide the after change function - ;; with an indication of where the change should have occurred... - (set-marker else-move-to-position else-placeholder-start) - (setq else-move-change t) - - ;; Check if this is an "auto-substitute" placeholder, if so then - ;; set a flag and create some markers to where the placeholder - ;; substitution is required. Note that the front and back markers - ;; are used in later invocations of this function to determine - ;; whether the cursor and the action taken should be duplicated in - ;; the auto-substitute string. - ;; - (if is-auto-sub - (save-excursion - (goto-char else-placeholder-end) - ;; Set up all of the after change sub markers. The - ;; number is controlled by the number of counts in - ;; the placeholder definition. We increment the - ;; following limit number because of list contains - ;; a counter as the first element. - (setq sub-marker-counter-limit - (1+ - (get else-current-definition - 'else-substitute-count-ref))) - ;; Check whether the total number of markers will - ;; be adequate to meet the needs of the - ;; saubstitution count - if not then 'grow' the - ;; list here as the easiest point to do it. - (if (> (1- sub-marker-counter-limit) - (- (car else-Auto-Sub-Marker-List) 2)) - ;; Grow the list by the required number.... - (progn - (let ((count-increase - (- sub-marker-counter-limit - (- (car else-Auto-Sub-Marker-List) - 2) - 1))) - (while (> count-increase 0) - (setq else-Auto-Sub-Marker-List - (append else-Auto-Sub-Marker-List - (list (cons (make-marker) - (make-marker))))) - (setq count-increase (1- count-increase))) - - (setcar else-Auto-Sub-Marker-List - (length (cdr else-Auto-Sub-Marker-List)))))) - - (setq valid-search t) - ;; Note that the first pair of markers have - ;; already been used to capture the master text - ;; area, so start at the second set of pairs. - (setq sub-marker-counter 2) - - ;; Save the global placeholder variables because - ;; kill-placeholder is used within the following - ;; FORMS - (let ((current-definition else-current-definition) - (please-duplicate else-please-duplicate) - (deleted-string else-deleted-string) - (definition-type else-definition-type) - (definition-name else-definition-name) - (placeholder-start else-placeholder-start) - (placeholder-end else-placeholder-end) - (mandatory-placeholder else-Mandatory-Placeholder)) - (while (and valid-search - (<= sub-marker-counter - sub-marker-counter-limit)) - ;; Find the matching string, arguments mean - ;; search to end of buffer and don't error if - ;; search fails. - (if (search-forward else-definition-name nil t) - (progn - ;; position back into the placeholder - ;; and then kill it (even if it is - ;; mandatory). - (backward-char) - ;; Next call just sets up all of the - ;; global variables so that the text can - ;; be deleted - don't use a - ;; kill-placeholder here because it - ;; would destroy the information that is - ;; required to be kept..... - (else-in-placeholder) - (if else-please-duplicate - (delete-region else-placeholder-start - (+ else-placeholder-end 3)) - (delete-region else-placeholder-start - else-placeholder-end)) - - (if (> sub-marker-counter - (car else-Auto-Sub-Marker-List)) - (progn - ;; we need to grow the list - (error - "growth of sub marker list not implemented") - ) - (set-marker (car - (nth sub-marker-counter - else-Auto-Sub-Marker-List)) - (point)) - (set-marker (cdr - (nth sub-marker-counter - else-Auto-Sub-Marker-List)) - (1+ (point))))) - (setq valid-search nil)) - - (setq sub-marker-counter (1+ sub-marker-counter))) - - ;; Restore the global variables. - (setq else-current-definition current-definition) - (setq else-please-duplicate please-duplicate) - (setq else-deleted-string deleted-string) - (setq else-definition-type definition-type) - (setq else-definition-name definition-name) - (setq else-placeholder-start placeholder-start) - (setq else-placeholder-end placeholder-end) - (setq else-Mandatory-Placeholder mandatory-placeholder)) - - ;; This is not legacy code - (setq else-Auto-Sub-Active t) - - ;; Set the substitute "toggle" flag. This variable - ;; is only used the first time that the - ;; placeholder is deleted. It is used in the - ;; "after" change function because the begin/end - ;; pair is "screwed" up by what is happening here - ;; ie it receives a "begin" which is after the - ;; "end" and the difference is the difference - ;; between the beginning of the placeholder string - ;; and the current cursor position within the - ;; placeholder. - (setq else-sub-active-toggle t))) - - (if else-please-duplicate - (delete-region else-placeholder-start - (+ else-placeholder-end 3)) - (delete-region else-placeholder-start else-placeholder-end)) - - (setq else-deleted-column (current-column)) - - ;; if the placeholder is/was trailed by a duplication request - ;; indicator (...) then replicate it not only in the primary - ;; location but also in any repeat/auto-substitute locations. - (if else-please-duplicate - (save-excursion - (setq this-pos (point)) - ;; Work out the duplication requirements only if the - ;; placeholder definition is context_dependent i.e. it - ;; is not being overridden explicitly in the - ;; definition. - (setq vert-dup (get else-current-definition - 'else-duplication-ref)) - (if (char-equal vert-dup ?c) - (if (not (else-scan-for-match "[^ \t]" nil t)) - (setq vert-dup ?v) - (setq vert-dup ?h))) - - (goto-char this-pos) - (else-replicate-placeholder-string vert-dup - else-deleted-column - else-current-definition) - ;; Now lets replicate the auto-sub placeholders - this would - ;; be considered to be an unusual event but may be required - ;; in the case of duplication of parameters etc of - ;; function/procedure calls as might be desired by languages - ;; that allow/require a declaration and a definition. - (setq marker-index 2) - (while (and (marker-position - (car (nth marker-index - else-Auto-Sub-Marker-List))) - (<= marker-index (car - else-Auto-Sub-Marker-List))) - ;; Position at the start of where the original placeholder - ;; was. - (setq this-pos (marker-position (car (nth marker-index - else-Auto-Sub-Marker-List)))) - - ;; Have to calculate the column number for the call to - ;; replicate.... - (goto-char this-pos) - (beginning-of-line) - (setq this-column (- this-pos (point))) - (goto-char this-pos) - ;; Now do the replication - (else-replicate-placeholder-string vert-dup - this-column - else-current-definition) - (setq marker-index (1+ marker-index)))))) - - (progn - ;; This is the point where we have decided that we are not in - ;; a placeholder, so therefore it is not a situation of - ;; deleting any placeholders etc. for an insertion. - ;; - ;; Check whether auto-substitute should be cancelled (if - ;; active). - (if else-Auto-Sub-Active - (progn - ;; OK, need to check whether auto-sub mode should - ;; remain active. - (if (not - (and (>= begin - (car (nth 1 else-Auto-Sub-Marker-List))) - (<= end - (cdr (nth 1 else-Auto-Sub-Marker-List))))) - (setq else-Auto-Sub-Active nil)))))) - - ;; The 'else' case of this not being a self-insert (basically). This is - ;; a real problem because just deleting the placeholder can cause - ;; serious problems for some commands i.e. 'erase-buffer after - ;; performing a kill-placeholder will crash Emacs! There is insufficient - ;; information in the Elisp manual about what you can and cannot do in a - ;; before-change-function, so the following code was used extensively - ;; (well, it was active for some considerable time :-)) in my edit - ;; sessions with no bad side-effects - so it must be OK? - (if (else-in-placeholder) - ;; There is at least one command, erase-buffer, that doesn't like - ;; the contents of the buffer being changed. So, limit the - ;; execution of the kill-placeholder command to the situation - ;; where it only occurs if the (begin . end) change area is within - ;; the limits of the placeholder. - (if (and (> begin else-placeholder-start) - (< begin else-placeholder-end)) - ;; There doesn't seem to be any reason to check the 'end - ;; variable i.e. commands like insert-register, kill-line etc - ;; seem to have only a single variable in the 'begin. - (progn - (else-kill-placeholder t t t) - (set-marker else-move-to-position else-placeholder-start) - (setq else-move-change t)))))) - - ;; restore the match data - (set-match-data data))) - -(defun else-check-language-file (path-name) - "Check if the file contains a fast load version and verify validity. -Validity checking entails the date stamps on the .esl file versus the time -stamp on the .lse file. A warning is issued if the .esl version is younger than -the .lse version ie the fast load version should be recompiled." - (let ((file-name) - (split-name) - (file-name-with-esl) - (file-name-with-lse) - (fast-mod-time) - (slow-mod-time)) - ;; Split the path up into path+name and extension. - (setq split-name (split-string path-name "\\.")) - (if (= (length split-name) 2) - (progn - (setq file-name (car split-name)) - ) - ;; Otherwise, no extension available. - (setq file-name path-name) - ) - ;; Next check the timestamps of the two versions of the files. - (setq file-name-with-esl (concat file-name else-esl-ext)) - (setq file-name-with-lse (concat file-name else-lse-ext)) - (if (and (file-exists-p file-name-with-esl) - (file-exists-p file-name-with-lse)) - (progn - (setq fast-mod-time - (nth 5 (file-attributes file-name-with-esl))) - (setq slow-mod-time - (nth 5 (file-attributes file-name-with-lse))) - (if (or (> (car slow-mod-time) (car fast-mod-time)) - (and (= (car slow-mod-time) (car fast-mod-time)) - (> (cadr slow-mod-time) (cadr fast-mod-time)))) - (message "%s.esl is older than %s.lse" - file-name file-name) - ) - ) - ) - ) - ) - -;; Clean up (delete) all lines that contain placeholders. This would be the -;; final step after all coding is complete. -(defun else-cleanup-placeholders () - "Delete every _line_ in the buffer containing a valid placeholder. -Note the emphasis on _line_, so be careful :-)." - (interactive) - (let () - (progn - (save-excursion - (goto-char (point-min)) - (while (not (= (point) (else-next-placeholder))) - (else-kill-placeholder nil t) - ) - ) - ) - ) - ) - - -;; Rip thru' the buffer (or narrowed region) and place comment characters -;; on each line that has a valid placeholder. Use the 'comment-region -;; function, so end comments will be placed as well. -(defun else-comment-placeholders () - "Comments out every line in the buffer containing a valid placeholder. -This function uses the 'comment-region' function to achieve this miracle of -modern science." - (interactive) - (let ((region-start) - (region-end)) - (progn - (save-excursion - (goto-char (point-min)) - (while (not (= (point) (else-next-placeholder))) - (progn - (beginning-of-line) - (setq region-start (point)) - (end-of-line) - (setq region-end (point)) - (comment-region region-start region-end) - (end-of-line) - ) - ) - ) - ) - ) - ) - -;; -;; "Compile" the language template definitions in the current buffer. -;; Processes from `point' to the end of the buffer. -(defun else-compile-buffer (&optional start-at-point-min) - "Compile the language template definitions from 'point' to the end." - (interactive "P") - (let ((command) - (err-msg nil) - (here (point)) - ;; User may not like UPPER-CASE in the template file - sigh...... - (case-fold-search t)) - (setq err-msg - (catch 'compile - (if start-at-point-min - (goto-char (point-min))) - (while (not (= (point) (point-max))) - (progn - ;;Only look if the line isn't a comment line - (if (not (else-scan-for-match else-template-comment nil)) - (if (else-scan-for-match else-defining-string nil) - (progn - ;; Get the command, either a DELETE or a DEFINE - (setq command (match-string else-defining-command)) - (cond ((string= command "DELETE") - ;; Actions to delete a definition - (else-delete-a-definition)) - ((string= command "DEFINE") - ;; Actions to define a definition - (else-read-a-definition)) - ((string= command ";;") - (setq command 1)) - (t - ())))) - ;; if-else to template comment string search - do nothing - )) - (forward-line)))) - - ;; If there has been an error then leave point at the error, - ;; otherwise return the user to the starting point. - (if err-msg - (progn - (message "Aborted - %s" err-msg) - nil) - (goto-char here) - t))) - -(defun else-compile-fast-load (language-file-name) - "Make an Emacs Lisp loadable file from a standard language template file. -The resulting file has a .esl extension as opposed to the .lse extension -of a normal language template file." - (interactive "fName of language file:") - (let ((file-ext-start) - (compiled-file-name) - (language-input-buffer) - (result nil) - (auto-mode-alist nil) - (else-lse-ext-search-string (concat "\\" else-lse-ext))) - - ;; Check if the file contains the ELSE file extension. - (setq file-ext-start - (string-match else-lse-ext-search-string language-file-name)) - (if (not file-ext-start) - ;; Take the easy out here and just tack on the .lse extension. - (setq language-file-name (append language-file-name else-lse-ext)) - ) - ;; Check if the file exists - (if (file-exists-p language-file-name) - (progn - ;; locate the start of the normal file extension because we have to - ;; construct a file name using the new file extension. - (setq file-ext-start - (string-match else-lse-ext-search-string language-file-name)) - - ;; Copy the entire language file name to the place where the - ;; compiled version of the name will be created. - (setq compiled-file-name (substring language-file-name 0)) - ;; create the compiled version - (store-substring compiled-file-name file-ext-start else-esl-ext) - - (save-excursion - ;; Read the language template into a buffer and "compile" it. - (setq language-input-buffer - (find-file-noselect language-file-name)) - (set-buffer language-input-buffer) - (setq result (else-compile-buffer)) - (if result - (progn - ;; Dump the language to the file - (else-dump-language compiled-file-name) - ) - (message "Failed to compile %s" language-file-name) - ) - ;; Clean up the input buffer. - (kill-buffer language-input-buffer) - ) - ) - (message "File %s doesn't exist." language-file-name) - ) - ) - ) - -;; -;; Delete either a "LANGUAGE", "PLACEHOLDER" or "TOKEN" definition. -;; Called upon detection of the "DELETE" token in the template source file. -;; -(defun else-delete-a-definition () - (let ((obarray-name nil) - (array-type nil) - (language-name "") - (current-language else-Current-Language) - (object-name) - (defining-type)) - ;; Get the 'type' of thing being deleted ie LANGUAGE, PLACEHOLDER or TOKEN - (setq defining-type (match-string else-defining-type)) - (cond ((string= defining-type "PLACEHOLDER") - (setq array-type ?p)) - ((string= defining-type "TOKEN") - (setq array-type ?t)) - ((string= defining-type "LANGUAGE") - (else-delete-language-definition)) - ) - (if array-type - (progn - ;; - ;; Get the name of the item being deleted first then move on and get - ;; the target language database to perform the operation upon. - ;; - (setq object-name - (else-strip-quotes (match-string else-defining-name))) - (forward-line) - (if (else-scan-for-match else-body-string nil) - (progn - (setq language-name - (else-strip-quotes (match-string else-body-command-2))) - (if language-name - (progn - (if (else-establish-language language-name) - (progn - (cond ((char-equal array-type ?p) - (setq obarray-name Placeholder) - ) - ((char-equal array-type ?t) - (setq obarray-name Token) - ) - ) - (if obarray-name - (unintern (upcase object-name) obarray-name) - ) - ) - (message "This language (%s) has not been defined!" - language-name) - ) - ;; restore the 'original' language i.e. might - ;; have template language enabled for a .lse - ;; file that contains definitions for some other - ;; language - so compiling a definition - ;; shouldn't destroy the current language - ;; settings for the buffer. - (else-establish-language current-language) - ) - ) - ) - ) - ) - ) - ) - ) - -;; Unintern or "Delete" an entry in `obarray'. This function is used as an -;; argument to the mapatoms command. -(defun else-delete-entry (s) - (let () - (if (not (unintern s)) - (message "Can't delete from obarray!") - ) - ) - ) - -;; -;; Delete a language definition from the Global Template definitions. -;; Called when the sequence "DELETE LANGUAGE" has been parsed in the -;; language template definition file. -;; -(defun else-delete-language-definition () - (let ((language-name "") - (language-assoc) - (current-language else-Current-Language)) - (progn - (setq language-name - (else-strip-quotes (match-string else-defining-name))) - (if (else-establish-language language-name) - (progn - (mapatoms (lambda (s) - (if (not (unintern s Placeholder)) - (message "Can't delete from Placeholder") - ) - ) - Placeholder - ) - (mapatoms (lambda (s) - (if (not (unintern s Token)) - (message "Can't delete from Token") - ) - ) - Token - ) - (setq language-assoc - (assoc language-name else-Language-Definitions)) - (if language-assoc - (progn - ;; - ;; The 'delete' command doesn't seem to work, so I will - ;; adopt a strategy of "emptying" the language entry - ;; Unless I apply logic to "re-use" the slot, then - ;; we will waste the memory allocated to the vectors - ;; but at the moment I don't care. - ;; - (setq else-Language-Definitions - (delete (assoc language-name else-Language-Definitions) - else-Language-Definitions)) - ) - ) - ) - ) - ;; restore the 'original' language i.e. might have template - ;; language enabled for a .lse file that contains definitions - ;; for some other language - so compiling a definition shouldn't - ;; destroy the current language settings for the buffer. - (else-establish-language current-language) - ) - ) - ) - -;; -;; Delete or "Kill" the placeholder in which `point' resides. The 'force' option -;; is added because it is possible for else-mode to want to kill a placeholder -;; and it really means it wants to - this situation arises when creating new -;; language templates and the second /LANGUAGE="{language_name}" has been -;; defined as a AUTO-SUBSTITUTE - in this case the else-before-change function -;; really does want to kill the second occurrence but we really do want to keep -;; the definition as a mandatory just in case the user doesn't want to define -;; this placeholder type (language_name). -;; -(defun else-delete-placeholder (&optional leave-spacing force dont-kill-empty-lines) - "Delete the placeholder at `point'. Clean up syntactically." - (interactive "i\nP") - (let ((separator) - (separator-region-end) - (had-left-space nil) - (had-right-space nil) - (here) - (search-limit) - (string-index) - (new-separator-search)) - - (catch 'problem - (if (not else-mode) - (progn - (error "ELSE mode not enabled.") - (throw 'problem nil) - ) - ) - - ;; Check if we are in a valid placeholder and also that the detected - ;; placeholder is not mandatory (the else-Mandatory-Placeholder flag is - ;; set as a side effect of the call to else-in-placeholder). - (if (else-in-placeholder) - (if (or (not else-Mandatory-Placeholder) force) - (progn - ;; Make sure we keep a copy of the text of the - ;; placeholder being deleted - this is mainly because - ;; of the symbol-name of the definition doesn't - ;; reflect the same character casing of the text being - ;; deleted. - (setq else-deleted-string (buffer-substring - else-placeholder-start - else-placeholder-end)) - - (goto-char else-placeholder-end) - - (if else-please-duplicate - (delete-region else-placeholder-start (+ (point) 3)) - (delete-region else-placeholder-start (point)) - ) - - ;; Pause here a moment and check what "spacing" surrounded the - ;; deleted placeholder. - (if (char-or-string-p (preceding-char)) - (setq had-left-space - (char-equal (preceding-char) ?\ )) - (setq had-left-space nil) - ) - - (if (char-or-string-p (following-char)) - (setq had-right-space - (char-equal (following-char) ?\ )) - (setq had-right-space nil) - ) - - ;; Process a placeholder that maintains a "separator" string - (setq separator (get else-current-definition 'else-separator-ref)) - (if (> (length separator) 0) - (progn - (setq separator-region-end (point)) - ;; Set a limit as the beginning of the previous line, this - ;; is a worst case situation. - (forward-line -1) - (setq search-limit (point)) - (goto-char separator-region-end) - - ;; Note that some major modes provide trimming of trailing - ;; spaces on file-save! So, any template separators may - ;; have one or more trailing spaces stripped off in the - ;; buffer (if they appear at a line and the file was saved - ;; and then re-edited i.e. the separator won't get - ;; matched! So the following code looks for the separator - ;; in it's entirety, then if not found it trims off - ;; trailing spaces and attempts to do a regexp match for - ;; the separator. - - (if (search-backward separator search-limit t) - (delete-region (point) separator-region-end) - ;; not found - (progn - ;; check for special case mentioned above i.e. if - ;; there is a trailing space in the separator, has it - ;; been deleted accidently? - (if (char-equal - (aref separator (1- (length separator))) ?\ ) - ;; there is at least one trailing space, so make - ;; up a new search string. Might as well make it a - ;; regexp. - (progn - (setq string-index (1- (length separator))) - (while (and (< 0 string-index) - (char-equal - (aref separator string-index) ?\ )) - (setq string-index (1- string-index)) - ) - ;; Now make a regexp which is the left over - ;; separator character(s) plus " +" at the end. - (setq new-separator-search - (make-string (+ 3 string-index) ?\ )) - ;; Copy the separator character(s) over. - (while (not (= -1 string-index)) - (aset new-separator-search string-index - (aref separator string-index)) - (setq string-index (1- string-index)) - ) - ;; Now append the regexp for a series of spaces. - (aset new-separator-search - (1- (length new-separator-search)) - ?*) - (aset new-separator-search - (- (length new-separator-search) 2) - ?\ ) - ;; Now try the search. - (if (re-search-backward - new-separator-search search-limit t) - ;; found - (delete-region (point) separator-region-end) - ) - ) - ) - ) - ) - ) - ) - (setq here (point)) - - ;; If this leaves the line blank, then delete the entire line - (end-of-line) - (if (and (not (else-scan-for-match "[^ \t]" nil t)) - (not dont-kill-empty-lines)) - (progn - (beginning-of-line) - (kill-line) - ) - ;; Line is not blank - (progn - (goto-char here) - ;; If there was a space before and after the placeholder - ;; then "clean-up" by deleting one more space under - ;; point. Groan.... only if there is more than one space! - (if (and (not leave-spacing) had-right-space had-left-space - (char-equal (preceding-char) ?\ ) - (char-equal (following-char) ?\ )) - (delete-char 1) - ) - ;; Finally, if it is a "punctuation" character of the - ;; language then make sure there is no preceding space. But - ;; if it's not at the start of a line (and the leave-spacing - ;; hasn't been requested) (exceptions... exceptions... - ;; *sigh*) - (if (not (= (current-column) 0)) - (if (and (not leave-spacing) - (aref Language-Punctuation-Characters-Vector - (following-char))) - (while (char-equal (preceding-char) ?\ ) - (delete-char -1) - ) - ) - ) - ) - ) - ) - (error "Can't delete - mandatory entry required") - ) - ) - ) - ) - ) - - -;; -;; Display the list of possible matches for the expand-a-word function, it is -;; not called unless there is more than one possible match -;; -(defun else-display-menu (possible-matches &optional momentary-only) - "Display menu of possible choices. Doubles as prompt display as well - yuk." - (let ((my-buffer) - (start-window (selected-window)) - (menu-string "")) - (save-window-excursion - (save-excursion - ;; Process all of the possible matches into a list of strings - ;; appropriate for display to the user. - (dolist (match-element possible-matches) - (setq menu-string (concat menu-string - (else-display-menu-element match-element)))) - - ;; Sometimes we end up with an extraneous carriage return at - ;; the end of the menu list - this causes a blank line in the - ;; menu display. Get rid of it. - (if (= (elt menu-string (1- (length menu-string))) ?\n) - (aset menu-string (1- (length menu-string)) ?\ )) - ;; Set the selection item to nothing - (setq else-selected-text nil) - - ;; Create and point to the appropriate buffer i.e. if a momentary - ;; display then use a separate buffer to that used by the menu selection - ;; process. - (if momentary-only - (progn - (setq my-buffer (get-buffer-create " *ELSE Placeholder Prompt*")) - (set-buffer my-buffer) - ) - ;; Otherwise it is a menu display of possible choices, so create a - ;; temporary buffer and display the data. - (setq my-buffer (get-buffer-create " *ELSE Menu List*")) - (set-buffer my-buffer) - (if (and else-set-lineno (featurep 'setnu)) - ;; Don't have to worry about "standard" minor mode behaviour of - ;; each call "toggling" the mode as this mode allows a positive - ;; argument to indicate that the mode should be turned on. - (setnu-mode 1))) - - (erase-buffer) - - ;; Am now pointing into the appropriate buffer so insert the data for - ;; display. - (setq truncate-lines t) - (insert menu-string) - - ;; Now position the cursor appropriately, size the window to fit the - ;; buffer to be displayed and then display it. - (goto-char (point-min)) - (split-window (selected-window)) - (set-window-buffer start-window my-buffer) - ;; Finally, size the window to match the size of the buffer i.e. no - ;; point in displaying a window that is unnecessarily large. - (shrink-window-if-larger-than-buffer start-window) - (select-window start-window) - (setq major-mode 'else-Display) - (use-local-map else-menu-mode-map) - (setq mode-name "ELSE mode") - (if momentary-only - (sit-for else-prompt-time) - (recursive-edit) - ) - ) - ) - ) - ) - -(defun else-display-menu-element (body-element) - "Given a definition body element, extract the appropriate -information for inclusion in a menu display and format it -appropriately. Return the resultant string." - (let ((description nil) - (element-text) - (current-type) - (result "")) - - (setq element-text (elt body-element else-body-text-ref)) - (setq current-type (elt body-element else-body-type-ref)) - (if current-type - (progn - (setq description - (else-get-description element-text current-type)) - (cond ((char-equal current-type ?p) - (setq result (concat result - (format "{%s}" element-text)))) - ((char-equal current-type ?t) - (setq result (concat result - (format "\"%s\"" element-text)))) - ) - (if description - (setq result (concat result (format " - %s\n" description))) - (setq result (concat result "\n")) - ) - ) - (setq result (concat result - (format "\"%s\"\n" element-text))) - ) - result - ) - ) - -(defun else-dump-language (compiled-file-name) - "Dump the current buffer language template to the named file. -Note that the file name parameter must have been already vetted to make sure -it complies with the else naming conventions ie .esl" - (let ((language-output-buffer)) - ;; The language definition should be in the local copies of Placeholder, - ;; Token and Language-Specifics. So we can take that and write it out to - ;; the language compilation file. - (save-excursion - (setq language-output-buffer - (find-file-noselect compiled-file-name t)) - (set-buffer language-output-buffer) - (setq else-read-marker (point-marker)) - ) - - ;; Ok, all set to write the data to the buffer. Write the language specific - ;; information and then each element of the Placeholder and Token obarrays. - (print Language-Specifics else-read-marker) - (setq else-type-of-symbols ?p) - (mapatoms 'else-store-element Placeholder) - (setq else-type-of-symbols ?t) - (mapatoms 'else-store-element Token) - - (save-excursion - (set-buffer language-output-buffer) - (save-buffer) - ) - ;; Clean up the output buffer. - (kill-buffer language-output-buffer) - ) - ) - -;; -;; Make sure that all key-bindings that bind to the expansion command are -;; echoed in the menu selection keymap ie the user doesn't have to move his -;; fingers from the command that caused a menu pick list to be displayed. -;; -(defun else-enable-dups (map command-to-search-out replacement-command) - (let (abc) - (setq abc (where-is-internal command-to-search-out)) - (while abc - (progn - (define-key map (car abc) replacement-command) - (setq abc (cdr abc)) - ) - ) - ) - ) - -;; -;; Set the local buffer variables to the appropriate language definition -;; templates. -(defun else-establish-language (language-name) - "Set language template set 'language-name as the current template -set for this buffer." - (let ((language-assoc) - (result nil)) - (setq language-assoc - (cdr (assoc language-name else-Language-Definitions))) - (if language-assoc - (progn - (setq Placeholder (car language-assoc)) - (setq Token (car (cdr language-assoc))) - (setq Language-Specifics (car (cdr (cdr language-assoc)))) - (setq else-Current-Language language-name) - (setq result t) - ) - ) - result - ) - ) - -(defun else-expand-item-at-overlay (item) - "Expand the object (placeholder or token) 'item at the location of the -else-placeholder-overlay. This defun is designed to be called by an external -entity with a selection from a menu that was constructed using -else-get-menu-entries. It must work in conjunction with the use of the Overlay -denoted by else-placeholder-overlay." - (let ((this-definition nil) - (origin nil)) - ;; Protect against inadvertant use - (catch 'problem - (if (not else-mode) - (progn - (error "ELSE mode not enabled.") - (throw 'problem nil) - ) - ) - (if (overlayp else-placeholder-overlay) - (progn - (goto-char (1+ (overlay-start else-placeholder-overlay))) - (setq origin (point)) - ;; 'process' the selected menu entry - note the expectation that any - ;; item entered to this defun must be encoded using the format that - ;; else-get-menu-entries imposes. - (setq else-selected-text (else-extract-item item)) - - ;; see if the item is a placeholder or token. This is made easier - ;; because the menu encoding adds {}'s to placeholders and leaves - ;; tokens and substitution strings alone! - (if (char-equal (elt item 0) ?\{) - ;; placeholder - (progn - (setq this-definition (else-look-up else-selected-text ?p)) - (if this-definition - ;; It's a valid placeholder - (else-process-definition this-definition ?p))) - ;; must be either a token or a straight string substitution - (setq this-definition (else-look-up else-selected-text ?t)) - (if this-definition - (else-process-definition this-definition ?t) - ;; Not a placeholder or a token so it must be text to substitute - (else-substitute else-selected-text nil))) - ;; Now position the cursor intelligently - (goto-char origin) - (else-next-placeholder) - ) - ;; There is no overlay defined - ) - ) - ) - ) - -;; -;; Function name is a misnomer, this routine is the general start point for -;; expanding either a placeholder or a token. -;; -(defun else-expand-placeholder () - "Expand the placeholder or token located at `point'." - (interactive) - (let ((here (point))) - (catch 'problem - (if (not else-mode) - (progn - (error "ELSE mode not enabled.") - (throw 'problem nil) - ) - ) - - ;; Reset the definition type and then work out if there is a - ;; valid definition to expand - setting this variables as a side - ;; effect. - (setq else-definition-type nil) - - (if (else-in-placeholder) - (progn - ;; Yup, detected a valid placeholder, so just skip - ;; straight down and process it. - ) - ;; Else - check if it is as a token. - (if (else-after-token) - (progn - ;; yes, it is a token - ) - ) - ) - ;; O.K. If it's a placeholder or a token then process it. - (if else-definition-type - (progn - (if (else-process-definition else-current-definition - else-definition-type) - (progn - ;; A valid definition was processed, so position back to - ;; the start of it and proceed to the next placeholder. - (goto-char else-placeholder-start) - (else-next-placeholder) - ) - ) - ) - (progn - ;; Not a valid placeholder or a token string. Check to see what - ;; behaviour is required. The following code dealing with - ;; expand-or-move flag and else-direction flag was added to make ELSE - ;; more usable with VoiceCoder. the test for interactiveness is needed - ;; because the case no valid placeholder can be found in the - ;; search-direction results in a crash (endless loop). This situation - ;; is quite likely if you use speech recognition and try to expand a - ;; token. - (if (and else-move-and-execute (interactive-p)) - ;; User must desire a movement and then an expansion i.e. the next - ;; placeholder can be "seen" and an expansion is desired there. - (progn - (if else-direction - (else-next-placeholder) - (else-previous-placeholder) - ) - (else-expand-placeholder) - ) - ;; otherwise default behaviour is to print an error message to the - ;; user. This is voice coding slanted: sometimes when called as-if - ;; interactive from abbreviations, an error destroys the contents of - ;; before-change-functions. I don't know exactly why and where, but - ;; this is the solution: - (if else-move-and-execute - (message "Not a valid placeholder or token.") - (goto-char here) - (error "Not a valid placeholder or token.")) - ) - ) - ) - ) - ) - ) - -;; -;; These routines provide the 'extract' feature of ELSE -;; -(defun else-extract-all () - "Extract all placeholders and tokens definitions for the enabled language -template." - (interactive) - (let ((current-language else-Current-Language) - (sorted-names)) - ;; Allow a bit of flexibility here, if the user is extracting in a buffer - ;; that has language defined then operate on that language, otherwise - ;; prompt the user for a language name and then operate on that language - ;; definition. Do also if the user is editing an LSE file i.e. template - ;; would be the language enabled - which you don't want to extract from - ;; :-). - (if (else-extract-chk-language) - (progn - - ;; Extract the language definition - (insert (concat "DELETE LANGUAGE \"" else-Current-Language - "\" -")) - (newline) - (insert (concat "DEFINE LANGUAGE \"" else-Current-Language - "\" -")) - (newline) - (indent-to else-Extract-Column) - (insert (concat "/INITIAL_STRING=\"" - (cdr (assoc else-Initial-String-ref Language-Specifics)) - "\" -")) - (newline) - (indent-to else-Extract-Column) - (insert (concat "/PUNCTUATION_CHARACTERS=\"" - (cdr (assoc else-Punctuation-ref Language-Specifics)) - "\" -")) - (newline) - (indent-to else-Extract-Column) - (insert (concat "/SELF_INSERT_CHARACTERS=\"" - (cdr (assoc else-Self-Insert-Characters-ref - Language-Specifics)) - "\" -")) - (newline) - (indent-to else-Extract-Column) - (insert (concat "/VALID_IDENTIFIER_CHARACTERS=\"" - (cdr (assoc else-Valid-Idents-ref - Language-Specifics)) - "\" -")) - (newline) - (indent-to else-Extract-Column) - (insert (concat "/INDENT_SIZE=\"" - (number-to-string - (cdr (assoc else-tab-size-ref - Language-Specifics))) - "\" -")) - (newline) - (indent-to else-Extract-Column) - (insert (concat "/VERSION=\"" - (cdr (assoc else-language-version-ref - Language-Specifics)) - "\" -")) - (newline) - (newline) - (insert "END DEFINE") - (newline) - (newline) - ;; Extract all the placeholder and token definitions. Do - ;; this by getting a alphabetically sorted list of the - ;; placeholder/token names and then processing each of the - ;; definitions individually - (setq sorted-names (else-return-sorted-list Placeholder)) - (mapc '(lambda (element-name) - (else-extract-a-placeholder - (intern-soft (upcase element-name) - Placeholder))) sorted-names) - - (setq sorted-names (else-return-sorted-list Token)) - (mapc '(lambda (element-name) - (else-extract-a-token - (intern-soft (upcase element-name) - Token))) sorted-names) - - ;; Restore the original language (assuming there was one) - (if current-language - (else-establish-language current-language) - ) - ) - ) - ) - ) - -;; -;; Extract an individual placeholder definition. (non-interactive form - see -;; else-extract-placeholder). -;; -(defun else-extract-a-placeholder (placeholder-definition) - (let ((selected-definition placeholder-definition) - (name) - (temp) - (tmp) - (function-name) - (body) - (lang-indent-size (cdr (assoc else-tab-size-ref Language-Specifics)))) - - (setq name (get selected-definition 'else-original-name)) - (insert "DELETE PLACEHOLDER ") - (if (string-match " " name) - (insert (concat "\"" name "\" -")) - (insert (concat name " -"))) - (newline) - (indent-to else-Extract-Column) - (insert (concat "/LANGUAGE=\"" else-Current-Language "\" -")) - (newline) - (insert "DEFINE PLACEHOLDER ") - (if (string-match " " name) - (insert (concat "\"" name "\" -")) - (insert (concat name " -"))) - (newline) - (indent-to else-Extract-Column) - (insert (concat "/LANGUAGE=\"" else-Current-Language "\" -")) - (newline) - (indent-to else-Extract-Column) - ;; Check to see if the placeholder is a forward reference. - (setq temp (get selected-definition 'else-placeholder-ref)) - (if (car temp) - (progn - (insert "/PLACEHOLDER=") - (insert (concat "\"" - (car (cdr temp)) - "\""))) - ;; Not a forward reference, so continue with the rest of the information. - (progn - (setq temp (get selected-definition 'else-substitute-ref)) - (cond ((char-equal temp ?n) - (insert "/NOAUTO_SUBSTITUTE -")) - ((char-equal temp ?a) - (insert "/AUTO_SUBSTITUTE -") - (newline) - (indent-to else-Extract-Column) - (insert "/SUBSTITUTE_COUNT=") - (insert (number-to-string - (get selected-definition 'else-substitute-count-ref))) - (insert " - ")) - (t - (message "invalid substitute value"))) - (newline) - (indent-to else-Extract-Column) - (insert "/DESCRIPTION=") - (insert (concat "\"" (get selected-definition 'else-description-ref)) "\"") - (setq temp (get selected-definition 'else-duplication-ref)) - (newline) - (indent-to else-Extract-Column) - (insert "/DUPLICATION=") - (cond ((char-equal temp ?c) - (insert "CONTEXT_DEPENDENT -")) - ((char-equal temp ?v) - (insert "VERTICAL -")) - ((char-equal temp ?h) - (insert "HORIZONTAL -")) - (t - (message "Illegal duplication type detected"))) - (newline) - (indent-to else-Extract-Column) - (insert (concat "/SEPARATOR=" "\"" - (get selected-definition 'else-separator-ref) - "\" -")) - (setq temp (get selected-definition 'else-type-ref)) - (newline) - (indent-to else-Extract-Column) - (insert "/TYPE=") - (cond ((char-equal temp ?m) - (insert "MENU -")) - ((char-equal temp ?t) - (insert "TERMINAL -")) - ((char-equal temp ?n) - (insert "NONTERMINAL -")) - (t - (message "Illegal service detected"))) - (else-extract-runcode-component) - (setq body (get selected-definition 'else-body-ref)) - (newline) - (indent-to else-Extract-Column) - (while (car body) - (progn - (newline) - (indent-to else-Extract-Column) - (insert "\"") - (insert (make-string - (* (nth else-body-indent-ref (car body)) - lang-indent-size) - ?\ )) - (insert (concat (nth else-body-text-ref (car body)) "\"")) - (setq temp (nth else-body-type-ref (car body))) - (if temp - (cond ((char-equal temp ?p) - (insert "/PLACEHOLDER")) - ((char-equal temp ?t) - (insert "/TOKEN")) - (t - (message "Illegal body text type detected")))) - (setq body (cdr body)))))) - (newline) - (newline) - (insert "END DEFINE") - (newline) - (newline))) - -;; -;; Extract an individual token definition. (non-interactive form - see -;; else-extract-token). -;; -(defun else-extract-a-token (token-definition) - (let ((selected-definition token-definition) - (temp) - (body) - (name)) - (setq name (get selected-definition 'else-original-name)) - (insert "DELETE TOKEN ") - (insert (concat name " -")) - (newline) - (indent-to else-Extract-Column) - (insert (concat "/LANGUAGE=\"" else-Current-Language "\" -")) - (newline) - (insert "DEFINE TOKEN ") - (insert (concat name " -")) - (newline) - (indent-to else-Extract-Column) - (insert (concat "/LANGUAGE=\"" else-Current-Language "\" -")) - (setq temp (get selected-definition 'else-placeholder-ref)) - (if (car temp) - (progn - (newline) - (indent-to else-Extract-Column) - (insert "/PLACEHOLDER=") - (insert (car (cdr temp)))) - (progn - (setq temp (get selected-definition 'else-description-ref)) - (if temp - (progn - (newline) - (indent-to else-Extract-Column) - (insert "/DESCRIPTION=") - (insert (concat "\"" - (get selected-definition - 'else-description-ref) "\"")))))) - (else-extract-runcode-component) - (setq body (get selected-definition 'else-body-ref)) - (newline) - (indent-to else-Extract-Column) - (while (car body) - (progn - (newline) - (indent-to else-Extract-Column) - (insert (concat "\"" - (nth else-body-text-ref (car body)) "\""))) - (setq body (cdr body))) - (newline) - (newline) - (insert "END DEFINE") - (newline) - (newline))) - -;; This routine assumes that it has been called after a regular expression match -;; that indicates a line from the body of a definition has been found -;; ie. \".*\". The entry for the body form can be of the form " text " with an -;; optional trailer(s) of /TOKEN or /PLACEHOLDER. If the text is meant for -;; substitution i.e. it is not a menu or terminal entry prompt, then we wish to -;; also record indentation information. The algorithm that calculates the number -;; of indents for each line makes an assumption that the first line that is -;; indented establishes a "base" indent level and any subsequent lines have -;; their spacing compared with this count. Therefore, this routine (since it -;; acts on a single line at a time) must take an argument of any current indent -;; level information that may be in force and conversely, provide any indent -;; information that it "discovers" i.e. if there is not indent level currently -;; in force then if the current line contains indent information, that -;; information must be returned to the caller. -;; -;; Further processing is made easier if there are three elements in each 'body' -;; entry, so start the definition off with nil for all three elements and then -;; replace them as needed. The order is /PLACEHOLDER or /TOKEN, indentation and -;; then "any text". It assumes that the match-data from the "body" search string -;; is still valid! -;; -;; 28-Jun-2002: Found a problem when attempting to define bodies that are purely -;; textual in nature and the user doesn't want the indentation rules to be -;; used i.e. definition of a file header with text lines that are heavily -;; indented. Take the (obvious?) approach and use some special character ('@' in -;; this case to denote 'hard' spaces. -;; -(defun else-extract-body (indent-level-size) - (let ((local-list (list nil 0 nil t)) - (this-line nil) - (this-indent-size) - (return-size indent-level-size)) - (progn - ;; Extract the text and place it into a local variable for further - ;; manipulation and testing. - (setq this-line (else-strip-quotes - (match-string else-body-text-1))) - ;; Search the line for the first occurrence of non-whitespace, this is the - ;; current indent value. Make sure that the match data is preserved - ;; because we use a regular expression scan here! - (save-match-data - (setq this-indent-size (string-match "\\S-" this-line)) - ;; Allow for the case of an empty line i.e. "" - (if (not this-indent-size) - (setq this-indent-size 0))) - ;; If there is an indent, then calculate it as a multiple of the global - ;; value 'indent-level-size - (if (> this-indent-size 0) - (progn - ;; First, make sure we strip out the white i.e. we don't want to - ;; copy it through, so copy through from the first non-whitespace to - ;; the end. - (setq this-line (substring this-line this-indent-size)) - ;; Calculate the indentation as a multiple of the "base" value but - ;; allow for the case where the base value hasn't been established - ;; yet! Note that this calculation also assumes that if the - ;; indentation is greater than a "multiple" of the base value then - ;; an assumption is made that the user made a mistake and is - ;; requesting the next multiple boundary i.e. the base may be 3 - ;; spaces and a line is indented to space 5 - this means that 6 was - ;; intended. - (if (> indent-level-size 0) - (progn - (if (> (% this-indent-size indent-level-size) 0) - (setcar (nthcdr else-body-indent-ref local-list) - (1+ (/ this-indent-size indent-level-size))) - (setcar (nthcdr else-body-indent-ref local-list) - (/ this-indent-size indent-level-size)))) - ;; else this value is now the base indent size - (setcar (nthcdr else-body-indent-ref local-list) 1) - (setq return-size this-indent-size))) - ;; either no indentation (in which case leave at the default level) or - ;; the definition may contain 'hard' space characters i.e. '@'. Convert - ;; all of these to real spaces. - (progn - ;; This is only a possibility if the first character(s) are '@' - ;; i.e. there is no need to place 'hard spaces' after any non-white - ;; space. - (if (and (not (= (length this-line) 0)) - (or (string= (substring this-line 0 1) "@") - (and (> (length this-line) 1) - (string= (substring this-line 0 2) "\\@")))) - (progn - ;; protect 'real' @'s the tradional way by preceding - ;; them with a '\' character - so just strip off that - ;; single character and proceed - (if (string= (substring this-line 0 2) "\\@") - (setq this-line (substring this-line 1 (length this-line))) - ;; else the case of @'s being used to designate hard - ;; spaces, so strip the @'s and convert them to - ;; space characters in this-line. - (let (number-ats) - ;; Not necessary to test the result - can only get - ;; here if there are leading @'s - (string-match "@+" this-line) - (setq this-line - (replace-match (make-string - (length (match-string 0 this-line)) ?\ ) - t t - this-line)))))))) - - ;; Place the text into the last element of the list. - (setcar (nthcdr else-body-text-ref local-list) this-line) - - ;; - ;; Now extract any trailing modifiers ie /PLACEHOLDER or /TOKEN - ;; - (setq this-line (match-string else-body-text-2)) - (if this-line - (cond ((string= this-line "/PLACEHOLDER") - (setcar (nthcdr else-body-type-ref local-list) ?p)) - ((string= this-line "/TOKEN") - (setcar (nthcdr else-body-type-ref local-list) ?t)) - (t - (message "Haven't covered this option yet!")))) - (setq this-line (match-string else-body-text-3)) - (if this-line - (cond ((string= this-line "/NOFOLLOW") - (setcar (nthcdr else-body-menu-follow-on-ref local-list) nil)) - ((string= this-line "/FOLLOW") - ;; this is the redundant case given the initialisation of - ;; 'local-list. - (setcar (nthcdr else-body-menu-follow-on-ref local-list) t)) - (t - (message "Haven't covered this option yet!"))))) - ;; Now return what we have "discovered". - (cons return-size local-list))) - -(defun else-extract-chk-language () - "Check and change the current language for extraction commands." - (let ((result t)) - ;; Originally tried anding this test with the current language being - ;; 'template' but that leads to some inconsistencies. Seems to make sense - ;; that the rule is: if the current buffer is an LSE file then use the - ;; language that can be calculated from the file name. - (if (string-match (concat "\\" else-lse-ext) (buffer-name)) - ;; Case where the user is editing an LSE buffer/file, so calculate - ;; the desired language based upon the name of the file/buffer - (let ((file-name-comps (split-string (buffer-name) "\\."))) - ;; Check if the file is of the form <lang>-cust.lse - (if (string-match "-cust" (car file-name-comps)) - ;; Yes, it is a custom LSE file, so split further - (progn - (setq file-name-comps (split-string - (car file-name-comps) "-cust")) - ) - ) - ;; At this point, the CAR of file-name-comps should be the - ;; language name. - (setq result (else-establish-language (car file-name-comps))) - (if (not result) - (error "Language %s is not loaded" (car file-name-comps)) - ) - ) - ) - result - ) - ) - -;; -;; Extract the "duplication" information from the template definition. Assumes -;; that the match-data information is valid! -;; -(defun else-extract-duplication-info () - (let ((this-line)) - (setq this-line - (else-strip-quotes (match-string else-body-command-2))) - (cond ((string= this-line "CONTEXT_DEPENDENT") - ?c) - ((string= this-line "VERTICAL") - ?v) - ((string= this-line "HORIZONTAL") - ?h) - (t - (throw 'compile "illegal duplication type")) - ) - ) - ) - -;; -;; Interactive command to extract an individual placeholder definition. -;; -(defun else-extract-placeholder () - "Extract the definition of a placeholder into the buffer at point." - (interactive) - (let ((selected-definition) - (current-language else-Current-Language) - (name) - (temp completion-ignore-case)) - ;; Allow a bit of flexibility here, if the user is extracting in a buffer - ;; that has language defined then operate on that language, otherwise - ;; prompt the user for a language name and then operate on that language - ;; definition. - (if (else-extract-chk-language) - (progn - (setq completion-ignore-case t) - (setq name - (completing-read "Placeholder Name: " Placeholder)) - (setq name (upcase name)) - (setq selected-definition (else-look-up name ?p)) - (if selected-definition - (else-extract-a-placeholder selected-definition) - (message "Placeholder \`%s\` doesn't exist" name) - ) - (setq completion-ignore-case temp) - ;; Restore the original language (assuming there was one) - (if current-language - (else-establish-language current-language) - ) - ) - ) - ) - ) - -(defun else-extract-runcode-component () - "Extract the run_code components - uses variables declared in caller -defun." - (let ((temp) - (tmp) - (processing-function)) - ;; Do any /RUN_CODE attributes. - (setq temp (copy-alist (get - selected-definition 'else-elisp-action))) - ;; If there are run-time encodings then have to handle the fact that one or - ;; more phases have the same function pointer. - (while temp - (setq tmp (pop temp)) - (newline) - (indent-to else-Extract-Column) - (insert (format "/RUN_CODE=%s%s" - (cdr tmp) - (car tmp))) - (setq processing-function (cdr tmp)) - ;; Now recurse through the other functions (if any) - (let ((local-copy (copy-alist temp))) - (while local-copy - (setq tmp (pop local-copy)) - (if (equal processing-function (cdr tmp)) - (progn - (insert (car tmp)) - (setq temp - (assq-delete-all (car tmp) temp))))))))) - -;; -;; Interactive command to extract and individual token definition. -;; -(defun else-extract-token () - "Extract the definition of a token into the buffer at point." - (interactive) - (let ((selected-definition) - (temp completion-ignore-case) - (name) - (current-language else-Current-Language)) - ;; Allow a bit of flexibility here, if the user is extracting in a buffer - ;; that has language defined then operate on that language, otherwise - ;; prompt the user for a language name and then operate on that language - ;; definition. - (if (else-extract-chk-language) - (progn - (setq completion-ignore-case t) - (setq name - (completing-read "Token Name: " Token)) - (setq name (upcase name)) - (setq selected-definition (else-look-up name ?t)) - (if selected-definition - (else-extract-a-token selected-definition) - (message "Token \`%s\` doesn't exist" name) - ) - (setq completion-ignore-case temp) - ;; Restore the original language (assuming there was one) - (if current-language - (else-establish-language current-language) - ) - ) - ) - ) - ) - - -;; -;; Extract the "type" information of a placeholder ie it is either a MENU, -;; TERMINAL or NONTERMINAL definition. -;; -(defun else-extract-type-info () - "Parse the /TYPE attribute of the definition" - (let ((this-match)) - (setq this-match (else-strip-quotes (match-string else-body-command-2))) - (cond ((string= this-match "MENU") - ?m) - ((string= this-match "TERMINAL") - ?t) - ((string= this-match "NONTERMINAL") - ?n) - (t (throw 'compile "illegal TYPE value"))) - ) - ) -;; -;; Get the "body" of a definition. This is a list of "strings". -;; -(defun else-get-body (element) - "Extract the 'body' of the definition." - (let () - (get element 'else-body-ref) - ) - ) - -;; -;; Extract the descriptive text ie /DESCRIPTION="...." -;; -(defun else-get-description (name type) - "Extract the /DESCRIPTION attribute" - (let ((place-def (else-look-up name type))) - (if place-def - (get place-def 'else-description-ref) - ) - ) - ) - - -;; -;; Get a definition from either the Placeholder or Token definition array -;; -(defun else-get-entry (name-string type) - "Get a definition from either the Placeholder or Token definition set" - (let ((obarray-name nil)) - (cond ((char-equal type ?t) (setq obarray-name Token)) - ((char-equal type ?p) (setq obarray-name Placeholder)) - ) - (if obarray-name - (intern name-string obarray-name) - ) - ) - ) - -(defun else-get-menu-entries (element) - "Create a list from the menu elements in this placeholder. Note that if -sub-elements are defined with menu elements, then there are options to follow or -not follow individual elements in the menu list - but these options can be -overriden by the 'else-follow-menus and 'else-nofollow-menus flags! By doing -this we avoid menus that lead to other menus ad infinitum - very boring :-)." - (let ((the-list (else-get-body element)) - (temp-list) - (this-element) - (this-def) - (ref-type) - (this-element-type) - (new-list)) - (setq temp-list the-list) - (while (> (length temp-list) 0) - (setq this-element (car temp-list)) - (setq temp-list (cdr temp-list)) - ;; This is a bit weird, but basically we want to put the current element - ;; into the new list that will be returned. The only exception to this is - ;; if the entry is itself an menu, in which case the values of that item - ;; will be substituted (depending upon /follow/nofollow and - ;; else-follow-menus settings). All items will be prepended and that way - ;; if we have to remove an element it will be easy. - (setq new-list (append (cons this-element '()) new-list)) - ;; Check if the element is a placeholder and if so, if it is a menu - ;; itself. - (setq this-element-type (elt this-element else-body-type-ref)) - (if (and this-element-type - (char-equal this-element-type ?p)) - (progn - (setq this-def (else-look-up - (elt this-element else-body-text-ref) - ?p)) - ;; guard against errors... - (if this-def - (progn - (setq ref-type (get this-def 'else-type-ref)) - ;; If the element - (if (and (equal ref-type ?m) - (not else-nofollow-menus) - (or else-follow-menus - (elt this-element else-body-menu-follow-on-ref))) - ;; There is a menu reference, so check if the placeholder - ;; being referenced is also a menu. If it is then replace - ;; this element with the elements from the referenced - ;; placeholder. - (progn - ;; Must remove the element at the head of the list as it - ;; is being replaced by this list. - (setq new-list (cdr new-list)) - (setq new-list (append (else-get-body this-def) - new-list)) - ) - ) - ) - ) - ) - ) - ) - (nreverse new-list) - ) - ) - -(defun else-in-placeholder () - "Test if `point' is within a placeholder. Validity of text string is checked - against the placeholder definition arrays. If it is a placeholder - then set up several global (buffer local) variables to save effort - elsewhere." - (let ((here (point)) - (result nil) - (start-position) - (end-position) - (stop-point) - (stop-flag)) - (save-excursion - ;; Start by determining if invoked in a token or - ;; placeholder. Placeholder's are defined as being enclosed by - ;; either a [] or {} pair. This is more complicated than it - ;; first appears because you have to make sure that any - ;; "placeholder" indicators actually enclose `point' ie don't - ;; find a placeholder earlier in the same line etc. Also, - ;; placeholders may have embedded spaces, so again, more - ;; complications. Search backward for the first occurrence of - ;; either '[', '{', whitespace or beginning of line. Things are - ;; made really messy because it is possible to have point within - ;; a placeholder that also contains another placeholder eg - ;; [[abstract] tagged]. So, we perform the scan character by - ;; character and use a "counting" system to record the "depth". - ;; - ;; Then I discovered another complication what about the case: - ;; [{discriminant_simple_name}... =>] - ;; here we have to make sure which is the "greater" placeholder - (end-of-line) - (setq stop-point (point)) - (beginning-of-line) - (setq stop-flag nil) - (while (and (< (point) here) (not stop-flag)) - (progn - (if (re-search-forward "[{[]" here t) - (progn - (backward-char) - (setq start-position (point)) - (if (not (= (else-match-brace stop-point) start-position)) - (progn - (setq end-position (point)) - (if (and (< start-position here) - (< here end-position)) - (if (else-look-up (buffer-substring - (+ start-position 1) - end-position) ?p) - (progn - (setq else-placeholder-start start-position) - (setq else-placeholder-end (1+ - end-position)) - (setq else-definition-type ?p) - - (setq else-definition-name (buffer-substring - (1+ start-position) - end-position)) - ;; record the definition for any - ;; calling routine to use. - (setq else-current-definition - (else-look-up else-definition-name ?p)) - (if (char-equal (following-char) ?}) - (setq else-Mandatory-Placeholder t) - (setq else-Mandatory-Placeholder nil) - ) - ;; Determine if the placeholder is - ;; repeating - (goto-char else-placeholder-end) - (setq else-please-duplicate - (looking-at (regexp-quote "..."))) - (setq stop-flag t) - (setq result t) - ) - (goto-char (1+ start-position)) - ) - (goto-char (1+ start-position)) - ) - ) - (goto-char (1+ start-position)) - ) - ) - (setq stop-flag t) - ) - ) - ) - ) - result - ) - ) - -(defun else-initialise-symbol (the-definition) - "Initialise a placeholder/token symbol with default values." - (put the-definition 'else-placeholder-ref '(nil nil)) - (put the-definition 'else-type-ref ?p) - (put the-definition 'else-separator-ref "") - (put the-definition 'else-substitute-ref ?n) - (put the-definition 'else-duplication-ref ?c) - (put the-definition 'else-topic-ref nil) - (put the-definition 'else-description-ref "") - (put the-definition 'else-body-ref nil) - (put the-definition 'else-substitute-count-ref 1) - (put the-definition 'else-original-name "") - (put the-definition 'else-elisp-action '())) - -(defun else-kill-placeholder (&optional leave-spacing force dont-kill-empty-lines) - "Kill the current placeholder. Wrapper for else-delete-placeholder, calls the -lower level defun continuously in cases where the placeholder is defined as an -auto-substitute placeholder." - (interactive "i\nP") - (let ((current-location (point)) - (loop-counter) - (is-auto-sub) - (here) - (stop-loop)) - ;; Verify we are with a placeholder. - (if (else-in-placeholder) - ;; Only proceed if the conditions are right..... - (if (or (not else-Mandatory-Placeholder) force) - (progn - ;; If the definition is an "auto-substitute" then we have to - ;; find the matching occurrences and delete them also..... - (setq is-auto-sub (char-equal - (get else-current-definition - 'else-substitute-ref) - ?a)) - (if is-auto-sub - (progn - (setq loop-counter (get else-current-definition - 'else-substitute-count-ref)) - (setq stop-loop nil) - (while (and (not stop-loop) - (> loop-counter 0)) - (if (search-forward else-definition-name nil t) - (progn - ;; position back into the placeholder and then - ;; kill it (even if it is mandatory). - (backward-char) - ;; Next call just sets up all of the global - ;; variables so that the text can be deleted - - ;; don't use a kill-placeholder here because - ;; it would destroy the information that is - ;; required to be kept..... - (if (else-in-placeholder) - (progn - (else-delete-placeholder leave-spacing - force - dont-kill-empty-lines) - (setq loop-counter (1- loop-counter)) - ) - ) - ) - ;; There are no more occurrences of the placeholder - ;; name so stop the search. - (setq stop-loop t) - ) - ) - ) - ) - ;; Now locate back into the original placeholder and - ;; delete it - this returns all global variables to - ;; their original state as the same time. - (goto-char current-location) - (else-in-placeholder) - (else-delete-placeholder leave-spacing - force - dont-kill-empty-lines) - ;; Check to see whether we should auto-position to the - ;; next placeholder or not. This is mainly useful for - ;; the VR folks so it is a customisable flag. - (if (and else-kill-proceed-to-next-placeholder (interactive-p)) - (if else-only-proceed-within-window - (progn - (setq here (point)) - (else-move-n-placeholders 1) - ;; Only move to the new placeholder if it is - ;; visible in the current window i.e. we don't - ;; want the user to become disorientated by a - ;; large jump. - (if (not (pos-visible-in-window-p)) - (goto-char here) - ) - ) - ;; otherwise just default to move to the next placeholder. - (else-next-placeholder 1) - ) - ) - ) - (error "Can't delete - mandatory entry required") - ) - ;; Failed to delete because not in a placeholder - check if desired - ;; behaviour is to find the next(previous) placeholder and kill that - ;; instance. - (if (and else-move-and-execute (interactive-p)) - ;; User must desire to kill the next placeholder. So save them - ;; the trouble of moving and killing as two separate actions. - (progn - (if else-direction - (else-next-placeholder) - (else-previous-placeholder) - ) - (else-kill-placeholder) - ) - ) - ) - ) - ) - -;; -;; Load a template definition file and "compile" it. -;; -(defun else-load-template () - "Load a language definition file and compile it." - (let ((lang-def-buffer) - (language-file-name) - (result nil) - (language-name) - (found-template-name nil) - (auto-mode-alist nil) - (template-file-loaded nil)) - (progn - (catch 'quit-loading - ;; It is possible for the user to have an auto-mode-alist - ;; entry for files of .lse type that will enable else-mode and - ;; load the language templates for .lse files - this causes a - ;; mix-up in the Placeholder/Token definitions if this - ;; happens. So temporarily disable the entry if it exists in the - ;; auto-mode-alist when we are auto-loading .lse files - - ;; re-enable it at the end of this function. Note that this is - ;; done using the "let" definition for auto-mode-list above. - - ;; Extract the mode-name and use that as the default template file - ;; name - (setq language-name mode-name) - ;; Mode name "may" have spaces, modify them to '-' i.e. Visual - ;; Basic becomes Visual-Basic. - (while (string-match " " language-name) - (setq language-name (replace-match "-" t nil language-name)) - ) - (setq language-file-name (else-locate-language-file language-name)) - (if (not language-file-name) - (progn - ;; - ;; The file doesn't exist, so maybe its a case of the file - ;; attribute not reflecting the language type. So ask the user. - ;; - (setq language-name - (read-from-minibuffer - "Enter the language name (no file extensions, please): ")) - (if (cdr (assoc language-name else-Language-Definitions)) - (progn - ;; The language is already loaded, so set the local buffer - ;; language name and discontinue processing. - (setq else-Current-Language language-name) - (setq result t) - (throw 'quit-loading t) - ) - ;; Otherwise, check if a file of that name exists. - (setq language-file-name (else-locate-language-file language-name)) - ) - ) - ) - ;; At this point we have either skipped early (throw to 'quit-loading) - ;; because we already have the language loaded for another buffer or we - ;; have either found the file or not. - (if language-file-name - ;; Load the definition file and compile it - (progn - (save-excursion - ;; Guard against deleting a file that already is loaded into the - ;; current edit session. This 'flag' is used to determine - ;; whether kill-buffer is called or not before defun - ;; exit. - (setq template-file-loaded - (else-is-template-file-present language-file-name)) - (setq lang-def-buffer - (find-file-noselect language-file-name)) - (set-buffer lang-def-buffer) - ;; Make sure we are at the beginning of the buffer. This is done - ;; because there may be packages such as session.el active. - (goto-char (point-min)) - ;; Have to make a choice based on what type of file we are - ;; dealing with. - (if (string-match else-esl-ext language-file-name) - (setq result (else-restore language-name)) - (setq result (else-compile-buffer)) - - ) - ;; Only delete the buffer if we had to load it explicitly, - ;; otherwise leave it alone. - (if (and result (not template-file-loaded)) - ;; Only want to clean up when it succeeded, otherwise the - ;; user probably wants to see the error line. - (kill-buffer lang-def-buffer) - ) - ;; Now load any customisation files. This works by changing the - ;; name to the form of <language-name>-cust.lse and then - ;; searches first the local directory and then the load path. - (setq language-file-name (else-locate-language-file - (concat language-name "-cust.lse") - t)) - (if language-file-name - (progn - (setq template-file-loaded - (else-is-template-file-present language-file-name)) - (setq lang-def-buffer - (find-file-noselect language-file-name)) - (set-buffer lang-def-buffer) - - ;; Make sure we are at the beginning of the buffer. This - ;; is done because there may be packages such as - ;; session.el active. - (goto-char (point-min)) - - ;; compile the customisation buffer, for the moment, just - ;; ignore the return of the compilation ie it doesn't - ;; matter at the moment. - (if (not (else-compile-buffer)) - (message "Compile of custom file %s failed." - language-file-name) - ) - (if (not template-file-loaded) - (kill-buffer lang-def-buffer) - ) - ) - ) - ) - ) - ) - ) - (if result - (progn - ;; It is possible that the 'language-name' is actually an - ;; entered file name and isn't actually the name of the - ;; language template loaded. If this is the case, then the - ;; entered language name may be radically case different - ;; from the actual language name as defined in the - ;; template file i.e. TEMPLATE versus template. So make - ;; the basic assumption that there will be only one - ;; language name, doesn't matter what the casing is. - (if (not (cdr (assoc language-name - else-Language-Definitions))) - (progn - ;; Look for it - (assoc-default language-name - else-Language-Definitions - 'else-test-key) - (setq language-name found-template-name) - ) - ) - (setq else-Current-Language language-name) - ) - ) - result - ) - ) - ) - -(defun else-test-key (element-car key) - "Used by else-load-template to locate a language template set." - (let (index) - (setq index (string-match (upcase element-car) - (upcase key))) - - ;; Return the results - (if (and (= index 0) (= (length element-car) (length key))) - (setq found-template-name element-car) - ) - ) - ) - - - -(defun else-locate-language-file (name &optional check-local-dir-first) - "Search the load-path looking for a language definition file. -Precedence is given to `fast-load' versions ie .esl." - (let ((load-point nil)) - (progn - (if (or (string-match (concat "\\" else-lse-ext) name) - (string-match (concat "\\" else-esl-ext) name)) - ;; OK, has the extension name present, so use that as the search - ;; locus. - (progn - (setq load-point (else-search-load-path name - check-local-dir-first)) - (if (string-match (concat "\\" else-esl-ext) name) - (else-check-language-file load-point) - ) - ) - ;; The name wasn't supplied with an extension, so try fast load first - ;; and then slow load last. - (setq load-point (else-search-load-path (concat name else-esl-ext) - check-local-dir-first)) - (if (not load-point) - (setq load-point (else-search-load-path (concat name - else-lse-ext) - check-local-dir-first)) - (else-check-language-file load-point) - ) - ) - load-point - ) - ) - ) - -(defun else-look-up (name-string type &optional ignore-forward-refs) - "Look-up the definition of a placeholder/token called NAME-STRING. -'ignore-forward-refs allows functions like 'else-kill-placeholder to -stop the forwarding referrals i.e. we wish to kill what is there not -what might have been there :-)." - (let ((obarray-name nil) - definition) - (cond ((char-equal type ?t) (setq obarray-name Token)) - ((char-equal type ?p) (setq obarray-name Placeholder)) - ) - (if obarray-name - (progn - (setq definition - (intern-soft (upcase name-string) obarray-name)) - ;; Now check to see if it is a "forward" reference - (if (and (not ignore-forward-refs) - (char-equal type ?p) - (car (get definition 'else-placeholder-ref))) - ;; there is a forward reference - (else-look-up (car - (cdr - (get definition 'else-placeholder-ref))) - ?p) - definition - ) - ) - (message "Look-up error, type not defined for \`%s\`" name-string) - ) - ) - ) - -(defun else-match-brace (&optional limit) - (interactive) - (let ((close-brace) - (open-brace) - (match-character) - (search-back) - (search-string) - (stop-flag) - (total-count 1) - (current-pos (point))) - (setq match-character (following-char)) - (cond ((char-equal match-character ?\}) - (setq search-back t) - (setq open-brace ?\{)) - ((char-equal match-character ?\]) - (setq search-back t) - (setq open-brace ?\[)) - ((char-equal match-character ?\)) - (setq search-back t) - (setq open-brace ?\()) - ((char-equal match-character ?\{) - (setq search-back nil) - (setq close-brace ?\})) - ((char-equal match-character ?\[) - (setq search-back nil) - (setq close-brace ?\])) - ((char-equal match-character ?\() - (setq search-back nil) - (setq close-brace ?\))) - (t (message "Not on a valid brace character")) - ) - (if search-back ; looking for opening brace - (progn - (setq close-brace match-character) - (setq stop-flag nil) - (while (and (not (= total-count 0)) (not stop-flag)) - (setq search-string - (concat "[" - (char-to-string close-brace) - (char-to-string open-brace) - "]")) - (if (re-search-backward search-string limit t) - (if (char-equal (following-char) open-brace) - (setq total-count (- total-count 1)) - (setq total-count (+ total-count 1)) - ) - (progn - (if (not limit) - (message "Match search failed!") - ) - (goto-char current-pos) - (setq stop-flag t) - ) - ) - ) - ) - (progn ;; Else case, ie looking for a closing brace - (setq open-brace match-character) - ;; Don't want to include the character we are on when searching starts - ;; so move forward one character position. - (forward-char) - (setq stop-flag nil) - (while (and (not (= total-count 0)) (not stop-flag)) - (setq search-string - (concat "[" - (char-to-string close-brace) - (char-to-string open-brace) - "]")) - (if (re-search-forward search-string limit t) - (if (char-equal (preceding-char) close-brace) - (setq total-count (- total-count 1)) - (setq total-count (+ total-count 1)) - ) - (progn - (if (not limit) - (message "Match search failed!") - ) - (goto-char current-pos) - (setq stop-flag t) - ) - ) - ) - (if (char-equal (preceding-char) close-brace) - (backward-char) - ) - ) - ) - (point) - ) - ) - - -;; -;; Block out forward and backward char motion. -;; -(defun else-menu-block-movement () - ;; [Documentation] - (interactive) - (let () - ) - ) - -;; -;; Next line in the menu, wraps when moving past last line -;; -(defun else-menu-previous-line () - ;; [Documentation] - (interactive) - (let () - (progn - (if (not (= (point) (point-min))) - (progn - (backward-char) - (beginning-of-line) - ) - (progn - (goto-char (1- (point-max))) - (beginning-of-line) - ) - ) - ) - ) - ) - -;; -;; Quit the menu pick list processing. -;; -(defun else-menu-quit () - "Quit from the menu pick list." - (interactive) - (let () - (setq else-selected-text nil) - (exit-recursive-edit) - ) - ) - -;; -;; Next line in the menu, wraps when moving past last line -;; -(defun else-menu-next-line (&optional n) - ;; [Documentation] - (interactive "p") - (let ((count (or n 1))) - (progn - (while (> count 0) - (end-of-line) - (if (not (= (point) (1- (point-max)))) - (forward-char) - (goto-char (point-min)) - ) - (setq count (1- count)) - ) - ) - ) - ) - -(defun else-extract-item (menu-text) - "Extract the menu data from a menu line item. Each menu item is -encoded with extraneous information for display to the user i.e. {}'s, -description text etc" - (let ((result "") - (start-char)) - (save-match-data - ;; Get the first character in the line - this will determine - ;; what type of information is to be extracted i.e. a - ;; placeholder will have a '{' character, a token or direct text - ;; substitution will have a quote character - (setq start-char (elt menu-text 0)) - (cond ((char-equal start-char ?\") - ;; Find the last occurrence of a " character..... - (string-match "\".*\"+" menu-text 0) - (setq result (substring menu-text 1 - (1- (match-end 0))))) - ((char-equal start-char ?{) - ;; The menu item is a placeholder, so select text between - ;; {}'s - (setq result (substring menu-text 1 (string-match "}" menu-text)))) - (t - (setq result (substring menu-text 1 (1- (length menu-text))))) - ) - result - ) - ) - ) - -;; -;; Select the pick item at `point'. -;; -(defun else-menu-select () - "Select the menu pick item at `point'." - (interactive) - (let ((start-pos)) - (save-excursion - (beginning-of-line) - (setq start-pos (point)) - (end-of-line) - (setq else-selected-text (else-extract-item - (buffer-substring start-pos - (point)))) - (message "%s" (buffer-substring start-pos - (point))) - ) - (exit-recursive-edit) - ) - ) - -(defun else-mode (&optional arg) - "Invoke ELSE mode for the current buffer. -Keybindings: -\\{else-menu-mode-map}" - (interactive) - (let ((language-assoc nil) - (name) - (did-it-work t)) - (progn - (setq else-mode - (if (null arg) - (not else-mode) - (> (prefix-numeric-value arg) 0) - )) - (if else-mode - (progn - ;; Make sure that the Xemacs variables are established. This code is - ;; not guarded - it doesn't hurt FSF Emacs. - (if (not (markerp else-move-to-position)) - (setq else-move-to-position (make-marker)) - ) - ;; Make sure the flag used by the after-change function is reset - ;; (should never be set at this point anyway). - (setq else-move-change nil) - - (setq else-Auto-Sub-Active nil) - ;; Initialise the auto substitute marker list. The marker in this - ;; list are set to nowhere when they are not active. The structure - ;; of the list is (n (f . b) ...) where n is the number of marker - ;; pairs and (f . b) is a marker pair where f is the front marker - ;; and b is the back marker. This list can grow as required, but - ;; will set it to a value that should be reasonable for most - ;; applications. - (if (not else-Auto-Sub-Marker-List) - (setq else-Auto-Sub-Marker-List - (list 6 - (cons (make-marker) (make-marker)) - (cons (make-marker) (make-marker)) - (cons (make-marker) (make-marker)) - (cons (make-marker) (make-marker)) - (cons (make-marker) (make-marker)) - (cons (make-marker) (make-marker)))) - ) - - ;; Check if a language is loaded for the buffer - (if else-Current-Language - (progn - (setq name else-Current-Language) - (setq language-assoc (cdr (assoc name - else-Language-Definitions))) - ) - ;; Possible that the language is already loaded for another - ;; buffer so check using the mode-name. - (setq language-assoc (cdr (assoc mode-name - else-Language-Definitions))) - ) - (setq did-it-work - (catch 'foo - (if (not language-assoc) - (progn - (if (else-load-template) - (progn - (setq name else-Current-Language) - (setq language-assoc - (cdr - (assoc name else-Language-Definitions))) - ) - ;; It didn't work, so bail out - (throw 'foo nil) - ) - ) - ;; Yes, the language is already loaded so make - ;; sure we set the following variable! - (setq else-Current-Language mode-name) - ) - (setq Placeholder (car language-assoc)) - (setq Token (car (cdr language-assoc))) - (setq Language-Specifics (car (cdr (cdr language-assoc)))) - (else-setup-change-hooks) - - (if (= (buffer-size) 0) - (progn - (insert (cdr (assoc else-Initial-String-ref - Language-Specifics))) - (goto-char 0) - (else-next-placeholder) - ) - ) - ;; Add ELSE to the status bar. - (or (assq 'else-mode minor-mode-alist) - (setq minor-mode-alist - (cons '(else-mode " ELSE") minor-mode-alist))) - ;; Set the "self-insert" character array for the buffer - ;; ie. else-before-change checks whether a command is a - ;; "self-insert" character using the language - ;; attributes. We do this to maintain compatibility with - ;; Emacs 19.X (note, Elisp change after 19.29 means that - ;; only 19.29 -> will work). - (else-set-self-insert-vector) - ;; Set the result to t, ie we have successfully found - ;; a language template. - t - ) - ) - (if (not did-it-work) - ;; Things didn't work, so make sure that the mode is not - ;; falsely enabled. - (setq else-mode (not else-mode)) - ;; Otherwise, make sure some simple commands are set up in the - ;; ELSE menu keymap. - (progn - (else-enable-dups else-menu-mode-map - 'else-expand-placeholder 'else-menu-select) - (else-enable-dups else-menu-mode-map - 'next-line 'else-menu-next-line) - (else-enable-dups else-menu-mode-map - 'previous-line 'else-menu-previous-line) - (else-enable-dups else-menu-mode-map 'forward-char 'undefined) - (else-enable-dups else-menu-mode-map 'backward-char 'undefined) - - ;; Now setup the minor mode map. Note the 'or' will - ;; "short-circuit" if the first form evaluates to 'true'. - (or (assq 'else-mode minor-mode-map-alist) - (setq minor-mode-map-alist - (cons (cons 'else-mode else-mode-key-map) - minor-mode-map-alist))) - ) - ) - ) - ;; - ;; Else the mode has just been toggled off so clean up on things. - ;; - (else-mode-clean-up) - ) - ;; Return the result to the caller - did-it-work - ) - ) - ) - -;; -;; Do a clean up. Consists of deleting buffer local variables and removing -;; functions from various change hooks. -;; -(defun else-mode-clean-up () - (let ((sub-length)) - ;; Set the auto sub marker list to point to nowhere - (if else-Auto-Sub-Marker-List - (progn - (setq sub-length (car else-Auto-Sub-Marker-List)) - (while (> sub-length 0) - (set-marker (car (nth sub-length else-Auto-Sub-Marker-List)) - nil) - (set-marker (cdr (nth sub-length else-Auto-Sub-Marker-List)) - nil) - (setq sub-length (1- sub-length)) - ) - ) - ) - - (setq else-Auto-Sub-Active nil) - (kill-local-variable 'else-Auto-Sub-Active) - (kill-local-variable 'else-Auto-Sub-Marker-List) - (kill-local-variable 'else-Current-Language) - (kill-local-variable 'else-mode) - (kill-local-variable 'Placeholder) - (kill-local-variable 'Token) - (kill-local-variable 'Language-Specifics) - (kill-local-variable 'else-Current-Language) - - (remove-hook 'before-change-functions - 'else-before-change - t) - (remove-hook 'after-change-functions - 'else-after-change - t) - - ) - ) - - -(defun else-move-n-placeholders (&optional arg) - "Move forward or backward (determined by 'else-direction) 'n placeholders." - (interactive "p") - (if else-direction - (else-next-placeholder arg) - (else-previous-placeholder arg) - ) - ) - -;; -;; Position `point' in the next available placeholder. -;; -(defun else-next-placeholder (&optional n) - "Position `point' in the next available placeholder." - (interactive "p") - (let ((origin (point)) - (no-more nil) - (target-pos) - (target-count) - (count (or n 1))) - - (catch 'problem - (if (not else-mode) - (progn - (error "ELSE mode not enabled.") - (throw 'problem nil) - ) - ) - - (setq target-count count) - ;; Now move forward "n" placeholders. Will stop at the last one found if - ;; there are less than "n". Note that we use else-placeholder-start and - ;; else-placeholder-end in this routine. - (while (and (not no-more) (> count 0)) - (if (re-search-forward "[[{]" nil t) - (progn - (if (else-scan-for-match "[]}]" nil) - (progn - (backward-char 2) - (if (else-in-placeholder) - (setq count (1- count)) - (forward-char 2) - ) - ) - ) - ) - (setq no-more t) - ) - ) - ;; User may have asked to go forward more placeholders than exist, so - ;; either stop when the requested count is reached or position to the last - ;; one located. If we matched all of the requested placeholders then count - ;; will be 0, if we ran out of placeholders but still managed to find at - ;; least one (as manifested by (not (= count target-count)) then position - ;; point to the last placeholder found. - (if (or (= count 0) (not (= count target-count))) - ;; position mid-way in the placeholder - (setq target-pos (+ else-placeholder-start - (/ (- else-placeholder-end else-placeholder-start) - 2))) - (setq target-pos origin) - ) - (goto-char target-pos) - ;; If found a new placeholder to go to, set the overlay onto it - (if (and else-experimental-code-flag - (not (equal origin target-pos))) - (else-set-overlay-here) - ) - ;; Callers expect to be told the whether the function succeeded - ;; or not by testing whether point has moved - not a very good - ;; idea at all! - target-pos - ) - ) - ) - -;; -;; Move `point' to the previous placeholder. -;; -(defun else-previous-placeholder (&optional n) - "Move `point' to any previously available placeholder." - (interactive "p") - (let ((origin (point)) - (no-more nil) - (target-pos) - (target-count) - (count (or n 1))) - - (catch 'problem - (if (not else-mode) - (progn - (error "ELSE mode not enabled.") - (throw 'problem nil) - ) - ) - - (setq target-count count) - ;; This bit of code makes sure that we get out of any "current" - ;; placeholder i.e. otherwise we won't move. - (if (else-in-placeholder) - (progn - ;; Find the beginning of a placeholder string - (else-scan-for-match "[[{]" nil t) - ;; step back onto the actual character of the placeholder in - ;; preparation for the next backward search. - (if (> (point) (+ (point-min) 2)) - (backward-char 2) - ) - ) - ) - ;; Now position to the count'th placeholder - (while (and (> count 0) (not no-more)) - ;; Locate the start of a brace or bracket and then test if it is a - ;; placeholder. Continue this process until either a valid placeholder - ;; has been found or the search has hit up against the beginning of - ;; buffer - (if (re-search-backward "[[{]" nil t) - (progn - (forward-char 1) - ;; Test if in a valid placeholder. - (if (else-in-placeholder) - (setq count (1- count)) - ) - ;; always go back one character to make sure we are not still in - ;; the placeholder. - (backward-char 1) - ) - ;; search has failed, so we must be up against the beginning of buffer. - (setq no-more t) - ) - ) - ;; User may have asked to go backward for more placeholder than exist, so - ;; either stop when the count is reached or position to the last one - ;; located. If we matched all of the requested placeholders then count - ;; will be 0, if we ran out of placeholders but still managed to find at - ;; least one (as manifested by (not (= count target-count)) then position - ;; point to the last placeholder found. - (if (or (= count 0) (not (= count target-count))) - (setq target-pos (+ else-placeholder-start - (/ (- else-placeholder-end - else-placeholder-start) 2))) - (setq target-pos origin) - ) - (goto-char target-pos) - - ;; If found a new placeholder to go to, set the overlay onto it - (if (and else-experimental-code-flag - (not (equal origin target-pos))) - (else-set-overlay-here) - ) - ) - ) - ) - - - -;; -;; This routine is called to process the placeholder/token depending upon -;; the definition of the element. -;; -(defun else-process-definition (element def-type) - (let ((body-list) - (service-type) - (selected-element) - (result t) - (selected-type) - (dummy) - (placeholder-reference) - (place-name) - (action-struct (get element 'else-elisp-action))) - ;; Check for /BEFORE processing - note the protection against an elisp - ;; function that is not defined. - (condition-case err - (if (assoc else-before-key action-struct) - (funcall (intern-soft (cdr (assoc else-before-key - action-struct))))) - (void-function - (message "Symbol's function definition is void: %s" - (cdr (assoc else-before-key action-struct)))) - (error - (message "%s" (error-message-string err)))) - - (if (char-equal def-type ?p) - (progn - (setq service-type (get element 'else-type-ref)) - (cond ((char-equal service-type ?m) - (progn - (setq dummy (else-get-menu-entries element)) - ;; Display the menu choices to the user - (else-display-menu dummy) - - ;; Now have to search out which entry in the menu body of - ;; the definition. The interesting aspect of this is that we - ;; have a list consisting of 'body elements' i.e. a list of - ;; data and the text of the selected item. However, the text - ;; is just one of the elements in a 'body element' object. So - ;; the code has to search the list of body elements looking - ;; for an element that contains the selected textual string. - (if else-selected-text - (progn - (setq body-list dummy) - (while (not (string= - else-selected-text - (nth else-body-text-ref - (car body-list)))) - (setq body-list (cdr body-list))) - (setq selected-type (nth else-body-type-ref - (car body-list))) - ;; if its a /placeholder or /token then look-up - ;; otherwise it must be a text substitution. - (if selected-type - (setq selected-element - (else-look-up else-selected-text - selected-type)) - (setq selected-element nil)) - (if selected-element - (setq result (else-process-definition - selected-element - (nth else-body-type-ref - (car body-list)))) - (else-substitute else-selected-text nil))) - ;; - ;; Else no menu element selected (User quit or - ;; something) - ;; - (setq result nil)))) - ((char-equal service-type ?n) - (else-substitute element def-type)) - ((char-equal service-type ?t) - ;; Display the prompt string to the user - (else-display-menu (else-get-body element) t) - (setq result nil)))) - ;; else case, the definition must be a token. There are two - ;; possibilities here, the token may be just referencing a - ;; placeholder or it may contain "self-insert" lines of text. - (setq placeholder-reference (get element 'else-placeholder-ref)) - ;; Check if there is a forward reference to a placeholder - (if (car (cdr placeholder-reference)) - (progn - (setq place-name (car (cdr placeholder-reference))) - (if (else-look-up place-name ?p) - (else-process-definition (else-look-up place-name ?p) ?p))) - ;; else there is not a forward reference, so process the - ;; 'body' of element - (else-substitute element def-type))) - (if result - ;; Check for /BEFORE processing - (condition-case err - (if (assoc else-after-key action-struct) - (funcall (intern-soft (cdr (assoc else-after-key - action-struct))))) - (void-function - (message "Symbol's function definition is void: %s" - (cdr (assoc else-after-key action-struct)))) - (error - (message "%s" (error-message-string err))))) - result)) - -;; -;; This routines reads a placeholder/token definition from the current buffer, -;; it assumes that the match-data contains a successful result of searching -;; for a definition command sequence. -;; -(defun else-read-a-definition () - (let ((definition-type nil) - (definition-complete nil) - (definition-name) - (this-line) - (this-definition nil) - (already-exists nil) - (language-name "") - (current-language else-Current-Language) - (defining-type) - (original-name "") - (action-struct '()) - (elisp-function-name) - (body-text-info (cons 0 nil))) - - ;; Get the definition type ie either PLACEHOLDER, TOKEN or LANGUAGE - (setq defining-type (match-string else-defining-type)) - (cond ((string= defining-type "PLACEHOLDER") - (setq definition-type ?p)) - ((string= defining-type "TOKEN") - (setq definition-type ?t)) - ((string= defining-type "LANGUAGE") - (else-read-language-definition)) - (t - ;; Note this error will never be thrown as the string - ;; matching precludes catching errors in this line... - (throw 'compile "illegal definition type"))) - (if definition-type - (progn - ;; - ;; Grab the definition name then move on - ;; - (setq original-name - (else-strip-quotes (match-string else-defining-name))) - (setq definition-name (upcase original-name)) - ;; - ;; Must extract the "Language" for which the definition is being made - ;; so extract the Language name and set the appropriate variables - ;; prior to any other operations - (forward-line) - (if (else-scan-for-match else-body-string nil) - (progn - (setq this-line (match-string else-body-command-1)) - (if (string= this-line "/LANGUAGE=") - (progn - (setq language-name - (else-strip-quotes - (match-string else-body-command-2))) - (if (else-establish-language language-name) - (progn - (if (else-look-up definition-name definition-type) - ;; The definition already exists, but also have - ;; to checked if 'deleted' - (if (else-look-up definition-name - definition-type) - (progn - (message "\`%s\` already exists!" - definition-name) - (setq already-exists t) - ) - ) - ) - ) - (message "Language definition \`%s\` doesn't exist!" - language-name) - ;; Want to stop the processing at this point, - ;; so use already-exists - (setq already-exists t) - ) - ) - ) - ) - ) - (if (not already-exists) - (progn - ;; Get an entry in the appropriate obarray for the definition - (setq this-definition (else-get-entry - definition-name definition-type)) - - ;; Now process the "body" of the template definition - before - ;; doing though, create the data structure that will hold the - ;; various members of a definition etc - these will have - ;; "default" values and that way if a user decides not to - ;; specify something there will be no "errors" later on. - (else-initialise-symbol this-definition) - - ;; save the original-name - (put this-definition 'else-original-name original-name) - - (forward-line) - (while (and (not definition-complete) - (not (= (point) (point-max)))) - (progn - (if (else-scan-for-match else-body-string nil) - (progn - (cond - ((setq this-line (match-string else-body-command-1)) - ;; Have a line of the form /[...]=, so process it. - (cond ((string= this-line "/DUPLICATION=") - (put this-definition 'else-duplication-ref - (else-extract-duplication-info))) - - ((string= this-line "/SEPARATOR=") - (put this-definition 'else-separator-ref - (else-strip-quotes - (match-string else-body-command-2)))) - - ((string= this-line "/DESCRIPTION=") - (put this-definition 'else-description-ref - (else-strip-quotes - (match-string else-body-command-2)))) - - ((string= this-line "/TYPE=") - (put this-definition 'else-type-ref - (else-extract-type-info))) - - ((string= this-line "/PLACEHOLDER=") - (put this-definition 'else-placeholder-ref - (list t (else-strip-quotes - (match-string else-body-command-2))))) - - ((string= this-line "/SUBSTITUTE_COUNT=") - (put this-definition 'else-substitute-count-ref - (string-to-number - (else-strip-quotes - (match-string else-body-command-2)))) - (if (equal (get this-definition - 'else-substitute-count-ref) 0) - (throw - 'compile "illegal value for substitute count") - )) - ((string= this-line "/RUN_CODE=") - (setq elisp-function-name - (format "%s" (match-string - else-body-command-2))) - (setq this-line (match-string - else-body-command-3)) - ;; Now do a series of if statements based - ;; upon the options - they may all be set - (if (string-match else-before-key this-line) - (push (cons else-before-key - elisp-function-name) - action-struct)) - (if (string-match else-after-key this-line) - (push (cons else-after-key - elisp-function-name) - action-struct)) - (if (string-match else-oninsert-key this-line) - (push (cons else-oninsert-key - elisp-function-name) - action-struct))))) - ((setq this-line (match-string else-body-command-4)) - (cond ((string= this-line "/NOAUTO_SUBSTITUTE -") - (put this-definition 'else-substitute-ref ?n)) - ((string= this-line "/AUTO_SUBSTITUTE -") - (put this-definition 'else-substitute-ref ?a)) - )) - ((setq this-line (match-string else-body-text-1)) - (setq body-text-info - (else-extract-body (car body-text-info))) - (put this-definition 'else-body-ref - (cons (cdr body-text-info) - (get this-definition 'else-body-ref)))) - ((setq this-line (match-string else-body-end)) - (setq definition-complete t))))) - (forward-line))) ; Go to the start of the next line. - - ;; Definition is now complete - the action-struct hasn't been - ;; put into the definition as yet though, so do that now. - (put this-definition 'else-elisp-action - (reverse (copy-alist action-struct))) - - ;; reverse the body list - (if (get this-definition 'else-body-ref) - (put this-definition 'else-body-ref - (reverse (get this-definition 'else-body-ref)))))) - - ;; restore the 'original' language i.e. might have template language - ;; enabled for a .lse file that contains definitions for some other - ;; language - so compiling a definition shouldn't destroy the - ;; current language settings for the buffer. - (else-establish-language current-language) - ) - ) - ) - ) - - -;; -;; Read or process the language definition of a template language. -;; -(defun else-read-language-definition () - "Parse a language definition statement." - (let ((language-name "") - (current-language else-Current-Language) - (definition-complete nil) - (this-line) - (tab-size-specified nil)) - (progn - (setq language-name - (else-strip-quotes (match-string else-defining-name))) - ;; Check if there is a set of existing definitions for this - ;; language, if not then create a blank set of variables. - (if (else-check-and-init-globals language-name) - (message "Language %s exists, assuming attribute modification" - language-name) - ) - - ;; The caller may be defining an entirely new language definition or - ;; just modifying attributes of a current definition. In both cases we - ;; will modify the attributes of the language definition that - ;; was set by the previous call. This allows the overriding of - ;; attributes such as indentation setting in the users - ;; customisation file. - (else-establish-language language-name) - - (forward-line) - (while (and (not definition-complete) - (not (= (point) (point-max)))) - (progn - (if (else-scan-for-match else-body-string nil) - (progn - (setq this-line (match-string else-body-command-1)) - (if this-line - (cond ((string= this-line "/INITIAL_STRING=") - (setcdr (assoc else-Initial-String-ref - Language-Specifics) - (else-strip-quotes - (match-string else-body-command-2)))) - ((string= this-line "/PUNCTUATION_CHARACTERS=") - (setcdr (assoc else-Punctuation-ref - Language-Specifics) - (else-strip-quotes - (match-string else-body-command-2))) - (setcdr (assoc else-Punctuation-Length-ref - Language-Specifics) - (length (cdr (assoc else-Punctuation-ref - Language-Specifics))))) - ((string= this-line "/SELF_INSERT_CHARACTERS=") - (setcdr (assoc else-Self-Insert-Characters-ref - Language-Specifics) - (else-strip-quotes - (match-string else-body-command-2))) - (setcdr (assoc else-Self-Insert-Characters-Length-ref - Language-Specifics) - (length (cdr (assoc else-Self-Insert-Characters-ref - Language-Specifics))))) - ((string= this-line - "/VALID_IDENTIFIER_CHARACTERS=") - (setcdr (assoc else-Valid-Idents-ref - Language-Specifics) - (else-strip-quotes - (match-string else-body-command-2))) - (setcdr (assoc else-Valid-Idents-Length-ref - Language-Specifics) - (length (cdr (assoc else-Valid-Idents-ref - Language-Specifics))))) - ((string= this-line - "/INDENT_SIZE=") - ;; Expect a numerical value here. - (setcdr (assoc else-tab-size-ref - Language-Specifics) - (string-to-number - (else-strip-quotes - (match-string - else-body-command-2)))) - (setq tab-size-specified t)) - ((string= this-line - "/VERSION=") - (setcdr (assoc else-language-version-ref - Language-Specifics) - (else-strip-quotes - (match-string else-body-command-2)))) - (t - (throw 'compile - "language specifier not recognised")) - ) - ;; The else case, there is either an error or its the - ;; language definition end command, which is tested - ;; purely by something being in else-body-end slot - ;; of the match-data. - (if (match-string else-body-end) - (progn - (setq definition-complete t) - ;; Check to see if a /INDENT_SIZE attribute - ;; was specified or not, issue a warning - ;; message if not - (if (not tab-size-specified) - (message "/INDENT_SIZE not specified assuming %s spaces" - (cdr (assoc else-tab-size-ref - Language-Specifics))) - ) - ) - (throw 'compile "Unknown Error") - ) - ) - ) - ) - ) - (forward-line) ; Go to the start of the next line. - ) - ;; restore the 'original' language i.e. might have template - ;; language enabled for a .lse file that contains definitions - ;; for some other language - so compiling a definition shouldn't - ;; destroy the current language settings for the buffer. - (else-establish-language current-language) - ) - ) - ) - -;; This routine is called after the process has defined a definition which -;; should replace the placeholder/token being replaced. It assumes that the -;; string being expanded has been deleted and placed into the -;; else-deleted-string variable. -;; -;; Add some basic code here that makes sure Context_dependent work better! -;; ie -;; if <<there is nothing else preceeding the placeholder>> AND -;; <<we can locate a separator string immediately preceeding>> then -;; Vertical substitution is appropriate -;; else -;; Perform Horizontal substitution -;; end if -;; -(defun else-replicate-placeholder-string (duplication-type - indent-column - element-def) - (let ((separator-type) - (newline-at-start) - (cur-column indent-column)) - (progn - ;; Extract the separator string, test whether it contains a ^M - ;; at the beginning and then split it across any embedded ^M's - ;; to create a list of separator texts - I imagine this later - ;; case will almost never happen? - (setq separator-type (get element-def 'else-separator-ref)) - - ;; Test for leading newline - - (if (> (length separator-type) 0) - (setq newline-at-start (char-equal (aref separator-type 0) ?\r)) - (setq newline-at-start nil) - ) - - (cond ((char-equal duplication-type ?v) - ;; (setq separator-type (get element-def 'else-separator-ref)) - (if (> (length separator-type) 0) - (progn - ;; Now split the string around any embedded - ;; newlines - this effectively deletes any leading - ;; newline character. - (setq separator-type (split-string separator-type - (string ?\r))) - (if newline-at-start - (progn - (newline) - ) - ) - - (while separator-type - (insert (car separator-type)) - (setq separator-type (cdr separator-type)) - (if separator-type - (newline) - ) - ) - ) - ) - (newline) - (indent-to cur-column) - (insert (concat "[" else-definition-name "]")) - (insert "...") - ) - ((char-equal duplication-type ?h) - (if separator-type - (progn - (insert separator-type) - (insert (concat "[" else-definition-name "]")) - (insert "...") - ) - ) - ) - ;; This case 'can't' happen because the duplication - ;; requirements are a pre-requisite for this defun. - ((char-equal duplication-type ?c) - (message "Invalid duplication in else-replicate-placeholder-string") - ) - ) - ) - ) - ) - -(defun else-restore (language-name) - "Read the Emacs Lisp objects that represent a pre-compiled language definition." - (let ((this-definition) - (entire) - (read-type) - (obarray-name) - (continue t) - (result t)) - (progn - (save-excursion - (setq else-read-marker (point-marker)) - ) - (condition-case nil - (progn - (else-check-and-init-globals language-name) - (setq Language-Specifics (read else-read-marker)) - (while continue - (setq entire (read else-read-marker)) - (if entire - (progn - (setq read-type (nth 1 entire)) - (cond ((char-equal read-type ?p) - ;; Actions for a placeholder - (setq obarray-name Placeholder)) - ((char-equal read-type ?t) - ;; Actions for a token - (setq obarray-name Token)) - (t - (setq result nil)) - ) - (unintern (car entire) obarray-name) - (setq this-definition (else-get-entry (car entire) read-type)) - (setplist this-definition (nth 2 entire)) - ) - ) - ) - ) - (end-of-file nil) - ) - result - ) - ) - ) - -(defun else-return-sorted-list (this-obarray) - "Extract all of the names from the obarray, sort them alphabetically -and return them as a list." - (let ((sorted-list) - (case-fold-search nil)) - ;; Put all of the names into a list - (mapatoms '(lambda (obarray-element) - (push (get obarray-element 'else-original-name) - sorted-list)) this-obarray) - - ;; Now sort the list alphabetically - ;;(setq sorted-list (sort sorted-list 'string<)) - (setq sorted-list - (sort sorted-list - (lambda (left right) - (< (compare-strings left 0 nil - right 0 nil - else-ignore-case-in-name-sorts) - 0)))))) - -;; -;; Generalised search routine that provides access to either regular searches -;; or regular expression searches either forward or backward of `point' but -;; ultimately search limited to the current line. -;; -(defun else-scan-for-match (match-string regexp &optional direction-reverse) - (let ((current-position) (search-limit)) - - ;; - ;; Find the limit of the search based upon whether it is in the - ;; forward (default or reverse direction and provide it as a limit - ;; for the search. Note that if the search is successful then point - ;; is positioned after the end of the word that has been matched. - ;; - (setq current-position (point)) - (if direction-reverse - (beginning-of-line) - (end-of-line) - ) - (setq search-limit (point)) - (goto-char current-position) - (if regexp - (if direction-reverse - (search-backward match-string search-limit t) - (search-forward match-string search-limit t) - ) - (if direction-reverse - (re-search-backward match-string search-limit t) - (re-search-forward match-string search-limit t) - ) - ) - ) - ) - -(defun else-search-load-path (name &optional check-local-dir-first) - "Search load path for file 'name', returns path plus name. -If 'check-local-dir-first' is t then it will check for the file in the -'current' directory prior to searching the load path." - (let ((search-path load-path) - (found nil) - (this-attempt)) - (progn - (if check-local-dir-first - (progn - (setq this-attempt (expand-file-name - (concat "./" name))) - (setq found (file-exists-p this-attempt)) - ) - ) - (while (and search-path - (not found)) - (setq this-attempt (expand-file-name - (concat (car search-path) - "/" - name))) - (setq found (file-exists-p this-attempt)) - (setq search-path (cdr search-path)) - ) - (if found - this-attempt - nil - ) - ) - ) - ) - -(defun else-set-overlay-here () - "If there is an active overlay then send the menu choices string to -the hook function." - (let ((definition-type nil) - (possible-choices nil) - (menu-string "")) - (if (overlayp else-placeholder-overlay) - ;; The overlay already exists, so just move it - (move-overlay else-placeholder-overlay - (1+ else-placeholder-start) - (1- else-placeholder-end)) - ;; else create the overlay and associate the face to it - (setq else-placeholder-overlay - (make-overlay (1+ else-placeholder-start) - (1- else-placeholder-end))) - (overlay-put else-placeholder-overlay - 'face 'else-placeholder-face) - ) - ;; Now check if the placeholder is a menu item, if so then load up - ;; the menu information and call the VoiceCoder hook. - (setq definition-type (get else-current-definition - 'else-type-ref)) - (setq possible-choices nil) - (if (char-equal definition-type ?m) - ;; It is a menu, so get all of the possible choices and then - ;; send them to the functions that have registered on the - ;; hook. - (progn - (setq possible-choices (else-get-menu-entries - else-current-definition)) - (dolist (match-element possible-choices) - (setq menu-string - (concat menu-string - (else-display-menu-element match-element))))) - ;; the else is an empty menu string i.e. if the placeholder - ;; isn't a menu then send a blank string to the hook functions - ) - (run-hook-with-args 'else-menu-display-functions - menu-string) - ) - ) - -(defun else-set-self-insert-vector () - "Initialise else-before-change character look-up vectors." - (let ((local-string) - (local-string-length) - (index-value)) - ;; Create a vector of 256 character code length - will this cause problems - ;; with "other language" programming? - (setq Language-Self-Insert-Characters-Vector - (make-vector else-character-vector-length nil)) - (setq Language-Valid-Identifier-Characters-Vector - (make-vector else-character-vector-length nil)) - (setq Language-Punctuation-Characters-Vector - (make-vector else-character-vector-length nil)) - (setq local-string (cdr (assoc else-Valid-Idents-ref - Language-Specifics))) - (setq local-string-length (cdr (assoc else-Valid-Idents-Length-ref - Language-Specifics))) - (while (> local-string-length 0) - (setq local-string-length (1- local-string-length)) - (setq index-value (aref local-string local-string-length)) - (aset Language-Valid-Identifier-Characters-Vector - index-value - t) - ) - - (setq local-string (cdr (assoc else-Self-Insert-Characters-ref - Language-Specifics))) - (setq local-string-length (cdr (assoc else-Self-Insert-Characters-Length-ref - Language-Specifics))) - (while (> local-string-length 0) - (setq local-string-length (1- local-string-length)) - (setq index-value (aref local-string local-string-length)) - (aset Language-Self-Insert-Characters-Vector - index-value - t) - ) - - (setq local-string (cdr (assoc else-Punctuation-ref - Language-Specifics))) - (setq local-string-length (cdr (assoc else-Punctuation-Length-ref - Language-Specifics))) - (while (> local-string-length 0) - (setq local-string-length (1- local-string-length)) - (setq index-value (aref local-string local-string-length)) - (aset Language-Punctuation-Characters-Vector - index-value - t) - ) - ) - ) - -;; Set up the before and after change functions and add them to the -;; appropriate change hooks. Note that the standard change hooks must be made -;; "local" to the buffer so as not to interfere with buffers that don't have -;; ELSE mode enabled. -(defun else-setup-change-hooks () - (let () - (make-local-hook 'after-change-functions) - (make-local-hook 'before-change-functions) - (add-hook 'before-change-functions - 'else-before-change - t - t) - (add-hook 'after-change-functions - 'else-after-change - nil - t) - - (setq else-before-var nil) - (setq else-after-var nil) - ) - ) - -(defun else-show-placeholder-names () - "Display names of all of the Placeholders in the current language template -set, sort them alphabetically and display them in a temporary buffer." - (interactive) - (let ((placeholder-list) - (desc) - (forward-ref) - (element) - (placeholder-length 0) - (list-index) - (output-format)) - (if (not else-mode) - (progn - (error "ELSE mode not enabled for this buffer.")) - (with-output-to-temp-buffer "*Available Placeholders*" - ;; Put all of the placeholder names into an alphabetically sorted list - (setq placeholder-list (else-return-sorted-list Placeholder)) - - ;; Nice to have good formatting for the output - determine the - ;; longest placeholder name and incorporate the length into the format - ;; string. Start with a "default" length of the column header - (setq list-index 0) - (setq placeholder-length (length "Placeholder")) - (while (< list-index (length placeholder-list)) - (if (> (length (nth list-index placeholder-list)) placeholder-length) - (setq placeholder-length - (length (nth list-index placeholder-list))) - ) - (setq list-index (+ 1 list-index))) - - (setq output-format (concat "%" (number-to-string placeholder-length) - "s %s" )) - ;; Now insert them into the buffer at point? Attempt some nice - ;; formatting at the same time - (princ (format (concat "%" (number-to-string placeholder-length) - "s %s ******") - "****** Placeholders for" - else-Current-Language)) - (terpri) - (terpri) - (princ (format output-format "Placeholder" "Description")) - ;; newline to output buffer - (terpri) - (while placeholder-list - ;; Get the element as it is used multiple times - (setq element (else-look-up (car placeholder-list) ?p)) - - ;; Get the description - (setq desc (get element 'else-description-ref)) - - ;; The placeholder may not have a description because it references - ;; a placeholder, so take appropriate action in that - ;; situation. - (setq forward-ref (get element 'else-placeholder-ref)) - - (if (and (string= desc "") (car forward-ref)) - ;; It is a forward reference, so derive the description - ;; from that placeholder - (setq desc (get (else-look-up (car (cdr forward-ref)) ?p) - 'else-description-ref))) - ;; Now format the output string - (princ (format output-format (car placeholder-list) desc)) - (terpri) - (setq placeholder-list (cdr placeholder-list))))))) - -(defun else-show-token-names () - "Display names of all of the Tokens in the current language template -set, sort them alphabetically and display them in a temporary buffer." - (interactive) - (let ((token-list) - (desc) - (forward-ref) - (element) - (token-length 0) - (list-index) - (output-format)) - (if (not else-mode) - (progn - (error "ELSE mode not enabled for this buffer.")) - (with-output-to-temp-buffer "*Available Tokens*" - ;; Put all of the token names into an alphabetically sorted list - (setq token-list (else-return-sorted-list Token)) - - ;; Nice to have good formatting for the output - determine the - ;; longest token name and incorporate the length into the format - ;; string. Start with a "default" length of the column header - (setq list-index 0) - (setq token-length (length "Token")) - (while (< list-index (length token-list)) - (if (> (length (nth list-index token-list)) token-length) - (setq token-length (length (nth list-index token-list))) - ) - (setq list-index (+ 1 list-index))) - - (setq output-format (concat "%" (number-to-string token-length) - "s %s" )) - ;; Now insert them into the buffer at point? Attempt some nice - ;; formatting at the same time - (princ (format (concat "%" (number-to-string token-length) - "s %s ******") - "****** Tokens for" - else-Current-Language)) - (terpri) - (terpri) - (princ (format output-format "Token" "Description")) - ;; newline to output buffer - (terpri) - (while token-list - ;; Get the element as it is used multiple times - (setq element (else-look-up (car token-list) ?t)) - - ;; Get the description - (setq desc (get element 'else-description-ref)) - - ;; The token may not have a description because it references - ;; a placeholder, so take appropriate action in that - ;; situation. - (setq forward-ref (get element 'else-placeholder-ref)) - - (if (and (string= desc "") (car forward-ref)) - ;; It is a forward reference, so derive the description - ;; from that placeholder - (setq desc (get (else-look-up (car (cdr forward-ref)) ?p) - 'else-description-ref))) - ;; Now format the output string - (princ (format output-format (car token-list) desc)) - (terpri) - (setq token-list (cdr token-list))))))) - -(defun else-store-element (s-symbol) - "Called by mapatom to save the symbol to a file. -The file is indicated by 'else-read-marker'" - (let ((this-definition) - (property-list) - (entire)) - (progn - (setq this-definition s-symbol) - (setq property-list (symbol-plist this-definition)) - (setq entire (list (symbol-name this-definition) - else-type-of-symbols - property-list)) - (print entire else-read-marker) - ) - ) - ) - - -;; -;; If ARG contains enclosing quotes, then strip them off. -;; -(defun else-strip-quotes (arg) - (let () - (if (string= (substring arg 0 1) "\"") - (substring arg 1 (1- (length arg))) - arg - ) - ) - ) - -;; Called to provide a textual substitution of the current token or -;; placeholder with either a single line of text (because it was -;; selected from a menu) or the body of a placeholder. -;; element - either a string or a symbol -;; defn-type - token or placeholder type of the element being replaced. -(defun else-substitute (element defn-type) - "[text]" - (let ((lang-indent-size (cdr (assoc else-tab-size-ref Language-Specifics))) - (adjust-factor 0) - (duplication-direction 0) - (text-to-insert "") - (cur-column 0) - (here)) - (condition-case nil - (progn - ;; Now process each line to be inserted. First though, turn off - ;; processing by the before/after change hook functions by ELSE. - (remove-hook 'before-change-functions 'else-before-change t) - (remove-hook 'after-change-functions 'else-after-change t) - - ;; Grab a copy of the string that is about to be deleted - we may - ;; use it later on, so here is a convenient place to take a copy. - (setq else-deleted-string (buffer-substring - else-placeholder-start - else-placeholder-end)) - - ;; Delete the element that we are replacing - in both cases - ;; we expect the else-placeholder-start/end variables to be - ;; setup - this is a precondition of entry to this - ;; defun. Note also that the definition type - ;; i.e. placeholder or token of what is being deleted is not - ;; necessarily the argument value of defn-type to this defun - ;; i.e. at this point we may have followed several levels of - ;; "indirection" to arrive at an actual point of - ;; substitution. So depend on a global variable for the - ;; element type of what we are deleting - ;; (else-definition-type). - (delete-region else-placeholder-start else-placeholder-end) - (if (char-equal else-definition-type ?p) - (progn - (if else-please-duplicate - (progn - (delete-char 3) - ;; What is the context of the duplication? - ;; i.e. if there is only whitespace prior to the - ;; placeholder then the duplication context is - ;; vertical, otherwise it is horizontal - the - ;; only way this can be overridden is if the - ;; placeholder definition contains something - ;; other than CONTEXT_DEPENDENT. So test for - ;; this first. - ;; If it is context dependent, then work out - ;; what the context is otherwise just assume the - ;; value in the definition. - (setq duplication-direction (get else-current-definition - 'else-duplication-ref)) - (if (char-equal duplication-direction ?c) - (progn - ;; Make sure the search doesn't change point - (setq here (point)) - (if (not (else-scan-for-match "[^ \t]" nil t)) - (setq duplication-direction ?v) - (setq duplication-direction ?h) - ) - (goto-char here) - ) - ) - ) - ) - ) - ;; - ) - (setq else-deleted-column (current-column)) - - ;; Now take action based upon the target substitution. What - ;; we want here is to have a list of text line(s) to - ;; insert. In the case of defun argument element being a - ;; placeholder, then we need to extract all of the body text - ;; into a list, when the defun argument is a single line - ;; (line from a menu selection) then place that into the - ;; same list element - this way we can process both cases - ;; using the same code. Note that the resultant list, no - ;; matter where the source came from has to contain elements - ;; that have the same structure as each line of the body of - ;; a placeholder. - (if (symbolp element) - (setq text-to-insert (get element 'else-body-ref)) - ;; object must be a string, so construct a standard single - ;; line entry for the list i.e. it should have a structure - ;; as defined in else-extract-body. This is easy because - ;; we know that the element is a string for direct - ;; insertion, so it is not a /PLACEHOLDER or /TOKEN, has a - ;; zero level indent and the line is the string text. - (setq text-to-insert (list (list nil 0 element))) - ) - - (setq cur-column (current-column)) - (while text-to-insert - (progn - ;; Insert the correct number of spaces for the - ;; indentation of the line. - (insert (make-string - (* (nth else-body-indent-ref (car text-to-insert)) - lang-indent-size) - ?\ )) - (insert (nth else-body-text-ref (car text-to-insert))) - - ;; Now check for more lines of text to be inserted. - (setq text-to-insert (cdr text-to-insert)) - (if text-to-insert - (progn - (newline) - (indent-to cur-column) - ) - ) - ) - ) - ) - (error nil)) ;; end of the condition-case - (add-hook 'before-change-functions 'else-before-change t t) - (add-hook 'after-change-functions 'else-after-change nil t) - ;; If the item just expanded was a placeholder and it should be - ;; replicated then do it. - (if (and (char-equal else-definition-type ?p) else-please-duplicate) - (else-replicate-placeholder-string duplication-direction - else-deleted-column - else-current-definition) - ) - ) - ) - -(defun else-summary () - (interactive) - (let () - (progn - (message "s-elect, q-uit, n-ext line, p-revious line") - ) - ) - ) - -(defun else-toggle-direction () - "Toggle the value of the direction flag 'else-direction." - (interactive) - (setq else-direction (not else-direction)) - ) - - -(defun else-uncomment-placeholders () - "Remove any comment prefixes from lines containing valid placeholders. -This function reverses the effects of else-comment-placeholders." - (interactive) - (let ((region-start) - (region-end)) - (progn - (save-excursion - (goto-char (point-min)) - (while (not (= (point) (else-next-placeholder))) - (progn - (beginning-of-line) - (if (looking-at (regexp-quote comment-start)) - (progn - (setq region-start (point)) - (end-of-line) - (setq region-end (point)) - (uncomment-region region-start region-end) - ) - ) - (end-of-line) - ) - ) - ) - ) - ) - ) - -(defun else-find-template (template-name obarray-name) - "Try completion for template-name in obarray-name." - (let ((succeeded t) - (matched-string) - (match-data) - (is-completions-displayed)) - (progn - ;; Make sure that any existing completions display is deleted. - (setq is-completions-displayed - (get-buffer-window "*Completions*" 'visible)) - (if is-completions-displayed - (progn - (save-excursion - (delete-window is-completions-displayed) - ) - ) - ) - (setq matched-string (upcase template-name)) - (setq match-data (try-completion - matched-string - obarray-name)) - (cond ((or (equal match-data t) - (equal match-data nil)) - ;; Actions for an exact match - (setq succeeded nil) - ) - (t - ;; All else i.e. there is "longest" possible string - (if (equal (length match-data) - (length matched-string)) - (progn - ;; The two match, so therefore we have matched up - ;; until the unique portion but still not finished - ;; the completion i.e. there is more than one - ;; possible completion. - (with-output-to-temp-buffer "*Completions*" - (display-completion-list - (all-completions matched-string Placeholder) - ) - ) - (setq succeeded nil) - ) - (progn - (setq match-data (downcase match-data)) - (insert match-data) - ) - ) - ) - ) - succeeded - ) - ) - ) - -(defun else-insert-placeholder () - "Given a string, lookup the template in the current language. When found, -insert the string at point." - (interactive) - (let ((here (point)) - (stop-location) - (matched-string)) - (progn - (beginning-of-line) - (setq stop-location (point)) - (goto-char here) - ;; Look backwards for either a "{" or a "[" character. - (if (re-search-backward "[{[]" stop-location t) - (progn - (forward-char) - (setq matched-string (buffer-substring (point) here)) - (delete-region (point) here) - (if (not (else-find-template matched-string Placeholder)) - (progn - (insert matched-string) - (goto-char here) - ) - ) - ) - (progn - ;; This is the else case. Assume that a token is desired. - (forward-word -1) - (setq matched-string (buffer-substring (point) here)) - (delete-region (point) here) - (if (not (else-find-template matched-string Token)) - (progn - (insert matched-string) - (goto-char here) - ) - ) - ) - ) - ) - ) - ) - -(defun else-is-template-file-present (language-file-name) - "Search the list of all buffers checking whether the file that each -visits is the target file - return t if there is a match." - (let ((local-list (buffer-list)) - (result nil) - this-buffer - (abs-file-name (expand-file-name language-file-name))) - ;; Search the list until empty or a match is found - (while (and local-list (not result)) - - (setq this-buffer (car local-list)) - (setq local-list (cdr local-list)) - - (setq result (string= abs-file-name (buffer-file-name this-buffer))) - ) - result - ) - ) - -(defun else-wrap-region (begin end) - "'wrap' a region of code with a placeholder definition. -The marked region will be moved into the first placeholder in the -second line of the placeholder being used." - (interactive "r") - (let ((template-name) - (text-being-wrapped (buffer-substring begin end)) - (start-region) - (end-region)) - (if (not else-mode) - (error "Must have a language loaded to run this function.") - (setq template-name - (completing-read "Placeholder: " Placeholder)) - (delete-region begin end) - (newline) - (forward-line -1) - (indent-for-tab-command) - (setq start-region (point-marker)) - (insert (concat "{" template-name "}")) - (else-previous-placeholder) - (else-expand-placeholder) - (goto-char start-region) - (beginning-of-line) - (forward-line) - (else-next-placeholder) - (insert text-being-wrapped) - (setq end-region (point-marker)) - (indent-region start-region end-region nil) - ) - ) - ) - - -(defgroup ELSE nil - "Custom variables for Emacs Language Sensitive Editor" - :tag "Emacs LSE" - :prefix "else" - :group 'tools) - -(defcustom else-prompt-time 3 - "Prompter Screen display time in seconds" - :type 'integer - :group 'ELSE) - -(defcustom else-kill-proceed-to-next-placeholder nil - "Should else-kill-placeholder goto next placeholder after a kill or not" - :type 'boolean - :group 'ELSE) - -(defcustom else-set-lineno nil - "Turn line numbering in the Menu buffer on or off. Requires setnu.el." - :type 'boolean - :group 'ELSE) - -(defcustom else-move-and-execute nil - "If set, then if a command fails then a movement-<execute> pair is assumed -where <execute> is the requested operation and the movement is determined by the -else-direction flag - note that the 'command' is currently restricted to expand -and kill operations only." - :type 'boolean - :group 'ELSE) - -(defcustom else-direction t - "If expand-or-move is enabled, this flag determines the direction of movement - on - next placeholder - off - previous placeholder" - :type 'boolean - :group 'ELSE) - -(defcustom else-only-proceed-within-window t - "Move after a kill only if the next placeholder is visible in the current window. -This flag controls jumps when they are part of a composite action by ELSE -i.e. in kill-placeholder, if the kill-proceed flags is set then this flag -allows the move to the next placeholder only if it is visible in the current -window." - :type 'boolean - :group 'ELSE) - -(defcustom else-follow-menus nil - "If true then menu definitions are 'followed' or expanded until no sub-entry -menu is found and all are combined into a single menu selection -display at the 'top level'. If nil, then menu's are not expanded and -the user has to traverse sub-menu entries (useful when combining -menu's leads to huge menu selections)." - :type 'boolean - :group 'ELSE) - -(defcustom else-nofollow-menus nil - "If true then menu definitions are *not* 'followed'. If nil, -'else-follow-menus and then /NOFOLLOW or /FOLLOW attributes are tested to -determine the behaviour of menu displays. If set to t then this flag has -precedence over all other settings dealing with this bechaviour." - :type 'boolean - :group 'ELSE) - -(make-variable-buffer-local 'else-follow-menus) -(make-variable-buffer-local 'else-nofollow-menus) - -(defcustom else-experimental-code-flag nil - "Protect experimental regions of the code. Leave set to nil unless you are sure -you can live with the consequences. Current behaviour being protected by the flag -is: -1. Creating an overlay for the last placeholder visited by else-next-placeholder -and else-previous-placeholder - this is code for VoiceCoder requirements." - :type 'boolean - :group 'ELSE) - -(defface else-placeholder-face - '((((type tty) (class color)) (:foreground "green")) - (((class grayscale) (background light)) (:foreground "DimGray" :italic t)) - (((class grayscale) (background dark)) (:foreground "LightGray" :italic t)) - (((class color) (background light)) (:foreground "RosyBrown")) - (((class color) (background dark)) (:foreground "LightSalmon")) - (t (:italic t))) - "ELSE mode face used for placeholder strings." - :group 'ELSE) - -(defcustom else-menu-display-functions nil - "A hook by which functions communicate their interest in menu -selections when ELSE moves into a placeholder that is a menu -placeholder." - :type '(repeat (cons string symbol)) - :group 'ELSE) - -(defcustom else-ignore-case-in-name-sorts t - "Ignore case (t) in sorting token names for display using -else-show-token-names" - :type 'boolean - :group 'ELSE) - -;; make a unique copy for this buffer -(make-variable-buffer-local 'else-placeholder-overlay) - -(provide 'else-mode) - -;;; elsemode.el ends here -;; LocalWords: elsemode Milliken dosuser peterm msg esl lse setq progn concat -;; LocalWords: keymaps keymap eg ada lang keypress obarray mapatom nthcdr alist -;; LocalWords: NOAUTOSUBSTITUTE da mapatoms se sl utils obarrays thru Ok defun -;; LocalWords: fName Unintern cdr assoc NOAUTO NOLIST Placeholder's lineno VR -;; LocalWords: regexp cust Keybindings dir ARG uit revious placeholders struct -;; LocalWords: VoiceCoder count'th barfing XEmacs cond xemacs fns Monnier wrt -;; LocalWords: setnu diff --git a/app-emacs/else-mode/files/else.info b/app-emacs/else-mode/files/else.info deleted file mode 100644 index 4fdc14b..0000000 --- a/app-emacs/else-mode/files/else.info +++ /dev/null @@ -1,3215 +0,0 @@ -This is else, produced by makeinfo version 4.2 from else.texi. - - This file documents the Emacs Language Sensitive Editor (ELSE) minor -mode. - - This version is edition 1.5 of the ELSE User Manual. It corresponds -to ELSE Version 1.20 - - Copyright (C) 1999 - 2003 Peter Milliken - - Permission is granted to make and distribute verbatim copies of this -manual provided the copyright notice and this permission notice are -preserved on all copies. - - Permission is granted to copy and distribute modified versions of -this manual under the conditions for verbatim copying, provided also -that the sections entitled "Copying" and "GNU General Public License" -are included exactly as in the original, and provided that the entire -resulting derived work is distributed under the terms of a permission -notice identical to this one. - - Permission is granted to copy and distribute translations of this -manual into another language, under the above conditions for modified -versions, except that this permission notice may be stated in a -translation approved by the Free Software Foundation. - -INFO-DIR-SECTION Editors -START-INFO-DIR-ENTRY -* ELSE: (else). Emacs Language Sensitive Editor mode. -END-INFO-DIR-ENTRY - - -File: else, Node: Top, Next: Introduction, Prev: (dir), Up: (dir) - - This Info file contains edition 1.5 of the ELSE Users Manual, -corresponding to Version 1.20 of the Elisp file else-mode.el. - -* Menu: - -* Introduction:: -* Overview:: -* Installation Instructions:: -* Default Keybindings:: -* Command Summary:: -* Using ELSE:: -* Creating and Modifying Templates:: -* Custom Variables:: -* Technical Notes:: -* Compatibility:: -* Notes for VR Coding:: -* Template Availability:: -* Tutorial:: -* Concept Index:: - - --- The Detailed Node Listing --- - -Overview of ELSE - -* Typographical Conventions:: Definitions of special characters used. -* Definitions:: Definitions of special terminology. - -Using ELSE - -* Invoking ELSE:: How to start it up and what you get. -* Navigating:: -* Expanding Placeholders:: How to expand Placeholders. -* Expanding Tokens:: How to expand Tokens. -* Deleting Placeholders:: -* Preparing for Compilation:: -* Disabling ELSE:: Sometimes you just don't want ELSE to be active. - -Creating and Modifying Templates - -* Syntactic Conventions:: -* Customising An Existing Template Language:: -* Extracting Placeholders or Tokens:: -* Create a New Language:: How to create a new language template -* Definition of the Template Structure:: -* Example of Creating A New Language Template:: - -Customising An Existing Template Language - -* Extracting Placeholders or Tokens:: How to extract a placeholder or token - -Creating a New Language - -* Language Definition Template:: -* Overriding Language Attributes:: - -Language Definition Template - -* Language Identification:: -* Initial String:: -* Punctuation characters:: -* Self Insert Characters:: -* Valid Identifier Characters:: -* Indentation Size:: -* Template Version:: - -Definition of the Template Structure - -* Placeholders:: -* Tokens:: -* Hooking Elisp Code into ELSE Templates:: - -Placeholder Definition - -* Delete Placeholder Statement:: -* Language Specifier:: -* Define Placeholder Statement:: -* Auto Text Substitute:: -* Description Specifier:: -* Duplication Specifier:: -* Separator Specification:: -* Type Specifier:: -* Template Body:: -* Placeholder Cross-Referencing:: -* End Define Command:: - -Technical Notes - -* Useful ELSE Defuns:: -* Editing Template Files:: -* ELSE and Hooks:: -* Building the Language Template File Name:: - -ELSE and Hooks - -* Building the Language Template File Name:: - -Tutorial - -* Abbreviation Coding:: -* Whole Language Coding:: - - -File: else, Node: Introduction, Next: Overview, Prev: Top, Up: Top - -Introduction -************ - - These days a number of packages exist for Emacs that provide what -users think of as "templates" or "skeletons" or code "abbreviations". -When they first go in search of something to help generate code they -are thinking of something that will allow the generation of common code -constructs (usually control structures or file/function headers) with a -small number of keystrokes (similar to the Emacs abbreviation -facility). For instance, a user might be interested in a package that -generates an "if" statement, they envisage such as package generally -working like an abbreviation i.e. "if<some Emacs command/key sequence>" -which then leaves a tailored "if" construct in their buffer, where they -can then "fill in the blank" or missing portions of the code. - - ELSE (Emacs Language Sensitive Editor) provides this functionality -via what is called "tokens" (*note Expanding Tokens::) plus much more. -The following example shows the use of a token definition taken from -the C language templates, this definition generates an "if" construct. -The key-stroke sequence to generate this command (assumes installation -of ELSE has been achieved) is `ifC-c / e' with the following result in -the buffer: - - if ({expression}) { - {statement}... - } - [elsif_part]... - [else_part] - -After the expansion, the cursor is automatically positioned within the -first placeholder (`{expression}' and the user can just start typing the -condition expression, ELSE will automatically delete the placeholder -text and replace it with the typed information. - - ELSE takes what I will term a "whole language" approach to helping -generate code. Not only does it provide code "abbreviations" but it -also provides facilities that allow generation of a code file from -initial empty buffer to completed file - all without having to leave -the template system. Indeed, it is possible to code a typical language -file without having to manually type a single language keyword or -construct. This "whole language" approach utilises what is termed -"placeholders" (*note Expanding Placeholders::). Given a sufficiently -detailed language template file (one that closely mirrors the EBNF (1) -for the language, for instance), then it is possible to achieve this -goal. - - A brief tutorial is offered (*note Tutorial::) showing the use of -both placeholders and tokens. - - Most people, when they start to explore language sensitive editing, -start out by looking for a system that allows them to specify language -"templates" -- a facility that will allow them to type in an -abbreviation which is then somehow expanded to the full language -construct i.e. `if' is expanded to the full syntax of the particular -language if statement. This is as far as they typically envisage a -templating package to work. ELSE provides this basic functionality via -what is termed "tokens". But ELSE goes much further than this, it -provides a system that allows the mimicking of the entire language -syntax i.e. it offers not only expansion of abbreviations but also -allows menu choices and the provision of information messages to the -user -- all within the syntax of an ASCII readable language definition -file. The structure of the language definition file is described fully -in the reference portions of this manual (*Note Creating and Modifying -Templates::). - - You might be asking the question - how is ELSE different from any of -the other template packages available for Emacs? ELSE differs from -other packages that aim to achieve the same goals in several ways: - 1. ELSE language template definitions are specified using a purely - ASCII, textural syntax with no attempt at making them look - ELisp-like. At least one user has seen this as a disadvantage - though :-). To be fair, his argument was that why should he have - to learn yet another "language" when if the template definitions - could be defined using Elisp style syntax? There is no easy answer - for this. As the author, I (obviously) thought that staying away - from Elisp like syntax would be a benefit to a user i.e. they - don't have to learn Elisp to use ELSE! At first glance, ELisp is - not an easy language to pick up with its nested brackets etc - - miss one and you are history! :-). - - 2. ELSE language definition syntax conforms with a commercially - available Editor(2). - - 3. The user interface for using ELSE is completely visual i.e. other - template/skeleton packages use an interface of questions/answers - and have invisible "markers" to points of interest in the syntax - generated. Thus their interface is not easy to use (once you - embark into a Q&A session you are stuck with completing it - many - such sessions require you to know the full extent of your code - before you embark on it! e.g. how many case statements will be - used in a switch statement and exactly what are the cases in which - the program should take action? If you need further information to - answer any of the questions then there is no way to just - "interrupt" the season, switch to another buffer and look up the - required information -- so you are either forced to continue on as - best you can or abandon the Q&A session entirely). ELSE's - placeholders or "markers" persist across edit sessions because - they are actual text in the buffer, other template/skeleton - packages use Emacs markers which are lost when the edit session - for that file is ended. - - 4. ELSE offers features that are missing in other packages e.g. the - ability to have text automatically repeated as you type at a - single place in multiple places within the language syntax i.e. - function names can be repeated at the end of the function body as - the name is typed by the user at the start of the body(3). It is - possible to create flexible templates for commonly used language - constructs using this feature i.e. coding for loops in C often - have a similar, repetitive "pattern", using this feature of ELSE, - typing can be kept to a minimum as the variable name is repeated - in multiple places e.g. - - for (no_items = 0; no_items < 100; no_items++) - - is a very common construct - the auto-substitute feature of ELSE - could allow the user to create the above code pattern such that - the variable "no_items" was automatically repeated in two places - as the first instance was typed by the user. - - 5. ELSE language definitions can model the original language syntax - either as loosely or closely as the template definition maintainer - desires using a menu system that provides choices that follow - language syntax branching. Thus a user can see what code syntax is - possible at different points in the file without necessarily - having to be an expert in the language in which the code is being - generated. This means that ELSE can be a aid to beginning - programmers as they learn the language in which they are - generating code. - - 6. ELSE offers a more "dynamic" interface than other similar - packages. The user can "extract" and modify language template - definitions "on the fly" whilst in an Emacs edit session. These - changes can be either temporary i.e. last for the current edit - session only or can be saved for future use in later sessions. In - fact, ELSE is so dynamic that you can actually extract the contents - of the entire language template set for the current edit session - and save that for later (re)use. - - 7. And lastly (but not least :-)), ELSE is extensively documented. - Documentation for competitive packages are only just starting to - emerge, use of those packages have thus been limited to those few - who were prepared to invest the time to read Elisp and a few - scattered examples to learn how to use the packages. ELSE template - definition syntax and documentation hopefully allows even users - who are not interested in programming in Elisp to enjoy the fruits - of language sensitive editing quickly and (relatively) easily. - - - ---------- Footnotes ---------- - - (1) Extended Backus-Naur Form is a mechanism used by computer -scientists to describe the syntax of a computer language i.e. check -section A.13 of Kernighan and Ritchie's "White book" on the C language - - (2) well, it is as close as my memory allowed when I moved from -using DEC LSE and creating a mimic of it -- users have reported very -minor syntactical differences that are easily catered for by editing -the template file - - (3) this is mandatory for some languages, also some project coding -standards demand a repetition of information that is found at the head -of construct to be repeated at the end of the construct i.e. copying -the expression portion of an if statement into a comment at the end of -the if structure - - -File: else, Node: Overview, Next: Installation Instructions, Prev: Introduction, Up: Top - -Overview of ELSE -**************** - - ELSE is an implementation of a minor mode for Emacs that provides -language sensitive editing capability to the currently enabled major -mode (for the current buffer) of Emacs. It is aimed fairly and squarely -at providing support to programmers for input of program text but as -you will see it can be easily customised for any task that involves -repetitious input of common textual sequences. - - Use of ELSE will improve programmer productivity by reducing the -amount of time to enter the program/text in the first instance and in -the second instance, it will cut-down on time consuming errors due to -typing mistakes i.e. syntax errors that are usually found by the -compiler during the compile - edit cycle e.g. missing ;'s become a -thing of the past. - - The aim of ELSE is to reduce programming to an exercise of "filling -in the blanks", hence the use of the term "template" language. Language -constructs are the templates and the variable, procedure and function -names are the "blanks". - - There are a number of ways of implementing so called "language -sensitive editing" (lse) in an editor. The most common approaches seen -in many editors that offer this feature take a very "primitive" form -where the programmer is left feeling that he/she could just as easily -do without e.g., many implementations offer the following behaviour: - - 1. offer macros that would fill in some of the language syntax by - straight generation of a portion of the chosen language statement - leaving the user to position the cursor manually to where variable - entry is required and manual deletion of (optional) portions of - the syntax that are not required; or - - 2. through a series of question/answer sessions, where at the end of - the sequence, the language statement is deemed "complete" and is - entered into the text buffer. - - These approaches tend to feel fairly "intrusive" to the programmer -and are generally awkward to use. In addition, they offer little or no -help to the novice in possible selections of syntax. - - The approach to Language Sensitive Editing offered here for Emacs is -modelled after a feature found in a editor offered by Digital Equipment -Corporation(1) called LSE. This approach to the problem does not suffer -from any of the usual awkwardness associated with typical lse -implementations. It provides a natural framework for the programmer -where the work is limited to menu selections and "filling in the -blanks" e.g., a typical "template" (*note Definitions::) in ELSE looks -like: - - [context_clause]... - package {program_unit_name} is - {basic_declarative_item}... - [private_part] - end [program_unit_name]; - -This is the template for a `package' specification in Ada. Each of the -textual strings inclosed by `{}''s or `[]''s are language -"placeholders" (*note Definitions::) that offer further expansion -possibilities through either menu selection, text substitution or -language prompts e.g., if the placeholder `[context_clause]' is -"expanded" then the contents of the buffer will become: - - with {library_unit_name}...; [use_clause] - [context_clause]... - package {program_unit_name} is - {basic_declarative_item}... - [private_part] - end [program_unit_name]; - -Observe that the placeholder `[context_clause]...' has been expanded -and replaced with the two lines: - - - with {library_unit_name}...; [use_clause] - [context_clause]... - -Upon expansion, ELSE replaced the placeholder `context_clause' with its -definition, namely the text `with {library_unit_name}...; -[use_clause]'. It detected that the placeholder was to be repeated (the -trailing ...) and thus duplicated the placeholder being expanded onto -the next line. - - After the expansion, the cursor will be automatically re-positioned -between the first set of `{}''s. The user then has options of further -expansion or performing straight text entry, if the text entry option -is exercised then the text within and including the `{}''s is -automatically deleted by the minor mode and replaced by the entered -text i.e. no awkward "killing" or "deleting" of text is required, the -minor mode recognises a valid(2) placeholder and responds appropriately -e.g., - - - with TEXT_IO, [library_unit_name]...; [use_clause]... - -Note that the user has only typed the text `TEXT_IO', the `,' and the -repetition of the (optional) syntax/placeholder -`[library_unit_name]...' was automatically supplied by the minor mode -functionality. Just as `conveniently', if the programmer decides that a -second `library_unit_name' is not required then the placeholder can be -deleted (`else-expand-placeholder' (`C-c / e')) using a single command -with the following to result: - - - with TEXT_IO; [use_clause]... - -Note that ELSE has performed appropriate "housekeeping" and that the -`,' has been automatically deleted as nolonger required and the `;' -character is flush against the package name (TEXT_IO). Similarly, the -`[use_clause]' placeholder can be expanded upon or deleted. - - The preceeding examples have shown how ELSE offers language sensitive -editing via the "placeholder" mechanism. Another mechanism offered by -ELSE for quick generation of language syntax is via the expansion of -"token's". A token is usually used where no placeholders are available -i.e. the programmer has deleted all placeholders but wants to add -further code to a particular section. He/She has the option of either -typing in a placeholder, such as, `{statement}'... or if a simple -construct is all that is needed, then he/she can type in a token and -perform expansion upon it. A "token" is an abbreviated string that has -been defined in the language templates to be expanded to a full -construct e.g. - - Code before entry with the ``token'' inserted at the desired point: - - Value1 := 10; - Value2 := 20; - - if <---- require an ``if'' statement here - - Value3 := Value1 * Value2; - - Code after token is expanded: - - Value1 := 10; - Value2 := 20; - - if {condition} then - {statement}... - [elsif_part] - [else_part] - end if; - - Value3 := Value1 * Value2; - - In the previous example, the abbreviation "if" is a token defined in -the Ada language templates which is defined to expand to an "if -statement" template. - -* Menu: - -* Typographical Conventions:: Definitions of special characters used. -* Definitions:: Definitions of special terminology. - - ---------- Footnotes ---------- - - (1) DEC has been purchased by Compaq, which has in turn been -purchased by Hewlett-Packard, but the product lines lives on AFAIK - - (2) valid placeholder or token strings are defined as a string that -exists as a definition in the currently enabled language definitions - - -File: else, Node: Typographical Conventions, Next: Definitions, Prev: Overview, Up: Overview - -Typographical Conventions -========================= - - ELSE uses the following typographical conventions: - - 1. Curly braces `{}''s -- denote a mandatory entry e.g. `with - {library_unit_name}', the language requires that a package name be - supplied. Mandatory entries cannot be deleted (using the - `else-kill-placeholder' (`C-c / k') command, that is), the user is - warned by a error message in the command line of the editor. - - 2. Square braces `[]''s -- denote an optional entry e.g. - `[context_clause]' can be either deleted or `expanded'. - - 3. 3 Dots ... -- denote the fact that the preceeding (or `attached') - placeholder will be `automatically' repeated by the minor mode - functionality when the user performs any actions other than the - `else-kill-placeholder' (`C-c / k') command. - - 4. ==> -- denotes the results of an "expansion" of either a - placeholder or token e.g. - [context_clause]... ==> with {library_unit_name}...; [use_clause] - - -File: else, Node: Definitions, Prev: Typographical Conventions, Up: Overview - -Definitions -=========== - - The following terminology is used in this manual: - - 1. `placeholder' -- Term used to denote a textual string that is - recognisable or "defined" in the currently selected `language' - mode. The string is enclosed by either `[]''s or `{}''s (*note - Typographical Conventions::). - - 2. `token' -- A (usually short) textual string that has been - "defined" in the currently active language template. It can be - expanded to provide a language template. This is (usually) used as - a shorthand way of inserting a particular language construct. - Tokens are textual strings which are not enclosed by `[]''s or - `{}''s. - - 3. `expand' or `expansion' -- Denotes the execution of the command - `else-expand-placeholder'. - - -File: else, Node: Installation Instructions, Next: Default Keybindings, Prev: Overview, Up: Top - -Installation Instructions -************************* - - To install ELSE, copy the Emacs Lisp file `else-mode.el' anywhere -into the load path of your installation of Emacs (I use the `site-lisp' -directory). Place the following command into your .emacs file: - (require 'else-mode) - - ELSE also optionally supports the use of a support package called -setnu.el (mirrored/available from the same place that you copied -else-mode.el). This package is written by Kyle E. Jones and provides -line numbering support (if enabled - *Note Custom Variables::.) to the -display of menu choices. This feature is available so that individuals -using voice coding systems can easily pick the desired menu choice. The -setnu.el package should be copied to the same spot as else-mode.el. - - It is recommended, but not necessary, that you install the ELSE info -documentation. ELSE documentation consists of a TexInfo file -(else.texi), an info file (else.info) and a PDF file (else.pdf). Copy -the info file (else.info) into the Emacs Info directory and add the -following line to the `dir' file that can be found in the Emacs info -directory: - - * ELSE: (else.info). Emacs Language Sensitive Editor. - - ELSE comes with a number of template definition files (*note -Template Availability::). Place the desired template definition files -anywhere in the Emacs `load-path' (the site-lisp directory is fine). - - -File: else, Node: Default Keybindings, Next: Command Summary, Prev: Installation Instructions, Up: Top - -Default Keybindings -******************* - - Following the recommendations of the Elisp manual regarding minor -modes, ELSE provides a minor-mode map i.e. a map that is active only -when the minor mode is active, that binds the four main commands of -ELSE as follows: - 1. else-expand-placeholder - `C-c / e' - - 2. else-next-placeholder - `C-c / n' - - 3. else-previous-placeholder - `C-c / p' - - 4. else-kill-placeholder - `C-c / k' - - Some lessor used commands and their bindings are: - 1. else-comment-placeholders - `C-c / c' - - 2. else-uncomment-placeholders - `C-c / u' - - 3. else-insert-placeholder - `C-c / i' - - Note that these bindings are purely provided to conform with the -conventions for such things as specified in the Emacs Lisp manual. My -personal preference is to bind the main four commands to `F3 - F6'. A -'quirk' of the operation of ELSE that is worth mentioning is that when -selecting items from the menu display, the command -`else-expand-placeholder' can also be used to select an item i.e. first -instance of the command over a placeholder will bring up a menu of -choices and then a second press of the keybinding will provide a -selection request - this provides faster and convenient selection for -the user at times e.g. a commonly selected menu option can be a quick as -`F3'/`F3' (assuming the desired option is the first entry in the menu --- if it isn't then "customise" that placeholder definition and swap the -order of menu item!). - - For the convenience of novice/beginning Emacs programmers, here are -the key definitions that I use (place them in your .emacs or emacs.el -file -- whichever one you use): - - (global-set-key [f3] 'else-expand-placeholder) - (global-set-key [f4] 'else-next-placeholder) - (global-set-key [f5] 'else-previous-placeholder) - (global-set-key [f6] 'else-kill-placeholder) - - A further "nice to have" in your .emacs file is to have else-mode -turned on automatically for each file that you edit. An example of how -to turn on ELSE for c-mode (C source files) is: - - (add-hook 'c-mode-hook - (lambda () - ;; this is shown as a lambda so you can add further interesting - ;; minor mode definitions here. - (else-mode))) - - Refer to the Emacs manual for further information on major mode -hooks, when and how they are run to achieve customisation of an edit -environment. - - -File: else, Node: Command Summary, Next: Using ELSE, Prev: Default Keybindings, Up: Top - -Command Summary -*************** - - The following user commands are provided by ELSE. - - - Command: else-mode - Toggles the minor mode for the current buffer. If the buffer is - empty then it inserts the "initial_string". - - - Command: else-expand-placeholder - If the cursor is positioned within a "placeholder" (*note - Definitions::) then the placeholder is expanded (1) according to - the rules for the definition of that placeholder name. If the - command is executed with the cursor immediately positioned after a - valid token then the rules defined for that token are used in the - expansion. - - - Command: else-next-placeholder - Moves the cursor to the next valid placeholder in the current - buffer. - - - Command: else-previous-placeholder - Moves the cursor to the previous valid placeholder in the current - buffer. - - - Command: else-kill-placeholder - Kills or deletes the placeholder in which the cursor is currently - positioned. Note that a numeric argument `C-u' will force a kill - even when the placeholder is mandatory. - - - Interactive Command: else-cleanup-placeholders - Command to delete every placeholder remaining in the current - buffer. Mandatory and optional placeholders are all deleted using - the else-kill-placeholder command. - - - Command: else-comment-placeholders - Uses the comment syntax for the currently defined major mode to - "comment out" any placeholders in the source file that have not - been expanded or deleted. This command is useful for when a - compilation is desired but coding is not yet deemed complete ie - there are still placeholders in the buffer. - - - Command: else-compile-buffer - Command to "compile" the language definitions found at `point' to - the end of the buffer. When supplied with a numeric argument - (`C-u') will compile definitions from the beginning of the current - buffer. - - - Command: else-compile-fast-load - Command to generate a "fast" load version of a language template - file. A version of the language template file is created using the - Emacs Lisp"read" syntax. When ELSE attempts to load a new language - definition file it will first look for a "fast load" version of - the file. Please note that this command is a "hold-over" from the - days when PC's were very slow, this command probably should not be - used as it will be removed from future versions of ELSE. - - - Interactive command: else-extract-all - Extract all of the placeholders, tokens and the language - definition for the current language into the current buffer at - `point'. - - - Interactive command: else-extract-placeholder placeholder - Prompts the user for a valid placeholder name and then extracts - the placeholder definition into the current buffer (*note - Customising An Existing Template Language::). - - - Interactive command: else-extract-token token - Prompts the user for a valid token name and then extracts the - token definition into the current buffer (*note Customising An - Existing Template Language::). - - - Interactive Command: else-insert-placeholder - Command to insert a placeholder string at point into the current - buffer. It expects some leading characters of the placeholder - prior to point at the time the command is invoked (these character - must be preceeded by a "{" or "[" character). It will use this - abbreviation to perform auto-completion on the placeholders loaded - for the current language template file. If there are more than one - possibilities, then the command will provide auto-completion of the - unique portion of the placeholder and then stop, a second - invocation will split the window and display a list of possible - completions. This second window must be deleted manually (in the - current version - a future release will probably fix this problem). - - - Interactive Command: else-move-n-placeholders - Command to move to the "next" placeholder where "next" is - controlled by the `else-direction' custom variable i.e. if - `else-direction' is on then this command will invoked the - `else-next-placeholder' (`C-c / n') command, if the - `else-direction' flag is off then it will invoke the - `else-previous-placeholder' (`C-c / p'). This command was added - for "usability" for VR Programming, it helps reduce the number of - voice commands required to use ELSE. - - - Interactive Command: else-show-token-names - Display names of all of the Tokens in the current language - template set, sort them alphabetically and display them in a - temporary buffer. - - - Interactive Command: else-show-placeholder-names Display names of - all of - the Placeholders in the current language template set, sort them - alphabetically and display them in a temporary buffer. - - - Interactive Command: else-toggle-direction - Command to toggle the custom variable `else-direction'. - - - Command: else-uncomment-placeholders - This command will go through the current buffer looking for - placeholders that have been "commented out" using the comment - syntax of the current major mode. The language comment syntax will - be removed. - - - Interactive Command: else-wrap-region - "Wrap" a template around a region of code. Mark the region to be - enclosed by the template and then run this command, it will prompt - for the placeholder name. - - ---------- Footnotes ---------- - - (1) Note that if the placeholder text within the `{}''s or `[]''s is -not defined then the command will not recognise the placeholder string, -this is a common error when the user has manually (mis-)typed a -placeholder and can't work out why ELSE won't expand it. - - -File: else, Node: Using ELSE, Next: Creating and Modifying Templates, Prev: Command Summary, Up: Top - -Using ELSE -********** - - ELSE has been implemented as a minor mode of Emacs. This means that -each buffer within Emacs may have it own set of language templates -enabled, the only limit is the system resources that is running the -editor. So, Emacs may have multiple language definitions loaded at any -one time i.e. the user may be interfacing an Ada program to a C program -and so editing an Ada module in one buffer and a C file in another -buffer, ELSE could be enabled for both buffers and they will each have -the appropriate set of language templates enabled. The following -sections detail how to start up ELSE and use it in the course of normal -code entry. - -* Menu: - -* Invoking ELSE:: How to start it up and what you get. -* Navigating:: -* Expanding Placeholders:: How to expand Placeholders. -* Expanding Tokens:: How to expand Tokens. -* Deleting Placeholders:: -* Preparing for Compilation:: -* Disabling ELSE:: Sometimes you just don't want ELSE to be active. - - -File: else, Node: Invoking ELSE, Next: Navigating, Prev: Using ELSE, Up: Using ELSE - -Invoking ELSE -============= - - ELSE has been implemented as a minor mode of Emacs, it determines -which language specification to load either from the buffer's major -mode or, if it can't locate an appropriate template file name (*note -Building the Language Template File Name::), then it will prompt the -user to enter the template name. For example, if the major mode for the -current buffer is "C", then the major mode name will be "C" and ELSE -will attempt to load the "C" template file using the name "C.lse" -(*note Building the Language Template File Name::). Note that ELSE will -first check if the template file for the major mode is already loaded, -if not then it will search (*note Building the Language Template File -Name::) for the file, if it can't find the file then it will prompt the -user to enter a file name. - - After loading the language template file, ELSE will then search for a -"customisation" file for that particular language. The name of this -file is of the form <language_name>-cust.lse i.e. in the case of -loading a template file for the C language it would look for a -customisation file called C-cust.lse located anywhere in the load path. -Refer to *note Customising An Existing Template Language:: for more -information on this feature. - - To invoke ELSE use the command `else-mode'. If the current buffer is -empty then ELSE will insert the "initial_string" for the language -(*note Creating and Modifying Templates::) and position the cursor -within the placeholder(1). - - ---------- Footnotes ---------- - - (1) The four primary else commands (else-expand-placeholder, -else-next/previous-placeholder and else-kill-placeholder) each check -whether else-mode is enabled and will invoke it automatically if not set - - -File: else, Node: Navigating, Next: Expanding Placeholders, Prev: Invoking ELSE, Up: Using ELSE - -Navigating Using ELSE -===================== - - Use the `else-next-placeholder' (`C-c / n') and -`else-previous-placeholder' (`C-c / p') commands to navigate forwards -and backwards through the buffer being edited. These commands will -locate the next/previous valid placeholder and move point into the -middle of the placeholder text. Each command can take a numeric -argument, if the desired number of placeholders are not available, then -point will be positioned to the last/first placeholder in the buffer. - - -File: else, Node: Expanding Placeholders, Next: Expanding Tokens, Prev: Navigating, Up: Using ELSE - -Expanding Placeholders -====================== - - Placeholders are expanded by positioning the cursor between the -`{}''s or `[]''s and executing the `else-expand-placeholder' (`C-c / -e') command. If the placeholder string is a valid placeholder then ELSE -will provide one of the following responses: - - 1. Replace the placeholder with a lower level language construct e.g. - [context_clause] ==> with {library_unit_name}...; [use_clause] - - 2. Provide a choice of possible lower level language constructs via a - menu selection scheme e.g. - [type_declaration] ==> full_type_declaration - incomplete_type_declaration - private_type_declaration - private_extension_declaration - - 3. Provide a prompt to the user that this is the lowest possible - expansion and that the user must type in a replacement string i.e. - expansion of the Ada placeholder `{expression}' will display the - prompt: - Enter an Ada expression as defined in section 4.4 of the LRM, - for example: - 4.0, Pi, (1 .. 10 => 0), Integer'Last, Sine(X), not Destroyed - Color'(Blue), 2*Line_count, -4.0 + A, B**2 - 4.0*A*C - - If a placeholder is followed by ellipses (...) then ELSE will -reproduce the placeholder automatically as the user either expands or -types into a placeholder. The placeholder may be replicated in either -the horizontal (same line) or vertical direction. The direction of -replication (*note Duplication Specifier::) is determined in the -definition of the placeholder. - - -File: else, Node: Expanding Tokens, Next: Deleting Placeholders, Prev: Expanding Placeholders, Up: Using ELSE - -Expanding Tokens -================ - - Tokens can best be thought of as a handy abbreviation for a -placeholder that can be expanded e.g. the token "if", when expanded, -gives the language construct for the if statement (example taken from -the C language templates but this is a very common token definition) -i.e. - - if ==> if ({expression}) - { - {statement}... - } - [else statement] - - Tokens are most commonly used when the main portion of the code has -been entered and the programmer/user is in the compile/fix-up cycle -i.e. the placeholders have been removed from the source file to make it -compilable but the programmer needs to add further statements. The -options available at this point depends on the scope of the change -required, if a major piece of code needs to be added then it is usually -best to manually type in a placeholder that can be used as a good -starting point e.g. [statement]... is a pretty common definition in -almost any language definition template. - - -File: else, Node: Deleting Placeholders, Next: Preparing for Compilation, Prev: Expanding Tokens, Up: Using ELSE - -Deleting Placeholders -===================== - - Use the command `else-kill-placeholder' (`C-c / k') to delete a -placeholder located under point. Note that if the placeholder is a -mandatory entry (enclosed by `{}''s rather than `[]''s) then ELSE will -issue an error message and ring the bell. - - To delete all placeholders in a buffer, use the command -`else-cleanup-placeholders'. This command will start at the beginning of -the buffer and delete every placeholder (mandatory or optional) -contained in the buffer. This is a convenient method of performing a -"final" clean-up after completing the coding of an program file. - - -File: else, Node: Preparing for Compilation, Next: Disabling ELSE, Prev: Deleting Placeholders, Up: Using ELSE - -Preparing for Compilation -========================= - - Often a user will wish to compile the current buffer even though -code entry has not been completed. Two commands are provided for -convenience during this phase of coding: - - 1. `else-comment-placeholders' -- Comment all lines that contain - placeholders, this uses the comment syntax defined by the current - major mode. It uses the Emacs `comment-region' command to - accomplish this process (1) - - 2. `else-uncomment-placeholders' -- Uncomment all placeholders in the - current buffer. This command is provided to reverse the effects of - the `else-comment-placeholders' command and return the buffer to a - state ready for more code entry by the user. - - ---------- Footnotes ---------- - - (1) you definitely want to do this because the typical compiler won't -compile ELSE placeholder templates! But it is a "nice to have" because -you might not have finished writing code and thus don't want to lose -all of your placeholders. By using `else-uncomment-placeholders' you -can quickly reverse the effect and start coding again. - - -File: else, Node: Disabling ELSE, Prev: Preparing for Compilation, Up: Using ELSE - -Disabling ELSE -============== - - To disable ELSE just type the command `else-mode' to toggle ELSE -off. Note that any template language definitions that have been loaded -will remain loaded into Emacs memory. To explicitly delete a set of -language definitions the user must either stop and re-start the Emacs -session or use a DELETE LANGUAGE specifier (*note Language -Identification::) which must be "compiled" by ELSE using the command -`else-compile-buffer' (*note Command Summary::). - - -File: else, Node: Creating and Modifying Templates, Next: Custom Variables, Prev: Using ELSE, Up: Top - -Creating and Modifying Templates -******************************** - - This section covers the details of how to create and modify language -template definitions. The aim is to give the user a basic -understanding, which when coupled with looking at real template -definitions, will allow the creation of new language templates and the -customisation of existing template definitions. - - Commands that are used in this activity are: - - 1. `else-compile-buffer' -- "compiles" ELSE template definitions from - point until the end of the current buffer. When supplied with a - numeric argument (`C-u'), will compile from the beginning of the - current buffer. - - 2. `else-extract-all' -- will "extract" the definition of the entire - enabled language definition file into the current buffer at point. - - 3. `else-extract-placeholder'(1) -- extract the template definition - of a placeholder into the current buffer at point. The command will - prompt the user for the name of the placeholder to extract. - - 4. `else-extract-token' -- extract the template definition of a token - into the current buffer at point. The command will prompt the user - for the name of the token to extract. - -* Menu: - -* Syntactic Conventions:: -* Customising An Existing Template Language:: -* Extracting Placeholders or Tokens:: -* Create a New Language:: How to create a new language template -* Definition of the Template Structure:: -* Example of Creating A New Language Template:: - - ---------- Footnotes ---------- - - (1) These commands provide "auto-completion" for the convenience of -the user - - -File: else, Node: Syntactic Conventions, Next: Customising An Existing Template Language, Prev: Creating and Modifying Templates, Up: Creating and Modifying Templates - -Syntactic Conventions for Template Definitions -============================================== - - General syntactic conventions used in a language template file: - - 1. Template definitions are not case sensitive i.e. a placeholder - definition for If_Statement is the same as a definition for - IF_STATEMENT. Also the current version of ELSE expects all - "standard" template definition strings (such as DEFINE, LANGUAGE - etc) to be upper case. I don't really see any reason to fix this - up, it would just slow down the regular expression searching when - the template file is loaded. The only exception to the case - sensitivity rule is that the language name is case sensitive i.e. - if you are defining a new definition for Emacs-Lisp and call it - EMACS-LISP then you will get an error message to the effect that - language Emacs-Lisp doesn't exist! - - 2. Enclose text strings that contain embedded spaces with quotes. - - 3. Enclose _text strings_ to the right of an equal (=) sign in - quotes, this rule does not apply to "standard" values such as - `NONTERMINAL, TERMINAL, MENU' etc. - - -File: else, Node: Customising An Existing Template Language, Next: Extracting Placeholders or Tokens, Prev: Syntactic Conventions, Up: Creating and Modifying Templates - -Customising An Existing Template Language -========================================= - - Probably the first thing you will want to do after the initial -exploration of using ELSE is to start to customise the templates for -your own environment and use. Experience will show that only a small -number of templates require customisation and then it will largely -depend upon the "phase" in your code entry i.e. you might find yourself -coding a section that has a large number of `case' constructs and not -so many `if' constructs, so rather than have to pass over the `if' -construct in a menu to get to the `case' construct continually, just -customise the "statement" placeholder so that the `case' construct -occurs before the `if' construct i.e. - - Before: - DELETE PLACEHOLDER STATEMENT - - /LANGUAGE="Ada" - - DEFINE PLACEHOLDER STATEMENT - - /LANGUAGE="Ada" - - /NOAUTO_SUBSTITUTE - - /DESCRIPTION="" - /DUPLICATION=CONTEXT_DEPENDENT - - /SEPARATOR="" - - /TYPE=MENU - - - "null_statement"/PLACEHOLDER - "if_statement"/PLACEHOLDER - "case_statement"/PLACEHOLDER - "loop_statement"/PLACEHOLDER - "block_statement"/PLACEHOLDER - "accept_statement"/PLACEHOLDER - . - . - . - - END DEFINE - - After: - DELETE PLACEHOLDER STATEMENT - - /LANGUAGE="Ada" - - DEFINE PLACEHOLDER STATEMENT - - /LANGUAGE="Ada" - - /NOAUTO_SUBSTITUTE - - /DESCRIPTION="" - /DUPLICATION=CONTEXT_DEPENDENT - - /SEPARATOR="" - - /TYPE=MENU - - - "case_statement"/PLACEHOLDER - "if_statement"/PLACEHOLDER - "null_statement"/PLACEHOLDER - "loop_statement"/PLACEHOLDER - "block_statement"/PLACEHOLDER - "accept_statement"/PLACEHOLDER - . - . - . - - END DEFINE - - To achieve the above change you would perform the following sequence: - - 1. Extract the definition for STATEMENT using the command - `else-extract-placeholder' and supplying STATEMENT as the argument; - - 2. Edit the definition by swapping the "if_statement" and - "case_statement" lines and moving the "null_statement" below the - "if_statement" line; - - 3. "compile" the new definition by positioning point at the beginning - of the `DELETE PLACEHOLDER' line and running the command - `else-compile-buffer'. - - Note that you can accomplish the above in any buffer in your Emacs -session. The change will only exist for that edit session unless you -either save the changed template definition (either into the main -language template file or the language custom file). - - Note also that the language templates are held as a `global' -variable within the Emacs session, so any changes you make to the -template definitions in one buffer will be in effect for every other -buffer that has ELSE mode enabled and that particular set of language -templates selected. - - Other reasons for the desire to perform customisation of a set of -language templates also exist. One such is the establishment of a -"global" set of common templates across a number of users (usually to -help enforce project coding standards). In this case, each user may -want to provide their own customisations but make sure that they don't -impinge on other users. For this reason, ELSE searches and loads a -"customisation" language file immediately after loading the primary -language file i.e. loading a language file comprises two steps, the -loading of the <language>.lse file and then the searching and loading -of a customisation file <language>-cust.lse. The customisation file may -be located anywhere in the Emacs load path i.e. it doesn't have to be -in the same directory as the primary template file and can be used to -not only provide new template definitions but also provide "overrides" -for definitions in the "global" language template file. In this manner, -we can achieve several goals: - - 1. distribution of a standard language template file which remains - constant; and - - 2. allow projects and groups to use the same template file. - - and yet still provide the facility to have individual template -characteristics. An example of this is the first release of ELSE -contained language template files that contained file and function -headers that had been customised for previous projects and coding -standards that I had worked on. These definitions went out in the -original distribution as an example of how people could produce such -things but neglected the very real problem of providing a central -repository for a standard set of templates for a particular language. -The current language template file distribution have these definitions -extracted from the main template file and <language>-cust.lse files are -provided with these definitions in them. These definitions can then be -readily edited for the particular project the user is working on -without incurring incompatibilities with the central distribution. - - The main feature of the ELSE definition language that allows these -customisations to work is the sequence of a template definition where -the placeholder/token is first DELETE'd and then DEFINE'd (*note Delete -Placeholder Statement:: and *Note Define Placeholder Statement::). This -means that any existing template definition is wiped and then -completely redefined for the current edit session. - -* Menu: - -* Extracting Placeholders or Tokens:: How to extract a placeholder or token - - -File: else, Node: Extracting Placeholders or Tokens, Next: Create a New Language, Prev: Customising An Existing Template Language, Up: Creating and Modifying Templates - -Extracting Placeholders or Tokens -================================= - - To customise a set of language template definitions you can either -edit the original definition file to make the change permanently or, if -you are after just a temporary change to a definition, you can -`extract' the definition into the current buffer, make your change and -then recompile the definition into the current editing session. - - The commands to access the currently loaded language definitions are -`else-extract-all', `else-extract-placeholder' or `else-extract-token'. -The latter two commands will extract an individual definition of the -type indicated whereas the first command will extract the entire -definition. The process of "extraction" will leave the desired -definition in the current buffer at `point'. Note that definition name -completion is available when typing in the name of the definition to -extract. Once the modifications have been made then the definition can -be re-compiled into ELSE using the command `else-compile-buffer' (*Note -Command Summary::. - - These changes go into effect at a global level i.e. if there are -multiple buffers loaded with the same language template then they all -see the same change. - - -File: else, Node: Create a New Language, Next: Definition of the Template Structure, Prev: Extracting Placeholders or Tokens, Up: Creating and Modifying Templates - -Creating a New Language -======================= - - A language template file is best started from a set of EBNF for the -target language. The structure of the language definitions take the -form of the classical inverted tree structure commonly found in -computer science literature i.e. portion of the Ada language template -structure looks like: - - initial string - | - --------------------------------------------------------------- - | | | | - library_unit_declaration library_unit_body separate_body ... - . | . - . --------------------- . - . | | . - subprogram_body package_body - - Here the placeholder definitions of `subprogram_body' and -`package_body' expand directly to the language constructs and the user -is then taken to the top of the tree again for the "lower level" -definitions. - - Each template file starts out with a "language definition" template -(*note Language Definition Template::) (the root of the tree) and then -proceeds into the individual branches using placeholder and token -definitions. Each element of the template syntax is defined and -explained in the following sections. - -* Menu: - -* Language Definition Template:: -* Overriding Language Attributes:: - - -File: else, Node: Language Definition Template, Next: Overriding Language Attributes, Prev: Create a New Language, Up: Create a New Language - -Language Definition Template ----------------------------- - - The language definition template is (note that the valid identifier -characters are shown here as split across two lines for documentation -purposes, this should not be done in a language definition file)(1): - - 1 DELETE LANGUAGE "Ada" - - 2 DEFINE LANGUAGE "Ada" - - 3 /INITIAL_STRING="{compilation_unit}..." - - 4 /PUNCTUATION_CHARACTERS=",|;" - 5 /SELF_INSERT_CHARACTERS=" `~!@#$%^&*(),.<>/?;:'[]{}=\-+|"" - 6 /VALID_IDENTIFIER_CHARACTERS="abcdefghijklmnopqrstuvwxyzABCDEF \ - GHIJKLMNOPQRSTUVWXYZ_0123456789-" - 7 /INDENT_SIZE=2 - - 8 /VERSION=1.7 - - END DEFINE - - - Example Language Definition - - -* Menu: - -* Language Identification:: -* Initial String:: -* Punctuation characters:: -* Self Insert Characters:: -* Valid Identifier Characters:: -* Indentation Size:: -* Template Version:: - - ---------- Footnotes ---------- - - (1) Line numbers are added to aid in the referencing in later -sections - - -File: else, Node: Language Identification, Next: Initial String, Prev: Language Definition Template, Up: Language Definition Template - -Language Identification -....................... - - `Lineno 1 - 2' -- Any given Emacs session can have multiple source -files loaded, each with their own set of language templates i.e. the -user could be editing a C source file, a C++ source file and an Ada -source, ELSE could be turned on for each buffer. So, language -definition files need a mechanism to uniquely identify the language to -which the definition will be applied. A language definition file always -starts out with the same two lines, the `DELETE LANGUAGE {language -name}'(1) and `DEFINE LANGUAGE {language name}'. Because each ELSE -session is customisable, each template definition construct (`LANGUAGE', -`PLACEHOLDER' and `TOKEN') includes a `DELETE' and `DEFINE' command -pair. By using a convention of `DELETE' and then `DEFINE' we ensure -that the definition being "replaced" or changed will be deleted and -then defined anew. Thus to define a new language the following two -lines are: - - DELETE LANGUAGE "XXX" - - DEFINE LANGUAGE "XXX" - - - This deletes a complete language definition called "XXX" (and all of -its associated placeholder and token definitions) and then commences -defining a new language called "XXX". - - ---------- Footnotes ---------- - - (1) Note that language name is case sensitive i.e. Ada and ADA are -two different language names - - -File: else, Node: Initial String, Next: Punctuation characters, Prev: Language Identification, Up: Language Definition Template - -Initial String -.............. - - `Lineno 3' -- The specifier `/INITIAL_STRING' defines the textual -string to be inserted on the condition that the buffer in which ELSE is -being turned on is empty. When ELSE mode is enabled for a buffer it -will make sure the appropriate set of language definitions are loaded -and then check if the buffer is empty, if the buffer is empty then the -text string defined by this specifier will be inserted into the buffer. -This text string is usually the template that appears at the top of the -language definition tree i.e. `{compilation_unit}'. - - -File: else, Node: Punctuation characters, Next: Self Insert Characters, Prev: Initial String, Up: Language Definition Template - -Punctuation characters -...................... - - `Lineno 4' -- The specifier `/PUNCTUATION_CHARACTERS' defines the -punctuation characters for the language being defined. This affects how -the "housekeeping" efforts of ELSE work. It helps the code determine -where whitespace should or should not occur. e.g. when deleting the -optional placeholder for the parameters of the following procedure -specification: - - procedure TEST [formal_part]; - - then we want the following: - procedure TEST; - rather than: - procedure TEST ; - In this example, the function `else-kill-placeholder' (`C-c / k') -command noticed that the `;' character is defined as a punctuation -character by the Ada Language Definition and thus it should ensure that -no whitespace exists between the punctuation character and the -preceeding function name. - - -File: else, Node: Self Insert Characters, Next: Valid Identifier Characters, Prev: Punctuation characters, Up: Language Definition Template - -Self Insert Characters -...................... - - `Lineno 5' -- When the user inserts keystrokes into an ELSE enabled -buffer the code has to check if the cursor is within an placeholder, if -it is then the desired behaviour is for ELSE to automatically delete -the placeholder and replace it with the keypresses that are coming from -the keyboard. The strings defined by `/SELF_INSERT_CHARACTERS' and -`/VALID_IDENTIFIER_CHARACTERS' are both used for this purpose. - - -File: else, Node: Valid Identifier Characters, Next: Indentation Size, Prev: Self Insert Characters, Up: Language Definition Template - -Valid Identifier Characters -........................... - - `Lineno 6' -- This attribute is used during token searches to allow -ELSE to correctly identify the text string that the user may be -attempting to expand. When the user runs `else-expand-placeholder' -(`C-c / e') ELSE "compiles" the string specified by the -/VALID_IDENTIFIER_CHARACTERS attribute into the following Elisp regular -expression: - - [^%s+] - - where the "%s" is replaced by the text string -/VALID_IDENTIFIER_CHARACTERS. This regular expression means "search for -any character which is not in the range of characters". The entire -string between "point" (current cursor location) and the character -found by this search is taken to be the text of the token the user is -requesting an expansion for. - - Since this search uses Emacs regular expression syntax, care needs -to be exercised in the text actually placed in the -/VALID_IDENTIFIER_CHARACTERS attribute. If the user wishes to alter -this attribute, they are advised to become familiar with Emacs regular -expression syntax prior to attempting any changes. - - As an example, the following situation is put -- the user wants to -modify a set of language templates so that they can use a token -consisting of the character sequence "?:" (the "C" ternary operator -could be generated this way). Just creating a token with a name of "?:" -will not work as the two characters will not be part of the -/VALID_IDENTIFIER_CHARACTERS set and therefore attempting to "expand" -the string "?:" would fail to find a valid string to search the token -database with. - - So the logical first cut by the unwary would be to add these -characters at the end of the existing string attribute for -/VALID_IDENTIFIER_CHARACTERS thusly: - - /VALID_IDENTIFIER_CHARACTERS="abcdefghijklmnopqrstuvwxyzABCDEF \ - GHIJKLMNOPQRSTUVWXYZ_0123456789-?:" - - However, since this string is used as a regular expression, the -character sequence "9-?" will be interpreted as "all characters in the -range from 9 to ?" rather than as the user intended i.e. the individual -characters "9", "-", "?" and ":". The "correct" place to add the -sequence "?:" would be anywhere in the string _other than_ at the end -of the /VALID_IDENTIFIER_CHARACTERS string i.e. this would be the -correct method of implementing this change: - - /VALID_IDENTIFIER_CHARACTERS="abcdefghijklmnopqrstuvwxyzABCDEF \ - GHIJKLMNOPQRSTUVWXYZ_0123456789?:-" - - In fact, it might be better for template maintainers to make the -treatment of /VALID_IDENTIFIER_CHARACTERS more "obvious" by using -something like this: - - /VALID_IDENTIFIER_CHARACTERS="a-zA-Z_0-9-" - - If a "user" was faced with modifying this, they might be tempted to -read further? - - -File: else, Node: Indentation Size, Next: Template Version, Prev: Valid Identifier Characters, Up: Language Definition Template - -Indentation Size -................ - - `Lineno 7' -- The line - /INDENT_SIZE=2 - - - allows customisation of the identation of the code generated using -ELSE. This attribute allows the user to specify the indentation of each -line of the template. It provides a single point for the user to change -the indentation of the code generated by ELSE (previous versions of -ELSE did not contain this feature and thus, if your coding standard -required indention differently to that specified by the standard base -template, then you would have to edit the entire template file and -change all indented lines to the level required by your coding -standard). - - As ELSE loads and scans the template definition file it determines a -"normalised" value for the indentation of each line within each -definition by making the first line that shows an indentation (leading -space(s)) from the first line of the definition. If subsequent lines -show indentation which is greater that the "normalised" value then it -is assigned a further multiple of the INDENT_SIZE. This continues for -the scanning of the definition and the indentation of each line is -stored by ELSE. When ELSE is asked to insert the text lines for a -definition then it multiples each indentation value by the value -specified by INDENT_SIZE i.e. as an example, the text definition of a -switch statement might be: - - "switch ({expression}) {" - " [case_part]..." - " [default_part]" - "}" - - Here we see at line 2 that we have an indentation of 3 spaces -- -this value is calculated as a value of indentation of 1 times the value -contained in INDENT_SIZE. When line 3 is scanned, ELSE notes that it is -further indented and assigns a value of 2 to that line. When line 4 is -scanned ELSE notes that it has no indentation compared with line 1 and -is assigned an indentation level of 0 to that line. - - When ELSE inserts this definition, it will take the indentation -value of each line (0 for lines 1 and 4, 1 for line 2, 2 for line 3) -and insert the number of spaces determined by the indentation level -multipled by the value of INDENT_SIZE. Thus line 0 would be inserted -with no extra spaces, line 1 would have 2 spaces inserted, line 3 would -have 4 spaces inserted and line 4 would have 0 spaces inserted e.g. - - switch ({expression}) { - [case_part]... - [default_part] - } - - To change the indentation of lines in ELSE, all the user has to do -is change the value of /INDENT_SIZE and "recompile" the language -template definition file. - - Note that if there is no indentation size specified then a default -value of 4 will be assumed. ELSE will produce a message when compiling -a language that contains no indentation size attribute specifier. - - Where the user might want to override the spacing of templates as -they are scanned by ELSE i.e. textual headers for functions/files might -be an example. ELSE has the facility of allowing "hard" spaces to be -inserted at the beginning of each line of a definition. These hard -spaces are indicated by a '@' character i.e. - - DELETE PLACEHOLDER MODULE_LEVEL_COMMENTS - - /LANGUAGE="C" - - DEFINE PLACEHOLDER MODULE_LEVEL_COMMENTS - - /LANGUAGE="C" - - /NOAUTO_SUBSTITUTE - - /DESCRIPTION="" - /DUPLICATION=CONTEXT_DEPENDENT - - /SEPARATOR="" - - /TYPE=NONTERMINAL - - - "/* ===[ {module} ]=============================================//" - "" - "@Description: {text}" - "" - "@Revisions:" - "" - "@@REV DATE BY DESCRIPTION" - "@------ --------- --- ---------------------------------//" - "" - "@--------------------------------------------------------------//" - "" - "@@This item is the property of ResMed Ltd, and contains confid//" - "@@secret information. It may not be transfered from the custod//" - "@@ResMed except as authorised in writing by an officer of ResM//" - "@@item nor the information it contains may be used, transfered//" - "@@published, or disclosed, in whole or in part, and directly o//" - "@@except as expressly authorised by an officer of ResMed, purs//" - "@@agreement." - "" - "@@Copyright (c) 2002 ResMed Ltd. All rights reserved." - "@==============================================================//" - "" - - END DEFINE - - -File: else, Node: Template Version, Prev: Indentation Size, Up: Language Definition Template - -Template Version -................ - - `Lineno 8' -- The line - /VERSION=1.7 - - - indicates what version this particular language template file is. -This is a better solution to placing version labels in the comments -portion of language template files as if a user decides to "extract" -the entire language set then any comment headers are lost -- this -attribute allows people to see what version of the template file was -used as the base when the language template set was compiled. - - -File: else, Node: Overriding Language Attributes, Prev: Language Definition Template, Up: Create a New Language - -Overriding Language Attributes ------------------------------- - - You can "override" any of the attributes of a language (attributes -have been described above) by providing a single `DEFINE LANGUAGE' -statement without the (normally) preceding `DELETE LANGUAGE' statement. -Just include the attribute that you wish to "override" and the new -value will take effect when you "compile" the new language definition. -Currently this feature of ELSE is only really useful for the -`/INDENT_SIZE' attribute i.e. the baseline language file may define a -value that is not appropriate for your project so you can redefine it -to some other value by placing a `DEFINE LANGUAGE' statement in the -<lang>-cust.lse file. For example, the following will re-define the -indentation size of C Language template definitions to be 4 spaces: - - - DEFINE LANGUAGE C - - /INDENT_SIZE=4 - - - END DEFINE - - When ELSE meets such a situation it will issue a "warning" message -i.e. "Language XXX exists, assuming attribute modification". - - -File: else, Node: Definition of the Template Structure, Next: Example of Creating A New Language Template, Prev: Create a New Language, Up: Creating and Modifying Templates - -Definition of the Template Structure -==================================== - - The remainder of the language definition file may contain a mixture -of placeholder and token definitions. The order in which they appear is -not important as no attempts are made at cross checking definitions and -their use whilst the language definition file is being loaded. Perhaps -one day there will be an explicit command to aid template developers to -check for "holes" by performing a consistency check. - -* Menu: - -* Placeholders:: -* Tokens:: -* Hooking Elisp Code into ELSE Templates:: - - -File: else, Node: Placeholders, Next: Tokens, Prev: Definition of the Template Structure, Up: Definition of the Template Structure - -Placeholder Definition ----------------------- - - A typical placeholder definition is shown below. Note that the line -numbers are added as an aid in the following sections that explain each -portion of this structure. Each section will reference the appropriate -section by use of a line number. Texinfo doesn't seem to offer -appropriate x-referencing in this area, so each section will just -mention `Lineno: X'. - - 1 DELETE PLACEHOLDER IF_STATEMENT - - 2 /LANGUAGE="Ada" - - 3 DEFINE PLACEHOLDER IF_STATEMENT - - 4 /LANGUAGE="Ada" - - 5 /NOAUTO_SUBSTITUTE - - 6 /SUBSTITUTE_COUNT=2 - - 7 /DESCRIPTION="" - - 8 /DUPLICATION=CONTEXT_DEPENDENT - - 9 /SEPARATOR="" - - 10 /TYPE=NONTERMINAL - 11 - 12 "if {condition} then" - 13 " {statement}..." - 14 "[elsif_part]" - 15 "[else_part]" - 16 "end if;" - 17 - 18 END DEFINE - - The following sections explain each construct used in this -definition. - -* Menu: - -* Delete Placeholder Statement:: -* Language Specifier:: -* Define Placeholder Statement:: -* Auto Text Substitute:: -* Description Specifier:: -* Duplication Specifier:: -* Separator Specification:: -* Type Specifier:: -* Template Body:: -* Placeholder Cross-Referencing:: -* End Define Command:: - - -File: else, Node: Delete Placeholder Statement, Next: Language Specifier, Prev: Placeholders, Up: Placeholders - -Delete Placeholder Statement -............................ - - `Lineno 1' -- This statement tells ELSE to delete a placeholder -called `IF_STATEMENT' from the language template definitions for the -language "Ada" (as defined in the next line -- *note Language -Specifier::). The placeholder name may be any combination of -characters between the range of SPC to ~. If the name contains one or -more spaces, then it must be wholly enclosed by quotation marks. - - -File: else, Node: Language Specifier, Next: Define Placeholder Statement, Prev: Delete Placeholder Statement, Up: Placeholders - -Language Specifier -.................. - - `Lineno 2 & 4' -- The language specifier `/LANGUAGE="Ada"' defines -the particular language set to which the preceeding template command -applies. This line must follow the commands `DEFINE PLACEHOLDER' or -`DELETE PLACEHOLDER'. - - -File: else, Node: Define Placeholder Statement, Next: Auto Text Substitute, Prev: Language Specifier, Up: Placeholders - -Define Placeholder Statement -............................ - - `Lineno 3' -- This statement tells ELSE to define a placeholder -called `IF_STATEMENT' from the language definition identifier in the -next line (*note Language Specifier::). The placeholder name may be any -legal combination of the following characters: - - `A-Z 0-9_' - - If the name contains embedded spaces then it must be enclosed by -quotation marks. - - -File: else, Node: Auto Text Substitute, Next: Description Specifier, Prev: Define Placeholder Statement, Up: Placeholders - -Auto Text Substitute -.................... - - `Lineno 5 --- Lineno 6' -- The attribute on Lineno 5 has two possible -values: `/AUTO_SUBSTITUTE' or `/NOAUTO_SUBSTITUTE'. It works in -conjunction with count specified by the attribute on Lineno 6. This -attribute exists because it is quite common in many languages (or -coding styles) to repeat a text string multiple times within a language -construct e.g. in Ada the package name (`designator') is an optional -entry at the end of the package body: - - 1 package body {designator} is - 2 {declarative_item}... - 3 [begin_package_body] - 4 end [designator]; - - In the above example, it would be desirable if the second occurrence -of the "designator" string, shown at lineno 4, could be replaced with -the text of the first "designator" string (lineno 1) as the user types -it into the buffer. To achieve this behaviour in ELSE, the definition -of the "designator" placeholder would have the auto-substitute -attribute set and the substitution count attribute set as follows: - - DELETE PLACEHOLDER DESIGNATOR - - /LANGUAGE="Ada" - - DEFINE PLACEHOLDER DESIGNATOR - - /LANGUAGE="Ada" - - /AUTO_SUBSTITUTE - - /SUBSTITUTE_COUNT=2 - - . - . - . - - END DEFINE - - The general behaviour of ELSE is that whenever the user starts to -enter text whilst positioned within a placeholder, ELSE will examine -the auto-substitute attribute for that placeholder and if it is set to -`AUTO_SUBSTITUTE' it will then search forward in the buffer looking for -`SUBSTITUTE_COUNT' matches of the placeholder string. Each matching -portion of the buffer is tagged using Emacs markers, then as the user -types in the text string at the first placeholder, the same text -(including backspaces etc) is repeated at each of the subsequent -matching sites. The duplication of changes to the subsequent textual -areas continues until the user makes a change to the buffer that is -outside the area of the original placeholder. Once such a change occurs -then all auto-substitution makers are erased. - - The default value for the `/SUBSTITUTE_COUNT' attribute is 1 i.e. -there will be one other place to perform a substitution. - - The following example shows an interesting example of the use of the -auto-substitute feature in the C language to create a "custom" -placeholder definition for the for loop i.e. it is quite common to have -a for loop where the count variable is repeated at three different -points in the same line. By defining a special placeholder name with an -auto-substitute count set appropriately then we can save some typing -i.e. - - DELETE TOKEN FOR - - /LANGUAGE="C" - - DEFINE TOKEN FOR - - /LANGUAGE="C" - - /DESCRIPTION="conditional, repeated statement execution" - - "for ({loop_var} = [0]; {loop_var} [<] {value}; {loop_var}[++])" - "{" - " {statement}..." - "}" - - END DEFINE - - DELETE PLACEHOLDER LOOP_VAR - - /LANGUAGE="C" - - DEFINE PLACEHOLDER LOOP_VAR - - /LANGUAGE="C" - - /AUTO_SUBSTITUTE - - /SUBSTITUTE_COUNT=2 - - /DESCRIPTION="" - - /DUPLICATION=CONTEXT_DEPENDENT - - /SEPARATOR="" - - /TYPE=TERMINAL - - "Enter a variable name." - - END DEFINE - - Here, the "loop_var" placeholder is defined to auto-substitute with -2 further occurrences. As the user types into the first occurrence of -the placeholder then that text will be repeated twice more. - - Note that if the placeholder definition specifies a repeat count but -that number of matches cannot be found at run-time then only the -placeholders that were matched will have the substitution performed. - - Another thing to note about this example, is that it shows a for -loop definition with some "common" options i.e. the initial value is -defined as a placeholder with a value of `0' when expanded, the loop -test is defined with a default of '<' and the loop counter is defined -with a default value of increment i.e. `++'. Since all three of these -items are defined as placeholders, the user has the option of -navigating between them and either selecting the default value or -typing in a new value. - - -File: else, Node: Description Specifier, Next: Duplication Specifier, Prev: Auto Text Substitute, Up: Placeholders - -Description Specifier -..................... - - `Lineno 7' -- This specifier defines a text string which will appear -with the placeholder if it is referenced from a menu item. This acts as -a one line help string for the user in menu displays. An empty -description is defined by """". - - -File: else, Node: Duplication Specifier, Next: Separator Specification, Prev: Description Specifier, Up: Placeholders - -Duplication Specifier -..................... - - `Lineno 8' -- This specifier is used to define how the template will -be duplicated if the ellipses are found after the placeholder text in -the buffer i.e. `[statement]...' tells ELSE to keep repeating the -placeholder `[statement]' whenever the user expands (or types into) it. -The possible values are: - - 1. VERTICAL -- the placeholder is duplicated vertically onto the next - line. - - 2. HORIZONTAL -- the placeholder is duplicated on the same line to - the right of the placeholder being expanded. - - 3. CONTEXT_DEPENDENT -- means the placeholder will be duplicated in - either the vertical or horizontal direction. Some simple rules are - applied in this case, if the placeholder is alone on the line then - it is duplicated vertically, if there is text on the same line - before the placeholder then it will be duplicated in the - horizontal e.g. - - [statement]... ==> if {condition} then - {statement}... - [elsif_part] - [else_part] - end if; - [statement]... - - - Example of Vertical Duplication - - - - - when {discrete_choice}... => ==> when RED | [discrete_choice]... => - - - Example of Horizontal Duplication - - -File: else, Node: Separator Specification, Next: Type Specifier, Prev: Duplication Specifier, Up: Placeholders - -Separator Specification -....................... - - `Lineno 9' -- The specifier `/SEPARATOR' is used to indicate the -characters that should be inserted automatically when the placeholder is -duplicated e.g. Ada uses the `|' character as a logical `or' symbol when -multiple conditions are applicable in a case statement, so when each -occurrence of the placeholder is expanded then ELSE automatically -inserts the character(s) defined by this specifier as part of the -placeholder duplication e.g. the placeholder definition for -"discrete_choice" is: - - DELETE PLACEHOLDER DISCRETE_CHOICE - - /LANGUAGE="Ada" - - DEFINE PLACEHOLDER DISCRETE_CHOICE - - /LANGUAGE="Ada" - - /NOAUTO_SUBSTITUTE - - /DESCRIPTION="" - - /DUPLICATION=CONTEXT_DEPENDENT - - /SEPARATOR=" | " - /TYPE=MENU - - "expression"/PLACEHOLDER - "discrete_range"/PLACEHOLDER - "others" - - END DEFINE - - and the expansion would be: - - when {discrete_choice}... => ==> when RED | [discrete_choice]... => - - Note that the separator characters, `" | "' were automatically -inserted before the placeholder was repeated. ELSE also uses the -character(s) defined by the `/SEPARATOR' specifier when killing an -unwanted placeholder e.g. - - when RED | [discrete_choice]... => ==> when RED => - - -File: else, Node: Type Specifier, Next: Template Body, Prev: Separator Specification, Up: Placeholders - -Type Specifier -.............. - - `Lineno 10' -- The specifier `/TYPE' informs ELSE how to treat the -expansion of the placeholder. This specifier can have three possible -values: - - 1. TERMINAL -- This is the "end of the line", no further expansions - are defined and the text string(s) held in the body of the - definition are to be used as a prompter to the user e.g. with the - following definition for "identifier" placeholder - - DELETE PLACEHOLDER IDENTIFIER - - /LANGUAGE="Ada" - - DEFINE PLACEHOLDER IDENTIFIER - - /LANGUAGE="Ada" - - /NOAUTO_SUBSTITUTE - - /DESCRIPTION="" - - /DUPLICATION=CONTEXT_DEPENDENT - - /SEPARATOR="" - - /TYPE=TERMINAL - - "Any Ada identifier will do" - - END DEFINE - - An expansion of this placeholder will provide the prompt of `Any - Ada identifier will do' to the user. The prompt is displayed for a - customisable period (*note Custom Variables::) in seconds and then - erased from the screen. Note that is the user performs any entry - during the display of the prompt string then the prompt buffer - will be terminated immediately and the user input actioned. - - 2. NONTERMINAL -- informs ELSE that the body of the placeholder - definition contains one or more text strings which should be used - to replace the placeholder ie. the following definition will - provide this expansion - [context_clause] ==> with {library_unit_name}...; [use_clause] - - DELETE PLACEHOLDER CONTEXT_CLAUSE - - /LANGUAGE="Ada" - - DEFINE PLACEHOLDER CONTEXT_CLAUSE - - /LANGUAGE="Ada" - - /NOAUTO_SUBSTITUTE - - /DESCRIPTION="" - /DUPLICATION=CONTEXT_DEPENDENT - - /SEPARATOR="" - - /TYPE=NONTERMINAL - - - "with {unit_simple_name}...; [use_clause]" - - END DEFINE - - 3. MENU -- informs ELSE that the body of the placeholder definition - contains a menu selection that must be presented to the user for - resolution i.e. the following definition will present a menu of - choices for the `statement' placeholder: - - DELETE PLACEHOLDER STATEMENT - - /LANGUAGE="Ada" - - DEFINE PLACEHOLDER STATEMENT - - /LANGUAGE="Ada" - - /NOAUTO_SUBSTITUTE - - /DESCRIPTION="" - /DUPLICATION=VERTICAL - - /SEPARATOR="" - - /TYPE=MENU - - - "assignment_statement"/PLACEHOLDER - "if_statement"/PLACEHOLDER - "case_statement"/PLACEHOLDER - "loop_statement"/PLACEHOLDER - "block_statement"/PLACEHOLDER - . - . - . - "select_statement"/PLACEHOLDER - - END DEFINE - - -File: else, Node: Template Body, Next: Placeholder Cross-Referencing, Prev: Type Specifier, Up: Placeholders - -Template Body -............. - - `Lineno 12 - 16' -- The "body" of the template definition may -contain one or more text strings. These text strings will be used by -ELSE according to the setting of the `/TYPE' specifier (*note Type -Specifier:: for examples). - - When the placeholder body is a menu then each text line may contain -optional keywords. These keywords are: - - 1. `/PLACEHOLDER' -- informs ELSE that the preceding text is the name - of a placeholder. - - 2. `/TOKEN' -- informs ELSE that the preceding text is the name of a - token. - - 3. `/FOLLOW' -- informs ELSE that if the line item is a placeholder, - that is itself a menu, then incorporate the entries of that - definition into the menu display(1). The default for a line item - in a menu template definition is `FOLLOW' and so this attribute - may be omitted. To explicitly override this behavour for - individual instances use the `/NOFOLLOW' option as documented - below. - - 4. `/NOFOLLOW' -- informs ELSE that even though the line item is a - placeholder, that is itself a menu, do not "follow" the definition - by incorporating the entries of that definition into the menu - display. Note that this option can be globally overriden by the - `'else-follow-menus' and `'else-nofollow-menus' flags (*Note - Custom Variables::.) - - For example, the `FULL_TYPE_DECLARATION' placeholder in the Ada -language templates has a body of: - - "type {identifier} [known_discriminant_part] is {type_definition};" - "task_type_declaration"/PLACEHOLDER - "protected_type_declaration"/PLACEHOLDER - - This body tells ELSE that if the user selects the first line, then -perform a direct text substitution, if one of the other two lines are -selected then ELSE is being told that they refer to a further -placeholder and will be treated according to the `/TYPE' specifier of -that placeholder i.e. the indicated placeholder will be expanded. See -also *Note Indentation Size::, for further information on applying -"hard" spaces to the beginning of a line of text in the body. - - An example of the use of the `FOLLOW' and `NOFOLLOW' is taken from -the Emacs-Lisp template file for the definition of the `STATEMENT' -placeholder(2): - - "let_statement"/PLACEHOLDER - "if_statement"/PLACEHOLDER - . - . - . - "property-list-stmt"/PLACEHOLDER - "symbols"/PLACEHOLDER/NOFOLLOW - "sequences"/PLACEHOLDER/NOFOLLOW - . - . - - Here the placeholder `property-list-stmt' is a menu which in turn has -multiple entries/options. If `else-follow-menus' is `nil', then ELSE -will "follow" the menu definitions for `property-list-stmt' and include -its items in the menu display, however, because `symbols' is followed by -`/NOFOLLOW' then its definitions will not be included in the primary -menu dispolay i.e. if the user wishes to select one of the options in -the `symbols' placeholder then they must explicity select the `symbols' -entry to be presented with the possible options at that level. - - ---------- Footnotes ---------- - - (1) This is default behaviour for ELSE - - (2) The entry for `property-list-stmt' has been modified for the -purposes of this example - - -File: else, Node: Placeholder Cross-Referencing, Next: End Define Command, Prev: Template Body, Up: Placeholders - -Placeholder Cross-Referencing -............................. - - Finally, the "body" of a placeholder definition may contain some or -none of the above attributes and purely reference another existing -placeholder i.e. - - DELETE PLACEHOLDER XYZ - - /LANGUAGE="ABC" - DEFINE PLACEHOLDER XYZ - - /LANGUAGE="ABC" - /PLACEHOLDER=DEF - - END DEFINE - - Here we have a placeholder called "XYZ" which will automatically use -the definition of the placeholder "DEF" when it is referenced or -invoked by the ELSE routines. This can be extremely useful in -situations such as the following where the EBNF for a language might -specify two forms of "identifier" which you wish to ideally make the -same w.r.t ELSE behaviour e.g. when the user enters a string for -`subprogram_identifier' ELSE should perform an auto-substitution on the -following `defining_identifier' placeholder. - - procedure {subprogram_identifier} is - ... - end [defining_identifier]; - - We may not want to necessarily change the template definition to -generate: - - procedure {defining_identifier} is - ... - end [defining_identifier]; - - and then have to define a placeholder definition for -`defining_identifier' that includes auto-substitution behaviour, -because `defining_identifier' may appear somewhere else as a -"singleton". The ideal would be to have a placeholder definition for -`subprogram_identifier' that defined auto-substitute behaviour but also -referred to the definition of `defining_identifier' for its basic -behaviour i.e. if we use the following definition then when the user -types in a `subprogram_identifier' placeholder ELSE will search for a -matching `defining_identifier' placeholder and perform -auto-substitution there: - - DELETE PLACEHOLDER SUBPROGRAM_IDENTIFIER - - /LANGUAGE="ABC" - DEFINE PLACEHOLDER SUBPROGRAM_IDENTIFIER - - /LANGUAGE="ABC" - /AUTO_SUBSTITUTE - - /PLACEHOLDER=DEFINING_IDENTIFIER - - END DEFINE - - -File: else, Node: End Define Command, Prev: Placeholder Cross-Referencing, Up: Placeholders - -End Define Command -.................. - - `Lineno 18' -- The `END DEFINE' specifier informs ELSE that the end -of a placeholder or token definition has occurred. - - -File: else, Node: Tokens, Next: Hooking Elisp Code into ELSE Templates, Prev: Placeholders, Up: Definition of the Template Structure - -Token Definition ----------------- - - There are only two forms to the definition of a Token, they are both -shown below. These two definitions show two different ways of -specifying the same thing. In the first instance, the definition is -using an existing placeholder definition and just referring to it as -the action to perform on expansion. The second form shows a textual -substitution form which acts in the same manner as a `NONTERMINAL' -placeholder (*note Type Specifier::). - DELETE TOKEN IF - DELETE TOKEN IF - - /LANGUAGE="Ada" - /LANGUAGE="Ada" - - DEFINE TOKEN IF - DEFINE TOKEN IF - - /LANGUAGE="Ada" - /LANGUAGE="Ada" - - /PLACEHOLDER=IF_STATEMENT - "if {condition} then" - END DEFINE " {statement}..." - "[elsif_part]" - "[else_part]" - "end if;" - END DEFINE - - The `DELETE' and `DEFINE' lines follow the same rules as for the -equivalent placeholder specifiers (*note Delete Placeholder -Statement::) and (*note Define Placeholder Statement::. Similarly for -the `LANGUAGE' specifier (*note Language Specifier::. - - The greatest strength of the token definition is that it provides -convenient "abbreviations" for the user i.e. the user doesn't have to -type out the full placeholder name and enclose it in braces. Tokens -provide the facility of a convenient stand alone string which can be -expanded into some other entity, either another placeholder definition -or as a textual string. Note that token definitions do not provide -"non-terminal" and "menu" facilities like the placeholder definition -however, this is off-set by the ability of the token definition to -refer to a placeholder definition which does provide these facilities. - - Of special note, ELSE searches the appropriate definition array -based upon the context of the string being expanded i.e. if the string -is enclosed in `{}''s or `[]''s then it will search the placeholder -array, if the string is "free-standing" then ELSE will search the token -array. Thus, template definition names do not have to be unique between -placeholders definitions and token definitions e.g. you could have a -placeholder definition called "if" and a token definition called "if" -without having any conflict. - - -File: else, Node: Hooking Elisp Code into ELSE Templates, Prev: Tokens, Up: Definition of the Template Structure - -Hooking Elisp Code into ELSE Templates --------------------------------------- - - On rare occasions it might be useful to associate some Elisp code -with ELSE templating activities. This can be "linked" to both -placeholder and token definitions using the same syntax (the following -examples show usage with placeholder definitions but the same syntax -applies equally to token definitions). The syntax is: - - - /RUN_CODE=<elisp-defun><phase> - - where "elisp-defun" is the name of a Elisp defun and "phase" is the -"phase" of operation during which ELSE will call the defun. The -currently(1) defined "phases" are: - - * /BEFORE -- Call `elisp-defun' "before" the placeholder/token is - expanded (invoked during execution of `else-expand-placeholder' - (`C-c / e')); - - * /AFTER - Call `elisp-defun' "after" the placeholder/token has been - expanded (invoked during execution of `else-expand-placeholder' - (`C-c / e')); - - * /ONINSERT -- Call `elisp-defun' when a "self-insert" character is - typed with point in the placeholder (this phase option is - meaningless for tokens). - - - A definition (placeholder or token) may have multiple `/RUN_CODE' -lines indicating a separate elisp-defun to call for each line. Each -`/RUN_CODE' line may have only one elisp-defun but can have multiple -phase indicators i.e. the following example would have "elisp-test-dfn" -called during both the `/BEFORE' and `/AFTER' phases of the expansion. - - DELETE PLACEHOLDER XXXX - - /LANGUAGE="yyy" - - DEFINE PLACEHOLDER XXXX - - /LANGUAGE="yyy" - - . - . - /RUN_CODE=else-test-dfn/BEFORE/AFTER - . - - END DEFINE - - A more concrete example is shown using a definition found in the -ELSE template language itself (Template.lse). The definition for -placeholder "nonterminal|terminal_placeholder" is (partially shown for -brevity): - - DELETE PLACEHOLDER nonterminal|terminal_placeholder - - /LANGUAGE="Template" - - DEFINE PLACEHOLDER nonterminal|terminal_placeholder - - /LANGUAGE="Template" - - . - . - - " /{substitute}" - " [substitute_count]" - " /DESCRIPTION={descriptive_text} -" - . - . - - END DEFINE - - The "{substitute}" placeholder is a menu that leads to either -`/NOAUTO_SUBSTITUTE' or `/AUTO_SUBSTITUTE' -- however, if the user -selects `/NOAUTO_SUBSTITUTE' then they have to manually delete the -redundant placeholder "[substitute_count]". A possible solution (this -can be solved with slightly different ELSE template definitions, BTW) -is to use the `/RUN_CODE' attribute and accompany it with an -appropriate elisp defun. In this scenario, the definition of -"substitute" changes from: - - DELETE PLACEHOLDER SUBSTITUTE - - /LANGUAGE="Template" - - DEFINE PLACEHOLDER SUBSTITUTE - - /LANGUAGE="Template" - - . - . - /TYPE=MENU - - - "NOAUTO_SUBSTITUTE -" - "AUTO_SUBSTITUTE -" - - END DEFINE - - to this (incorporating the run-time attribute): - - DELETE PLACEHOLDER SUBSTITUTE - - /LANGUAGE="Template" - - DEFINE PLACEHOLDER SUBSTITUTE - - /LANGUAGE="Template" - - . - . - /RUN_CODE=process-substitute/AFTER - /TYPE=MENU - - - "NOAUTO_SUBSTITUTE -" - "AUTO_SUBSTITUTE -" - - END DEFINE - - and the user "compiles" the following elisp defun into their edit -session (place in a convenient .el file that gets loaded, your .emacs -file or whatever): - - (defun process-substitute () - "Determine whether the next placeholder after a [substitute] should - be deleted or left intact - could make this more 'robust' by testing - whether the placeholder is a [substitute_count] before deleting......" - (let () - (if (else-scan-for-match "/NOAUTO_SUBSTITUTE" nil t) - (progn - (else-next-placeholder) - (else-delete-placeholder))))) - - Now when "`{substitute}'" is expanded, the Elisp defun -`process-substitute' is run "after" the expansion and decides whether -the "`[substitute_count]'" placeholder remains or not depending upon -which option the user selected. - - Note that this example relies on "published" ELSE defuns -(`else-next-placeholder' and `else-delete-placeholder') and an -"unpublished" defun `else-scan-for-match'. The later is used to scan the -text before point (search limited to the beginning of the line in this -case) and look for the text `/NOAUTO_SUBSTITUTE' -- if it is found then -the "`[substitute_count]'" is not wanted and is deleted. - - ---------- Footnotes ---------- - - (1) Other possibilties are /ON_ENTRY and /ON_EXIT i.e. calling -defuns as ELSE moves point into or out of a placeholder -- if there is -demand for these "phases" I will implement them - - -File: else, Node: Example of Creating A New Language Template, Prev: Definition of the Template Structure, Up: Creating and Modifying Templates - -Example of Creating A New Language Template -=========================================== - - Use of ELSE shines for "verbose", structured languages such as Ada, -Modula-2, Pascal etc and performs not so well for what I will call -unstructured "minimalist" languages such as C and C++. Obviously, the -aim in the definition of languages such as Modula-2, Pascal etc was to -provide code that was more readable and therefore easier to check and -maintain. Languages such as C and C++ were designed (C++, due to its -desire to be backward compatible with C) for minimal code entry effort -which results in code with minimal readability and therefore -maintainability. - - When creating language templates it is important to keep in mind -that there is a point where the trade-off of template availability -versus user effort is reached i.e. even for "verbose" languages, I -would not recommend providing templates for the "expression" construct. -It is easier to just provide a prompt string at this point rather than -to follow the path that the language syntax lays out, because at this -stage the user is only required to type in something like `A = B' or -something equally simple. Remember the aim of ELSE is to reduce -keystrokes and improve productivity, so providing templates that allow -the user to select from the many permutations that lead from a typical -language "expression" syntax is not warranted either on your part of -template design or on the users part of code entry. - - If you are faced with developing a set of language templates then -there are two possible courses of action. You can either establish a -bare minimum of constructs that will suit your needs i.e. template -definitions for the common language constructs such as "statement", "if -statement", "case statement", "procedure or function statement" etc or -you can go the "whole hog" and provide a "complete" set of templates -right down to definitions for common library calls etc. - - One of the benefits of the "bare minimum" approach is that you can -cater for the large portion of code entry with only a couple of hours -work to develop the template definitions. Whereas if you opt for the -"whole hog" approach then it may involve quite a few hours work. -Creation of language template definitions is a very manual, mechanical -task and is not always easy since you are usually working from a -specification for the language such as a set syntax diagrams. Such -syntax diagrams are rarely suitable for straight incorporation into a -set of language template definitions. There is usually a fair amount of -manually going through the syntax looking for simplifications etc. - - If you are going for the complete approach then you are advised to -start from a set of EBNF syntax diagrams for the language. To relieve -the amount of work required for this approach, I have written a program -that helps enormously in the effort of going from the EBNF to the -language definition file. This program is available upon request, just -email me and I will send you the latest copy (its comes in binary form -because I am too embarrassed to release it, it was my very first effort -at using both literate programming and C++ :-), perhaps one day I will -re-do it based upon experiences learnt). The program is available for -Win95 platforms only. - - The following attempts to provide some definition of the EBNF -structure and examples with accompanying language template definitions. -EBNF syntax diagrams are useful because they can be used to determine -when a particular construct should be optional, mandatory, whether it -should auto-repeat and whether there are any "punctuation" strings -required. - - It was somewhat difficult to run down a definition of EBNF syntax, -hopefully the following is accurate, please provide corrections if I am -wrong :-). - - In EBNF the following rules apply: - 1. Square brackets enclose optional items, thus the two following - rules are equivalent. - return_statement ::= return [expression]; - return_statement ::= return; | return expression; - - 2. Curly braces enclose a repeated item. The item may appear zero or - more times, the repetitions occur from left to right as with an - equivalent left-recursive rule. Thus the two following rules are - equivalent: - term ::= factor {multiplying_operator factor} - term ::= factor | term multiplying_operator factor - - 3. A vertical line separates alternative items unless it occurs - immediately after an opening curly bracket, in which case it - stands for itself: - constraint ::= scalar_constraint | composite_constraint - discrete_choice_list ::= discrete_choice {| discrete_choice} - - 4. Items that repeat are enclosed within braces, any character that - appears after the opening curly brace defines a "separator" string - ie. a string that appears between each occurrence of the repeating - construct (refer to example in previous item) - - It is important to note in the following examples, that the keywords -of the language being converted are copied verbatim into the language -template definition, any other text is converted to either a mandatory -or optional placeholder depending on how the EBNF defines their usage. -Examples that illustrate these points are shown below. The EBNF -construct is shown first followed by the equivalent ELSE template -definition. - - - return_statement ::= return [expression]; - - DELETE PLACEHOLDER RETURN_STATEMENT - - /LANGUAGE="Ada" - - DEFINE PLACEHOLDER RETURN_STATEMENT - - /LANGUAGE="Ada" - - /NOAUTO_SUBSTITUTE - - /DESCRIPTION="" - /DUPLICATION=CONTEXT_DEPENDENT - - /SEPARATOR="" - - /TYPE=NONTERMINAL - - - "return [expression];" - - END DEFINE - - sequence_of_statements ::= statement {statement} - - DELETE PLACEHOLDER SEQUENCE_OF_STATEMENTS - - /LANGUAGE="Ada" - - DEFINE PLACEHOLDER SEQUENCE_OF_STATEMENTS - - /LANGUAGE="Ada" - - /NOAUTO_SUBSTITUTE - - /DESCRIPTION="" - /DUPLICATION=VERTICAL - - /SEPARATOR="" - - /TYPE=NONTERMINAL - - - "{statement}..." - - END DEFINE - This example shows the definition of an item that appears zero or -more time, because a typical language syntax demands at least one -occurrence of a `statement' the EBNF shows a single instance (the -mandatory single instance) followed by the instance enclosed in curly -braces which is specified as repeating "zero or more times". Thus we -"code" the template definition as single item enclosed by curly braces -(which in ELSE means a mandatory entry). Remember that the ... denote -auto-repeat, so when the placeholder is repeated it will be enclosed by -square brackets and will thus be an optional entry. Thus we achieve the -original intent of the ENBF. - - In practice, you would not define the construct -`sequence_of_statements' as it appears by itself and is used in other -constructs such as: - if_statement ::= if condition then - sequence_of_statements - {elsif condition then - sequence_of_statements} - [else - sequence_of_statements] - end if; - So rather than define the language template such that the user is -forced to expand `sequence_of_statements', we perform a "substitution" -ourselves so that our `if' construct looks like: - if_statement ::= if condition then - statement {statement} - {elsif condition then - statement {statement}} - [else - statement {statement}] - end if; - Which would lead us to a language template of: - - DELETE PLACEHOLDER IF_STATEMENT - - /LANGUAGE="Ada" - - DEFINE PLACEHOLDER IF_STATEMENT - - /LANGUAGE="Ada" - - /NOAUTO_SUBSTITUTE - - /DESCRIPTION="" - /DUPLICATION=CONTEXT_DEPENDENT - - /SEPARATOR="" - - /TYPE=NONTERMINAL - - - "if {condition} then" - " {statement}..." - "[elsif_part]..." - "[else_part]" - "end if;" - - END DEFINE - This step also shows the `elsif' and `else' portion being modified -for incorporation into the template language. Placeholders may not span -lines, so any EBNF construct that does so must be reduced to a -placeholder that can be produced on one line. The syntax for the `if' -statement is a good example of this having to be done. The following -shows the equivalent EBNF and language templates for these structures: - DELETE PLACEHOLDER ELSIF_PART - - elsif_part ::= /LANGUAGE="Ada" - - elsif condition then DEFINE PLACEHOLDER ELSIF_PART - - statement {statement} /LANGUAGE="Ada" - - /NOAUTO_SUBSTITUTE - - /DESCRIPTION="" - /DUPLICATION=CONTEXT_DEPENDENT - - /SEPARATOR="" - - /TYPE=NONTERMINAL - - - "elsif {condition} then" - " {statement}..." - - END DEFINE - - DELETE PLACEHOLDER ELSE_PART - - else_part ::= /LANGUAGE="Ada" - - else DEFINE PLACEHOLDER ELSE_PART - - statement {statement} /LANGUAGE="Ada" - - /NOAUTO_SUBSTITUTE - - /DESCRIPTION="" - /DUPLICATION=CONTEXT_DEPENDENT - - /SEPARATOR="" - - /TYPE=NONTERMINAL - - - "else" - " {statement}..." - - END Define - - The following is an example of syntax that repeats with a separator -string present. The construct is the (partial) Ada syntax for an object -declaration. Just to provide the context, the (partial) EBNF is shown -first. - - object_declaration ::= - defining_identifier_list : [aliased] [constant] subtype_indication [:= \ - expression]; - - defining_identifier_list ::= - defining_identifier {, defining_identifier} - - Here, `defining_identifier_list' is defined as a -`defining_identifier' that must occur one or more times and is separated -by the string ", " when it does repeat. Thus, this EBNF leads to: - - DELETE PLACEHOLDER DEFINING_IDENTIFIER - - /LANGUAGE="Ada" - - DEFINE PLACEHOLDER DEFINING_IDENTIFIER - - /LANGUAGE="Ada" - - /NOAUTO_SUBSTITUTE - - /DESCRIPTION="" - /DUPLICATION=HORIZONTAL - - /SEPARATOR=", " - - /TYPE=TERMINAL - - - "Type in a valid Ada identifier" - - END DEFINE - - Here we can see the /SEPARATOR attribute be used, duplication is set -for the horizontal direction and the placeholder is defined as a -TERMINAL placeholder with an appropriate prompt message. - - -File: else, Node: Custom Variables, Next: Technical Notes, Prev: Creating and Modifying Templates, Up: Top - -Custom Variables -**************** - - ELSE has a small (but growing) number of custom variables, these are -available through the Customisation Groups under the customisation -group `Programming - Tools - Emacs LSE'. These variables are (listed -alphabetically): - - - Custom Variable: else-direction - This variable determines which direction the command - `else-move-n-placeholders' will attempt i.e. if the variable is - "on" then the command `else-next-placeholder' (`C-c / n') will be - used, if the variable is "off" then the command - `else-previous-placeholder' (`C-c / p') will be used. The default - for this variable is 't' (on). - - - Custom Variable: else-follow-menus - If true (`t') then menu definitions are 'followed' or expanded - until no sub-entry menu is found and all are combined into a - single menu selection display at the 'top level'. If `nil', then - menu's are not expanded and the user has to traverse sub-menu - entries (useful when combining menu's leads to huge menu - selections). - - Setting this flag to `t' will explicitly override the settings of - individual template definitions that use the `/NOFOLLOW' attribute - (*Note Template Body::.) - - The default for this variable is `nil' (off) as the default - behaviour of ELSE is to "follow" menu definitions unless - explicityly told not to by the `/NOFOLLOW' attribute. - - This variable may be overriden by the setting of - `'else-nofollow-menus' to `t'. - - This flag is a buffer-local variable so individual buffers can - have individual settings. - - This also means that setting the variable through the Emacs - Customisation menu will set the global value for the variable but - not actually affect the setting of any "current" buffers that are - using this variable. Only "new" buffers will inherit the new value - set via the customisation menu. - - See the Emacs manual for instructions on changing a variable from - the command line (Evaluating Emacs-Lisp Expressions). - - - Custom Variable: else-ignore-case-in-name-sorts - Used by ELSE when sorting output (else-extract-all, - else-show-token-names, else-show-placeholder-names ) into - alphabetical order. A value of `t' will ignore case when sorting - the names i.e. - - PASS - print - RETURN - - A value of `nil' will produce a sorted list that is case sensitive - i.e. - - PASS - RETURN - . - . - print - - The default for this variable is `t' (ignore case). - - - Custom Variable: else-kill-proceed-to-next-placeholder - This is a "usability" variable that controls the behaviour of the - command `else-kill-placeholder' (`C-c / k') after it has executed. - If this variable is set (on) then ELSE will attempt to perform a - `else-next-placeholder' (`C-c / n') after successfully killing a - placeholder. If the variable is "off" then the cursor will remain - at the point at which the kill command was executed. The default is - `nil' (off). - - - Custom Variable: else-move-and-execute - Another "usability" variable. If this variable is "on" then after - either an expansion or kill request (`else-expand-placeholder' - (`C-c / e') or `else-kill-placeholder' (`C-c / k')) which has - failed, then a "movement" (either a "next" or "previous" - placeholder - direction is dependent upon the setting of the - `else-direction' flag) command is executed and the original - operation (expand or kill) will be attempted again at the new - placeholder(1). The default for this variable is `nil' (off). - - - Custom Variable: else-nofollow-menus - If true (`t') then menu definitions are not 'followed' -- when - `t', this variable takes precedence over the setting of - `'else-follow-menus' and any `/FOLLOW' or `/NOFOLLOW' attibutes of - the template definition. If `nil', then the variable becomes - "inactive" and determination of menu "follow" or not is determined - based upon the settings of `'else-follow-menus' and thence the - `/NOFOLLOW' and `/FOLLOW' attributes in that order. - - The default for this variable is `nil' (off). - - This flag is a buffer-local variable so individual buffers can - have individual settings. - - This also means that setting the variable through the Emacs - Customisation menu will set the global value for the variable but - not actually affect the setting of any "current" buffers that are - using this variable. Only "new" buffers will inherit the new value - set via the customisation menu. - - See the Emacs manual for instructions on changing a variable from - the command line (Evaluating Emacs-Lisp Expressions). - - - Custom Variable: else-only-proceed-within-window - This flag is used only if the - else-kill-proceed-to-next-placeholder flag is set. The movement to - the next placeholder will only occur if the placeholder is visible - in the current window. If this flag is off then the movement will - proceed (possibly) causing visual disorientation to the user when - the screen display jumps. The default for this variable is 't' - (on). - - - Custom Variable: else-prompt-time - This variable supplies the time which a prompt string to the user - is displayed for a TERMINAL placeholder (*note Type Specifier::). - The default is 3 seconds. - - - Custom Variable: else-set-lineno - Controls the display of line numbers in the menu display window. - The default for this variable is `nil' (off). - - ---------- Footnotes ---------- - - (1) this behaviour was added specifically for VR Coding and helps -reduce the number of voice commands required to achieve a specific -objective - - -File: else, Node: Technical Notes, Next: Compatibility, Prev: Custom Variables, Up: Top - -Technical Notes -*************** - - This chapter provides some "technical" information that doesn't fall -into any particular category for inclusion in previous chapters. The -information offered covers: - 1. "useful" variables/functions that are contained within - else-mode.el. This is a brief description of the some of the - variables/functions that an individual might want to access/call - from outside of ELSE to perform various tasks. This list is - probably not exhaustive but hopefully helpful. (1) - - 2. Editing Template Files - - 3. Hooks used in ELSE. - - 4. How ELSE determines the file name of a language template. - - 5. How to speed up load times of templates on a slow computer. - -* Menu: - -* Useful ELSE Defuns:: -* Editing Template Files:: -* ELSE and Hooks:: -* Building the Language Template File Name:: - - ---------- Footnotes ---------- - - (1) Customisable variables and interactive defuns are documented -elsewhere in this manual, the variables/functions mentioned here are -for "internal" use and should be used with discretion - - -File: else, Node: Useful ELSE Defuns, Next: Editing Template Files, Prev: Technical Notes, Up: Technical Notes - -Useful ELSE Defuns -================== - - Description of some useful Defuns that ELSE contains that users can -access (they are non-interactive) from their own elisp Defuns to -perform useful actions. - - - apropos: else-after-token - Return `t' if point is situated immediately after a valid token - string for the language definition in force for that buffer. - - - apropos: else-in-placeholder - Returns `t' if point is within a valid placeholder for the language - definition in force for that buffer. See also - else-placeholder-start and else-placeholder-end. - - - apropos: else-dump-language - Dump the current buffer language template to the named file. Note - that the file name parameter must have been already vetted to make - sure it complies with the else naming conventions i.e. .esl - - - apropos: else-establish-language language-name - Set language template set 'language-name as the current template - set for this buffer. - - - apropos: else-look-up name-string &optional ignore-forward-refs - Look-up the definition of a placeholder/token called 'name-string. - 'ignore-forward-refs allows functions like - `'else-kill-placeholder' to stop the forwarding referrals i.e. we - wish to kill what is there not what might have been there - - - apropos: else-placeholder-start - Position in the buffer of the start of the last placeholder - detected/found (see else-in-placeholder). - - - apropos: else-placeholder-end - Position in the buffer of the end of the last placeholder - detected/found (see else-in-placeholder). - - -File: else, Node: Editing Template Files, Next: ELSE and Hooks, Prev: Useful ELSE Defuns, Up: Technical Notes - -Editing Template Files -====================== - - ELSE comes with a template definition language file for creating and -maintaining language template files. It is called template.lse. When -editing template definition files you can have ELSE enabled for the -buffer and it will load the template.lse definitions. However, when -performing common ELSE functions (common to editing a language template -file that is) it will perform in terms of the language of the buffer -contents rather than the ELSE template language itself i.e. if you are -editing C.lse and wish to perform an extraction of a current C language -definition then you can run `else-extract-placeholder' and it will look -in the C language definitions for the requested definition rather than -the template definitions. Likewise, when compiling the current buffer -the definitions will go into the C language definitions rather than the -ELSE language template definitions. The only exception to this rule is -the commands that are obviously relevant to editing a language -definition file in its own language i.e. `else-expand-placeholder' will -still be expecting to expand placeholders and tokens that below to the -TEMPLATE definitions rather than the C definitions. - - -File: else, Node: ELSE and Hooks, Next: Building the Language Template File Name, Prev: Editing Template Files, Up: Technical Notes - -ELSE and Hooks -============== - - Probably the most single significant feature that sets ELSE above -any other equivalent templating system for Emacs is the ability to -generate portions of text that can be easily located (placeholders) and -to which the cursor can be positioned (*note Navigating Using ELSE: -Navigating.). Once there, then typing by the user will cause the -automatic deletion of the placeholder and the insertion of the typed -text. This functionality is achieved by ELSE "hooking" into the before -and after change hooks of Emacs. Here it can monitor what is happening -in the changes to the buffer and take appropriate action (such as the -deletion of a placeholder when `self-insert' text is typed or the -duplication of typed text when the placeholder has identifier and -auto-substitute situation (*note Auto Text Substitute::)). - -* Menu: - -* Building the Language Template File Name:: - - -File: else, Node: Building the Language Template File Name, Prev: ELSE and Hooks, Up: Technical Notes - -Building the Language Template File Name -======================================== - - When ELSE mode is invoked for a buffer it will read the name of the -major mode currently in effect and append the file extension ".lse" and -attempt to load a file by that name using the 'load-path'. Note that -this function is case sensitive i.e. if the major mode for the buffer -is `C' then a file name of `C.lse' will be constructed and searched. -Similarly, if the major mode is Emacs-Lisp then ELSE will construct a -file name of 'Emacs-Lisp.lse'. - - If the constructed file name cannot be located in the `load-path' -then the user will be prompted for a file name. - - -File: else, Node: Compatibility, Next: Notes for VR Coding, Prev: Technical Notes, Up: Top - -Compatibility -************* - - ELSE is definitely known not to be compatible with versions of Emacs -prior to Emacs 20.X. Emacs Lisp introduced a change at 19.29 that I -took advantage of and then Emacs 20.X introduced the use of custom -variables which are also used in ELSE. - - -File: else, Node: Notes for VR Coding, Next: Template Availability, Prev: Compatibility, Up: Top - -Notes for Voice Recognition Coding -********************************** - - It is recommended that people using Emacs and ELSE for programming -using Voice Recognition tools should set the following custom variables -(*note Custom Variables::). - - 1. `else-kill-proceed-to-next-placeholder' - - 2. `else-set-lineno' - - 3. `else-move-and-execute' - - 4. `else-only-proceed-within-window' - - Having these variables set result in a minimum of voice commands to -navigate and input code using ELSE. Refer to demonstration videos using -ELSE, that Hans van Dam has kindly produced, at -<http://home.hetnet.nl/~vandamhans/index.htm> - - -File: else, Node: Template Availability, Next: Tutorial, Prev: Notes for VR Coding, Up: Top - -Language Template Availability -****************************** - - The following list indicates what language templates are currently -available from <http://www.zipworld.com.au/~peterm>. For further (and a -growing list) of other language templates, kindly made available by -Douglas Harter refer to <http://mywebpages.comcast.net/dharter46>. -Douglas currently has template files for Basic, Bliss, Bourne Shell, C -Shell, COBOL, DEC DCL, Fortran90, Fortran, PASCAL, Perl and the list is -growing. - 1. Ada83 -- must be renamed to Ada.lse prior to use. Has seen some - extensive use in a programming environment so should be quite - "usable"(1) - - 2. Ada95 -- must be renamed to Ada.lse to be used. Usability index is - moderate, I used these templates for about 6 months of coding, - some obvious paths have not been fine tuned. - - 3. ELSE Template Language (template.lse). Quite usable - use these - templates to create ELSE language definition templates. - - 4. LaTeX -- Usable but extremely small sub-set - I don't do - documentation this way anymore - the world is succumbing to - MS-Word :-(. - - 5. Emacs-Lisp -- Usable not terrifically extensive. - - 6. C -- Usable. - - 7. Python -- Usable. - - 8. C++ -- Not very Usable. Some work is being done by Stephen Leake. - - 9. Java -- Not very Usable. Nobody is working with this template set - to my knowledge. - - ---------- Footnotes ---------- - - (1) Language template files have what I would term a "usability" -index as far as ELSE is concerned. The more extensively they are used -in programming the more "fine tuning" has been done to the template -definitions and thus they become more "usable" by the programmer. -Template files that have been freshly translated from the EBNF of a -language have a low usability index and should be regarded by beginners -with extreme caution. - - -File: else, Node: Tutorial, Next: Concept Index, Prev: Template Availability, Up: Top - -Tutorial -******** - - This tutorial assumes that you have followed the installation -instructions and have downloaded the C language templates (`C.lse' and -`C-cust.lse'), these files represent the base C language template files -(`C.lse') and the customisation templates that I use for my C -programming (`C-cust.lse'). For the tutorial to be as shown, it is -important that these two files are used, otherwise the code samples -shown may not be accurate. - - The tutorial uses the C language templates, as C is probably the -most recognised language (everybody has at some time or another been -exposed to some form of C syntax, using any of the other languages for -which ELSE templates are available might not have such a wide -recognition factor). - -* Menu: - -* Abbreviation Coding:: -* Whole Language Coding:: - - -File: else, Node: Abbreviation Coding, Next: Whole Language Coding, Prev: Tutorial, Up: Tutorial - -Using ELSE for Abbreviation Coding -================================== - - If you are in a "maintenance" type role i.e. working with modifying -or fixing existing code files, or perhaps you are completely new to -ELSE, then you might be more interested in the "abbreviation" powers of -ELSE. - - In these kind of coding situations, you are more likely to wish to -just add a couple of lines of code rather than write completely new -code from scratch. In the case of just adding several lines, then it is -convenient to have some quick and easy way to generate a common code -construct. You could type a placeholder directly into the buffer and -then expand it but this is somewhat laborious and is not necessarily -true to the underlying aim of ELSE, which is to reduce typing. To meet -these needs, ELSE offers something called "tokens". Tokens are a -template definition that takes a minimal number of characters and turns -them into some desired construct using the expand command (`C-c / e'). -Most of the common language constructs available to ELSE should have -the common constructs available as tokens as well as placeholders i.e. -one such common construct is the "if statement". To generate an if -construct at point in the buffer, just perform the following key -sequence: - - `ifC-c / e' - - and you will have the following if construct appear: - - if ({expression}) { - {statement}... - } - [elsif_part]... - [else_part] - - Again, the cursor will be automatically positioned into the first -placeholder and options similar to that explained in the previous -section (*Note Whole Language Coding::). - - Another example of a simple, but common construct is the humble -comment statement. In `C-cust.lse' there is a token that allows quick -and easy comment generation. Type the following anywhere in the buffer: - - `cC-c / e' - - and you should see the text: - /* {text} */ - - The cursor will be positioned within the "text" placeholder and the -user can start typing the comment immediately. - - -File: else, Node: Whole Language Coding, Prev: Abbreviation Coding, Up: Tutorial - -Using ELSE for Whole Language Coding -==================================== - - Open a new file, "example.c". When the new file is created, enable -ELSE for the buffer using `M-x else-mode'. You should see the following -in the buffer: - - {compilation_unit} - - The cursor should be positioned within the placeholder shown. This -is a top level language construct that should lead to all of the -possible paths to create a complete C language file. Expand the -placeholder by executing `C-c / e', which should result in the buffer -containing: - - [module_level_comments] - [#include]... - - {translation_unit}... - - Again, the cursor will be positioned in the first placeholder -(`module_level_comments') of the expansion. Perform another expansion -(`C-c / e') and this placeholder will be replaced by the following text: - - /* ===[ {module} ]========================================================= - - Description: - - {text} - - Revisions: - - REV DATE BY DESCRIPTION - ------ --------- --- -------------------------------------------- - - ------------------------------------------------------------------------- - This item is the property of GTECH Corporation, Providence, - Rhode Island, and contains confidential and trade secret information. - It may not be transfered from the custody or control of GTECH except - as authorized in writing by an officer of GTECH. Neither this item - nor the information it contains may be used, transfered, reproduced, - published, or disclosed, in whole or in part, and directly or - indirectly, except as expressly authorized by an officer of GTECH, - pursuant to written agreement. - - Copyright (c) 1996 GTECH Corporation. All rights reserved. - ========================================================================*/ - - The cursor will now be the next available placeholder (`module'). If -this placeholder is expanded (`C-c / e'), then the user will receive a -prompt screen with the following text: - - Enter the name of the module i.e. gs_lib.c - - This text will be visible for approximately 3 seconds (ELSE prompt -time - a customisable variable). This indicates to the user that there -is no further expansions available from the templates. The prompt -string itself offers informative text meant to help the user provide -the required information. The fact that the placeholder is a -"mandatory" placeholder (*note Typographical Conventions::) means that -the user must provide a value i.e. the placeholder cannot be deleted or -killed because the syntactic conventions require an entry to be made at -this point. - - Type in the text, `example.c' -- the placeholder will be deleted -automatically when the first letter is typed by the user. - - Now navigate to the placeholder `include_files' using repeated next -placeholder commands (`C-c / n'). Expand the placeholder (`C-c / e') and -you will be presented with a menu screen showing two possible choices -(as shown below): - - #include <{file_name}> - #include "{file_name}" - - Select the first option by pressing the letter `s' on the keyboard -(selection can also be achieved by re-executing the expansion command -`C-c / e' -- this is a convenience option for individuals who may map -the ELSE expand command to a more convenient key sequence i.e. I have -the else-expand-placeholder command mapped to <F3> - by allowing this -behaviour, the user doesn't have to move fingers to achieve menu -selection. - - Enter the text `stdio.h', the buffer should now contain (excluding -the file header that we have already developed in the interest of -saving space): - - #include <stdio.h> - [#include]... - - Note that the `#include' placeholder has been automatically repeated -(repetition of the placeholder is achieved by the inclusion of the -ellipses (...) at the end of the placeholder. This allows multiple -constructs to be easily repeated i.e. ELSE does the repetition -- it -would be extremely tedious if the user was forced to type in each -placeholder by hand. - - Navigate to the next placeholder and delete it using `C-c / k', this -will delete the text of the second instance of the `#include' -placeholder, including the braces and ellipses. - - Now navigate to the "translation_unit" placeholder and expand it, -you will be presented with a menu consisting of the following choices: - - function_definition - declaration - - Select the first possibility (`function_definition') to receive the -following text in the buffer: - - [declaration_specifiers] {declarator} - [declaration]... - { - [declaration]... - [statement]... - } - - You can navigate backwards (`C=c /p') and forwards through these -placeholders, expansion will lead to either prompt strings, menu -choices or simple text substitutions, depending upon the language -template definition for that placeholder. From these simple -placeholders an entire language file can be constructed. Since ELSE -generates all of the "house-keeping" characters such as opening and -closing braces, semi-colons that end the line etc, when it comes time -to compile this file, then the compiler should report a very much -reduced number of syntactic errors that if the file had been entered by -more traditional methods. - - Hopefully this tutorial has given you some small taste for the power -of ELSE and has whetted your appetite to learn more. Any questions -about the contents of this manual, using ELSE or creating/modifying new -templates then just contact me at the email address on the front page -of this manual, or, if that doesn't work, then you can reach me through -the gnu.emacs.help newsgroup, I monitor that group on all work days of -the week (Australian time that is). - - -File: else, Node: Concept Index, Prev: Tutorial, Up: Top - -Concept Index -************* - -* Menu: - -* abbrev: Definitions. -* abbreviation: Definitions. -* expand <1>: Expanding Placeholders. -* expand: Definitions. -* expanding: Expanding Placeholders. -* expansion of: Expanding Placeholders. -* Installation: Installation Instructions. -* invoke, invoking: Invoking ELSE. -* navigate: Navigating. -* navigating: Navigating. -* placeholder: Definitions. -* token: Definitions. - - - -Tag Table: -Node: Top1209 -Node: Introduction3670 -Ref: Introduction-Footnote-111906 -Ref: Introduction-Footnote-212111 -Ref: Introduction-Footnote-312335 -Node: Overview12634 -Ref: Overview-Footnote-119314 -Ref: Overview-Footnote-219446 -Node: Typographical Conventions19587 -Node: Definitions20682 -Node: Installation Instructions21537 -Node: Default Keybindings23029 -Node: Command Summary25533 -Ref: Command Summary-Footnote-131123 -Node: Using ELSE31389 -Node: Invoking ELSE32502 -Ref: Invoking ELSE-Footnote-134125 -Node: Navigating34332 -Node: Expanding Placeholders34942 -Node: Expanding Tokens36656 -Node: Deleting Placeholders37792 -Node: Preparing for Compilation38536 -Ref: Preparing for Compilation-Footnote-139420 -Node: Disabling ELSE39758 -Node: Creating and Modifying Templates40332 -Ref: Creating and Modifying Templates-Footnote-141960 -Node: Syntactic Conventions42041 -Node: Customising An Existing Template Language43344 -Node: Extracting Placeholders or Tokens49015 -Node: Create a New Language50404 -Node: Language Definition Template52114 -Ref: Language Definition Template-Footnote-153267 -Node: Language Identification53342 -Ref: Language Identification-Footnote-154709 -Node: Initial String54809 -Node: Punctuation characters55522 -Node: Self Insert Characters56494 -Node: Valid Identifier Characters57103 -Node: Indentation Size60036 -Node: Template Version64610 -Node: Overriding Language Attributes65197 -Node: Definition of the Template Structure66338 -Node: Placeholders67086 -Node: Delete Placeholder Statement68529 -Node: Language Specifier69103 -Node: Define Placeholder Statement69506 -Node: Auto Text Substitute70048 -Node: Description Specifier74397 -Node: Duplication Specifier74804 -Node: Separator Specification76300 -Node: Type Specifier77755 -Node: Template Body80788 -Ref: Template Body-Footnote-183993 -Ref: Template Body-Footnote-284036 -Node: Placeholder Cross-Referencing84130 -Node: End Define Command86249 -Node: Tokens86509 -Node: Hooking Elisp Code into ELSE Templates89159 -Ref: Hooking Elisp Code into ELSE Templates-Footnote-193915 -Node: Example of Creating A New Language Template94101 -Node: Custom Variables105862 -Ref: Custom Variables-Footnote-1111589 -Node: Technical Notes111736 -Ref: Technical Notes-Footnote-1112698 -Node: Useful ELSE Defuns112890 -Node: Editing Template Files114587 -Node: ELSE and Hooks115927 -Node: Building the Language Template File Name116966 -Node: Compatibility117728 -Node: Notes for VR Coding118102 -Node: Template Availability118826 -Ref: Template Availability-Footnote-1120339 -Node: Tutorial120774 -Node: Abbreviation Coding121671 -Node: Whole Language Coding123794 -Node: Concept Index129699 - -End Tag Table diff --git a/app-emacs/else-mode/files/semantic.cache b/app-emacs/else-mode/files/semantic.cache deleted file mode 100644 index d6e0c32..0000000 --- a/app-emacs/else-mode/files/semantic.cache +++ /dev/null @@ -1,14 +0,0 @@ -;; Object semantic.cache -;; SEMANTICDB Tags save file -(semanticdb-project-database "semantic.cache" - :file "semantic.cache" - :tables (list - (semanticdb-table "50else-mode-gentoo.el" - :file "50else-mode-gentoo.el" - :pointmax 136 - :major-mode 'emacs-lisp-mode - :tokens '(("add-to-list" code nil [1 64]) ("add-to-list" code nil [65 112]) ("else-mode" include nil nil nil [114 134])) - :unmatched-syntax 'nil - ) - ) - ) diff --git a/app-emacs/else-mode/files/setnu.el b/app-emacs/else-mode/files/setnu.el deleted file mode 100644 index 65660e8..0000000 --- a/app-emacs/else-mode/files/setnu.el +++ /dev/null @@ -1,448 +0,0 @@ -;;; vi-style line number mode for Emacs -;;; (requires Emacs 19.29 or later, or XEmacs 19.11 or later) -;;; Copyright (C) 1994, 1995, 1997 Kyle E. Jones -;;; -;;; 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. -;;; -;;; A copy of the GNU General Public License can be obtained from this -;;; program's author (send electronic mail to kyle@uunet.uu.net) or from -;;; the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA -;;; 02139, USA. -;;; -;;; Send bug reports to kyle@wonderworks.com -;; -;; M-x setnu-mode toggles the line number mode on and off. -;; -;; turn-on-setnu-mode is useful for adding to a major-mode hook -;; variable. -;; Example: -;; (add-hook 'text-mode-hook 'turn-on-setnu-mode) -;; to automatically turn on line numbering when enterting text-mode." - -(provide 'setnu) - -(defconst setnu-running-under-xemacs - (or (string-match "XEmacs" emacs-version) - (string-match "Lucid" emacs-version))) - -(defconst setnu-mode-version "1.05" - "Version number for this release of setnu-mode.") - -(defvar setnu-mode nil - "Non-nil if setnu-mode is active in the current buffer.") -(make-variable-buffer-local 'setnu-mode) - -(defvar setnu-start-extent nil - "First extent of a chain of extents used by setnu-mode. -Each line has its own extent. Each line extent has a -`setnu-next-extent' property that points to the next extent in -the chain, which is the extent for the next line in the buffer. -There is also a `setnu-prev-extent' that points at the previous -extent in the chain. To distinguish them from other extents the -setnu-mode extents all have a non-nil `setnu' property.") -(make-variable-buffer-local 'setnu-start-extent) - -(defvar setnu-glyph-obarray (make-vector 401 0) - "Obarray of symbols whose values are line number glyphs. -Each symbol name is the string represnetation of a number, perhaps -passed with spaces. The value of the symbol is a glyph that can -be made the begin glyph of an extent to display as a line number.") - -(defvar setnu-begin-glyph-property (if (fboundp 'extent-property) - 'begin-glyph - 'before-string) - "Property name to use to set the begin glyph of an extent.") - -(defvar setnu-line-number-format (if setnu-running-under-xemacs "%4d" "%4d ") - "String suitable for `format' that will generate a line number string. -`format' will be called with this string and one other argument -which will be an integer, the line number.") - -(defvar setnu-line-number-face 'bold - "*Face used to display the line numbers. -Currently this works for XEmacs 19.12 and later versions only.") - -(defun setnu-mode (&optional arg) - "Toggle setnu-mode. -With prefix argument, turn setnu-mode on if argument is positive. -When setnu-mode is enabled, a line number will appear at the left -margin of each line." - (interactive "P") - (let ((oldmode (not (not setnu-mode))) - (inhibit-quit t)) - (setq setnu-mode (or (and arg (> (prefix-numeric-value arg) 0)) - (and (null arg) (null setnu-mode)))) - (if (not (eq oldmode setnu-mode)) - (if setnu-mode - (setnu-mode-on) - (setnu-mode-off))))) - -(defun turn-on-setnu-mode () - "Turn on setnu-mode. -Useful for adding to a major-mode hook variable. -Example: - (add-hook 'text-mode-hook 'turn-on-setnu-mode) -to automatically turn on line numbering when enterting text-mode." - (setnu-mode 1)) - -;;; Internal functions - -;;; The program is written using XEmacs terminology, -;;; e.g. extents, glyphs, etc. Functions are defined to twist -;;; the FSF Emacs overlay API into the XEmacs model. - -(defconst setnu-running-under-xemacs - (or (string-match "XEmacs" emacs-version) - (string-match "Lucid" emacs-version))) - -(if setnu-running-under-xemacs - (fset 'setnu-make-extent 'make-extent) - (fset 'setnu-make-extent 'make-overlay)) - -(if setnu-running-under-xemacs - (fset 'setnu-delete-extent 'delete-extent) - (fset 'setnu-delete-extent 'delete-overlay)) - -(if setnu-running-under-xemacs - (fset 'setnu-extent-property 'extent-property) - (fset 'setnu-extent-property 'overlay-get)) - -(if setnu-running-under-xemacs - (fset 'setnu-set-extent-property 'set-extent-property) - (fset 'setnu-set-extent-property 'overlay-put)) - -(if setnu-running-under-xemacs - (fset 'setnu-set-extent-endpoints 'set-extent-endpoints) - (fset 'setnu-set-extent-endpoints 'move-overlay)) - -(if setnu-running-under-xemacs - (fset 'setnu-extent-end-position 'extent-end-position) - (fset 'setnu-extent-end-position 'overlay-end)) - -(if setnu-running-under-xemacs - (fset 'setnu-extent-start-position 'extent-start-position) - (fset 'setnu-extent-start-position 'overlay-start)) - -(if setnu-running-under-xemacs - (defun setnu-set-extent-begin-glyph (e g) - (set-extent-begin-glyph e g 'outside-margin)) - (defun setnu-set-extent-begin-glyph (e g) - (overlay-put e setnu-begin-glyph-property g))) - -(fset 'setnu-make-glyph (if setnu-running-under-xemacs 'make-glyph 'identity)) - -(cond ((and setnu-running-under-xemacs (fboundp 'set-glyph-face)) - (fset 'setnu-set-glyph-face 'set-glyph-face)) - (setnu-running-under-xemacs - (fset 'setnu-set-glyph-face 'ignore)) - (t ; FSF Emacs - (defun setnu-set-glyph-face (g face) - (put-text-property 0 (length g) 'face face g)))) - -(defun setnu-mode-off () - "Internal shutdown of setnu-mode. -Deletes the extents associated with setnu-mode." - (if (and setnu-running-under-xemacs - (fboundp 'remove-specifier)) - (remove-specifier left-margin-width (current-buffer))) - (if setnu-start-extent - (let (e ee) - (setq e setnu-start-extent) - (while e - (setq ee e) - (setq e (setnu-extent-property e 'setnu-next-extent)) - (setnu-delete-extent ee)) - (setq setnu-start-extent nil)))) - -(defun setnu-mode-on () - "Internal startup of setnu-mode. -Sets up the extents associated with setnu-mode." - (if (and setnu-running-under-xemacs - (fboundp 'set-specifier)) - (set-specifier left-margin-width 6 (current-buffer))) - (let ((done nil) - (curr-e nil) - (n 1) - (match-data (match-data)) - e start numstr) - (unwind-protect - (save-excursion - (save-restriction - (widen) - (goto-char (point-min)) - (setq start (point)) - (while (not done) - (setq done (null (search-forward "\n" nil 0))) - (setq e (setnu-make-setnu-extent start (point))) - (if (null setnu-start-extent) - (setq setnu-start-extent e - curr-e e) - (setnu-set-extent-property curr-e 'setnu-next-extent e) - (setnu-set-extent-property e 'setnu-prev-extent curr-e) - (setq curr-e e)) - (setq numstr (format setnu-line-number-format n)) - (setnu-set-extent-property e 'line-number numstr) - (setnu-set-extent-begin-glyph e (setnu-number-glyph numstr)) - (setq n (1+ n) - start (point))))) - (store-match-data match-data)))) - -(defun setnu-before-change-function (start end) - "Before change function for setnu-mode. -Notices when a delete is about to delete some lines and adjusts -the line number extents accordingly." - (if (or (not setnu-mode) (= start end)) - () ;; not in setnu-mode or this is an insertion - (let ((inhibit-quit t) - (start-e nil) - (match-data (match-data)) - end-e saved-next e ee) - (unwind-protect - (save-excursion - (save-restriction - (widen) - (goto-char start) - (if (search-forward "\n" end t) - (progn - (setq start-e (setnu-extent-at-create start nil) - saved-next (setnu-extent-property - start-e - 'setnu-next-extent)) - (setq end-e (setnu-extent-at-create end nil)) - (setnu-set-extent-endpoints - start-e - (setnu-extent-start-position start-e) - (setnu-extent-end-position end-e)) - (setnu-set-extent-property - start-e 'setnu-next-extent - (setnu-extent-property end-e 'setnu-next-extent)))) - (if start-e - (progn - (setq e (setnu-extent-property start-e 'setnu-next-extent) - ee saved-next) - (while (and e (setnu-extent-property e 'setnu-next-extent)) - (setq e (setnu-extent-property e 'setnu-next-extent) - ee (setnu-extent-property ee 'setnu-next-extent))) - (while (and e (not (eq ee start-e))) - (setnu-set-extent-begin-glyph - e (setnu-extent-property ee setnu-begin-glyph-property)) - (setnu-set-extent-property - e 'line-number (setnu-extent-property ee 'line-number)) - (setq e (setnu-extent-property e 'setnu-prev-extent) - ee (setnu-extent-property ee 'setnu-prev-extent))) - (setq end-e (setnu-extent-property start-e - 'setnu-next-extent)) - (and end-e - (setnu-set-extent-property end-e - 'setnu-prev-extent - start-e)) - (setq e saved-next) - (while (not (eq e end-e)) - (setq ee e - e (setnu-extent-property e 'setnu-next-extent)) - (setnu-delete-extent ee)))))) - (store-match-data match-data))))) - -(defun setnu-after-change-function (start end length) - "After change function for setnu-mode. -Notices when an insert has added some lines and adjusts -the line number extents accordingly." - (if (or (not setnu-mode) (= start end)) - () ; not in setnu-mode or this is a deletion - (let ((inhibit-quit t) - (ee nil) - (match-data (match-data)) - (new-lines 0) - start-e e saved-end saved-next n numstr) - (unwind-protect - (save-excursion - (save-restriction - (widen) - (setq start-e (setnu-extent-at-create start nil)) - (if (< (setnu-extent-end-position start-e) (point)) - ;; bogus! insertion didn't put the text into - ;; the extent because, - ;; a. the extent was zero length or - ;; b. this is FSF Emacs which means chars - ;; inserted at the end position of an extent - ;; are not inserted into the extent. - (setnu-set-extent-endpoints - start-e - (setnu-extent-start-position start-e) - end)) - (setq saved-next (setnu-extent-property start-e - 'setnu-next-extent) - saved-end (setnu-extent-end-position start-e) - e start-e) - (goto-char start) - (while (search-forward "\n" end 0) - (setnu-set-extent-endpoints e - (setnu-extent-start-position e) - (point)) - (setq ee (setnu-make-setnu-extent (point) (point))) - (setnu-set-extent-property e 'setnu-next-extent ee) - (setnu-set-extent-property ee 'setnu-prev-extent e) - (setq e ee new-lines (1+ new-lines))) - (if ee - (progn - (setnu-set-extent-endpoints - e (setnu-extent-start-position e) saved-end) - (setnu-set-extent-property e 'setnu-next-extent saved-next) - (and saved-next - (setnu-set-extent-property - saved-next 'setnu-prev-extent e)) - (setq e (setnu-extent-property start-e 'setnu-next-extent) - ee saved-next) - (while ee - (setnu-set-extent-begin-glyph - e (setnu-extent-property ee setnu-begin-glyph-property)) - (setnu-set-extent-property - e 'line-number (setnu-extent-property ee 'line-number)) - (setq e (setnu-extent-property e 'setnu-next-extent) - ee (setnu-extent-property ee 'setnu-next-extent))) - (setq n (1+ (string-to-int - (setnu-extent-property - (setnu-extent-property e 'setnu-prev-extent) - 'line-number)))) - (while e - (setq numstr (format setnu-line-number-format n)) - (setnu-set-extent-property e 'line-number numstr) - (setnu-set-extent-begin-glyph - e (setnu-number-glyph numstr)) - (setq e (setnu-extent-property e 'setnu-next-extent) - n (1+ n))))))) - (store-match-data match-data))))) - -(defun setnu-number-glyph (number-string) - (let ((sym (intern number-string setnu-glyph-obarray))) - (if (boundp sym) - (symbol-value sym) - (let ((g (setnu-make-glyph number-string))) - (set sym g) - (setnu-set-glyph-face g setnu-line-number-face) - g )))) - -(defun setnu-make-setnu-extent (beg end) - "Create an extent and set some properties that all setnu extents have." - (let ((e (setnu-make-extent beg end))) - (setnu-set-extent-property e 'setnu t) -;; (setnu-set-extent-property e 'begin-glyph-layout 'outside-margin) - (setnu-set-extent-property e 'detachable nil) - (setnu-set-extent-property e 'evaporate nil) - e )) - -(cond ((fboundp 'overlays-in) ;; expect to see this in 19.30 - (defun setnu-extent-at (pos buf) - "Finds the setnu extent at the position POS in the buffer BUF." - (catch 'done - (save-excursion - (and buf (set-buffer buf)) - (let ((o-list (overlays-in pos (1+ pos)))) - (while o-list - (if (overlay-get (car o-list) 'setnu) - (throw 'done (car o-list))) - (setq o-list (cdr o-list))) - nil ))))) - ((fboundp 'overlays-at) - (defun setnu-extent-at (pos buf) - "Finds the setnu extent at the position POS in the buffer BUF." - (catch 'done - (save-excursion - (and buf (set-buffer buf)) - (let ((o-list (overlays-at pos)) o-lists) - ;; search what overlays-at returns first. for all - ;; but zero length extents this will return the - ;; extent we want. - (while o-list - (if (overlay-get (car o-list) 'setnu) - (throw 'done (car o-list))) - (setq o-list (cdr o-list))) - ;; No luck. Search the lists returned by - ;; overlay-lists. Use overlays-recenter so we only - ;; have to search the `before' lobe of the return - ;; value. - (overlay-recenter (1- pos)) - (setq o-lists (overlay-lists)) - (setq o-list (cdr o-lists)) - (while o-list - (if (and (overlay-get (car o-list) 'setnu) - (or (and (= pos (overlay-start (car o-list))) - (= pos (overlay-end (car o-list)))) - (and (>= pos (overlay-start (car o-list))) - (< pos (overlay-end (car o-list)))))) - (throw 'done (car o-list))) - (setq o-list (cdr o-list))) - nil ))))) - ((fboundp 'map-extents) - (defun setnu-extent-at (pos buf) - "Finds the setnu extent at the position POS in the buffer BUF." - (map-extents (function (lambda (e maparg) - (if (setnu-extent-property e 'setnu) - e - nil))) - buf pos pos))) - (t (error "can't find overlays-in, overlays-at, or map-extents!"))) - -(defun setnu-extent-at-create (pos buf) - "Like `setnu-extent-at' except if an extent isn't found, then -it is created based on where the extent failed to be found." - (let ((e (setnu-extent-at pos buf)) ee beg numstr) - (if e - e - ;; no extent found so one must be created. - (save-excursion - (goto-char pos) - (beginning-of-line) - (setq e (setnu-extent-at (point) buf)) - (cond (e - ;; found one. extend it to cover this whole line. - ;; this takes care of zero length extents that - ;; might exist at bob or eob that can't be - ;; inserted into. - (setq beg (point)) - (forward-line 1) - (setnu-set-extent-endpoints e beg (point)) - e ) - ((bobp) - ;; we are at bob and there's no extent. - ;; - ;; this is because the extent that was there got - ;; detached because all the text in the buffer was - ;; deleted. so we create a new extent and make it - ;; contain the whole buffer, since there can be no - ;; other attached extents. - (setq e (setnu-make-setnu-extent (point-min) (point-max)) - numstr (format setnu-line-number-format 1)) - (setnu-set-extent-property e 'line-number numstr) - (setnu-set-extent-begin-glyph e (setnu-number-glyph numstr)) - (setq setnu-start-extent e) - e ) - (t - ;; we must be at eob and there's no extent. - ;; - ;; this is because the extent that was there - ;; shrank to zero length and was detached. create - ;; a new extent that contains all text from point - ;; to pos. - (setq e (setnu-make-setnu-extent (point) pos)) - (setq ee (setnu-extent-at (1- (point)) buf)) - (setnu-set-extent-property e 'setnu-prev-extent ee) - (setnu-set-extent-property ee 'setnu-next-extent e) - (setq numstr - (format setnu-line-number-format - (1+ (string-to-int - (setnu-extent-property ee 'line-number))))) - (setnu-set-extent-property e 'line-number numstr) - (setnu-set-extent-begin-glyph e (setnu-number-glyph numstr)) - e )))))) - -(add-hook 'before-change-functions 'setnu-before-change-function) -(add-hook 'after-change-functions 'setnu-after-change-function) diff --git a/app-emacs/rnc-mode/Manifest b/app-emacs/rnc-mode/Manifest deleted file mode 100644 index acc0baa..0000000 --- a/app-emacs/rnc-mode/Manifest +++ /dev/null @@ -1,3 +0,0 @@ -MD5 72fde6aa8e6ed547cecee58f23186624 rnc-mode-1.0.3_beta.ebuild 711 -MD5 936bd7dceb2b37f2b40e76268bc8993f files/digest-rnc-mode-1.0.3_beta 60 -MD5 ebb3a946ae8fe46a91772ee5024aca6a files/50rnc-mode-gentoo.el 145 diff --git a/app-emacs/rnc-mode/files/50rnc-mode-gentoo.el b/app-emacs/rnc-mode/files/50rnc-mode-gentoo.el deleted file mode 100644 index 8a27348..0000000 --- a/app-emacs/rnc-mode/files/50rnc-mode-gentoo.el +++ /dev/null @@ -1,7 +0,0 @@ - -;;; rnc-mode site-lisp configuration - -(require 'rnc-mode) - -(setq auto-mode-alist - (cons '("\\.rnc\\'" . rnc-mode) auto-mode-alist)) diff --git a/app-emacs/rnc-mode/files/digest-rnc-mode-1.0.3_beta b/app-emacs/rnc-mode/files/digest-rnc-mode-1.0.3_beta deleted file mode 100644 index c3412aa..0000000 --- a/app-emacs/rnc-mode/files/digest-rnc-mode-1.0.3_beta +++ /dev/null @@ -1 +0,0 @@ -MD5 f3e9695d02c8ed319981e4053d4e574c RncMode-1_0b3.tgz 3420 diff --git a/app-emacs/rnc-mode/rnc-mode-1.0.3_beta.ebuild b/app-emacs/rnc-mode/rnc-mode-1.0.3_beta.ebuild deleted file mode 100644 index 3868c5f..0000000 --- a/app-emacs/rnc-mode/rnc-mode-1.0.3_beta.ebuild +++ /dev/null @@ -1,37 +0,0 @@ -# Copyright 1999-2004 Gentoo Foundation -# Distributed under the terms of the GNU General Public License v2 -# $Header: $ - -inherit elisp - -IUSE="" - -DESCRIPTION="An emacs mode for editing Relax NG compact schema files." -HOMEPAGE="http://www.pantor.com/" -SRC_URI="http://www.pantor.com/RncMode-1_0b3.tgz" -LICENSE="BSD" -SLOT="0" -KEYWORDS="~x86" - -DEPEND="virtual/emacs" - -SITEFILE=50rnc-mode-gentoo.el -S="${WORKDIR}" - -src_compile() { - elisp-compile *.el || die -} - -src_install() { - elisp-install ${PN} *.el *.elc - elisp-site-file-install ${FILESDIR}/${SITEFILE} -} - -pkg_postinst() { - elisp-site-regen - einfo "Please see ${SITELISP}/${PN}/rnc-mode.el for the complete documentation." -} - -pkg_postrm() { - elisp-site-regen -} diff --git a/app-emacs/smtpmail/Manifest b/app-emacs/smtpmail/Manifest new file mode 100644 index 0000000..bc73d01 --- /dev/null +++ b/app-emacs/smtpmail/Manifest @@ -0,0 +1,5 @@ +MD5 eda332bf7b071adfe1fb3f6fe7266a7a smtpmail-1.77.ebuild 421 +MD5 d41d8cd98f00b204e9800998ecf8427e files/digest-smtpmail-1.77 0 +MD5 47f9486e657339167867814bcaa71241 files/50smtpmail.el 75 +MD5 34dc501944ab5d9e5b155da7c4337057 files/smtpmail.el 34191 +MD5 04eb8f78500b9404e954eb9b11b993dc files/netrc.el 3938 diff --git a/app-emacs/ssh-login/files/50ssh-login-gentoo.el b/app-emacs/smtpmail/files/50smtpmail.el index bd953bc..4c4d39a 100644 --- a/app-emacs/ssh-login/files/50ssh-login-gentoo.el +++ b/app-emacs/smtpmail/files/50smtpmail.el @@ -1,4 +1,4 @@ - ;;; ssh-mode site-lisp configuration -(require 'ssh) +(require 'netrc) +(require 'smtpmail) diff --git a/app-emacs/else-mode/files/digest-else-1.20 b/app-emacs/smtpmail/files/digest-smtpmail-1.77 index e69de29..e69de29 100644 --- a/app-emacs/else-mode/files/digest-else-1.20 +++ b/app-emacs/smtpmail/files/digest-smtpmail-1.77 diff --git a/app-emacs/smtpmail/files/netrc.el b/app-emacs/smtpmail/files/netrc.el new file mode 100644 index 0000000..228e02b --- /dev/null +++ b/app-emacs/smtpmail/files/netrc.el @@ -0,0 +1,129 @@ +;;; netrc.el --- .netrc parsing functionality +;; Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, +;; 2005 Free Software Foundation, Inc. + +;; Author: Lars Magne Ingebrigtsen <larsi@gnus.org> +;; Keywords: news +;; Modularized by Ted Zlatanov <tzz@lifelogs.com> +;; when it was part of Gnus. + +;; 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, Inc., 51 Franklin Street, Fifth Floor, +;; Boston, MA 02110-1301, USA. + +;;; Commentary: + +;; Just the .netrc parsing functionality, abstracted so other packages +;; besides Gnus can use it. + +;;; Code: + +;;; +;;; .netrc and .authinforc parsing +;;; + +(defalias 'netrc-point-at-eol + (if (fboundp 'point-at-eol) + 'point-at-eol + 'line-end-position)) + +(defun netrc-parse (file) + "Parse FILE and return a list of all entries in the file." + (when (file-exists-p file) + (with-temp-buffer + (let ((tokens '("machine" "default" "login" + "password" "account" "macdef" "force" + "port")) + alist elem result pair) + (insert-file-contents file) + (goto-char (point-min)) + ;; Go through the file, line by line. + (while (not (eobp)) + (narrow-to-region (point) (netrc-point-at-eol)) + ;; For each line, get the tokens and values. + (while (not (eobp)) + (skip-chars-forward "\t ") + ;; Skip lines that begin with a "#". + (if (eq (char-after) ?#) + (goto-char (point-max)) + (unless (eobp) + (setq elem + (if (= (following-char) ?\") + (read (current-buffer)) + (buffer-substring + (point) (progn (skip-chars-forward "^\t ") + (point))))) + (cond + ((equal elem "macdef") + ;; We skip past the macro definition. + (widen) + (while (and (zerop (forward-line 1)) + (looking-at "$"))) + (narrow-to-region (point) (point))) + ((member elem tokens) + ;; Tokens that don't have a following value are ignored, + ;; except "default". + (when (and pair (or (cdr pair) + (equal (car pair) "default"))) + (push pair alist)) + (setq pair (list elem))) + (t + ;; Values that haven't got a preceding token are ignored. + (when pair + (setcdr pair elem) + (push pair alist) + (setq pair nil))))))) + (when alist + (push (nreverse alist) result)) + (setq alist nil + pair nil) + (widen) + (forward-line 1)) + (nreverse result))))) + +(defun netrc-machine (list machine &optional port defaultport) + "Return the netrc values from LIST for MACHINE or for the default entry. +If PORT specified, only return entries with matching port tokens. +Entries without port tokens default to DEFAULTPORT." + (let ((rest list) + result) + (while list + (when (equal (cdr (assoc "machine" (car list))) machine) + (push (car list) result)) + (pop list)) + (unless result + ;; No machine name matches, so we look for default entries. + (while rest + (when (assoc "default" (car rest)) + (push (car rest) result)) + (pop rest))) + (when result + (setq result (nreverse result)) + (while (and result + (not (equal (or port defaultport "nntp") + (or (netrc-get (car result) "port") + defaultport "nntp")))) + (pop result)) + (car result)))) + +(defun netrc-get (alist type) + "Return the value of token TYPE from ALIST." + (cdr (assoc type alist))) + +(provide 'netrc) + +;;; arch-tag: af9929cc-2d12-482f-936e-eb4366f9fa55 +;;; netrc.el ends here diff --git a/app-emacs/smtpmail/files/smtpmail.el b/app-emacs/smtpmail/files/smtpmail.el new file mode 100644 index 0000000..55a4d06 --- /dev/null +++ b/app-emacs/smtpmail/files/smtpmail.el @@ -0,0 +1,978 @@ +;;; smtpmail.el --- simple SMTP protocol (RFC 821) for sending mail + +;; Copyright (C) 1995, 1996, 2001, 2002, 2003, 2004, 2005 +;; Free Software Foundation, Inc. + +;; Author: Tomoji Kagatani <kagatani@rbc.ncl.omron.co.jp> +;; Maintainer: Simon Josefsson <simon@josefsson.org> +;; w32 Maintainer: Brian D. Carlstrom <bdc@ai.mit.edu> +;; ESMTP support: Simon Leinen <simon@switch.ch> +;; Hacked by Mike Taylor, 11th October 1999 to add support for +;; automatically appending a domain to RCPT TO: addresses. +;; AUTH=LOGIN support: Stephen Cranefield <scranefield@infoscience.otago.ac.nz> +;; Keywords: mail + +;; 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, Inc., 51 Franklin Street, Fifth Floor, +;; Boston, MA 02110-1301, USA. + +;;; Commentary: + +;; Send Mail to smtp host from smtpmail temp buffer. + +;; Please add these lines in your .emacs(_emacs) or use customize. +;; +;;(setq send-mail-function 'smtpmail-send-it) ; if you use `mail' +;;(setq message-send-mail-function 'smtpmail-send-it) ; if you use message/Gnus +;;(setq smtpmail-default-smtp-server "YOUR SMTP HOST") +;;(setq smtpmail-local-domain "YOUR DOMAIN NAME") +;;(setq smtpmail-sendto-domain "YOUR DOMAIN NAME") +;;(setq smtpmail-debug-info t) ; only to debug problems +;;(setq smtpmail-auth-credentials ; or use ~/.authinfo +;; '(("YOUR SMTP HOST" 25 "username" "password"))) +;;(setq smtpmail-starttls-credentials +;; '(("YOUR SMTP HOST" 25 "~/.my_smtp_tls.key" "~/.my_smtp_tls.cert"))) +;; Where the 25 equals the value of `smtpmail-smtp-service', it can be an +;; integer or a string, just as long as they match (eq). + +;; To queue mail, set smtpmail-queue-mail to t and use +;; smtpmail-send-queued-mail to send. + +;; Modified by Stephen Cranefield <scranefield@infoscience.otago.ac.nz>, +;; 22/6/99, to support SMTP Authentication by the AUTH=LOGIN mechanism. +;; See http://help.netscape.com/products/server/messaging/3x/info/smtpauth.html +;; Rewritten by Simon Josefsson to use same credential variable as AUTH +;; support below. + +;; Modified by Simon Josefsson <jas@pdc.kth.se>, 22/2/99, to support SMTP +;; Authentication by the AUTH mechanism. +;; See http://www.ietf.org/rfc/rfc2554.txt + +;; Modified by Simon Josefsson <simon@josefsson.org>, 2000-10-07, to support +;; STARTTLS. Requires external program +;; ftp://ftp.opaopa.org/pub/elisp/starttls-*.tar.gz. +;; See http://www.ietf.org/rfc/rfc2246.txt, http://www.ietf.org/rfc/rfc2487.txt + +;;; Code: + +(require 'sendmail) +(autoload 'starttls-open-stream "starttls") +(autoload 'starttls-negotiate "starttls") +(autoload 'mail-strip-quoted-names "mail-utils") +(autoload 'message-make-date "message") +(autoload 'message-make-message-id "message") +(autoload 'rfc2104-hash "rfc2104") +(autoload 'netrc-parse "netrc") +(autoload 'netrc-machine "netrc") +(autoload 'netrc-get "netrc") + +;;; +(defgroup smtpmail nil + "SMTP protocol for sending mail." + :group 'mail) + + +(defcustom smtpmail-default-smtp-server nil + "*Specify default SMTP server. +This only has effect if you specify it before loading the smtpmail library." + :type '(choice (const nil) string) + :group 'smtpmail) + +(defcustom smtpmail-smtp-server + (or (getenv "SMTPSERVER") smtpmail-default-smtp-server) + "*The name of the host running SMTP server." + :type '(choice (const nil) string) + :group 'smtpmail) + +(defcustom smtpmail-smtp-service 25 + "*SMTP service port number. +The default value would be \"smtp\" or 25 ." + :type '(choice (integer :tag "Port") (string :tag "Service")) + :group 'smtpmail) + +(defcustom smtpmail-local-domain nil + "*Local domain name without a host name. +If the function (system-name) returns the full internet address, +don't define this value." + :type '(choice (const nil) string) + :group 'smtpmail) + +(defcustom smtpmail-sendto-domain nil + "*Local domain name without a host name. +This is appended (with an @-sign) to any specified recipients which do +not include an @-sign, so that each RCPT TO address is fully qualified. +\(Some configurations of sendmail require this.) + +Don't bother to set this unless you have get an error like: + Sending failed; SMTP protocol error +when sending mail, and the *trace of SMTP session to <somewhere>* +buffer includes an exchange like: + RCPT TO: <someone> + 501 <someone>: recipient address must contain a domain +" + :type '(choice (const nil) string) + :group 'smtpmail) + +(defcustom smtpmail-debug-info nil + "Whether to print info in buffer *trace of SMTP session to <somewhere>*. +See also `smtpmail-debug-verb' which determines if the SMTP protocol should +be verbose as well." + :type 'boolean + :group 'smtpmail) + +(defcustom smtpmail-debug-verb nil + "Whether this library sends the SMTP VERB command or not. +The commands enables verbose information from the SMTP server." + :type 'boolean + :group 'smtpmail) + +(defcustom smtpmail-code-conv-from nil ;; *junet* + "*smtpmail code convert from this code to *internal*..for tiny-mime.." + :type 'boolean + :group 'smtpmail) + +(defcustom smtpmail-queue-mail nil + "*Specify if mail is queued (if t) or sent immediately (if nil). +If queued, it is stored in the directory `smtpmail-queue-dir' +and sent with `smtpmail-send-queued-mail'." + :type 'boolean + :group 'smtpmail) + +(defcustom smtpmail-queue-dir "~/Mail/queued-mail/" + "*Directory where `smtpmail.el' stores queued mail." + :type 'directory + :group 'smtpmail) + +(defcustom smtpmail-auth-credentials "~/.authinfo" + "Specify username and password for servers, directly or via .netrc file. +This variable can either be a filename pointing to a file in netrc(5) +format, or list of four-element lists that contain, in order, +`servername' (a string), `port' (an integer), `user' (a string) and +`password' (a string, or nil to query the user when needed). If you +need to enter a `realm' too, add it to the user string, so that it +looks like `user@realm'." + :type '(choice file + (repeat (list (string :tag "Server") + (integer :tag "Port") + (string :tag "Username") + (choice (const :tag "Query when needed" nil) + (string :tag "Password"))))) + :version "22.1" + :group 'smtpmail) + +(defcustom smtpmail-starttls-credentials '(("" 25 "" "")) + "Specify STARTTLS keys and certificates for servers. +This is a list of four-element list with `servername' (a string), +`port' (an integer), `key' (a filename) and `certificate' (a filename)." + :type '(repeat (list (string :tag "Server") + (integer :tag "Port") + (file :tag "Key") + (file :tag "Certificate"))) + :version "21.1" + :group 'smtpmail) + +(defcustom smtpmail-warn-about-unknown-extensions nil + "*If set, print warnings about unknown SMTP extensions. +This is mainly useful for development purposes, to learn about +new SMTP extensions that might be useful to support." + :type 'boolean + :version "21.1" + :group 'smtpmail) + +(defvar smtpmail-queue-index-file "index" + "File name of queued mail index, +This is relative to `smtpmail-queue-dir'.") + +(defvar smtpmail-address-buffer) +(defvar smtpmail-recipient-address-list) + +(defvar smtpmail-queue-counter 0) + +;; Buffer-local variable. +(defvar smtpmail-read-point) + +(defvar smtpmail-queue-index (concat smtpmail-queue-dir + smtpmail-queue-index-file)) + +(defconst smtpmail-auth-supported '(cram-md5 plain login) + "List of supported SMTP AUTH mechanisms.") + +;;; +;;; +;;; + +(defvar smtpmail-mail-address nil + "Value to use for envelope-from address for mail from ambient buffer.") + +;;;###autoload +(defun smtpmail-send-it () + (let ((errbuf (if mail-interactive + (generate-new-buffer " smtpmail errors") + 0)) + (tembuf (generate-new-buffer " smtpmail temp")) + (case-fold-search nil) + delimline + (mailbuf (current-buffer)) + ;; Examine this variable now, so that + ;; local binding in the mail buffer will take effect. + (smtpmail-mail-address + (or (and mail-specify-envelope-from (mail-envelope-from)) + user-mail-address)) + (smtpmail-code-conv-from + (if enable-multibyte-characters + (let ((sendmail-coding-system smtpmail-code-conv-from)) + (select-message-coding-system))))) + (unwind-protect + (save-excursion + (set-buffer tembuf) + (erase-buffer) + (insert-buffer-substring mailbuf) + (goto-char (point-max)) + ;; require one newline at the end. + (or (= (preceding-char) ?\n) + (insert ?\n)) + ;; Change header-delimiter to be what sendmail expects. + (mail-sendmail-undelimit-header) + (setq delimline (point-marker)) +;; (sendmail-synch-aliases) + (if mail-aliases + (expand-mail-aliases (point-min) delimline)) + (goto-char (point-min)) + ;; ignore any blank lines in the header + (while (and (re-search-forward "\n\n\n*" delimline t) + (< (point) delimline)) + (replace-match "\n")) + (let ((case-fold-search t)) + ;; We used to process Resent-... headers here, + ;; but it was not done properly, and the job + ;; is done correctly in smtpmail-deduce-address-list. + ;; Don't send out a blank subject line + (goto-char (point-min)) + (if (re-search-forward "^Subject:\\([ \t]*\n\\)+\\b" delimline t) + (replace-match "") + ;; This one matches a Subject just before the header delimiter. + (if (and (re-search-forward "^Subject:\\([ \t]*\n\\)+" delimline t) + (= (match-end 0) delimline)) + (replace-match ""))) + ;; Put the "From:" field in unless for some odd reason + ;; they put one in themselves. + (goto-char (point-min)) + (if (not (re-search-forward "^From:" delimline t)) + (let* ((login smtpmail-mail-address) + (fullname (user-full-name))) + (cond ((eq mail-from-style 'angles) + (insert "From: " fullname) + (let ((fullname-start (+ (point-min) 6)) + (fullname-end (point-marker))) + (goto-char fullname-start) + ;; Look for a character that cannot appear unquoted + ;; according to RFC 822. + (if (re-search-forward "[^- !#-'*+/-9=?A-Z^-~]" + fullname-end 1) + (progn + ;; Quote fullname, escaping specials. + (goto-char fullname-start) + (insert "\"") + (while (re-search-forward "[\"\\]" + fullname-end 1) + (replace-match "\\\\\\&" t)) + (insert "\"")))) + (insert " <" login ">\n")) + ((eq mail-from-style 'parens) + (insert "From: " login " (") + (let ((fullname-start (point))) + (insert fullname) + (let ((fullname-end (point-marker))) + (goto-char fullname-start) + ;; RFC 822 says \ and nonmatching parentheses + ;; must be escaped in comments. + ;; Escape every instance of ()\ ... + (while (re-search-forward "[()\\]" fullname-end 1) + (replace-match "\\\\\\&" t)) + ;; ... then undo escaping of matching parentheses, + ;; including matching nested parentheses. + (goto-char fullname-start) + (while (re-search-forward + "\\(\\=\\|[^\\]\\(\\\\\\\\\\)*\\)\\\\(\\(\\([^\\]\\|\\\\\\\\\\)*\\)\\\\)" + fullname-end 1) + (replace-match "\\1(\\3)" t) + (goto-char fullname-start)))) + (insert ")\n")) + ((null mail-from-style) + (insert "From: " login "\n"))))) + ;; Insert a `Message-Id:' field if there isn't one yet. + (goto-char (point-min)) + (unless (re-search-forward "^Message-Id:" delimline t) + (insert "Message-Id: " (message-make-message-id) "\n")) + ;; Insert a `Date:' field if there isn't one yet. + (goto-char (point-min)) + (unless (re-search-forward "^Date:" delimline t) + (insert "Date: " (message-make-date) "\n")) + ;; Insert an extra newline if we need it to work around + ;; Sun's bug that swallows newlines. + (goto-char (1+ delimline)) + (if (eval mail-mailer-swallows-blank-line) + (newline)) + ;; Find and handle any FCC fields. + (goto-char (point-min)) + (if (re-search-forward "^FCC:" delimline t) + (mail-do-fcc delimline)) + (if mail-interactive + (with-current-buffer errbuf + (erase-buffer)))) + ;; + ;; + ;; + (setq smtpmail-address-buffer (generate-new-buffer "*smtp-mail*")) + (setq smtpmail-recipient-address-list + (smtpmail-deduce-address-list tembuf (point-min) delimline)) + (kill-buffer smtpmail-address-buffer) + + (smtpmail-do-bcc delimline) + ; Send or queue + (if (not smtpmail-queue-mail) + (if (not (null smtpmail-recipient-address-list)) + (if (not (smtpmail-via-smtp + smtpmail-recipient-address-list tembuf)) + (error "Sending failed; SMTP protocol error")) + (error "Sending failed; no recipients")) + (let* ((file-data + (expand-file-name + (format "%s_%i" + (format-time-string "%Y-%m-%d_%H:%M:%S") + (setq smtpmail-queue-counter + (1+ smtpmail-queue-counter))) + smtpmail-queue-dir)) + (file-data (convert-standard-filename file-data)) + (file-elisp (concat file-data ".el")) + (buffer-data (create-file-buffer file-data)) + (buffer-elisp (create-file-buffer file-elisp)) + (buffer-scratch "*queue-mail*")) + (unless (file-exists-p smtpmail-queue-dir) + (make-directory smtpmail-queue-dir t)) + (with-current-buffer buffer-data + (erase-buffer) + (insert-buffer tembuf) + (write-file file-data) + (set-buffer buffer-elisp) + (erase-buffer) + (insert (concat + "(setq smtpmail-recipient-address-list '" + (prin1-to-string smtpmail-recipient-address-list) + ")\n")) + (write-file file-elisp) + (set-buffer (generate-new-buffer buffer-scratch)) + (insert (concat file-data "\n")) + (append-to-file (point-min) + (point-max) + smtpmail-queue-index) + ) + (kill-buffer buffer-scratch) + (kill-buffer buffer-data) + (kill-buffer buffer-elisp)))) + (kill-buffer tembuf) + (if (bufferp errbuf) + (kill-buffer errbuf))))) + +;;;###autoload +(defun smtpmail-send-queued-mail () + "Send mail that was queued as a result of setting `smtpmail-queue-mail'." + (interactive) + (with-temp-buffer + ;;; Get index, get first mail, send it, update index, get second + ;;; mail, send it, etc... + (let ((file-msg "")) + (insert-file-contents smtpmail-queue-index) + (goto-char (point-min)) + (while (not (eobp)) + (setq file-msg (buffer-substring (point) (line-end-position))) + (load file-msg) + ;; Insert the message literally: it is already encoded as per + ;; the MIME headers, and code conversions might guess the + ;; encoding wrongly. + (with-temp-buffer + (let ((coding-system-for-read 'no-conversion)) + (insert-file-contents file-msg)) + (let ((smtpmail-mail-address + (or (and mail-specify-envelope-from (mail-envelope-from)) + user-mail-address))) + (if (not (null smtpmail-recipient-address-list)) + (if (not (smtpmail-via-smtp smtpmail-recipient-address-list + (current-buffer))) + (error "Sending failed; SMTP protocol error")) + (error "Sending failed; no recipients")))) + (delete-file file-msg) + (delete-file (concat file-msg ".el")) + (delete-region (point-at-bol) (point-at-bol 2))) + (write-region (point-min) (point-max) smtpmail-queue-index)))) + +;(defun smtpmail-via-smtp (host,port,sender,destination,smtpmail-text-buffer) + +(defun smtpmail-fqdn () + (if smtpmail-local-domain + (concat (system-name) "." smtpmail-local-domain) + (system-name))) + +(defsubst smtpmail-cred-server (cred) + (nth 0 cred)) + +(defsubst smtpmail-cred-port (cred) + (nth 1 cred)) + +(defsubst smtpmail-cred-key (cred) + (nth 2 cred)) + +(defsubst smtpmail-cred-user (cred) + (nth 2 cred)) + +(defsubst smtpmail-cred-cert (cred) + (nth 3 cred)) + +(defsubst smtpmail-cred-passwd (cred) + (nth 3 cred)) + +(defun smtpmail-find-credentials (cred server port) + (catch 'done + (let ((l cred) el) + (while (setq el (pop l)) + (when (and (equal server (smtpmail-cred-server el)) + (equal port (smtpmail-cred-port el))) + (throw 'done el)))))) + +(defun smtpmail-maybe-append-domain (recipient) + (if (or (not smtpmail-sendto-domain) + (string-match "@" recipient)) + recipient + (concat recipient "@" smtpmail-sendto-domain))) + +(defun smtpmail-intersection (list1 list2) + (let ((result nil)) + (dolist (el2 list2) + (when (memq el2 list1) + (push el2 result))) + (nreverse result))) + +(defvar starttls-extra-args) +(defvar starttls-extra-arguments) + +(defun smtpmail-open-stream (process-buffer host port) + (let ((cred (smtpmail-find-credentials + smtpmail-starttls-credentials host port))) + (if (null (and cred (condition-case () + (with-no-warnings + (require 'starttls) + (call-process (if starttls-use-gnutls + starttls-gnutls-program + starttls-program))) + (error nil)))) + ;; The normal case. + (open-network-stream "SMTP" process-buffer host port) + (let* ((cred-key (smtpmail-cred-key cred)) + (cred-cert (smtpmail-cred-cert cred)) + (starttls-extra-args + (append + starttls-extra-args + (when (and (stringp cred-key) (stringp cred-cert) + (file-regular-p + (setq cred-key (expand-file-name cred-key))) + (file-regular-p + (setq cred-cert (expand-file-name cred-cert)))) + (list "--key-file" cred-key "--cert-file" cred-cert)))) + (starttls-extra-arguments + (append + starttls-extra-arguments + (when (and (stringp cred-key) (stringp cred-cert) + (file-regular-p + (setq cred-key (expand-file-name cred-key))) + (file-regular-p + (setq cred-cert (expand-file-name cred-cert)))) + (list "--x509keyfile" cred-key "--x509certfile" cred-cert))))) + (starttls-open-stream "SMTP" process-buffer host port))))) + +(defun smtpmail-try-auth-methods (process supported-extensions host port) + (let* ((mechs (cdr-safe (assoc 'auth supported-extensions))) + (mech (car (smtpmail-intersection smtpmail-auth-supported mechs))) + (cred (if (stringp smtpmail-auth-credentials) + (let* ((netrc (netrc-parse smtpmail-auth-credentials)) + (port-name (format "%s" (or port "smtp"))) + (hostentry (netrc-machine netrc host port-name + port-name))) + (when hostentry + (list host port + (netrc-get hostentry "login") + (netrc-get hostentry "password")))) + (smtpmail-find-credentials + smtpmail-auth-credentials host port))) + (passwd (when cred + (or (smtpmail-cred-passwd cred) + (read-passwd + (format "SMTP password for %s:%s: " + (smtpmail-cred-server cred) + (smtpmail-cred-port cred)))))) + ret) + (when (and cred mech) + (cond + ((eq mech 'cram-md5) + (smtpmail-send-command process (upcase (format "AUTH %s" mech))) + (if (or (null (car (setq ret (smtpmail-read-response process)))) + (not (integerp (car ret))) + (>= (car ret) 400)) + (throw 'done nil)) + (when (eq (car ret) 334) + (let* ((challenge (substring (cadr ret) 4)) + (decoded (base64-decode-string challenge)) + (hash (rfc2104-hash 'md5 64 16 passwd decoded)) + (response (concat (smtpmail-cred-user cred) " " hash)) + (encoded (base64-encode-string response))) + (smtpmail-send-command process (format "%s" encoded)) + (if (or (null (car (setq ret (smtpmail-read-response process)))) + (not (integerp (car ret))) + (>= (car ret) 400)) + (throw 'done nil))))) + ((eq mech 'login) + (smtpmail-send-command process "AUTH LOGIN") + (if (or (null (car (setq ret (smtpmail-read-response process)))) + (not (integerp (car ret))) + (>= (car ret) 400)) + (throw 'done nil)) + (smtpmail-send-command + process (base64-encode-string (smtpmail-cred-user cred))) + (if (or (null (car (setq ret (smtpmail-read-response process)))) + (not (integerp (car ret))) + (>= (car ret) 400)) + (throw 'done nil)) + (smtpmail-send-command process (base64-encode-string passwd)) + (if (or (null (car (setq ret (smtpmail-read-response process)))) + (not (integerp (car ret))) + (>= (car ret) 400)) + (throw 'done nil))) + ((eq mech 'plain) + (smtpmail-send-command process "AUTH PLAIN") + (if (or (null (car (setq ret (smtpmail-read-response process)))) + (not (integerp (car ret))) + (not (equal (car ret) 334))) + (throw 'done nil)) + (smtpmail-send-command process (base64-encode-string + (concat "\0" + (smtpmail-cred-user cred) + "\0" + (smtpmail-cred-passwd cred)))) + (if (or (null (car (setq ret (smtpmail-read-response process)))) + (not (integerp (car ret))) + (not (equal (car ret) 235))) + (throw 'done nil))) + + (t + (error "Mechanism %s not implemented" mech))) + ;; Remember the password. + (when (and (not (stringp smtpmail-auth-credentials)) + (null (smtpmail-cred-passwd cred))) + (setcar (cdr (cdr (cdr cred))) passwd))))) + +(defun smtpmail-via-smtp (recipient smtpmail-text-buffer) + (let ((process nil) + (host (or smtpmail-smtp-server + (error "`smtpmail-smtp-server' not defined"))) + (port smtpmail-smtp-service) + ;; smtpmail-mail-address should be set to the appropriate + ;; buffer-local value by the caller, but in case not: + (envelope-from (or smtpmail-mail-address + (and mail-specify-envelope-from + (mail-envelope-from)) + user-mail-address)) + response-code + greeting + process-buffer + (supported-extensions '())) + (unwind-protect + (catch 'done + ;; get or create the trace buffer + (setq process-buffer + (get-buffer-create (format "*trace of SMTP session to %s*" host))) + + ;; clear the trace buffer of old output + (with-current-buffer process-buffer + (erase-buffer)) + + ;; open the connection to the server + (setq process (smtpmail-open-stream process-buffer host port)) + (and (null process) (throw 'done nil)) + + ;; set the send-filter + (set-process-filter process 'smtpmail-process-filter) + + (with-current-buffer process-buffer + (set-buffer-process-coding-system 'raw-text-unix 'raw-text-unix) + (make-local-variable 'smtpmail-read-point) + (setq smtpmail-read-point (point-min)) + + + (if (or (null (car (setq greeting (smtpmail-read-response process)))) + (not (integerp (car greeting))) + (>= (car greeting) 400)) + (throw 'done nil) + ) + + (let ((do-ehlo t) + (do-starttls t)) + (while do-ehlo + ;; EHLO + (smtpmail-send-command process (format "EHLO %s" (smtpmail-fqdn))) + + (if (or (null (car (setq response-code + (smtpmail-read-response process)))) + (not (integerp (car response-code))) + (>= (car response-code) 400)) + (progn + ;; HELO + (smtpmail-send-command + process (format "HELO %s" (smtpmail-fqdn))) + + (if (or (null (car (setq response-code + (smtpmail-read-response process)))) + (not (integerp (car response-code))) + (>= (car response-code) 400)) + (throw 'done nil))) + (dolist (line (cdr (cdr response-code))) + (let ((name (mapcar (lambda (s) (intern (downcase s))) + (split-string (substring line 4) "[ ]")))) + (and (eq (length name) 1) + (setq name (car name))) + (and name + (cond ((memq (if (consp name) (car name) name) + '(verb xvrb 8bitmime onex xone + expn size dsn etrn + enhancedstatuscodes + help xusr + auth=login auth starttls)) + (setq supported-extensions + (cons name supported-extensions))) + (smtpmail-warn-about-unknown-extensions + (message "Unknown extension %s" name))))))) + + (if (and do-starttls + (smtpmail-find-credentials smtpmail-starttls-credentials host port) + (member 'starttls supported-extensions) + (numberp (process-id process))) + (progn + (smtpmail-send-command process (format "STARTTLS")) + (if (or (null (car (setq response-code (smtpmail-read-response process)))) + (not (integerp (car response-code))) + (>= (car response-code) 400)) + (throw 'done nil)) + (starttls-negotiate process) + (setq do-starttls nil)) + (setq do-ehlo nil)))) + + (smtpmail-try-auth-methods process supported-extensions host port) + + (if (or (member 'onex supported-extensions) + (member 'xone supported-extensions)) + (progn + (smtpmail-send-command process (format "ONEX")) + (if (or (null (car (setq response-code (smtpmail-read-response process)))) + (not (integerp (car response-code))) + (>= (car response-code) 400)) + (throw 'done nil)))) + + (if (and smtpmail-debug-verb + (or (member 'verb supported-extensions) + (member 'xvrb supported-extensions))) + (progn + (smtpmail-send-command process (format "VERB")) + (if (or (null (car (setq response-code (smtpmail-read-response process)))) + (not (integerp (car response-code))) + (>= (car response-code) 400)) + (throw 'done nil)))) + + (if (member 'xusr supported-extensions) + (progn + (smtpmail-send-command process (format "XUSR")) + (if (or (null (car (setq response-code (smtpmail-read-response process)))) + (not (integerp (car response-code))) + (>= (car response-code) 400)) + (throw 'done nil)))) + + ;; MAIL FROM:<sender> + (let ((size-part + (if (or (member 'size supported-extensions) + (assoc 'size supported-extensions)) + (format " SIZE=%d" + (with-current-buffer smtpmail-text-buffer + ;; size estimate: + (+ (- (point-max) (point-min)) + ;; Add one byte for each change-of-line + ;; because of CR-LF representation: + (count-lines (point-min) (point-max))))) + "")) + (body-part + (if (member '8bitmime supported-extensions) + ;; FIXME: + ;; Code should be added here that transforms + ;; the contents of the message buffer into + ;; something the receiving SMTP can handle. + ;; For a receiver that supports 8BITMIME, this + ;; may mean converting BINARY to BASE64, or + ;; adding Content-Transfer-Encoding and the + ;; other MIME headers. The code should also + ;; return an indication of what encoding the + ;; message buffer is now, i.e. ASCII or + ;; 8BITMIME. + (if nil + " BODY=8BITMIME" + "") + ""))) +; (smtpmail-send-command process (format "MAIL FROM:%s@%s" (user-login-name) (smtpmail-fqdn))) + (smtpmail-send-command process (format "MAIL FROM:<%s>%s%s" + envelope-from + size-part + body-part)) + + (if (or (null (car (setq response-code (smtpmail-read-response process)))) + (not (integerp (car response-code))) + (>= (car response-code) 400)) + (throw 'done nil) + )) + + ;; RCPT TO:<recipient> + (let ((n 0)) + (while (not (null (nth n recipient))) + (smtpmail-send-command process (format "RCPT TO:<%s>" (smtpmail-maybe-append-domain (nth n recipient)))) + (setq n (1+ n)) + + (setq response-code (smtpmail-read-response process)) + (if (or (null (car response-code)) + (not (integerp (car response-code))) + (>= (car response-code) 400)) + (throw 'done nil) + ) + )) + + ;; DATA + (smtpmail-send-command process "DATA") + + (if (or (null (car (setq response-code (smtpmail-read-response process)))) + (not (integerp (car response-code))) + (>= (car response-code) 400)) + (throw 'done nil) + ) + + ;; Mail contents + (smtpmail-send-data process smtpmail-text-buffer) + + ;;DATA end "." + (smtpmail-send-command process ".") + + (if (or (null (car (setq response-code (smtpmail-read-response process)))) + (not (integerp (car response-code))) + (>= (car response-code) 400)) + (throw 'done nil) + ) + + ;;QUIT +; (smtpmail-send-command process "QUIT") +; (and (null (car (smtpmail-read-response process))) +; (throw 'done nil)) + t )) + (if process + (with-current-buffer (process-buffer process) + (smtpmail-send-command process "QUIT") + (smtpmail-read-response process) + +; (if (or (null (car (setq response-code (smtpmail-read-response process)))) +; (not (integerp (car response-code))) +; (>= (car response-code) 400)) +; (throw 'done nil) +; ) + (delete-process process) + (unless smtpmail-debug-info + (kill-buffer process-buffer))))))) + + +(defun smtpmail-process-filter (process output) + (with-current-buffer (process-buffer process) + (goto-char (point-max)) + (insert output))) + +(defun smtpmail-read-response (process) + (let ((case-fold-search nil) + (response-strings nil) + (response-continue t) + (return-value '(nil ())) + match-end) + (catch 'done + (while response-continue + (goto-char smtpmail-read-point) + (while (not (search-forward "\r\n" nil t)) + (unless (memq (process-status process) '(open run)) + (throw 'done nil)) + (accept-process-output process) + (goto-char smtpmail-read-point)) + + (setq match-end (point)) + (setq response-strings + (cons (buffer-substring smtpmail-read-point (- match-end 2)) + response-strings)) + + (goto-char smtpmail-read-point) + (if (looking-at "[0-9]+ ") + (let ((begin (match-beginning 0)) + (end (match-end 0))) + (if smtpmail-debug-info + (message "%s" (car response-strings))) + + (setq smtpmail-read-point match-end) + + ;; ignore lines that start with "0" + (if (looking-at "0[0-9]+ ") + nil + (setq response-continue nil) + (setq return-value + (cons (string-to-number + (buffer-substring begin end)) + (nreverse response-strings))))) + + (if (looking-at "[0-9]+-") + (progn (if smtpmail-debug-info + (message "%s" (car response-strings))) + (setq smtpmail-read-point match-end) + (setq response-continue t)) + (progn + (setq smtpmail-read-point match-end) + (setq response-continue nil) + (setq return-value + (cons nil (nreverse response-strings))))))) + (setq smtpmail-read-point match-end)) + return-value)) + + +(defun smtpmail-send-command (process command) + (goto-char (point-max)) + (if (= (aref command 0) ?P) + (insert "PASS <omitted>\r\n") + (insert command "\r\n")) + (setq smtpmail-read-point (point)) + (process-send-string process command) + (process-send-string process "\r\n")) + +(defun smtpmail-send-data-1 (process data) + (goto-char (point-max)) + + (if (and (multibyte-string-p data) + smtpmail-code-conv-from) + (setq data (string-as-multibyte + (encode-coding-string data smtpmail-code-conv-from)))) + + (if smtpmail-debug-info + (insert data "\r\n")) + + (setq smtpmail-read-point (point)) + ;; Escape "." at start of a line + (if (eq (string-to-char data) ?.) + (process-send-string process ".")) + (process-send-string process data) + (process-send-string process "\r\n") + ) + +(defun smtpmail-send-data (process buffer) + (let ((data-continue t) sending-data) + (with-current-buffer buffer + (goto-char (point-min))) + (while data-continue + (with-current-buffer buffer + (setq sending-data (buffer-substring (point-at-bol) (point-at-eol))) + (end-of-line 2) + (setq data-continue (not (eobp)))) + (smtpmail-send-data-1 process sending-data)))) + +(defun smtpmail-deduce-address-list (smtpmail-text-buffer header-start header-end) + "Get address list suitable for smtp RCPT TO: <address>." + (unwind-protect + (with-current-buffer smtpmail-address-buffer + (erase-buffer) + (let + ((case-fold-search t) + (simple-address-list "") + this-line + this-line-end + addr-regexp) + (insert-buffer-substring smtpmail-text-buffer header-start header-end) + (goto-char (point-min)) + ;; RESENT-* fields should stop processing of regular fields. + (save-excursion + (setq addr-regexp + (if (re-search-forward "^Resent-\\(to\\|cc\\|bcc\\):" + header-end t) + "^Resent-\\(to\\|cc\\|bcc\\):" + "^\\(To:\\|Cc:\\|Bcc:\\)"))) + + (while (re-search-forward addr-regexp header-end t) + (replace-match "") + (setq this-line (match-beginning 0)) + (forward-line 1) + ;; get any continuation lines + (while (and (looking-at "^[ \t]+") (< (point) header-end)) + (forward-line 1)) + (setq this-line-end (point-marker)) + (setq simple-address-list + (concat simple-address-list " " + (mail-strip-quoted-names (buffer-substring this-line this-line-end)))) + ) + (erase-buffer) + (insert " " simple-address-list "\n") + (subst-char-in-region (point-min) (point-max) 10 ? t);; newline --> blank + (subst-char-in-region (point-min) (point-max) ?, ? t);; comma --> blank + (subst-char-in-region (point-min) (point-max) 9 ? t);; tab --> blank + + (goto-char (point-min)) + ;; tidyness in case hook is not robust when it looks at this + (while (re-search-forward "[ \t]+" header-end t) (replace-match " ")) + + (goto-char (point-min)) + (let (recipient-address-list) + (while (re-search-forward " \\([^ ]+\\) " (point-max) t) + (backward-char 1) + (setq recipient-address-list (cons (buffer-substring (match-beginning 1) (match-end 1)) + recipient-address-list)) + ) + (setq smtpmail-recipient-address-list recipient-address-list)) + + ) + ) + ) + ) + + +(defun smtpmail-do-bcc (header-end) + "Delete [Resent-]BCC: and their continuation lines from the header area. +There may be multiple BCC: lines, and each may have arbitrarily +many continuation lines." + (let ((case-fold-search t)) + (save-excursion + (goto-char (point-min)) + ;; iterate over all BCC: lines + (while (re-search-forward "^\\(RESENT-\\)?BCC:" header-end t) + (delete-region (match-beginning 0) + (progn (forward-line 1) (point))) + ;; get rid of any continuation lines + (while (and (looking-at "^[ \t].*\n") (< (point) header-end)) + (replace-match "")))))) + + +(provide 'smtpmail) + +;;; arch-tag: a76992df-6d71-43b7-9e72-4bacc6c05466 +;;; smtpmail.el ends here diff --git a/app-emacs/smtpmail/smtpmail-1.77.ebuild b/app-emacs/smtpmail/smtpmail-1.77.ebuild new file mode 100644 index 0000000..7ef23da --- /dev/null +++ b/app-emacs/smtpmail/smtpmail-1.77.ebuild @@ -0,0 +1,24 @@ +# Copyright 1999-2004 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 + +inherit elisp + +IUSE="" + +DESCRIPTION="CVS version of the smtp library for emaces" +HOMEPAGE="http://josefsson.org/emacs-rfc2554.html" +SRC_URI="" +LICENSE="GPL-2" +SLOT="0" +KEYWORDS="~x86" + +DEPEND="virtual/emacs" + +SITEFILE=50smtpmail.el +S="${WORKDIR}" + +src_unpack() { + cd ${S} + cp ${FILESDIR}/{smtpmail,netrc}.el . +} + diff --git a/app-emacs/ssh-login/Manifest b/app-emacs/ssh-login/Manifest deleted file mode 100644 index cff0f2b..0000000 --- a/app-emacs/ssh-login/Manifest +++ /dev/null @@ -1,4 +0,0 @@ -MD5 61b1a7b03b94e6f3993f7a6239499f5c ssh-login-1.9.ebuild 720 -MD5 c8f908098c8082dc82798708aadffa89 files/50ssh-login-gentoo.el 54 -MD5 eae9cc8023fc3db913edd88ed32db912 files/digest-ssh-login-1.9 52 -MD5 b445638f576d784ec777a695b6ba8178 files/semantic.cache 364 diff --git a/app-emacs/ssh-login/files/digest-ssh-login-1.9 b/app-emacs/ssh-login/files/digest-ssh-login-1.9 deleted file mode 100644 index 5dc77ca..0000000 --- a/app-emacs/ssh-login/files/digest-ssh-login-1.9 +++ /dev/null @@ -1 +0,0 @@ -MD5 344c0eae6d13569999806f614d537f78 ssh.el.gz 5321 diff --git a/app-emacs/ssh-login/files/semantic.cache b/app-emacs/ssh-login/files/semantic.cache deleted file mode 100644 index bfd0cc8..0000000 --- a/app-emacs/ssh-login/files/semantic.cache +++ /dev/null @@ -1,14 +0,0 @@ -;; Object semantic.cache -;; SEMANTICDB Tags save file -(semanticdb-project-database "semantic.cache" - :file "semantic.cache" - :tables (list - (semanticdb-table "50ssh-login-gentoo.el" - :file "50ssh-login-gentoo.el" - :pointmax 55 - :major-mode 'emacs-lisp-mode - :tokens '(("ssh" include nil nil nil [40 54])) - :unmatched-syntax 'nil - ) - ) - ) diff --git a/app-emacs/ssh-login/ssh-login-1.9.ebuild b/app-emacs/ssh-login/ssh-login-1.9.ebuild deleted file mode 100644 index 74dd440..0000000 --- a/app-emacs/ssh-login/ssh-login-1.9.ebuild +++ /dev/null @@ -1,36 +0,0 @@ -# Copyright 1999-2004 Gentoo Foundation -# Distributed under the terms of the GNU General Public License v2 - -inherit elisp - -IUSE="" - -DESCRIPTION="Allows to use an emacs buffer for remote login" -HOMEPAGE="http://www.splode.com/~friedman/" -SRC_URI="http://www.gunnarwrobel.de/downloads/${PN/-login/}.el.gz" -LICENSE="GPL-2" -SLOT="0" -KEYWORDS="x86" - -DEPEND="virtual/emacs" - -SITEFILE=50ssh-login-gentoo.el -S="${WORKDIR}" - -src_compile() { - elisp-compile *.el || die -} - -src_install() { - elisp-install ${PN/-login/} *.el *.elc - elisp-site-file-install ${FILESDIR}/${SITEFILE} -} - -pkg_postinst() { - elisp-site-regen - einfo "Please see ${SITELISP}/${PN}/ssh.el for the complete documentation." -} - -pkg_postrm() { - elisp-site-regen -} diff --git a/app-misc/scripts-gw/Manifest b/app-misc/scripts-gw/Manifest deleted file mode 100644 index 6ccfa17..0000000 --- a/app-misc/scripts-gw/Manifest +++ /dev/null @@ -1,7 +0,0 @@ -MD5 78746d037a76270de96b0bbb5695cd91 scripts-gw-1.2.4.ebuild 347 -MD5 9f022aee88bf25bd660ef0461ef16dca files/digest-scripts-gw-1.2.4 68 -MD5 e202345317ec6444e8815d8f23915c9e files/digest-scripts-gw-1.1 65 -MD5 4be550b3ed4fb3be8ee20a9e1f12755e files/digest-scripts-gw-1.2 65 -MD5 fbe4c4eac3a75f72f197a5c08ecc67d4 files/digest-scripts-gw-1.2.1 67 -MD5 a4e62c18ca292e62e60df94199ddb3f1 files/digest-scripts-gw-1.2.2 67 -MD5 b859cf9f9749ed3f9db2d227ad2c6f45 files/digest-scripts-gw-1.2.3 67 diff --git a/app-misc/scripts-gw/files/digest-scripts-gw-1.1 b/app-misc/scripts-gw/files/digest-scripts-gw-1.1 deleted file mode 100644 index 9dad4e3..0000000 --- a/app-misc/scripts-gw/files/digest-scripts-gw-1.1 +++ /dev/null @@ -1 +0,0 @@ -MD5 d57dc4d324afa8c11c23480b941d52b3 scripts-gw-1.1.tar.bz2 4447 diff --git a/app-misc/scripts-gw/files/digest-scripts-gw-1.2 b/app-misc/scripts-gw/files/digest-scripts-gw-1.2 deleted file mode 100644 index 6a82535..0000000 --- a/app-misc/scripts-gw/files/digest-scripts-gw-1.2 +++ /dev/null @@ -1 +0,0 @@ -MD5 e021768bb9b92ab388e46b43d8dcaaaa scripts-gw-1.2.tar.bz2 9313 diff --git a/app-misc/scripts-gw/files/digest-scripts-gw-1.2.1 b/app-misc/scripts-gw/files/digest-scripts-gw-1.2.1 deleted file mode 100644 index 237ac54..0000000 --- a/app-misc/scripts-gw/files/digest-scripts-gw-1.2.1 +++ /dev/null @@ -1 +0,0 @@ -MD5 12f1564bcb38df05366e0b65010999f0 scripts-gw-1.2.1.tar.bz2 9646 diff --git a/app-misc/scripts-gw/files/digest-scripts-gw-1.2.2 b/app-misc/scripts-gw/files/digest-scripts-gw-1.2.2 deleted file mode 100644 index 9f6beb0..0000000 --- a/app-misc/scripts-gw/files/digest-scripts-gw-1.2.2 +++ /dev/null @@ -1 +0,0 @@ -MD5 05e920337d049817b91dba2951cbfc9d scripts-gw-1.2.2.tar.bz2 9662 diff --git a/app-misc/scripts-gw/files/digest-scripts-gw-1.2.3 b/app-misc/scripts-gw/files/digest-scripts-gw-1.2.3 deleted file mode 100644 index 1fc6624..0000000 --- a/app-misc/scripts-gw/files/digest-scripts-gw-1.2.3 +++ /dev/null @@ -1 +0,0 @@ -MD5 37454ffa1f8ded90a289967231fba99d scripts-gw-1.2.3.tar.bz2 9903 diff --git a/app-misc/scripts-gw/files/digest-scripts-gw-1.2.4 b/app-misc/scripts-gw/files/digest-scripts-gw-1.2.4 deleted file mode 100644 index 9ad1eb5..0000000 --- a/app-misc/scripts-gw/files/digest-scripts-gw-1.2.4 +++ /dev/null @@ -1 +0,0 @@ -MD5 b2e12311dc8a091e1894ac60df6f5a7e scripts-gw-1.2.4.tar.bz2 10867 diff --git a/app-misc/scripts-gw/scripts-gw-1.2.4.ebuild b/app-misc/scripts-gw/scripts-gw-1.2.4.ebuild deleted file mode 100644 index dac2643..0000000 --- a/app-misc/scripts-gw/scripts-gw-1.2.4.ebuild +++ /dev/null @@ -1,20 +0,0 @@ -# Copyright 1999-2004 Gentoo Technologies, Inc. -# Distributed under the terms of the GNU General Public License v2 -# -# $Header: $ - -DESCRIPTION="Some sys-admin scripts by Gunnar Wrobel" - -KEYWORDS="~x86" - -SRC_URI="http://www.gunnarwrobel.de/downloads/${P}.tar.bz2" - -S=${WORKDIR}/${PN} - -SLOT=0 - -src_install() -{ - cd ${S} - make install DESTDIR=${D} -} diff --git a/app-portage/polymeraze/Manifest b/app-portage/polymeraze/Manifest deleted file mode 100644 index 6e7d18e..0000000 --- a/app-portage/polymeraze/Manifest +++ /dev/null @@ -1,2 +0,0 @@ -MD5 b8b418440eaf6ca9a33ba08610c5fc35 files/digest-polymeraze-1.0 65 -MD5 aabed50fd3947c60583e2b5b2dc0ae94 polymeraze-1.0.ebuild 758 diff --git a/app-portage/polymeraze/files/digest-polymeraze-1.0 b/app-portage/polymeraze/files/digest-polymeraze-1.0 deleted file mode 100644 index 12ba494..0000000 --- a/app-portage/polymeraze/files/digest-polymeraze-1.0 +++ /dev/null @@ -1 +0,0 @@ -MD5 73f1bc3ea96cffa1af11c838ab3e6c3b polymeraze-1.0.tar.gz 21744 diff --git a/app-portage/polymeraze/polymeraze-1.0.ebuild b/app-portage/polymeraze/polymeraze-1.0.ebuild deleted file mode 100644 index 7f0ffea..0000000 --- a/app-portage/polymeraze/polymeraze-1.0.ebuild +++ /dev/null @@ -1,37 +0,0 @@ -# Copyright 1999-2006 Gentoo Foundation -# Distributed under the terms of the GNU General Public License v2 -# $Header: $ - -inherit eutils distutils - -DESCRIPTION="An alternate frontend for portage " -HOMEPAGE="http://projects.pardus.de/polymeraze" -SRC_URI="http://dev.gentoo.org/~wrobel/polymeraze/${PF}.tar.gz" - -LICENSE="GPL-2" -SLOT="0" -KEYWORDS="~x86" -IUSE="" -S=${WORKDIR}/${PF} - -DEPEND="" - -src_install() { - - distutils_src_install - - dodir /etc/polymeraze - cp etc/* ${D}/etc/polymeraze/ - -# doman doc/polymeraze.8 -# dohtml doc/polymeraze.8.html -} - -src_test() { - cd ${S} - einfo "Running polymeraze doctests..." - if ! PYTHONPATH="." ${python} polymeraze/tests/dtest.py; then - eerror "DocTests failed - please submit a bug report" - die "DocTesting failed!" - fi -} diff --git a/dev-lang/R/Manifest b/dev-lang/R/Manifest new file mode 100644 index 0000000..76c5365 --- /dev/null +++ b/dev-lang/R/Manifest @@ -0,0 +1,2 @@ +MD5 c702c191f207d51ca64c156de0dfbc67 R-2.999.ebuild 2676 +MD5 7466cd1a2032f34898f591f942ccd971 files/digest-R-2.999 62 diff --git a/dev-lang/R/R-2.999.ebuild b/dev-lang/R/R-2.999.ebuild new file mode 100644 index 0000000..206dec4 --- /dev/null +++ b/dev-lang/R/R-2.999.ebuild @@ -0,0 +1,90 @@ +# Copyright 1999-2005 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/dev-lang/R/R-2.1.1.ebuild,v 1.3 2005/08/22 21:53:01 gustavoz Exp $ + +inherit fortran toolchain-funcs + +MY_P="R-devel" + +IUSE="blas jpeg nls png readline tcltk X" +DESCRIPTION="R is GNU S - A language and environment for statistical computing and graphics." +SRC_URI="ftp://ftp.stat.math.ethz.ch/Software/R/${MY_P}.tar.bz2" +#There are daily release patches, don't know how to utilize these +#"ftp://ftp.stat.math.ethz.ch/Software/${PN}/${PN}-release.diff.gz" +HOMEPAGE="http://www.r-project.org/" +DEPEND="virtual/libc + >=dev-lang/perl-5.6.1-r3 + readline? ( >=sys-libs/readline-4.1-r3 ) + jpeg? ( >=media-libs/jpeg-6b-r2 ) + png? ( >=media-libs/libpng-1.2.1 ) + blas? ( virtual/blas ) + X? ( virtual/x11 ) + tcltk? ( dev-lang/tk )" +SLOT="0" +LICENSE="GPL-2 LGPL-2.1" +KEYWORDS="~x86" +S="${WORKDIR}/${MY_P}" + +pkg_setup() { + # Test for a 64 bit architecture - f2c won't work on 64 bit archs with R. + # Thanks to vapier for providing the test. + echo 'int main(){}' > test.c + $(tc-getCC) -c test.c -o test.o + if file test.o | grep -qs 64-bit ; then + einfo "64 bit architecture detected, using g77." + FORTRAN="g77" + else + FORTRAN="g77 f2c" + fi + fortran_pkg_setup +} + +src_compile() { + local myconf="--enable-R-profiling --enable-R-shlib --enable-linux-lfs" + + if use tcltk; then + #configure needs to find the files tclConfig.sh and tkConfig.sh + myconf="${myconf} --with-tcltk --with-tcl-config=/usr/lib/tclConfig.sh --with-tk-config=/usr/lib/tkConfig.sh" + else + myconf="${myconf} --without-tcltk" + fi + + econf \ + $(use_enable nls) \ + $(use_with blas) \ + $(use_with jpeg jpeglib) \ + $(use_with png libpng) \ + $(use_with readline) \ + $(use_with X x) \ + ${myconf} || die "econf failed" + emake || die "emake failed" +} + +src_install() { + make \ + prefix=${D}/usr \ + mandir=${D}/usr/share/man \ + infodir=${D}/usr/share/info \ + rhome=${D}/usr/$(get_libdir)/R \ + install || die "Installation Failed" + + #fix the R wrapper script to have the correct R_HOME_DIR + #sed regexp borrowed from included debian rules + sed \ + -e "#^R_\(HOME|SHARE|INCLUDE|DOC\)_DIR=${D}#R_\1_DIR=#" \ + -i ${D}/usr/$(get_libdir)/R/bin/R \ + || die "sed failed" + + #R installs two identical wrappers under /usr/bin and /usr/lib/R/bin/ + #the 2nd one is corrected by above sed, for the 1st + #I'll just symlink it into /usr/bin + cd ${D}/usr/bin/ + rm R + dosym ../$(get_libdir)/R/bin/R /usr/bin/R + dodir /etc/env.d + echo > ${D}/etc/env.d/99R "LDPATH=/usr/$(get_libdir)/R/lib" + cd ${S} + + dodoc AUTHORS BUGS COPYING* ChangeLog FAQ *NEWS README \ + RESOURCES THANKS VERSION Y2K +} diff --git a/dev-lang/R/files/digest-R-2.999 b/dev-lang/R/files/digest-R-2.999 new file mode 100644 index 0000000..13bd415 --- /dev/null +++ b/dev-lang/R/files/digest-R-2.999 @@ -0,0 +1 @@ +MD5 0a724ff3adbe18c91ec8d5f750bbd146 R-devel.tar.bz2 11708371 diff --git a/dev-python/python-fuse/Manifest b/dev-python/python-fuse/Manifest deleted file mode 100644 index af7c5a2..0000000 --- a/dev-python/python-fuse/Manifest +++ /dev/null @@ -1,2 +0,0 @@ -MD5 f60dcd1e6d44bdb3b585a4bfd6e94514 python-fuse-2.3.ebuild 480 -MD5 80235cf0bc98dd3beadb50852a66b69f files/digest-python-fuse-2.3 66 diff --git a/dev-python/python-fuse/files/digest-python-fuse-2.3 b/dev-python/python-fuse/files/digest-python-fuse-2.3 deleted file mode 100644 index f4e6ad7..0000000 --- a/dev-python/python-fuse/files/digest-python-fuse-2.3 +++ /dev/null @@ -1 +0,0 @@ -MD5 b0ec113341ae9c9a396fc9fd120eda36 python-fuse-2.3.tar.gz 12855 diff --git a/dev-python/python-fuse/python-fuse-2.3.ebuild b/dev-python/python-fuse/python-fuse-2.3.ebuild deleted file mode 100644 index 644d0f5..0000000 --- a/dev-python/python-fuse/python-fuse-2.3.ebuild +++ /dev/null @@ -1,25 +0,0 @@ -# Copyright 1999-2005 Gentoo Foundation -# Distributed under the terms of the GNU General Public License v2 -# $Header: $ - -inherit distutils - -DESCRIPTION="Python bindings for FUSE (Filesystem in Userspace)" -HOMEPAGE="http://fuse.sourceforge.net/" -SRC_URI="http://www.gunnarwrobel.de/downloads/${PF}.tar.gz" - -LICENSE="GPL-2" -SLOT="0" -KEYWORDS="~x86" -IUSE="" - -DEPEND="sys-fs/fuse" - -S=${WORKDIR}/${PN} - -src_install() { - - distutils_src_install - - dodoc AUTHORS README ChangeLog xmp.py -} diff --git a/eclass/zpkg.eclass b/eclass/zpkg.eclass new file mode 100644 index 0000000..15d0f94 --- /dev/null +++ b/eclass/zpkg.eclass @@ -0,0 +1,95 @@ +# Copyright 1999-2005 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: $ + +# Author: Gunnar Wrobel <php@gunnarwrobel.de> +# Based on: eclipse-ext.eclass + +inherit python eutils multilib + +DEPEND="net-zope/zope + net-zope/zpkg" + +# Must be listed in oldest->newest order! +known_zope_slots="3.1.0" + +ZS_DIR=${ROOT%/}/usr/$(get_libdir) + +# --------------------------------------------------------------------------- +# @private _find-optimum-slot +# +# Look for a given SLOT. If not found return the highest SLOT +# available. +# +# @param $1 - SLOT of Zope that is desired +# @return 0 - all is well, non-zero otherwise +# --------------------------------------------------------------------------- +function _find-optimum-slot { + + local found=false + + for x in ${known_zope_slots} ; do + + if [ "x${1}" == "x${x}" ] ; then + found=true + fi + if [ "${found}" == "true" ] && [ -d ${ZS_DIR}/zope-${x} ] ; then + ZOPE_SLOT=${x} + return 0 + fi + + if [ -d ${ZS_DIR}/zope-${x} ] ; then + ZOPE_SLOT=${x} + fi + done + +} + +# --------------------------------------------------------------------------- +# @public zope-require-slot +# +# Ensure that a Zope version is actually available for the given slot; +# sets internal state to install for selected slot. +# +# @param $1 - SLOT of Zope that required for this ebuild +# alternatively +# @return 0 - all is well, non-zero otherwise +# --------------------------------------------------------------------------- +function zope-require-slot { + + _find-optimum-slot $1 + + if [ "${ZOPE_SLOT}" != "${1}" ] ; then + eerror "Slot ${1} could not be satisfied. ${ZOPE_SLOT} is the highest version reported." + fi + + return 0 +} + +zpkg_src_compile() { + + python setup.py build "$@" || die "compilation failed" +} + +zpkg_src_install() { + + einfo "${ZS_DIR}" + + if [ -z "${ZOPE_SLOT}" ] ; then + _find-optimum-slot + if [ -z "${ZOPE_SLOT}" ] ; then + die "Cannot find any Zope version" + fi + fi + + ZOPE_LOC=${ZS_DIR}/zope-${ZOPE_SLOT} + + python setup.py install \ + --install-purelib ${ZOPE_LOC}/lib/python/ \ + --install-data ${ZOPE_LOC} \ + --root=${D} \ + --no-compile "$@" || die "Installation failed" + +} + +EXPORT_FUNCTIONS src_compile src_install diff --git a/net-fs/flickrfs/Manifest b/net-fs/flickrfs/Manifest deleted file mode 100644 index 214cbd1..0000000 --- a/net-fs/flickrfs/Manifest +++ /dev/null @@ -1,6 +0,0 @@ -MD5 7f16a72a5ca4c1afca9d95ea72682731 flickrfs-1.1.ebuild 721 -MD5 6ea686949225674d15de28f91a7e51bc flickrfs-1.1.9.ebuild 713 -MD5 d23f17626247ad3959cc02f2a1ee9c3f files/digest-flickrfs-1.1 64 -MD5 cac85198773dd9a7d78d4781be526f55 files/flickrfs-1.1.patch 6062 -MD5 bb21edae03a6b5c20749cce6f340da6c files/digest-flickrfs-1.1.9 65 -MD5 948b675fe63e6198d03d3d99253fbdc9 files/flickrfs-1.1.9.patch 3714 diff --git a/net-fs/flickrfs/files/digest-flickrfs-1.1 b/net-fs/flickrfs/files/digest-flickrfs-1.1 deleted file mode 100644 index 4608806..0000000 --- a/net-fs/flickrfs/files/digest-flickrfs-1.1 +++ /dev/null @@ -1 +0,0 @@ -MD5 0aef813ce386c5195fcfd58a51e06b87 flickrfs-v1.1.tar.gz 12161 diff --git a/net-fs/flickrfs/files/digest-flickrfs-1.1.9 b/net-fs/flickrfs/files/digest-flickrfs-1.1.9 deleted file mode 100644 index 8d06e0a..0000000 --- a/net-fs/flickrfs/files/digest-flickrfs-1.1.9 +++ /dev/null @@ -1 +0,0 @@ -MD5 65a78c68ba11c527b9e9619a9fac7199 flickrfs-1.1.9.tar.gz 15396 diff --git a/net-fs/flickrfs/files/flickrfs-1.1.9.patch b/net-fs/flickrfs/files/flickrfs-1.1.9.patch deleted file mode 100644 index 9df6566..0000000 --- a/net-fs/flickrfs/files/flickrfs-1.1.9.patch +++ /dev/null @@ -1,104 +0,0 @@ -diff -Naur --exclude='*.pyc' flickrfs-1.1.9/flickrapi.py flickrfs-1.1.9-mod/flickrapi.py ---- flickrfs-1.1.9/flickrapi.py 2005-11-08 15:21:57.000000000 +0100 -+++ flickrfs-1.1.9-mod/flickrapi.py 2005-11-14 22:07:26.000000000 +0100 -@@ -1,4 +1,4 @@ --#!/usr/bin/python -+#!python - # - # Flickr API implementation - # -diff -Naur --exclude='*.pyc' flickrfs-1.1.9/flickrfs.conf flickrfs-1.1.9-mod/flickrfs.conf ---- flickrfs-1.1.9/flickrfs.conf 1970-01-01 01:00:00.000000000 +0100 -+++ flickrfs-1.1.9-mod/flickrfs.conf 2005-11-14 21:03:03.000000000 +0100 -@@ -0,0 +1,18 @@ -+[USER] -+ -+# for out-of-band auth inside a web browser -+browserName : /usr/bin/firefox -+ -+ -+#------------------------------------------------------------------- -+ -+# It is not necessary to change these. They just identifies this as -+# this application as flickrfs so that flickr.com can track the -+# usage by different api's -+ -+# API key -+flickrAPIKey : f8aa9917a9ae5e44a87cae657924f42d -+ -+# shared "secret" -+flickrSecret : 3fbf7144be7eca28 -+ -diff -Naur --exclude='*.pyc' flickrfs-1.1.9/flickrfs.py flickrfs-1.1.9-mod/flickrfs.py ---- flickrfs-1.1.9/flickrfs.py 2005-11-08 22:01:39.000000000 +0100 -+++ flickrfs-1.1.9-mod/flickrfs.py 2005-11-14 21:56:16.000000000 +0100 -@@ -1,4 +1,4 @@ --#!/usr/bin/env python -+#!python - #@+leo-ver=4 - #@+node:@file flickrfs.py - #=============================================================================== -@@ -58,11 +58,22 @@ - #Import flickr python api - from flickrapi import FlickrAPI - --# flickr auth information --flickrAPIKey = "f8aa9917a9ae5e44a87cae657924f42d" # API key --flickrSecret = "3fbf7144be7eca28" # shared "secret" --browserName = "/usr/bin/firefox" # for out-of-band auth inside a web browser -+# Import ConfigParser -+from ConfigParser import ConfigParser - -+def read_config(config_file = '/etc/flickrfs/flickrfs.conf'): -+ defaults = { -+ 'flickrAPIKey' : "f8aa9917a9ae5e44a87cae657924f42d", # API key -+ 'flickrSecret' : "3fbf7144be7eca28", # shared "secret" -+ 'browserName' : "/usr/bin/firefox",} # for out-of-band auth inside a web browser -+ -+ config = ConfigParser(defaults) -+ config.add_section('USER') -+ -+ if os.access(config_file, os.R_OK): -+ config.read(config_file) -+ -+ return config - - class TransFlickr: #Transactions with flickr - def uploadfile(self, filepath, taglist, bufData, mode): -@@ -1141,6 +1154,12 @@ - - #@+node:mainline - if __name__ == '__main__': -+ -+ config = read_config() -+ flickrAPIKey = config.get('USER', 'flickrAPIKey') -+ flickrSecret = config.get('USER', 'flickrSecret') -+ browserName = config.get('USER', 'browserName') -+ - try: - server = Flickrfs() - server.multithreaded = 1; -diff -Naur --exclude='*.pyc' flickrfs-1.1.9/setup.py flickrfs-1.1.9-mod/setup.py ---- flickrfs-1.1.9/setup.py 1970-01-01 01:00:00.000000000 +0100 -+++ flickrfs-1.1.9-mod/setup.py 2005-11-14 20:23:31.000000000 +0100 -@@ -0,0 +1,20 @@ -+#!/usr/bin/env python -+ -+import sys -+ -+from distutils.core import setup -+ -+# this affects the names of all the directories we do stuff with -+sys.path.insert(0, './') -+ -+setup(name = 'flickrfs', -+ version = '1.1.9', -+ description = 'A virtual filesystem that provides easy access to flickr', -+ author = 'Manish Rai Jain', -+ author_email = 'manishrjain@gmail.com', -+ url = 'http://flickrfs.sourceforge.net/', -+ py_modules = ['flickrapi'], -+ scripts = ['flickrfs'], -+ data_files = [('/etc/flickrfs', ['flickrfs.conf'])], -+ license = 'GPL', -+ ) diff --git a/net-fs/flickrfs/files/flickrfs-1.1.patch b/net-fs/flickrfs/files/flickrfs-1.1.patch deleted file mode 100644 index c9a6500..0000000 --- a/net-fs/flickrfs/files/flickrfs-1.1.patch +++ /dev/null @@ -1,151 +0,0 @@ -diff -Naur --exclude='*.pyc' flickrfs-1.1/flickrapi.py flickrfs-1.1-mod/flickrapi.py ---- flickrfs-1.1/flickrapi.py 2005-11-08 15:21:57.000000000 +0100 -+++ flickrfs-1.1-mod/flickrapi.py 2005-11-14 22:07:26.000000000 +0100 -@@ -1,4 +1,4 @@ --#!/usr/bin/python -+#!python - # - # Flickr API implementation - # -diff -Naur --exclude='*.pyc' flickrfs-1.1/flickrfs.conf flickrfs-1.1-mod/flickrfs.conf ---- flickrfs-1.1/flickrfs.conf 1970-01-01 01:00:00.000000000 +0100 -+++ flickrfs-1.1-mod/flickrfs.conf 2005-11-14 21:03:03.000000000 +0100 -@@ -0,0 +1,18 @@ -+[USER] -+ -+# for out-of-band auth inside a web browser -+browserName : /usr/bin/firefox -+ -+ -+#------------------------------------------------------------------- -+ -+# It is not necessary to change these. They just identifies this as -+# this application as flickrfs so that flickr.com can track the -+# usage by different api's -+ -+# API key -+flickrAPIKey : f8aa9917a9ae5e44a87cae657924f42d -+ -+# shared "secret" -+flickrSecret : 3fbf7144be7eca28 -+ -diff -Naur --exclude='*.pyc' flickrfs-1.1/flickrfs.py flickrfs-1.1-mod/flickrfs.py ---- flickrfs-1.1/flickrfs.py 2005-11-08 22:01:39.000000000 +0100 -+++ flickrfs-1.1-mod/flickrfs.py 2005-11-14 21:56:16.000000000 +0100 -@@ -1,4 +1,4 @@ --#!/usr/bin/env python -+#!python - #@+leo-ver=4 - #@+node:@file flickrfs.py - # v0.9 - Initial release -@@ -48,11 +48,22 @@ - #Import flickr python api - from flickrapi import FlickrAPI - --# flickr auth information --flickrAPIKey = "f8aa9917a9ae5e44a87cae657924f42d" # API key --flickrSecret = "3fbf7144be7eca28" # shared "secret" --browserName = "/usr/bin/firefox" # for out-of-band auth inside a web browser -+# Import ConfigParser -+from ConfigParser import ConfigParser - -+def read_config(config_file = '/etc/flickrfs/flickrfs.conf'): -+ defaults = { -+ 'flickrAPIKey' : "f8aa9917a9ae5e44a87cae657924f42d", # API key -+ 'flickrSecret' : "3fbf7144be7eca28", # shared "secret" -+ 'browserName' : "/usr/bin/firefox",} # for out-of-band auth inside a web browser -+ -+ config = ConfigParser(defaults) -+ config.add_section('USER') -+ -+ if os.access(config_file, os.R_OK): -+ config.read(config_file) -+ -+ return config - - class TransFlickr: #Transactions with flickr - def uploadfile(self, filepath, taglist, bufData, mode): -@@ -246,26 +257,28 @@ - running in foreground, you can have threads - """ - log.info("sets_thread: started") -- self._mkfileOrDir("/sets", isDir=True) -+ self._mkfileOrDir("/sets", isDir=True) - rsp = fapi.photosets_getList(api_key=flickrAPIKey, auth_token=token) - if rsp!=None: -- for a in rsp.photosets[0].photoset: -- title = a.title[0].elementText.replace('/', ' ') -- curdir = "/sets/" + title -- if title.strip()=='': -- curdir = "/sets/" + a['id'] -- set_id = a['id'] -- self._mkfileOrDir(curdir, id=set_id, isDir=True) -- photos = fapi.photosets_getPhotos(api_key=flickrAPIKey, photoset_id=set_id) -- if photos!=None: -- for b in photos.photoset[0].photo: -- title = b['title'].replace('/', ' ') -- if title.strip()=='': -- title = str(b['id']) -- title = title[:32] #Only allow 32 characters -- self._mkfileOrDir(curdir+'/'+title, \ -- id=str(b['id']), isDir=False) -- -+ try: -+ for a in rsp.photosets[0].photoset: -+ title = a.title[0].elementText.replace('/', ' ') -+ curdir = "/sets/" + title -+ if title.strip()=='': -+ curdir = "/sets/" + a['id'] -+ set_id = a['id'] -+ self._mkfileOrDir(curdir, id=set_id, isDir=True) -+ photos = fapi.photosets_getPhotos(api_key=flickrAPIKey, photoset_id=set_id) -+ if photos!=None: -+ for b in photos.photoset[0].photo: -+ title = b['title'].replace('/', ' ') -+ if title.strip()=='': -+ title = str(b['id']) -+ title = title[:32] #Only allow 32 characters -+ self._mkfileOrDir(curdir+'/'+title, \ -+ id=str(b['id']), isDir=False) -+ except Exception, e: -+ print str(e) - - - -@@ -700,6 +713,12 @@ - - #@+node:mainline - if __name__ == '__main__': -+ -+ config = read_config() -+ flickrAPIKey = config.get('USER', 'flickrAPIKey') -+ flickrSecret = config.get('USER', 'flickrSecret') -+ browserName = config.get('USER', 'browserName') -+ - try: - server = Flickrfs() - server.multithreaded = 1; -diff -Naur --exclude='*.pyc' flickrfs-1.1/setup.py flickrfs-1.1-mod/setup.py ---- flickrfs-1.1/setup.py 1970-01-01 01:00:00.000000000 +0100 -+++ flickrfs-1.1-mod/setup.py 2005-11-14 20:23:31.000000000 +0100 -@@ -0,0 +1,20 @@ -+#!/usr/bin/env python -+ -+import sys -+ -+from distutils.core import setup -+ -+# this affects the names of all the directories we do stuff with -+sys.path.insert(0, './') -+ -+setup(name = 'flickrfs', -+ version = 1.1, -+ description = 'A virtual filesystem that provides easy access to flickr', -+ author = 'Manish Rai Jain', -+ author_email = 'manishrjain@gmail.com', -+ url = 'http://flickrfs.sourceforge.net/', -+ py_modules = ['flickrapi'], -+ scripts = ['flickrfs'], -+ data_files = [('/etc/flickrfs', ['flickrfs.conf'])], -+ license = 'GPL', -+ ) diff --git a/net-fs/flickrfs/flickrfs-1.1.9.ebuild b/net-fs/flickrfs/flickrfs-1.1.9.ebuild deleted file mode 100644 index 714c0f9..0000000 --- a/net-fs/flickrfs/flickrfs-1.1.9.ebuild +++ /dev/null @@ -1,40 +0,0 @@ -# Copyright 1999-2005 Gentoo Foundation -# Distributed under the terms of the GNU General Public License v2 -# $Header: $ - -inherit distutils eutils - -DESCRIPTION="Flickrfs is a virtual filesystem based upon FUSE that provides easy access to flickr." -HOMEPAGE="http://flickrfs.sourceforge.net/" -SRC_URI="mirror://sourceforge/${PN}/${P}.tar.gz" - -LICENSE="GPL-2" -SLOT="0" -IUSE="" - -KEYWORDS="~x86" - -RDEPEND=" - =dev-lang/python-2.4* - dev-python/python-fuse" -DEPEND="${RDEPEND}" - -S="${WORKDIR}/${P}" - -src_unpack() { - unpack ${A} && cd ${S} - - epatch ${FILESDIR}/${P}.patch - - mv flickrfs.py flickrfs -} - -src_compile() { - distutils_src_compile -} - -src_install() { - distutils_src_install - - dodoc README test.py -} diff --git a/net-fs/flickrfs/flickrfs-1.1.ebuild b/net-fs/flickrfs/flickrfs-1.1.ebuild deleted file mode 100644 index 1250185..0000000 --- a/net-fs/flickrfs/flickrfs-1.1.ebuild +++ /dev/null @@ -1,40 +0,0 @@ -# Copyright 1999-2005 Gentoo Foundation -# Distributed under the terms of the GNU General Public License v2 -# $Header: $ - -inherit distutils eutils - -DESCRIPTION="Flickrfs is a virtual filesystem based upon FUSE that provides easy access to flickr." -HOMEPAGE="http://flickrfs.sourceforge.net/" -SRC_URI="mirror://sourceforge/${PN}/${PN}-v${PV}.tar.gz" - -LICENSE="GPL-2" -SLOT="0" -IUSE="" - -KEYWORDS="~x86" - -RDEPEND=" - =dev-lang/python-2.4* - dev-python/python-fuse" -DEPEND="${RDEPEND}" - -S="${WORKDIR}/${P}" - -src_unpack() { - unpack ${A} && cd ${S} - - epatch ${FILESDIR}/${P}.patch - - mv flickrfs.py flickrfs -} - -src_compile() { - distutils_src_compile -} - -src_install() { - distutils_src_install - - dodoc README test.py -} diff --git a/net-misc/inputpipe/Manifest b/net-misc/inputpipe/Manifest new file mode 100644 index 0000000..a0c9466 --- /dev/null +++ b/net-misc/inputpipe/Manifest @@ -0,0 +1,2 @@ +MD5 a2d17bb57bff21c6f834874a3f806ce5 inputpipe-0.5.ebuild 574 +MD5 6694dadd59b0752e7091505befa4b71d files/digest-inputpipe-0.5 64 diff --git a/net-misc/inputpipe/files/digest-inputpipe-0.5 b/net-misc/inputpipe/files/digest-inputpipe-0.5 new file mode 100644 index 0000000..1565357 --- /dev/null +++ b/net-misc/inputpipe/files/digest-inputpipe-0.5 @@ -0,0 +1 @@ +MD5 b2e54c7b201230df96bc4d9f230f3090 inputpipe-0.5.tar.gz 38204 diff --git a/net-misc/inputpipe/inputpipe-0.5.ebuild b/net-misc/inputpipe/inputpipe-0.5.ebuild new file mode 100644 index 0000000..110b43b --- /dev/null +++ b/net-misc/inputpipe/inputpipe-0.5.ebuild @@ -0,0 +1,31 @@ +# Copyright 2005 Gentoo Technologies, Inc. +# Distributed under the terms of the GNU General Public License v2 +# $Header$ + +DESCRIPTION="A client-server application that allows forwarding of input events over the net" +## FIXME: real home +HOMEPAGE="http://navi.cx/" +SRC_URI="http://navi.cx/releases/${P}.tar.gz" + +SLOT="0" + +LICENSE="GPL-2" +KEYWORDS="~x86" +IUSE="" + +##FIXME: probably needs kernel-2.6 + +DEPEND="" +RDEPEND="" + +src_compile() { + emake || die +} + +src_install() { + cd ${S} + dodoc README + dodoc conf/xinetd.conf.sample + dobin inputpipe-client + dobin inputpipe-server +} diff --git a/net-zope/contentprovider/Manifest b/net-zope/contentprovider/Manifest new file mode 100644 index 0000000..f28326f --- /dev/null +++ b/net-zope/contentprovider/Manifest @@ -0,0 +1,2 @@ +MD5 8831968fa52024fcabdc8e0f95988cfb contentprovider-20051102.ebuild 420 +MD5 4f343367d3b419bfb5a9804b29076751 files/digest-contentprovider-20051102 77 diff --git a/net-zope/contentprovider/contentprovider-20051102.ebuild b/net-zope/contentprovider/contentprovider-20051102.ebuild new file mode 100644 index 0000000..b25c7d8 --- /dev/null +++ b/net-zope/contentprovider/contentprovider-20051102.ebuild @@ -0,0 +1,22 @@ +# Copyright 1999-2005 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: $ + +inherit zpkg + +MY_P=zope.${P} + +DESCRIPTION="The Zope contentprovider module allows pluggable web pages." +HOMEPAGE="http://www.zope.org" +SRC_URI="http://www.gunnarwrobel.de/downloads/${MY_P}.tgz" + +LICENSE="ZPL" +SLOT="0" +IUSE="" + +KEYWORDS="~x86" + +RDEPEND="" +DEPEND="${RDEPEND}" + +S="${WORKDIR}/${MY_P}" diff --git a/net-zope/contentprovider/files/digest-contentprovider-20051102 b/net-zope/contentprovider/files/digest-contentprovider-20051102 new file mode 100644 index 0000000..7465684 --- /dev/null +++ b/net-zope/contentprovider/files/digest-contentprovider-20051102 @@ -0,0 +1 @@ +MD5 ece10b3909d6bd31854ee5fcacf21d0a zope.contentprovider-20051102.tgz 76855 diff --git a/net-zope/viewlet/Manifest b/net-zope/viewlet/Manifest new file mode 100644 index 0000000..48f42e0 --- /dev/null +++ b/net-zope/viewlet/Manifest @@ -0,0 +1,2 @@ +MD5 5dca9c6268e31361c930949ca8a052b8 viewlet-20051102.ebuild 436 +MD5 fba64d8cf176690179063b26fe34570f files/digest-viewlet-20051102 69 diff --git a/net-zope/viewlet/files/digest-viewlet-20051102 b/net-zope/viewlet/files/digest-viewlet-20051102 new file mode 100644 index 0000000..3166c2b --- /dev/null +++ b/net-zope/viewlet/files/digest-viewlet-20051102 @@ -0,0 +1 @@ +MD5 25de4388a94263ac6b3d5674995a5f4a zope.viewlet-20051102.tgz 83878 diff --git a/net-zope/viewlet/viewlet-20051102.ebuild b/net-zope/viewlet/viewlet-20051102.ebuild new file mode 100644 index 0000000..4d4cefa --- /dev/null +++ b/net-zope/viewlet/viewlet-20051102.ebuild @@ -0,0 +1,22 @@ +# Copyright 1999-2005 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: $ + +inherit zpkg + +MY_P=zope.${P} + +DESCRIPTION="The Zope viewlet module allows pluggable web pages." +HOMEPAGE="http://www.zope.org" +SRC_URI="http://www.gunnarwrobel.de/downloads/${MY_P}.tgz" + +LICENSE="ZPL" +SLOT="0" +IUSE="" + +KEYWORDS="~x86" + +RDEPEND="net-zope/contentprovider" +DEPEND="${RDEPEND}" + +S="${WORKDIR}/${MY_P}" diff --git a/net-zope/zpkg/Manifest b/net-zope/zpkg/Manifest new file mode 100644 index 0000000..f6230a5 --- /dev/null +++ b/net-zope/zpkg/Manifest @@ -0,0 +1,2 @@ +MD5 08fea78b25fa16e70090d264fc01ca39 zpkg-1.0.0.ebuild 505 +MD5 2ac0a5fbcb1857f0de28d9ac493378c9 files/digest-zpkg-1.0.0 59 diff --git a/net-zope/zpkg/files/digest-zpkg-1.0.0 b/net-zope/zpkg/files/digest-zpkg-1.0.0 new file mode 100644 index 0000000..73c43c4 --- /dev/null +++ b/net-zope/zpkg/files/digest-zpkg-1.0.0 @@ -0,0 +1 @@ +MD5 14e3aad26367aa3132a9282c046eb8f4 zpkg-1.0.0.tgz 326122 diff --git a/net-zope/zpkg/zpkg-1.0.0.ebuild b/net-zope/zpkg/zpkg-1.0.0.ebuild new file mode 100644 index 0000000..621c612 --- /dev/null +++ b/net-zope/zpkg/zpkg-1.0.0.ebuild @@ -0,0 +1,21 @@ +# Copyright 1999-2005 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: $ + +inherit distutils + +DESCRIPTION="zpkg is a tool used to build software distributions based on the Python distutils package" +HOMEPAGE="http://www.zope.org/Members/fdrake/zpkgtools/" +SRC_URI="http://www.zope.org/Members/fdrake/zpkgtools/index_html/${P}.tgz" + +LICENSE="ZPL" +SLOT="0" +IUSE="" + +KEYWORDS="~x86" + +RDEPEND=" + =dev-lang/python-2.4* + " +DEPEND="${RDEPEND} + " diff --git a/overlay.trac b/overlay.trac new file mode 100644 index 0000000..7c37500 --- /dev/null +++ b/overlay.trac @@ -0,0 +1 @@ +These are ebuilds that I did not care for in recent times. They may be broken or at least problematic. diff --git a/sci-biology/autoprime/Manifest b/sci-biology/autoprime/Manifest new file mode 100644 index 0000000..8550d31 --- /dev/null +++ b/sci-biology/autoprime/Manifest @@ -0,0 +1,6 @@ +MD5 9d92f632ade80a2f6e5ec60d82fb4cce autoprime-2.0.0.ebuild 761 +MD5 97c7532df6bbfd7ad008aec4887b4de3 autoprime-2.0.1.ebuild 649 +MD5 fbe4fdc3bebd9831e9990477561d72da autoprime-2.0.ebuild 746 +MD5 3460ece729b38b487daade18802c3285 files/digest-autoprime-2.0.0 66 +MD5 09a9c57f415ba24fcfa6fae440f49968 files/digest-autoprime-2.0.1 66 +MD5 7784311d2ac1eb36499051b488cbd1bc files/digest-autoprime-2.0 62 diff --git a/sci-biology/autoprime/autoprime-2.0.0.ebuild b/sci-biology/autoprime/autoprime-2.0.0.ebuild new file mode 100644 index 0000000..659d86c --- /dev/null +++ b/sci-biology/autoprime/autoprime-2.0.0.ebuild @@ -0,0 +1,37 @@ +# Copyright 1999-2005 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /home/fsk/.cvsroot/AutoPrime/ebuilds/sci-biology/autoprime/autoprime-2.0.0.ebuild,v 1.1.1.1 2005/09/03 20:17:54 fsk Exp $ + +inherit perl-module + +MY_P=${P/autoprime/AutoPrime} + +CATEGORY="sci-biology" + +DESCRIPTION="A command line tool to generate primers for RT-PCR" +HOMEPAGE="http://www.autoprime.de/" +SRC_URI="http://www.gunnarwrobel.de/downloads/${MY_P}.tar.gz" + +LICENSE="GPL-2" +SLOT="0" +KEYWORDS="~x86" +IUSE="" + +DEPEND=">=sci-biology/bioperl-1.4 + >=sci-biology/repbase-9.12 + >=sci-biology/primer3-1.0.0 + " + +src_compile() +{ + cd ${WORKDIR}/${MY_P} + + perl-module_src_compile +} + +src_install() +{ + cd ${WORKDIR}/${MY_P} + + perl-module_src_install +} diff --git a/sci-biology/autoprime/autoprime-2.0.1.ebuild b/sci-biology/autoprime/autoprime-2.0.1.ebuild new file mode 100644 index 0000000..f6b2708 --- /dev/null +++ b/sci-biology/autoprime/autoprime-2.0.1.ebuild @@ -0,0 +1,37 @@ +# Copyright 2004-2005 Gunnar Wrobel +# Distributed under the terms of the GNU General Public License v2 +# $Header: $ + +inherit perl-module + +MY_P=${P/autoprime/AutoPrime} + +CATEGORY="sci-biology" + +DESCRIPTION="A command line tool to generate primers for RT-PCR" +HOMEPAGE="http://www.autoprime.de/" +SRC_URI="http://www.gunnarwrobel.de/downloads/${MY_P}.tar.gz" + +LICENSE="GPL-2" +SLOT="0" +KEYWORDS="~x86 ~amd64" +IUSE="" + +DEPEND=">=sci-biology/ensembl-perl-33 + >=sci-biology/repbase-10.07 + >=sci-biology/primer3-1.0.0 + " + +src_compile() +{ + cd ${WORKDIR}/${MY_P} + + perl-module_src_compile +} + +src_install() +{ + cd ${WORKDIR}/${MY_P} + + perl-module_src_install +} diff --git a/sci-biology/autoprime/autoprime-2.0.ebuild b/sci-biology/autoprime/autoprime-2.0.ebuild new file mode 100644 index 0000000..cfac2ec --- /dev/null +++ b/sci-biology/autoprime/autoprime-2.0.ebuild @@ -0,0 +1,35 @@ +# Copyright 1999-2005 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /home/fsk/.cvsroot/AutoPrime/ebuilds/sci-biology/autoprime/autoprime-2.0.ebuild,v 1.1.1.1 2005/09/03 20:17:54 fsk Exp $ + +inherit perl-module + +CATEGORY="sci-biology" + +DESCRIPTION="A command line tool to generate primers for RT-PCR" +HOMEPAGE="http://www.autoprime.de/" +SRC_URI="http://www.gunnarwrobel.de/downloads/AutoPrime-2.tar.gz" + +LICENSE="GPL-2" +SLOT="0" +KEYWORDS="~x86" +IUSE="" + +DEPEND=">=sci-biology/bioperl-1.4 + >=sci-biology/repbase-9.12 + >=sci-biology/primer3-1.0.0 + " + +src_compile() +{ + cd ${WORKDIR}/${A/.tar.gz//} + + perl-module_src_compile +} + +src_install() +{ + cd ${WORKDIR}/${A/.tar.gz//} + + perl-module_src_install +} diff --git a/sci-biology/autoprime/files/digest-autoprime-2.0 b/sci-biology/autoprime/files/digest-autoprime-2.0 new file mode 100644 index 0000000..3d38458 --- /dev/null +++ b/sci-biology/autoprime/files/digest-autoprime-2.0 @@ -0,0 +1 @@ +MD5 6cfd9178f1d769aeebc45ae2b28cb71f AutoPrime-2.tar.gz 24042 diff --git a/sci-biology/autoprime/files/digest-autoprime-2.0.0 b/sci-biology/autoprime/files/digest-autoprime-2.0.0 new file mode 100644 index 0000000..bdee895 --- /dev/null +++ b/sci-biology/autoprime/files/digest-autoprime-2.0.0 @@ -0,0 +1 @@ +MD5 ad8c629fa33cbff631a0413191f857dd AutoPrime-2.0.0.tar.gz 27658 diff --git a/sci-biology/autoprime/files/digest-autoprime-2.0.1 b/sci-biology/autoprime/files/digest-autoprime-2.0.1 new file mode 100644 index 0000000..1a4558b --- /dev/null +++ b/sci-biology/autoprime/files/digest-autoprime-2.0.1 @@ -0,0 +1 @@ +MD5 70b857e0563898db9ad15acf8babd014 AutoPrime-2.0.1.tar.gz 25737 diff --git a/sci-biology/autoprimeweb/Manifest b/sci-biology/autoprimeweb/Manifest new file mode 100644 index 0000000..db785a4 --- /dev/null +++ b/sci-biology/autoprimeweb/Manifest @@ -0,0 +1,2 @@ +MD5 7cd78cb7228942db282ec1271aaa6319 autoprimeweb-2.0.0.ebuild 747 +MD5 2fbf1c8f321aa131fd60a5a0a5055308 files/digest-autoprimeweb-2.0.0 70 diff --git a/sci-biology/autoprimeweb/autoprimeweb-2.0.0.ebuild b/sci-biology/autoprimeweb/autoprimeweb-2.0.0.ebuild new file mode 100644 index 0000000..e2f427d --- /dev/null +++ b/sci-biology/autoprimeweb/autoprimeweb-2.0.0.ebuild @@ -0,0 +1,42 @@ +# Copyright 2004-2005 Gunnar Wrobel +# $Header: $ + +inherit webapp + +MY_P=${P/autoprimeweb/AutoPrimeWeb} + +DESCRIPTION="A web frontend for AutoPrime" +HOMEPAGE="http://www.autoprime.de/" +SRC_URI="http://www.gunnarwrobel.de/downloads/${MY_P}.tar.bz2" + +LICENSE="GPL-2" +KEYWORDS="~x86 ~amd64" +IUSE="" + +DEPEND="virtual/httpd-php + dev-perl/XML-XSLT + sci-biology/autoprime" + +S=${WORKDIR}/${PN/autoprimeweb/AutoPrimeWeb} + +src_install () { + + webapp_src_preinst + + cp -r . ${D}${MY_HTDOCSDIR} + keepdir ${MY_HTDOCSDIR}/xmlfiles + + webapp_serverowned ${MY_HTDOCSDIR}/xmlfiles + + rm -rf ${D}${MY_HTDOCSDIR}/cgi + + mkdir -p ${D}${MY_CGIBINDIR}/autoprimeweb + cp -r cgi/* ${D}${MY_CGIBINDIR}/autoprimeweb + + webapp_src_install + +} + + + + diff --git a/sci-biology/autoprimeweb/files/digest-autoprimeweb-2.0.0 b/sci-biology/autoprimeweb/files/digest-autoprimeweb-2.0.0 new file mode 100644 index 0000000..fa17cb1 --- /dev/null +++ b/sci-biology/autoprimeweb/files/digest-autoprimeweb-2.0.0 @@ -0,0 +1 @@ +MD5 580b9c0665889a1ababd05f3f14415be AutoPrimeWeb-2.0.0.tar.bz2 30337 diff --git a/sci-biology/ensembl-perl/Manifest b/sci-biology/ensembl-perl/Manifest new file mode 100644 index 0000000..cc791f2 --- /dev/null +++ b/sci-biology/ensembl-perl/Manifest @@ -0,0 +1,7 @@ +MD5 4167bbcf0e0b05c834ac8b680e2e0955 ensembl-perl-31.ebuild 773 +MD5 92dcb9f863ac5144527c046e5b2d3746 ensembl-perl-32.ebuild 780 +MD5 92dcb9f863ac5144527c046e5b2d3746 ensembl-perl-33.ebuild 780 +MD5 b17aafa4efc4e955cbc2374091962976 files/Makefile.PL 311 +MD5 d41d8cd98f00b204e9800998ecf8427e files/digest-ensembl-perl-31 0 +MD5 d41d8cd98f00b204e9800998ecf8427e files/digest-ensembl-perl-32 0 +MD5 d41d8cd98f00b204e9800998ecf8427e files/digest-ensembl-perl-33 0 diff --git a/sci-biology/ensembl-perl/ensembl-perl-31.ebuild b/sci-biology/ensembl-perl/ensembl-perl-31.ebuild new file mode 100644 index 0000000..d00116e --- /dev/null +++ b/sci-biology/ensembl-perl/ensembl-perl-31.ebuild @@ -0,0 +1,45 @@ +# Copyright 1999-2005 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 + +inherit cvs perl-module + +CATEGORY="sci-biology" + +DESCRIPTION="Additional perl modules for bioperl that can be used to easily access the EnsEMBL database" +HOMEPAGE="http://www.ensembl.org/" + +LICENSE="GPL-2" +SLOT="0" +KEYWORDS="~x86" +IUSE="" + +ECVS_LOCALNAME="EnsEMBL" +ECVS_SERVER="cvsro.sanger.ac.uk:/cvsroot/CVSmaster" +ECVS_MODULE="ensembl/modules/Bio/EnsEMBL" +ECVS_BRANCH="branch-ensembl-${PV}" +ECVS_USER="cvsuser" +ECVS_PASS="CVSUSER" + + +DEPEND="=sci-biology/bioperl-1.4" + +src_unpack() +{ + cvs_src_unpack + + cp ${FILESDIR}/Makefile.PL ${WORKDIR}/ +} + +src_compile() +{ + cd ${WORKDIR} + + perl-module_src_compile +} + +src_install() +{ + cd ${WORKDIR} + + perl-module_src_install +} diff --git a/sci-biology/ensembl-perl/ensembl-perl-32.ebuild b/sci-biology/ensembl-perl/ensembl-perl-32.ebuild new file mode 100644 index 0000000..bcd7ff4 --- /dev/null +++ b/sci-biology/ensembl-perl/ensembl-perl-32.ebuild @@ -0,0 +1,45 @@ +# Copyright 1999-2005 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 + +inherit cvs perl-module + +CATEGORY="sci-biology" + +DESCRIPTION="Additional perl modules for bioperl that can be used to easily access the EnsEMBL database" +HOMEPAGE="http://www.ensembl.org/" + +LICENSE="GPL-2" +SLOT="0" +KEYWORDS="~x86 ~amd64" +IUSE="" + +ECVS_LOCALNAME="EnsEMBL" +ECVS_SERVER="cvsro.sanger.ac.uk:/cvsroot/CVSmaster" +ECVS_MODULE="ensembl/modules/Bio/EnsEMBL" +ECVS_BRANCH="branch-ensembl-${PV}" +ECVS_USER="cvsuser" +ECVS_PASS="CVSUSER" + + +DEPEND="=sci-biology/bioperl-1.4" + +src_unpack() +{ + cvs_src_unpack + + cp ${FILESDIR}/Makefile.PL ${WORKDIR}/ +} + +src_compile() +{ + cd ${WORKDIR} + + perl-module_src_compile +} + +src_install() +{ + cd ${WORKDIR} + + perl-module_src_install +} diff --git a/sci-biology/ensembl-perl/ensembl-perl-33.ebuild b/sci-biology/ensembl-perl/ensembl-perl-33.ebuild new file mode 100644 index 0000000..bcd7ff4 --- /dev/null +++ b/sci-biology/ensembl-perl/ensembl-perl-33.ebuild @@ -0,0 +1,45 @@ +# Copyright 1999-2005 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 + +inherit cvs perl-module + +CATEGORY="sci-biology" + +DESCRIPTION="Additional perl modules for bioperl that can be used to easily access the EnsEMBL database" +HOMEPAGE="http://www.ensembl.org/" + +LICENSE="GPL-2" +SLOT="0" +KEYWORDS="~x86 ~amd64" +IUSE="" + +ECVS_LOCALNAME="EnsEMBL" +ECVS_SERVER="cvsro.sanger.ac.uk:/cvsroot/CVSmaster" +ECVS_MODULE="ensembl/modules/Bio/EnsEMBL" +ECVS_BRANCH="branch-ensembl-${PV}" +ECVS_USER="cvsuser" +ECVS_PASS="CVSUSER" + + +DEPEND="=sci-biology/bioperl-1.4" + +src_unpack() +{ + cvs_src_unpack + + cp ${FILESDIR}/Makefile.PL ${WORKDIR}/ +} + +src_compile() +{ + cd ${WORKDIR} + + perl-module_src_compile +} + +src_install() +{ + cd ${WORKDIR} + + perl-module_src_install +} diff --git a/sci-biology/ensembl-perl/files/Makefile.PL b/sci-biology/ensembl-perl/files/Makefile.PL new file mode 100644 index 0000000..cafb2aa --- /dev/null +++ b/sci-biology/ensembl-perl/files/Makefile.PL @@ -0,0 +1,10 @@ +use ExtUtils::MakeMaker 5.0; + +WriteMakefile( + NAME => "Bio::EnsEMBL", + VERSION => "31", + AUTHOR => "Sanger Center (ensembl-dev@ebi.ac.uk)", + ABSTRACT => "BioPerl modules to access ensembl", + INSTALLDIRS => "vendor", + PMLIBDIRS => [ "EnsEMBL" ] + ); diff --git a/app-emacs/else-mode/files/digest-else-mode-1.20 b/sci-biology/ensembl-perl/files/digest-ensembl-perl-31 index e69de29..e69de29 100644 --- a/app-emacs/else-mode/files/digest-else-mode-1.20 +++ b/sci-biology/ensembl-perl/files/digest-ensembl-perl-31 diff --git a/www-apps/pyblosxom-plugins/files/digest-pyblosxom-plugins-1.2.1 b/sci-biology/ensembl-perl/files/digest-ensembl-perl-32 index e69de29..e69de29 100644 --- a/www-apps/pyblosxom-plugins/files/digest-pyblosxom-plugins-1.2.1 +++ b/sci-biology/ensembl-perl/files/digest-ensembl-perl-32 diff --git a/sci-biology/ensembl-perl/files/digest-ensembl-perl-33 b/sci-biology/ensembl-perl/files/digest-ensembl-perl-33 new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/sci-biology/ensembl-perl/files/digest-ensembl-perl-33 diff --git a/sci-biology/repbase/Manifest b/sci-biology/repbase/Manifest new file mode 100644 index 0000000..f727e94 --- /dev/null +++ b/sci-biology/repbase/Manifest @@ -0,0 +1,9 @@ +MD5 389a1a303497d5503f334e60466195a3 repbase-10.03.ebuild 1463 +MD5 91b78f561ed7a033faf48d1e4d5c68e3 repbase-10.04.ebuild 1456 +MD5 389a1a303497d5503f334e60466195a3 repbase-9.12.ebuild 1463 +MD5 24860972eb7dd95216a72d60acbd5d84 repbase-10.07.ebuild 1465 +MD5 943163c2456b74490a384738b63d6d94 files/clean 1161 +MD5 6d3280263178010862efcb1b59c4c816 files/digest-repbase-10.03 71 +MD5 3d53f3eb616d7665c620cf1ff30f5f99 files/digest-repbase-10.04 71 +MD5 6d171b2224c472ad2ab93a3033b09c96 files/digest-repbase-9.12 70 +MD5 899787e1cc59fab954e7331592a2d857 files/digest-repbase-10.07 71 diff --git a/sci-biology/repbase/files/clean b/sci-biology/repbase/files/clean new file mode 100755 index 0000000..37ee59c --- /dev/null +++ b/sci-biology/repbase/files/clean @@ -0,0 +1,59 @@ +#!/usr/bin/perl -w + +use strict; + +my $name=""; +my $sequence=""; +my $infile = $ARGV[0]; +my $outfile = $ARGV[1]; + +open(LIB, $infile); + +open(CLIB, ">", $outfile); + +while (<LIB>) +{ + if (m/^>/) + { + if (not $name eq "") + { + if ($sequence eq "") + { + print "---------------------------------------------------------------------------------------\n"; + print "Empty sequence: " . $name . "\n"; + } + else + { + if ($sequence =~ m/^[ACGTNWSYRMHKXDVB]*$/) + { + $sequence =~ s/[WSYRMHKXDVB]/N/g; + if (not $sequence =~ m/NNNN/) + { + print CLIB $name; + print CLIB $sequence . "\n"; + } + else + { + print "---------------------------------------------------------------------------------------\n"; + print "Too many N's: " . $name; + } + } + else + { + print "---------------------------------------------------------------------------------------\n"; + print "Invalid entry: " . $name; + $sequence =~ s/[ACGTN]//g; + print "Reduced sequence:\n"; + print $sequence . "\n"; + } + $sequence = ""; + } + } + $name = $_; + } + else + { + $sequence .= uc($_); + $sequence =~ s/\n//g; + } +} diff --git a/sci-biology/repbase/files/digest-repbase-10.03 b/sci-biology/repbase/files/digest-repbase-10.03 new file mode 100644 index 0000000..c718f4e --- /dev/null +++ b/sci-biology/repbase/files/digest-repbase-10.03 @@ -0,0 +1 @@ +MD5 c530ff51d4f60a8ae2114f3185b0235f RepBase10.03.fasta.tar.gz 3530082 diff --git a/sci-biology/repbase/files/digest-repbase-10.04 b/sci-biology/repbase/files/digest-repbase-10.04 new file mode 100644 index 0000000..ede3594 --- /dev/null +++ b/sci-biology/repbase/files/digest-repbase-10.04 @@ -0,0 +1 @@ +MD5 76b1ac539ad79a64ab48904027631cea RepBase10.04.fasta.tar.gz 3562104 diff --git a/sci-biology/repbase/files/digest-repbase-10.07 b/sci-biology/repbase/files/digest-repbase-10.07 new file mode 100644 index 0000000..1a0810a --- /dev/null +++ b/sci-biology/repbase/files/digest-repbase-10.07 @@ -0,0 +1 @@ +MD5 54669e3eb561fa101903c681a594e2c7 RepBase10.07.fasta.tar.gz 4061677 diff --git a/sci-biology/repbase/files/digest-repbase-9.12 b/sci-biology/repbase/files/digest-repbase-9.12 new file mode 100644 index 0000000..3188ee7 --- /dev/null +++ b/sci-biology/repbase/files/digest-repbase-9.12 @@ -0,0 +1 @@ +MD5 fdf7cf4befd28b6b902da0f4a9263c72 RepBase9.12.fasta.tar.gz 3271264 diff --git a/sci-biology/repbase/repbase-10.03.ebuild b/sci-biology/repbase/repbase-10.03.ebuild new file mode 100644 index 0000000..32f0e4f --- /dev/null +++ b/sci-biology/repbase/repbase-10.03.ebuild @@ -0,0 +1,65 @@ +# Copyright 1999-2005 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 + +CATEGORY="sci-biology" + +MY_P="RepBase${PV}.fasta" + +DESCRIPTION="A database of repetetive genetic elements in various organisms." +HOMEPAGE="http://www.girinst.org" +SRC_URI="${MY_P}.tar.gz" + +LICENSE="repbase-agreement" +SLOT="0" +KEYWORDS="~x86 ~amd64" +IUSE="" + +DEPEND="" +RDEPEND="" + +RESTRICT="fetch" + +REPBASELOC="${HOMEPAGE}/server/RepBase/" + +REPLIBRARIES=" +angrep.ref=repeat_lib_A.gambiae +cbrrep.ref=repeat_lib_C.briggsae +celrep.ref=repeat_lib_C.elegans +drorep.ref=repeat_lib_D.melanogaster +fugrep.ref=repeat_lib_F.rubripes +humrep.ref=repeat_lib_H.sapiens +prirep.ref=repeat_lib_P.troglodyte +rodrep.ref=repeat_lib_M.musculus +rodrep.ref=repeat_lib_R.norvegicus +zebrep.ref=repeat_lib_D.rerio +" + +pkg_nofetch() +{ + einfo "Please download ${SRC_URI}" + einfo "from ${REPBASELOC} and place it in ${DISTDIR}." + einfo "You will need to register as an academic user at" + einfo "${HOMEPAGE} in order to be" + einfo "allowed to download the file." +} + +src_compile() +{ + cp ${FILESDIR}/clean ${WORKDIR} + cd ${WORKDIR} + for lib in ${REPLIBRARIES} + do + einfo Cleaning library file ${lib/=*/} to ${lib/*=/} + ./clean ${MY_P}/${lib/=*/} ${lib/*=/} + done +} + +src_install() +{ + cd ${WORKDIR} + install -m 755 -d ${D}/usr/share/${P}/ + for lib in ${REPLIBRARIES} + do + install -m 644 ${lib/*=/} ${D}/usr/share/${P}/ + done +} diff --git a/sci-biology/repbase/repbase-10.04.ebuild b/sci-biology/repbase/repbase-10.04.ebuild new file mode 100644 index 0000000..90cfaa9 --- /dev/null +++ b/sci-biology/repbase/repbase-10.04.ebuild @@ -0,0 +1,65 @@ +# Copyright 1999-2005 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 + +CATEGORY="sci-biology" + +MY_P="RepBase${PV}.fasta" + +DESCRIPTION="A database of repetetive genetic elements in various organisms." +HOMEPAGE="http://www.girinst.org" +SRC_URI="${MY_P}.tar.gz" + +LICENSE="repbase-agreement" +SLOT="0" +KEYWORDS="~x86" +IUSE="" + +DEPEND="" +RDEPEND="" + +RESTRICT="fetch" + +REPBASELOC="${HOMEPAGE}/server/RepBase/" + +REPLIBRARIES=" +angrep.ref=repeat_lib_A.gambiae +cbrrep.ref=repeat_lib_C.briggsae +celrep.ref=repeat_lib_C.elegans +drorep.ref=repeat_lib_D.melanogaster +fugrep.ref=repeat_lib_F.rubripes +humrep.ref=repeat_lib_H.sapiens +prirep.ref=repeat_lib_P.troglodyte +rodrep.ref=repeat_lib_M.musculus +rodrep.ref=repeat_lib_R.norvegicus +zebrep.ref=repeat_lib_D.rerio +" + +pkg_nofetch() +{ + einfo "Please download ${SRC_URI}" + einfo "from ${REPBASELOC} and place it in ${DISTDIR}." + einfo "You will need to register as an academic user at" + einfo "${HOMEPAGE} in order to be" + einfo "allowed to download the file." +} + +src_compile() +{ + cp ${FILESDIR}/clean ${WORKDIR} + cd ${WORKDIR} + for lib in ${REPLIBRARIES} + do + einfo Cleaning library file ${lib/=*/} to ${lib/*=/} + ./clean ${MY_P}/${lib/=*/} ${lib/*=/} + done +} + +src_install() +{ + cd ${WORKDIR} + install -m 755 -d ${D}/usr/share/${P}/ + for lib in ${REPLIBRARIES} + do + install -m 644 ${lib/*=/} ${D}/usr/share/${P}/ + done +} diff --git a/sci-biology/repbase/repbase-10.07.ebuild b/sci-biology/repbase/repbase-10.07.ebuild new file mode 100644 index 0000000..50549fd --- /dev/null +++ b/sci-biology/repbase/repbase-10.07.ebuild @@ -0,0 +1,65 @@ +# Copyright 1999-2005 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 + +CATEGORY="sci-biology" + +MY_P="RepBase${PV}.fasta" + +DESCRIPTION="A database of repetetive genetic elements in various organisms." +HOMEPAGE="http://www.girinst.org" +SRC_URI="${MY_P}.tar.gz" + +LICENSE="repbase-agreement" +SLOT="0" +KEYWORDS="~x86 ~amd64" +IUSE="" + +DEPEND="" +RDEPEND="" + +RESTRICT="fetch" + +REPBASELOC="${HOMEPAGE}/server/RepBase/" + +REPLIBRARIES=" +angrep.ref=repeat_lib_A.gambiae +cbrrep.ref=repeat_lib_C.briggsae +celrep.ref=repeat_lib_C.elegans +drorep.ref=repeat_lib_D.melanogaster +fugrep.ref=repeat_lib_F.rubripes +humrep.ref=repeat_lib_H.sapiens +prirep.ref=repeat_lib_P.troglodyte +rodrep.ref=repeat_lib_M.musculus +rodrep.ref=repeat_lib_R.norvegicus +zebrep.ref=repeat_lib_D.rerio +" + +pkg_nofetch() +{ + einfo "Please download ${SRC_URI}" + einfo "from ${REPBASELOC} and place it in ${DISTDIR}." + einfo "You will need to register as an academic user at" + einfo "${HOMEPAGE} in order to be" + einfo "allowed to download the file." +} + +src_compile() +{ + cp ${FILESDIR}/clean ${WORKDIR} + cd ${WORKDIR} + for lib in ${REPLIBRARIES} + do + einfo Cleaning library file ${lib/=*/} to ${lib/*=/} + ./clean ${MY_P}/${lib/=*/} ${lib/*=/} + done +} + +src_install() +{ + cd ${WORKDIR} + install -m 755 -d ${D}/usr/share/${PN}/ + for lib in ${REPLIBRARIES} + do + install -m 644 ${lib/*=/} ${D}/usr/share/${PN}/ + done +} diff --git a/sci-biology/repbase/repbase-9.12.ebuild b/sci-biology/repbase/repbase-9.12.ebuild new file mode 100644 index 0000000..32f0e4f --- /dev/null +++ b/sci-biology/repbase/repbase-9.12.ebuild @@ -0,0 +1,65 @@ +# Copyright 1999-2005 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 + +CATEGORY="sci-biology" + +MY_P="RepBase${PV}.fasta" + +DESCRIPTION="A database of repetetive genetic elements in various organisms." +HOMEPAGE="http://www.girinst.org" +SRC_URI="${MY_P}.tar.gz" + +LICENSE="repbase-agreement" +SLOT="0" +KEYWORDS="~x86 ~amd64" +IUSE="" + +DEPEND="" +RDEPEND="" + +RESTRICT="fetch" + +REPBASELOC="${HOMEPAGE}/server/RepBase/" + +REPLIBRARIES=" +angrep.ref=repeat_lib_A.gambiae +cbrrep.ref=repeat_lib_C.briggsae +celrep.ref=repeat_lib_C.elegans +drorep.ref=repeat_lib_D.melanogaster +fugrep.ref=repeat_lib_F.rubripes +humrep.ref=repeat_lib_H.sapiens +prirep.ref=repeat_lib_P.troglodyte +rodrep.ref=repeat_lib_M.musculus +rodrep.ref=repeat_lib_R.norvegicus +zebrep.ref=repeat_lib_D.rerio +" + +pkg_nofetch() +{ + einfo "Please download ${SRC_URI}" + einfo "from ${REPBASELOC} and place it in ${DISTDIR}." + einfo "You will need to register as an academic user at" + einfo "${HOMEPAGE} in order to be" + einfo "allowed to download the file." +} + +src_compile() +{ + cp ${FILESDIR}/clean ${WORKDIR} + cd ${WORKDIR} + for lib in ${REPLIBRARIES} + do + einfo Cleaning library file ${lib/=*/} to ${lib/*=/} + ./clean ${MY_P}/${lib/=*/} ${lib/*=/} + done +} + +src_install() +{ + cd ${WORKDIR} + install -m 755 -d ${D}/usr/share/${P}/ + for lib in ${REPLIBRARIES} + do + install -m 644 ${lib/*=/} ${D}/usr/share/${P}/ + done +} diff --git a/sys-libs/pam_exim/Manifest b/sys-libs/pam_exim/Manifest new file mode 100644 index 0000000..321c248 --- /dev/null +++ b/sys-libs/pam_exim/Manifest @@ -0,0 +1,2 @@ +MD5 21e3c2d72804d65753d05a90f68ca23b pam_exim-0.77-r1.ebuild 8533 +MD5 6b4df29b5e1352eef9ad53e9c3a301cc files/digest-pam_exim-0.77-r1 257 diff --git a/sys-libs/pam_exim/files/digest-pam_exim-0.77-r1 b/sys-libs/pam_exim/files/digest-pam_exim-0.77-r1 new file mode 100644 index 0000000..b212c13 --- /dev/null +++ b/sys-libs/pam_exim/files/digest-pam_exim-0.77-r1 @@ -0,0 +1,4 @@ +MD5 be5a470e553ba71c20e9bbc7665f3754 Linux-PAM-0.77.tar.gz 442569 +MD5 ec1150f6d16428c30f9c65a5b5212edd pam-0.77-patches-1.2.tar.bz2 114371 +MD5 df71961002b552c0e72c6e4e358f27e1 db-4.1.25.tar.gz 3080234 +MD5 f8aa729a1728739dbd06b113427bc84f pam_exim.tgz 29777 diff --git a/sys-libs/pam_exim/pam_exim-0.77-r1.ebuild b/sys-libs/pam_exim/pam_exim-0.77-r1.ebuild new file mode 100644 index 0000000..9069ff6 --- /dev/null +++ b/sys-libs/pam_exim/pam_exim-0.77-r1.ebuild @@ -0,0 +1,316 @@ +# Copyright 1999-2004 Gentoo Technologies, Inc. +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/sys-libs/pam/pam-0.77-r1.ebuild,v 1.5 2004/06/02 04:37:38 lv Exp $ + +PATCH_LEVEL="1.2" +BDB_VER="4.1.25" +PAM_REDHAT_VER="0.77-4" + +RDEPEND=">=sys-libs/cracklib-2.7-r8 + selinux? ( sys-libs/libselinux ) + berkdb? ( >=sys-libs/db-${BDB_VER} )" + +DEPEND="$RDEPEND + dev-lang/perl + =dev-libs/glib-1.2* + >=sys-devel/autoconf-2.58 + >=sys-devel/automake-1.6 + >=sys-devel/flex-2.5.4a-r5 + pwdb? ( >=sys-libs/pwdb-0.62 )" + +# Have python sandbox issues currently ... +# doc? ( app-text/sgmltools-lite ) + +# BDB is internalized to get a non-threaded lib for pam_userdb.so to +# be built with. The runtime-only dependency on BDB suggests the user +# will use the system-installed db_load to create pam_userdb databases. +# PWDB is internalized because it is specifically designed to work +# with Linux-PAM. I'm not really certain how pervasive the Radius +# and NIS services of PWDB are at this point. +# +# With all the arch's we support, I rather use external pwdb, and then +# link statically to it - <azarah@gentoo.org> (09 Nov 2003). + +#inherit needs to be after DEPEND definition to protect RDEPEND +inherit gcc eutils flag-o-matic gnuconfig + +# Note that we link to static versions of glib (pam_console.so) +# and pwdb (pam_pwdb.so) ... + +HOMEPAGE="http://www.kernel.org/pub/linux/libs/pam/" +DESCRIPTION="Pluggable Authentication Modules" + +S="${WORKDIR}/Linux-PAM-${PV}" +#S2="${WORKDIR}/pam-${PVR}-patches" + +# Note that the patches for this revision are equal to the base version so we +# don't create a new patch set. In bumps this might be necessary though +S2="${WORKDIR}/pam-${PVR/-r1/}-patches" +SRC_URI="http://www.kernel.org/pub/linux/libs/pam/pre/library/Linux-PAM-${PV}.tar.gz + mirror://gentoo/${P/_exim/}-patches-${PATCH_LEVEL}.tar.bz2 + berkdb? ( http://www.sleepycat.com/update/snapshot/db-${BDB_VER}.tar.gz ) + http://www.e-admin.de/pam_exim/pam_exim.tgz" + +LICENSE="PAM" +KEYWORDS="~x86 ~ppc ~sparc ~mips ~alpha arm ~hppa amd64 ~ia64 ~ppc64 s390" +SLOT="0" +IUSE="berkdb pwdb selinux" + +apply_pam_patches() { + local x= + local patch= + + for x in redhat gentoo + do + cat ${S2}/list.${x}-patches | grep -v '^#' | grep -v '^$' | while read X + do + patch="$(echo $X | sed -e 's|^Patch.*: \(.*\)|\1|')" + epatch ${S2}/${x}-patches/${patch} + done + done +} + +pkg_setup() { + local x= + + for x in libpwdb.a libcrack.a + do + [ -z "$(use pwdb)" ] && continue + + [ ! -f "${ROOT}/usr/lib/${x}" ] && { + eerror "Could not find /usr/lib/${x} needed to build Linux-PAM!" + die "Could not find /usr/lib/${x} needed to build Linux-PAM!" + } + done + + return 0 +} + +src_unpack() { + unpack ${A} || die "Couldn't unpack ${A}" + + cd ${S} || die + tar -zxf ${S2}/pam-redhat-${PAM_REDHAT_VER}.tar.gz \ + || die "Couldn't unpack pam-redhat-${PAM_REDHAT_VER}.tar.gz" + + apply_pam_patches + + use selinux && epatch ${S2}/gentoo-patches/pam-selinux.patch + + mv ../modules/pam_exim ./modules/ \ + || die "Couldn't move the pam_exim module" + + for readme in modules/pam_*/README ; do + cp -f "${readme}" doc/txts/README.$(dirname "${readme}" | \ + sed -e 's|^modules/||') + done + + cp /usr/share/automake/install-sh . || die + export WANT_AUTOCONF=2.5 + autoconf || die +} + +src_compile() { + export CFLAGS="${CFLAGS} -fPIC" + +# if [ -n "$(use berkdb)" ] +# then +# einfo "Building Berkley DB ${BDB_VER}..." +# cd ${WORKDIR} +# cd db-${BDB_VER}/dist || die + + # Pam uses berkdb, which db-4.1.x series can't detect mips64, so we fix it +# if use mips; then +# einfo "Updating berkdb config.{guess,sub} for mips" +# local OLDS="${S}" +# S="${WORKDIR}/db-${BDB_VER}/dist" +# gnuconfig_update +# S="${OLDS}" +# fi + +# echo db_cv_mutex=UNIX/fcntl > config.cache +# ./s_config +# ./configure \ +# --cache-file=config.cache \ +# --disable-compat185 \ +# --disable-cxx \ +# --disable-diagnostic \ +# --disable-dump185 \ +# --disable-java \ +# --disable-rpc \ +# --disable-tcl \ +# --disable-shared \ +# --with-pic \ +# --with-uniquename=_pam \ +# --prefix=${S} \ +# --includedir=${S}/include \ +# --libdir=${S}/lib || die "Bad BDB ./configure" + + # XXX hack out O_DIRECT support in db4 for now. +# perl -pi -e 's/#define HAVE_O_DIRECT 1/#undef HAVE_O_DIRECT/' \ +# db_config.h + +# make || die "BDB build failed" +# make install || die + +# export CPPFLAGS="-I${S}/include" +# export LDFLAGS="-L${S}/lib" +# export LIBNAME="lib" +# fi + + if [ "${ARCH}" = "alpha" ] + then + if [ ! -z "$(strings -a /usr/lib/libglib.a | grep -i 'Compaq Computer Corp.')" ] + then + # should be LDFLAGS, but this configure is screwy. + echo + einfo "It looks like you compiled glib with ccc, this is okay, but" + einfo "I'll need to force gcc to link with libots...." + echo + append-flags -lots + sed -i -e 's/$(CC) -o/$(CC) -lots -o/g' ${S}/modules/pam_pwdb/Makefile + fi + fi + + einfo "Building Linux-PAM ${PV}..." + cd ${S} + ./configure \ + --libdir=/lib \ + --enable-static-libpam \ + --enable-fakeroot=${D} \ + --enable-isadir=/lib/security \ + --host=${CHOST} || die + + # Python stuff in docs gives sandbox problems + sed -i -e 's|modules doc examples|modules|' Makefile + + # Fix warnings for gcc-2.95.3 + if [ "$(gcc-version)" = "2.95" ] + then + sed -i -e "s:-Wpointer-arith::" Make.Rules + fi + + if [ -z "$(use berkdb)" ] + then + # Do not build pam_userdb.so ... + sed -i -e "s:^HAVE_NDBM_H=yes:HAVE_NDBM_H=no:" \ + -e "s:^HAVE_LIBNDBM=yes:HAVE_LIBNDBM=no:" \ + -e "s:^HAVE_LIBDB=yes:HAVE_LIBDB=no:" \ + Make.Rules + + # Also edit the configuration file else the wrong include files + get used + sed -i -e "s:^#define HAVE_NDBM_H.*$:/* #undef HAVE_NDBM_H */:" \ + -e "s:^#define HAVE_DB_H.*$:/* #undef HAVE_DB_H */:" \ + _pam_aconf.h + + else + # Do not link pam_userdb.so to db-1.85 ... + sed -i -e "s:^HAVE_NDBM_H=yes:HAVE_NDBM_H=no:" \ + -e "s:^HAVE_LIBNDBM=yes:HAVE_LIBNDBM=no:" \ + Make.Rules + + # Also edit the configuration file else the wrong include files + get used + sed -i -e "s:^#define HAVE_NDBM_H.*$:/* #undef HAVE_NDBM_H */:" _pam_aconf.h + fi + + mkdir modules/pam_exim/security + + cp _pam_aconf.h modules/pam_exim/security + + cd modules/pam_exim + + sed -i -e 's:CFLAGS += $(USE_CRACKLIB) $(USE_LCKPWDF) $(NEED_LCKPWDF) $(EXTRAS):CFLAGS += $(USE_CRACKLIB) $(USE_LCKPWDF) $(NEED_LCKPWDF) $(EXTRAS) -I.:' Makefile + + make || die "pam_exim build failed" +} + +src_install() { + local x= + + einfo "Installing pam_exim..." + cd modules/pam_exim + + make FAKEROOT=${D} \ + LDCONFIG="" \ + install || die + +# # Make sure every module built. +# # Do not remove this, as some module can fail to build +# # and effectively lock the user out of his system. +# einfo "Checking if all modules were built..." +# for x in ${S}/modules/pam_* +# do +# if [ -d ${x} ] +# then +# # Its OK if the module failed when we didnt ask for it anyway +# if ! ls -1 ${D}/lib/security/$(basename ${x})*.so &> /dev/null +# then +# if [ -z "$(use berkdb)" -a "$(basename ${x})" = "pam_userdb" ] +# then +# continue +# fi +# if [ -z "$(use pwdb)" -a "$(basename ${x})" = "pam_pwdb" ] +# then +# continue +# fi +# if [ -z "$(use pwdb)" -a "$(basename ${x})" = "pam_radius" ] +# then +# continue +# fi +# eerror "ERROR: $(basename ${x}) module did not build." +# exit 1 +# else +# # Remove the ones we didnt want if it ended up building ok anyways +# if [ -z "$(use berkdb)" -a "$(basename ${x})" = "pam_userdb" ] +# then +# rm -f ${D}/lib/security/pam_userdb* +# fi +# if [ -z "$(use pwdb)" -a "$(basename ${x})" = "pam_pwdb" ] +# then +# rm -f ${D}/lib/security/pam_pwdb* +# fi +# if [ -z "$(use pwdb)" -a "$(basename ${x})" = "pam_radius" ] +# then +# rm -f ${D}/lib/security/pam_radius* +# fi +# fi +# fi +# done + +# dodir /usr/lib +# cd ${D}/lib +# for x in pam pamc pam_misc +# do +# rm lib${x}.so +# ln -s lib${x}.so.${PV} lib${x}.so +# ln -s lib${x}.so.${PV} lib${x}.so.0 +# mv lib${x}.a ${D}/usr/lib +# # See bug #4411 +# gen_usr_ldscript lib${x}.so +# done + +# cd ${S} +# doman doc/man/*.[58] + +# dodoc CHANGELOG Copyright README +# docinto modules ; dodoc modules/README ; dodoc doc/txts/README.* +# docinto txt ; dodoc doc/specs/*.txt #doc/txts/*.txt +# # docinto print ; dodoc doc/ps/*.ps + +# # docinto html +# # dohtml -r doc/html/ + +# # need this for pam_console +# keepdir /var/run/console + +# insinto /etc/pam.d +# for x in ${FILESDIR}/${PVR}/pam.d/* +# do +# if [ -f ${x} ] +# then +# doins ${x} +# fi +# done +} diff --git a/www-apps/pyblosxom-plugins/Manifest b/www-apps/pyblosxom-plugins/Manifest deleted file mode 100644 index 147c00b..0000000 --- a/www-apps/pyblosxom-plugins/Manifest +++ /dev/null @@ -1,15 +0,0 @@ -MD5 de6a2a634cd8474fc643ee50d5cb485b pyblosxom-plugins-1.2.1.ebuild 966 -MD5 3ae49161534556018d226f514ef68195 files/hardcodedates.py 2036 -MD5 3d89ed013ed90e7afff11e8e3a57ebf4 files/comments.py 25302 -MD5 548dee82839a94879bb3f7eab221b5cf files/contact.py 11534 -MD5 2b01a7bfae3b1e961b9c3e006d0c3f06 files/getstamps.py 1330 -MD5 13427211867bdf6231ec8d9ab1a585cc files/logrequest.py 2248 -MD5 d41d8cd98f00b204e9800998ecf8427e files/digest-pyblosxom-plugins-1.2.1 0 -MD5 d30d5cf286b0a3bfb42f1af7029854fc files/pycategories.py 7740 -MD5 3a489e93c5a569beaff1aeba02b6dc20 files/nospam.py 6364 -MD5 78f0af45b70b019c7ef0236175db6f30 files/rss2renderer.py 8777 -MD5 dad8289c1e561ffec042f661873e4ed4 files/pyguest.py 10951 -MD5 1bd704ad5a8e5fd621b84a6ab2ec9d32 files/wbglast10summary.py.html 4862 -MD5 551595972432681869214de6b21dc0aa files/rss2renderer.py.html 41245 -MD5 9d08ee37ee648e2e1541b51333db0fe6 files/session.py 11214 -MD5 2fcbddb5246ec1f79ec0557cbe56bdad files/wbglast10summary.py 1094 diff --git a/www-apps/pyblosxom-plugins/files/comments.py b/www-apps/pyblosxom-plugins/files/comments.py deleted file mode 100644 index 0747137..0000000 --- a/www-apps/pyblosxom-plugins/files/comments.py +++ /dev/null @@ -1,705 +0,0 @@ -""" -This module contains an extension to Blosxom file entries to support -comments. - -Contributors: - Ted Leung - Will Guaraldi - Wari Wahab - Robert Wall - Bill Mill - Roberto De Almeida - David Geller - -If you make any changes to this plugin, please a send a patch with your -changes to twl+pyblosxom@sauria.com so that we can incorporate your changes. -Thanks! - -This plugin requires the PyXML module. - -This module supports the following config parameters (they are not -required): - - comment_dir - the directory we're going to store all our comments in. - this defaults to datadir + "comments". - comment_ext - the file extension used to denote a comment file. - this defaults to "cmt". - comment_draft_ext - the file extension used for new comments that have - not been manually approved by you. this defaults - to comment_ext (i.e. there is no draft stage) - - comment_smtp_server - the smtp server to send comments notifications - through. - comment_smtp_from - the person comment notifications will be from. - If you omit this, the from address will be the - e-mail address as input in the comment form - comment_smtp_to - the person to send comment notifications to. - comment_nofollow - set this to 1 to add rel="nofollow" attributes to - links in the description -- these attributes are embedded - in the stored representation. - -Comments are stored 1 per file in a parallel hierarchy to the datadir -hierarchy. The filename of the comment is the filename of the blog -entry, plus the creation time of the comment as a float, plus the -comment extension. The contents of the comment file is an RSS 2.0 -formatted item. - -Comments now follow the blog_encoding variable specified in config.py - -Each entry has to have the following properties in order to work with -comments: - - 1. absolute_path - the category of the entry. ex. "dev/pyblosxom" - 2. fn - the filename of the entry without the file extension and without - the directory. ex. "staticrendering" - 3. file_path - the absolute_path plus the fn. ex. "dev/pyblosxom/staticrendering" - -Also, for any entry that you don't want to have comments, just add -"nocomments" to the properties of the entry. - -If you would like comment previews, you need to do 2 things. - - 1) Add a preview button to comment-form.html like this: - <input name="preview" type="submit" value="Preview" /> - - You may change the contents of the value attribute, but the name of - the input must be "preview". - - 2) Still in your comment-form.html template, you need to use the comment - values to fill in the values of your input fields like so: - <input name="author" type="text" value="$cmt_author"> - <input name="email" type="text" value="$cmt_email"> - <input name="url" type="text" value="$cmt_link"> - <textarea name="body">$cmt_description</textarea> - - If there is no preview available, these variables will be stripped - from the text and cause no problem. - - 3) Copy comment.html to a template called comment-preview.html. All of - the available variables from the comment template are available for - this template. - -This plugin implements Google's nofollow support for links in the body of the -comment. If you display the link of the comment poster in your HTML template -then you must add the rel="nofollow" attribute to your template as well - - - -Copyright (c) 2003-2005 Ted Leung - -Permission is hereby granted, free of charge, to any person obtaining -a copy of this software and associated documentation files (the -"Software"), to deal in the Software without restriction, including -without limitation the rights to use, copy, modify, merge, publish, -distribute, sublicense, and/or sell copies of the Software, and to -permit persons to whom the Software is furnished to do so, subject to -the following conditions: - -The above copyright notice and this permission notice shall be -included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -""" -__author__ = "Ted Leung" -__version__ = "$Id: comments.py,v 1.41.4.7 2005/06/10 13:58:29 willhelm Exp $" - -import cgi, glob, os.path, re, time, cPickle, os, codecs -from xml.sax.saxutils import escape -from Pyblosxom import tools -from Pyblosxom.entries.base import EntryBase - -def cb_start(args): - request = args["request"] - config = request.getConfiguration() - logdir = config.get("logdir", "/tmp/") - - # logfile = os.path.normpath(logdir + os.sep + "comments.log") - # tools.make_logger(logfile) - - if not config.has_key('comment_dir'): - config['comment_dir'] = os.path.join(config['datadir'],'comments') - if not config.has_key('comment_ext'): - config['comment_ext'] = 'cmt' - if not config.has_key('comment_draft_ext'): - config['comment_draft_ext'] = config['comment_ext'] - if not config.has_key('comment_nofollow'): - config['comment_nofollow'] = 0 - -def verify_installation(request): - config = request.getConfiguration() - - retval = 1 - - if config.has_key('comment_dir') and not os.path.isdir(config['comment_dir']): - print 'The "comment_dir" property in the config file must refer to a directory' - retval = 0 - - smtp_keys_defined = [] - smtp_keys=['comment_smtp_server', 'comment_smtp_from', 'comment_smtp_to'] - for k in smtp_keys: - if config.has_key(k): - smtp_keys_defined.append(k) - - if smtp_keys_defined: - for i in smtp_keys: - if i not in smtp_keys_defined: - print("Missing comment SMTP property: '%s'" % i) - retval = 0 - - optional_keys = ['comment_dir', 'comment_ext', 'comment_draft_ext'] - for i in optional_keys: - if not config.has_key(i): - print("missing optional property: '%s'" % i) - - return retval - -def createhtmlmail (html, headers): - """Create a mime-message that will render HTML in popular - MUAs, text in better ones - - Based on: http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/67083""" - import MimeWriter - import mimetools - import cStringIO - - out = cStringIO.StringIO() # output buffer for our message - htmlin = cStringIO.StringIO(html) - - text = re.sub('<.*?>', '', html) - txtin = cStringIO.StringIO(text) - - writer = MimeWriter.MimeWriter(out) - for header,value in headers: - writer.addheader(header, value) - writer.addheader("MIME-Version", "1.0") - writer.startmultipartbody("alternative") - writer.flushheaders() - - subpart = writer.nextpart() - subpart.addheader("Content-Transfer-Encoding", "quoted-printable") - pout = subpart.startbody("text/plain", [("charset", 'us-ascii')]) - mimetools.encode(txtin, pout, 'quoted-printable') - txtin.close() - - subpart = writer.nextpart() - subpart.addheader("Content-Transfer-Encoding", "quoted-printable") - pout = subpart.startbody("text/html", [("charset", 'us-ascii')]) - mimetools.encode(htmlin, pout, 'quoted-printable') - htmlin.close() - - writer.lastpart() - msg = out.getvalue() - out.close() - - return msg - -def readComments(entry, config): - """ - @param: a file entry - @type: dict - - @returns: a list of comment dicts - """ - encoding = config['blog_encoding'] - filelist = glob.glob(cmtExpr(entry, config)) - if not entry.has_key('num_comments'): - entry['num_comments'] = len(filelist) - comments = [readComment(f, encoding) for f in filelist] - comments = [(cmt['cmt_time'], cmt) for cmt in comments] - comments.sort() - return [c[1] for c in comments] - -def getCommentCount(entry, config): - """ - @param: a file entry - @type: dict - - @returns: the number of comments for the entry - """ - if entry['absolute_path'] == None: return 0 - filelist = glob.glob(cmtExpr(entry,config)) - if filelist is not None: - return len(filelist) - return 0 - -def cmtExpr(entry, config): - """ - Return a string containing the regular expression for comment entries - - @param: a file entry - @type: dict - @returns: a string with the directory path for the comment - - @param: configuratioin dictionary - @type: dict - - @returns: a string containing the regular expression for comment entries - """ - cmtDir = os.path.join(config['comment_dir'], entry['absolute_path']) - cmtExpr = os.path.join(cmtDir,entry['fn']+'-*.'+config['comment_ext']) - return cmtExpr - -def readComment(filename, encoding): - """ - Read a comment from filename - - @param filename: filename containing a comment - @type filename: string - - @param encoding: encoding of comment files - @type encoding: string - - @returns: a comment dict - """ - from xml.sax import make_parser, SAXException - from xml.sax.handler import feature_namespaces, ContentHandler - class cmtHandler(ContentHandler): - def __init__(self, cmt): - self._data = "" - self.cmt = cmt - def startElement(self, name, atts): - self._data = "" - def endElement(self, name): - self.cmt['cmt_'+name] = self._data - def characters(self, content): - self._data += content - - cmt = {} - - try: - parser = make_parser() - parser.setFeature(feature_namespaces, 0) - handler = cmtHandler(cmt) - parser.setContentHandler(handler) - parser.parse(filename) - cmt['cmt_time'] = float(cmt['cmt_pubDate']) #time.time() - cmt['cmt_pubDate'] = time.ctime(float(cmt['cmt_pubDate'])) #pretty time - return cmt - except: #don't error out on a bad comment - # tools.log('bad comment file: %s' % filename) - pass - -def writeComment(request, config, data, comment, encoding): - """ - Write a comment - - @param config: dict containing pyblosxom config info - @type config: dict - - @param data: dict containing entry info - @type data: dict - - @param comment: dict containing comment info - @type comment: dict - - @return: The success or failure of creating the comment. - @rtype: string - """ - entry = data['entry_list'][0] - cdir = os.path.join(config['comment_dir'],entry['absolute_path']) - cdir = os.path.normpath(cdir) - if not os.path.isdir(cdir): - os.makedirs(cdir, mode = 0775) - - cfn = os.path.join(cdir,entry['fn']+"-"+comment['pubDate']+"."+config['comment_draft_ext']) - - argdict = { "request": request, "comment": comment } - reject = tools.run_callback("comment_reject", - argdict, - donefunc=lambda x:x) - if reject == 1: - return "Comment rejected." - - def makeXMLField(name, field): - return "<"+name+">" + cgi.escape(field.get(name, "")) + "</"+name+">\n"; - - filedata = '<?xml version="1.0" encoding="%s"?>\n' % encoding - filedata += "<item>\n" - filedata += makeXMLField('title', comment) - filedata += makeXMLField('author', comment) - filedata += makeXMLField('link', comment) - filedata += makeXMLField('email', comment) - filedata += makeXMLField('source', comment) - filedata += makeXMLField('pubDate', comment) - filedata += makeXMLField('description', comment) - filedata += "</item>\n" - - try : - cfile = codecs.open(cfn, "w", encoding) - except IOError: - # tools.log("Couldn't open comment file %s for writing" % cfn) - return "Internal error: Your comment could not be saved." - - cfile.write(filedata) - cfile.close() - os.chmod(cfn, 0664) - - #write latest pickle - latest = None - latestFilename = os.path.join(config['comment_dir'],'LATEST.cmt') - try: - latest = open(latestFilename,"w") - except IOError: - # tools.log("Couldn't open latest comment pickle for writing") - return "Couldn't open latest comment pickle for writing." - else: - modTime = float(comment['pubDate']) - - try: - cPickle.dump(modTime,latest) - latest.close() - except IOError: - # should log or e-mail - if latest: - latest.close() - return "Internal error: Your comment may not have been saved." - - if config.has_key('comment_smtp_server') and \ - config.has_key('comment_smtp_to'): - # FIXME - removed grabbing send_email's return error message - # so there's no way to know if email is getting sent or not. - send_email(config, entry, comment, cdir, cfn) - - # figure out if the comment was submitted as a draft - if config["comment_ext"] != config["comment_draft_ext"]: - return "Comment was submitted for approval. Thanks!" - - return "Comment submitted. Thanks!" - -def send_email(config, entry, comment, comment_dir, comment_filename): - """Send an email to the blog owner on a new comment - - @param config: configuration as parsed by Pyblosxom - @type config: dictionary - - @param entry: a file entry - @type config: dictionary - - @param comment: comment as generated by readComment - @type comment: dictionary - - @param comment_dir: the comment directory - @type comment_dir: string - - @param comment_filename: file name of current comment - @type comment_filename: string - """ - import smtplib - # import the formatdate function which is in a different - # place in Python 2.3 and up. - try: - from email.Utils import formatdate - except ImportError: - from rfc822 import formatdate - - author = escape_SMTP_commands(clean_author(comment['author'])) - description = escape_SMTP_commands(comment['description']) - if comment.has_key('email'): - email = comment['email'] - else: - email = config['comment_smtp_from'] - - try: - server = smtplib.SMTP(config['comment_smtp_server']) - curl = config['base_url']+'/'+entry['file_path'] - comment_dir = os.path.join(config['comment_dir'], entry['absolute_path']) - - message = [] - message.append("From: %s" % email) - message.append("To: %s" % config["comment_smtp_to"]) - message.append("Date: %s" % formatdate(float(comment['pubDate']))) - message.append("Subject: write back by %s" % author) - message.append("") - message.append("%s\n%s\n%s\n" % (description, comment_filename, curl)) - server.sendmail(from_addr=email, - to_addrs=config['comment_smtp_to'], - msg="\n".join(message)) - server.quit() - except Exception, e: - # tools.log("Error sending mail: %s" % e) - # FIXME - if we error out, no one will know. - pass - -def clean_author(s): - """ - Guard against blasterattacko style attacks that embedd SMTP commands in - author field. - - If author field is more than one line, reduce to one line - - @param the string to be checked - @type string - - @returns the sanitized string - """ - return s.splitlines()[0] - -def escape_SMTP_commands(s): - """ - Guard against blasterattacko style attacks that embed SMTP commands by - using an HTML span to make the command syntactically invalid to SMTP but - renderable by HTML - - @param the string to be checked - @type string - - @returns the sanitized string - """ - def repl_fn(mo): - return '<span>'+mo.group(0)+'</span>' - s = re.sub('([Tt]o:.*)',repl_fn,s) - s = re.sub('([Ff]rom:.*)',repl_fn,s) - s = re.sub('([Ss]ubject:.*)',repl_fn,s) - return s - -def sanitize(body): - """ - This code shamelessly lifted from Sam Ruby's mombo/post.py - """ - body=re.sub(r'\s+$','',body) - body=re.sub('\r\n?','\n', body) - - # naked urls become hypertext links - body=re.sub('(^|[\\s.:;?\\-\\]<])' + - '(http://[-\\w;/?:@&=+$.!~*\'()%,#]+[\\w/])' + - '(?=$|[\\s.:;?\\-\\[\\]>])', - '\\1<a href="\\2">\\2</a>',body) - - # html characters used in text become escaped - body=escape(body) - - # passthru <a href>, <em>, <i>, <b>, <blockquote>, <br/>, <p>, - # <abbr>, <acronym>, <big>, <cite>, <code>, <dfn>, <kbd>, <pre>, <small> - # <strong>, <sub>, <sup>, <tt>, <var> - body=re.sub('<a href="([^"]*)">([^&]*)</a>', - '<a href="\\1">\\2</a>', body) - body=re.sub('<a href=\'([^\']*)\'>([^&]*)</a>', - '<a href="\\1">\\2</a>', body) - body=re.sub('<em>([^&]*)</em>', '<em>\\1</em>', body) - body=re.sub('<i>([^&]*)</i>', '<i>\\1</i>', body) - body=re.sub('<b>([^&]*)</b>', '<b>\\1</b>', body) - body=re.sub('<blockquote>([^&]*)</blockquote>', - '<blockquote>\\1</blockquote>', body) - body=re.sub('<br\s*/?>\n?','\n',body) - - body=re.sub('<abbr>([^&]*)</abbr>', '<abbr>\\1</abbr>', body) - body=re.sub('<acronym>([^&]*)</acronym>', '<acronym>\\1</acronym>', body) - body=re.sub('<big>([^&]*)</big>', '<big>\\1</big>', body) - body=re.sub('<cite>([^&]*)</cite>', '<cite>\\1</cite>', body) - body=re.sub('<code>([^&]*)</code>', '<code>\\1</code>', body) - body=re.sub('<dfn>([^&]*)</dfn>', '<dfn>\\1</dfn>', body) - body=re.sub('<kbd>([^&]*)</kbd>', '<kbd>\\1</kbd>', body) - body=re.sub('<pre>([^&]*)</pre>', '<pre>\\1</pre>', body) - body=re.sub('<small>([^&]*)</small>', '<small>\\1</small>', body) - body=re.sub('<strong>([^&]*)</strong>', '<strong>\\1</strong>', body) - body=re.sub('<sub>([^&]*)</sub>', '<sub>\\1</sub>', body) - body=re.sub('<sup>([^&]*)</sup>', '<sup>\\1</sup>', body) - body=re.sub('<tt>([^&]*)</tt>', '<tt>\\1</tt>', body) - body=re.sub('<var>([^&]*)</var>', '<var>\\1</var>', body) - - body=re.sub('</?p>','\n\n',body).strip() - - # wiki like support: _em_, *b*, [url title] - body=re.sub(r'\b_(\w.*?)_\b', r'<em>\1</em>', body) - body=re.sub(r'\*(\w.*?)\*', r'<b>\1</b>', body) - body=re.sub(r'\[(\w+:\S+\.gif) (.*?)\]', r'<img src="\1" alt="\2" />', body) - body=re.sub(r'\[(\w+:\S+\.jpg) (.*?)\]', r'<img src="\1" alt="\2" />', body) - body=re.sub(r'\[(\w+:\S+\.png) (.*?)\]', r'<img src="\1" alt="\2" />', body) - body=re.sub(r'\[(\w+:\S+) (.*?)\]', r'<a href="\1">\2</a>', body).strip() - - # unordered lists: consecutive lines starting with spaces and an asterisk - chunk=re.compile(r'^( *\*.*(?:\n *\*.*)+)',re.M).split(body) - for i in range(1, len(chunk), 2): - (html,stack)=('', ['']) - for indent,line in re.findall(r'( +)\* +(.*)', chunk[i]) + [('','')]: - if indent>stack[-1]: (stack,html)=(stack+[indent],html+'<ul>\r') - while indent<stack[-1]: (stack,html)=(stack[:-1],html+'</ul>\r') - if line: html += '<li>'+line+'</li>\r' - chunk[i]=html - - # white space - chunk=re.split('\n\n+', ''.join(chunk)) -# if len(chunk)>1: body='<p>' + '</p>\r<p>'.join(chunk) + '</p>\r' - body=re.sub('\n','<br />\n', body) - body=re.compile('<p>(<ul>.*?</ul>)\r</p>?',re.M).sub(r'\1',body) - body=re.compile('<p>(<blockquote>.*?</blockquote>)</p>?',re.M).sub(r'\1',body) - body=re.sub('\r', '\n', body) - body=re.sub(' +', ' ', body) - - return body - -def dont_follow(mo): - return '<a rel="nofollow" '+mo.group(1)+'>' - -def add_dont_follow(s, config): - url_pat_str = '<a ([^>]+)>' - url_pat = re.compile(url_pat_str) - if config['comment_nofollow'] == 1: - return url_pat.sub(dont_follow, s) - else: - return s - -def cb_prepare(args): - """ - Handle comment related HTTP POST's. - - @param request: pyblosxom request object - @type request: a Pyblosxom request object - """ - request = args["request"] - form = request.getHttp()['form'] - config = request.getConfiguration() - data = request.getData() - - if form.has_key("title") and form.has_key("author") and \ - form.has_key("body") and not form.has_key("preview"): - - encoding = config['blog_encoding'] - decode_form(form, encoding) - - body = form['body'].value - - body = sanitize(body) - - # Check if the form has a URL - url = (form.has_key('url') and [form['url'].value] or [''])[0] - - #it doesn't make sense to add nofollow to link here, but we should - #escape it. If you don't like the link escaping, I'm not attached to it. - cdict = {'title': form['title'].value, \ - 'author' : form['author'].value, \ - 'pubDate' : str(time.time()), \ - 'link' : escape_link(url), \ - 'source' : '', \ - 'description' : add_dont_follow(body, config) } - if form.has_key('email'): - cdict['email'] = form['email'].value - - data["comment_message"] = writeComment(request, config, data, \ - cdict, encoding) - -def escape_link(linkstring): - """Don't allow html in the link string""" - for c in "<>'\"": - linkstring = linkstring.replace(c, '') - return linkstring - -def decode_form(d, encoding): - for key in d: - d[key].value = d[key].value.decode(encoding) - -def cb_pathinfo(args): - request = args['request'] - data = request.getData() - pyhttp = request.getHttp() - qstr = pyhttp.get('QUERY_STRING', None) - - data['display_comment_default'] = 0 - - if qstr == None: - return None - - parsed_qs = cgi.parse_qs(qstr) - if parsed_qs.has_key('showcomments'): - if parsed_qs['showcomments'][0] == 'yes': - data['display_comment_default'] = 1 - - return None - - -def cb_head(args): - renderer = args['renderer'] - template = args['template'] - - newtemplate = renderer.flavour.get('comment-head','') - if not newtemplate == '' and len(renderer.getContent()) == 1: - args['template'] = newtemplate - - # expand all of entry vars for expansion - entry = args['entry'] - single_entry = entry['entry_list'][0] - single_entry['title'] # force lazy evaluation - entry.update(single_entry) - args['entry'] = entry - return template - -def cb_story(args): - renderer = args['renderer'] - entry = args['entry'] - template = args['template'] - request = args["request"] - data = request.getData() - config = request.getConfiguration() - if len(renderer.getContent()) == 1 \ - and renderer.flavour.has_key('comment-story') \ - and not entry.has_key("nocomments") \ - and data['display_comment_default'] == 1: - template = renderer.flavour.get('comment-story','') - args['template'] = args['template'] + template - - entry['num_comments'] = getCommentCount(entry, config) - return template - -def build_preview_comment(form, entry): - """Build a prevew comment by brute force - - @param form: cgi form object (or compatible) - @type form: Dictionary of objects with a .value propery - - @param entry: pyblosxom entry object - @type entry: pyblosxom entry object - """ - c = {} - #required fields - try: - c['cmt_time'] = str(time.time()) - c['cmt_author'] = form['author'].value - c['cmt_title'] = form['title'].value - c['cmt_item'] = sanitize(form['body'].value) - c['cmt_pubDate'] = time.ctime(time.time()) - c['cmt_description'] = sanitize(form['body'].value) - except KeyError, e: - c['cmt_error'] = 'Missing value: %s' % e - - #optional fields - if 'url' in form: - c['cmt_link'] = form['url'].value - if 'email' in form: - c['cmt_email'] = form['email'].value - for key in c: entry[key] = c[key] - - return c - -def cb_story_end(args): - renderer = args['renderer'] - entry = args['entry'] - template = args['template'] - request = args["request"] - data = request.getData() - form = request.getHttp()['form'] - config = request.getConfiguration() - if len(renderer.getContent()) == 1 \ - and renderer.flavour.has_key('comment-story') \ - and not entry.has_key("nocomments") \ - and data['display_comment_default'] == 1: - output = [] - entry['comments'] = readComments(entry, config) - if entry.has_key('comments'): - for comment in entry['comments']: - renderer.outputTemplate(output, comment, 'comment') - if form.has_key('preview')\ - and renderer.flavour.has_key('comment-preview'): - com = build_preview_comment(form, entry) - renderer.outputTemplate(output, com, 'comment-preview') - renderer.outputTemplate(output, entry, 'comment-form') - args['template'] = template +u"".join(output) - - entry['num_comments'] = getCommentCount(entry, config) - return template diff --git a/www-apps/pyblosxom-plugins/files/contact.py b/www-apps/pyblosxom-plugins/files/contact.py deleted file mode 100644 index d3fcf38..0000000 --- a/www-apps/pyblosxom-plugins/files/contact.py +++ /dev/null @@ -1,390 +0,0 @@ -""" -Provides a form to send an email to the blog-owner. - -If you make any changes to this plugin, please send a patch to -<sa+pyblosxom at c-area dot ch> so I can incorporate them. -Thanks! - - -To install: -1) Put contact.py in your plugin directory. -2) In config.py add 'contact' to py['load_plugins'] -3) Add the following variables to config.py: - py['contact_urltrigger'] = "/contact" # optional, this is the default - py['contact_smtp_server'] = "localhost" # required - py['contact_smtp_to'] = "you@example.com" # required -4) Optionally create a template named contact.<flavour> in your flavour directory. - If no contact.<flavour> exists a simple default is used. See _default_template below. - - -Dependencies: - - My compatibility plugin if you're not using pyblosxom 1.2+. - - -$Id: contact.py,v 1.6 2005/08/25 13:21:48 sar Exp $ -""" -__author__ = "Steven Armstrong <sa at c-area dot ch>" -__version__ = "$Revision: 1.6 $ $Date: 2005/08/25 13:21:48 $" -__url__ = "http://www.c-area.ch/code/" -__description__ = "Provides a form to send an email to the blog-owner." -__license__ = "GPL 2+" - - -# Python imports -import urlparse - -# Pyblosxom imports -from Pyblosxom.renderers.blosxom import Renderer -from Pyblosxom import tools - - -# Variables -TRIGGER = "/contact" -TRIGGER_KEY = "contact_urltrigger" -INIT_KEY = "contact_initiated" -MESSAGE_KEY = "contact_error_message" -_form_fields = ['name', 'email', 'subject', 'message'] - -_default_template = """ -<div> -<h2>Contact me</h2> -<div style="display:block;">$contact_error_message</div> -<form name="contactForm" id="contactForm" method="post" action="$base_url$contact_urltrigger"> -<div class="contactLine"> - <div class="contactLabel"> - <label class="contactLine" for="name" title="Your name">Name</label> - </div> - <input type="text" name="name" id="name" value="$contact_name" /><br /> -</div> -<div class="contactLine"> - <div class="contactLabel"> - <label class="contactLine" for="email" title="Your email address">Email</label> - </div> - <input type="text" name="email" id="email" value="$contact_email" /><br /> -</div> -<div class="contactLine"> - <div class="contactLabel"> - <label class="contactLine" for="subject" title="Subject of your message">Subject</label> - </div> - <input class="contactLine" type="text" name="subject" id="subject" value="$contact_subject" /><br /> -</div> -<div class="contactText"> - <div class="contactLabel"> - <label class="contactText" for="message" title="Your message">Message</label> - </div> - <textarea name="message" id="message" style="height:150px;">$contact_message</textarea><br /> -</div> -<div class="contactSubmit"> - <div class="contactButton"> - <input class="contactSubmit" type="submit" value="Send" style="width:auto; margin-right:0;" /> - </div> - <div class="contactButton"> - <input class="contactSubmit" type="reset" value="Reset" style="width:auto; margin-right:0;" /> - </div> -</div> -</form> -</div> -""" - -################################################################################ -## -## Helper functions -## -################################################################################ - -rfc822_specials = '()<>@,;:\\"[]' - -def isAddressValid(addr): - ''' - Taken from - - http://www.secureprogramming.com/?action=view&feature=recipes&recipeid=1 - - Posted by Matt Messier on Tue, Sep 02, 2003 (06:19 PM) GMT - - >>> isAddressValid('djfhdfh') - 0 - >>> isAddressValid('djfhdfh@test.com') - 8 - >>> isAddressValid('dj@fhdfh@test.com') - 0 - >>> isAddressValid('dj\@fhdfh@test.com') - 0 - >>> isAddressValid('dj"@"fhdfh@test.com') - 0 - >>> isAddressValid('dj" "fhdfh@test.com') - 0 - >>> isAddressValid('dj\" \"fhdfh@test.com') - 0 - >>> isAddressValid('dj." ".fhdfh@test.com') - 13 - >>> isAddressValid('dj."@ ".fhdfh@test.com') - 14 - >>> isAddressValid('dj."@<> ".fhdfh@test.com') - 16 - >>> isAddressValid('dj."@<>ü ".fhdfh@test.com') - 0 - >>> isAddressValid('dj<>fhdfh@test.com') - 0 - >>> isAddressValid('dj\<\>fhdfh@test.com') - 0 - >>> isAddressValid('dj\ fhdfh@test.com') - 0 - >>> isAddressValid('dj\\ fhdfh@test.com') - 0 - >>> isAddressValid('djfhdfh@test.com.de') - 8 - >>> isAddressValid('djfhdfh@test.co<m.de') - 0 - ''' - # Ported from Recipe 3.9 in Secure Programming Cookbook for C and C++ by - # John Viega and Matt Messier (O'Reilly 2003) - - # First we validate the name portion (name@domain) - c = 0 - while c < len(addr): - if addr[c] == '"' and (not c or addr[c - 1] == '.' or addr[c - 1] == '"'): - c = c + 1 - while c < len(addr): - if addr[c] == '"': - c = c + 1 - break - if addr[c] == '\\' and addr[c + 1] == ' ': - c = c + 2 - continue - if ord(addr[c]) < 32 or ord(addr[c]) >= 127: return 0 - c = c + 1 - else: return 0 - if addr[c] == '@': break - if addr[c] != '.': return 0 - c = c + 1 - continue - if addr[c] == '@': break - if ord(addr[c]) <= 32 or ord(addr[c]) >= 127: return 0 - if addr[c] in rfc822_specials: return 0 - c = c + 1 - if not c or addr[c - 1] == '.': return 0 - - # Next we validate the domain portion (name@domain) - domain = c = c + 1 - if domain >= len(addr): return 0 - count = 0 - while c < len(addr): - if addr[c] == '.': - if c == domain or addr[c - 1] == '.': return 0 - count = count + 1 - if ord(addr[c]) <= 32 or ord(addr[c]) >= 127: return 0 - if addr[c] in rfc822_specials: return 0 - c = c + 1 - - ## The final return statement was modified to return the split point - ## (position of @) so that the email can split in its two subsections. - if count >= 1: - return domain - - -def verify_installation(request): - config = request.getConfiguration() - retval = 1 - - if not 'contact_urltrigger' in config: - print "Missing optional property: 'contact_urltrigger'" - print "Using the default of '%s'" % TRIGGER - - _required = ['contact_smtp_server', 'contact_smtp_to'] - for prop in _required: - if not prop in config: - print "Missing required property: '%s'" % prop - retval = 0 - - return retval - - - -class ContactRenderer(Renderer): - - def render(self, header=1): - config = self._request.getConfiguration() - data = self._request.getData() - - # root_datadir is normaly set after the cb_pathinfo callback. - # but if a plugin implements cb_handle (as this one does), - # cb_pathinfo is never called. - # if root_datadir is not set and flavourdir is not set in config.py - # an exception is thrown in BlosxomRenderer._getFlavour. - # so set root_datadir here explicitly to prevent that. - if not 'root_datadir' in data: - data['root_datadir'] = config['datadir'] - - # initialize flavour - self.flavour = self._getFlavour(data.get('flavour', 'html')) - data['content-type'] = self.flavour['content_type'].strip() - if header: - self.addHeader("Status", "200 OK") - if self._needs_content_type and data['content-type'] != "": - self.addHeader('Content-type', '%s; charset=%s' % (data['content-type'], config.get('blog_encoding', 'iso-8859-1'))) - self.showHeaders() - - d = {} - d.update(config) - d.update(data) - - if 'head' in self.flavour: - self._outputFlavour(d, 'head') - - if not 'contact' in self.flavour: - self.flavour['contact'] = _default_template - self._outputFlavour(d, 'contact') - - if 'foot' in self.flavour: - self._outputFlavour(d, 'foot') - - self.rendered = 1 - - - -def _update_config(config): - if TRIGGER_KEY in config: - global TRIGGER - TRIGGER = config[TRIGGER_KEY] - else: - # set this explicitly so it's available in templates - config[TRIGGER_KEY] = TRIGGER - - -def _handle_post(request): - form = request.getForm() - data = request.getData() - http = request.getHttp() - config = request.getConfiguration() - - email = {} - error = False - error_messages = [] - - if not 'HTTP_REFERER' in http or \ - not http['HTTP_REFERER'].startswith('://'.join(urlparse.urlsplit(config['base_url'])[0:1])): - data[MESSAGE_KEY] = "Posting from foreign hosts not allowed.<br />\nUse the form below to send your message." - return - - for field in _form_fields: - if not field in form: - error_messages.append("Missing required field '%s'." % field) - error = True - else: - # strip markup - parser = tools.Stripper() - parser.feed(form[field].value) - email[field] = parser.gettext() - - if 'email' in email.keys() and not isAddressValid(email['email']): - error = True - error_messages.append("Invalid email address '%s'. Cannot deliver your message!" % email['email']) - - if error: - data[MESSAGE_KEY] = "<br />\n".join(error_messages) - _remember_email(email, data) - else: - success, data[MESSAGE_KEY] = _send_email(email, config) - if success: - _forget_email(data) - else: - _remember_email(email, data) - - -def _remember_email(email, data): - """ - Stores form fields in the data dict so they can be used to - populate the form in the template. - """ - for key in email: - data["contact_%s" % key] = email[key] - - -def _forget_email(data): - """ - Resets/forgets any stored form field values. - """ - for key in _form_fields: - key = "contact_%s" % key - if key in data: - del data[key] - - -def _send_email(email, config): - try: - try: from email.Utils import formatdate - except ImportError: from rfc822 import formatdate - import smtplib - - smtp = smtplib.SMTP(config['contact_smtp_server']) - - email['to'] = config["contact_smtp_to"] - email['date'] = formatdate(localtime=True) - - msg = """\ -From: %(name)s <%(email)s> -To: %(to)s -Date: %(date)s -Subject: %(subject)s - -%(message)s - -""" % email - - smtp.sendmail( - from_addr=email['email'], - to_addrs=config['contact_smtp_to'], - msg=msg - ) - smtp.quit() - except: - if hasattr(tools, "log_exception"): - tools.log_exception() - return (False, "Error: Problem sending email.") - else: - return (True, "Thanks for feeding my mailbox ;-)") - - - - -#****************************** -# Callbacks -#****************************** - -def cb_start(args): - request = args['request'] - http = request.getHttp() - config = request.getConfiguration() - _update_config(config) - - if http['PATH_INFO'].startswith(TRIGGER): - data = request.getData() - data[INIT_KEY] = True - - -def cb_handle(args): - request = args['request'] - data = request.getData() - - if INIT_KEY in data: - http = request.getHttp() - if http['REQUEST_METHOD'].upper() == "POST": - _handle_post(request) - else: - _forget_email(data) - - ContactRenderer(request, request.getResponse()).render() - - return 1 - - -def cb_end(args): - # cleanup - request = args['request'] - data = request.getData() - if INIT_KEY in data: - del data[INIT_KEY] - if MESSAGE_KEY in data: - del data[MESSAGE_KEY] - diff --git a/www-apps/pyblosxom-plugins/files/getstamps.py b/www-apps/pyblosxom-plugins/files/getstamps.py deleted file mode 100644 index 64ec15a..0000000 --- a/www-apps/pyblosxom-plugins/files/getstamps.py +++ /dev/null @@ -1,49 +0,0 @@ -""" -Run this file 'python getstamps.py' from your pyblosxom data-dir. - -You may need to make some modification for your situation. This -assumes your blog entries use a .txt extension. - -Hacked on by Michael Olson <http://www.mwolson.org/>. -""" -__author__ = 'Nathan Kent Bullock' -__homepage__ = 'http://bullock.moo.com/nathan/' -__email__ = 'nathan_kent_bullock -at- yahoo.ca' -__version__ = '1.0' - -import re, sys, os, types - -OutFile=None - -DateRegexp = re.compile (r'^#date\s+(.+)$') - -def getdate(f): - for line in f: - matched = DateRegexp.search(line) - if matched: - return matched.group(1) - -def recurse(so_far): - global OutFile - - for filename in os.listdir(so_far): - filepath = so_far + "/" + filename - - # just makes output prettier. - if filename == ".svn": continue - - if os.path.isdir(filepath): - print "dir %s" % (filepath,) - recurse(filepath) - - # You may need to modify the extension test - if os.path.isfile(filepath) and filepath != "timestamps": - thisfile = open(filepath,'r') - thisdate = getdate (thisfile) - if thisdate: - OutFile.write("%s %s\n" % (thisdate, filepath[2:])) - continue - -if __name__ == "__main__": - OutFile = open("timestamps", "w+") - recurse(".") diff --git a/www-apps/pyblosxom-plugins/files/hardcodedates.py b/www-apps/pyblosxom-plugins/files/hardcodedates.py deleted file mode 100644 index 559421f..0000000 --- a/www-apps/pyblosxom-plugins/files/hardcodedates.py +++ /dev/null @@ -1,67 +0,0 @@ -""" -This allows the user to create a file "timestamps" in their datadir, -that will override the timestamp of any given blog entry. Each line -in this file should be of the form "YYYY-MM-DD-hh-mm file-name". -Then for any entry that one of these lines exist the system will use -that timestamp instead of the actual files modification time. - -Note: the filename is relative to your data-dir. -Example of a line for the file /var/data-dir/school/abc.txt - where the datadir is "/var/data-dir/" and the date is Aug 9, 2004. - -2004-08-09-00-00 school/abc.txt - -Hacked on by Michael Olson <http://www.mwolson.org/>. -""" -__author__ = 'Nathan Kent Bullock' -__homepage__ = 'http://bullock.moo.com/nathan/' -__email__ = 'nathan_kent_bullock -at- yahoo.ca' -__version__ = '1.2' - -from Pyblosxom import tools -import os, re, time, sys - -FILETIME = re.compile('^([0-9]{4})-([0-1][0-9])-([0-3][0-9])(-([0-2][0-9])-([0-5][0-9]))? +(.*)$') - -all_timestamps = None - -def get_all_timestamps(datadir): - f = open(datadir + "/timestamps") - t = [] - while True: - str = f.readline() - if str == "": break - m = FILETIME.search(str.strip()) - if m: - year = int(m.group(1)) - mo = int(m.group(2)) - day = int(m.group(3)) - if m.group(4): - hr = int(m.group(5)) - minute = int(m.group(6)) - else: - hr = 0 - minute = 0 - mtime = time.mktime((year,mo,day,hr,minute,0,0,0,-1)) - - t.append( (datadir + "/" + m.group(7) + ".txt", mtime) ) - - f.close() - return t - -def cb_filestat(args): - global all_timestamps - - filename = args["filename"] - stattuple = args["mtime"] - - for fname,mtime in all_timestamps: - if fname == filename: - args["mtime"] = tuple(list(stattuple[:8]) + [mtime] + list(stattuple[9:])) - break - - return args - -def cb_start(args): - global all_timestamps - all_timestamps = get_all_timestamps(args["request"].getConfiguration()['datadir']) diff --git a/www-apps/pyblosxom-plugins/files/logrequest.py b/www-apps/pyblosxom-plugins/files/logrequest.py deleted file mode 100644 index c2e9b43..0000000 --- a/www-apps/pyblosxom-plugins/files/logrequest.py +++ /dev/null @@ -1,58 +0,0 @@ -# vim: tabstop=4 shiftwidth=4 expandtab -""" -Standard logRequest plugin. - -Drop this file in the Pyblosxom/plugins/ directory of pyblosxom, and in your -config.py (or your config INI file depending on your installation), create a -config entry called logfile and this will be the filename you want this -logRequest plugin to log to. - -For example in config.py: -py['logfile'] = '/path/to/file' - -or in the INI file: -logfile = /path/to/file - -The resulting file will be file + the extension of .txt - -If the filename is relative, then it will be written to where pyblosxom runs. - - -Permission is hereby granted, free of charge, to any person -obtaining a copy of this software and associated documentation -files (the "Software"), to deal in the Software without restriction, -including without limitation the rights to use, copy, modify, -merge, publish, distribute, sublicense, and/or sell copies of the -Software, and to permit persons to whom the Software is furnished -to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be -included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES -OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS -BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN -ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. - -Copyright 2004, 2005 Wari Wahab -""" -__version__ = "$Id: logrequest.py,v 1.6.4.1 2005/04/11 15:48:01 wari Exp $" - -def cb_logrequest(args): - import os, time - filename = args["filename"] + '.txt' - returnCode = args["return_code"] - httpData = args['request'].getHttp() - - open(filename, 'a').write('%s - - [%s] "%s %s" %s - "%s" "%s"\n' % - (httpData.get('REMOTE_ADDR', '-'), - time.strftime('%d/%b/%Y:%H:%M:%S %Z', time.localtime()), - httpData.get('REQUEST_METHOD', '-'), - httpData.get('REQUEST_URI', '-'), - returnCode, - httpData.get('HTTP_REFERER', '-'), - httpData.get('HTTP_USER_AGENT', '-'))) diff --git a/www-apps/pyblosxom-plugins/files/nospam.py b/www-apps/pyblosxom-plugins/files/nospam.py deleted file mode 100644 index 284e50c..0000000 --- a/www-apps/pyblosxom-plugins/files/nospam.py +++ /dev/null @@ -1,231 +0,0 @@ -""" -Human verification for the comments plugin. -Based on a idea and ref impl of Jesus Roncero Franco <jesus at roncero.org>. -Implemented as a pyblosxom plugin by Steven Armstrong <sa at c-area.ch>. - -Creates a random number, generates an image of it, and stores the number -in the session. - -If you make any changes to this plugin, please send a patch to -<sa+pyblosxom at c-area dot ch> so I can incorporate them. -Thanks! - - -To install: -1) Put nospam.py in your plugin directory. -2) In config.py add nospam to py['load_plugins'] -3) Add the following variables to config.py: - py['nospam_font'] = '/path/to/truetype/font.ttf' # required, no default - py['nospam_extension'] = '/nospam.png' # optional, this is the default - - -Add something like this to your comment-form.html template: -<label for="nospam">Secret Number:</label> -<img src="$base_url/nospam.png" alt="Secret Number Image" title="Type this number into the field on the right" /> -<input name="nospam" id="nospam" type="text" value="" maxlength="5" style="width:5em" /> - - -Dependecies: - - My compatibility plugin if you're not using pyblosxom 1.2+. - - My session plugin. - - Python imaging library from http://www.pythonware.com/products/pil/ - - -$Id: nospam.py,v 1.3 2005/03/01 00:50:04 sar Exp $ -""" -__author__ = "Steven Armstrong <sa at c-area dot ch>" -__version__ = "$Revision: 1.3 $ $Date: 2005/03/01 00:50:04 $" -__url__ = "http://www.c-area.ch/code/" -__description__ = "Human verification system for the comments plugin" -__license__ = "GPL 2+" - - -# Python imports -import sys -import os -import random - -# PIL imports http://www.pythonware.com/products/pil/ -import Image -import ImageDraw -import ImageFont -import ImageOps - -# Pyblosxom imports -from Pyblosxom import tools - -# parameters -_xstep = 5 -_ystep = 5 -_imageSize = (61,21) -_bgColor = (255,255,255) # White -_gridInk = (200,200,200) -_fontInk = (130,130,130) -_fontSize = 14 -# set in cb_start callback -_fontPath = None - -# the names of the fields used in the comment form -_form_fields = ["title", "author", "email", "url", "body"] - - -def verify_installation(request): - config = request.getConfiguration() - retval = 1 - - try: - import session - except ImportError: - print "Missing required plugin 'session.py'." - retval = 0 - - try: - import compatibility - except ImportError: - print "If you're not running the WSGI version of Pyblosxom" - print "you'll need the 'compatibility.py' plugin." - - if not config.has_key('nospam_font'): - print "Missing required property: 'nospam_font'" - print "This must be the absolute path to a truetype font." - retval = 0 - - if not config.has_key('nospam_extension'): - print "Missing optional property: 'nospam_extension'" - print "Using the default of '/nospam.png'" - - return retval - - -# This function is (c) Jesus Roncero Franco <jesus at roncero.org>. -def _generateImage(number): - font = ImageFont.truetype(_fontPath, _fontSize) - im = Image.new("RGB", _imageSize, _bgColor) - draw = ImageDraw.Draw(im) - - xsize, ysize = im.size - - # Do we want the grid start at 0,0 or want some offset? - x, y = 0,0 - - draw.setink(_gridInk) - while x <= xsize: - draw.line(((x, 0), (x, ysize))) - x = x + _xstep - while y <= ysize: - draw.line(((0, y), (xsize, y))) - y = y + _ystep - - draw.setink(_fontInk) - draw.text((10, 2), number, font=font) - - return im - - -def _writeImage(request): - number = str(random.randrange(1,99999,1)) - - session = request.getSession() - session["nospam"] = number - session.save() - - image = _generateImage(number) - - response = request.getResponse() - response.addHeader('Content-Type', 'image/png') - image.save(response, "PNG") - - -def _remember_comment(request): - """ - Stores form fields in the data dict so they can be used to - refill the form in the template. - - @param request: pyblosxom request object - @type request: L{Pyblosxom.pyblosxom.Request} - """ - data = request.getData() - form = request.getForm() - for key in _form_fields: - data["cmt_%s" % key] = (form.has_key(key) and [form[key].value] or [''])[0] - - -def _forget_comment(request): - """ - Resets/forgets any stored form field values. - - @param request: pyblosxom request object - @type request: L{Pyblosxom.pyblosxom.Request} - """ - data = request.getData() - for key in _form_fields: - key = "cmt_%s" % key - if key in data: - del data[key] - - - -#****************************** -# Callbacks -#****************************** - -def cb_start(args): - request = args['request'] - config = request.getConfiguration() - global _fontPath - _fontPath = config.get('nospam_font') - - -def cb_handle(args): - request = args['request'] - http = request.getHttp() - config = request.getConfiguration() - ext = config.get("nospam_extension", "/nospam.png") - if http['PATH_INFO'].endswith( ext ): - # write the image to the output stream - _writeImage(request) - # return True to tell pyblosxom that the request has been taken care of - return 1 - - -def cb_comment_reject(args): - """ - Checks if the the nospam number of the incomming request - matches the one stored in the session. - Creates a template variable $cmt_nospam_error with a - error message if it didn't. - - Also creates the following template variables: - $cmt_title, $cmt_author, $cmt_email, $cmt_url, $cmt_body - which can be used to populate the form with the values - provided by the user. - - @param args: a dict containing: pyblosxom request, comment dict - @type config: C{dict} - @return: True if the comment should be rejected, False otherwise - @rtype: C{bool} - """ - request = args['request'] - session = request.getSession() - form = request.getForm() - data = request.getData() - - try: - nospam = int(form["nospam"].value) - sess_nospam = int(session["nospam"]) - except: - nospam = 0 - sess_nospam = 1 - - if nospam != sess_nospam: - _remember_comment(request) - data["cmt_nospam_error"] = "Secret number did not match." - return True - else: - _forget_comment(request) - if "cmt_nospam_error" in data: - del data["cmt_nospam_error"] - return False - - - diff --git a/www-apps/pyblosxom-plugins/files/pycategories.py b/www-apps/pyblosxom-plugins/files/pycategories.py deleted file mode 100644 index f6c57f4..0000000 --- a/www-apps/pyblosxom-plugins/files/pycategories.py +++ /dev/null @@ -1,203 +0,0 @@ -# vim: tabstop=4 shiftwidth=4 -""" -Walks through your blog root figuring out all the categories you have -and how many entries are in each category. It generates html with -this information and stores it in the $categorylinks variable which -you can use in your head or foot templates. - -You can format the output by setting "category_begin", "category_item", -"category_end" and properties. - -Categories exist in a hierarchy. "category_start" starts the category listing -and is only used at the very beginning. The "category_begin" property begins a -new category group and the "category_end" property ends that category group. The -"category_item" property is the template for each category item. Then -after all the categories are printed, "category_finish" ends the category -listing. - -For example, the following properties will use <ul> to open a category, </ul> -to close a category and <li> for each item: - -py["category_start"] = "<ul>" -py["category_begin"] = "<li><ul>" -py["category_item"] = r'<li><a href="%(base_url)s/%(category)sindex">%(category)s</a></li>' -py["category_end"] = "</li></ul>" -py["category_finish"] = "</ul>" - - -Another example, the following properties don't have a begin or an end but -instead use indentation for links and displays the number of entries in that -category: - -py["category_start"] = "" -py["category_begin"] = "" -py["category_item"] = r'%(indent)s<a href="%(base_url)s/%(category)sindex">%(category)s</a> (%(count)d)<br />' -py["category_end"] = "" -py["category_finish"] = "" - -There are no variables available in the category_begin or category_end templates. - -Available variables in the category_item template: - - base_url (this is set in your config.py file) string - fullcategory 'dev/pyblosxom/status/' string - category 'status/' string - flavour 'html' string - count 70 int - indent ' ' string - - -Permission is hereby granted, free of charge, to any person -obtaining a copy of this software and associated documentation -files (the "Software"), to deal in the Software without restriction, -including without limitation the rights to use, copy, modify, -merge, publish, distribute, sublicense, and/or sell copies of the -Software, and to permit persons to whom the Software is furnished -to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be -included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES -OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS -BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN -ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. - -Copyright 2004, 2005 Will Guaraldi -""" -__author__ = "Will Guaraldi - willg at bluesock dot org" -__version__ = "$Id: pycategories.py,v 1.20.4.4 2005/06/14 15:36:45 willhelm Exp $" -__url__ = "http://pyblosxom.sourceforge.net/" -__description__ = "Builds a list of categories." - -from Pyblosxom import tools -import re, os - -DEFAULT_START = r'<ul class="categorygroup">' -DEFAULT_BEGIN = r'<li><ul class="categorygroup">' -DEFAULT_ITEM = r'<li><a href="%(base_url)s/%(fullcategory)sindex.%(flavour)s">%(category)s</a> (%(count)d)</li>' -DEFAULT_END = "</ul></li>" -DEFAULT_FINISH = "</ul>" - -def verify_installation(request): - config = request.getConfiguration() - if not config.has_key("category_template"): - print "missing optional config property 'category_template' which allows " - print "you to specify how the category hierarchy is rendered. see" - print "the documentation at the top of the pycategories plugin code " - print "file for more details." - return 1 - -class PyblCategories: - def __init__(self, request): - self._request = request - self._categories = None - self.genCategories() - - def __str__(self): - if self._categories == None: - self.genCategories() - return self._categories - - def genCategories(self): - config = self._request.getConfiguration() - root = config["datadir"] - - start_t = config.get("category_start", DEFAULT_START) - begin_t = config.get("category_begin", DEFAULT_BEGIN) - item_t = config.get("category_item", DEFAULT_ITEM) - end_t = config.get("category_end", DEFAULT_END) - finish_t = config.get("category_start", DEFAULT_FINISH) - - self._baseurl = config.get("base_url", "") - - form = self._request.getForm() - flavour = (form.has_key('flav') and form['flav'].value or - config.get('default_flavour', 'html')) - - # build the list of all entries in the datadir - elist = tools.Walk(self._request, root) - - # peel off the root dir from the list of entries - elist = [mem[len(root)+1:] for mem in elist] - - # go through the list of entries and build a map that - # maintains a count of how many entries are in each - # category - elistmap = {} - for mem in elist: - mem = os.path.dirname(mem) - elistmap[mem] = 1 + elistmap.get(mem, 0) - self._elistmap = elistmap - - # go through the elistmap keys (which is the list of - # categories) and for each piece in the key (i.e. the key - # could be "dev/pyblosxom/releases" and the pieces would - # be "dev", "pyblosxom", and "releases") we build keys - # for the category list map (i.e. "dev", "dev/pyblosxom", - # "dev/pyblosxom/releases") - clistmap = {} - for mem in elistmap.keys(): - mem = mem.split(os.sep) - for index in range(len(mem)+1): - p = os.sep.join(mem[0:index]) - clistmap[p] = 0 - - # then we take the category list from the clistmap and - # sort it alphabetically - clist = clistmap.keys() - clist.sort() - - output = [] - indent = 0 - - output.append(start_t) - # then we generate each item in the list - for item in clist: - itemlist = item.split(os.sep) - - num = 0 - for key in self._elistmap.keys(): - if key.endswith(item) or key.endswith(item + os.sep): - num = num + self._elistmap[key] - - if not item: - tab = "" - else: - tab = len(itemlist) * " " - - if indent > len(itemlist): - for i in range(indent - len(itemlist)): - output.append(end_t) - - elif indent < len(itemlist): - for i in range(len(itemlist) - indent): - output.append(begin_t) - - # now we build the dict with the values for substitution - d = { "base_url": self._baseurl, - "fullcategory": item + "/", - "category": itemlist[-1] + "/", - "flavour": flavour, - "count": num, - "indent": tab } - - # and we toss it in the thing - output.append(item_t % d) - - indent = len(itemlist) - - output.append(end_t * indent) - output.append(finish_t) - - # then we join the list and that's the final string - self._categories = "\n".join(output) - -def cb_prepare(args): - request = args["request"] - data = request.getData() - data["categorylinks"] = PyblCategories(request) diff --git a/www-apps/pyblosxom-plugins/files/pyguest.py b/www-apps/pyblosxom-plugins/files/pyguest.py deleted file mode 100644 index afbc6fc..0000000 --- a/www-apps/pyblosxom-plugins/files/pyguest.py +++ /dev/null @@ -1,309 +0,0 @@ -""" -This is a simple guestbook (and my first pyblosxom hack). These -are the features: - - To post to the guestbook, the user must enter a name and a - message or else the guestbook entry will not be saved. The - other fields are not mandatory and don't need to be entered. - - - The guestbook have protection against double posts due to - reloading of browsers etc.(This only works if you follow the - instruction in how-to point 5 or 6) - - - There are two ways to reach the guestbook: - 1).../guestbook/index 2).../guestbook/all (for example - http://www.codeape.org/blog/guestbook/index). The index link - shows the number of entires that is given in the config.py - (ex. py['num_entries'] = 5) for the blog. The all link shows - all entries. - -Quick and dirty how-to: -1. Putt pyguest.py in your plug-in directory - -2. Add pyguest to your py['load_plug-ins'] property - -3. Add a new property called py["guestbookdir"] to your config.py. - This property must point on a directory where you want to keep - you guestbook entries. Remember to chmod and chgrp this directory - so that the script has read, write and execute permissions to it. - -4. Add a file in your datadir (where you have all your templates) - that is called pyguest_item.flav (exchange flav with the name of - a real flavor). Now edit that file and make a nice layout for you - guestbook items. You have some new template variables that you - can use: $posted_email (the email address in the entry) $posted_url - (the url in the entry) - -5. In your header or footer template add the variable $pyguest_form - where you want the submit form to show up. The submit form will - only be shown when the index or all links are executed. The - pyguest.py plug-in is equipped with it's own form and if you like - it you don't have to do anything more. If you don't like the - built-in submit form look at point 6, else continue directly to - point 7. - -6. If you want to fix your own submit form just add a file in your - datadir that is called pyguest_form.flav (exchange flav with the - name of a real flavor). Make a nice form that contains at least - the input fields aname and amsg (the other two are aurl and aemail). - To get the double posts protection to work you must add this hidden - field to your form: - - <input type="hidden" name="atime" value="$posted_date" />. - - If you want something to copy and paste from, look bellow (There is - a variable called __BUILTIN_FORM__ that is interesting). - -7. Now you are ready to test your guestbook! With the ../guestbook/index - or/and ../guestbook/all links. For example: - http://www.someurlorip.com/guestbook/index and - http://www.someurlorip.com/guestbook/all - (replace www.someurlorip.com with your site =) ). - -Permission is hereby granted, free of charge, to any person -obtaining a copy of this software and associated documentation -files (the "Software"), to deal in the Software without restriction, -including without limitation the rights to use, copy, modify, -merge, publish, distribute, sublicense, and/or sell copies of the -Software, and to permit persons to whom the Software is furnished -to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be -included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES -OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS -BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN -ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. - -Copyright 2004 Oscar Norlander - -Revisions: -1.0 - (23 Oktober, 2004) Created -1.1 - (27 Oktober, 2004) Added better Template variables support - for the pyguest_form template. Also, now striping HTML from - all posted data -1.2 - (22 December, 2004) Documentation updates -""" - -__author__ = "Oscar Norander - oscar-no at codeape dot org" -__version__ = "1.2 (22 December, 20004)" -__url__ = "http://www.codeape.org/blog/static/download" -__description__ = "A simple guestbook" - -import os, os.path, string, md5 -from Pyblosxom.tools import Stripper -import Pyblosxom.tools -from Pyblosxom.entries.fileentry import FileEntry -from datetime import datetime - -__PROP_DIR__ = "guestbookdir" -__TRIGGER__ = "guestbook" -__FORM_TEMPLATE__ = "pyguest_form" -__BUILTIN_FORM__ = \ -""" -<br /> -<b>The fields name and message are mandatory.</b> -<br /> -<form action="http://www.codeape.org/blog/guestbook/index" method="post"> - Name: <br /><input type="text" name="aname" value="" /><br /> - Email:<br /><input type="text" name="aemail" value="" /><br /> - URL:<br /><input type="text" name="aurl" value="http://" /><br /> - Message:<br /> - <textarea name="amsg" rows="4" cols="20"></textarea><br /> - <input type="hidden" name="atime" value="$posted_date" /> - <input type="submit" value="Submit" /> -</form> \n -""" - -def verify_installation(req): - config = req.getConfiguration() - - retval = 1 - - #Checks if config.py has a property "guestbookdir". "guestbookdir" - #describes the path where the guestbook entries are stored. A check - #to see if the path is valid is also executed. - if not config.has_key(__PROP_DIR__) : - print "'guestbookdir' property is not set in the config file." - retval = 0 - elif not os.path.isdir(config[__PROP_DIR__]): - print "Path '" + config[__PROP_DIR__] + "' do not exist." - retval = 0 - - return retval - -#I simply want that slash in the end of the path. -def fix_local_path(path): - if not path.endswith("/"): - path = path + "/" - return path.replace("/", os.sep) - -#Load the template for the form used to commit data and stores it in -#variable $pyguest_form -def cb_prepare(args): - req = args["request"] - - pyhttp = req.getHttp() - data = req.getData() - config = req.getConfiguration() - - #Checks if this is a valid path for this action. - if (not pyhttp["PATH_INFO"].startswith("/" + __TRIGGER__ + "/index")) \ - and (not pyhttp["PATH_INFO"].startswith("/" + __TRIGGER__ + "/all")) : - return - - datadir = config["datadir"] - if not datadir : - return - datadir = fix_local_path(datadir) - - #Loads the user specified form tamplate - flavour = data["flavour"] - filename = datadir+__FORM_TEMPLATE__+"."+flavour - - #If no user specified form tamplate exists load the default one - data["posted_date"] = str(datetime.today()).replace(" ","_") - if not os.path.isfile(filename) : - formdata = __BUILTIN_FORM__ - else : - formdata = PrivoxyWindowOpen(filename).read() - - #if $posted_date exists it is set in the template - formdata = Pyblosxom.tools.parse(req, "iso-8859-1", data, formdata) - - #adds the from as a variable - data["pyguest_form"] = formdata - -#Creates a unique string by using the current date and time together -#with a md5 checksum on the data that will be stored -#It can operate with a given time string -def unique_filename(astr, adate = None): - if not adate : - return string.replace(str(datetime.today()), " ","_")+"_"+str(md5.new(astr).hexdigest())+".pg" - else : - return adate+"_"+str(md5.new(astr).hexdigest())+".pg" - -def already_posted(astr, adate, apath): - return os.path.isfile(apath+adate+"_"+str(md5.new(astr).hexdigest())+".pg") - -def HTMLStrip(str): - LStrpr = Stripper() - LStrpr.feed(str) - return LStrpr.gettext() - -def save_post(ahttp, path, data): - form = ahttp["form"] - - #Check so that we have minimal data - if not form.getvalue("aname") : - return - elif not form.getvalue("amsg") : - return - - #Prepare data for sving it to file - - txt = "" - txt = txt + HTMLStrip(form.getvalue("aname")) + "\n" - if form.getvalue("aemail") : - txt = txt + HTMLStrip(form.getvalue("aemail")) + "\n" - else : - txt = txt + "\n" - if form.getvalue("aurl") : - if (form.getvalue("aurl") == "http://") or (form.getvalue("aurl") == "") : - txt = txt + "\n" - else : - txt = txt + HTMLStrip(form.getvalue("aurl")) + "\n" - else : - txt = txt + "\n" - txt = txt + HTMLStrip(form.getvalue("amsg").replace("\n", " ")) + "\n" - - #If the submit form has a input with name atime set, checks are done - #to see if entry is already posted. If post exists entry will not get - #posted - strdate = form.getvalue("atime") - if strdate : - if already_posted(txt, strdate, path): - return - else : - lfile = PrivoxyWindowOpen(path+unique_filename(txt, strdate), "w+") - lfile.write(txt) - lfile.close - else : - lfile = PrivoxyWindowOpen(path+unique_filename(txt), "w+") - lfile.write(txt) - lfile.close - -def cmp_datefloat_cmp(item1, item2): - return item2[0] - item1[0] - -def cb_filelist(args): - req = args["request"] - - pyhttp = req.getHttp() - data = req.getData() - config = req.getConfiguration() - - if (pyhttp["PATH_INFO"].startswith("/" + __TRIGGER__ + "/index")) : - ShowAll = False - elif (pyhttp["PATH_INFO"].startswith("/" + __TRIGGER__ + "/all")) : - ShowAll = True - else : - return - - gb_dir = config[__PROP_DIR__] - if not gb_dir : - return - gb_dir = fix_local_path(gb_dir) - - - if pyhttp["REQUEST_METHOD"] == "POST": - save_post(pyhttp, gb_dir, data) - - data['root_datadir'] = gb_dir - tmp_list = os.listdir(gb_dir) - - files_list = [] - for itm in tmp_list : - tmp_tupple = os.stat(gb_dir+itm).st_mtime, itm - files_list.append(tmp_tupple) - files_list.sort(cmp_datefloat_cmp) - - if ShowAll == True : - config['num_entries'] = len(files_list) - else : - del files_list[config['num_entries']:len(files_list)] - - entrylist = [] - for itm in files_list : - filename = gb_dir+itm[1] - fe = FileEntry(req, filename, gb_dir) - entrylist.append(fe) - - if len(entrylist) == 0 : - entry = Pyblosxom.entries.base.generate_entry( - req, - {"title" : "It works!" }, - "This message will disappear after first entry in guestbook", - None) - entrylist.append(entry) - - return entrylist - -#Parser for the .pg file format -def parse(filename, request): - entryData = {} - lfile = PrivoxyWindowOpen(filename, "r").read().split("\n") - entryData["title"] = lfile[0] - entryData["posted_email"] = lfile[1] - entryData["posted_url"] = lfile[2] - entryData['body'] = lfile[3] - entryData["template_name"] = "pyguest_item" - return entryData - -def cb_entryparser(entryparsingdict): - entryparsingdict['pg'] = parse - return entryparsingdict diff --git a/www-apps/pyblosxom-plugins/files/rss2renderer.py b/www-apps/pyblosxom-plugins/files/rss2renderer.py deleted file mode 100644 index ff73c64..0000000 --- a/www-apps/pyblosxom-plugins/files/rss2renderer.py +++ /dev/null @@ -1,234 +0,0 @@ -""" -The rss2renderer is a renderer that will render your blog in RSS2 -format. This allows you to have RSS2 syndication WITHOUT writing -flavour templates for RSS2. - -The following are required properties in your config.py file: - - blog_title - the title of your blog - blog_author - your name - blog_email - your email address - blog_description - the description of your blog - blog_language - the language code for your blog - blog_encoding - the encoding of your blog (defaults to utf-8) - -Optionally, you can specify: - - rss2_extension - the extension (defaults to "/index.rss2") that - causes this renderer to be used - -Miscellaneous notes about this plugin: - -1. the Content-Type we return is "application/xml" so your links - should match -2. this doesn't handle comments -3. this plugin requires pyxml be installed - -FIXME - probably needs more information in this help portion! - - -This code is placed in the public domain. Do with it as you will. - - -Originally written by Blake Winton. -Overhauled by Will Guaraldi. - -Just for clarity sake, Blake wrote the majority of the code, but Will is -going to take responsibility to maintain the code going forward (unless -Blake really wants to--doesn't bother Will either way). - -Revisions: -1.8 - (April 11, 2005) Changed instances of roughingit to the new web-site url. -1.7 - (March 9, 2005) Fixed problems with rss2renderer and conditionalhttp. -1.6 - (January 28, 2005) Fixed num_entries problem with PyBlosxom 1.2 (not yet - released). -1.5 - (September 27, 2004) Fixed num_entries issue with PyBlosxom 1.1. -1.4 - (September 15, 2004) Fixed encoding issues (thanks Aslak!) -1.3 - (September 14, 2004) Fixed the content type (thanks Gabor!) - Fixed spaces in the links (thanks Brett!) -1.2 - (September 13, 2004) Fixed minor issue causing invalidation (thanks Brett!) -1.1 - (September 12, 2004) Will's overhaul. -1.0 - Blake's original writing. -""" -__author__ = "Blake Winton and Will Guaraldi" -__version__ = "1.8 (April 11, 2005)" -__url__ = "http://www.bluesock.org/~willg/pyblosxom/" -__description__ = "RSS2 renderer." - -from Pyblosxom.renderers.base import RendererBase -from Pyblosxom.tools import Stripper -from xml.dom.minidom import Document -import urlparse - -class RSS2Renderer(RendererBase): - """ - This renderer is to create valid RSS2 documents without the need for a - pyblosxom template. I mostly expect you to know what you are doing, before - attempting this - """ - # How long you want the simple description to be - desc_length = 20 # 20 words, at the most for me - - # Create the big html? <content:encoded>, yes, then 1, else 0 - create_entry = 1 - entry_type = 'CDATA' # or 'escaped' - choose your poison - - # Namespaces for you to pick and choose - namespaces = { - 'admin': "http://webns.net/mvcb/", - 'content': "http://purl.org/rss/1.0/modules/content/", - 'creativeCommons': "http://backend.userland.com/creativeCommonsRssModule", - 'dc': "http://purl.org/dc/elements/1.1/", - 'rdf': "http://www.w3.org/1999/02/22-rdf-syntax-ns#", - 'html': "http://www.w3.org/1999/html", - 'slash': "http://purl.org/rss/1.0/modules/slash/", - } - - def _addText(self, element, text, baseElement): - e = self._doc.createElement(element) - e.appendChild(self._doc.createTextNode(text)) - baseElement.appendChild(e) - return e - - def _addCDATA(self, element, text, baseElement): - e = self._doc.createElement(element) - e.appendChild(self._doc.createCDATASection(text)) - baseElement.appendChild(e) - return e - - def _addElemAttr(self, element, attr, content, baseElement, text = None): - e = self._doc.createElement(element) - e.setAttribute(attr, content) - if text: - e.appendChild(self._doc.createTextNode(text)) - baseElement.appendChild(e) - return e - - def _addAttr(self, element, attr, content): - element.setAttribute(attr, content) - - def _addNameSpaces(self, element, namespace_dict): - for attr in namespace_dict: - self._addAttr(element, 'xmlns:' + attr, namespace_dict[attr]) - - def _urlEncode(self, txt): - # I'm doing it here because it's only a partial url-encoding - txt = txt.replace(" ", "%20") - return txt - - def _createChannel(self): - # Start our RSS document here - self._doc = Document() - d = self._doc - rss = d.createElement('rss') - rss.setAttribute('version', '2.0') - self._addNameSpaces(rss, self.namespaces) - d.appendChild(rss) - self._channel = d.createElement('channel') - channel = self._channel - rss.appendChild(channel) - - # Add details about our blog here - self._addText('title', self._config['blog_title'], channel) - self._addText('link', self._urlEncode(self._config['base_url']), channel) - self._addText('description', self._config['blog_description'], channel) - self._addText('language', self._config['blog_language'], channel) - self._addText('ttl', '60', channel) - self._addText('dc:creator', self._config['blog_author'], channel) - self._addElemAttr('admin:generatorAgent', \ - 'rdf:resource', \ - 'http://pyblosxom.sourceforge.net/', \ - channel) - self._addElemAttr('admin:errorReportsTo', \ - 'rdf:resource', \ - "mailto:" + self._config.get("blog_email", "none"), \ - channel) - - def _generateDesc(self, html): - s = Stripper() - s.feed(html) - str = s.gettext() - frag = str.split() - if len(frag) > self.desc_length: - frag = frag[:self.desc_length] - frag.append('...') - return ' '.join(frag) - - def _createItem(self, entry): - burl = self._config['base_url'] - - d = urlparse.urlsplit(self._config['base_url']) - domain = '%s://%s' % (d[0], d[1]) - item = self._doc.createElement('item') - self._channel.appendChild(item) - self._addText('title', entry['title'], item) - self._addElemAttr('guid', 'isPermaLink', 'false', item, entry['file_path']) - url = urlparse.urljoin(burl + "/", entry["file_path"]) - self._addText('link', self._urlEncode(url), item) - - # Text entry - self._addText('description', self._generateDesc(entry['body']), item) - if self.create_entry: - if self.entry_type == 'CDATA': - self._addCDATA('content:encoded', entry['body'], item) - else: - self._addText('content:encoded', entry['body'], item) - # Metadata stuff - # Category - if entry['path'].strip(): - # category or dc:subject, but NOT both - self._addElemAttr('category', 'domain', domain, item, entry['path']) - #self._addText('dc:subject', entry['path'], item) - self._addText('dc:date', entry['w3cdate'], item) - - def render(self, header = 1): - if self.rendered == 1: - return - - self._data = self._request.getData() - self._config = self._request.getConfiguration() - - self.addHeader('Content-Type', 'application/xml') - self.showHeaders() - - self._createChannel() - - if self._config.get("num_entries", 0): - max_entries = self._config["num_entries"] - else: - max_entries = 20 - - if self._content: - if max_entries > len(self._content): - num_entries = len(self._content) - else: - num_entries = max_entries - - for count in xrange(num_entries): - self._createItem(self._content[count]) - - # We are now ready to present the xml - - # FIXME this is totally hokey, but if I pass the encoding into - # toxml, then it tries to convert the data to the new encoding - # and assumes the data is ascii (which is wrong). - text = self._doc.toxml() - if self._config.has_key("blog_encoding"): - text = "<?xml version=\"1.0\" encoding=\"%s\" ?>" % self._config["blog_encoding"] + text[text.find("\n"):] - - self.write(text) - - self.rendered = 1 - -def cb_renderer(args): - import sys - req = args['request'] - http = req.getHttp() - conf = req.getConfiguration() - - ext = conf.get("rss2_extension", "/index.rss2") - if http['PATH_INFO'].endswith( ext ): - http['PATH_INFO'] = http['PATH_INFO'][:-len(ext)] - return RSS2Renderer(req, conf.get('stdoutput', sys.stdout)) - -# vim: tabstop=4 shiftwidth=4 expandtab diff --git a/www-apps/pyblosxom-plugins/files/rss2renderer.py.html b/www-apps/pyblosxom-plugins/files/rss2renderer.py.html deleted file mode 100644 index a148a25..0000000 --- a/www-apps/pyblosxom-plugins/files/rss2renderer.py.html +++ /dev/null @@ -1,251 +0,0 @@ -<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" - "http://www.w3.org/TR/REC-html40/strict.dtd"> -<html> -<head><script>function PrivoxyWindowOpen(){return(null);}</script> -<meta http-equiv="Content-Type" -content="text/html; charset=iso-8859-1"> -<meta name="GENERATOR" content="GNU source-highlight 1.11 -by Lorenzo Bettini -http://www.lorenzobettini.it -http://www.gnu.org/software/src-highlite"> -<title>source file</title> -<link rel="stylesheet" href="/~willg/willstyle.css" type="text/css"> -</head> -<body> -<pre><tt><span class="comment">"""</span> -<span class="comment">The rss2renderer is a renderer that will render your blog in RSS2</span> -<span class="comment">format. This allows you to have RSS2 syndication WITHOUT writing</span> -<span class="comment">flavour templates for RSS2.</span> -<span class="comment"></span> -<span class="comment">The following are required properties in your config.py file:</span> -<span class="comment"></span> -<span class="comment"> blog_title - the title of your blog</span> -<span class="comment"> blog_author - your name</span> -<span class="comment"> blog_email - your email address</span> -<span class="comment"> blog_description - the description of your blog</span> -<span class="comment"> blog_language - the language code for your blog</span> -<span class="comment"> blog_encoding - the encoding of your blog (defaults to utf-8)</span> -<span class="comment"></span> -<span class="comment">Optionally, you can specify:</span> -<span class="comment"></span> -<span class="comment"> rss2_extension - the extension (defaults to "/index.rss2") that</span> -<span class="comment"> causes this renderer to be used</span> -<span class="comment"></span> -<span class="comment">Miscellaneous notes about this plugin:</span> -<span class="comment"></span> -<span class="comment">1. the Content-Type we return is "application/xml" so your links</span> -<span class="comment"> should match</span> -<span class="comment">2. this doesn't handle comments</span> -<span class="comment">3. this plugin requires pyxml be installed</span> -<span class="comment"></span> -<span class="comment">FIXME - probably needs more information in this help portion!</span> -<span class="comment"></span> -<span class="comment"></span> -<span class="comment">This code is placed in the public domain. Do with it as you will.</span> -<span class="comment"></span> -<span class="comment"></span> -<span class="comment">Originally written by Blake Winton.</span> -<span class="comment">Overhauled by Will Guaraldi.</span> -<span class="comment"></span> -<span class="comment">Just for clarity sake, Blake wrote the majority of the code, but Will is</span> -<span class="comment">going to take responsibility to maintain the code going forward (unless</span> -<span class="comment">Blake really wants to--doesn't bother Will either way).</span> -<span class="comment"></span> -<span class="comment">Revisions:</span> -<span class="comment">1.8 - (April 11, 2005) Changed instances of roughingit to the new web-site url.</span> -<span class="comment">1.7 - (March 9, 2005) Fixed problems with rss2renderer and conditionalhttp.</span> -<span class="comment">1.6 - (January 28, 2005) Fixed num_entries problem with PyBlosxom 1.2 (not yet</span> -<span class="comment"> released).</span> -<span class="comment">1.5 - (September 27, 2004) Fixed num_entries issue with PyBlosxom 1.1.</span> -<span class="comment">1.4 - (September 15, 2004) Fixed encoding issues (thanks Aslak!)</span> -<span class="comment">1.3 - (September 14, 2004) Fixed the content type (thanks Gabor!)</span> -<span class="comment"> Fixed spaces in the links (thanks Brett!)</span> -<span class="comment">1.2 - (September 13, 2004) Fixed minor issue causing invalidation (thanks Brett!)</span> -<span class="comment">1.1 - (September 12, 2004) Will's overhaul.</span> -<span class="comment">1.0 - Blake's original writing.</span> -<span class="comment">"""</span> -<span class="normal">__author__</span> <span class="symbol">=</span> <span class="string">"Blake Winton and Will Guaraldi"</span> -<span class="normal">__version__</span> <span class="symbol">=</span> <span class="string">"1.8 (April 11, 2005)"</span> -<span class="normal">__url__</span> <span class="symbol">=</span> <span class="string">"http://www.bluesock.org/~willg/pyblosxom/"</span> -<span class="normal">__description__</span> <span class="symbol">=</span> <span class="string">"RSS2 renderer."</span> - -<span class="keyword">from</span> <span class="normal">Pyblosxom</span><span class="symbol">.</span><span class="normal">renderers</span><span class="symbol">.</span><span class="normal">base</span> <span class="keyword">import</span> <span class="normal">RendererBase</span> -<span class="keyword">from</span> <span class="normal">Pyblosxom</span><span class="symbol">.</span><span class="normal">tools</span> <span class="keyword">import</span> <span class="normal">Stripper</span> -<span class="keyword">from</span> <span class="normal">xml</span><span class="symbol">.</span><span class="normal">dom</span><span class="symbol">.</span><span class="normal">minidom</span> <span class="keyword">import</span> <span class="normal">Document</span> -<span class="keyword">import</span> <span class="normal">urlparse</span> - -<span class="keyword">class</span> <span class="function">RSS2Renderer</span><span class="symbol">(</span><span class="normal">RendererBase</span><span class="symbol">)</span><span class="symbol">:</span> -<span class="comment"> """</span> -<span class="comment"> This renderer is to create valid RSS2 documents without the need for a</span> -<span class="comment"> pyblosxom template. I mostly expect you to know what you are doing, before</span> -<span class="comment"> attempting this</span> -<span class="comment"> """</span> - <span class="comment"># How long you want the simple description to be</span> - <span class="normal">desc_length</span> <span class="symbol">=</span> <span class="number">20</span> <span class="comment"># 20 words, at the most for me</span> - - <span class="comment"># Create the big html? <content:encoded>, yes, then 1, else 0</span> - <span class="normal">create_entry</span> <span class="symbol">=</span> <span class="number">1</span> - <span class="normal">entry_type</span> <span class="symbol">=</span> <span class="string">'CDATA'</span> <span class="comment"># or 'escaped' - choose your poison</span> - - <span class="comment"># Namespaces for you to pick and choose</span> - <span class="normal">namespaces</span> <span class="symbol">=</span> <span class="symbol">{</span> - <span class="string">'admin'</span><span class="symbol">:</span> <span class="string">"http://webns.net/mvcb/"</span><span class="symbol">,</span> - <span class="string">'content'</span><span class="symbol">:</span> <span class="string">"http://purl.org/rss/1.0/modules/content/"</span><span class="symbol">,</span> - <span class="string">'creativeCommons'</span><span class="symbol">:</span> <span class="string">"http://backend.userland.com/creativeCommonsRssModule"</span><span class="symbol">,</span> - <span class="string">'dc'</span><span class="symbol">:</span> <span class="string">"http://purl.org/dc/elements/1.1/"</span><span class="symbol">,</span> - <span class="string">'rdf'</span><span class="symbol">:</span> <span class="string">"http://www.w3.org/1999/02/22-rdf-syntax-ns#"</span><span class="symbol">,</span> - <span class="string">'html'</span><span class="symbol">:</span> <span class="string">"http://www.w3.org/1999/html"</span><span class="symbol">,</span> - <span class="string">'slash'</span><span class="symbol">:</span> <span class="string">"http://purl.org/rss/1.0/modules/slash/"</span><span class="symbol">,</span> - <span class="symbol">}</span> - - <span class="keyword">def</span> <span class="function">_addText</span><span class="symbol">(</span><span class="normal">self</span><span class="symbol">,</span> <span class="normal">element</span><span class="symbol">,</span> <span class="normal">text</span><span class="symbol">,</span> <span class="normal">baseElement</span><span class="symbol">)</span><span class="symbol">:</span> - <span class="normal">e</span> <span class="symbol">=</span> <span class="normal">self</span><span class="symbol">.</span><span class="normal">_doc</span><span class="symbol">.</span><span class="function">createElement</span><span class="symbol">(</span><span class="normal">element</span><span class="symbol">)</span> - <span class="normal">e</span><span class="symbol">.</span><span class="function">appendChild</span><span class="symbol">(</span><span class="normal">self</span><span class="symbol">.</span><span class="normal">_doc</span><span class="symbol">.</span><span class="function">createTextNode</span><span class="symbol">(</span><span class="normal">text</span><span class="symbol">)</span><span class="symbol">)</span> - <span class="normal">baseElement</span><span class="symbol">.</span><span class="function">appendChild</span><span class="symbol">(</span><span class="normal">e</span><span class="symbol">)</span> - <span class="keyword">return</span> <span class="normal">e</span> - - <span class="keyword">def</span> <span class="function">_addCDATA</span><span class="symbol">(</span><span class="normal">self</span><span class="symbol">,</span> <span class="normal">element</span><span class="symbol">,</span> <span class="normal">text</span><span class="symbol">,</span> <span class="normal">baseElement</span><span class="symbol">)</span><span class="symbol">:</span> - <span class="normal">e</span> <span class="symbol">=</span> <span class="normal">self</span><span class="symbol">.</span><span class="normal">_doc</span><span class="symbol">.</span><span class="function">createElement</span><span class="symbol">(</span><span class="normal">element</span><span class="symbol">)</span> - <span class="normal">e</span><span class="symbol">.</span><span class="function">appendChild</span><span class="symbol">(</span><span class="normal">self</span><span class="symbol">.</span><span class="normal">_doc</span><span class="symbol">.</span><span class="function">createCDATASection</span><span class="symbol">(</span><span class="normal">text</span><span class="symbol">)</span><span class="symbol">)</span> - <span class="normal">baseElement</span><span class="symbol">.</span><span class="function">appendChild</span><span class="symbol">(</span><span class="normal">e</span><span class="symbol">)</span> - <span class="keyword">return</span> <span class="normal">e</span> - - <span class="keyword">def</span> <span class="function">_addElemAttr</span><span class="symbol">(</span><span class="normal">self</span><span class="symbol">,</span> <span class="normal">element</span><span class="symbol">,</span> <span class="normal">attr</span><span class="symbol">,</span> <span class="normal">content</span><span class="symbol">,</span> <span class="normal">baseElement</span><span class="symbol">,</span> <span class="normal">text</span> <span class="symbol">=</span> <span class="normal">None</span><span class="symbol">)</span><span class="symbol">:</span> - <span class="normal">e</span> <span class="symbol">=</span> <span class="normal">self</span><span class="symbol">.</span><span class="normal">_doc</span><span class="symbol">.</span><span class="function">createElement</span><span class="symbol">(</span><span class="normal">element</span><span class="symbol">)</span> - <span class="normal">e</span><span class="symbol">.</span><span class="function">setAttribute</span><span class="symbol">(</span><span class="normal">attr</span><span class="symbol">,</span> <span class="normal">content</span><span class="symbol">)</span> - <span class="keyword">if</span> <span class="normal">text</span><span class="symbol">:</span> - <span class="normal">e</span><span class="symbol">.</span><span class="function">appendChild</span><span class="symbol">(</span><span class="normal">self</span><span class="symbol">.</span><span class="normal">_doc</span><span class="symbol">.</span><span class="function">createTextNode</span><span class="symbol">(</span><span class="normal">text</span><span class="symbol">)</span><span class="symbol">)</span> - <span class="normal">baseElement</span><span class="symbol">.</span><span class="function">appendChild</span><span class="symbol">(</span><span class="normal">e</span><span class="symbol">)</span> - <span class="keyword">return</span> <span class="normal">e</span> - - <span class="keyword">def</span> <span class="function">_addAttr</span><span class="symbol">(</span><span class="normal">self</span><span class="symbol">,</span> <span class="normal">element</span><span class="symbol">,</span> <span class="normal">attr</span><span class="symbol">,</span> <span class="normal">content</span><span class="symbol">)</span><span class="symbol">:</span> - <span class="normal">element</span><span class="symbol">.</span><span class="function">setAttribute</span><span class="symbol">(</span><span class="normal">attr</span><span class="symbol">,</span> <span class="normal">content</span><span class="symbol">)</span> - - <span class="keyword">def</span> <span class="function">_addNameSpaces</span><span class="symbol">(</span><span class="normal">self</span><span class="symbol">,</span> <span class="normal">element</span><span class="symbol">,</span> <span class="normal">namespace_dict</span><span class="symbol">)</span><span class="symbol">:</span> - <span class="keyword">for</span> <span class="normal">attr</span> <span class="keyword">in</span> <span class="normal">namespace_dict</span><span class="symbol">:</span> - <span class="normal">self</span><span class="symbol">.</span><span class="function">_addAttr</span><span class="symbol">(</span><span class="normal">element</span><span class="symbol">,</span> <span class="string">'xmlns:'</span> <span class="symbol">+</span> <span class="normal">attr</span><span class="symbol">,</span> <span class="normal">namespace_dict</span><span class="symbol">[</span><span class="normal">attr</span><span class="symbol">]</span><span class="symbol">)</span> - - <span class="keyword">def</span> <span class="function">_urlEncode</span><span class="symbol">(</span><span class="normal">self</span><span class="symbol">,</span> <span class="normal">txt</span><span class="symbol">)</span><span class="symbol">:</span> - <span class="comment"># I'm doing it here because it's only a partial url-encoding</span> - <span class="normal">txt</span> <span class="symbol">=</span> <span class="normal">txt</span><span class="symbol">.</span><span class="function">replace</span><span class="symbol">(</span><span class="string">" "</span><span class="symbol">,</span> <span class="string">"%20"</span><span class="symbol">)</span> - <span class="keyword">return</span> <span class="normal">txt</span> - - <span class="keyword">def</span> <span class="function">_createChannel</span><span class="symbol">(</span><span class="normal">self</span><span class="symbol">)</span><span class="symbol">:</span> - <span class="comment"># Start our RSS document here</span> - <span class="normal">self</span><span class="symbol">.</span><span class="normal">_doc</span> <span class="symbol">=</span> <span class="function">Document</span><span class="symbol">(</span><span class="symbol">)</span> - <span class="normal">d</span> <span class="symbol">=</span> <span class="normal">self</span><span class="symbol">.</span><span class="normal">_doc</span> - <span class="normal">rss</span> <span class="symbol">=</span> <span class="normal">d</span><span class="symbol">.</span><span class="function">createElement</span><span class="symbol">(</span><span class="string">'rss'</span><span class="symbol">)</span> - <span class="normal">rss</span><span class="symbol">.</span><span class="function">setAttribute</span><span class="symbol">(</span><span class="string">'version'</span><span class="symbol">,</span> <span class="string">'2.0'</span><span class="symbol">)</span> - <span class="normal">self</span><span class="symbol">.</span><span class="function">_addNameSpaces</span><span class="symbol">(</span><span class="normal">rss</span><span class="symbol">,</span> <span class="normal">self</span><span class="symbol">.</span><span class="normal">namespaces</span><span class="symbol">)</span> - <span class="normal">d</span><span class="symbol">.</span><span class="function">appendChild</span><span class="symbol">(</span><span class="normal">rss</span><span class="symbol">)</span> - <span class="normal">self</span><span class="symbol">.</span><span class="normal">_channel</span> <span class="symbol">=</span> <span class="normal">d</span><span class="symbol">.</span><span class="function">createElement</span><span class="symbol">(</span><span class="string">'channel'</span><span class="symbol">)</span> - <span class="normal">channel</span> <span class="symbol">=</span> <span class="normal">self</span><span class="symbol">.</span><span class="normal">_channel</span> - <span class="normal">rss</span><span class="symbol">.</span><span class="function">appendChild</span><span class="symbol">(</span><span class="normal">channel</span><span class="symbol">)</span> - - <span class="comment"># Add details about our blog here</span> - <span class="normal">self</span><span class="symbol">.</span><span class="function">_addText</span><span class="symbol">(</span><span class="string">'title'</span><span class="symbol">,</span> <span class="normal">self</span><span class="symbol">.</span><span class="normal">_config</span><span class="symbol">[</span><span class="string">'blog_title'</span><span class="symbol">]</span><span class="symbol">,</span> <span class="normal">channel</span><span class="symbol">)</span> - <span class="normal">self</span><span class="symbol">.</span><span class="function">_addText</span><span class="symbol">(</span><span class="string">'link'</span><span class="symbol">,</span> <span class="normal">self</span><span class="symbol">.</span><span class="function">_urlEncode</span><span class="symbol">(</span><span class="normal">self</span><span class="symbol">.</span><span class="normal">_config</span><span class="symbol">[</span><span class="string">'base_url'</span><span class="symbol">]</span><span class="symbol">)</span><span class="symbol">,</span> <span class="normal">channel</span><span class="symbol">)</span> - <span class="normal">self</span><span class="symbol">.</span><span class="function">_addText</span><span class="symbol">(</span><span class="string">'description'</span><span class="symbol">,</span> <span class="normal">self</span><span class="symbol">.</span><span class="normal">_config</span><span class="symbol">[</span><span class="string">'blog_description'</span><span class="symbol">]</span><span class="symbol">,</span> <span class="normal">channel</span><span class="symbol">)</span> - <span class="normal">self</span><span class="symbol">.</span><span class="function">_addText</span><span class="symbol">(</span><span class="string">'language'</span><span class="symbol">,</span> <span class="normal">self</span><span class="symbol">.</span><span class="normal">_config</span><span class="symbol">[</span><span class="string">'blog_language'</span><span class="symbol">]</span><span class="symbol">,</span> <span class="normal">channel</span><span class="symbol">)</span> - <span class="normal">self</span><span class="symbol">.</span><span class="function">_addText</span><span class="symbol">(</span><span class="string">'ttl'</span><span class="symbol">,</span> <span class="string">'60'</span><span class="symbol">,</span> <span class="normal">channel</span><span class="symbol">)</span> - <span class="normal">self</span><span class="symbol">.</span><span class="function">_addText</span><span class="symbol">(</span><span class="string">'dc:creator'</span><span class="symbol">,</span> <span class="normal">self</span><span class="symbol">.</span><span class="normal">_config</span><span class="symbol">[</span><span class="string">'blog_author'</span><span class="symbol">]</span><span class="symbol">,</span> <span class="normal">channel</span><span class="symbol">)</span> - <span class="normal">self</span><span class="symbol">.</span><span class="function">_addElemAttr</span><span class="symbol">(</span><span class="string">'admin:generatorAgent'</span><span class="symbol">,</span> <span class="symbol">\</span> - <span class="string">'rdf:resource'</span><span class="symbol">,</span> <span class="symbol">\</span> - <span class="string">'http://pyblosxom.sourceforge.net/'</span><span class="symbol">,</span> <span class="symbol">\</span> - <span class="normal">channel</span><span class="symbol">)</span> - <span class="normal">self</span><span class="symbol">.</span><span class="function">_addElemAttr</span><span class="symbol">(</span><span class="string">'admin:errorReportsTo'</span><span class="symbol">,</span> <span class="symbol">\</span> - <span class="string">'rdf:resource'</span><span class="symbol">,</span> <span class="symbol">\</span> - <span class="string">"mailto:"</span> <span class="symbol">+</span> <span class="normal">self</span><span class="symbol">.</span><span class="normal">_config</span><span class="symbol">.</span><span class="function">get</span><span class="symbol">(</span><span class="string">"blog_email"</span><span class="symbol">,</span> <span class="string">"none"</span><span class="symbol">)</span><span class="symbol">,</span> <span class="symbol">\</span> - <span class="normal">channel</span><span class="symbol">)</span> - - <span class="keyword">def</span> <span class="function">_generateDesc</span><span class="symbol">(</span><span class="normal">self</span><span class="symbol">,</span> <span class="normal">html</span><span class="symbol">)</span><span class="symbol">:</span> - <span class="normal">s</span> <span class="symbol">=</span> <span class="function">Stripper</span><span class="symbol">(</span><span class="symbol">)</span> - <span class="normal">s</span><span class="symbol">.</span><span class="function">feed</span><span class="symbol">(</span><span class="normal">html</span><span class="symbol">)</span> - <span class="normal">str</span> <span class="symbol">=</span> <span class="normal">s</span><span class="symbol">.</span><span class="function">gettext</span><span class="symbol">(</span><span class="symbol">)</span> - <span class="normal">frag</span> <span class="symbol">=</span> <span class="normal">str</span><span class="symbol">.</span><span class="function">split</span><span class="symbol">(</span><span class="symbol">)</span> - <span class="keyword">if</span> <span class="function">len</span><span class="symbol">(</span><span class="normal">frag</span><span class="symbol">)</span> <span class="symbol">></span> <span class="normal">self</span><span class="symbol">.</span><span class="normal">desc_length</span><span class="symbol">:</span> - <span class="normal">frag</span> <span class="symbol">=</span> <span class="normal">frag</span><span class="symbol">[</span><span class="symbol">:</span><span class="normal">self</span><span class="symbol">.</span><span class="normal">desc_length</span><span class="symbol">]</span> - <span class="normal">frag</span><span class="symbol">.</span><span class="function">append</span><span class="symbol">(</span><span class="string">'...'</span><span class="symbol">)</span> - <span class="keyword">return</span> <span class="string">' '</span><span class="symbol">.</span><span class="function">join</span><span class="symbol">(</span><span class="normal">frag</span><span class="symbol">)</span> - - <span class="keyword">def</span> <span class="function">_createItem</span><span class="symbol">(</span><span class="normal">self</span><span class="symbol">,</span> <span class="normal">entry</span><span class="symbol">)</span><span class="symbol">:</span> - <span class="normal">burl</span> <span class="symbol">=</span> <span class="normal">self</span><span class="symbol">.</span><span class="normal">_config</span><span class="symbol">[</span><span class="string">'base_url'</span><span class="symbol">]</span> - - <span class="normal">d</span> <span class="symbol">=</span> <span class="normal">urlparse</span><span class="symbol">.</span><span class="function">urlsplit</span><span class="symbol">(</span><span class="normal">self</span><span class="symbol">.</span><span class="normal">_config</span><span class="symbol">[</span><span class="string">'base_url'</span><span class="symbol">]</span><span class="symbol">)</span> - <span class="normal">domain</span> <span class="symbol">=</span> <span class="string">'%s://%s'</span> <span class="symbol">%</span> <span class="symbol">(</span><span class="normal">d</span><span class="symbol">[</span><span class="number">0</span><span class="symbol">]</span><span class="symbol">,</span> <span class="normal">d</span><span class="symbol">[</span><span class="number">1</span><span class="symbol">]</span><span class="symbol">)</span> - <span class="normal">item</span> <span class="symbol">=</span> <span class="normal">self</span><span class="symbol">.</span><span class="normal">_doc</span><span class="symbol">.</span><span class="function">createElement</span><span class="symbol">(</span><span class="string">'item'</span><span class="symbol">)</span> - <span class="normal">self</span><span class="symbol">.</span><span class="normal">_channel</span><span class="symbol">.</span><span class="function">appendChild</span><span class="symbol">(</span><span class="normal">item</span><span class="symbol">)</span> - <span class="normal">self</span><span class="symbol">.</span><span class="function">_addText</span><span class="symbol">(</span><span class="string">'title'</span><span class="symbol">,</span> <span class="normal">entry</span><span class="symbol">[</span><span class="string">'title'</span><span class="symbol">]</span><span class="symbol">,</span> <span class="normal">item</span><span class="symbol">)</span> - <span class="normal">self</span><span class="symbol">.</span><span class="function">_addElemAttr</span><span class="symbol">(</span><span class="string">'guid'</span><span class="symbol">,</span> <span class="string">'isPermaLink'</span><span class="symbol">,</span> <span class="string">'false'</span><span class="symbol">,</span> <span class="normal">item</span><span class="symbol">,</span> <span class="normal">entry</span><span class="symbol">[</span><span class="string">'file_path'</span><span class="symbol">]</span><span class="symbol">)</span> - <span class="normal">url</span> <span class="symbol">=</span> <span class="normal">urlparse</span><span class="symbol">.</span><span class="function">urljoin</span><span class="symbol">(</span><span class="normal">burl</span> <span class="symbol">+</span> <span class="string">"/"</span><span class="symbol">,</span> <span class="normal">entry</span><span class="symbol">[</span><span class="string">"file_path"</span><span class="symbol">]</span><span class="symbol">)</span> - <span class="normal">self</span><span class="symbol">.</span><span class="function">_addText</span><span class="symbol">(</span><span class="string">'link'</span><span class="symbol">,</span> <span class="normal">self</span><span class="symbol">.</span><span class="function">_urlEncode</span><span class="symbol">(</span><span class="normal">url</span><span class="symbol">)</span><span class="symbol">,</span> <span class="normal">item</span><span class="symbol">)</span> - - <span class="comment"># Text entry</span> - <span class="normal">self</span><span class="symbol">.</span><span class="function">_addText</span><span class="symbol">(</span><span class="string">'description'</span><span class="symbol">,</span> <span class="normal">self</span><span class="symbol">.</span><span class="function">_generateDesc</span><span class="symbol">(</span><span class="normal">entry</span><span class="symbol">[</span><span class="string">'body'</span><span class="symbol">]</span><span class="symbol">)</span><span class="symbol">,</span> <span class="normal">item</span><span class="symbol">)</span> - <span class="keyword">if</span> <span class="normal">self</span><span class="symbol">.</span><span class="normal">create_entry</span><span class="symbol">:</span> - <span class="keyword">if</span> <span class="normal">self</span><span class="symbol">.</span><span class="normal">entry_type</span> <span class="symbol">=</span><span class="symbol">=</span> <span class="string">'CDATA'</span><span class="symbol">:</span> - <span class="normal">self</span><span class="symbol">.</span><span class="function">_addCDATA</span><span class="symbol">(</span><span class="string">'content:encoded'</span><span class="symbol">,</span> <span class="normal">entry</span><span class="symbol">[</span><span class="string">'body'</span><span class="symbol">]</span><span class="symbol">,</span> <span class="normal">item</span><span class="symbol">)</span> - <span class="keyword">else</span><span class="symbol">:</span> - <span class="normal">self</span><span class="symbol">.</span><span class="function">_addText</span><span class="symbol">(</span><span class="string">'content:encoded'</span><span class="symbol">,</span> <span class="normal">entry</span><span class="symbol">[</span><span class="string">'body'</span><span class="symbol">]</span><span class="symbol">,</span> <span class="normal">item</span><span class="symbol">)</span> - <span class="comment"># Metadata stuff</span> - <span class="comment"># Category</span> - <span class="keyword">if</span> <span class="normal">entry</span><span class="symbol">[</span><span class="string">'path'</span><span class="symbol">]</span><span class="symbol">.</span><span class="function">strip</span><span class="symbol">(</span><span class="symbol">)</span><span class="symbol">:</span> - <span class="comment"># category or dc:subject, but NOT both</span> - <span class="normal">self</span><span class="symbol">.</span><span class="function">_addElemAttr</span><span class="symbol">(</span><span class="string">'category'</span><span class="symbol">,</span> <span class="string">'domain'</span><span class="symbol">,</span> <span class="normal">domain</span><span class="symbol">,</span> <span class="normal">item</span><span class="symbol">,</span> <span class="normal">entry</span><span class="symbol">[</span><span class="string">'path'</span><span class="symbol">]</span><span class="symbol">)</span> - <span class="comment">#self._addText('dc:subject', entry['path'], item)</span> - <span class="normal">self</span><span class="symbol">.</span><span class="function">_addText</span><span class="symbol">(</span><span class="string">'dc:date'</span><span class="symbol">,</span> <span class="normal">entry</span><span class="symbol">[</span><span class="string">'w3cdate'</span><span class="symbol">]</span><span class="symbol">,</span> <span class="normal">item</span><span class="symbol">)</span> - - <span class="keyword">def</span> <span class="function">render</span><span class="symbol">(</span><span class="normal">self</span><span class="symbol">,</span> <span class="normal">header</span> <span class="symbol">=</span> <span class="number">1</span><span class="symbol">)</span><span class="symbol">:</span> - <span class="keyword">if</span> <span class="normal">self</span><span class="symbol">.</span><span class="normal">rendered</span> <span class="symbol">=</span><span class="symbol">=</span> <span class="number">1</span><span class="symbol">:</span> - <span class="keyword">return</span> - - <span class="normal">self</span><span class="symbol">.</span><span class="normal">_data</span> <span class="symbol">=</span> <span class="normal">self</span><span class="symbol">.</span><span class="normal">_request</span><span class="symbol">.</span><span class="function">getData</span><span class="symbol">(</span><span class="symbol">)</span> - <span class="normal">self</span><span class="symbol">.</span><span class="normal">_config</span> <span class="symbol">=</span> <span class="normal">self</span><span class="symbol">.</span><span class="normal">_request</span><span class="symbol">.</span><span class="function">getConfiguration</span><span class="symbol">(</span><span class="symbol">)</span> - - <span class="normal">self</span><span class="symbol">.</span><span class="function">addHeader</span><span class="symbol">(</span><span class="string">'Content-Type'</span><span class="symbol">,</span> <span class="string">'application/xml'</span><span class="symbol">)</span> - <span class="normal">self</span><span class="symbol">.</span><span class="function">showHeaders</span><span class="symbol">(</span><span class="symbol">)</span> - - <span class="normal">self</span><span class="symbol">.</span><span class="function">_createChannel</span><span class="symbol">(</span><span class="symbol">)</span> - - <span class="keyword">if</span> <span class="normal">self</span><span class="symbol">.</span><span class="normal">_config</span><span class="symbol">.</span><span class="function">get</span><span class="symbol">(</span><span class="string">"num_entries"</span><span class="symbol">,</span> <span class="number">0</span><span class="symbol">)</span><span class="symbol">:</span> - <span class="normal">max_entries</span> <span class="symbol">=</span> <span class="normal">self</span><span class="symbol">.</span><span class="normal">_config</span><span class="symbol">[</span><span class="string">"num_entries"</span><span class="symbol">]</span> - <span class="keyword">else</span><span class="symbol">:</span> - <span class="normal">max_entries</span> <span class="symbol">=</span> <span class="number">20</span> - - <span class="keyword">if</span> <span class="normal">self</span><span class="symbol">.</span><span class="normal">_content</span><span class="symbol">:</span> - <span class="keyword">if</span> <span class="normal">max_entries</span> <span class="symbol">></span> <span class="function">len</span><span class="symbol">(</span><span class="normal">self</span><span class="symbol">.</span><span class="normal">_content</span><span class="symbol">)</span><span class="symbol">:</span> - <span class="normal">num_entries</span> <span class="symbol">=</span> <span class="function">len</span><span class="symbol">(</span><span class="normal">self</span><span class="symbol">.</span><span class="normal">_content</span><span class="symbol">)</span> - <span class="keyword">else</span><span class="symbol">:</span> - <span class="normal">num_entries</span> <span class="symbol">=</span> <span class="normal">max_entries</span> - - <span class="keyword">for</span> <span class="normal">count</span> <span class="keyword">in</span> <span class="function">xrange</span><span class="symbol">(</span><span class="normal">num_entries</span><span class="symbol">)</span><span class="symbol">:</span> - <span class="normal">self</span><span class="symbol">.</span><span class="function">_createItem</span><span class="symbol">(</span><span class="normal">self</span><span class="symbol">.</span><span class="normal">_content</span><span class="symbol">[</span><span class="normal">count</span><span class="symbol">]</span><span class="symbol">)</span> - - <span class="comment"># We are now ready to present the xml</span> - - <span class="comment"># FIXME this is totally hokey, but if I pass the encoding into</span> - <span class="comment"># toxml, then it tries to convert the data to the new encoding</span> - <span class="comment"># and assumes the data is ascii (which is wrong).</span> - <span class="normal">text</span> <span class="symbol">=</span> <span class="normal">self</span><span class="symbol">.</span><span class="normal">_doc</span><span class="symbol">.</span><span class="function">toxml</span><span class="symbol">(</span><span class="symbol">)</span> - <span class="keyword">if</span> <span class="normal">self</span><span class="symbol">.</span><span class="normal">_config</span><span class="symbol">.</span><span class="function">has_key</span><span class="symbol">(</span><span class="string">"blog_encoding"</span><span class="symbol">)</span><span class="symbol">:</span> - <span class="normal">text</span> <span class="symbol">=</span> <span class="string">"<?xml version=\"1.0\" encoding=\"%s\" ?>"</span> <span class="symbol">%</span> <span class="normal">self</span><span class="symbol">.</span><span class="normal">_config</span><span class="symbol">[</span><span class="string">"blog_encoding"</span><span class="symbol">]</span> <span class="symbol">+</span> <span class="normal">text</span><span class="symbol">[</span><span class="normal">text</span><span class="symbol">.</span><span class="function">find</span><span class="symbol">(</span><span class="string">"\n"</span><span class="symbol">)</span><span class="symbol">:</span><span class="symbol">]</span> - - <span class="normal">self</span><span class="symbol">.</span><span class="function">write</span><span class="symbol">(</span><span class="normal">text</span><span class="symbol">)</span> - - <span class="normal">self</span><span class="symbol">.</span><span class="normal">rendered</span> <span class="symbol">=</span> <span class="number">1</span> - -<span class="keyword">def</span> <span class="function">cb_renderer</span><span class="symbol">(</span><span class="normal">args</span><span class="symbol">)</span><span class="symbol">:</span> - <span class="keyword">import</span> <span class="normal">sys</span> - <span class="normal">req</span> <span class="symbol">=</span> <span class="normal">args</span><span class="symbol">[</span><span class="string">'request'</span><span class="symbol">]</span> - <span class="normal">http</span> <span class="symbol">=</span> <span class="normal">req</span><span class="symbol">.</span><span class="function">getHttp</span><span class="symbol">(</span><span class="symbol">)</span> - <span class="normal">conf</span> <span class="symbol">=</span> <span class="normal">req</span><span class="symbol">.</span><span class="function">getConfiguration</span><span class="symbol">(</span><span class="symbol">)</span> - - <span class="normal">ext</span> <span class="symbol">=</span> <span class="normal">conf</span><span class="symbol">.</span><span class="function">get</span><span class="symbol">(</span><span class="string">"rss2_extension"</span><span class="symbol">,</span> <span class="string">"/index.rss2"</span><span class="symbol">)</span> - <span class="keyword">if</span> <span class="normal">http</span><span class="symbol">[</span><span class="string">'PATH_INFO'</span><span class="symbol">]</span><span class="symbol">.</span><span class="function">endswith</span><span class="symbol">(</span> <span class="normal">ext</span> <span class="symbol">)</span><span class="symbol">:</span> - <span class="normal">http</span><span class="symbol">[</span><span class="string">'PATH_INFO'</span><span class="symbol">]</span> <span class="symbol">=</span> <span class="normal">http</span><span class="symbol">[</span><span class="string">'PATH_INFO'</span><span class="symbol">]</span><span class="symbol">[</span><span class="symbol">:</span><span class="symbol">-</span><span class="function">len</span><span class="symbol">(</span><span class="normal">ext</span><span class="symbol">)</span><span class="symbol">]</span> - <span class="keyword">return</span> <span class="function">RSS2Renderer</span><span class="symbol">(</span><span class="normal">req</span><span class="symbol">,</span> <span class="normal">conf</span><span class="symbol">.</span><span class="function">get</span><span class="symbol">(</span><span class="string">'stdoutput'</span><span class="symbol">,</span> <span class="normal">sys</span><span class="symbol">.</span><span class="normal">stdout</span><span class="symbol">)</span><span class="symbol">)</span> - -<span class="comment"># vim: tabstop=4 shiftwidth=4 expandtab</span> -</tt></pre> -</body> -<script>function PrivoxyWindowOpen(a, b, c){return(window.open(a, b, c));}</script></html> diff --git a/www-apps/pyblosxom-plugins/files/session.py b/www-apps/pyblosxom-plugins/files/session.py deleted file mode 100644 index d44a604..0000000 --- a/www-apps/pyblosxom-plugins/files/session.py +++ /dev/null @@ -1,431 +0,0 @@ -""" -A simple session management plugin for pyblosxom. -Inspired by the mod_python Session module. - -This plugin tries to set a session cookie. As an alternative you can get -the session id manually and store it in a hidden form field or the QS. -See below for examples. - -If you make any changes to this plugin, please send a patch to -<sa+pyblosxom at c-area dot ch> so I can incorporate them. -Thanks! - - -To install: -1) Put session.py in your plugin directory. -2) In config.py add session to py['load_plugins'] -3) Add the following optional variable to config.py: - py['session_dbmfile'] = '/tmp/pb_session.dbm' # this is the default - -Note: check the dependency listing below. - -Usage with cookies: - Store variables in the session: - def cb_whatever(args): - request = args['request'] - session = request.getSession() - session['hello'] = "world" - session.save() - ... - - Retreive variables from the session: - def cb_whatever(args): - request = args['request'] - session = request.getSession() - msg = session['hello'] - ... - -Usage without cookies: - Create a session: - def cb_whatever(args): - request = args['request'] - session = request.getSession() - session['hello'] = "world" - session.save() - sessId = session.id() - # store sessId in a hidden form field or add it to the QS or whatever. - - Retreive a session: - def cb_whatever(args): - request = args['request'] - form = request.getForm() - sessId = form['pbsid'].value - session = request.getSession(sessId) - msg = session['hello'] - ... - - -Todo: - write doc strings ... :( - - -Dependecies: - - My compatibility plugin if you're not using pyblosxom 1.2+. - - -Revisions: - $Log: session.py,v $ - Revision 1.2 2005/02/10 15:47:44 sar - removed debugging statements - - Revision 1.1 2005/02/08 17:51:21 sar - cvs server update - - Revision 1.8 2005/01/18 02:14:29 sar - moved cgi stuff to the compatibility plugin - - Revision 1.7 2005/01/16 14:08:00 sar - removed unnecessary local variables - - Revision 1.6 2004/12/17 02:51:18 sar - fixed bugs in _init. indentation error caused that ._accessed was - not updated and .cleanup() was only called if session was new. - - Revision 1.5 2004/12/16 03:09:54 sar - fixed a bug in the CGI version of _setCookie, thanks Will. - added config variable 'session_dbmfile'. - - Revision 1.4 2004/12/14 20:17:31 sar - fixed bugs in _lock, _unlock and _setCookie - - Revision 1.3 2004/12/11 19:12:43 sar - removed dependencies on my WSGI wrapper - - Revision 1.2 2004/12/05 12:07:19 sar - changed callback from cb_renderer to cb_start, - added switch to handle mod_python session or fall back to the handmade Session. - - Revision 1.1 2004/11/27 23:54:58 sar - created - -$Id: session.py,v 1.2 2005/02/10 15:47:44 sar Exp $ -""" -__author__ = "Steven Armstrong <sa at c-area dot ch>" -__version__ = "$Revision: 1.2 $ $Date: 2005/02/10 15:47:44 $" -__url__ = "http://www.c-area.ch/code/" -__description__ = "Simple session management" -__license__ = "GPL 2+" - - -# Python imports -import sys -import os -import time -import random -import md5 -import anydbm -import tempfile -from Cookie import SimpleCookie as Cookie -try: import cPickle as pickle -except ImportError: import pickle - -# Pyblosxom imports -from Pyblosxom import tools - - -# parameters -COOKIE_NAME = "pbsid" # mod_python uses 'pysid'. don't use the same. -DFT_TIMEOUT = 30*60 # 30 min -CLEANUP_CHANCE = 1000 # cleanups have 1 in CLEANUP_CHANCE chance -DBM_NAME = "pb_session.dbm" -DBM_FILE = os.path.join(tempfile.gettempdir(), DBM_NAME) - -# the mod_python session seems to be a bit buggy when running with a WSGI wrapper. -# looks like issues with the Session object directly accessing the output-stream. -# so here's a flag to use the handmade session even if running under mod_python. -USE_MP_SESSION = False - - -def verify_installation(request): - config = request.getConfiguration() - retval = 1 - - try: - import compatibility - except ImportError: - print "If you're not running the WSGI version of Pyblosxom" - print "you'll need the 'compatibility.py' plugin." - - if not 'session_dbmfile' in config: - print "Missing optional property: 'session_dbmfile'" - print "Using the default of '%s'." % DBM_FILE - - return retval - -class Session(dict): - - def __init__(self, request, sid=None, dbmfile=None, timeout=None, lock=1): - dict.__init__(self) - self._request = request - self._http = self._request.getHttp() - self._sid = sid - self._use_lock = lock - self._new = 1 - self._created = 0 - self._accessed = 0 - self._timeout = 0 - self._locked = 0 - self._invalid = 0 - if dbmfile: - self._dbmfile = dbmfile - else: - self._dbmfile = self._request.getConfiguration().get('session_dbmfile', DBM_FILE) - - self._init(timeout) - - - def __del__(self): - self._unlock() - - - def _init(self, timeout): - if not self._sid: - # check to see if cookie exists - cookie = self._getCookie() - if cookie: - self._sid = cookie.value - - if self._sid: - # attempt to load ourselves - if self.load(): - self._new = 0 - - if self._new: - # make a new session - self._sid = self._generateSID() - self._setCookie(self._makeCookie()) - self._created = time.time() - if timeout: - self._timeout = timeout - else: - self._timeout = DFT_TIMEOUT - - self._accessed = time.time() - - # need cleanup? - if random.randint(1, CLEANUP_CHANCE) == 1: - self.cleanup() - - - def _generateSID(self): - """ - Generates a new session ID. Uses different random sources to be - difficult to guess. - """ - t = long(time.time()*10000) - pid = os.getpid() - rnd1 = random.randrange(1,999999999,1) - rnd2 = random.randrange(1,999999999,1) - ip = self._request.getHttp()['REMOTE_ADDR'] - return md5.new("%d%d%d%d%s" % (t, pid, rnd1, rnd2, ip)).hexdigest() - - -### cookie related methods - - def _makeCookie(self): - m = Cookie() - m.load("%s=%s" % (COOKIE_NAME, self._sid)) - c = m[COOKIE_NAME] - #c['path'] = "/" - c['path'] = self._http['SCRIPT_NAME'] - return c - - - def _getCookie(self): - # check to see if cookie exists - cookies = Cookie() - if 'HTTP_COOKIE' in self._http: - cookies.load(self._http['HTTP_COOKIE']) - if cookies.has_key(COOKIE_NAME): - return cookies[COOKIE_NAME] - return None - - - def _setCookie(self, c): - k, v = c.output().split(":", 1) - self._request.getResponse().addHeader(k, v.strip()) - - -### dbm related methods - - def _lock(self): - # ???: does this work as expected? - if self._use_lock: - self._dbmfile_lock = open(self._dbmfile, "r+") - tools.lock(self._dbmfile_lock, tools.LOCK_EX) - self._locked = 1 - - - def _unlock(self): - # ???: does this work as expected? - if self._use_lock and self._locked: - tools.unlock(self._dbmfile_lock) - self._dbmfile_lock.close() - self._locked = 0 - - - def _getDBM(self): - result = anydbm.open(self._dbmfile, 'c') - return result - - - def _do_load(self): - dbm = self._getDBM() - self._lock() - try: - if dbm.has_key(self._sid): - return pickle.loads(dbm[self._sid]) - else: - return None - finally: - dbm.close() - self._unlock() - - - def _do_save(self, dict): - dbm = self._getDBM() - self._lock() - try: - dbm[self._sid] = pickle.dumps(dict) - finally: - dbm.close() - self._unlock() - - - def _do_delete(self): - dbm = self._getDBM() - self._lock() - try: - try: - del dbm[self._sid] - except KeyError: pass - finally: - dbm.close() - self._unlock() - - - def _do_cleanup(self): - dbm = self._getDBM() - self._lock() - try: - old = [] - try: - s = dbm.first() - while 1: - key, val = s - dict = pickle.loads(val) - try: - if (time.time() - dict["_accessed"]) > dict["_timeout"]: - old.append(key) - except KeyError: - old.append(key) - try: - s = dbm.next() - except KeyError: - break - except DBNotFoundError: - pass - - for key in old: - try: - del dbm[key] - except: - pass - finally: - dbm.close() - self._unlock() - - - -### public methods - - def invalidate(self): - c = self._makeCookie() - c['expires'] = 0 - self._setCookie(c) - self.delete() - self._invalid = 1 - - def load(self): - dict = self._do_load() - - if dict == None: - return 0 - - if (time.time() - dict["_accessed"]) > dict["_timeout"]: - return 0 - self._created = dict["_created"] - self._accessed = dict["_accessed"] - self._timeout = dict["_timeout"] - self.update(dict["_data"]) - return 1 - - - def save(self): - if not self._invalid: - dict = {"_data" : self.copy(), - "_created" : self._created, - "_accessed": self._accessed, - "_timeout" : self._timeout} - self._do_save(dict) - - - def delete(self): - self._do_delete() - self.clear() - - - def is_new(self): - return not not self._new - - - def id(self): - return self._sid - - - def created(self): - return self._created - - - def last_accessed(self): - return self._accessed - - - def timeout(self): - return self._timeout - - - def set_timeout(self, secs): - self._timeout = secs - - - def cleanup(self): - self._do_cleanup() - - - -#****************************** -# Callbacks -#****************************** - -def cb_start(args): - request = args['request'] - http = request.getHttp() - - if not request.getSession: - def _getSession(sessId=None): - if request._session == None: - # running on mod_python and using WSGI wrapper - if 'mod_python.request' in http and USE_MP_SESSION: - from mod_python.Session import Session as MPSession - request._session = MPSession(http['mod_python.request'], sid=sessId) - - # CGI version - else: - request._session = Session(request, sid=sessId) - return request._session - - request.getSession = _getSession - - - diff --git a/www-apps/pyblosxom-plugins/files/wbglast10summary.py b/www-apps/pyblosxom-plugins/files/wbglast10summary.py deleted file mode 100644 index cf086f9..0000000 --- a/www-apps/pyblosxom-plugins/files/wbglast10summary.py +++ /dev/null @@ -1,37 +0,0 @@ -""" -Thrown-together plugin to summarize all entries after the first five -in the html flavour. - -This uses the summary template. So make sure to build a summary template -file. Also, you should probably fiddle with the values in this plugin to -get it to meet your special needs. - -This code is placed in the public domain. Do with it as you will. -""" - -__author__ = "Will Guaraldi - willg at bluesock dot org" -__version__ = "1.0" -__url__ = "http://www.bluesock.org/~willg/pyblosxom/" -__description__ = "Summarizes old posts." - - -def cb_prepare(args): - request = args["request"] - data = request.getData() - - flavour = data.get("flavour", "html") - - # we don't want to do anything if the flavour isn't html - if not flavour in ["html"]: - return - - # grab the entry list - entry_list = data["entry_list"] - - # for all the entries after the 5th one, we set the template_name - # to summary. - i = 5 - while i < len(entry_list): - if entry_list[i].get("template_name", "story") == "story": - entry_list[i]["template_name"] = "summary" - i = i + 1 diff --git a/www-apps/pyblosxom-plugins/files/wbglast10summary.py.html b/www-apps/pyblosxom-plugins/files/wbglast10summary.py.html deleted file mode 100644 index a5f8297..0000000 --- a/www-apps/pyblosxom-plugins/files/wbglast10summary.py.html +++ /dev/null @@ -1,54 +0,0 @@ -<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" - "http://www.w3.org/TR/REC-html40/strict.dtd"> -<html> -<head><script>function PrivoxyWindowOpen(){return(null);}</script> -<meta http-equiv="Content-Type" -content="text/html; charset=iso-8859-1"> -<meta name="GENERATOR" content="GNU source-highlight 1.11 -by Lorenzo Bettini -http://www.lorenzobettini.it -http://www.gnu.org/software/src-highlite"> -<title>source file</title> -<link rel="stylesheet" href="/~willg/willstyle.css" type="text/css"> -</head> -<body> -<pre><tt><span class="comment">"""</span> -<span class="comment">Thrown-together plugin to summarize all entries after the first five</span> -<span class="comment">in the html flavour.</span> -<span class="comment"></span> -<span class="comment">This uses the summary template. So make sure to build a summary template </span> -<span class="comment">file. Also, you should probably fiddle with the values in this plugin to </span> -<span class="comment">get it to meet your special needs.</span> -<span class="comment"></span> -<span class="comment">This code is placed in the public domain. Do with it as you will.</span> -<span class="comment">"""</span> - -<span class="normal">__author__</span> <span class="symbol">=</span> <span class="string">"Will Guaraldi - willg at bluesock dot org"</span> -<span class="normal">__version__</span> <span class="symbol">=</span> <span class="string">"1.0"</span> -<span class="normal">__url__</span> <span class="symbol">=</span> <span class="string">"http://www.bluesock.org/~willg/pyblosxom/"</span> -<span class="normal">__description__</span> <span class="symbol">=</span> <span class="string">"Summarizes old posts."</span> - - -<span class="keyword">def</span> <span class="function">cb_prepare</span><span class="symbol">(</span><span class="normal">args</span><span class="symbol">)</span><span class="symbol">:</span> - <span class="normal">request</span> <span class="symbol">=</span> <span class="normal">args</span><span class="symbol">[</span><span class="string">"request"</span><span class="symbol">]</span> - <span class="normal">data</span> <span class="symbol">=</span> <span class="normal">request</span><span class="symbol">.</span><span class="function">getData</span><span class="symbol">(</span><span class="symbol">)</span> - - <span class="normal">flavour</span> <span class="symbol">=</span> <span class="normal">data</span><span class="symbol">.</span><span class="function">get</span><span class="symbol">(</span><span class="string">"flavour"</span><span class="symbol">,</span> <span class="string">"html"</span><span class="symbol">)</span> - - <span class="comment"># we don't want to do anything if the flavour isn't html</span> - <span class="keyword">if</span> <span class="keyword">not</span> <span class="normal">flavour</span> <span class="keyword">in</span> <span class="symbol">[</span><span class="string">"html"</span><span class="symbol">]</span><span class="symbol">:</span> - <span class="keyword">return</span> - - <span class="comment"># grab the entry list</span> - <span class="normal">entry_list</span> <span class="symbol">=</span> <span class="normal">data</span><span class="symbol">[</span><span class="string">"entry_list"</span><span class="symbol">]</span> - - <span class="comment"># for all the entries after the 5th one, we set the template_name</span> - <span class="comment"># to summary.</span> - <span class="normal">i</span> <span class="symbol">=</span> <span class="number">5</span> - <span class="keyword">while</span> <span class="normal">i</span> <span class="symbol"><</span> <span class="function">len</span><span class="symbol">(</span><span class="normal">entry_list</span><span class="symbol">)</span><span class="symbol">:</span> - <span class="keyword">if</span> <span class="normal">entry_list</span><span class="symbol">[</span><span class="normal">i</span><span class="symbol">]</span><span class="symbol">.</span><span class="function">get</span><span class="symbol">(</span><span class="string">"template_name"</span><span class="symbol">,</span> <span class="string">"story"</span><span class="symbol">)</span> <span class="symbol">=</span><span class="symbol">=</span> <span class="string">"story"</span><span class="symbol">:</span> - <span class="normal">entry_list</span><span class="symbol">[</span><span class="normal">i</span><span class="symbol">]</span><span class="symbol">[</span><span class="string">"template_name"</span><span class="symbol">]</span> <span class="symbol">=</span> <span class="string">"summary"</span> - <span class="normal">i</span> <span class="symbol">=</span> <span class="normal">i</span> <span class="symbol">+</span> <span class="number">1</span> -</tt></pre> -</body> -<script>function PrivoxyWindowOpen(a, b, c){return(window.open(a, b, c));}</script></html> diff --git a/www-apps/pyblosxom-plugins/pyblosxom-plugins-1.2.1.ebuild b/www-apps/pyblosxom-plugins/pyblosxom-plugins-1.2.1.ebuild deleted file mode 100644 index 820a907..0000000 --- a/www-apps/pyblosxom-plugins/pyblosxom-plugins-1.2.1.ebuild +++ /dev/null @@ -1,47 +0,0 @@ -# Copyright 1999-2005 Gentoo Technologies, Inc. -# Distributed under the terms of the GNU General Public License v2 -# $Header: $ - -DESCRIPTION="Plugins for PyBlosxom." -SRC_URI="" -HOMEPAGE="http://pyblosxom.sourceforge.net/" - -LICENSE="MIT" -KEYWORDS="~x86" - -SLOT="0" - -IUSE="" - -RDEPEND="virtual/python - dev-python/pyxml - dev-python/imaging - media-fonts/freefonts - www-apps/pyblosxom" - -src_install() { - - PLUGIN_DIR=${D}/usr/share/pyblosxom-${PV}/plugins - - mkdir -p ${PLUGIN_DIR} - - PLUGINS="comments.py - nospam.py - session.py - hardcodedates.py - getstamps.py - rss2renderer.py - pycategories.py - contact.py - logrequest.py - pyguest.py - wbglast10summary.py" - - for plg in ${PLUGINS} - do - cp ${FILESDIR}/${plg} ${PLUGIN_DIR} - done - - dodoc ${FILESDIR}/rss2renderer.py.html - dodoc ${FILESDIR}/wbglast10summary.py.html -} |