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 22:01:40 +0800 [thread overview]
Message-ID: <9F68B9F5-2B25-48A5-9878-76483A274E48@qq.com> (raw)
In-Reply-To: <83poqoi6kl.fsf@gnu.org>
Sorry I wasn’t aware that a button can be just represented by a position.
I think insert-button, insert-text-button, push-button, forward-button and backward-button
do not need this change. Their names and documentations implies that.
diff --git a/lisp/button.el b/lisp/button.el
index cb08b78..b0a99d3 100644
--- a/lisp/button.el
+++ b/lisp/button.el
@@ -172,7 +172,8 @@ button-type-subtype-p
;; Button properties and other attributes
(defun button-start (button)
- "Return the position at which BUTTON starts."
+ "Return the position at which BUTTON starts.
+Only works when BUTTON is in the current buffer."
(if (overlayp button)
(overlay-start button)
;; Must be a text-property button.
@@ -180,7 +181,8 @@ button-start
(point-min))))
(defun button-end (button)
- "Return the position at which BUTTON ends."
+ "Return the position at which BUTTON ends.
+Only works when BUTTON is in the current buffer."
(if (overlayp button)
(overlay-end button)
;; Must be a text-property button.
@@ -188,7 +190,8 @@ button-end
(point-max))))
(defun button-get (button prop)
- "Get the property of button BUTTON named PROP."
+ "Get the property of button BUTTON named PROP.
+Only works when BUTTON is in the current buffer."
(cond ((overlayp button)
(overlay-get button prop))
((button--area-button-p button)
@@ -198,7 +201,8 @@ button-get
(get-text-property button prop))))
(defun button-put (button prop val)
- "Set BUTTON's PROP property to VAL."
+ "Set BUTTON's PROP property to VAL.
+Only works when BUTTON is in the current buffer."
;; Treat some properties specially.
(cond ((memq prop '(type :type))
;; We translate a `type' property a `category' property, since
@@ -233,7 +237,9 @@ button-activate
marker then goto it. Otherwise it it is a function then it is
called with BUTTON as only argument. BUTTON is either an
overlay, a buffer position, or (for buttons in the mode-line or
-header-line) a string."
+header-line) a string.
+
+Only works when BUTTON is in the current buffer."
(let ((action (or (and use-mouse-action (button-get button 'mouse-action))
(button-get button 'action))))
(if (markerp action)
@@ -244,7 +250,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)
d
> On Jul 8, 2016, at 9:48 PM, Eli Zaretskii <eliz@gnu.org> wrote:
>
>> From: Jiegec <jiegec@qq.com>
>> Date: Fri, 8 Jul 2016 18:36:42 +0800
>> Cc: 23909@debbugs.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.
>
> Are we talking about the same issue? I see these functions work on
> the current buffer without telling that in their doc strings:
>
> button-start, button-end, button-get, button-put, button-activate,
> insert-button, insert-text-button, push-button, forward-button, and
> backward-button
>
> Thanks.
>
>
>
>
next prev parent reply other threads:[~2016-07-08 14:01 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
2016-07-08 13:48 ` Eli Zaretskii
2016-07-08 14:01 ` Jiegec [this message]
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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=9F68B9F5-2B25-48A5-9878-76483A274E48@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 external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.