Git Product home page Git Product logo

malabar-mode's Introduction

Melpa Status

malabar-mode

EMACS integration with the JVM.

malabar is moving to JDEE

As of October 21, 2016, malabar mode is uniting with https://github.com/jdee-emacs/jdee. No more work will be done on malabar and all the useful functionality has been or will be moved to JDEE. I recommend using JDEE instead of malabar (I have).

If there is malabar functionality missing from JDEE, please create an issue at https://github.com/jdee-emacs/jdee/issues with "from malabar" in the title specifying the missing functionality.

I will leave this project up for reference but no issues are being worked and no updates will be made. My efforts will go to improving JDEE.

Summary

malabar-mode is a monir-mode with hooks into Maven that makes it easy to compile files on the fly and execute Maven build commands.

NOTE: The java/groovy code has been moved to https://github.com/m0smith/malabar-mode-jar

This is based on a fork of buzztaiki's fork of espenhw's malabar-mode which has been merged back into the master branch. Development of malabar-mode has restarted. This is an attempt to keep it up to date and develop at a modest pace.

You may want to skip to Installation.

What malabar-mode offers

Since malabar-mode can be used from both java-mode and groovy-mode, we get some things for free:

  • Syntax highlighting

  • Movement commands (C-M-f/-b is a winner; so is M-f/-b, especially with c-subword-mode turned on)

  • Electric punctuation

There's lots more; and since this is Emacs, you can turn off or modify anything you don't like.

But there is more:

  • Tight integration with Maven. If you're not using Maven, you should not consider malabar-mode for now. Adding gradle support is pending.

  • A Groovy console for rapid prototyping and exploratory programming

  • JUnit integration, both for running tests standalone and through Maven

  • Debugger integration with EMACS built in GUD

  • Import help; import one class or all needed classes in the buffer (with prompting if the class name is ambiguous)

  • Extend class / implement interface / override method helpers

  • Simplistic refactorings

  • See the Cheat Sheet

and more.

# Installation

There has been a lot of work to rewrite malabar-mode to make it easier to maintain, install and develop. It is currently in a beta stage. Once it has some time to mature, it will be put back into MELPA. Until then, the installation is manual:

    git clone https://github.com/alexott/cedet.git
    cd cedet
    make all
  • Install malabar-mode from melpa

  • Install emacs package groovy-mode. Do not use marmalade version as it is old.

  • Add to .emacs:


	(load-file "~/projects/cedet/cedet-devel-load.el")
    (add-hook 'after-init-hook (lambda ()
			     (message "activate-malabar-mode")
			     (activate-malabar-mode)))

    (add-hook 'malabar-java-mode-hook 'flycheck-mode)
    (add-hook 'malabar-groovy-mode-hook 'flycheck-mode)



  • in emacs (malabar-run-groovy) or C-u M-x run-groovy - you may need to enter the path to groovysh, especially on Windows
  • Edit a java/groovy file in a maven2 project

NOTE 1.x is no longer supported and no more development will happen on this branch

