From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: "R. Diez via help-gnu-emacs" Newsgroups: gmane.emacs.help Subject: Re: Indenting with the tab key like everyone else Date: Tue, 25 Jun 2019 10:09:29 +0200 Message-ID: <4deddc97-3a92-c350-01b0-75d47f1077fa@yahoo.de> References: <1019418503.3900238.1559510385829.ref@mail.yahoo.com> <1019418503.3900238.1559510385829@mail.yahoo.com> <87blzegehi.fsf@work.i-did-not-set--mail-host-address--so-tickle-me> Reply-To: "R. Diez" Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="209981"; mail-complaints-to="usenet@blaine.gmane.org" User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.7.0 Cc: "help-gnu-emacs@gnu.org" To: YUE Daian Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Tue Jun 25 10:10:06 2019 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([209.51.188.17]) by blaine.gmane.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1hfgWk-000sWs-Ep for geh-help-gnu-emacs@m.gmane.org; Tue, 25 Jun 2019 10:10:06 +0200 Original-Received: from localhost ([::1]:57366 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hfgWj-0000Pp-FK for geh-help-gnu-emacs@m.gmane.org; Tue, 25 Jun 2019 04:10:05 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:47370) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hfgWK-0000Pa-VF for help-gnu-emacs@gnu.org; Tue, 25 Jun 2019 04:09:42 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hfgWI-0004mh-Pw for help-gnu-emacs@gnu.org; Tue, 25 Jun 2019 04:09:40 -0400 Original-Received: from sonic303-19.consmr.mail.ir2.yahoo.com ([77.238.178.200]:43831) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hfgWG-0004gi-T4 for help-gnu-emacs@gnu.org; Tue, 25 Jun 2019 04:09:37 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.de; s=s2048; t=1561450171; bh=Qpu/3LeUbCbzmx+prf+kFIShMhzOf05y6rq6hz+M0/U=; h=Subject:To:References:Cc:From:Date:In-Reply-To:From:Subject; b=Z8UJ+RfWSLDGxP0tVmyzNTonaLQ6Z6NKRVkN6S5hrH9AyWASKXNWUvH9lORwQG2CKRFMH1SF5KumQcLpvOCe1Xh7a2GPphHqPyYUQJ9RkqwtY5rlF3d463IipAJ22glglTOu9w3R7OwC+wRGxFrYAQWouTjdJX5pJJPACJBd0nV5hOP5s1b+4yth4dPelEB3Vojg19k1zlcIdQCJXml32o1wfVSGYmu9kYbsm9JbSmkggmeVcWTAhHAk5/s04DulysuueI0xVVSaTrdHZeDzBfw8Dz8Y8bqPD17JSwcD6MoFcpVw4/P9V1VdVkAZjsd6aq6NzepfwEqVJhCfaHqMYA== X-YMail-OSG: 0i4xZdIVM1kpW2I_wxPonEL8XKtVPtm3mtcwuWtHIpDL5O7oNCobcwWvEiVFL9A l4uHZj2BKotUNXloq_V606vw0BBS_LIyrzQc2nBUTiROjqLTg6NkvLufeLZb_NetDe7YyaQID_v2 bsfRRpXEFunwfr_2CiWqXQVLivvHgTDPVWlELtSVeE9PbBARCaY2T9AW1L_m0_Xl1KBhM6P3v_3_ .PI07mZUAubz_CFVZluGGqJVFZhK_1RyOVAEhkMtUEx4HzK2Hu7PF7pP_tk932fPpSrKOU1bg2s. wdjcJzzLFG_x_zvmmOf57wL9WrxpO0wOITTTj9wNjx2Uo2EG3SR3JPOULkjtAvWijBb66rK2CMk0 g8Ae9Xhr5FxFnRU0LM6E0YMubyYG5T8yBZv2AkGKeY2xbW4xyyV86sCbGiz3wN7KPAQUvUDB7NAK 2lGhjlzm1CY7aRZwJbc7Z9FxOW0DYG6qgSFTIm6cfmFuRmDbAhJPE0P8OX0h5jSvfNxoqpY7ZWWH OnMe5lDEMMmRyS5jpvOuU7KTK93oU0UxlN0FfVjYrxbi9YOVGPnCPVWecqauhTU5nkMOSPwEPkFu s8uePvVbpSqqUELY7ihqSmcTUzAGGtYiPyessXnUxzF.e0O3.VVDDn0lfSfBoKb7LKWyN6oLTaaq u4HH0hmXgLuSmR53FWnZqGACaDg27z5Y5VsmetUeXCznUQgeeY.ejDELqD5zQmQXBYTYIhlKepeK 3vsCCBNAfLM2NH1SPvyfovl1326I6JzzeyAPR4J4CtIhCxbqMqnYcpf.hE1El91o.0Mp6TfvRdt2 OWyo1l5fo.V.TytiY.eKEValveILrIORsbGWVhrxEt Original-Received: from sonic.gate.mail.ne1.yahoo.com by sonic303.consmr.mail.ir2.yahoo.com with HTTP; Tue, 25 Jun 2019 08:09:31 +0000 Original-Received: from p5B254565.dip0.t-ipconnect.de (EHLO [192.168.1.137]) ([91.37.69.101]) by smtp405.mail.ir2.yahoo.com (Oath Hermes SMTP Server) with ESMTPA ID 0dfd8caaa6922acb407b7ad183fcc150; Tue, 25 Jun 2019 08:09:30 +0000 (UTC) In-Reply-To: <87blzegehi.fsf@work.i-did-not-set--mail-host-address--so-tickle-me> Content-Language: en-GB X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 77.238.178.200 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.23 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" Xref: news.gmane.org gmane.emacs.help:121038 Archived-At: Hallo Danny: Thanks for your help. I got a little further, see the code I came up with below (I used some code I found on the Internet too). There is a little issue I have not been able to fix yet. Say I place the cursor at the beginning of a line, and select a few lines by keeping the "shift" key pressed and hitting the down arrow key a few times. I call this selecting lines "downwards". Then indenting by hitting the tab key multiple times works fine. However, if I select/mark the lines "upwards" (by using the up arrow key), then 'my-indent-rigidly' loses the selection after indenting the first time. I am confused with the terms 'region', 'mark' and 'transient mark', and my Lisp skills are not very good either. Have you got any ideas on how to fix that? The Lisp code is here: ; This routine keeps the region/mark/transient mark (?) when doing an indent-rigidly. (defun my-indent-rigidly (amount) "" (save-excursion (let ((deactivate-mark nil) (beg (region-beginning))) (move-beginning-of-line nil) (indent-rigidly beg (region-end) amount) (push-mark beg t t)))) ; Shift-Tab to decrease the indentation. ; As an alternative, block-select the columns of spaces you want to delete, and press the Del key. (defun unindent-rigidly nil "" (interactive) (my-indent-rigidly -1) ) (global-set-key [S-tab] 'unindent-rigidly) ; Sometimes "S-tab" does not work, use [backtab] instead: (global-set-key [backtab] 'unindent-rigidly) ; The Tab key has 2 functions: ; - If some text is selected, ridigly increases indentation. ; - Otherwise, intelligently indent the current line. (defun my-tab-indent nil "" (interactive) (if (use-region-p) (my-indent-rigidly 1) (indent-for-tab-command))) (global-set-key (kbd "TAB") 'my-tab-indent) Best regards, rdiez