From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Gregory Heytings Newsgroups: gmane.emacs.devel Subject: Re: Reading text properties from a yanked text Date: Sat, 26 Nov 2022 23:26:07 +0000 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii; format=flowed Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="31326"; mail-complaints-to="usenet@ciao.gmane.io" Cc: emacs-devel@gnu.org To: "Nicolas P. Rougier (inria)" Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Sun Nov 27 00:27:16 2022 Return-path: Envelope-to: ged-emacs-devel@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1oz4Zn-0007vt-3C for ged-emacs-devel@m.gmane-mx.org; Sun, 27 Nov 2022 00:27:15 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oz4Yo-00055E-QH; Sat, 26 Nov 2022 18:26:14 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oz4Yn-000555-5u for emacs-devel@gnu.org; Sat, 26 Nov 2022 18:26:13 -0500 Original-Received: from heytings.org ([95.142.160.155]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oz4Yl-0005Hj-DH for emacs-devel@gnu.org; Sat, 26 Nov 2022 18:26:12 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=heytings.org; s=20220101; t=1669505168; bh=MCb+tueD4dLHuX5eC9hZ3D2nfxkOr35C96cIe2xpKzQ=; h=Date:From:To:cc:Subject:In-Reply-To:Message-ID:References:From; b=hqltUv2RbN99gW01v4hWO3S8sECZX+Ql8d9KSqViaTM7EBg/7u7NzD1JJsEtgqy6t PYePNf3/SpvJ4kQ1isWnjF63V06cAhm9GGUvYG2UQTaJfYWK2nQ5adqI7oLva6zBhx rs1q6V1i7gvEv/s2qKL3HeJ92qFcvJ++HNquOffLcNsceHLnyr69hG6H+mKXSjErNC 7FeqbSkzHgsdYqhVQzr3Kf6Vf8HFJ6DwWaP1UXZX75PVhWQ4MZuiQ2AXvbEoL3UjzL zwq1WegxmLTAItgRP04ovXglSBn1JNPgyGiDreHyBplZqbpMiQ+v8nYJkYvIK4aeqt tpfQKZqk9dNHw== In-Reply-To: Received-SPF: pass client-ip=95.142.160.155; envelope-from=gregory@heytings.org; helo=heytings.org X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.29 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-mx.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.devel:300602 Archived-At: > > 1. I evaluate the line below to get a bold "Hello" and I copy the result > in the kill ring. > > (insert (propertize "Hello" 'face 'bold)) > > 2. If I try to get the properties of the yanked text, I get nil. > However, the text is displayed bold and a (text-properties-at (point)) > returns '(face bold) when point is on the H letter. > > (text-properties-at 0 "Hello") > > 3. This version works as expected (but this is not what I need): > (text-properties-at 0 (propertize "Hello" 'face 'bold)) > > Why do I get a nil result in case 2 (using Emacs 28.2) even though the > text is displayed bold? > I think I see what you mean (but I'm not sure). Is your recipe the following one? emacs -Q M-x text-mode RET M-: (insert (propertize "Hello" 'face 'bold)) RET C-SPC M-b M-w M-: (text-properties-at 0 "") RET in which you see the text in bold in the minibuffer before pressing RET? (Instead of M-: you could also type (text-properties-at 0 "") followed by C-x C-e somewhere else.)