From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Jiegec Newsgroups: gmane.emacs.bugs 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 Message-ID: <9F68B9F5-2B25-48A5-9878-76483A274E48@qq.com> References: <838txdlbdp.fsf@gnu.org> <839DE945-E926-4774-8F30-CE7DE6B66C9F@qq.com> <83poqoi6kl.fsf@gnu.org> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 (Mac OS X Mail 9.3 \(3124\)) Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Trace: ger.gmane.org 1467986616 26040 80.91.229.3 (8 Jul 2016 14:03:36 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 8 Jul 2016 14:03:36 +0000 (UTC) Cc: 23909@debbugs.gnu.org To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Fri Jul 08 16:03:28 2016 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1bLWNJ-00075n-HA for geb-bug-gnu-emacs@m.gmane.org; Fri, 08 Jul 2016 16:03:25 +0200 Original-Received: from localhost ([::1]:45776 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bLWNI-0007Cs-BH for geb-bug-gnu-emacs@m.gmane.org; Fri, 08 Jul 2016 10:03:24 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:45776) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bLWN3-00079Z-HI for bug-gnu-emacs@gnu.org; Fri, 08 Jul 2016 10:03:14 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bLWMw-0005lA-M9 for bug-gnu-emacs@gnu.org; Fri, 08 Jul 2016 10:03:08 -0400 Original-Received: from debbugs.gnu.org ([208.118.235.43]:58692) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bLWMw-0005l6-J4 for bug-gnu-emacs@gnu.org; Fri, 08 Jul 2016 10:03:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1bLWMw-0002dH-60 for bug-gnu-emacs@gnu.org; Fri, 08 Jul 2016 10:03:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Jiegec Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 08 Jul 2016 14:03:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 23909 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 23909-submit@debbugs.gnu.org id=B23909.146798652710014 (code B ref 23909); Fri, 08 Jul 2016 14:03:02 +0000 Original-Received: (at 23909) by debbugs.gnu.org; 8 Jul 2016 14:02:07 +0000 Original-Received: from localhost ([127.0.0.1]:42793 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bLWM2-0002bR-Sr for submit@debbugs.gnu.org; Fri, 08 Jul 2016 10:02:07 -0400 Original-Received: from smtpbg202.qq.com ([184.105.206.29]:48254) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bLWLy-0002Wz-Te for 23909@debbugs.gnu.org; Fri, 08 Jul 2016 10:02:05 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=qq.com; s=s201512; t=1467986503; bh=rtjGlel9mmQhGf/7SZyuS446Cn087dRQQsxmIEIkhW0=; h=Content-Type:Mime-Version:Subject:From:In-Reply-To:Date:Cc:Content-Transfer-Encoding:Message-Id:References:To; b=XhLs5tviaEWQk03X66gbpbPj366dK/wY+J2TsGGSCQ/yTlygXogOqpNlz27OQSbNV bsoJD3WV+R9XZQwm4CfqMmmGwiq2FrvR3OwwTmeKly9mPsK+yusUrvGtSVWrtFrl3E 4BMA8cJGo9luKaov3WASuXOylVZjI3aegM3vVFuc= X-QQ-mid: esmtp27t1467986501t010t09804 Original-Received: from [192.168.0.162] (unknown [14.20.7.110]) by esmtp4.qq.com (ESMTP) with id ; Fri, 08 Jul 2016 22:01:40 +0800 (CST) X-QQ-SSF: 0000000000000050F31000000000000 X-QQ-FEAT: jLTfbrzLdoOb4mCkaQsL+5HJ4Fmuvv/0sEzsoHTZeAzmUz8+T4ByQBhLhyhAn f6gCvZ0dbW/1ha/tSImiHOWpX8PexZ9cFjVc6cYRfeR+aLCJY+YPASsxvke+ss5lt7md3Sp sUcvOzuO+PaP7PQjR+nhbz00OlNxtBXyeK2TvJe1qc2mniRCeBnBtXR+fPKGcXC+CfzZBeY nS5LjZeiba7O8UVSiXrU+znGubDUTw+wcfBZG+i0r/aF2eVSZPAOt X-QQ-GoodBg: 0 In-Reply-To: <83poqoi6kl.fsf@gnu.org> X-Mailer: Apple Mail (2.3124) X-QQ-SENDSIZE: 520 X-QQ-Bgrelay: 1 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 208.118.235.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.org gmane.emacs.bugs:120627 Archived-At: Sorry I wasn=E2=80=99t 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=20 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 wrote: >=20 >> From: Jiegec >> Date: Fri, 8 Jul 2016 18:36:42 +0800 >> Cc: 23909@debbugs.gnu.org >>=20 >> I have gone through button.el and found only `button-label=E2=80=99 = needs >> this change. If I have left out some, please add those as well. >=20 > Are we talking about the same issue? I see these functions work on > the current buffer without telling that in their doc strings: >=20 > button-start, button-end, button-get, button-put, button-activate, > insert-button, insert-text-button, push-button, forward-button, and > backward-button >=20 > Thanks. >=20 >=20 >=20 >=20