aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJiajie Chen2019-10-12 21:47:47 +0200
committerLars Ingebrigtsen2019-10-12 21:47:47 +0200
commit9eda79fc8c2b3e66ff6934ef0a8f2b747c27d245 (patch)
treedf348e06299d90c1b3b9ceacf99ee4f4f2bcc08d
parent3fcfa8071ac820c2a857b890de31ba5517d7249e (diff)
downloademacs-9eda79fc8c2b3e66ff6934ef0a8f2b747c27d245.tar.gz
emacs-9eda79fc8c2b3e66ff6934ef0a8f2b747c27d245.zip
button-* function doc string clarifications
* lisp/button.el (button-start, button-end, button-get) (button-put, button-label): Have the doc string mention that they have to be called from the current buffer (bug#23909). Copyright-paperwork-exempt: yes
-rw-r--r--lisp/button.el24
1 files changed, 18 insertions, 6 deletions
diff --git a/lisp/button.el b/lisp/button.el
index 04e77ca904f..ac6af0be4f8 100644
--- a/lisp/button.el
+++ b/lisp/button.el
@@ -169,7 +169,9 @@ changes to a supertype are not reflected in its subtypes)."
169;;; Button properties and other attributes 169;;; Button properties and other attributes
170 170
171(defun button-start (button) 171(defun button-start (button)
172 "Return the position at which BUTTON starts." 172 "Return the position at which BUTTON starts.
173
174This function only works when BUTTON is in the current buffer."
173 (if (overlayp button) 175 (if (overlayp button)
174 (overlay-start button) 176 (overlay-start button)
175 ;; Must be a text-property button. 177 ;; Must be a text-property button.
@@ -177,7 +179,9 @@ changes to a supertype are not reflected in its subtypes)."
177 (point-min)))) 179 (point-min))))
178 180
179(defun button-end (button) 181(defun button-end (button)
180 "Return the position at which BUTTON ends." 182 "Return the position at which BUTTON ends.
183
184This function only works when BUTTON is in the current buffer."
181 (if (overlayp button) 185 (if (overlayp button)
182 (overlay-end button) 186 (overlay-end button)
183 ;; Must be a text-property button. 187 ;; Must be a text-property button.
@@ -185,7 +189,9 @@ changes to a supertype are not reflected in its subtypes)."
185 (point-max)))) 189 (point-max))))
186 190
187(defun button-get (button prop) 191(defun button-get (button prop)
188 "Get the property of button BUTTON named PROP." 192 "Get the property of button BUTTON named PROP.
193
194This function only works when BUTTON is in the current buffer."
189 (cond ((overlayp button) 195 (cond ((overlayp button)
190 (overlay-get button prop)) 196 (overlay-get button prop))
191 ((button--area-button-p button) 197 ((button--area-button-p button)
@@ -197,7 +203,9 @@ changes to a supertype are not reflected in its subtypes)."
197 (get-text-property button prop)))) 203 (get-text-property button prop))))
198 204
199(defun button-put (button prop val) 205(defun button-put (button prop val)
200 "Set BUTTON's PROP property to VAL." 206 "Set BUTTON's PROP property to VAL.
207
208This function only works when BUTTON is in the current buffer."
201 ;; Treat some properties specially. 209 ;; Treat some properties specially.
202 (cond ((memq prop '(type :type)) 210 (cond ((memq prop '(type :type))
203 ;; We translate a `type' property to a `category' property, 211 ;; We translate a `type' property to a `category' property,
@@ -235,7 +243,9 @@ overlay, a buffer position, or (for buttons in the mode-line or
235header-line) a string. 243header-line) a string.
236 244
237If BUTTON has a `button-data' value, call the function with this 245If BUTTON has a `button-data' value, call the function with this
238value instad of BUTTON." 246value instad of BUTTON.
247
248This function only works when BUTTON is in the current buffer."
239 (let ((action (or (and use-mouse-action (button-get button 'mouse-action)) 249 (let ((action (or (and use-mouse-action (button-get button 'mouse-action))
240 (button-get button 'action))) 250 (button-get button 'action)))
241 (data (button-get button 'button-data))) 251 (data (button-get button 'button-data)))
@@ -247,7 +257,9 @@ value instad of BUTTON."
247 (funcall action (or data button))))) 257 (funcall action (or data button)))))
248 258
249(defun button-label (button) 259(defun button-label (button)
250 "Return BUTTON's text label." 260 "Return BUTTON's text label.
261
262This function only works when BUTTON is in the current buffer."
251 (if (button--area-button-p button) 263 (if (button--area-button-p button)
252 (substring-no-properties (button--area-button-string button)) 264 (substring-no-properties (button--area-button-string button))
253 (buffer-substring-no-properties (button-start button) 265 (buffer-substring-no-properties (button-start button)