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 02:26:32 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.4 (gnu/linux)

John Mastro <john.b.mastro@gmail.com> writes:

> Yaron will actually need something like this for the
> second one:
>
> (global-set-key [backtab] 'remove-four-chars)

Right, it was shift, not Meta! Yes, Mastro is right.

> 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.

This

    (global-set-key [C-tab] 'insert-four-spaces)

works for me as well. The reason I put it the other
way is I first put it this way:

    (global-set-key [C-TAB] 'insert-four-spaces)

And then it says:

    To bind the key C-TAB, use [?\\C-\\t], not [C-TAB]

But neither, nor

    (global-set-key [?\C-\t]   'insert-four-spaces)
    (global-set-key [?\\C-\\t] 'insert-four-spaces)

works what I can see (and the second don't even eval).

What does it mean?

> 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.

Yes, of course, I thought that was self-evident.
Ehm... Anyway, another way to do it is to `defvar'
the cmake-mode-map, and then set the keys up in
a hook. Like this, but not with IELM but cmake:

(defvar ielm-map)

;; (setq ielm-mode-hook nil) ; use to reset hook
(defun ielm-mode-hook-f ()
  (let ((the-map ielm-map))
    (define-key the-map "\C-xk" 'bury-buffer)
    (define-key the-map "\C-p"  'comint-previous-input)
    (define-key the-map "\C-n"  'comint-next-input) ))
(add-hook 'ielm-mode-hook 'ielm-mode-hook-f)

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




reply via email to

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