-
-
Notifications
You must be signed in to change notification settings - Fork 123
/
scimax-apps.el
100 lines (82 loc) · 2.68 KB
/
scimax-apps.el
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
;;; scimax-apps.el --- Library to open programs
;;; Commentary:
;;
;;;###autoload
(defun explorer (&optional path)
"Open Finder or Windows Explorer in the current directory."
(interactive (list (if (buffer-file-name)
(file-name-directory (buffer-file-name))
(expand-file-name default-directory))))
(cond
((string= system-type "gnu/linux")
(shell-command "nautilus"))
((string= system-type "darwin")
(shell-command (format "open -b com.apple.finder%s"
(if path (format " \"%s\""
(file-name-directory
(expand-file-name path))) ""))))
((string= system-type "windows-nt")
(shell-command (format "explorer %s"
(replace-regexp-in-string
"/" "\\\\"
path))))))
(defalias 'finder 'explorer "Alias for `explorer'.")
(defun bash (&optional path)
"Open a bash window.
PATH is optional, and defaults to the current directory."
(interactive (list (if (buffer-file-name)
(file-name-directory (buffer-file-name))
(expand-file-name default-directory))))
(cond
((string= system-type "gnu/linux")
(shell-command "gnome-terminal"))
((string= system-type "darwin")
(shell-command
(format "open -b com.apple.terminal%s"
(if path (format " \"%s\"" (expand-file-name path)) ""))))
((string= system-type "windows-nt")
(shell-command "start \"\" \"%SYSTEMDRIVE%\\Program Files\\Git\\bin\\bash.exe\" --login &"))))
(defun excel ()
"Open Microsoft Excel."
(interactive)
(cond
((string= system-type "gnu/linux")
(error "Excel is not on Linux."))
((string= system-type "darwin")
(shell-command
(shell-command "open -b com.microsoft.Excel")))
((string= system-type "windows-nt")
(shell-command "start excel"))))
(defun word ()
"Open Microsoft Word."
(interactive)
(cond
((string= system-type "gnu/linux")
(error "Word is not on Linux."))
((string= system-type "darwin")
(shell-command
(shell-command "open -b com.microsoft.Word")))
((string= system-type "windows-nt")
(shell-command "start winword"))))
(defun powerpoint ()
"Open Microsoft Powerpoint."
(interactive)
(cond
((string= system-type "gnu/linux")
(error "Powerpoint is not on Linux."))
((string= system-type "darwin")
(shell-command
(shell-command "open -b com.microsoft.Powerpoint")))
((string= system-type "windows-nt")
(shell-command "start powerpnt"))))
(defun tweetdeck ()
(interactive)
(when (region-active-p)
(kill-ring-save nil nil t))
(browse-url "https://tweetdeck.twitter.com"))
(defun google ()
"Open default browser to google.com."
(interactive)
(browse-url "http://google.com"))
(provide 'scimax-apps)
;;; scimax-apps.el ends here