Giter Club home page Giter Club logo

gomacro-mode's Introduction

gomacro-mode

MELPA CI

This Emacs package provides bindings for working with Gomacro, a read eval print loop for Go. Gomacro installation instuctions can be found in the gomacro repo. Thanks to the gomacro author!

Table of Contents

Todo

  • Look into using go--build-font-lock-keywordsto to syntax highlightning in gomacro buffer
  • Add gomacro-eval-file which prompts for file to eval
  • Add gomacro-eval-pacakge which evaluates all files in specified folder
  • Combine eval region and eval region verbose to one function with config param
  • Add gomacro-eval-buffer
  • Add gomacro-eval-line
  • Add support for type definitions in eval defun (struct and interface)
  • Remove all comments in gomacro--sanitize-string
  • Ensure only one whitespace in gomacro--sanitize-string
  • Add some tests
  • Handle package declarations

Issues

Does not handle multiple packages as all files are evaluated without package header.

Installation

Installation can be done using use-package:

(use-package gomacro-mode
  :hook (go-mode . gomacro-mode))

Usage

By enabling gomacro-mode in buffer with Go source code the following keybindings will be set:

Keybinding Function
C-M-x gomacro-eval-defun
C-c C-r gomacro-eval-region
C-c C-l gomacro-eval-line
C-c C-t gomacro-verbose-toggle

Interactive functions

The following functions are ment to be used from the M-x interface.

gomacro-run

Run an inferior instance of gomacro inside Emacs comint-mode buffer

gomacro-verbose-toggle

Toggle value of gomacro-verbose-toggle. When verbose mode is activated everything is sent to gomacro line by line, default behaviour is to only display "Region is sent to gomacro REPL".

gomacro-eval (stmt)

Evaluate stmt in gomacro REPL buffer. Will prompt for statement if run interactively.

gomacro-eval-region (begin end)

Evaluate region between begin and end. Can be run interactively with marked region. If gomacro-verbose-eval is set region will be sent line by line to gomacro REPL.

gomacro-eval-line

Evaluate current line.

gomacro-eval-defun

Evaluate the nearest function, type or import statement looking backwards. This function will select whichever function, type or import statement that is nearest to current cursor position and pass it to gomacro REPL.

gomacro-eval-buffer

Evaluate entire buffer.

Does not evaluate package statement, hence all buffers sent to gomacro REPL will be in the same namespace.

gomacro-eval-file

Evaluate file, will prompt for file if run interactively.

gomacro-eval-package

Evaluate go package, will prompt for path if run interactively. If filename is specified all other go files in same directory will be processed.

Other useful functions

These functions are not ment to run interactively.

gomacro-running-p

Check if gomacro REPL is running or not.

gomacro-mode's People

Contributors

storvik avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar

Forkers

emacsmirror

gomacro-mode's Issues

// read error: unexpected character '\n' inside string literal

For example trying to evaluate a line with a url;

	feed, _ := fp.ParseURL("http://feeds.twit.tv/twit.xml")

I think this has to do with gomacro--sanitize-string. I tried to get the string output from sending the line above to it, and I got;"feed, _ := fp.ParseURL(\"http:;"

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.