From debbugs-submit-bounces@debbugs.gnu.org Sun Jun 19 14:27:15 2011 Received: (at submit) by debbugs.gnu.org; 19 Jun 2011 18:27:15 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1QYMiJ-0004SA-4t for submit@debbugs.gnu.org; Sun, 19 Jun 2011 14:27:15 -0400 Received: from eggs.gnu.org ([140.186.70.92]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1QYMiG-0004Ry-Fp for submit@debbugs.gnu.org; Sun, 19 Jun 2011 14:27:13 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QYMiA-0001ef-5b for submit@debbugs.gnu.org; Sun, 19 Jun 2011 14:27:07 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00,FREEMAIL_FROM, RCVD_IN_DNSWL_LOW,RFC_ABUSE_POST,T_DKIM_INVALID autolearn=unavailable version=3.3.1 Received: from lists.gnu.org ([140.186.70.17]:54243) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QYMi9-0001eb-UG for submit@debbugs.gnu.org; Sun, 19 Jun 2011 14:27:06 -0400 Received: from eggs.gnu.org ([140.186.70.92]:41074) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QYMi8-0001yS-KR for bug-gnu-emacs@gnu.org; Sun, 19 Jun 2011 14:27:05 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QYMi7-0001cP-2H for bug-gnu-emacs@gnu.org; Sun, 19 Jun 2011 14:27:04 -0400 Received: from mail-fx0-f52.google.com ([209.85.161.52]:32888) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QYMi6-0001cL-PP for bug-gnu-emacs@gnu.org; Sun, 19 Jun 2011 14:27:02 -0400 Received: by fxm6 with SMTP id 6so1640199fxm.39 for ; Sun, 19 Jun 2011 11:27:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:from:to:subject:date:message-id:mime-version :content-type; bh=bjoY29tIR+b9qdrODb+MyzqR5MSh5JOYSdpApNXWLQ8=; b=oEGiOqSxgBN+DRg44MmqaU2hFbgY0GwXEfufhJQa35FZJP480HvCvwU5WUu/YosOV6 ISCu9geee4XdkuOh3S3iBKaJAkHi4WSf5um+UmOBsGjAVU2Al6mb/WwN9EGTxwt6nBCe nBcfDPcfvMJPfHlVQG2yVmtr7/Mspoy5tcTuM= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=from:to:subject:date:message-id:mime-version:content-type; b=fevg/tQv9TCKVqQoD7beXUr90E6f4PVtx6pusoRiQdmSIa8wqht8+5aLpuKzyEYiy7 1KqOBAitg/6YkUN9zagkXLmKfn34UZ8ejFu89uEMn0pL4QWlR7Eu01YZwya8YfyvzhVV R87jfsHZybW1rK8s4sr3HzwSZ2M2tkZP05Qbs= Received: by 10.223.78.140 with SMTP id l12mr4924964fak.147.1308508021318; Sun, 19 Jun 2011 11:27:01 -0700 (PDT) Received: from localhost (176.119.broadband10.iol.cz [90.177.119.176]) by mx.google.com with ESMTPS id r10sm2379949fah.26.2011.06.19.11.26.59 (version=TLSv1/SSLv3 cipher=OTHER); Sun, 19 Jun 2011 11:27:00 -0700 (PDT) From: =?utf-8?B?xaB0xJtww6FuIE7Em21lYw==?= To: bug-gnu-emacs Subject: `completion--insert-strings' clobbers user-added text properties Date: Sun, 19 Jun 2011 20:22:54 +0200 Message-ID: <8739j5bs01.fsf@gmail.com> MIME-Version: 1.0 Content-Type: text/plain X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-Received-From: 140.186.70.17 X-Spam-Score: -4.7 (----) X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -4.7 (----) Tags: patch It is possible to bind `completion-annotate-function' to add custom annotations, which is great. Unfortunately, the `face' and `mouse-face' text properties added by such a function are then unconditionally overwritten by `completion--insert-strings'. In my particular case I define annotations as buttons (which display even more detail about a completion value upon activation), so a visual indication of clickability is very important for me. I wonder if something like the patch below, which fixes the problem for me, could be applied? diff --git a/lisp/minibuffer.el b/lisp/minibuffer.el index 284cbdc..11534e6 100644 --- a/lisp/minibuffer.el +++ b/lisp/minibuffer.el @@ -1003,9 +1003,12 @@ (defun completion--insert-strings (strings) 'mouse-face 'highlight) (put-text-property (point) (progn (insert (car str)) (point)) 'mouse-face 'highlight) - (add-text-properties (point) (progn (insert (cadr str)) (point)) - '(mouse-face nil - face completions-annotations))) + (let ((annotation (cadr str))) + (if (text-properties-at 1 annotation) + (insert annotation) + (add-text-properties (point) (progn (insert annotation) (point)) + '(mouse-face nil + face completions-annotations))))) (cond ((eq completions-format 'vertical) ;; Vertical format From debbugs-submit-bounces@debbugs.gnu.org Sun Jun 19 14:34:40 2011 Received: (at 8897) by debbugs.gnu.org; 19 Jun 2011 18:34:40 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1QYMpU-0005PH-I0 for submit@debbugs.gnu.org; Sun, 19 Jun 2011 14:34:40 -0400 Received: from fencepost.gnu.org ([140.186.70.10]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1QYMpT-0005P3-AY for 8897@debbugs.gnu.org; Sun, 19 Jun 2011 14:34:39 -0400 Received: from localhost ([127.0.0.1]:46774) by fencepost.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QYMpL-0008BB-Uu; Sun, 19 Jun 2011 14:34:32 -0400 From: Glenn Morris To: stepnem@gmail.com Subject: Re: bug#8897: `completion--insert-strings' clobbers user-added text properties References: <8739j5bs01.fsf@gmail.com> X-Spook: terrorism Glock Cocaine jihad Majic encryption MDA Steve X-Ran: ,AZCJfQ'5a1"Rz.pLcl=9YX'mDm3>`#ddTPhtT$;Cp&Q2ndb{{*7(LF|Fyqn]92l4ZN<\a X-Hue: white X-Debbugs-No-Ack: yes X-Attribution: GM Date: Sun, 19 Jun 2011 14:34:31 -0400 In-Reply-To: <8739j5bs01.fsf@gmail.com> (=?utf-8?B?IsWgdMSbcMOhbiBOxJtt?= =?utf-8?B?ZWMiJ3M=?= message of "Sun, 19 Jun 2011 20:22:54 +0200") Message-ID: <8i39j53c20.fsf@fencepost.gnu.org> User-Agent: Gnus (www.gnus.org), GNU Emacs (www.gnu.org/software/emacs/) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Spam-Score: -6.3 (------) X-Debbugs-Envelope-To: 8897 Cc: 8897@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -6.3 (------) > I wonder if something like the patch below, which fixes the problem for > me, could be applied? We cannot apply any (more) patches from you because you don't want to complete a copyright assignment. That's your prerogative of course, but given that, it is best if you do not send patches when you report issues. From debbugs-submit-bounces@debbugs.gnu.org Sun Jun 19 23:09:05 2011 Received: (at 8897) by debbugs.gnu.org; 20 Jun 2011 03:09:05 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1QYUrI-0000s5-8J for submit@debbugs.gnu.org; Sun, 19 Jun 2011 23:09:04 -0400 Received: from ironport2-out.teksavvy.com ([206.248.154.181] helo=ironport2-out.pppoe.ca) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1QYUrG-0000rb-5F for 8897@debbugs.gnu.org; Sun, 19 Jun 2011 23:09:02 -0400 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: Av0EAPm4/k1FpYrD/2dsb2JhbABSplp4iHO9WYYqBJ1ZhCI X-IronPort-AV: E=Sophos;i="4.65,391,1304308800"; d="scan'208";a="116644878" Received: from 69-165-138-195.dsl.teksavvy.com (HELO pastel.home) ([69.165.138.195]) by ironport2-out.pppoe.ca with ESMTP/TLS/ADH-AES256-SHA; 19 Jun 2011 23:08:56 -0400 Received: by pastel.home (Postfix, from userid 20848) id 79BEA58B27; Sun, 19 Jun 2011 23:08:55 -0400 (EDT) From: Stefan Monnier To: =?utf-8?B?xaB0xJtww6FuIE7Em21lYw==?= Subject: Re: bug#8897: `completion--insert-strings' clobbers user-added text properties Message-ID: References: <8739j5bs01.fsf@gmail.com> Date: Sun, 19 Jun 2011 23:08:55 -0400 In-Reply-To: <8739j5bs01.fsf@gmail.com> (=?utf-8?B?IsWgdMSbcMOhbiBOxJtt?= =?utf-8?B?ZWMiJ3M=?= message of "Sun, 19 Jun 2011 20:22:54 +0200") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -2.1 (--) X-Debbugs-Envelope-To: 8897 Cc: 8897@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -2.1 (--) > In my particular case I define annotations as buttons (which display > even more detail about a completion value upon activation), so a visual > indication of clickability is very important for me. Currently, the completion-list-mode uses the `mouse-face' text-property to determine what is a completion item and what i something else (blank space, annotation, you name it). So as it stands, any mouse-face you'd add to an annotation would confuse completion-list-mode into thinking it is a completion item. Maybe you could try to use the `category' text-property instead. Stefan From debbugs-submit-bounces@debbugs.gnu.org Mon Jun 20 04:11:57 2011 Received: (at 8897) by debbugs.gnu.org; 20 Jun 2011 08:11:57 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1QYZaO-0005yA-PP for submit@debbugs.gnu.org; Mon, 20 Jun 2011 04:11:57 -0400 Received: from mail-fx0-f44.google.com ([209.85.161.44]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1QYZaN-0005xw-Bc for 8897@debbugs.gnu.org; Mon, 20 Jun 2011 04:11:56 -0400 Received: by fxm15 with SMTP id 15so1001913fxm.3 for <8897@debbugs.gnu.org>; Mon, 20 Jun 2011 01:11:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:from:to:cc:subject:in-reply-to:references :user-agent:date:message-id:mime-version:content-type :content-transfer-encoding; bh=PX8+uNJWTlNW8mFP7iKmem2oj3iwc7uEeyV5nZQig/s=; b=etAwLlBphN3YCIS5dyQcuLefQWY0jHkIqn2umVwQjWlWnTRgz+MF4Oa/D0EGXzzeim s1QYK3aPX+U90iLJqut2bT8pyNXXqKSYuY5iDxq7AXts8BjeYWtI95AU3xUWj1jXMjhu AGfE5/OxfIBcjkYyGYELxKtTkRLVGlpQR4IJQ= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=from:to:cc:subject:in-reply-to:references:user-agent:date :message-id:mime-version:content-type:content-transfer-encoding; b=rbeWV1akSIYPVdRNzVSOHjuM/DdN4j1R3AK0k7gncURaa4Eu4Vlro3Gun3oSw7INjC 7i83FC7Y1qg71tgPMLUBad/xU9jiZ7hb6q0znMVn3HI530uoysIJeq+ZUZ9vjL78I6Sj TCzXOpoGlqgeVFBqpyFCCDRVsHEMHM+G90XrM= Received: by 10.223.16.136 with SMTP id o8mr4780247faa.21.1308557509286; Mon, 20 Jun 2011 01:11:49 -0700 (PDT) Received: from localhost (176.119.broadband10.iol.cz [90.177.119.176]) by mx.google.com with ESMTPS id m5sm2045399fai.25.2011.06.20.01.11.47 (version=TLSv1/SSLv3 cipher=OTHER); Mon, 20 Jun 2011 01:11:47 -0700 (PDT) From: =?utf-8?B?xaB0xJtww6FuIE7Em21lYw==?= To: Stefan Monnier Subject: Re: bug#8897: `completion--insert-strings' clobbers user-added text properties In-Reply-To: (Stefan Monnier's message of "Sun, 19 Jun 2011 23:08:55 -0400") References: <8739j5bs01.fsf@gmail.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (gnu/linux) Date: Mon, 20 Jun 2011 10:07:41 +0200 Message-ID: <87y60x9b8y.fsf@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: -3.6 (---) X-Debbugs-Envelope-To: 8897 Cc: 8897@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -3.6 (---) Stefan Monnier writes: >> In my particular case I define annotations as buttons (which display >> even more detail about a completion value upon activation), so a visual >> indication of clickability is very important for me. > > Currently, the completion-list-mode uses the `mouse-face' text-property > to determine what is a completion item and what i something else (blank > space, annotation, you name it). So as it stands, any mouse-face you'd > add to an annotation would confuse completion-list-mode into thinking it > is a completion item. > > Maybe you could try to use the `category' text-property instead. Well I do use the `category' property, but the button functions seem to set up the button face automatically, which is then clobbered by `completion--insert-strings' (which is the problem). Here's how I set up an annotation, `n' being the number of a pull request as a string (i.e., the completion value itself): #+begin_src elisp (let ((req (assoc-default n minibuffer-completion-table))) (concat " " (propertize (plist-get req :title) 'fontified t 'button '(t) 'category 'default-button 'help-echo "RET or mouse-2 for details" 'pr-data req 'action (lambda (b) (magithub-pull-request-details (button-get b 'pr-data)))))) #+end_src With my patch I haven't noticed any problems you mention -- clicking or RET on the completion itself selects it, clicking or RET on the annotation displays further details, the button face is preserved. =C5=A0t=C4=9Bp=C3=A1n From debbugs-submit-bounces@debbugs.gnu.org Mon Jun 20 10:01:36 2011 Received: (at 8897) by debbugs.gnu.org; 20 Jun 2011 14:01:36 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1QYf2l-0007CI-Kg for submit@debbugs.gnu.org; Mon, 20 Jun 2011 10:01:35 -0400 Received: from ironport2-out.teksavvy.com ([206.248.154.183] helo=ironport2-out.pppoe.ca) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1QYf2j-0007C5-CK for 8897@debbugs.gnu.org; Mon, 20 Jun 2011 10:01:34 -0400 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: Av0EAJRS/01FpYrD/2dsb2JhbABTplx4iHO+e4YqBJ1ZhCI X-IronPort-AV: E=Sophos;i="4.65,394,1304308800"; d="scan'208";a="116667414" Received: from 69-165-138-195.dsl.teksavvy.com (HELO pastel.home) ([69.165.138.195]) by ironport2-out.pppoe.ca with ESMTP/TLS/ADH-AES256-SHA; 20 Jun 2011 10:01:22 -0400 Received: by pastel.home (Postfix, from userid 20848) id 4F00759011; Mon, 20 Jun 2011 10:01:22 -0400 (EDT) From: Stefan Monnier To: =?utf-8?B?xaB0xJtww6FuIE7Em21lYw==?= Subject: Re: bug#8897: `completion--insert-strings' clobbers user-added text properties Message-ID: References: <8739j5bs01.fsf@gmail.com> <87y60x9b8y.fsf@gmail.com> Date: Mon, 20 Jun 2011 10:01:22 -0400 In-Reply-To: <87y60x9b8y.fsf@gmail.com> (=?utf-8?B?IsWgdMSbcMOhbiBOxJtt?= =?utf-8?B?ZWMiJ3M=?= message of "Mon, 20 Jun 2011 10:07:41 +0200") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -2.1 (--) X-Debbugs-Envelope-To: 8897 Cc: 8897@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -2.1 (--) >>> In my particular case I define annotations as buttons (which display >>> even more detail about a completion value upon activation), so a visual >>> indication of clickability is very important for me. >> Currently, the completion-list-mode uses the `mouse-face' text-property >> to determine what is a completion item and what i something else (blank >> space, annotation, you name it). So as it stands, any mouse-face you'd >> add to an annotation would confuse completion-list-mode into thinking it >> is a completion item. >> Maybe you could try to use the `category' text-property instead. > Well I do use the `category' property, but the button functions seem to > set up the button face automatically, which is then clobbered by > `completion--insert-strings' (which is the problem). Here's how I set up > an annotation, `n' being the number of a pull request as a string (i.e., > the completion value itself): > #+begin_src elisp > (let ((req (assoc-default n minibuffer-completion-table))) > (concat " " > (propertize (plist-get req :title) > 'fontified t > 'button '(t) > 'category 'default-button > 'help-echo "RET or mouse-2 for details" > 'pr-data req > 'action (lambda (b) (magithub-pull-request-details > (button-get b 'pr-data)))))) > #+end_src I must be missing something: where is a `face' or `mouse-face' property added? The above code should not be affected by your patch, AFAICT. And I don't understand your comment about "but the button functions seem to set up the button face automatically" since I don't see where you call a button function before insertion. > With my patch I haven't noticed any problems you mention -- clicking > or RET on the completion itself selects it, clicking or RET on the > annotation displays further details, the button face is preserved. I guess click&RET work OK because they're locally overridden, but if you run M-x choose-completion while on the button or if you hit `left' or `right' to skip from one completion to the next, you might see some problem (although not with the code quoted above which should not suffer from any of the problems discussed in this thread, AFAICT). Stefan From debbugs-submit-bounces@debbugs.gnu.org Mon Jun 20 10:26:19 2011 Received: (at 8897) by debbugs.gnu.org; 20 Jun 2011 14:26:19 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1QYfQh-00006E-7p for submit@debbugs.gnu.org; Mon, 20 Jun 2011 10:26:19 -0400 Received: from mail-bw0-f44.google.com ([209.85.214.44]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1QYfQe-000061-Fv for 8897@debbugs.gnu.org; Mon, 20 Jun 2011 10:26:17 -0400 Received: by bwz13 with SMTP id 13so3570685bwz.3 for <8897@debbugs.gnu.org>; Mon, 20 Jun 2011 07:26:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:from:to:cc:subject:in-reply-to:references :user-agent:date:message-id:mime-version:content-type :content-transfer-encoding; bh=6ON2BTFOuhe2XczJwOUaB4ipEMRJh7Dbr8TJrMilC9k=; b=fBb5EGhuvgWe4R5COq9yLRWq1i8jnGI0XRWOIk8ZThj2GUQqw3ix4fmp/9NWSslMMV pwd1S/VnSqeYOfsybj1biLe3bVV8EksEY9uTzW6PCoX0FTWI9uZC79uGiP691MCeuQym L5VaHEuI58qoxLSswhR+P9uHWkXpxPWERtCb8= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=from:to:cc:subject:in-reply-to:references:user-agent:date :message-id:mime-version:content-type:content-transfer-encoding; b=xfq2xmn4DuB2QciH+mSnMHA3PY1YafiZRBNpWhxCY0I/Juk1Qr5XVSq+1/O9jsqCxc hzVZltHbqU/UZSa1IkHzk8SjDk8BI84bOFU9fAwnIw68ahRoO4UXcOTr96GBZEEln0D8 ZakT6ukIzMia0kutL2kDyajylgq2OdrS4nUeI= Received: by 10.204.128.198 with SMTP id l6mr2252012bks.19.1308579970346; Mon, 20 Jun 2011 07:26:10 -0700 (PDT) Received: from localhost (176.119.broadband10.iol.cz. [90.177.119.176]) by mx.google.com with ESMTPS id a28sm1139319fak.1.2011.06.20.07.26.08 (version=TLSv1/SSLv3 cipher=OTHER); Mon, 20 Jun 2011 07:26:09 -0700 (PDT) From: =?utf-8?B?xaB0xJtww6FuIE7Em21lYw==?= To: Stefan Monnier Subject: Re: bug#8897: `completion--insert-strings' clobbers user-added text properties In-Reply-To: (Stefan Monnier's message of "Mon, 20 Jun 2011 10:01:22 -0400") References: <8739j5bs01.fsf@gmail.com> <87y60x9b8y.fsf@gmail.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (gnu/linux) Date: Mon, 20 Jun 2011 16:22:02 +0200 Message-ID: <87pqm8a8hh.fsf@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: -3.6 (---) X-Debbugs-Envelope-To: 8897 Cc: 8897@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -3.6 (---) Stefan Monnier writes: >> #+begin_src elisp >> (let ((req (assoc-default n minibuffer-completion-table))) >> (concat " " >> (propertize (plist-get req :title) >> 'fontified t >> 'button '(t) >> 'category 'default-button >> 'help-echo "RET or mouse-2 for details" >> 'pr-data req >> 'action (lambda (b) (magithub-pull-request-details >> (button-get b 'pr-data)))))) >> #+end_src > > I must be missing something: where is a `face' or `mouse-face' property > added? The above code should not be affected by your patch, AFAICT. > And I don't understand your comment about "but the button functions seem > to set up the button face automatically" since I don't see where you > call a button function before insertion. Sorry for my confusing description. What I meant is that there is apparently some magic involved that makes a string manufactured with a `propertize' form like the one above appear as if it had the button face (underlined), even though it's not explicitely among its text properties (maybe the `category' does it? I don't know). In any case, without my patch the face is overridden to become the usual annotation italic, so it _does_ suffer from the problem I describe. >> With my patch I haven't noticed any problems you mention -- clicking >> or RET on the completion itself selects it, clicking or RET on the >> annotation displays further details, the button face is preserved. > > I guess click&RET work OK because they're locally overridden, but if you > run M-x choose-completion while on the button or if you hit `left' or > `right' to skip from one completion to the next, you might see some > problem (although not with the code quoted above which should not > suffer from any of the problems discussed in this thread, AFAICT). Indeed. I don't use the cursor keys, but you're right in that they seem to include the button-like annotations among their jump targets; as for `choose-completion', that seems to be bound to RET in the *Completions* buffer, but as I said and in line with your guess, pressing RET on an annotation actually invokes the button action as desired, so this problem doesn't seem to occur. =C5=A0t=C4=9Bp=C3=A1n From debbugs-submit-bounces@debbugs.gnu.org Mon Jun 20 12:36:47 2011 Received: (at 8897) by debbugs.gnu.org; 20 Jun 2011 16:36:47 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1QYhSx-0001f2-5k for submit@debbugs.gnu.org; Mon, 20 Jun 2011 12:36:47 -0400 Received: from ironport2-out.teksavvy.com ([206.248.154.181] helo=ironport2-out.pppoe.ca) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1QYhSv-0001er-HH for 8897@debbugs.gnu.org; Mon, 20 Jun 2011 12:36:46 -0400 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: Av0EANt2/01FpYrD/2dsb2JhbABTpl94iHO/N4YqBJ1ZhCI X-IronPort-AV: E=Sophos;i="4.65,395,1304308800"; d="scan'208";a="116689314" Received: from 69-165-138-195.dsl.teksavvy.com (HELO pastel.home) ([69.165.138.195]) by ironport2-out.pppoe.ca with ESMTP/TLS/ADH-AES256-SHA; 20 Jun 2011 12:36:37 -0400 Received: by pastel.home (Postfix, from userid 20848) id 258AC59011; Mon, 20 Jun 2011 12:36:37 -0400 (EDT) From: Stefan Monnier To: =?utf-8?B?xaB0xJtww6FuIE7Em21lYw==?= Subject: Re: bug#8897: `completion--insert-strings' clobbers user-added text properties Message-ID: References: <8739j5bs01.fsf@gmail.com> <87y60x9b8y.fsf@gmail.com> <87pqm8a8hh.fsf@gmail.com> Date: Mon, 20 Jun 2011 12:36:37 -0400 In-Reply-To: <87pqm8a8hh.fsf@gmail.com> (=?utf-8?B?IsWgdMSbcMOhbiBOxJtt?= =?utf-8?B?ZWMiJ3M=?= message of "Mon, 20 Jun 2011 16:22:02 +0200") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -2.1 (--) X-Debbugs-Envelope-To: 8897 Cc: 8897@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -2.1 (--) >>> #+begin_src elisp >>> (let ((req (assoc-default n minibuffer-completion-table))) >>> (concat " " >>> (propertize (plist-get req :title) >>> 'fontified t >>> 'button '(t) >>> 'category 'default-button >>> 'help-echo "RET or mouse-2 for details" >>> 'pr-data req >>> 'action (lambda (b) (magithub-pull-request-details >>> (button-get b 'pr-data)))))) >>> #+end_src >> >> I must be missing something: where is a `face' or `mouse-face' property >> added? The above code should not be affected by your patch, AFAICT. >> And I don't understand your comment about "but the button functions seem >> to set up the button face automatically" since I don't see where you >> call a button function before insertion. > Sorry for my confusing description. What I meant is that there is > apparently some magic involved that makes a string manufactured with a > `propertize' form like the one above appear as if it had the button face > (underlined), even though it's not explicitely among its text properties > (maybe the `category' does it? I don't know). Yes, the `category' property is special and is "equivalent" to adding all the properties on the symbol used for the category (i.e. all the properties on the `default-button' symbol in your above example), which most likely includes `face' and/or `mouse-face' properties. > In any case, without my patch the face is overridden to become the usual > annotation italic, so it _does_ suffer from the problem I describe. Right, the `face' text-property takes precedence over the `face' property provided by the `category' text property. Hmm... > Indeed. I don't use the cursor keys, but you're right in that they seem > to include the button-like annotations among their jump targets; as for > `choose-completion', that seems to be bound to RET in the *Completions* > buffer, but as I said and in line with your guess, pressing RET on an > annotation actually invokes the button action as desired, so this > problem doesn't seem to occur. Yes, when point is on the button, RET (and mouse clicks) does not call choose-completion but the button command instead. But if you have bound choose-completion to some other keys that are not overridden by the button, you'll see the problem (or if you do M-x choose-completion). Stefan From debbugs-submit-bounces@debbugs.gnu.org Mon Sep 14 08:25:20 2020 Received: (at 8897) by debbugs.gnu.org; 14 Sep 2020 12:25:20 +0000 Received: from localhost ([127.0.0.1]:52962 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kHnXs-0005Z6-67 for submit@debbugs.gnu.org; Mon, 14 Sep 2020 08:25:20 -0400 Received: from quimby.gnus.org ([95.216.78.240]:58200) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kHnXo-0005Yn-Ij for 8897@debbugs.gnu.org; Mon, 14 Sep 2020 08:25:18 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnus.org; s=20200322; h=Content-Transfer-Encoding:Content-Type:MIME-Version:Message-ID :In-Reply-To:Date:References:Subject:Cc:To:From:Sender:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=B4weKqJ8fgNK8vMz3Wnoz/rNF75/aXpUwcTEcyX0d2o=; b=odkt7X+Y1ekEvTQfGj+jCF6wkg YVCOeE//BQdty76iWRRO/BWsw4C1aCvy0uUrxFJYr1TqEeLDLa7gx0eYLZkhaCsyTysHn5KBKuefJ jR3d3fdUxKkcFFoWh68tn2MTGITvC/jpDTpIM5K11Up0676qcvuxhyZK7oGbagu3Rmak=; Received: from cm-84.212.202.86.getinternet.no ([84.212.202.86] helo=xo) by quimby with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kHnXb-0001JK-M9; Mon, 14 Sep 2020 14:25:10 +0200 From: Lars Ingebrigtsen To: =?utf-8?B?xaB0xJtww6FuIE7Em21lYw==?= Subject: Re: bug#8897: `completion--insert-strings' clobbers user-added text properties References: <8739j5bs01.fsf@gmail.com> X-Now-Playing: Cosey Fanni Tutti's _Tutti_: "Drone" Date: Mon, 14 Sep 2020 14:25:02 +0200 In-Reply-To: <8739j5bs01.fsf@gmail.com> (=?utf-8?B?IsWgdMSbcMOhbiBOxJtt?= =?utf-8?B?ZWMiJ3M=?= message of "Sun, 19 Jun 2011 20:22:54 +0200") Message-ID: <87wo0wbl5t.fsf@gnus.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Report: Spam detection software, running on the system "quimby.gnus.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see @@CONTACT_ADDRESS@@ for details. Content preview: Štěpán Němec writes: > It is possible to bind `completion-annotate-function' to add custom > annotations, which is great. Unfortunately, the `face' and `mouse-face' > text properties added by such a function are then unco [...] Content analysis details: (-2.9 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -1.0 ALL_TRUSTED Passed through trusted hosts only via SMTP -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 8897 Cc: 8897@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) =C5=A0t=C4=9Bp=C3=A1n N=C4=9Bmec writes: > It is possible to bind `completion-annotate-function' to add custom > annotations, which is great. Unfortunately, the `face' and `mouse-face' > text properties added by such a function are then unconditionally > overwritten by `completion--insert-strings'. > > In my particular case I define annotations as buttons (which display > even more detail about a completion value upon activation), so a visual > indication of clickability is very important for me. > > I wonder if something like the patch below, which fixes the problem for > me, could be applied? In conjunction with bug#43218, completion no longer clobbers all text properties (but it does clobber the face text property). So it still requires some wrangling by the caller if the text property was the one they wanted to have preserved, but the caller can stash that in a different text property. This requires that `minibuffer-allow-text-properties' is non-nil. So I think that basically takes care of the problem described here, and I'm closing this bug report.=20=20 --=20 (domestic pets only, the antidote for overdose, milk.) bloggy blog: http://lars.ingebrigtsen.no From debbugs-submit-bounces@debbugs.gnu.org Mon Sep 14 08:25:23 2020 Received: (at control) by debbugs.gnu.org; 14 Sep 2020 12:25:23 +0000 Received: from localhost ([127.0.0.1]:52965 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kHnXv-0005ZM-Dw for submit@debbugs.gnu.org; Mon, 14 Sep 2020 08:25:23 -0400 Received: from quimby.gnus.org ([95.216.78.240]:58214) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kHnXt-0005Yv-Re for control@debbugs.gnu.org; Mon, 14 Sep 2020 08:25:22 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnus.org; s=20200322; h=Subject:From:To:Message-Id:Date:Sender:Reply-To:Cc: MIME-Version:Content-Type:Content-Transfer-Encoding:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=GN+w/GC6ojBHZq+MvGifubY5G1TfvUwie213ehoWLQQ=; b=udVbmNB2XSJ04F7kOpk8cr0fVb xQ3xgHxOYQYYUCnAhiFklE58WCJoFLu9/3QHgqfvKGn+8uvuT/A9CAUBOBacwn5tawgRWwSwGK/da g/hbR+cupCFm4puFtHBJYb1isGUIj24g8/pjV25VqgECIP4UzA+eN8dhgQFSRwpu92xg=; Received: from cm-84.212.202.86.getinternet.no ([84.212.202.86] helo=xo) by quimby with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kHnXm-0001JX-45 for control@debbugs.gnu.org; Mon, 14 Sep 2020 14:25:16 +0200 Date: Mon, 14 Sep 2020 14:25:12 +0200 Message-Id: <87v9ggbl5j.fsf@gnus.org> To: control@debbugs.gnu.org From: Lars Ingebrigtsen Subject: control message for bug #8897 X-Spam-Report: Spam detection software, running on the system "quimby.gnus.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see @@CONTACT_ADDRESS@@ for details. Content preview: tags 8897 fixed close 8897 28.1 quit Content analysis details: (-2.9 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -1.0 ALL_TRUSTED Passed through trusted hosts only via SMTP -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: control X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) tags 8897 fixed close 8897 28.1 quit From unknown Thu Jul 10 15:12:05 2025 Received: (at fakecontrol) by fakecontrolmessage; To: internal_control@debbugs.gnu.org From: Debbugs Internal Request Subject: Internal Control Message-Id: bug archived. Date: Tue, 13 Oct 2020 11:24:09 +0000 User-Agent: Fakemail v42.6.9 # This is a fake control message. # # The action: # bug archived. thanks # This fakemail brought to you by your local debbugs # administrator