help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: While editing a CMake file, how to turn off smart indentation?


From: Dan Espen
Subject: Re: While editing a CMake file, how to turn off smart indentation?
Date: Thu, 16 Jul 2015 21:14:07 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.5 (gnu/linux)

Emanuel Berg <embe8573@student.uu.se> writes:

> Yaron Cohen-Tal <yaronct@gmail.com> writes:
>> In my `.emacs`, but for CMake files Emacs just
>> indents the lines automatically according to its own
>> rules, and TAB has no effect at all.
>
> What is CMake? I don't get any apropos matches and
> there isn't anything in the Emacs documentation
> according to my razor-sharp tools for finding out.

CMake files have the suffix ".cmake".
Emacs does not appear to handle them, you end up in Fundamental mode.

GNU Emacs 24.5.1 (x86_64-redhat-linux-gnu, GTK+ Version 3.14.12) of 2015-05-07 
on buildvm-08.phx2.fedoraproject.org

They look like a script with '#' comments so there might be a mode that
would come close:

  # Install script for directory: /home/me/src/libomron

  # Set the install prefix
  IF(NOT DEFINED CMAKE_INSTALL_PREFIX)
    SET(CMAKE_INSTALL_PREFIX "/usr/local")
  ENDIF(NOT DEFINED CMAKE_INSTALL_PREFIX)
  STRING(REGEX REPLACE "/$" "" CMAKE_INSTALL_PREFIX "${CMAKE_INSTALL_PREFIX}")

So, tab should just self insert.

For the original poster:

In Emacs, the tab key works differently depending on the mode.
The mode is often set automatically based on the file extension.
You can see the mode inside () on the mode line, its the first word.

If you are in fundamental mode, the tab key should insert a tab.
Emacs by default tabs by 8.

All of this can be changed, but don't do it to fundamental mode.

Try this:

http://www.emacswiki.org/emacs/CMakeMode


-- 
Dan Espen


reply via email to

[Prev in Thread] Current Thread [Next in Thread]