From f8d4b6c8378e7fe9bd3e2f3b5a949102f271746d Mon Sep 17 00:00:00 2001 From: Syohei YOSHIDA Date: Fri, 23 May 2014 11:14:24 +0900 Subject: [PATCH] Fix for packaging - Conform Emacs package convention - Add autoload cookies for lazy loading --- jsfmt.el | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/jsfmt.el b/jsfmt.el index 104a361..236d9dd 100644 --- a/jsfmt.el +++ b/jsfmt.el @@ -1,11 +1,23 @@ -;; jsfmt.el -- Interface to jsfmt command for javascript files -;; https://rdio.github.io/jsfmt +;; jsfmt.el --- Interface to jsfmt command for javascript files -;; Version 0.1.0 +;; Copyright (C) 2014 Brett Langdon + +;; Author: Brett Langdon +;; URL: https://github.com/brettlangdon/jsfmt.el +;; Version: 0.1.0 + +;; License that can be found in the LICENSE section in README. + +;;; Commentary: ;; this is basically a copy of the necessary parts from ;; go-mode version 20131222, so all credit goes to ;; The Go Authors +;; +;; See also +;; `jsfmt': https://rdio.github.io/jsfmt + +;;; Code: (defcustom jsfmt-command "jsfmt" "The 'jsfmt' command. https://rdio.github.io/jsfmt" @@ -76,6 +88,7 @@ buffer." (t (error "invalid rcs patch or internal error in js--apply-rcs-patch"))))))))) +;;;###autoload (defun jsfmt () "Formats the current buffer according to the jsfmt tool." @@ -121,6 +134,7 @@ buffer." (compilation-mode) (display-buffer errbuf))) +;;;###autoload (defun jsfmt-before-save () "Add this to .emacs to run jsfmt on the current buffer when saving: (add-hook 'before-save-hook 'jsfmt-before-save). @@ -132,3 +146,5 @@ you save any file, kind of defeating the point of autoloading." (when (memq major-mode '(js-mode js2-mode js3-mode)) (jsfmt))) (provide 'jsfmt) + +;;; jsfmt.el ends here