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: Emanuel Berg
Subject: Re: While editing a CMake file, how to turn off smart indentation?
Date: Sat, 18 Jul 2015 01:34:17 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.4 (gnu/linux)

Yaron Cohen-Tal <yaronct@gmail.com> writes:

> Sorry but I'm not experienced with ELisp.

Well, start today! "What you once feared, now makes
you free."

> 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)?

My idea isn't that, but on the contrary:

    1. Use the default, syntactic and
       automatic indentation.

    2. If you don't want to do that, use `C-u SPC' and
       `C-u DEL' to do what you want.

But OK, the functions would look like this:

(defun insert-four-spaces ()
  (interactive)
  (insert-char ?\  4) )

(defun remove-four-chars ()
  (interactive)
  (backward-delete-char 4) )

The shortcuts on the other hand is the tricky part.
I do this in a special way (which is easy), however
you probably won't be helped by that as you don't use
the ttys (also known as the console or "Linux VTs") -
you use the GUI Emacs of X, right? (If I'm wrong, I'm
happy to help you my way.)

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)

-- 
underground experts united
http://user.it.uu.se/~embe8573




reply via email to

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