[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: |
John Mastro |
Subject: |
Re: While editing a CMake file, how to turn off smart indentation? |
Date: |
Fri, 17 Jul 2015 16:54:03 -0700 |
>> Emanuel, let's say I borrow your idea. can u plz
>> give me the ELisp code to make "ctrl+TAB" (without
>> numeric argument) insert exactly 4 spaces, and make
>> "shift+TAB" (without numeric argument) remove
>> exactly 4 spaces (or any 4 characters)?
> Still, you can try this. If it doesn't work, someone
> else has to help you:
>
> (global-set-key [\C-\t] 'insert-four-spaces)
> (global-set-key [\M-\t] 'remove-four-chars)
Yaron will actually need something like this for the second one:
(global-set-key [backtab] 'remove-four-chars)
The \M in [\M-\t] if for the "meta" (usually labeled "alt"). I know
Emanuel knows this but I'm mentioning it for Yaron's benefit.
I also had to change the key for the first one to (kbd "<C-tab>") or
[C-tab] for it to work on my system.
One more thing - I'd recommend binding the keys in cmake-mode's keymap
rather than the global map, in case you want to do things differently in
other modes.
Putting that all together, and making some assumptions about cmake-mode
(that its feature is `cmake-mode' and its mode map is `cmake-mode-map'),
we'd end up with:
(eval-after-load 'cmake-mode
'(progn
(define-key cmake-mode-map (kbd "<C-tab>") 'insert-four-spaces)
(define-key cmake-mode-map (kbd "<backtab>") 'remove-four-chars)))
--
john
- Re: While editing a CMake file, how to turn off smart indentation?, (continued)
- Re: While editing a CMake file, how to turn off smart indentation?, Vaidheeswaran C, 2015/07/17
- Re: While editing a CMake file, how to turn off smart indentation?, Vaidheeswaran C, 2015/07/17
- Re: While editing a CMake file, how to turn off smart indentation?, Ian Zimmerman, 2015/07/17
- Re: While editing a CMake file, how to turn off smart indentation?, Yaron Cohen-Tal, 2015/07/17
- Re: While editing a CMake file, how to turn off smart indentation?, Vaidheeswaran C, 2015/07/17
- Re: While editing a CMake file, how to turn off smart indentation?, Emanuel Berg, 2015/07/17
- Re: While editing a CMake file, how to turn off smart indentation?,
John Mastro <=
- Re: While editing a CMake file, how to turn off smart indentation?, Emanuel Berg, 2015/07/17
- Re: While editing a CMake file, how to turn off smart indentation?, Yaron Cohen-Tal, 2015/07/18
- Re: While editing a CMake file, how to turn off smart indentation?, John Mastro, 2015/07/18
- Re: While editing a CMake file, how to turn off smart indentation?, Yaron Cohen-Tal, 2015/07/19