From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Karl Fogel Newsgroups: gmane.emacs.devel Subject: Question about intended behavior of 'insert-for-yank-1'. Date: Mon, 12 Sep 2016 00:17:14 -0500 Message-ID: <874m5lr92d.fsf@red-bean.com> Reply-To: Karl Fogel 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 1473657512 7045 195.159.176.226 (12 Sep 2016 05:18:32 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Mon, 12 Sep 2016 05:18:32 +0000 (UTC) To: Emacs Devel Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Mon Sep 12 07:18:28 2016 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 1bjJdO-0000XD-SK for ged-emacs-devel@m.gmane.org; Mon, 12 Sep 2016 07:18:23 +0200 Original-Received: from localhost ([::1]:40202 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bjJdM-0002ju-Qz for ged-emacs-devel@m.gmane.org; Mon, 12 Sep 2016 01:18:20 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:49679) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bjJcm-0002ji-NH for emacs-devel@gnu.org; Mon, 12 Sep 2016 01:17:45 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bjJcg-0001Lc-GH for emacs-devel@gnu.org; Mon, 12 Sep 2016 01:17:43 -0400 Original-Received: from mail-oi0-x243.google.com ([2607:f8b0:4003:c06::243]:35628) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bjJcg-0001IV-BN for emacs-devel@gnu.org; Mon, 12 Sep 2016 01:17:38 -0400 Original-Received: by mail-oi0-x243.google.com with SMTP id 2so20372823oif.2 for ; Sun, 11 Sep 2016 22:17:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:from:to:subject:reply-to:date:message-id:mime-version :content-transfer-encoding; bh=yEN/7+sjNXBK/EVmHSJtJTju3j7TzMyBZ4kPSgmHVOA=; b=WsuEutc6ERUltjs8kKZVBUiviiYYm3d3ih+vGImj82ELiGqdCfbK+2Qeo/ceLL9czq 2MhPCK3REpe8R3hZNLskA10OP08jWLXgEkXFoncy+ASR5EvJrbTXu2LhJaz86sTgVpJZ Ovm70PBYRp+DU3SAAMxBVtl/y03PJUR19Rk2AOlCuZplVOsSKQkN+iihDZ4ydL+eq+qe MbkV2+0MDBH1qfp0DGExXiBKQveZMBkRX4NskLwj0PnJsqrgh5A7m15WWPpho22K+8Y1 KMGm2/9nMlTe4NOcEtG+uLdu6In9p54XSZgOE4SSmKxqkbK5XABhkpqWG86P3shVNICn mbQA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:sender:from:to:subject:reply-to:date:message-id :mime-version:content-transfer-encoding; bh=yEN/7+sjNXBK/EVmHSJtJTju3j7TzMyBZ4kPSgmHVOA=; b=Na/Vy7k6N47PY9qs/CRwaZe40m2qxdV1WlhbKJc+UXRSZd71c30wbYdgyi6zCYi/IO s2leUoE5CpZ4+svBwsl+fvOrskNPtJGuYHebBRytBitvH+j9XH0W4LeQVNQhpcq62E/P Nakp3zl2XsSqOevxv62fALKTWBxAko2A/Ze/CHHPzdaIfOfrMDETxSX/9dud4I9Q89w/ C+CshRp4CTV7Ple/D+QXb2Z7jUF40SgyYQ/d3cD6FNP6XCZrV4kq6IJ+BQrs4sadkNK9 WtNf+hS2QdxhgSyklLrSbZBluCKRXxnLQoBltbtB3pSffq3Wg+1fhdSjLogXCzSUpszk aWFQ== X-Gm-Message-State: AE9vXwPjNUNcVlRSyuzf6LiDBgd6V+5oHXTCFvy80oaZdoEcZBn9ceGKe5yj9OUqO5fNuw== X-Received: by 10.202.50.85 with SMTP id y82mr21813869oiy.0.1473657436664; Sun, 11 Sep 2016 22:17:16 -0700 (PDT) Original-Received: from floss (207-181-239-70.c3-0.grn-ubr1.chi-grn.il.cable.rcn.com. [207.181.239.70]) by smtp.gmail.com with ESMTPSA id e66sm8960924itd.22.2016.09.11.22.17.14 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sun, 11 Sep 2016 22:17:15 -0700 (PDT) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2607:f8b0:4003:c06::243 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:207372 Archived-At: The doc string for 'insert-for-yank-1' says: [...] If STRING has a non-nil =E2=80=98yank-handler=E2=80=99 property on its fi= rst character, the normal insert behavior is altered. The value of the =E2=80=98yank-handler=E2=80=99 property must be a list of one to four elements, of the form (FUNCTION PARAM NOEXCLUDE UNDO). FUNCTION, if non-nil, should be a function of one argument, an object to insert; it is called instead of =E2=80=98insert=E2=80=99. PARAM, if present and non-nil, replaces STRING as the argument to FUNCTION or =E2=80=98insert=E2=80=99; e.g. if FUNCTION is =E2=80=98yank-= rectangle=E2=80=99, PARAM may be a list of strings to insert as a rectangle. [...] This implies that when the `yank-handler' property is present, then when PA= RAM is nil, the string passed to FUNCTION should be STRING. That is, the e= ntire length of STRING, even if the `yank-handler' property is set only on = STRING's first character. However, the way it actually behaves is that if you set the property on (sa= y) exactly the first character of STRING, then, assuming you rely on the im= plicit parameter passing, what gets passed to FUNCTION is a string consisti= ng of just the first character of STRING :-). Later, when you yank with C-= y, that's all you'll get. Now, this might be a reasonable behavior -- after all, if one wanted the en= tirety of STRING passed, then maybe one should set the property on all of S= TRING -- but it's not what's actually documented. Should I update the documentation to clarify? Or should the behavior chang= e instead? (By the way, I have not tested what happens if you set that property on mul= tiple disjoint extents of STRING. Does FUNCTION get passed a newly-created= concatenation of all the stretches of string that had the property? I hav= e no idea. If the recommendation here is just to fix the documentation, th= ough, then I'll do that testing.) Best regards, -Karl