Code Monkey home page Code Monkey logo

sivy-emacs-toys's Introduction

mt-modes

These are some emacs minor modes with some useful functions for developing Movable Type plugins in perl. The easiest way to set it up is to do something like this in your .emacs file:

;; ------------------------------
;; mt-modes
;; mt-util.el defines the custom settings, and some common functions
(require 'mt-util)

;; autoload the mode functions
(autoload 'mt-mode "mt-mode" nil t)
(autoload 'mt-test-mode "mt-test-mode" nil t)

;; my personal bindings for compile (c), test (t), and all tests (a)
(global-set-key (kbd "C-c c") 'mt-perl-compile)
(global-set-key (kbd "C-c t") 'mt-run-test)
(global-set-key (kbd "C-c a") 'mt-run-all-tests)

;; load MT mode for certain perl files, while keeping
;; cperl-mode as the major
(eval-after-load "cperl-mode"
      '(add-hook 'cperl-mode-hook 'load-mt-mode-conditionally))
;; load MT-Test mode for .t files
(eval-after-load "cperl-mode"
      '(add-hook 'cperl-mode-hook 'load-mt-test-mode-conditionally))

;; not really related, but useful
(add-to-list 'auto-mode-alist '("\\.tmpl$" . html-mode))

It's also important to set mt-home and mt-config in your .emacs. They default to "~/mte" and "mt-config.cgi" respectively.

 ; path to mt
(setq mt-home "/path/to/your/mte")
; path to mt-config.cgi
(setq mt-config (concat mt-home "/mt-config.cgi"))

mt-mode Features

mt-perl-compile

The first useful command is mt-perl-compile, which runs the current buffer through perl -c. This can be done with compile-command, but I build it myself and run the command, sending the output to a temporary buffer so it can be reviewed. Also, this way we can find the lib directory in the plugin and make sure that it's included as a -I with perl -c. I've got this bound to C-c c;

mt-test-mode Features

mt-run-test

Runs prove -v on the current buffer, after checking that it's a .t file. I've got this bound to C-c t;

mt-run-all-tests

Runs prove -v on all tests in the same directory as the current buffer, after checking that the current buffer is a .t file. I've got this bound to C-c a;

Contact

Any questions, comments, or praise can be sent to [email protected].

License

This code is released under the MIT License:

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

sivy-emacs-toys's People

Contributors

rayners avatar

Stargazers

Zak B. Elep avatar Yuji Takayama avatar Steve Ivy avatar  avatar Elijah Wright avatar David Jacobs avatar

Watchers

 avatar Steve Ivy 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.