From debbugs-submit-bounces@debbugs.gnu.org Sun Jun 19 16:26:21 2011 Received: (at submit) by debbugs.gnu.org; 19 Jun 2011 20:26:21 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1QYOZY-0004xN-Ma for submit@debbugs.gnu.org; Sun, 19 Jun 2011 16:26:21 -0400 Received: from mail-bw0-f44.google.com ([209.85.214.44]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1QYOZX-0004xB-2u for submit@debbugs.gnu.org; Sun, 19 Jun 2011 16:26:19 -0400 Received: by bwz13 with SMTP id 13so3092450bwz.3 for ; Sun, 19 Jun 2011 13:26:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:from:to:subject:user-agent:date:message-id :mime-version:content-type; bh=T4ZaCtPKFWim0Vq8uEclQ4d09Wu5FdTiuY1BvqxfEoE=; b=ioRGqfhM5H9T3U46Ifox6lLTd0zxywYGfge4+GDcT6ziOOQIyRICAiuEbgqcmDfuIt IH1XqyicDs4XbuxI9L67rfDa7Pf4r+k0XYhuAB3KjP5eFhxud0rNl/owT6YFXPT9qbUB bzIdInvy+GbK8S4vEB/WMcxiK+unScg0vDGWM= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=from:to:subject:user-agent:date:message-id:mime-version :content-type; b=bwd2+VrIiEhzoX9IWjCPaPkmPdrbT/z5800/kz4psFsYyp3t3zuLmSKoSqSJPbpADO EepJao6HGwU65tIQRtWjXgl9nldZRdgTaBSk7Py0P1q3az38hiz3f/hOrl0yJgJYOWwv ZMTTeNMXB6P8Smk0Jm7v6k2h/c1xO2cXMCKsQ= Received: by 10.204.7.91 with SMTP id c27mr1872958bkc.67.1308515173121; Sun, 19 Jun 2011 13:26:13 -0700 (PDT) Received: from localhost ([91.144.186.21]) by mx.google.com with ESMTPS id x6sm3840268bkv.0.2011.06.19.13.26.11 (version=TLSv1/SSLv3 cipher=OTHER); Sun, 19 Jun 2011 13:26:12 -0700 (PDT) From: Dmitry Kurochkin To: submit@debbugs.gnu.org Subject: add a function to change button label User-Agent: Notmuch/0.5-237-gf6d8cdb (http://notmuchmail.org) Emacs/23.3.1 (x86_64-pc-linux-gnu) Date: Mon, 20 Jun 2011 00:26:43 +0400 Message-ID: <87aadd5zzw.fsf@gmail.com> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Spam-Score: -3.5 (---) 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: -3.5 (---) --=-=-= Package: emacs Version: 24.0.50 Tags: patch In some cases it is very useful to change button text label. Please consider applying the attached patch that implements `button-set-label' function to change button label. Regards, Dmitry --=-=-= Content-Type: text/x-diff Content-Disposition: inline; filename=button-set-label.patch Add `button-set-label' function to change button label. === modified file 'doc/lispref/display.texi' --- doc/lispref/display.texi 2011-05-29 22:41:06 +0000 +++ doc/lispref/display.texi 2011-06-19 20:04:46 +0000 @@ -5046,40 +5046,44 @@ Return the position at which @var{button @defun button-get button prop Get the property of button @var{button} named @var{prop}. @end defun @defun button-put button prop val Set @var{button}'s @var{prop} property to @var{val}. @end defun @defun button-activate button &optional use-mouse-action Call @var{button}'s @code{action} property (i.e., invoke it). If @var{use-mouse-action} is non-@code{nil}, try to invoke the button's @code{mouse-action} property instead of @code{action}; if the button has no @code{mouse-action} property, use @code{action} as normal. @end defun @defun button-label button Return @var{button}'s text label. @end defun +@defun button-set-label button label +Change @var{button}'s text label to @var{label}. +@end defun + @defun button-type button Return @var{button}'s button-type. @end defun @defun button-has-type-p button type Return @code{t} if @var{button} has button-type @var{type}, or one of @var{type}'s subtypes. @end defun @defun button-at pos Return the button at position @var{pos} in the current buffer, or @code{nil}. @end defun @defun button-type-put type prop val Set the button-type @var{type}'s @var{prop} property to @var{val}. @end defun @defun button-type-get type prop Get the property of button-type @var{type} named @var{prop}. @end defun === modified file 'lisp/button.el' --- lisp/button.el 2011-01-25 04:08:28 +0000 +++ lisp/button.el 2011-06-19 20:08:33 +0000 @@ -216,40 +216,52 @@ changes to a supertype are not reflected prop val))) (defsubst button-activate (button &optional use-mouse-action) "Call BUTTON's action property. If USE-MOUSE-ACTION is non-nil, invoke the button's mouse-action instead of its normal action; if the button has no mouse-action, the normal action is used instead." (let ((action (or (and use-mouse-action (button-get button 'mouse-action)) (button-get button 'action)))) (if (markerp action) (save-selected-window (select-window (display-buffer (marker-buffer action))) (goto-char action) (recenter 0)) (funcall action button)))) (defun button-label (button) "Return BUTTON's text label." (buffer-substring-no-properties (button-start button) (button-end button))) +(defun button-set-label (button label) + "Change BUTTON's text label to LABEL." + (save-excursion + (let ((old-start (button-start button)) + (old-end (button-end button))) + (goto-char old-end) + (insert label) + (if (overlayp button) + (move-overlay button old-end (point)) + (add-text-properties old-end (point) (text-properties-at button))) + (delete-region old-start old-end)))) + (defsubst button-type (button) "Return BUTTON's button-type." (button-get button 'type)) (defun button-has-type-p (button type) "Return t if BUTTON has button-type TYPE, or one of TYPE's subtypes." (button-type-subtype-p (button-get button 'type) type)) ;; Creating overlay buttons (defun make-button (beg end &rest properties) "Make a button from BEG to END in the current buffer. The remaining arguments form a sequence of PROPERTY VALUE pairs, specifying properties to add to the button. In addition, the keyword argument :type may be used to specify a button-type from which to inherit other properties; see `define-button-type'. Also see `make-text-button', `insert-button'." --=-=-=-- From debbugs-submit-bounces@debbugs.gnu.org Tue Apr 10 19:52:19 2012 Received: (at 8898) by debbugs.gnu.org; 10 Apr 2012 23:52:19 +0000 Received: from localhost ([127.0.0.1]:49579 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1SHkrC-0006jb-Jl for submit@debbugs.gnu.org; Tue, 10 Apr 2012 19:52:18 -0400 Received: from hermes.netfonds.no ([80.91.224.195]:35852) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1SHkr9-0006jT-G0 for 8898@debbugs.gnu.org; Tue, 10 Apr 2012 19:52:16 -0400 Received: from cm-84.215.51.58.getinternet.no ([84.215.51.58] helo=stories.gnus.org) by hermes.netfonds.no with esmtpsa (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16) (Exim 4.72) (envelope-from ) id 1SHkq1-0002il-J4; Wed, 11 Apr 2012 01:51:05 +0200 From: Lars Magne Ingebrigtsen To: Dmitry Kurochkin Subject: Re: bug#8898: add a function to change button label References: <87aadd5zzw.fsf@gmail.com> X-Now-Playing: Lichens's _Time & Light (version)_: "(untitled)" Date: Wed, 11 Apr 2012 01:51:05 +0200 In-Reply-To: <87aadd5zzw.fsf@gmail.com> (Dmitry Kurochkin's message of "Mon, 20 Jun 2011 00:26:43 +0400") Message-ID: User-Agent: Gnus/5.130004 (Ma Gnus v0.4) Emacs/24.1.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-MailScanner-ID: 1SHkq1-0002il-J4 X-Netfonds-MailScanner: Found to be clean X-Netfonds-MailScanner-From: larsi@gnus.org MailScanner-NULL-Check: 1334706665.82842@meiaTFvqdsMAWHqWncVtfw X-Spam-Status: No X-Spam-Score: -1.9 (-) X-Debbugs-Envelope-To: 8898 Cc: 8898@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 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: -1.9 (-) Dmitry Kurochkin writes: > In some cases it is very useful to change button text label. Please > consider applying the attached patch that implements `button-set-label' > function to change button label. Looks good to me. A patch of this size requires signing FSF copyright papers. Do you have such paperwork on file, and if not, would you be willing to sign such paperwork? -- (domestic pets only, the antidote for overdose, milk.) bloggy blog http://lars.ingebrigtsen.no/ From debbugs-submit-bounces@debbugs.gnu.org Thu Feb 25 01:45:49 2016 Received: (at control) by debbugs.gnu.org; 25 Feb 2016 06:45:49 +0000 Received: from localhost ([127.0.0.1]:44644 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84) (envelope-from ) id 1aYpgK-0001vg-UA for submit@debbugs.gnu.org; Thu, 25 Feb 2016 01:45:49 -0500 Received: from hermes.netfonds.no ([80.91.224.195]:40873) by debbugs.gnu.org with esmtp (Exim 4.84) (envelope-from ) id 1aYpgJ-0001u8-PF for control@debbugs.gnu.org; Thu, 25 Feb 2016 01:45:48 -0500 Received: from [175.103.25.178] (helo=mouse) by hermes.netfonds.no with esmtpsa (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.72) (envelope-from ) id 1aYpfv-0005Ek-Va for control@debbugs.gnu.org; Thu, 25 Feb 2016 07:45:24 +0100 Date: Thu, 25 Feb 2016 17:15:19 +1030 Message-Id: <87vb5duw3k.fsf@gnus.org> To: control@debbugs.gnu.org From: Lars Ingebrigtsen Subject: control message for bug #8898 X-MailScanner-ID: 1aYpfv-0005Ek-Va X-Netfonds-MailScanner: Found to be clean X-Netfonds-MailScanner-From: larsi@gnus.org MailScanner-NULL-Check: 1456987525.42731@2nDfLip64CwtRH8M6o6sSg X-Spam-Status: No 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: 0.0 (/) tags 8898 wontfix close 8898 From unknown Thu Jul 10 19:39:32 2025 Received: (at fakecontrol) by fakecontrolmessage; To: internal_control@debbugs.gnu.org From: Debbugs Internal Request Subject: Internal Control Message-Id: bug archived. Date: Thu, 24 Mar 2016 11:24:05 +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