From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Yuri Khan Newsgroups: gmane.emacs.devel Subject: Re: Variable-width font indentation: pasting outside Emacs Date: Wed, 7 Mar 2018 13:28:10 +0700 Message-ID: References: <3b3217d9-de2f-4bba-a513-d2f6e714ecbf@default> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Trace: blaine.gmane.org 1520404032 1347 195.159.176.226 (7 Mar 2018 06:27:12 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Wed, 7 Mar 2018 06:27:12 +0000 (UTC) Cc: =?UTF-8?Q?Cl=C3=A9ment_Pit=2DClaudel?= , Paul Eggert , Emacs developers To: Drew Adams Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Wed Mar 07 07:27:08 2018 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1etSXZ-0007nE-IT for ged-emacs-devel@m.gmane.org; Wed, 07 Mar 2018 07:27:05 +0100 Original-Received: from localhost ([::1]:59868 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1etSZc-0001uU-39 for ged-emacs-devel@m.gmane.org; Wed, 07 Mar 2018 01:29:12 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:54852) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1etSYy-0001rq-Lj for emacs-devel@gnu.org; Wed, 07 Mar 2018 01:28:33 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1etSYx-0000YC-HV for emacs-devel@gnu.org; Wed, 07 Mar 2018 01:28:32 -0500 Original-Received: from mail-ot0-x236.google.com ([2607:f8b0:4003:c0f::236]:41638) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1etSYx-0000Y0-Br for emacs-devel@gnu.org; Wed, 07 Mar 2018 01:28:31 -0500 Original-Received: by mail-ot0-x236.google.com with SMTP id w38so1070987ota.8 for ; Tue, 06 Mar 2018 22:28:31 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc:content-transfer-encoding; bh=nSQ9hgj9JMNmxZO8Mg6bf5hBBCVbbzVdnjpBf4/z/C4=; b=nX05TLib88faXNYQ9tIMKNifgz4jJknDK801INCDd3qeKKOzAWFAbWoP01BF3admef 0Ds/NbtqKmlFdsa+PoZMOvkrRab4aFQpEWkVXERBj/ybQuyqq8MoaKYX7gnGSzMgUmgP +PR+EhYvFmSZT6eDGfnSKavdCgcnJY8DNyymGmxfg/Bpjuordk3iJSNHvkZz8KEx5uFn +o7EqD0S9+ksZHjaymtpkAZ9CHvDy4ZRCL1MS4o0rl4abMTB8i7WnBTEFq1KVy0Vxn1+ 7KDuMS2ETpsjOj4TQThNbhUFACz4EZBYdEwTTCigHqO+LUlsf5IciZ1xOQUFG8Cnrk5U V8sg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:sender:in-reply-to:references:from :date:message-id:subject:to:cc:content-transfer-encoding; bh=nSQ9hgj9JMNmxZO8Mg6bf5hBBCVbbzVdnjpBf4/z/C4=; b=G+NgBX048p1dcMZnFAr+6e5+cwpBPJ6rXoshLnqsGAXg1RB9QfEDs9tPMos5PKg5xC 5HzXkhl1r+k5Iog8JmzoLeXC2h2rOH9G2l0l/cswDflCHKy/aE3DNog7f6f8B07aWup8 wdtVdVgzKI7H6Be3w5LNYUpvQt8UC9ZVYQF9ZxopPQX2GbzEUHU3Y60LXMHWutx/I5hy uD9ufEC9lhc2D34+SnqhVrY7ejXrnq/RfQPl6ee/lOmHvMZs4NNNhVU8ygBhc6McJ81K xa7YbDgjmGvW8xpVtL6EqzZbeDM7U4MecONzJiuFPN2wvZlWJnttTQgr31SEa9P7Ty8b LsTA== X-Gm-Message-State: AElRT7FpOvN2NMmi/U5qM4m/7+f1x0TKhtXexcEjHLFMDek1SWFBRhFg /uKRcN3dEDwGO/DWHpd7u4Drk4VHI9RMenQ4ViM= X-Google-Smtp-Source: AG47ELslbum6aPEyavVafBp+SGT77afIYloGRcYspEeS37+3MaIEvQ2mmiyUNajhk5HEQqVQC/jAc9sYIX5MD6rEuDM= X-Received: by 10.157.74.20 with SMTP id h20mr15603285otf.381.1520404110604; Tue, 06 Mar 2018 22:28:30 -0800 (PST) Original-Received: by 10.74.211.77 with HTTP; Tue, 6 Mar 2018 22:28:10 -0800 (PST) In-Reply-To: <3b3217d9-de2f-4bba-a513-d2f6e714ecbf@default> X-Google-Sender-Auth: wdpLLHGWr-ytYb89YYsiXvF4oLM X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:4003:c0f::236 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.org gmane.emacs.devel:223400 Archived-At: On Wed, Mar 7, 2018 at 5:15 AM, Drew Adams wrote: > It happens sometimes that the code I copied uses tab chars > for indentation. I use a nil value of `indent-tabs-mode' > for my own use, but the copied code introduces some tab > chars (alas). Okay, that is the essence of the problem: you are copying and pasting code across a formatting convention boundary and you have to realize and acknowledge the fact and reformat the code according to the conventions of the target (or have code reformatted for you). That problem is not limited to tabs, spaces, indentation, and alignment. It involves also: * maximum line length; * spaces around punctuation; * omitting or including optional grammar elements (e.g. quotes around HTML attribute values, or the trailing semicolon in a Pascal compound statement); * preference for one of several equivalent forms of expressing an idea (e.g. in C++, =E2=80=9Cconst Foo=E2=80=9D vs =E2=80=9CFoo const=E2=80=9D; o= r in HTML, using a Unicode character directly vs character reference vs entity reference); * =E2=80=A6 There are some modes (web-mode comes to mind) that automatically reindent after a paste operation. That could be made a universal feature. I imagine it could be quite convenient if (a) your preferred indentation style matches their defaults, or (b) you take the effort to teach them your style; and quite annoying otherwise. A good first step would be to make reindentation also tabify or untabify the leading whitespace of each reindented line according to the current value of indent-tabs-mode. (Now, if the line is to be indented at 4, indent-tabs-mode is nil, tab-width is 4, and there is a single tab character at the start of the line, it will be kept with a tab.)