mirror of
https://github.com/atom/atom.git
synced 2026-02-08 13:45:09 -05:00
Removing any parens we're not forced to use. Lean into it.
This commit is contained in:
@@ -3,7 +3,7 @@
|
||||
console.originalLog = console.log
|
||||
console.log = (thing) ->
|
||||
OSX.NSLog thing.toString() if thing?
|
||||
console.originalLog(thing)
|
||||
console.originalLog thing
|
||||
|
||||
|
||||
# load require() function
|
||||
|
||||
@@ -35,9 +35,9 @@ save = ->
|
||||
exports.open = open = (path) ->
|
||||
filename = path
|
||||
|
||||
if Dir.isDir(filename)
|
||||
Process.cwd(filename)
|
||||
Chrome.title _.last filename.split('/')
|
||||
if Dir.isDir filename
|
||||
Process.cwd filename
|
||||
Chrome.title _.last filename.split '/'
|
||||
editor.getSession().setValue ""
|
||||
setMode()
|
||||
Chrome.setDirty false
|
||||
@@ -45,7 +45,7 @@ exports.open = open = (path) ->
|
||||
if /png|jpe?g|gif/i.test filename
|
||||
Chrome.openURL filename
|
||||
else
|
||||
Chrome.title _.last filename.split('/')
|
||||
Chrome.title _.last filename.split '/'
|
||||
editor.getSession().setValue File.read filename
|
||||
setMode()
|
||||
Chrome.setDirty false
|
||||
@@ -59,7 +59,7 @@ setMode = ->
|
||||
saveAs = ->
|
||||
if file = Chrome.savePanel()
|
||||
filename = file
|
||||
Chrome.title _.last filename.split('/')
|
||||
Chrome.title _.last filename.split '/'
|
||||
save()
|
||||
exports.bindKey = bindKey = (name, shortcut, callback) ->
|
||||
canon.addCommand
|
||||
@@ -73,7 +73,7 @@ exports.bindKey = bindKey = (name, shortcut, callback) ->
|
||||
|
||||
bindKey 'open', 'Command-O', (env, args, request) ->
|
||||
if file = Chrome.openPanel()
|
||||
open(file)
|
||||
open file
|
||||
|
||||
bindKey 'openURL', 'Command-Shift-O', (env, args, request) ->
|
||||
if url = prompt "Enter URL:"
|
||||
|
||||
@@ -3,12 +3,11 @@
|
||||
exports.outArgument = (args...) ->
|
||||
# Derive to store some javascript data in the internal hash
|
||||
if not @outArgument2?
|
||||
OSX.JSCocoa.createClass_parentClass_('JSCocoaOutArgument2', 'JSCocoaOutArgument')
|
||||
OSX.JSCocoa.createClass_parentClass_ 'JSCocoaOutArgument2', 'JSCocoaOutArgument'
|
||||
|
||||
o = OSX.JSCocoaOutArgument2.instance
|
||||
o.isOutArgument = true
|
||||
if args.length == 2
|
||||
o.mateWithMemoryBuffer_atIndex_(args[0], args[1])
|
||||
|
||||
o.mateWithMemoryBuffer_atIndex_ args[0], args[1]
|
||||
o
|
||||
|
||||
|
||||
@@ -10,19 +10,19 @@ Chrome =
|
||||
verticalDiv = $('#app-vertical')
|
||||
horizontalDiv = $('#app-horizontal')
|
||||
|
||||
el = document.createElement("div")
|
||||
el.setAttribute('class', "pane " + position)
|
||||
el = document.createElement "div"
|
||||
el.setAttribute 'class', "pane " + position
|
||||
el.innerHTML = html
|
||||
|
||||
switch position
|
||||
when 'top', 'main'
|
||||
verticalDiv.prepend(el)
|
||||
verticalDiv.prepend el
|
||||
when 'left'
|
||||
horizontalDiv.prepend(el)
|
||||
horizontalDiv.prepend el
|
||||
when 'bottom'
|
||||
verticalDiv.append(el)
|
||||
verticalDiv.append el
|
||||
when 'right'
|
||||
horizontalDiv.append(el)
|
||||
horizontalDiv.append el
|
||||
else
|
||||
throw "I DON'T KNOW HOW TO DEAL WITH #{position}"
|
||||
|
||||
@@ -51,7 +51,7 @@ Chrome =
|
||||
# Returns null or a file path.
|
||||
openPanel: ->
|
||||
panel = OSX.NSOpenPanel.openPanel
|
||||
panel.setCanChooseDirectories(true)
|
||||
panel.setCanChooseDirectories true
|
||||
if panel.runModal isnt OSX.NSFileHandlingPanelOKButton
|
||||
return null
|
||||
panel.filenames.lastObject
|
||||
@@ -94,7 +94,8 @@ File =
|
||||
path
|
||||
isFile: (path) ->
|
||||
isDir = new jscocoa.outArgument
|
||||
exists = OSX.NSFileManager.defaultManager.fileExistsAtPath_isDirectory(path, isDir)
|
||||
exists = OSX.NSFileManager.defaultManager.
|
||||
fileExistsAtPath_isDirectory path, isDir
|
||||
exists and not isDir.valueOf()
|
||||
|
||||
Dir =
|
||||
@@ -108,18 +109,19 @@ Dir =
|
||||
_.map paths, (entry) -> "#{path}/#{entry}"
|
||||
isDir: (path) ->
|
||||
isDir = new jscocoa.outArgument
|
||||
exists = OSX.NSFileManager.defaultManager.fileExistsAtPath_isDirectory(path, isDir)
|
||||
exists = OSX.NSFileManager.defaultManager.
|
||||
fileExistsAtPath_isDirectory path, isDir
|
||||
exists and isDir.valueOf()
|
||||
|
||||
Process =
|
||||
cwd: (path) ->
|
||||
if path?
|
||||
OSX.NSFileManager.defaultManager.changeCurrentDirectoryPath(path)
|
||||
OSX.NSFileManager.defaultManager.changeCurrentDirectoryPath path
|
||||
else
|
||||
OSX.NSFileManager.defaultManager.currentDirectoryPath()
|
||||
OSX.NSFileManager.defaultManager.currentDirectoryPath
|
||||
|
||||
env: ->
|
||||
OSX.NSProcess.processInfo.environment()
|
||||
OSX.NSProcess.processInfo.environment
|
||||
|
||||
exports.Chrome = Chrome
|
||||
exports.File = File
|
||||
|
||||
Reference in New Issue
Block a user