unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Jiegec <jiegec@qq.com>
To: Eli Zaretskii <eliz@gnu.org>
Cc: 23909@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	[thread overview]
Message-ID: <839DE945-E926-4774-8F30-CE7DE6B66C9F@qq.com> (raw)
In-Reply-To: <838txdlbdp.fsf@gnu.org>

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@gnu.org> wrote:
> 
>> From: Jiajie Chen <jiegec@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.
> 
> 
> 
> 








  reply	other threads:[~2016-07-08 10:36 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-07-07 10:19 bug#23909: 25.1.50; `button-label' must be called in the buffer where the button is in but not mentioned in document Jiajie Chen
2016-07-07 15:24 ` Eli Zaretskii
2016-07-08 10:36   ` Jiegec [this message]
2016-07-08 13:48     ` Eli Zaretskii
2016-07-08 14:01       ` Jiegec
2016-07-09 10:25         ` Eli Zaretskii
2019-10-12 19:48         ` Lars Ingebrigtsen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=839DE945-E926-4774-8F30-CE7DE6B66C9F@qq.com \
    --to=jiegec@qq.com \
    --cc=23909@debbugs.gnu.org \
    --cc=eliz@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).