all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Yuri Khan <yuri.v.khan@gmail.com>
To: Drew Adams <drew.adams@oracle.com>
Cc: "Clément Pit-Claudel" <cpitclaudel@gmail.com>,
	"Paul Eggert" <eggert@cs.ucla.edu>,
	"Emacs developers" <emacs-devel@gnu.org>
Subject: Re: Variable-width font indentation: pasting outside Emacs
Date: Wed, 7 Mar 2018 13:28:10 +0700	[thread overview]
Message-ID: <CAP_d_8Vig0hpMGX1C_qP6zDUQZXYcnPOs9WXZCi20LxHO_xAxw@mail.gmail.com> (raw)
In-Reply-To: <3b3217d9-de2f-4bba-a513-d2f6e714ecbf@default>

On Wed, Mar 7, 2018 at 5:15 AM, Drew Adams <drew.adams@oracle.com> 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++, “const Foo” vs “Foo const”; or in HTML, using a Unicode
character directly vs character reference vs entity reference);
* …


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.)



  reply	other threads:[~2018-03-07  6:28 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-03-06 18:21 Variable-width font indentation: pasting outside Emacs Drew Adams
2018-03-06 19:09 ` Yuri Khan
2018-03-06 19:52   ` Drew Adams
2018-03-06 22:15     ` Drew Adams
2018-03-07  6:28       ` Yuri Khan [this message]
2018-03-06 20:21 ` Eli Zaretskii
2018-03-06 20:56 ` Richard Stallman
2018-03-06 21:31   ` Drew Adams

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=CAP_d_8Vig0hpMGX1C_qP6zDUQZXYcnPOs9WXZCi20LxHO_xAxw@mail.gmail.com \
    --to=yuri.v.khan@gmail.com \
    --cc=cpitclaudel@gmail.com \
    --cc=drew.adams@oracle.com \
    --cc=eggert@cs.ucla.edu \
    --cc=emacs-devel@gnu.org \
    /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.