Refactor core-os-osx.el
This commit is contained in:
parent
b69c1be4f4
commit
76ac7c4801
1 changed files with 10 additions and 4 deletions
|
@ -55,19 +55,25 @@
|
||||||
(defun narf-open-with (&optional app-name path)
|
(defun narf-open-with (&optional app-name path)
|
||||||
"Send PATH to APP-NAME on OSX."
|
"Send PATH to APP-NAME on OSX."
|
||||||
(interactive)
|
(interactive)
|
||||||
(let* ((path (f-full (s-replace "'" "\\'" (or path (if (eq major-mode 'dired-mode) (dired-get-file-for-visit) (buffer-file-name))))))
|
(let* ((path (f-full (s-replace "'" "\\'"
|
||||||
(command (concat "open " (when app-name (concat "-a " (shell-quote-argument app-name))) " '" path "'")))
|
(or path (if (eq major-mode 'dired-mode)
|
||||||
|
(dired-get-file-for-visit)
|
||||||
|
(buffer-file-name))))))
|
||||||
|
(command (format "open %s"
|
||||||
|
(if app-name
|
||||||
|
(format "-a %s" (shell-quote-argument app-name))
|
||||||
|
(format "'%s'" path)))))
|
||||||
(message "Running: %s" command)
|
(message "Running: %s" command)
|
||||||
(shell-command command)))
|
(shell-command command)))
|
||||||
|
|
||||||
(defun narf-switch-to-iterm ()
|
(defun narf-switch-to-iterm ()
|
||||||
(interactive)
|
(interactive)
|
||||||
(shell-command "osascript -e 'tell application \"iTerm2\" to activate'" nil))
|
(do-applescript "tell application \"iTerm2\" to activate"))
|
||||||
|
|
||||||
(defun narf-switch-to-iterm-and-cd ()
|
(defun narf-switch-to-iterm-and-cd ()
|
||||||
(interactive)
|
(interactive)
|
||||||
(narf:tmux-chdir nil t)
|
(narf:tmux-chdir nil t)
|
||||||
(shell-command "osascript -e 'tell application \"iTerm2\" to activate'" nil))
|
(narf-switch-to-iterm))
|
||||||
|
|
||||||
(provide 'core-os-osx)
|
(provide 'core-os-osx)
|
||||||
;;; core-os-osx.el ends here
|
;;; core-os-osx.el ends here
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue