cmd_tools 4.0.4 → 4.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/cmd_tools.gemspec +9 -2
- data/lib/cmd_tools/commands/emacs_launch.rb +9 -7
- data/lib/cmd_tools/version.rb +1 -1
- metadata +11 -10
data/cmd_tools.gemspec
CHANGED
@@ -29,8 +29,15 @@ alias emacs_stop='cmd_tools emacs_stop'
|
|
29
29
|
case $(uname) in
|
30
30
|
# emacs_launch do not work satisfactory on Mac.
|
31
31
|
"Darwin")
|
32
|
-
|
33
|
-
|
32
|
+
function e(){
|
33
|
+
files=$@
|
34
|
+
for file in ${files}
|
35
|
+
do
|
36
|
+
[ -f ${file} ] || touch ${file}
|
37
|
+
done
|
38
|
+
open -a /Applications/MacPorts/Emacs.app ${files}
|
39
|
+
}
|
40
|
+
alias em='/Applications/MacPorts/Emacs.app/Contents/MacOS/Emacs --no-window-system --no-init-file'
|
34
41
|
;;
|
35
42
|
*)
|
36
43
|
alias e='cmd_tools emacs_launch --mode=gui'
|
@@ -2,8 +2,6 @@ module ::CmdTools::Commands::EmacsLaunch
|
|
2
2
|
require 'ruby_patch'
|
3
3
|
extend ::RubyPatch::AutoLoad
|
4
4
|
|
5
|
-
EMACSCLIENT_OPEN = lambda{|files| spawn "emacsclient -n #{files}"}
|
6
|
-
|
7
5
|
# Open +files+ by +mode+ (:gui/:cui) mode.
|
8
6
|
# Launch emacs daemon if necessary.
|
9
7
|
# Create new frame if necessary.
|
@@ -14,17 +12,17 @@ module ::CmdTools::Commands::EmacsLaunch
|
|
14
12
|
def self.run(mode, *files)
|
15
13
|
Process.waitpid(spawn "#{::CmdTools::Config.emacs} --daemon") unless daemon_running?
|
16
14
|
|
17
|
-
|
15
|
+
files_str = files.flatten.join(' ')
|
18
16
|
case mode
|
19
17
|
when :gui
|
20
18
|
if is_gui_running?
|
21
|
-
|
19
|
+
emacsclient_open(files_str)
|
22
20
|
else
|
23
|
-
spawn "emacsclient -c -n #{
|
21
|
+
spawn "emacsclient -c -n #{files_str}"
|
24
22
|
end
|
25
23
|
when :cui
|
26
|
-
Process.waitpid(
|
27
|
-
exec "emacsclient -t #{
|
24
|
+
Process.waitpid(emacsclient_open(files_str)) # To retain a file even if a terminal, which the file was opened, have closed.
|
25
|
+
exec "emacsclient -t #{files_str}"
|
28
26
|
else
|
29
27
|
raise ArgumentError, "Expected :gui or :cui, but got #{mode}."
|
30
28
|
end
|
@@ -44,4 +42,8 @@ module ::CmdTools::Commands::EmacsLaunch
|
|
44
42
|
def self.is_gui_running?
|
45
43
|
::CmdTools::Config.emacs_window_systems.include?(`emacsclient -e "(window-system)"`.strip)
|
46
44
|
end
|
45
|
+
|
46
|
+
def self.emacsclient_open(files_str)
|
47
|
+
spawn "emacsclient -n #{files_str}"
|
48
|
+
end
|
47
49
|
end
|
data/lib/cmd_tools/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cmd_tools
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 4.0
|
4
|
+
version: 4.1.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,11 +9,11 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-
|
12
|
+
date: 2012-11-01 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: ruby_patch
|
16
|
-
requirement: &
|
16
|
+
requirement: &2152156440 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ~>
|
@@ -21,10 +21,10 @@ dependencies:
|
|
21
21
|
version: '1.1'
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *2152156440
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: thor
|
27
|
-
requirement: &
|
27
|
+
requirement: &2152154160 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
30
|
- - ~>
|
@@ -32,7 +32,7 @@ dependencies:
|
|
32
32
|
version: '0.16'
|
33
33
|
type: :runtime
|
34
34
|
prerelease: false
|
35
|
-
version_requirements: *
|
35
|
+
version_requirements: *2152154160
|
36
36
|
description: ! 'Command line tools. Please type
|
37
37
|
|
38
38
|
|
@@ -63,10 +63,11 @@ homepage:
|
|
63
63
|
licenses: []
|
64
64
|
post_install_message: ! "\n# CmdTools\nalias bak='cmd_tools backup'\nalias tsh='cmd_tools
|
65
65
|
trash'\nalias emacs_stop='cmd_tools emacs_stop'\ncase $(uname) in\n # emacs_launch
|
66
|
-
do not work satisfactory on Mac.\n \"Darwin\")\n\
|
67
|
-
|
68
|
-
\
|
69
|
-
--
|
66
|
+
do not work satisfactory on Mac.\n \"Darwin\")\n\tfunction e(){\n\t files=$@\n\t
|
67
|
+
\ for file in ${files}\n\t do\n\t\t[ -f ${file} ] || touch ${file}\n\t done\n\t
|
68
|
+
\ open -a /Applications/MacPorts/Emacs.app ${files}\n\t}\n\talias em='/Applications/MacPorts/Emacs.app/Contents/MacOS/Emacs
|
69
|
+
--no-window-system --no-init-file'\n\t;;\n *)\n\talias e='cmd_tools emacs_launch
|
70
|
+
--mode=gui'\n\talias em='cmd_tools emacs_launch --mode=cui'\n\t;;\nesac\n\n"
|
70
71
|
rdoc_options: []
|
71
72
|
require_paths:
|
72
73
|
- lib
|