GNU bug report logs - #23909
25.1.50; `button-label' must be called in the buffer where the button is in but not mentioned in document

Previous Next

Package: emacs;

Reported by: Jiajie Chen <jiegec <at> qq.com>

Date: Thu, 7 Jul 2016 10:21:02 UTC

Severity: minor

Tags: fixed

Found in version 25.1.50

Fixed in version 27.1

Done: Lars Ingebrigtsen <larsi <at> gnus.org>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Jiegec <jiegec <at> qq.com>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 23909 <at> debbugs.gnu.org
Subject: bug#23909: 25.1.50; `button-label' must be called in the buffer where the button is in but not mentioned in document
Date: Fri, 8 Jul 2016 18:36:42 +0800
I have gone through button.el and found only `button-label’ needs
this change. If I have left out some, please add those as well.

This change should be small enough and I needn’t sign.


diff --git a/lisp/button.el b/lisp/button.el
index cb08b78..62a2d0f 100644
--- a/lisp/button.el
+++ b/lisp/button.el
@@ -244,7 +244,8 @@ button-activate
       (funcall action button))))

 (defun button-label (button)
-  "Return BUTTON's text label."
+  "Return BUTTON's text label.
+Only works when BUTTON is in the current buffer."
   (if (button--area-button-p button)
       (substring-no-properties (button--area-button-string button))
     (buffer-substring-no-properties (button-start button)

> On Jul 7, 2016, at 11:24 PM, Eli Zaretskii <eliz <at> gnu.org> wrote:
> 
>> From: Jiajie Chen <jiegec <at> qq.com>
>> Date: Thu, 07 Jul 2016 18:19:11 +0800
>> 
>> The definition of button-label is:
>> 
>> #+BEGIN_SRC elisp
>> (defun button-label (button)
>>  "Return BUTTON's text label."
>>  (if (button--area-button-p button)
>>      (substring-no-properties (button--area-button-string button))
>>    (buffer-substring-no-properties (button-start button)
>>                                    (button-end button))))
>> #+END_SRC
>> 
>> So when the function is called in a different buffer, it
>> returns a wrong result.
> 
> AFAICT, all of the functions in button.el operate on buttons in the
> current buffer, although only a few mention that explicitly in their
> doc strings.  Patches to mention that in the doc strings are welcome.
> 
> Thanks.
> 
> 
> 
> 







This bug report was last modified 5 years and 223 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.