Coder Social home page Coder Social logo

emacsmirror / gnuplot-mode Goto Github PK

View Code? Open in Web Editor NEW

This project forked from mkmcc/gnuplot-mode

1.0 3.0 0.0 141 KB

Major mode for editing gnuplot scripts

Home Page: https://github.com/mkmcc/gnuplot-mode

License: GNU General Public License v3.0

Emacs Lisp 91.92% Gnuplot 8.08%

gnuplot-mode's Introduction

#+TITLE gnuplot-mode

Introduction

Gnuplot is an extremely useful program – it’s fast, easy to use and great for getting a look at your data before starting a more sophisticated analysis. You can run gnuplot interactively at a command prompt, but I generally find it easier to write a plot script instead.

In order to edit these scripts a little more comfortably, I wrote this major mode for emacs. It offers syntax hilighting and basic indentation, as well as a command to plot the file. You can run the plot command either directly (by M-x gnuplot-run-buffer), or with the (customizable) shortcut C-c C-c.

Here is a screenshot showing the basic syntax hilighting. Note that it warns you about spaces at the ends of lines, which cause gnuplot to crash, but are otherwise hard to spot.

images/gnuplot-syntax-hilight.png

The mode runs gnuplot entirely in the background. If gnuplot reports an error, it creates a buffer called ”gnuplot errors” and brings it to the front to show you what happened.

images/gnuplot-errors.png

This uses the emacs compile system, so commands like next-error and previous-error will work as expected.

You can also send commands to gnuplot using C-c C-b (send buffer to gnuplot) or C-c C-r (send region to gnuplot), but the error reporting isn’t as helpful with these functions.

This mode was inspired by the one written by Bruce Ravel (available here), but I think it’s much simpler to use – it runs gnuplot non-interactively, and only has one command to remember.

Installation

If you like, you can download the file here. Once this file is somewhere visible to emacs, you can add the following to your .emacs to make it work.

;; make sure file is visible to emacs (if needed)
(add-to-list 'load-path "/path/to/your/lisp/files")

;; load the file
(require 'gnuplot-mode)

;; specify the gnuplot executable (if other than /usr/bin/gnuplot)
(setq gnuplot-program "/sw/bin/gnuplot")

;; automatically open files ending with .gp or .gnuplot in gnuplot mode
(setq auto-mode-alist 
(append '(("\\.\\(gp\\|gnuplot\\)$" . gnuplot-mode)) auto-mode-alist))

Better yet, use MELPA! If you add MELPA to your package archives using the following, you can install gnuplot mode with a simple M-x package-install gnuplot-mode.

(require 'package)
(add-to-list 'package-archives
             '("melpa" . "https://melpa.org/packages/") t)

I hope you find this useful. Please let me know if you encounter any problems with the mode, or if you have any suggestions for improving it.

gnuplot-mode's People

Contributors

impaktor avatar mkmcc avatar syohex avatar

Stargazers

 avatar

Watchers

 avatar  avatar  avatar

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.