summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefan Monnier <monnier@iro.umontreal.ca>2008-06-10 14:17:32 +0000
committerStefan Monnier <monnier@iro.umontreal.ca>2008-06-10 14:17:32 +0000
commit12b139e9a83173b9461e22cc908721b2b3a04245 (patch)
tree7bfe5042a73efdc5edb53911491b39970a9fc6c2
parentd948c431417f122f6892c1f739c5036d35edcd4a (diff)
downloademacs-12b139e9a83173b9461e22cc908721b2b3a04245.tar.gz
(make-text-button): Allow `start' to be a string.
-rw-r--r--lisp/ChangeLog8
-rw-r--r--lisp/button.el26
2 files changed, 22 insertions, 12 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 43b27becfb9..a2a80e919fe 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,7 @@
+2008-06-10 Stefan Monnier <monnier@iro.umontreal.ca>
+
+ * button.el (make-text-button): Allow `start' to be a string.
+
2008-06-10 Juanma Barranquero <lekktu@gmail.com>
* emacs-lisp/autoload.el (autoload-rubric):
@@ -13,8 +17,8 @@
* subr.el (locate-library): Doc fix.
* net/newsticker-treeview.el (w3m-toggle-inline-images): Declare.
- (newsticker-treeview-tool-bar-map, newsticker-treeview-mode): Check
- tool-bar-map is bound, for non-X builds.
+ (newsticker-treeview-tool-bar-map, newsticker-treeview-mode):
+ Check tool-bar-map is bound, for non-X builds.
* net/newsticker-reader.el (newsticker--next-item-image)
(newsticker--previous-item-image, newsticker--previous-feed-image)
diff --git a/lisp/button.el b/lisp/button.el
index 1be68acbc87..6a558af445a 100644
--- a/lisp/button.el
+++ b/lisp/button.el
@@ -293,10 +293,15 @@ part of the text instead of being a property of the buffer. Creating
large numbers of buttons can also be somewhat faster using
`make-text-button'.
+BEG can also be a string, in which case it is made into a button.
+
Also see `insert-text-button'."
- (let ((type-entry
+ (let ((object nil)
+ (type-entry
(or (plist-member properties 'type)
(plist-member properties :type))))
+ (when (stringp beg)
+ (setq object beg beg 0 end (length object)))
;; Disallow setting the `category' property directly.
(when (plist-get properties 'category)
(error "Button `category' property may not be set directly"))
@@ -308,15 +313,16 @@ Also see `insert-text-button'."
;; text-properties for inheritance.
(setcar type-entry 'category)
(setcar (cdr type-entry)
- (button-category-symbol (car (cdr type-entry))))))
- ;; Now add all the text properties at once
- (add-text-properties beg end
- ;; Each button should have a non-eq `button'
- ;; property so that next-single-property-change can
- ;; detect boundaries reliably.
- (cons 'button (cons (list t) properties)))
- ;; Return something that can be used to get at the button.
- beg)
+ (button-category-symbol (car (cdr type-entry)))))
+ ;; Now add all the text properties at once
+ (add-text-properties beg end
+ ;; Each button should have a non-eq `button'
+ ;; property so that next-single-property-change can
+ ;; detect boundaries reliably.
+ (cons 'button (cons (list t) properties))
+ object)
+ ;; Return something that can be used to get at the button.
+ beg))
(defun insert-text-button (label &rest properties)
"Insert a button with the label LABEL.