unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: Emanuel Berg <embe8573@student.uu.se>
To: help-gnu-emacs@gnu.org
Subject: Re: While editing a CMake file, how to turn off smart indentation?
Date: Sat, 18 Jul 2015 01:34:17 +0200	[thread overview]
Message-ID: <87a8uuz7d2.fsf@nl106-137-147.student.uu.se> (raw)
In-Reply-To: CADKOXrBcLCut2pJjyJVYV_FQGupt8cSxUcGwY8Owa67Obhe3AQ@mail.gmail.com

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




  parent reply	other threads:[~2015-07-17 23:34 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-07-17  4:18 While editing a CMake file, how to turn off smart indentation? Yaron Cohen-Tal
2015-07-17  5:59 ` Vaidheeswaran C
2015-07-17 23:34 ` Emanuel Berg [this message]
2015-07-17 23:54   ` John Mastro
2015-07-18  0:26     ` Emanuel Berg
2015-07-18 17:58       ` Yaron Cohen-Tal
2015-07-18 19:18         ` John Mastro
2015-07-19 17:35           ` Yaron Cohen-Tal
  -- strict thread matches above, loose matches on Subject: below --
2015-07-16  7:23 Yaron Cohen-Tal
2015-07-16 22:55 ` Emanuel Berg
2015-07-16 23:55 ` Stefan Monnier
     [not found] ` <mailman.7023.1437087429.904.help-gnu-emacs@gnu.org>
2015-07-17  1:14   ` Dan Espen
2015-07-17  5:39 ` Vaidheeswaran C
2015-07-17 23:37   ` Emanuel Berg
2015-07-17  5:52 ` Vaidheeswaran C
2015-07-17 15:01 ` Ian Zimmerman

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87a8uuz7d2.fsf@nl106-137-147.student.uu.se \
    --to=embe8573@student.uu.se \
    --cc=help-gnu-emacs@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).