From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: =?UTF-8?B?QWxlxaEgQml6amFr?= Newsgroups: gmane.emacs.help Subject: Re: Indent one level deeper rather than smart indent? Date: Fri, 22 Mar 2013 21:12:38 +0100 Message-ID: References: NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: multipart/alternative; boundary=047d7b6d9c04e0a6db04d88914dc X-Trace: ger.gmane.org 1363983198 9707 80.91.229.3 (22 Mar 2013 20:13:18 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 22 Mar 2013 20:13:18 +0000 (UTC) Cc: Emacs Help To: Andrew Pennebaker Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Fri Mar 22 21:13:44 2013 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 1UJ8LQ-0000uq-41 for geh-help-gnu-emacs@m.gmane.org; Fri, 22 Mar 2013 21:13:44 +0100 Original-Received: from localhost ([::1]:33648 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UJ8L1-0007cJ-Pt for geh-help-gnu-emacs@m.gmane.org; Fri, 22 Mar 2013 16:13:19 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:47146) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UJ8Km-0007ax-7s for help-gnu-emacs@gnu.org; Fri, 22 Mar 2013 16:13:10 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UJ8Kh-0003sK-QU for help-gnu-emacs@gnu.org; Fri, 22 Mar 2013 16:13:04 -0400 Original-Received: from mail-qa0-f54.google.com ([209.85.216.54]:38875) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UJ8Kh-0003sG-Me for help-gnu-emacs@gnu.org; Fri, 22 Mar 2013 16:12:59 -0400 Original-Received: by mail-qa0-f54.google.com with SMTP id o13so614573qaj.13 for ; Fri, 22 Mar 2013 13:12:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=x-received:mime-version:in-reply-to:references:from:date:message-id :subject:to:cc:content-type; bh=zX6Vd6Tpj0vBD0OnBZmzNESGrCPiotzwjddZHn9N3jA=; b=NFC4fHK5M6ZNic4cMl3ZvEZ8mAFCEoDWuPtVJZVoKn2hFDEtrVWJJAPAhmErXj0yxm vwSArvni+/L38MTeulE0bKKiz/dMc29pt6IGv34M7xCShrEWPwHWfq8QSQocWx6d3qRO ljvQZ7JD2z0fi1iRhrTqqJxd7T4vitFX7uvnrBptWzO4tX16kGh3wg6Pj5y16+R1GYwN t6gET4xE7u/pytl+XCxbb6gjur0KPQdOZOPnsPoYFBI6n4LeGdmHewjLhSABsEr/Se1v w2JYL9Iw2HUApznCObNnaJWdFF26h1owfCsDRpY0MohZQCAgrpKA4tVATMkqNGf1s8jv s2Aw== X-Received: by 10.49.128.170 with SMTP id np10mr1212125qeb.37.1363983179226; Fri, 22 Mar 2013 13:12:59 -0700 (PDT) Original-Received: by 10.229.78.193 with HTTP; Fri, 22 Mar 2013 13:12:38 -0700 (PDT) In-Reply-To: X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [fuzzy] X-Received-From: 209.85.216.54 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:89673 Archived-At: --047d7b6d9c04e0a6db04d88914dc Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable On 22 March 2013 17:06, Andrew Pennebaker wrot= e: > When in markdown-mode, I would like to disable smart indent. Instead, whe= n > I highlight a block of code and press TAB, I would like the block to be > indented one level deeper, like how Sublime does it. > > What goes in my ~/.emacs to achieve this? > > Which markdown-mode are you using? If the one at http://jblevins.org/projects/markdown-mode/ then I think something like (defadvice markdown-cycle (around indent-active-region-rigidly (&optional arg shift) activate) (if (use-region-p) (save-excursion (let ((rb (region-beginning)) (re (region-end))) (goto-char rb) (beginning-of-line) (indent-rigidly (point) re (if shift (- tab-width) tab-width)) (setq deactivate-mark nil))) ad-do-it)) should do it. If you don't have an active region TAB will behave the same as before, but if you have an active region, it will indent the whole region for tab-width. I have never used sublime-text so I don't know whether this is what you actually want. If you always want to indent and never want to cycle the visibility then the solution is simpler. If you want Shift+TAB to indent regions to the left then also put (add-hook 'markdown-mode-hook (lambda () (fset 'markdown-shifttab (lambda () (interactive) (markdown-cycle t t))))) into your .emacs. -- Cheers, Ale=C5=A1 --047d7b6d9c04e0a6db04d88914dc Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable

On 22 March 2013 17:06, Andrew Pennebake= r <andrew.pennebaker@gmail.com> wrote:
When in markdown-mode, I would like to disable smart = indent. Instead, when I highlight a block of code and press TAB, I would li= ke the block to be indented one level deeper, like how Sublime does it.

What goes in my ~/.emacs to achieve this?

<= /blockquote>

Which markdown-mode are you using? If the o= ne at=C2=A0http://j= blevins.org/projects/markdown-mode/=C2=A0then I think something like

(defadvice markdown-cycle (around indent-active-region-= rigidly (&optional arg shift) activate)
=C2=A0 (if (use-regio= n-p)
=C2=A0 =C2=A0 =C2=A0 (save-excursion
=C2=A0 =C2=A0= =C2=A0 =C2=A0 (let ((rb (region-beginning))
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (re (region-end)))
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (goto-char rb)
=C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 (beginning-of-line)
=C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 (indent-rigidly (point)
=C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 re=C2= =A0
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (if shift (- tab-width) tab-width))
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (setq deactivate-mark nil)))
<= div>=C2=A0 =C2=A0 ad-do-it))

should do it. If you = don't have an active region TAB will behave the same as before, but if = you have an active region, it will indent the whole region for tab-width. I= have never used sublime-text so I don't know whether this is what you = actually want. If you always want to indent and never want to cycle the vis= ibility then the solution is simpler.

If you want Shift+TAB to indent regions to the left the= n also put

(add-hook 'markdown-mode-hook<= /div>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (lambda ()
=C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (fset 'markdown-shifttab=C2=A0
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (lambda= ()=C2=A0
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0= =C2=A0 =C2=A0 (interactive)
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (markdown-cycle t t)))))

into your .emacs.=C2=A0

-- Cheers, Ale= =C5=A1
--047d7b6d9c04e0a6db04d88914dc--