MantisBT - CMake
View Issue Details
0016019CMakeCMakepublic2016-03-14 19:282016-06-10 14:21
Julian Schmidt 
Brad King 
lowminoralways
closedfixed 
x64CentOS6.7
CMake 3.5 
CMake 3.6CMake 3.6 
0016019: cmake-mode.el: cmake-help: one help item is missing for each 'type'
In 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".
In 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)
       ))
   )
==================
No tags attached.
Issue History
2016-03-14 19:28Julian SchmidtNew Issue
2016-03-15 09:38Brad KingNote Added: 0040689
2016-03-16 13:35Brad KingNote Added: 0040703
2016-03-16 13:35Brad KingAssigned To => Brad King
2016-03-16 13:35Brad KingStatusnew => resolved
2016-03-16 13:35Brad KingResolutionopen => fixed
2016-03-16 13:35Brad KingFixed in Version => CMake 3.6
2016-03-16 13:35Brad KingTarget Version => CMake 3.6
2016-06-10 14:21Kitware RobotNote Added: 0041224
2016-06-10 14:21Kitware RobotStatusresolved => closed

Notes
(0040689)
Brad King   
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   
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   
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.