View Issue Details Jump to Notes ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0012908CMakeCMakepublic2012-01-23 13:312012-09-03 16:01
ReporterChristopher Sean Morrison 
Assigned ToBrad King 
PrioritynormalSeverityminorReproducibilityalways
StatusclosedResolutionfixed 
PlatformOSOS Version
Product Version 
Target VersionCMake 2.8.8Fixed in VersionCMake 2.8.8 
Summary0012908: Emacs cmake mode indents incorrectly after multiline SET()
DescriptionSummary says it all. If you define a macro that calls set, it will think the previous line indentation was at that unindented level. See the example in the Steps to Reproduce section.

Fortunately, it seems a fix was easy. See attached.
Steps To ReproduceIndenting this region results in the lines after the DIRNAME_SRC set line all being at beginning of line.

MACRO(BRLCAD_CHECK_DIRNAME)
  SET(DIRNAME_SRC "
#include <libgen.h>
int main(int argc, char *argv[]) {
(void)dirname(argv[0]);
return 0;
}")
  CHECK_C_SOURCE_RUNS("${DIRNAME_SRC}" HAVE_DIRNAME)
  IF(HAVE_DIRNAME)
    FILE(APPEND ${CONFIG_H_FILE} "#define HAVE_DIRNAME 1\n")
  ENDIF(HAVE_DIRNAME)
ENDMACRO(BRLCAD_CHECK_DIRNAME var)
Additional InformationConveniently, there was already a cmake-line-starts-inside-string() function we could key off of, so we keep walking backwards until we find an actual statement inside cmake-find-last-indented-line().
TagsNo tags attached.
Attached Filespatch file icon cmake-mode-set-indent.patch [^] (632 bytes) 2012-01-23 13:31 [Show Content]

 Relationships

  Notes
(0028393)
Brad King (manager)
2012-01-23 14:05

Thanks for the detailed report, analysis, and solution. I was able to simplify the patch to achieve the same result. Fixed:

  http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=7da35e65 [^]
(0030875)
David Cole (manager)
2012-09-03 16:01

Closing resolved issues that have not been updated in more than 4 months.

 Issue History
Date Modified Username Field Change
2012-01-23 13:31 Christopher Sean Morrison New Issue
2012-01-23 13:31 Christopher Sean Morrison File Added: cmake-mode-set-indent.patch
2012-01-23 14:05 Brad King Note Added: 0028393
2012-01-23 14:05 Brad King Status new => resolved
2012-01-23 14:05 Brad King Resolution open => fixed
2012-01-23 14:05 Brad King Assigned To => Brad King
2012-04-19 15:44 David Cole Fixed in Version => CMake 2.8.8
2012-04-19 15:44 David Cole Target Version => CMake 2.8.8
2012-09-03 16:01 David Cole Note Added: 0030875
2012-09-03 16:01 David Cole Status resolved => closed


Copyright © 2000 - 2018 MantisBT Team