From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Yaron Cohen-Tal Newsgroups: gmane.emacs.help Subject: Re: While editing a CMake file, how to turn off smart indentation? Date: Sat, 18 Jul 2015 20:58:01 +0300 Message-ID: References: <87a8uuz7d2.fsf@nl106-137-147.student.uu.se> <87zj2ufgzr.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 1437242305 24721 80.91.229.3 (18 Jul 2015 17:58:25 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sat, 18 Jul 2015 17:58:25 +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 19:58:20 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 1ZGWNO-0005rF-Qp for geh-help-gnu-emacs@m.gmane.org; Sat, 18 Jul 2015 19:58:18 +0200 Original-Received: from localhost ([::1]:49276 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZGWNN-0002SA-O6 for geh-help-gnu-emacs@m.gmane.org; Sat, 18 Jul 2015 13:58:17 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:54782) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZGWNA-0002R0-TQ for help-gnu-emacs@gnu.org; Sat, 18 Jul 2015 13:58:06 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZGWN9-00019D-Dp for help-gnu-emacs@gnu.org; Sat, 18 Jul 2015 13:58:04 -0400 Original-Received: from mail-vn0-x22d.google.com ([2607:f8b0:400c:c0f::22d]:36578) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZGWN9-00018O-7M for help-gnu-emacs@gnu.org; Sat, 18 Jul 2015 13:58:03 -0400 Original-Received: by vnk197 with SMTP id 197so10949526vnk.3 for ; Sat, 18 Jul 2015 10:58:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; bh=EiuKV+0xapx1UVQjPvqf3QnDv6R7l04mUlZq2FWIm9M=; b=PWc0KMGA6JBJLotNT7lHkuhkagiDdUogX5DHyeNCdVb+opYo56jxodrdEeUyxXsW+A Tp2HslFVgdPaSI1lhIfxKtfyRQVDO2DU3RaunKC1D2wXVpZOgrr/HjOa+zdIThLa8+mU 8y7WdLUGSCMlLrJ/qRy8FjwZR3NjNPEN5PEBC5qTTpL1haT4tPHbGhS6a28s3QRMJg4q xbcH53e8Cs1kHrYW5CWp2phP4N5c7g3sM94hUIvu+DALpLfwrWveMcBNjYvhmYiJ3LEV u95W6p0QhPUNJZqnt3RppeOrLgVlkJ45/0hyN4bbpk6VaVN9kyoSsg23c9/jc4bZ9pTq 0shA== X-Received: by 10.52.117.145 with SMTP id ke17mr24266195vdb.62.1437242281979; Sat, 18 Jul 2015 10:58:01 -0700 (PDT) Original-Received: by 10.31.70.193 with HTTP; Sat, 18 Jul 2015 10:58:01 -0700 (PDT) In-Reply-To: <87zj2ufgzr.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:400c:c0f::22d X-Content-Filtered-By: Mailman/MimeDel 2.1.14 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:105812 Archived-At: Thanx guys, The shortcuts to (un)indent 4 spaces work perfectly. What I still don't manage is to make "RET" simply start a new line with indentation identical to the previous line. In C++ mode I arranged it so behave this way. I tried changing the code in "cmake-mode.el" from: (make-local-variable 'indent-line-function) (setq indent-line-function 'cmake-indent) to: (make-local-variable 'indent-line-function) (setq indent-line-function 'c-indent-line-or-region) Because "c-indent-line-or-region" is what's called when pressing TAB in C++ mode, and I want the same behavior. But instead, with CMake files, RET now starts a new line with no indentation at all. Btw u can get the "cmake-mode.el" file from the "cmake-data" package (in Debian). I also uploaded it here . On Sat, Jul 18, 2015 at 3:26 AM, Emanuel Berg wrote: > John Mastro 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 "") 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 > > >