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 02:09:20 +0700	[thread overview]
Message-ID: <CAP_d_8Vu35isu_Q_8Pq_z3Yt1T8W6otoWYmVaVhu_xHH7TYHqA@mail.gmail.com> (raw)
In-Reply-To: <f078cc98-b584-470b-acd9-6f450f4ff9ba@default>

On Wed, Mar 7, 2018 at 1:21 AM, Drew Adams <drew.adams@oracle.com> wrote:

> Could we, for example, (optionally) affect copy or paste
> operations, to automatically try to compensate by inserting
> the (more or less) right number of SPC chars of the
> variable-width font (of the first non-whitespace char on the
> line)?

You mean changing the number of spaces used as indentation, depending
on what font the receiving application uses?

> People communicate about code and other text in more and more
> ways, many of which are and will remain outside Emacs.  Can we
> try to DTRT for variable-width text, so that the result of
> pasting into another app gives indentation and alignment that
> at least approximates what one would want/expect?  If so,
> should we try to do that?

Oh please don’t.

Why? Because the widget where the text is going to be pasted from
Emacs is not the widget that will ultimately display the text.

How is that? Imagine a chat application such as Mattermost. Its UI is
a web page with a text input widget on the bottom. That widget
normally uses a variable width font, and accepts Markdown syntax. The
user will normally type three grave accent characters ``` and a hard
newline, then paste a snippet of code from clipboard, then close with
another ```. On the server, Markdown will be interpreted and the
recipient will receive a syntax-highlighted, fixed-width-formatted
fragment of code.

With your suggestion, that fragment will have the wrong amount of
indentation. (Where “wrong” denotes “other than the sender intended or
expected”.)


Relatedly, I have worked with several applications that support
copying and pasting HTML markup. In their striving to make the result
“intuitive”, they introduce abominations on the receiving side.

Example: You are reading a web page. You copy a fragment of text. The
source page is styled with CSS that specifies a blue-black foreground
color and a fancy font for the body text. When you paste that into a
blog post, the receiving widget attempts to preserve that color. But,
since the body text style of the target article specifies dark gray
foreground color and a different fancy font, it applies direct
formatting to the pasted text: <span style="color: rgb(0,51,102);
font-family: Proxima Nova, …">Lorem ipsum…</span>.

Now the post text is tainted. It will appear in blue-black and in
Proxima Nova for every viewer, regardless of their preferred color
scheme and font. A user who prefers green text on a dark gray
background will break his/her eyes trying to read that.

Copying and pasting WYSIWYG formatting: Just say no. Doing things
behind the user’s back on copy/paste: Just say no.



  reply	other threads:[~2018-03-06 19:09 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 [this message]
2018-03-06 19:52   ` Drew Adams
2018-03-06 22:15     ` Drew Adams
2018-03-07  6:28       ` Yuri Khan
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_8Vu35isu_Q_8Pq_z3Yt1T8W6otoWYmVaVhu_xHH7TYHqA@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.