Wednesday, March 5, 2014

Using malabar-mode to auto-populate a new Java file

Java has a lot of "template" code that needs to be written and most editors and IDEs understand this and help alliviate the common tasks.  One of these is the putting a skeleton into a blank file.  To do this in malabar-mode, there is the malabar-codegen-insert-class-template function that will:
  • add the class declaration based on the name of the buffer
  • add a javadoc comment skeleton
  • update the package statement
To have EMACS run this function when a new file is created, add the following to your .emacs:

;; Auto-populate an empty java file
(add-hook 'malabar-mode-hook
      '(lambda ()
         (when (= 0 (buffer-size))
           (malabar-codegen-insert-class-template))))

Tuesday, March 4, 2014

malabar-update-package now works in Windows

The functions malabar-update-package is used to add or fix the package statement in a Java class based on the location of a file in the maven source tree.  For example running malabar-update-package in a buffer looking at  src/main/java/com/m0smith/Test.java will result in the package being set to  package com.m0smith;

Wednesday, February 26, 2014

lein-resource 0.3.4 adds timestamp checking

The latest release of lein-resource, 0.3.4, adds support for a new flag, :update which when set to true checks time stamps before processing source files.  This provides a way to remove unnecessary copying and filtering if the source file has not been modified.

While it could potentially save time, it should not be used if build sensitive stencil filtering is used on any of the source files.  For example, if the source contains a {{timestamp}} tag then setting :update to true would prevent the file from being recreated on each build.  The suggestion therefore is to only set :update to true when :skip-stencil is also true.

The default is false or to always overwrite the destination file.

Monday, February 3, 2014

maven-pom-mode: Add Dependency

The maven-pom-mode project has been updated to have its own mode.  It will also search for and add a dependency

* `C-c d` will Search for artifacts in maven central and insert dependency tag via `maven-pom-add-dependency`.  NOTE the point has to be in the right place in the pom file when called.

Friday, January 31, 2014

malabar-mode 1.6 Change Log

Change log

Resolved Issues



  • "Apply suggestions to flycheck"
  • "import not work well in Win NT"
  • "Default to -source 1.5"
  • "in malabar-flycheck-error-column assign tabs to 8 spaces."
  • "Remove the @ from the front of annotations in malabar-import-one-class"
  • "File mode specification error: (void-function wisent-java-tags-wy--install-parser)"
  • "Compile error in melpa"
  • "Compile File Issue: IllegalArgumentException"
  • "Cannot open load file: wisent-comp"
  • "Show super classes and implemented interfaces of a class"
  • "Add pom.xml mode of some sort"
  • "[feature-request] malabar-delegate-interface"
  • "Can C-c C-v C-y be made to work for source jars?"
  • "Some sort of xref facility"
  • "Flymake/Flycheck"

  • Commits

    Tuesday, January 28, 2014

    malabar-mode meet flycheck-mode

    malabar-mode is an EMACS major mode for editing Java files in a MAVEN project.  flycheck-mode  is a modern on-the-fly syntax checking extension for GNU Emacs 24.   The latest release of malabar-mode in MELPA (20140128.1331) has integrated flycheck.

    To enable:
    (load "malabar-flycheck")(flycheck-mode)
    Once enabled, it uses javac to compile the buffer as changed.  See flycheck-mode for usage.

    Monday, January 27, 2014

    Introducing maven-pom-mode

    As part of my work on malabar-mode it has become apparent that EMACS needs a maven pom mode.  Looking around the various maven pom related projects, there are a lot of good ideas but not one project that incorporates them all.  The maven-pom-mode was created to give EMACS a better way of working with your pom files.

    Current functionality

    EMACS has built in XML editing via nxml-mode which includes tag completing, listing valid tags, etc.  With maven-pom-mode the schema for editing pom files is made available  to nxml-mode.

    •  C-M-i give valid suggestions. 
    • C-c / will close a tag.
    • C-c i will complete an inline tag.
    • C-c b will complete an block tag.

    Installation

    From the shell:
    git clone https://github.com/m0smith/maven-pom-mode.git
    
    In Emacs:
    (add-to-list 'load-path "path to maven-pom-mode")
    (load "maven-pom-mode")

    Future


    Future directions will include:

    • Searching for dependency in central and adding a dependency
    • Show and manipulate transitive dependencies
    • Form based manipulate sections of the pom
    • Integrate with malabar-mode