View Issue Details Jump to Notes ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0016019CMakeCMakepublic2016-03-14 19:282016-06-10 14:21
ReporterJulian Schmidt 
Assigned ToBrad King 
PrioritylowSeverityminorReproducibilityalways
StatusclosedResolutionfixed 
Platformx64OSCentOSOS Version6.7
Product VersionCMake 3.5 
Target VersionCMake 3.6Fixed in VersionCMake 3.6 
Summary0016019: cmake-mode.el: cmake-help: one help item is missing for each 'type'
DescriptionIn the Emacs mode cmake-mode.el, the available help items for cmake-help-command, cmake-help-module, ... are missing the first item each as printed, respectively, by "cmake --help-TYPE".
Steps To ReproduceIn Emacs 24.5.1, with cmake-model.el from git tag v3.5.0-rc3, do

M-x cmake-help

Then in the auto-completion, e.g. 'add_compile_options' will not be available.

This seems to be an off-by-one error which can be fixed like so:

==================
diff --git a/Auxiliary/cmake-mode.el b/Auxiliary/cmake-mode.el
index 08ac490..321177a 100644
--- a/Auxiliary/cmake-mode.el
+++ b/Auxiliary/cmake-mode.el
@@ -304,7 +304,7 @@ and store the result as a list in LISTVAR."
           (save-window-excursion
             (cmake-command-run (concat "--help-" listname "-list") nil temp-buffer-name)
             (with-current-buffer temp-buffer-name
- (set listvar (cdr (split-string (buffer-substring-no-properties (point-min) (point-max)) "\n" t))))))
+ (set listvar (split-string (buffer-substring-no-properties (point-min) (point-max)) "\n" t)))))
       (symbol-value listvar)
       ))
   )
==================
TagsNo tags attached.
Attached Files

 Relationships

  Notes
(0040689)
Brad King (manager)
2016-03-15 09:38

Good catch. The reason for the (cdr ...) is because prior to CMake 3.0 the `--help-*-list` options would print the CMake version number on the first line. For example:

    $ cmake --version
    cmake version 2.8.12.2
    $ cmake --help-command-list | head -3
    cmake version 2.8.12.2
    add_compile_options
    add_custom_command

However since CMake 3.0 the `cmake version ...` line is not present.

In order to support both versions one will need to drop the (cdr ...) and add a filter to remove the first entry conditionally.
(0040703)
Brad King (manager)
2016-03-16 13:35

While my concern in 0016019:0040689 is valid I think it is better to support CMake >= 3.0 correctly. I've applied the patch:

 cmake-mode.el: Fix help completion item lists with CMake >= 3.0
 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=9dc384f6 [^]

tweaked with a FIXME comment left behind for supporting CMake < 3.0.
(0041224)
Kitware Robot (administrator)
2016-06-10 14:21

This issue tracker is no longer used. Further discussion of this issue may take place in the current CMake Issues page linked in the banner at the top of this page.

 Issue History
Date Modified Username Field Change
2016-03-14 19:28 Julian Schmidt New Issue
2016-03-15 09:38 Brad King Note Added: 0040689
2016-03-16 13:35 Brad King Note Added: 0040703
2016-03-16 13:35 Brad King Assigned To => Brad King
2016-03-16 13:35 Brad King Status new => resolved
2016-03-16 13:35 Brad King Resolution open => fixed
2016-03-16 13:35 Brad King Fixed in Version => CMake 3.6
2016-03-16 13:35 Brad King Target Version => CMake 3.6
2016-06-10 14:21 Kitware Robot Note Added: 0041224
2016-06-10 14:21 Kitware Robot Status resolved => closed


Copyright © 2000 - 2018 MantisBT Team