all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: "R. Diez via help-gnu-emacs" <help-gnu-emacs@gnu.org>
To: "help-gnu-emacs@gnu.org" <help-gnu-emacs@gnu.org>
Subject: Indenting with the tab key like everyone else
Date: Sun, 2 Jun 2019 21:19:45 +0000 (UTC)	[thread overview]
Message-ID: <1019418503.3900238.1559510385829@mail.yahoo.com> (raw)
In-Reply-To: 1019418503.3900238.1559510385829.ref@mail.yahoo.com

Hi all:

I want to change the indenting behaviour of the tab key when writing source code like C++, Perl or Bash. But I am a little confused, so I need some help.

When in C mode, the Tab key is bound to c-indent-line-or-region . When in Perl mode, it is bound to indent-for-tab-command, which is a rather complicated function.

I want the same behaviour as most other IDEs I know: If I just press tab, it should "intelligently" indent the current line of code as usual. But if I select several lines with the shift key, I want to rigidly indent the selected block of lines. At the moment, Emacs tries to reindent the selected lines, which often does nothing, because it thinks the lines are already properly indented.

If I want to intelligently reindent a block of lines, I would rather manually call the right function, something like "reindent-code". I could create an alias or a new function just for that purpose.

I never got used to Emacs "prefix" mechanism, so I do not want to use it. And I do not want to retrain my "muscle memory". I want the same behaviour as everywhere else.

What would be the best way to achieve this? I know a little Lisp, but not enough for complex things.

Many thanks in advance,
  rdiez



       reply	other threads:[~2019-06-02 21:19 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <1019418503.3900238.1559510385829.ref@mail.yahoo.com>
2019-06-02 21:19 ` R. Diez via help-gnu-emacs [this message]
2019-06-04  1:19   ` Indenting with the tab key like everyone else Emanuel Berg via help-gnu-emacs
2019-06-04  4:29   ` YUE Daian
2019-06-25  8:09     ` R. Diez via help-gnu-emacs
2019-07-01  4:29       ` YUE Daian
2019-07-16  7:23         ` R. Diez

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

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

  git send-email \
    --in-reply-to=1019418503.3900238.1559510385829@mail.yahoo.com \
    --to=help-gnu-emacs@gnu.org \
    --cc=rdiezmail-emacs@yahoo.de \
    /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.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.