Skip to content

emacsorphanage/sourcemap

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

49 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

sourcemap.el Build Status melpa badge melpa stable badge

sourcemap parser in Emacs Lisp. Only supports decoder now.

Installation

You can install sourcemap from MELPA and MELPA stable

You can install sourcemap with the following command.

M-x package-install [RET] sourcemap [RET]

Interface

(sourcemap-original-position-for sourcemap properties)

Find line and column of original file from specified properties.

properties is plist and should have following properties

  • :line - Line in generated file
  • :column - Column in generated file

Return value is property list which has :line and :column.

With an optional :nearest property, return the closest matching location.

(sourcemap-generated-position-for sourcemap properties)

Find line and column of generated file from specified properties.

properties is plist and should have following properties

  • :line - Original line number
  • :column - Original column number

With an optional :nearest property, return the closest matching location.

(sourcemap-goto-corresponding-point properties)

Go to corresponding point.

This is useful for compiling command of coffee-mode. You can use this for moving point in compiled JavaScript file which corresponding to cursor point in CoffeeScript. If you want to use this feature, add following configuration.

(setq coffee-args-compile '("-c" "-m")) ;; generating sourcemap file
(add-hook 'coffee-after-compile-hook 'sourcemap-goto-corresponding-point)

properties is plist and should have following properties

  • :source - source file
  • :sourcemap - sourcemap file
  • :line - line in :source(CoffeeScript)
  • :column - column in :source(CoffeeScript)

(sourcemap-from-file file)

Parse file as sourcemap and return sourcemap instance

(sourcemap-from-string string)

Parse string as sourcemap and return sourcemap instance