From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: John Mastro Newsgroups: gmane.emacs.help Subject: Re: While editing a CMake file, how to turn off smart indentation? Date: Fri, 17 Jul 2015 16:54:03 -0700 Message-ID: References: <87a8uuz7d2.fsf@nl106-137-147.student.uu.se> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 X-Trace: ger.gmane.org 1437177278 15678 80.91.229.3 (17 Jul 2015 23:54:38 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 17 Jul 2015 23:54:38 +0000 (UTC) To: "help-gnu-emacs@gnu.org" Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Sat Jul 18 01:54:37 2015 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1ZGFSf-0007DY-Kh for geh-help-gnu-emacs@m.gmane.org; Sat, 18 Jul 2015 01:54:37 +0200 Original-Received: from localhost ([::1]:46453 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZGFSe-0001H1-NB for geh-help-gnu-emacs@m.gmane.org; Fri, 17 Jul 2015 19:54:36 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:52549) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZGFSU-0001Ga-Ax for help-gnu-emacs@gnu.org; Fri, 17 Jul 2015 19:54:27 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZGFST-0003t8-31 for help-gnu-emacs@gnu.org; Fri, 17 Jul 2015 19:54:26 -0400 Original-Received: from mail-ob0-x232.google.com ([2607:f8b0:4003:c01::232]:35722) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZGFSS-0003sv-UA for help-gnu-emacs@gnu.org; Fri, 17 Jul 2015 19:54:25 -0400 Original-Received: by obbop1 with SMTP id op1so74449797obb.2 for ; Fri, 17 Jul 2015 16:54:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :content-type; bh=8tEovtdHRV030DjUjkhzq7uVemtszuWQIrYTdcT20Do=; b=UCFaM0xiueciOnH7gePLezIpsmVuPnz/twEs5GgNyFvuKt3rTJG/M/m1ktIbanl+Tk RVemFJxfDFeC8oowgjGGW/ZWCAI1oAyaaaRSH1kDvE08//p0G79nT4K0pYIbURr+/il9 maJZEhI1MKTVPQsAGgcC41iNpT6tqJgJvfFXXUAzQ9jLg9dRRbjh3mxkgdY2ED+joFm+ FsVRj9jPoVg6ahpyDDaL0CAayXhsfwBqPm8whTg7WCKcJcOXT65EID7fd/+rcChbj6yH wkn/0RViu22NBjA54hpRda2tNS4zdAjyA8ndVMd3nmcrvmvpEf2fmih0wHeke54ltfHL 0IiQ== X-Received: by 10.202.48.22 with SMTP id w22mr15146816oiw.95.1437177262486; Fri, 17 Jul 2015 16:54:22 -0700 (PDT) Original-Received: by 10.76.168.70 with HTTP; Fri, 17 Jul 2015 16:54:03 -0700 (PDT) In-Reply-To: <87a8uuz7d2.fsf@nl106-137-147.student.uu.se> X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2607:f8b0:4003:c01::232 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:105797 Archived-At: >> 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 "") 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 "") 'insert-four-spaces) (define-key cmake-mode-map (kbd "") 'remove-four-chars))) -- john