diff --git a/package.d/.gitignore b/package.d/.gitignore index b5a7cd110..3d804f048 100644 --- a/package.d/.gitignore +++ b/package.d/.gitignore @@ -1,2 +1 @@ -omake-mode/ slime/ diff --git a/package.d/omake-mode/.hg/00changelog.i b/package.d/omake-mode/.hg/00changelog.i new file mode 100644 index 000000000..d3a831105 Binary files /dev/null and b/package.d/omake-mode/.hg/00changelog.i differ diff --git a/package.d/omake-mode/.hg/branch b/package.d/omake-mode/.hg/branch new file mode 100644 index 000000000..4ad96d515 --- /dev/null +++ b/package.d/omake-mode/.hg/branch @@ -0,0 +1 @@ +default diff --git a/package.d/omake-mode/.hg/cache/branchheads b/package.d/omake-mode/.hg/cache/branchheads new file mode 100644 index 000000000..a05736ad6 --- /dev/null +++ b/package.d/omake-mode/.hg/cache/branchheads @@ -0,0 +1,2 @@ +24200ec661974c36fffaef93530bd0ae55bc581d 3 +24200ec661974c36fffaef93530bd0ae55bc581d default diff --git a/package.d/omake-mode/.hg/cache/tags b/package.d/omake-mode/.hg/cache/tags new file mode 100644 index 000000000..3126bc95c --- /dev/null +++ b/package.d/omake-mode/.hg/cache/tags @@ -0,0 +1,2 @@ +3 24200ec661974c36fffaef93530bd0ae55bc581d + diff --git a/package.d/omake-mode/.hg/dirstate b/package.d/omake-mode/.hg/dirstate new file mode 100644 index 000000000..8ff2f6c9c Binary files /dev/null and b/package.d/omake-mode/.hg/dirstate differ diff --git a/package.d/omake-mode/.hg/hgrc b/package.d/omake-mode/.hg/hgrc new file mode 100644 index 000000000..9c71265ee --- /dev/null +++ b/package.d/omake-mode/.hg/hgrc @@ -0,0 +1,2 @@ +[paths] +default = https://bitbucket.org/camlspotter/omake-mode diff --git a/package.d/omake-mode/.hg/requires b/package.d/omake-mode/.hg/requires new file mode 100644 index 000000000..c1674f2dd --- /dev/null +++ b/package.d/omake-mode/.hg/requires @@ -0,0 +1,4 @@ +revlogv1 +fncache +store +dotencode diff --git a/package.d/omake-mode/.hg/store/00changelog.i b/package.d/omake-mode/.hg/store/00changelog.i new file mode 100644 index 000000000..e1023fd06 Binary files /dev/null and b/package.d/omake-mode/.hg/store/00changelog.i differ diff --git a/package.d/omake-mode/.hg/store/00manifest.i b/package.d/omake-mode/.hg/store/00manifest.i new file mode 100644 index 000000000..b40acd20c Binary files /dev/null and b/package.d/omake-mode/.hg/store/00manifest.i differ diff --git a/package.d/omake-mode/.hg/store/data/doc/_makefile.i b/package.d/omake-mode/.hg/store/data/doc/_makefile.i new file mode 100644 index 000000000..601374276 Binary files /dev/null and b/package.d/omake-mode/.hg/store/data/doc/_makefile.i differ diff --git a/package.d/omake-mode/.hg/store/data/doc/conf.py.i b/package.d/omake-mode/.hg/store/data/doc/conf.py.i new file mode 100644 index 000000000..25b3e31ce Binary files /dev/null and b/package.d/omake-mode/.hg/store/data/doc/conf.py.i differ diff --git a/package.d/omake-mode/.hg/store/data/doc/index.rst.i b/package.d/omake-mode/.hg/store/data/doc/index.rst.i new file mode 100644 index 000000000..0aa46e2a2 Binary files /dev/null and b/package.d/omake-mode/.hg/store/data/doc/index.rst.i differ diff --git a/package.d/omake-mode/.hg/store/data/doc/make.bat.i b/package.d/omake-mode/.hg/store/data/doc/make.bat.i new file mode 100644 index 000000000..a2b9b86e2 Binary files /dev/null and b/package.d/omake-mode/.hg/store/data/doc/make.bat.i differ diff --git a/package.d/omake-mode/.hg/store/data/omake-mode.el.i b/package.d/omake-mode/.hg/store/data/omake-mode.el.i new file mode 100644 index 000000000..36d882951 Binary files /dev/null and b/package.d/omake-mode/.hg/store/data/omake-mode.el.i differ diff --git a/package.d/omake-mode/.hg/store/data/~2ehgignore.i b/package.d/omake-mode/.hg/store/data/~2ehgignore.i new file mode 100644 index 000000000..06426ba9f Binary files /dev/null and b/package.d/omake-mode/.hg/store/data/~2ehgignore.i differ diff --git a/package.d/omake-mode/.hg/store/fncache b/package.d/omake-mode/.hg/store/fncache new file mode 100644 index 000000000..35bc2fe4a --- /dev/null +++ b/package.d/omake-mode/.hg/store/fncache @@ -0,0 +1,6 @@ +data/omake-mode.el.i +data/doc/Makefile.i +data/.hgignore.i +data/doc/conf.py.i +data/doc/make.bat.i +data/doc/index.rst.i diff --git a/package.d/omake-mode/.hg/store/phaseroots b/package.d/omake-mode/.hg/store/phaseroots new file mode 100644 index 000000000..e69de29bb diff --git a/package.d/omake-mode/.hg/store/undo b/package.d/omake-mode/.hg/store/undo new file mode 100644 index 000000000..8ab616a71 Binary files /dev/null and b/package.d/omake-mode/.hg/store/undo differ diff --git a/package.d/omake-mode/.hg/store/undo.phaseroots b/package.d/omake-mode/.hg/store/undo.phaseroots new file mode 100644 index 000000000..e69de29bb diff --git a/package.d/omake-mode/.hg/undo.bookmarks b/package.d/omake-mode/.hg/undo.bookmarks new file mode 100644 index 000000000..e69de29bb diff --git a/package.d/omake-mode/.hg/undo.branch b/package.d/omake-mode/.hg/undo.branch new file mode 100644 index 000000000..331d858ce --- /dev/null +++ b/package.d/omake-mode/.hg/undo.branch @@ -0,0 +1 @@ +default \ No newline at end of file diff --git a/package.d/omake-mode/.hg/undo.desc b/package.d/omake-mode/.hg/undo.desc new file mode 100644 index 000000000..63c424d41 --- /dev/null +++ b/package.d/omake-mode/.hg/undo.desc @@ -0,0 +1,3 @@ +0 +pull +https://bitbucket.org/camlspotter/omake-mode diff --git a/package.d/omake-mode/.hg/undo.dirstate b/package.d/omake-mode/.hg/undo.dirstate new file mode 100644 index 000000000..e69de29bb diff --git a/package.d/omake-mode/.hgignore b/package.d/omake-mode/.hgignore new file mode 100644 index 000000000..e35d8850c --- /dev/null +++ b/package.d/omake-mode/.hgignore @@ -0,0 +1 @@ +_build diff --git a/package.d/omake-mode/doc/Makefile b/package.d/omake-mode/doc/Makefile new file mode 100644 index 000000000..a8ee7d205 --- /dev/null +++ b/package.d/omake-mode/doc/Makefile @@ -0,0 +1,89 @@ +# Makefile for Sphinx documentation +# + +# You can set these variables from the command line. +SPHINXOPTS = +SPHINXBUILD = sphinx-build +PAPER = +BUILDDIR = _build + +# Internal variables. +PAPEROPT_a4 = -D latex_paper_size=a4 +PAPEROPT_letter = -D latex_paper_size=letter +ALLSPHINXOPTS = -d $(BUILDDIR)/doctrees $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) . + +.PHONY: help clean html dirhtml pickle json htmlhelp qthelp latex changes linkcheck doctest + +help: + @echo "Please use \`make ' where is one of" + @echo " html to make standalone HTML files" + @echo " dirhtml to make HTML files named index.html in directories" + @echo " pickle to make pickle files" + @echo " json to make JSON files" + @echo " htmlhelp to make HTML files and a HTML help project" + @echo " qthelp to make HTML files and a qthelp project" + @echo " latex to make LaTeX files, you can set PAPER=a4 or PAPER=letter" + @echo " changes to make an overview of all changed/added/deprecated items" + @echo " linkcheck to check all external links for integrity" + @echo " doctest to run all doctests embedded in the documentation (if enabled)" + +clean: + -rm -rf $(BUILDDIR)/* + +html: + $(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(BUILDDIR)/html + @echo + @echo "Build finished. The HTML pages are in $(BUILDDIR)/html." + +dirhtml: + $(SPHINXBUILD) -b dirhtml $(ALLSPHINXOPTS) $(BUILDDIR)/dirhtml + @echo + @echo "Build finished. The HTML pages are in $(BUILDDIR)/dirhtml." + +pickle: + $(SPHINXBUILD) -b pickle $(ALLSPHINXOPTS) $(BUILDDIR)/pickle + @echo + @echo "Build finished; now you can process the pickle files." + +json: + $(SPHINXBUILD) -b json $(ALLSPHINXOPTS) $(BUILDDIR)/json + @echo + @echo "Build finished; now you can process the JSON files." + +htmlhelp: + $(SPHINXBUILD) -b htmlhelp $(ALLSPHINXOPTS) $(BUILDDIR)/htmlhelp + @echo + @echo "Build finished; now you can run HTML Help Workshop with the" \ + ".hhp project file in $(BUILDDIR)/htmlhelp." + +qthelp: + $(SPHINXBUILD) -b qthelp $(ALLSPHINXOPTS) $(BUILDDIR)/qthelp + @echo + @echo "Build finished; now you can run "qcollectiongenerator" with the" \ + ".qhcp project file in $(BUILDDIR)/qthelp, like this:" + @echo "# qcollectiongenerator $(BUILDDIR)/qthelp/OMake-mode.qhcp" + @echo "To view the help file:" + @echo "# assistant -collectionFile $(BUILDDIR)/qthelp/OMake-mode.qhc" + +latex: + $(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex + @echo + @echo "Build finished; the LaTeX files are in $(BUILDDIR)/latex." + @echo "Run \`make all-pdf' or \`make all-ps' in that directory to" \ + "run these through (pdf)latex." + +changes: + $(SPHINXBUILD) -b changes $(ALLSPHINXOPTS) $(BUILDDIR)/changes + @echo + @echo "The overview file is in $(BUILDDIR)/changes." + +linkcheck: + $(SPHINXBUILD) -b linkcheck $(ALLSPHINXOPTS) $(BUILDDIR)/linkcheck + @echo + @echo "Link check complete; look for any errors in the above output " \ + "or in $(BUILDDIR)/linkcheck/output.txt." + +doctest: + $(SPHINXBUILD) -b doctest $(ALLSPHINXOPTS) $(BUILDDIR)/doctest + @echo "Testing of doctests in the sources finished, look at the " \ + "results in $(BUILDDIR)/doctest/output.txt." diff --git a/package.d/omake-mode/doc/conf.py b/package.d/omake-mode/doc/conf.py new file mode 100644 index 000000000..39968d524 --- /dev/null +++ b/package.d/omake-mode/doc/conf.py @@ -0,0 +1,194 @@ +# -*- coding: utf-8 -*- +# +# OMake-mode documentation build configuration file, created by +# sphinx-quickstart on Wed Feb 2 16:52:15 2011. +# +# This file is execfile()d with the current directory set to its containing dir. +# +# Note that not all possible configuration values are present in this +# autogenerated file. +# +# All configuration values have a default; values that are commented out +# serve to show the default. + +import sys, os + +# If extensions (or modules to document with autodoc) are in another directory, +# add these directories to sys.path here. If the directory is relative to the +# documentation root, use os.path.abspath to make it absolute, like shown here. +#sys.path.append(os.path.abspath('.')) + +# -- General configuration ----------------------------------------------------- + +# Add any Sphinx extension module names here, as strings. They can be extensions +# coming with Sphinx (named 'sphinx.ext.*') or your custom ones. +extensions = [] + +# Add any paths that contain templates here, relative to this directory. +templates_path = ['_templates'] + +# The suffix of source filenames. +source_suffix = '.rst' + +# The encoding of source files. +#source_encoding = 'utf-8' + +# The master toctree document. +master_doc = 'index' + +# General information about the project. +project = u'OMake-mode' +copyright = u'2011, Jun FURUSE' + +# The version info for the project you're documenting, acts as replacement for +# |version| and |release|, also used in various other places throughout the +# built documents. +# +# The short X.Y version. +version = '1.0.0' +# The full version, including alpha/beta/rc tags. +release = '1.0.0' + +# The language for content autogenerated by Sphinx. Refer to documentation +# for a list of supported languages. +#language = None + +# There are two options for replacing |today|: either, you set today to some +# non-false value, then it is used: +#today = '' +# Else, today_fmt is used as the format for a strftime call. +#today_fmt = '%B %d, %Y' + +# List of documents that shouldn't be included in the build. +#unused_docs = [] + +# List of directories, relative to source directory, that shouldn't be searched +# for source files. +exclude_trees = ['_build'] + +# The reST default role (used for this markup: `text`) to use for all documents. +#default_role = None + +# If true, '()' will be appended to :func: etc. cross-reference text. +#add_function_parentheses = True + +# If true, the current module name will be prepended to all description +# unit titles (such as .. function::). +#add_module_names = True + +# If true, sectionauthor and moduleauthor directives will be shown in the +# output. They are ignored by default. +#show_authors = False + +# The name of the Pygments (syntax highlighting) style to use. +pygments_style = 'sphinx' + +# A list of ignored prefixes for module index sorting. +#modindex_common_prefix = [] + + +# -- Options for HTML output --------------------------------------------------- + +# The theme to use for HTML and HTML Help pages. Major themes that come with +# Sphinx are currently 'default' and 'sphinxdoc'. +html_theme = 'default' + +# Theme options are theme-specific and customize the look and feel of a theme +# further. For a list of options available for each theme, see the +# documentation. +#html_theme_options = {} + +# Add any paths that contain custom themes here, relative to this directory. +#html_theme_path = [] + +# The name for this set of Sphinx documents. If None, it defaults to +# " v documentation". +#html_title = None + +# A shorter title for the navigation bar. Default is the same as html_title. +#html_short_title = None + +# The name of an image file (relative to this directory) to place at the top +# of the sidebar. +#html_logo = None + +# The name of an image file (within the static path) to use as favicon of the +# docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32 +# pixels large. +#html_favicon = None + +# Add any paths that contain custom static files (such as style sheets) here, +# relative to this directory. They are copied after the builtin static files, +# so a file named "default.css" will overwrite the builtin "default.css". +html_static_path = ['_static'] + +# If not '', a 'Last updated on:' timestamp is inserted at every page bottom, +# using the given strftime format. +#html_last_updated_fmt = '%b %d, %Y' + +# If true, SmartyPants will be used to convert quotes and dashes to +# typographically correct entities. +#html_use_smartypants = True + +# Custom sidebar templates, maps document names to template names. +#html_sidebars = {} + +# Additional templates that should be rendered to pages, maps page names to +# template names. +#html_additional_pages = {} + +# If false, no module index is generated. +#html_use_modindex = True + +# If false, no index is generated. +#html_use_index = True + +# If true, the index is split into individual pages for each letter. +#html_split_index = False + +# If true, links to the reST sources are added to the pages. +#html_show_sourcelink = True + +# If true, an OpenSearch description file will be output, and all pages will +# contain a tag referring to it. The value of this option must be the +# base URL from which the finished HTML is served. +#html_use_opensearch = '' + +# If nonempty, this is the file name suffix for HTML files (e.g. ".xhtml"). +#html_file_suffix = '' + +# Output file base name for HTML help builder. +htmlhelp_basename = 'OMake-modedoc' + + +# -- Options for LaTeX output -------------------------------------------------- + +# The paper size ('letter' or 'a4'). +#latex_paper_size = 'letter' + +# The font size ('10pt', '11pt' or '12pt'). +#latex_font_size = '10pt' + +# Grouping the document tree into LaTeX files. List of tuples +# (source start file, target name, title, author, documentclass [howto/manual]). +latex_documents = [ + ('index', 'OMake-mode.tex', u'OMake-mode Documentation', + u'Jun FURUSE', 'manual'), +] + +# The name of an image file (relative to this directory) to place at the top of +# the title page. +#latex_logo = None + +# For "manual" documents, if this is true, then toplevel headings are parts, +# not chapters. +#latex_use_parts = False + +# Additional stuff for the LaTeX preamble. +#latex_preamble = '' + +# Documents to append as an appendix to all manuals. +#latex_appendices = [] + +# If false, no module index is generated. +#latex_use_modindex = True diff --git a/package.d/omake-mode/doc/index.rst b/package.d/omake-mode/doc/index.rst new file mode 100644 index 000000000..684307bdd --- /dev/null +++ b/package.d/omake-mode/doc/index.rst @@ -0,0 +1,75 @@ +.. OMake-mode documentation master file, created by + sphinx-quickstart on Wed Feb 2 16:52:15 2011. + You can adapt this file completely to your liking, but it should at least + contain the root `toctree` directive. + +OMake-mode +====================================== + +OMake-mode is an emacs mode for compilation using `OMake build system `_. + +It is a quick reimplementation of ``compilation-mode`` but with some neat features for OCaml programming with ``omake -P``, OMake's persistent mode: + +* Auto jumps to OCaml errors. +* Sounds at build errors and successes using ``aplay``. +* Easy to restart the build. + +Download +----------------------------------- +Available at http://bitbucket.org/camlspotter/omake-mode/ . + +Configuration +----------------------------------------- +It is from my .emacs:: + + (require 'omake-mode) + (setq omake-program-path "/usr/bin/omake") ; The path of omake + (setq omake-program-arguments "-P -w -j 1 --verbose") ; Options + (setq omake-error-highlight-background "#555500") + (global-unset-key "\M-P") + (global-unset-key "\M-N") + (global-unset-key "\M-o") + (global-unset-key "\C-co") + (global-unset-key "\C-cO") + (global-set-key "\M-P" 'omake-previous-error) + (global-set-key "\M-N" 'omake-next-error) + (global-set-key "\M-o" 'omake-round-visit-buffer) + (global-set-key "\C-co" 'omake-run) + (global-set-key "\C-cO" 'omake-rerun) + +Some of the key combinations such as "\\M-P" might not working in Gnome compliant terminals. In such a case, help yourself. + +Usage +---------------------------------------------- + +Start building + + * Open or move to a buffer of the build dir. + * Then \\C-co (omake-run) + + It starts an OMake build and show the build log in a new OMake buffer. + The new build becomes `current` session. + + You can run more than one OMake build sessions. + +Visiting OMake buffers + + \\M-o (omake-round-visit-buffer) round-visits existing OMake buffers and changes the current OMake session. + +Visit OCaml errors of the current OMake session + + \\M-P (omake-previous-error) or \\M-N (omake-next-error) + +Stop the build + + Kill the omake buffer showing the build log + +Restart the current build + + \\C-cO (omake-rerun) kills the current OMake session and restarts it. + +Todos +----------------------------------------------- + +* Support of errors of other languages (C, C++, LaTeX, ...) +* Configuration diff --git a/package.d/omake-mode/doc/make.bat b/package.d/omake-mode/doc/make.bat new file mode 100644 index 000000000..7c7b84d76 --- /dev/null +++ b/package.d/omake-mode/doc/make.bat @@ -0,0 +1,113 @@ +@ECHO OFF + +REM Command file for Sphinx documentation + +set SPHINXBUILD=sphinx-build +set BUILDDIR=_build +set ALLSPHINXOPTS=-d %BUILDDIR%/doctrees %SPHINXOPTS% . +if NOT "%PAPER%" == "" ( + set ALLSPHINXOPTS=-D latex_paper_size=%PAPER% %ALLSPHINXOPTS% +) + +if "%1" == "" goto help + +if "%1" == "help" ( + :help + echo.Please use `make ^` where ^ is one of + echo. html to make standalone HTML files + echo. dirhtml to make HTML files named index.html in directories + echo. pickle to make pickle files + echo. json to make JSON files + echo. htmlhelp to make HTML files and a HTML help project + echo. qthelp to make HTML files and a qthelp project + echo. latex to make LaTeX files, you can set PAPER=a4 or PAPER=letter + echo. changes to make an overview over all changed/added/deprecated items + echo. linkcheck to check all external links for integrity + echo. doctest to run all doctests embedded in the documentation if enabled + goto end +) + +if "%1" == "clean" ( + for /d %%i in (%BUILDDIR%\*) do rmdir /q /s %%i + del /q /s %BUILDDIR%\* + goto end +) + +if "%1" == "html" ( + %SPHINXBUILD% -b html %ALLSPHINXOPTS% %BUILDDIR%/html + echo. + echo.Build finished. The HTML pages are in %BUILDDIR%/html. + goto end +) + +if "%1" == "dirhtml" ( + %SPHINXBUILD% -b dirhtml %ALLSPHINXOPTS% %BUILDDIR%/dirhtml + echo. + echo.Build finished. The HTML pages are in %BUILDDIR%/dirhtml. + goto end +) + +if "%1" == "pickle" ( + %SPHINXBUILD% -b pickle %ALLSPHINXOPTS% %BUILDDIR%/pickle + echo. + echo.Build finished; now you can process the pickle files. + goto end +) + +if "%1" == "json" ( + %SPHINXBUILD% -b json %ALLSPHINXOPTS% %BUILDDIR%/json + echo. + echo.Build finished; now you can process the JSON files. + goto end +) + +if "%1" == "htmlhelp" ( + %SPHINXBUILD% -b htmlhelp %ALLSPHINXOPTS% %BUILDDIR%/htmlhelp + echo. + echo.Build finished; now you can run HTML Help Workshop with the ^ +.hhp project file in %BUILDDIR%/htmlhelp. + goto end +) + +if "%1" == "qthelp" ( + %SPHINXBUILD% -b qthelp %ALLSPHINXOPTS% %BUILDDIR%/qthelp + echo. + echo.Build finished; now you can run "qcollectiongenerator" with the ^ +.qhcp project file in %BUILDDIR%/qthelp, like this: + echo.^> qcollectiongenerator %BUILDDIR%\qthelp\OMake-mode.qhcp + echo.To view the help file: + echo.^> assistant -collectionFile %BUILDDIR%\qthelp\OMake-mode.ghc + goto end +) + +if "%1" == "latex" ( + %SPHINXBUILD% -b latex %ALLSPHINXOPTS% %BUILDDIR%/latex + echo. + echo.Build finished; the LaTeX files are in %BUILDDIR%/latex. + goto end +) + +if "%1" == "changes" ( + %SPHINXBUILD% -b changes %ALLSPHINXOPTS% %BUILDDIR%/changes + echo. + echo.The overview file is in %BUILDDIR%/changes. + goto end +) + +if "%1" == "linkcheck" ( + %SPHINXBUILD% -b linkcheck %ALLSPHINXOPTS% %BUILDDIR%/linkcheck + echo. + echo.Link check complete; look for any errors in the above output ^ +or in %BUILDDIR%/linkcheck/output.txt. + goto end +) + +if "%1" == "doctest" ( + %SPHINXBUILD% -b doctest %ALLSPHINXOPTS% %BUILDDIR%/doctest + echo. + echo.Testing of doctests in the sources finished, look at the ^ +results in %BUILDDIR%/doctest/output.txt. + goto end +) + +:end diff --git a/package.d/omake-mode/omake-mode.el b/package.d/omake-mode/omake-mode.el new file mode 100644 index 000000000..f52bd6879 --- /dev/null +++ b/package.d/omake-mode/omake-mode.el @@ -0,0 +1,408 @@ +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Usage + +; in .emacs: +; (add-to-list 'load-path "THE DIRECTORY THIS ELISP EXISTS") +; (require 'omake-mode) +; (setq omake-program-path "/omake/or/jomake/path") +; (setq omake-program-arguments "-P -w -j 3 --verbose") +; ; omake command options. -w and --verbose are required for error browsing +; (setq omake-error-highlight-background "#880000") +; +; ; key bindings (jfuruse's setting) +; (global-unset-key "\M-P") ; Shift+Alt+p +; (global-unset-key "\M-N") ; Shift+Alt+n +; (global-unset-key "\M-o") ; Alt+o +; (global-unset-key "\M-O") ; Shift+Alt+o +; (global-unset-key [(control shift o)]) ; Ctrl+Shift+o +; +; (global-set-key "\M-O" 'omake-run) +; ; launch a new omake process in the current buffer's directory +; +; (global-set-key [(control shift o)] 'omake-rerun) +; ; restart omake process of the current omake buffer +; +; (global-set-key "\M-P" 'omake-previous-error) +; (global-set-key "\M-N" 'omake-next-error) +; ; visit the previous/next error of the current omake window +; +; (global-set-key "\M-o" 'omake-round-visit-buffer) +; ; visit another omake process window +; +; ; aother possibilities +; (global-unset-key [M-up]) +; (global-unset-key [M-down]) +; (global-set-key [M-up] 'omake-previous-error) +; (global-set-key [M-down] 'omake-next-error) + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Configurables + + ; omake path and args +(defconst omake-program-path "/mnt/global/base/bin/jomake") +(defconst omake-program-arguments "-P -w -j 3 --verbose") + + ; sounds +(defconst omake-sound-success "/home/jfuruse/sounds/eu2/hihat.wav") +(defconst omake-sound-error "/usr/share/sounds/pop.wav") +(defconst omake-sound-start "/home/jfuruse/sounds/eu2/if_nope.wav") + + ; colors +(defconst omake-error-highlight-background "#FFFF00") + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + +(require 'font-lock) + +(defconst omake-buffer-name "*omake*") +(defconst omake-buffer-pattern "^\*omake\*") +(defconst omake-misc-buffer-name "*omake-misc*") + +;;(defconst omake-error-regexp "File \"\\(.*\\)\", line \\([0-9]+\\), characters \\([0-9]+\\)-\\([0-9]+\\)") +(defconst omake-error-regexp ".*error.*") +(defconst omake-progress-regexp "\\[\\([= ]+\\|saved \\.omakedb[= ]*\\)\\] [0-9]+ / [0-9]+\n") +(defconst omake-directory-regexp "- exit \\([^ ]+\\)") + +(defconst omake-report-regexp "\\*\\*\\* omake:.*") +(defconst omake-rebuild-regexp "\\*\\*\\* omake: \\(rebuilding\\|reading OMakefiles$\\)") +(defconst omake-locked-regexp "\\*\\*\\* omake: waiting for project lock:") + +(defconst omake-root-regexp "\\*\\*\\* omake: changing directory to \\(.*\\)") + +(defvar omake-buffers nil) + + ; overlay +(setq omake-overlay-log nil) +(setq omake-overlay-source nil) + +(defun omake-create-overlay () + (let ((overlay (make-overlay 1 1 nil))) + (make-face 'omake-face) + (set-face-doc-string 'omake-face "face for omake highlight") + (set-face-background 'omake-face omake-error-highlight-background) + (overlay-put overlay 'face 'omake-face) + overlay)) + +(defun omake-display-overlay-log (buffer start end) + (interactive) + (if (not (overlayp omake-overlay-log)) + (setq omake-overlay-log (omake-create-overlay))) + (move-overlay omake-overlay-log start end buffer)) + +(defun omake-display-overlay-source (buffer start end) + (interactive) + (if (not (overlayp omake-overlay-source)) + (setq omake-overlay-source (omake-create-overlay))) + (move-overlay omake-overlay-source start end buffer)) + + ; CR jfuruse: use the variable above! +(defconst omake-font-lock-keywords + (list + (cons omake-error-regexp font-lock-warning-face) + (cons omake-progress-regexp font-lock-doc-face) + (cons omake-directory-regexp font-lock-function-name-face) + (cons omake-report-regexp font-lock-type-face))) + + +(defun omake-fold (f st lst) + (if lst (omake-fold f (funcall f st (car lst)) (cdr lst)) + st)) + + ; oh shit, we really have no recursion in elisp + ; (defun omake-filter (p lst) + ; (if lst + ; (if (funcall p (car lst)) + ; (cons (car lst) (omake-filter p (cdr lst))) + ; (omake-filter p (cdr lst))) + ; nil)) + +(defun omake-filter-rev (p lst) + (let ((res nil)) + (mapcar (lambda (x) (if (funcall p x) (setq res (cons x res)))) lst) + res)) + +(defun omake-filter (p lst) + (reverse (omake-filter-rev p lst))) + +(defun omake-filter-map (p lst) + (if lst + (let ((x (funcall p (car lst)))) + (if x (cons x (omake-filter-map p (cdr lst))) + (omake-filter-map p (cdr lst)))) + nil)) + +(defun omake-round-buffers () + (if omake-buffers + (let ((res (car omake-buffers))) + (setq omake-buffers (cdr omake-buffers)) + res) + (setq omake-buffers + (omake-filter (lambda (buf) + (string-match "\\*omake\\*" (buffer-name buf))) + (buffer-list))) + (if omake-buffers (omake-round-buffers)))) + +(defvar omake-current-buffer "") + +(defun omake-display-buffer (buf) + (interactive) + (display-buffer buf) + (setq omake-current-buffer buf)) + +(defun omake-round-visit-buffer () + (interactive) + (let ((buf (omake-round-buffers))) + (if buf (omake-display-buffer buf)) + buf)) + +(defun omake-set-font-lock () + (setq font-lock-defaults + '(omake-font-lock-keywords t ; keyword only + nil nil nil)) + (font-lock-mode 1)) + +(defun omake-create-buffer (dir) + (let ((buffer-name (buffer-name (generate-new-buffer omake-buffer-name)))) + (set-buffer buffer-name) + (cd dir) + (omake-mode) + (omake-set-font-lock) + (make-local-variable 'last-progress-point) + (setq last-progress-point nil) + (make-local-variable 'remained-output) + (setq remained-output nil) + (make-local-variable 'last-line-was-end-of-build) + (setq last-line-was-end-of-build nil) + (make-local-variable 'no-error) + (setq no-error t) + (make-local-variable 'root-dir) + (setq root-dir dir) + buffer-name)) + +(defun omake-play-sound (file) + (start-process "omake-sound" omake-misc-buffer-name "aplay" "--duration=8" file)) + +(defun omake-insert-line (string) + (save-excursion + (goto-char (point-max)) + (insert-before-markers string) ; (insert string) + )) + +(defun omake-insert-progress (string) + (if string + (save-excursion + (goto-char (point-max)) + (setq last-progress-point (point)) + (insert-before-markers string) ; (insert string) + (string-match " [0-9]+ / [0-9]+ +" string) + (setq mode-line-process (replace-match "" t nil string))) + (setq mode-line-process nil))) + + ; place holder for last-progress-meter +;; CR jfuruse: this must be buffer specific +(setq last-progress-meter nil) + +(defun omake-process-filter (process output) + (save-current-buffer + (let ((buffer (process-buffer process))) + ; if buffer is gone, we do nothing. + (if buffer + (progn + (set-buffer buffer) + + ;; concat remained output + (if remained-output + (setq output (concat remained-output output))) + (setq remained-output nil) + + ;; if we print progress meter in the last call, delete it + (if last-progress-point + (save-excursion + (delete-region last-progress-point (point-max)))) + + ;; fix => \n + (while (string-match " " output) + (setq output (replace-match "\n" t nil output))) + + ;; remove progress meter string from log + (while (string-match omake-progress-regexp output) + ;; set the match to last-progress-meter + (setq last-progress-meter (match-string 0 output)) + (setq output (replace-match "" t nil output))) + + ;; print output per line + (while (string-match ".*\n" output) + + ;; clear if a new make started + (if last-line-was-end-of-build (erase-buffer)) + + ;; get the line + (setq line (match-string 0 output)) + (setq output (substring output (match-end 0))) + ;; and print + (omake-insert-line line) + + ;; root + (if (string-match omake-root-regexp line) + (setq root-dir (match-string 1 line))) + + ;; error / warning lines + (if (string-match omake-error-regexp line) + (progn + (omake-play-sound omake-sound-error) + (setq no-error nil) + ;(omake-display-buffer buffer) + )) + + ;; locked + (if (string-match omake-locked-regexp line) + (progn + (omake-play-sound omake-sound-error) + (setq no-error nil) + ;(omake-display-buffer buffer) + )) + + (if (string-match omake-rebuild-regexp line) + (progn + (omake-play-sound omake-sound-start))) + + ;; find the end of build + (setq last-line-was-end-of-build + (string-match "\\*\\*\\* omake: polling for filesystem changes" line)) + (if last-line-was-end-of-build + (progn + (setq last-progress-meter nil) + (omake-insert-line "OMAKE IS WAITING YOUR CHANGE") + (if no-error + (omake-play-sound omake-sound-success)) + (setq no-error t) + ;(omake-display-buffer buffer) + )) + ) + + ;; if something left, it is not ended with \n. Keep it + (setq remained-output output) + + (setq last-progress-point nil) + (omake-insert-progress last-progress-meter)))))) + +(defun omake-find-file-existing (path) + (if (file-exists-p path) + (find-file path) ; CR find-file-literary ? + (progn (message "ERROR: source file %s was not found" path) + nil))) + +(defun omake-display-error (dir file line char-start char-end) + (let + ((path (concat (file-name-as-directory (concat (file-name-as-directory root-dir) dir)) file))) + (message path) + (setq target-buffer (omake-find-file-existing path)) + (if target-buffer + (progn + (goto-line line) + (let* + ((char-of-line (line-beginning-position)) + (char-of-start (+ char-of-line char-start)) + (char-of-end (+ char-of-line char-end))) + (omake-display-overlay-source (current-buffer) char-of-start char-of-end) + (goto-char char-of-start)) + target-buffer) + nil))) + +(defun omake-jump-error (next) + (if (get-buffer omake-current-buffer) + (progn + (set-buffer omake-current-buffer) + (if next (move-end-of-line nil) + (move-beginning-of-line nil)) + (display-buffer omake-current-buffer) + (let ((found-start -1) + (found-end -1) + (dir "") + (file "") + (line "") + (char-start -1) + (char-end -1) + (window (get-buffer-window (current-buffer)))) + (if (progn + (if + (if next + ; sometimes the error has tab in its head... + (re-search-forward omake-error-regexp + nil ; CR BOUND can be used to avoid the summary + t ; ignore not found error and return simply nil + ) + (re-search-backward omake-error-regexp + nil t)) + (progn + (setq found-start (match-beginning 0)) + (setq found-end (match-end 0)) + (setq file (match-string 1)) + (setq line (string-to-int (match-string 2))) + (setq char-start (string-to-int (match-string 3))) + (setq char-end (string-to-int (match-string 4))) + (set-window-point window (if next found-end found-start)) + (save-excursion + ; (if (re-search-backward "Entering directory `\\(.*\\)'" nil t) + (if (re-search-forward omake-directory-regexp nil t) + (progn + (setq dir (match-string 1)) + t) + (progn + (message "Error message found but no directory info") + nil)))) + (progn + (message "No more error found") + ; (delete-overlay omake-overlay-log) + ; (delete-overlay omake-overlay-source) + nil))) + (progn ; search successful: highlight the error line + (save-current-buffer (omake-display-error dir file line char-start char-end)) + (omake-display-overlay-log (current-buffer) found-start found-end) + )))) + (message "no omake buffer selected"))) + +(defun omake-next-error () + (interactive) + (omake-jump-error t)) + +(defun omake-previous-error () + (interactive) + (omake-jump-error nil)) + +(defun omake-mode () + (interactive) + (setq major-mode 'omake-mode) + (setq mode-name "omake mode")) + +(defun omake-run-dir (dir) + (interactive) + (save-current-buffer + (setq debug-on-error t) + (let* ((buffer (omake-create-buffer dir)) + (process + (start-process-shell-command buffer buffer + omake-program-path + omake-program-arguments))) + (setq last-progress-meter nil) + (set-process-filter process 'omake-process-filter) + (omake-display-buffer buffer) + ))) + +(defun omake-run () + (interactive) + (omake-run-dir default-directory)) + +(defun omake-rerun () + (interactive) + (if omake-current-buffer + (if (get-buffer omake-current-buffer) + (let ((old-buffer omake-current-buffer) + (dir (save-current-buffer + (set-buffer omake-current-buffer) + default-directory))) + (omake-run-dir dir) + (kill-buffer old-buffer)) + (message "no current omake buffer")) + (message "no current omake buffer"))) + +(provide 'omake-mode) diff --git a/package.d/omake-mode/omake-mode.elc b/package.d/omake-mode/omake-mode.elc new file mode 100644 index 000000000..921d24fa6 Binary files /dev/null and b/package.d/omake-mode/omake-mode.elc differ