The malabar-mode package is now part of MELPA thanks to this issue. Make sure you have the MELPA package archive enabled in your init.el or .emacs and your package contents are up to date (use M-x package-refresh-contents if you can’t find the malabar-mode package and you’ve added MELPA to your package archives.

Prerequisites

Groovy

Version 2.3.7 or beyond

Emacs

malabar-mode was originally developed on Emacs 23, but development now targets Emacs 24.

CEDET

  1. (optional) If you want to mimic the IDEish compile-on-save behaviour, add the following as well::

     (add-hook 'malabar-mode-hook
          (lambda () 
            (add-hook 'after-save-hook 'malabar-http-compile-file-silently
                       nil t)))
    

Usage

Update: malabar-mode now has a menu. Yay!

Java

What's working

  • flycheck integration is working except for the few edge cases where the groovy parser differs from th ejava parser

  • cedet integration for java, not working for groovy yet

  • unit testing a class or method

The 3 faces of malabar-mode

The malabar minor mode has three different integrations: an interactive groovy shell (repl), a malabar HTTP server (http), and the external project manager like maven or gradle (pm). Each of the integrations is managed seperately. That is, compiling a file using the service will not load that class into the repl. As such, the functions will be named so it is obvious which integration is used: malabar-repl- , malabar-http-, or malabar-pm-

Here is a list of available interactive commands by integration, with default keybindings where applicable:

Unit Test

malabar-http-run-test (C-c C-v t)
Runs the unit tests in the current class. With a prefix args, ask for a method name and only run that test
semantic-ia-describe-class (C-c C-v i)
Show the public variables and methods on a class
malabar-semantic-heirarchy (C-c C-v h)
Show super classes and interfaces implemented by a class
malabar-fully-qualified-class-name-kill-ring-save (C-c C-v *)
Copy the fully qualifed classname of the current buffer to the kill ring
malabar-which (C-c C-v w)
Returns the jar containing the speficied class
malabar-import-all (C-c C-v z)
Adds import statements for all unqualified classes in the buffer, as if by performing malabar-import-one-class on each.
malabar-import-one-class (C-c C-v C-z)

Adds an import statement for a single unqualified class (defaults to the symbol at point). If more than one class matches the unqualified name you will be asked which class to import.

The variable malabar-import-excluded-classes-regexp-list contains a list of regular expressions; if one of these matches the qualified class name, the class will be excluded from import. The default value excludes classes from java.lang, JRE internal classes and inner classes.

ede-edit-file-target (C-c C-v C-p)
Visit the project file, that is the closest file named pom.xml searching upwards in the directory structure.
malabar-repl-send-buffer (C-c C-v C-k)
Send the contents of the current buffer to the running groovy instance. If the buffer is a class rather than a script, prefer malabar-repl-mode-load-class
malabar-stack-trace-buffer (C-c C-v C-#)
Create a new stack trace buffer and optional copy the current region into it. A stack trace buffer parses the stack trace and allows jumping directly to the error in the source file. The stack trace buffer will parse whatever stack trace is pasted into it
malabar-repl-send-classpath-of-buffer (C-c C-v s)
For use with malabar-repl-send-buffer and malabar-repl-mode-load-class, it loads the classpath of the current project into the running groovy buffer. This allows for code in the current project to be used interactively.
malabar-repl-send-classpath-element (C-c C-v s)
Add a jar, zip or directory to the running groovy buffer
malabar-jdb (C-c C-v J)
Start the JDB debugger on the current class.
malabar-update-package
Updates the package statement of the current buffer to match its place in the source directory.
malabar-implement-interface (C-c C-v C-i)
Prompts for an interface, adds stub implementations of all that interface's methods and adds the interface to the class's implements clause.
malabar-jump-to-thing (C-c C-v C-y)
Jumps to the definition of the 'thing' at point. More technically, uses semantic-analyze-current-context output to identify an origin for the code at point, taking type membership into account. This function is much like semantic-ia-fast-jump, only a little smarter.

In addition, standard Semantic code completion is available; trigger this however you wish. By default, semantic-ia-complete-symbol is bound to C-c C-v C-. and semantic-ia-complete-symbol-menu is bound to C-c C-v ..

Still needing attention

The following are either not in 2.0 yet or are only partially working. If you use any of these regularly, please use the issue tracker to let me know. Those missing features that have issues added will be given higher priority. Otherwise, they will be added back in random order.

malabar-http-compile-file (C-c C-v C-c)
Compiles the current file.
malabar-clear-typecache
Clears the type cache (used for code completion) if it gets confused. If you have to use this often, please file a bug.
malabar-extend-class (C-c C-v C-e)
Prompts for a class, adds stub implementations of all that class's abstract methods and accessible constructors and inserts the appropriate extends clause.
malabar-repl-start
Start the Groovy console, or pop to it if it is running.
malabar-repl-stop
Kill the Groovy console process.
malabar-run-maven-command
Prompts for and executes an (almost) arbitrary Maven command line. Honors profile activation, property definitions and lifecycle phases/goals. E.g.: -DskipTests=true -Pdev-mode install will run the install lifecycle with the dev-mode profile active, skipping tests.
malabar-install-project (C-c C-v C-b)
Runs mvn install on your project. With prefix argument (C-u), cleans the project first (mvn clean install).
malabar-override-method (C-c C-v C-o)
Prompts for an eligible method from the superclass of the class at point and adds a stub implementation of that method. If the chosen method is one of Object.equals` or `Object.hashCode, override both of them.
malabar-run-all-tests (C-c C-v M-t)
Runs mvn test on your project. With prefix argument (C-u), cleans the project first (mvn clean test).
malabar-run-junit-test-no-maven (C-c C-v C-t)
Compiles the current file, performs malabar-visit-corresponding-test, compiles that file (if not the same as where we started) and runs the now-current buffer as a standalone JUnit test.
malabar-http-run-test (C-c C-v t)
Runs the corresponding test to this buffer using Maven (mvn test -Dtest=classname)
malabar-visit-corresponding-test

Visits the corresponding test class; that is, the file in the parallel src/test/java hierarchy that matches the class in the current buffer (with malabar-test-class-suffix appended).

E.g., M-x malabar-visit-corresponding-test in a buffer visiting src/main/java/org/grumblesmurf/malabar/MvnServer.java will visit the file src/test/java/org/grumblesmurf/malabar/MvnServerTest.java with the default value of malabar-test-class-suffix.

If the current buffer looks like a test class, this command does nothing.

malabar-refactor-extract-constant (C-c C-v C-r C-c)
Extracts the thing at point as a named constant. The scope of the constant will default to malabar-refactor-extract-constant-default-scope, but with a prefix arg will prompt for the scope.

Abbrevs

Some default abbrevs are set up, see the variable malabar-case-fixed-abbrevs for the current list.

Note the presence of the #Test abbrev; this expands to::

 @Test
 public void |() throws Exception {
     fail("Unfinished test");
 }

With point left at the position marked with |.

Electric expansions

In addition to the electric insertion offered by CC-mode, malabar-mode offers an expansion that simulates the Elvis operator, although the generated code is not as efficient as a language-provided Elvis operator would be. This expansion is controlled by the variable malabar-electric-elvis-p.

This is cool, I want to help

Github has excellent support for forking! Just hit the fork button at the top, code and go. For everyone's convenience, you should probably rebase to m0smith/malabar-mode/master every now and then. :)

If you don't want to go that far, git is, after all, a distributed VCS. Just commit to your local repository and then use git-format-patch to extract patches in a useful format.

But where do I send patches?

To the issue tracker (see the next section).

I found a bug!

Good for you. Create a ticket in the issue tracker and stuff will happen.

Hint #1: Tell me what you did, what you expected to happen and what actually happened. Include any error messages (Emacs backtraces, output in the buffers named starting with *Malabar, interesting stuff from *Messages* etc.).

Hint #2: Bugs with patches tend to be fixed faster (see the previous section).

Wouldn't it be cool if malabar-mode could...

Yes, it probably would! Either describe the feature that you want in the issue tracker, or (even better) fork, code, and ask me to pull.

And of course, if I nix your feature request, you're free to maintain your own local patch branch if you wish (or, for that matter, a complete fork). malabar-mode is Open Source, after all.

Hacking

This fork of malabar-mode uses git-flow to manage branching in development. As such, branches are:

develop
tracks the latest state of development (that isn't occurring in an isolated branch)
master
tracks the latest stable snapshot

Feature, release, feature, hotfix, and support branches won't usually be shared. If they are pushed to github, they shouldn't be rebased but may disappear after they are merged with develop or master.

Emacs environment

Your Emacs environment can be configured to use a "live" version of malabar-mode with the following steps:

  1. Add the following to your .emacs:

    (setq malabar-repl-lib-dir "/src/malabar-mode/target/lib") (setq malabar-repl-extra-classpath '("/src/malabar-mode/target/classes")) (add-to-list 'load-path "~/src/malabar-mode/src/main/lisp/")

  2. Run mvn package -P devel to extract libraries into target/lib.

With this configuration, you can rebuild malabar-mode's JVM component with mvn compile, which will compile classes into target/classes. To apply these changes, restart malabar-mode in Emacs with M-x malabar-repl-restart.

After editing elisp files, eval them to apply changes immediately.

Hints for Cygwin

Try

(setq malabar-util-path-separator ";")
(setq malabar-util-path-filter 'cygwin-convert-file-name-to-windows)
(setq malabar-util-groovy-file-filter 'malabar-util-reverse-slash)

Acknowledgments

  • JDEE for being a source of frustration and inspiration (and sometimes of code)
  • Nikolaj Schumacher for fringe-helper and elk-test
  • espenhw for getting the whole thing rolling
  • nflath, stepb and bbatsov for caring enough to help
  • Everybody else for caring enough read this and report bugs

Boring legal stuff

malabar-mode is copyright (c) 2009-2014 Matthew O. Smith [email protected]

This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

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.

For the full text of the GPL, see http://www.gnu.org/licenses/gpl2.txt.

malabar-mode's People

Contributors

abend avatar buzztaiki avatar cocoatomo avatar codefarmer avatar dstu avatar espenhw avatar lwiechec avatar m0smith avatar nflath avatar otfrom avatar purcell avatar stepb avatar wilfred avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

malabar-mode's Issues

Build Error on OS X

Hello,

I am getting an error on running 'mvn package':

Result of /bin/sh -c cd /Users/kmarti05/workspace_ext/malabar-mode && emacs -Q --batch -l src/test/lisp/all-tests.el execution is: '1'.

This is occurring right after unit test run and succeed. Here is all of the output:

06:44:15 malabar-mode $ mvn package
[INFO] Scanning for projects...
[INFO] ------------------------------------------------------------------------
[INFO] Building Malabar: A better Java mode for Emacs
[INFO] task-segment: [package]
[INFO] ------------------------------------------------------------------------
[INFO] [groovy:generateStubs {execution: default}]
[INFO] Generated 12 Java stubs
[INFO] [resources:resources {execution: default-resources}]
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory /Users/kmarti05/workspace_ext/malabar-mode/src/main/resources
[INFO] [compiler:compile {execution: default-compile}]
[INFO] Nothing to compile - all classes are up to date
[INFO] [groovy:compile {execution: default}]
[INFO] Compiled 70 Groovy classes
[INFO] [resources:testResources {execution: default-testResources}]
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory /Users/kmarti05/workspace_ext/malabar-mode/src/test/resources
[INFO] [compiler:testCompile {execution: default-testCompile}]
[INFO] Nothing to compile - all classes are up to date
[INFO] [groovy:testCompile {execution: default}]
[INFO] No sources found to compile
[INFO] [surefire:test {execution: default-test}]
[INFO] Surefire report directory: /Users/kmarti05/workspace_ext/malabar-mode/target/surefire-reports


T E S T S

Running org.grumblesmurf.malabar.UtilsTest
Tests run: 3, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 1.124 sec
Running org.grumblesmurf.malabar.GroovyServerTest
Tests run: 2, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 1.571 sec
Running org.grumblesmurf.malabar.SemanticReflectorTest
Tests run: 21, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 1.032 sec
Running org.grumblesmurf.malabar.ClasspathTest
Tests run: 7, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 2.077 sec
Running org.grumblesmurf.malabar.ProjectsTest
Tests run: 6, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 4.995 sec
Running org.grumblesmurf.malabar.TypestringTest
Tests run: 13, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.05 sec

Results :

Tests run: 52, Failures: 0, Errors: 0, Skipped: 0

[INFO] [exec:exec {execution: run-elisp-tests}]
[INFO] Loading /Users/kmarti05/workspace_ext/malabar-mode/src/test/lisp/malabar-util.elk...
[INFO] **FAIL: parse-maven-command-line all together: (Symbol's function definition is void: string-match-p)
[INFO] *__FAIL: parse-maven-command-line multiple definitions: (Symbol's function definition is void: string-match-p)
[INFO] *__FAIL: parse-maven-command-line simple definition: (Symbol's function definition is void: string-match-p)
[INFO] *__FAIL: parse-maven-command-line multiple profiles: (Symbol's function definition is void: string-match-p)
[INFO] *__FAIL: parse-maven-command-line single profile: (Symbol's function definition is void: string-match-p)
[INFO] *__FAIL: parse-maven-command-line two goals one mojo: (Symbol's function definition is void: string-match-p)
[INFO] *__FAIL: parse-maven-command-line two goals: (Symbol's function definition is void: string-match-p)
[INFO] *__FAIL: parse-maven-command-line simple: (Symbol's function definition is void: string-match-p)
[INFO] *__FAIL: string-with-newline: (Symbol's function definition is void: string-match-p)
[INFO] *__FAIL: string-with-newline nonl: (Symbol's function definition is void: string-match-p)
[INFO] *__FAIL: string-with-newline empty: (Symbol's function definition is void: string-match-p)
[INFO] *__FAIL: end-with no match: (Symbol's function definition is void: string-match-p)
[INFO] *__FAIL: end-with match: (Symbol's function definition is void: string-match-p)
[INFO] *__FAIL: end-with empty: (Symbol's function definition is void: string-match-p)
[INFO] *__FAIL: start-with no match: (Symbol's function definition is void: string-match-p)
[INFO] *__FAIL: start-with match: (Symbol's function definition is void: string-match-p)
[INFO] *
*FAIL: start-with empty: (Symbol's function definition is void: string-match-p)
[INFO] ------------------------------------------------------------------------
[ERROR] BUILD ERROR
[INFO] ------------------------------------------------------------------------
[INFO] Result of /bin/sh -c cd /Users/kmarti05/workspace_ext/malabar-mode && emacs -Q --batch -l src/test/lisp/all-tests.el execution is: '1'.
[INFO] ------------------------------------------------------------------------
[INFO] For more information, run Maven with the -e switch
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 20 seconds
[INFO] Finished at: Wed Jul 21 06:44:38 EDT 2010
[INFO] Final Memory: 38M/101M
[INFO] ------------------------------------------------------------------------

I am running
GNU Emacs 23.1.90.1 (i386-apple-darwin9.8.0, NS apple-appkit-949.54) of 2010-06-22 on OS X 10.5.8.

My emacs is aliased to '/Applications/Emacs.app/Contents/MacOS/Emacs -nw'

What would be the steps to track down the cause? I am almost sure this is due to something in my environment, rather than malabar itself.

Thanks,

Karl

get/set creation fails if field already exists

I'm running Emacs with M-x version giving:
GNU Emacs 23.2.1 (x86_64-pc-linux-gnu, GTK+ Version 2.20.1) of 2010-05-16 on barber, modified by Debian

I'm using the cedet bundled with this version of Emacs.

Issuing C-c C-v C-g for an existing class field gives the message:

srecode-insert-getset: Must specify field for get/set. (parts may not be impl'd yet.)

If I create a new field this way, C-c C-v C-g behaves appropriately.

maven-free classpath/sourcepath declaration

malabar-mode's integration with maven must be a boon to those who already use maven but seems unnecessarily restrictive for those who don't.
In particular I work with a codebase that does its own dependency management and build tool invocation. I'd like a way to tell malabar-mode about the classpath & sourcepath to use for my projects, preferably in lisp, keyed by the project's root directory (i.e. anything under project1's root should have this set of settings, etc).

Does this sound like something you'd like to have in malabar-mode?

In case the above is unclear, the comparable feature in JDEE is http://jdee.sourceforge.net/jdedoc/html/jde-ug/jde-ug.html which lets users specify classpath/sourcepath settings on a per-project basis by either hardcoding them into a prj.el file at the root of the project or else have a prj.el that calls out to lisp functions that return the approprate paths.

malabar-import-all throws Wrong type argument, sequencep, ERROR

malabar-import-all doesn't work for me.

Given this buffer:

package com.example.webserver;

import java.net.URL;
import java.io.IOException;
import java.util.logging.Level;
import java.util.logging.Logger;
import org.xlightweb.BadMessageException;
import org.xlightweb.IHttpRequestHandler;
import org.xlightweb.IHttpRequest;
import org.xlightweb.IHttpExchange;

class HTTPHandler implements IHttpRequestHandler
{
    private static final Logger log = 
        Logger.getLogger(EchoHandler.class.getName());

    public void onRequest(IHttpExchange exchange) 
        throws IOException, BadMessageException
    {
        IHttpRequest req = exchange.getRequest();
        URL url = req.getRequestUrl();

        log.info(url.getPath());
    }
}

I get this error:

Debugger entered--Lisp error: (wrong-type-argument sequencep ERROR)
  cl-position("java.lang.IHTTPRequestHandler" ERROR 0 nil nil)
  position("java.lang.IHTTPRequestHandler" ERROR :test equal)
  apply(position "java.lang.IHTTPRequestHandler" ERROR (:test equal))
  find("java.lang.IHTTPRequestHandler" ERROR :test equal)
  (or (malabar-find-imported-class-from-wildcard-imports classname buffer) (find (concat "java.lang." classname) (malabar-qualify-class-name classname buffer) :test (function equal)))
  (if (malabar-find-project-file buffer) (or (malabar-find-imported-class-from-wildcard-imports classname buffer) (find ... ... :test ...)) (or (cdr ...) (concat ... "." classname)))
  (or (when (> ... 1) classname) (when import-tag (semantic-tag-name import-tag)) (if (malabar-find-project-file buffer) (or ... ...) (or ... ...)))
  (let ((import-tag ...)) (or (when ... classname) (when import-tag ...) (if ... ... ...)))
  (let ((tags ...)) (let (...) (or ... ... ...)))
  malabar-find-imported-class("IHTTPRequestHandler")
  (or (malabar-class-defined-in-buffer-p token) (malabar-find-imported-class token))
  (lambda (token) (or (malabar-class-defined-in-buffer-p token) (malabar-find-imported-class token)))("IHTTPRequestHandler")
  remove*(nil ("IOException" "BufferUnderflowException" "Level" "Logger" "IDataHandler" "INonBlockingConnection" "MaxReadSizeExceededException" "HTTPHandler" "IHTTPRequestHandler" "Logger" "Logger" "EchoHandler" "IHttpExchange" "IOException" "BadMessageException" "String" "System") :if (lambda (token) (or (malabar-class-defined-in-buffer-p token) (malabar-find-imported-class token))))
  apply(remove* nil ("IOException" "BufferUnderflowException" "Level" "Logger" "IDataHandler" "INonBlockingConnection" "MaxReadSizeExceededException" "HTTPHandler" "IHTTPRequestHandler" "Logger" "Logger" "EchoHandler" "IHttpExchange" "IOException" "BadMessageException" "String" "System") :if (lambda (token) (or (malabar-class-defined-in-buffer-p token) (malabar-find-imported-class token))) nil)
  remove-if((lambda (token) (or (malabar-class-defined-in-buffer-p token) (malabar-find-imported-class token))) ("IOException" "BufferUnderflowException" "Level" "Logger" "IDataHandler" "INonBlockingConnection" "MaxReadSizeExceededException" "HTTPHandler" "IHTTPRequestHandler" "Logger" "Logger" "EchoHandler" "IHttpExchange" "IOException" "BadMessageException" "String" "System"))
  (remove-duplicates (remove-if (lambda ... ...) type-tokens) :test (function equal))
  (let ((type-tokens ...)) (remove-duplicates (remove-if ... type-tokens) :test (function equal)))
  malabar-import-candidates()
  (mapcar (function malabar-import-find-import) (malabar-import-candidates))
  (remove nil (mapcar (function malabar-import-find-import) (malabar-import-candidates)))
  (let ((imports ...)) (when imports (malabar-import-insert-imports imports)))
  (when-let (imports (remove nil ...)) (malabar-import-insert-imports imports))
  malabar-import-all()
  eval((malabar-import-all))
  eval-last-sexp-1(nil)
  eval-last-sexp(nil)
  call-interactively(eval-last-sexp nil nil)
  recursive-edit()
  byte-code("?  @?=?!???\"???!?A@)??=?!???\"??
Zy?|?)?c?eb???? \"???!???!?????!??? ?+ه" [unread-command-char debugger-args x debugger-buffer noninteractive debugger-batch-max-lines -1 debug backtrace-debug 4 t backtrace-frame lambda 5 pop-to-buffer debugger-mode debugger-setup-buffer count-lines 2 "...\n" message "%s" buffer-string kill-emacs "" nil recursive-edit middlestart buffer-read-only standard-output] 4)
  debug(error (wrong-type-argument sequencep ERROR))
  cl-position("java.lang.IHTTPRequestHandler" ERROR 0 nil nil)
  position("java.lang.IHTTPRequestHandler" ERROR :test equal)
  apply(position "java.lang.IHTTPRequestHandler" ERROR (:test equal))
  find("java.lang.IHTTPRequestHandler" ERROR :test equal)
  (or (malabar-find-imported-class-from-wildcard-imports classname buffer) (find (concat "java.lang." classname) (malabar-qualify-class-name classname buffer) :test (function equal)))
  (if (malabar-find-project-file buffer) (or (malabar-find-imported-class-from-wildcard-imports classname buffer) (find ... ... :test ...)) (or (cdr ...) (concat ... "." classname)))
  (or (when (> ... 1) classname) (when import-tag (semantic-tag-name import-tag)) (if (malabar-find-project-file buffer) (or ... ...) (or ... ...)))
  (let ((import-tag ...)) (or (when ... classname) (when import-tag ...) (if ... ... ...)))
  (let ((tags ...)) (let (...) (or ... ... ...)))
  malabar-find-imported-class("IHTTPRequestHandler")
  (or (malabar-class-defined-in-buffer-p token) (malabar-find-imported-class token))
  (lambda (token) (or (malabar-class-defined-in-buffer-p token) (malabar-find-imported-class token)))("IHTTPRequestHandler")
  remove*(nil ("IOException" "BufferUnderflowException" "Level" "Logger" "IDataHandler" "INonBlockingConnection" "MaxReadSizeExceededException" "HTTPHandler" "IHTTPRequestHandler" "Logger" "Logger" "EchoHandler" "IHttpExchange" "IOException" "BadMessageException" "String" "System") :if (lambda (token) (or (malabar-class-defined-in-buffer-p token) (malabar-find-imported-class token))))
  apply(remove* nil ("IOException" "BufferUnderflowException" "Level" "Logger" "IDataHandler" "INonBlockingConnection" "MaxReadSizeExceededException" "HTTPHandler" "IHTTPRequestHandler" "Logger" "Logger" "EchoHandler" "IHttpExchange" "IOException" "BadMessageException" "String" "System") :if (lambda (token) (or (malabar-class-defined-in-buffer-p token) (malabar-find-imported-class token))) nil)
  remove-if((lambda (token) (or (malabar-class-defined-in-buffer-p token) (malabar-find-imported-class token))) ("IOException" "BufferUnderflowException" "Level" "Logger" "IDataHandler" "INonBlockingConnection" "MaxReadSizeExceededException" "HTTPHandler" "IHTTPRequestHandler" "Logger" "Logger" "EchoHandler" "IHttpExchange" "IOException" "BadMessageException" "String" "System"))
  (remove-duplicates (remove-if (lambda ... ...) type-tokens) :test (function equal))
  (let ((type-tokens ...)) (remove-duplicates (remove-if ... type-tokens) :test (function equal)))
  malabar-import-candidates()
  (mapcar (function malabar-import-find-import) (malabar-import-candidates))
  (remove nil (mapcar (function malabar-import-find-import) (malabar-import-candidates)))
  (let ((imports ...)) (when imports (malabar-import-insert-imports imports)))
  (when-let (imports (remove nil ...)) (malabar-import-insert-imports imports))
  malabar-import-all()
  eval((malabar-import-all))
  eval-last-sexp-1(nil)
  eval-last-sexp(nil)
  call-interactively(eval-last-sexp nil nil)
  recursive-edit()
  byte-code("?  @?=?!???\"???!?A@)??=?!???\"??
Zy?|?)?c?eb???? \"???!???!?????!??? ?+ه" [unread-command-char debugger-args x debugger-buffer noninteractive debugger-batch-max-lines -1 debug backtrace-debug 4 t backtrace-frame lambda 5 pop-to-buffer debugger-mode debugger-setup-buffer count-lines 2 "...\n" message "%s" buffer-string kill-emacs "" nil recursive-edit middlestart buffer-read-only standard-output] 4)
  debug(error (wrong-type-argument sequencep ERROR))
  cl-position("java.lang.String" ERROR 0 nil nil)
  position("java.lang.String" ERROR :test equal)
  apply(position "java.lang.String" ERROR (:test equal))
  find("java.lang.String" ERROR :test equal)
  (or (malabar-find-imported-class-from-wildcard-imports classname buffer) (find (concat "java.lang." classname) (malabar-qualify-class-name classname buffer) :test (function equal)))
  (if (malabar-find-project-file buffer) (or (malabar-find-imported-class-from-wildcard-imports classname buffer) (find ... ... :test ...)) (or (cdr ...) (concat ... "." classname)))
  (or (when (> ... 1) classname) (when import-tag (semantic-tag-name import-tag)) (if (malabar-find-project-file buffer) (or ... ...) (or ... ...)))
  (let ((import-tag ...)) (or (when ... classname) (when import-tag ...) (if ... ... ...)))
  (let ((tags ...)) (let (...) (or ... ... ...)))
  malabar-find-imported-class("String")
  (or (malabar-class-defined-in-buffer-p token) (malabar-find-imported-class token))
  (lambda (token) (or (malabar-class-defined-in-buffer-p token) (malabar-find-imported-class token)))("String")
  remove*(nil ("UnknownHostException" "IOException" "IServer" "Server" "App" "String" "UnknownHostException" "IOException" "IServer" "Server" "EchoHandler" "System") :if (lambda (token) (or (malabar-class-defined-in-buffer-p token) (malabar-find-imported-class token))))
  apply(remove* nil ("UnknownHostException" "IOException" "IServer" "Server" "App" "String" "UnknownHostException" "IOException" "IServer" "Server" "EchoHandler" "System") :if (lambda (token) (or (malabar-class-defined-in-buffer-p token) (malabar-find-imported-class token))) nil)
  remove-if((lambda (token) (or (malabar-class-defined-in-buffer-p token) (malabar-find-imported-class token))) ("UnknownHostException" "IOException" "IServer" "Server" "App" "String" "UnknownHostException" "IOException" "IServer" "Server" "EchoHandler" "System"))
  (remove-duplicates (remove-if (lambda ... ...) type-tokens) :test (function equal))
  (let ((type-tokens ...)) (remove-duplicates (remove-if ... type-tokens) :test (function equal)))
  malabar-import-candidates()
  (mapcar (function malabar-import-find-import) (malabar-import-candidates))
  (remove nil (mapcar (function malabar-import-find-import) (malabar-import-candidates)))
  (let ((imports ...)) (when imports (malabar-import-insert-imports imports)))
  (when-let (imports (remove nil ...)) (malabar-import-insert-imports imports))
  malabar-import-all()
  eval((malabar-import-all))
  eval-last-sexp-1(nil)
  eval-last-sexp(nil)
  call-interactively(eval-last-sexp nil nil)

My Java version is:

java version "1.6.0_17"
Java(TM) SE Runtime Environment (build 1.6.0_17-b04-248-10M3025)
Java HotSpot(TM) 64-Bit Server VM (build 14.3-b01-101, mixed mode)

cedet is 1.0pre7

Malabar hangs starting groovey in second emacs instance

Start malabar in emacs then launch a second emacs instance and start malabar. Malabar hangs in the second instance at: Starting Groovy...waiting for main prompt. Emacs reports the following process is running: Malabar Groovy run *Malabar Groovy* /dev/pts/8 java -cp [classpath appears here] org.grumblesmurf.malabar.GroovyServer -c 5555 -e 6666

The process outputs:
Exception in thread "GroovyServer on 5555" Exception in thread "GroovyServer on 6666" java.net.BindException: Address already in use
(followed by a stack trace)

I think I can fix this one.

getset creation not working

Please help..None of getset comands are working..
Using Emacs 23.2.1 with latest malabar 1.4.0

seems rltd to:
symbol function is void: subword-capitalize

C-c C-v . doesn't work (semantic-ia-complete-symbol-menu missing?)

I'm running Emacs with M-x version giving:
GNU Emacs 23.2.1 (x86_64-pc-linux-gnu, GTK+ Version 2.20.1) of 2010-05-16 on barber, modified by Debian

I'm using the cedet bundled with this version of Emacs.

C-c C-v . leads to the message:

Symbol's function definition is void: semantic-ia-complete-symbol-menu

From what I can tell, it looks like semantic-ia-complete-symbol-menu doesn't exist in the bundled version of cedet. (I checked http://git.savannah.gnu.org/cgit/emacs.git/tree/lisp/cedet/semantic/ia.el and grepped for that string in HEAD of master in the Emacs source tree.)

malabar-extra-source-locations

I tried to add /usr/lib/jvm/java-6-sun/src.zip to the variable malabar-extra-source-locations.

However jumping to the contained code like java.lang.String using C-c C-v C-y does not work.
The error message is "could not find suitable jump point"

[Feature] Jump to project

At work I have a Maven project with 30+ modules (I guess that's a typical size for enterprise projects).
I often have to be jumping between source files in different modules, and that gives you finger ache when using a shell (or Emacs minibuffer). So I have come up with a simple feature idea:

  1. Malabar keeps a cache of all the projects I visit, so I can use this cache to jump to a project which I visited before. This means writing an elisp function to select a project by groupId:artifactId:version entered in the minibuffer (with completion built from the cache). The elisp function can take me to the root dir of the selected project.
  2. But I want to open a file somewhere hidden deep in a java package (e.g. src/main/java/com/foo/bar/client/FooBarClient.class). That means hammering my space bar (I have space do completion, its closer than tab). Therefore, I have come up with a second part to my 'jump-to-project' feature; a sort of high speed find file. I will explain: In my above example I would have to type: sr<spc>m<spc>j<spc><spc><spc><spc>c<spc>F<spc><ret> to open FooBarClient.class from my project's root dir. With my high speed completion idea, all I have to type is: srmjcF<ret>.

After 'jump-to-project' has prompted and accepted a project, it can then go into high speed find file, where only the minimum number of characters needed to uniquely identify each directory (for completion purposes) need be entered. After each character (or several characters if one char is not enough) it goes onto the next directory, jumping over dirs which contain only a single child dir (so in the example above, java/com/foo are jumped).

At each directory the character sequence needed to complete is presented in the prompt-string (e.g. Find (j)ava (r)esources: ~/my-project/src/main/). If there are a lot of choices then this can make the prompt string quite long, so I propose that if a file has not been selected, pressing <ret> takes you to the normal emacs Find file at that location (therefore also allowing the user to create a new file if they wish). <backspace> goes back a directory (or several jumped directories) if the wrong directory was chosen by mistake.

For large enterprise projects, Maven can work out the other modules in the project by traversing the module inheritance and aggregation tree. This adds one final peace of functionality: where as malabar-jump-to-project can jump to a cached project, malabar-jump-to-module can jump to a module in the same uber project, using Maven to find all the modules (leaf nodes in the inheritance-aggregation tree). Therefore, in my 30+ module enterprise project, all I need to do is open one source file to have instant access to all my other source files in all my other modules.

That is enough planning for now. I am going to dev this feature in a branch in my fork.

If anyone has any suggestions or ideas for this feature, or knows of any of this functionality already existing for Emacs, please comment to my issue at stepb/malabar-mode issue 1

Problem compiling malabar-1.4.0 on windows

Hello.

I'm trying to use it on windows. I've downloaded 1.4.0, and when I do 'mvn package', I get three errors on the test phase:

-------------------------------------------------------
 T E S T S
-------------------------------------------------------
Running org.grumblesmurf.malabar.UtilsTest
Tests run: 3, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.859 sec
Running org.grumblesmurf.malabar.GroovyServerTest
Tests run: 2, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.953 sec
Running org.grumblesmurf.malabar.SemanticReflectorTest
Tests run: 21, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.391 sec
Running org.grumblesmurf.malabar.ClasspathTest
Tests run: 7, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.703 sec
Running org.grumblesmurf.malabar.ProjectsTest
Tests run: 6, Failures: 3, Errors: 0, Skipped: 0, Time elapsed: 1.344 sec <<< FAILURE!
Running org.grumblesmurf.malabar.TypestringTest
Tests run: 13, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.078 sec

Results :

Failed tests:
  transitiveCompileClasspath(org.grumblesmurf.malabar.ProjectsTest)
  transitiveTestClasspath(org.grumblesmurf.malabar.ProjectsTest)
  runAGoal(org.grumblesmurf.malabar.ProjectsTest)

Tests run: 52, Failures: 3, Errors: 0, Skipped: 0

By observing the reports for the errors, I've seen that it's composing paths using the ':' separator, and for windows the path separator is ';', so I've edited the file Classpath.groovy, at line 70, and changed it from:
return urls.collect{it.substring(5)}.join(':')
to:
return urls.collect{it.substring(5)}.join(File.pathSeparator)

But I continue getting the same errors at the same point.

Anybody is using this under Windows? Any help? If you need the surefire-reports, I could post them.

Thanks in advance.

semantic-load not present in emacs 23.2

I tried to use malabar-mode with the CEDE present in emacs 23.3, but got the following error on (require 'malabar-mode):

(file-error "Cannot open load file" "semantic-load")

Profile support

Both persistent and one-shot would be nice, but I'll be happy just to have one-shot to start with

working.el and 'semanticdb-search not present in GNU Emacs 23.2.1

when try to build malabar-1.4-SNAPSHOT there is an error 'cannot load file working...'
I think it is because working.el not presetn in CEDET bundled with new Emacs.
When i put working.el (from latest CEDET distribution)
it says that semanticdb-search not found....

Getting Started

Would it be an idea to allow normal compile work if the file opened is not part of a maven project? Also, is there, somewhere, some info on getting started with malabar-mode. Some sort of usage example. Possibly a short few lines on how to create ones first malabar project for a single java file. Maven is quite daunting!

Compilation error links

When i run compile (C-c C-v C-c) it highlights error and sets links to lines in code
But when i run install (C-c C-v C-b) it don't highlight error and don't turn them to links
Is it possible to turn error records in compilation buffer to links everywhere?

Issues with build on ArchLinux, java 1.6, emacs 23.1

After executing "mvn package", SemanticReflectorTest fails at subClassWithInterface. It appears that the string genterated does not maintain the order of the methods. After @ignore'ing that test, ProjectsTest also fails on both of its tests. The error was a NullPointerException while trying to dereference p (at p.name). This has been @ignore'ed. The second failure is on malabar-1.1.tag, and if I remember correctly, the SemanticReflectorTest fails on HEAD for me.

Cannot start Groovy

Hi all,

malabor-mode looks really promising, but I cannot get it to work. Any help is greatly appreciated.

I'm running version 23.2.1 of Emacs

$ /usr/local/bin/emacs -version
GNU Emacs 23.2.1

I'm starting this version of Emacs without .emacs and just loading my malabar settings

$ /usr/local/bin/emacs -q -l /home/torstein/.emacs-malabar --debug-init

The contents of .emacs-malabar

;; Emacs 23.3 or later
;; Or enable more if you wish
(setq semantic-default-submodes 
  '(global-semantic-idle-scheduler-mode
   global-semanticdb-minor-mode
   global-semantic-idle-summary-mode
   global-semantic-mru-bookmark-mode))
(semantic-mode 1)
(add-to-list 'load-path "/usr/local/src/malabar-mode/src/main/lisp")
(require 'malabar-mode)
(setq malabar-groovy-lib-dir "/usr/local/src/malabar-mode/target")
(add-to-list 'auto-mode-alist '("\\.java\\'" . malabar-mode))

The malabar source in /usr/local/src/malabar-mode is update to date 2010-07-23

When I load a Java file, it tries in vain to start Groovy. The output from Messages is:

Grammar in src/main/lisp/wisent-malabar-java-wy.el contains 79 reduce/reduce conflicts
Test.java has auto save data; consider M-x recover-this-file
Starting Groovy...requesting ports 28%
File mode specification error: (error "Error starting groovy: time-out waiting for port")
Loading semantic/db-file...done

I've also tried the default Emacs version in Debian Squeeze with corresponding CEDET package with the same result.

Can someone please shed some light on this?

-Torstein

Test failure at org.grmublesmurf.malabar.TypestringTest

Hi, I have a test failure. The abbreviated failure is below.

My java version is:

java -version
java version "1.6.0_17"
Java(TM) SE Runtime Environment (build 1.6.0_17-b04-248-10M3025)
Java HotSpot(TM) 64-Bit Server VM (build 14.3-b01-101, mixed mode)

The failure itself is:

-------------------------------------------------------------------------------
Test set: org.grumblesmurf.malabar.TypestringTest
-------------------------------------------------------------------------------
Tests run: 13, Failures: 1, Errors: 0, Skipped: 0, Time elapsed: 0.066 sec <<< FAILURE!
collectionsBinarySearchHasComplicatedFirstParam(org.grumblesmurf.malabar.TypestringTest)  Time elapsed: 0.019 sec  <<< FAILURE!
java.lang.AssertionError: 
Expected: is "java.util.List>"
     got: "java.util.List"

    at org.junit.Assert.assertThat(Assert.java:750)
    at org.junit.Assert.assertThat(Assert.java:709)
    at org.junit.Assert$assertThat.callStatic(Unknown Source)
    at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCallStatic(CallSiteArray.java:51)
    at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callStatic(AbstractCallSite.java:167)
    at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callStatic(AbstractCallSite.java:179)
    at org.grumblesmurf.malabar.TypestringTest.collectionsBinarySearchHasComplicatedFirstParam(TypestringTest.groovy:76)

Maven command interactive argument passing

Is there any interactive way of passing in maven parameters like -D xxx to the default maven compile commands.
Currently I see only two commands - mvn install and mvn clean install ...but there would be situations where we need to fully utilize other maven command options.

If we can have a interactive way of argument passing like after C-u but before C-c C-v C-b.

Maybe use Unix domain sockets?

Pros:

  • Security - something I haven't worried about yet, but it needs to be considered
  • Performance - probably not a big issue

Cons:

  • Lose W32 compatibility - I'm not sure I care :)

need a chained-compilation facility

Scenario:

  • current-buffer is SUT
  • call run-junit-test
  • compile SUT: OK
  • compile test: FAIL
  • run test

We don’t want the last to happen. How about something like

@@@
(chained-compilations
(malabar-compile-file)
(with-current-buffer ...
(malabar-compile-file))
(run-test-internal ...))
@@@

Which expands to something clever involving groovy--compilation-backlog?

original LH ticket

This ticket has 0 attachment(s).

Required feature `semantic/wisent/wisent' was not provided (test error in emacs 23.2.1, with CEDET from CVS HEAD)

I'm trying to build malabar from master.
The build gets as far as run-elisp-tests then fails with this output:
[INFO] [exec:exec {execution: run-loadability-test}]
[INFO] Setting up CEDET packages...
[INFO] Setting up CEDET packages...done
[INFO] Required feature `semantic/wisent/wisent' was not provided

I have CEDET built from CVS loading in my .emacs:
(load-file "/usr/share/emacs/site-lisp/cedet/common/cedet.elc")

I know I have wisent because I can add the following to .emacs:
(require 'wisent)
But if I change it to: (require 'semantic/wisent/wisent) then it fails like the malabar build.

I have tested loading malabar major mode (from v1.3) in my emacs and it loads fine :)

I have to admit that I am new to emacs. I have just mastered the basics and I'm hoping to switch to using emacs as my IDE instead of Eclipse. I am a Java dev and don't know elisp.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.