cmd_tools 3.0.0 → 3.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.
@@ -17,13 +17,13 @@ module ::CmdTools::Command::EmacsLaunch
17
17
  files = files.flatten.join(' ')
18
18
  case mode
19
19
  when :gui
20
- if number_of_frames() <= 1 # emacs daemon has one (invisible) frame.
21
- spawn "emacsclient -c -n #{files}"
22
- else
20
+ if is_gui_running?
23
21
  EMACSCLIENT_OPEN[files]
22
+ else
23
+ spawn "emacsclient -c -n #{files}"
24
24
  end
25
25
  when :cui
26
- Process.waitpid(EMACSCLIENT_OPEN[files])
26
+ Process.waitpid(EMACSCLIENT_OPEN[files]) # To retain a file even if a terminal, which the file was opened, have closed.
27
27
  exec "emacsclient -t #{files}"
28
28
  else
29
29
  raise ArgumentError, "Expected :gui or :cui, but got #{mode}."
@@ -41,7 +41,7 @@ module ::CmdTools::Command::EmacsLaunch
41
41
  system "emacsclient -e '()' > #{File::NULL} 2>&1"
42
42
  end
43
43
 
44
- def self.number_of_frames
45
- `emacsclient -e "(length (visible-frame-list))"`.to_i
44
+ def self.is_gui_running?
45
+ %w[x ns].include?(`emacsclient -e "(window-system)"`.strip)
46
46
  end
47
47
  end
@@ -1,3 +1,3 @@
1
1
  module CmdTools
2
- VERSION = '3.0.0'
2
+ VERSION = '3.1.0'
3
3
  end
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: 3.0.0
4
+ version: 3.1.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -13,7 +13,7 @@ date: 2012-10-08 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: ruby_patch
16
- requirement: &2153006140 !ruby/object:Gem::Requirement
16
+ requirement: &77989990 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ~>
@@ -21,7 +21,7 @@ dependencies:
21
21
  version: '0.3'
22
22
  type: :development
23
23
  prerelease: false
24
- version_requirements: *2153006140
24
+ version_requirements: *77989990
25
25
  description: ! 'Command line tools. Please type
26
26
 
27
27
 
@@ -83,7 +83,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
83
83
  version: '0'
84
84
  requirements: []
85
85
  rubyforge_project:
86
- rubygems_version: 1.8.15
86
+ rubygems_version: 1.8.11
87
87
  signing_key:
88
88
  specification_version: 3
89
89
  summary: Command line tools.