]> git.eshelyaron.com Git - emacs.git/commitdiff
Fix make-text-button bug with string copy
authorPaul Eggert <eggert@cs.ucla.edu>
Wed, 3 Jun 2020 22:39:29 +0000 (15:39 -0700)
committerPaul Eggert <eggert@cs.ucla.edu>
Wed, 3 Jun 2020 22:39:51 +0000 (15:39 -0700)
* lisp/button.el (make-text-button): Use the copy of BEG
uniformly, instead of in just one place.  This fixes a typo
introduced in 2020-05-17T05:23:28Z!eggert@cs.ucla.edu.
Problem reported by João Távora in:
https://lists.gnu.org/r/emacs-devel/2020-06/msg00117.html

lisp/button.el

index f969a03cb028f5c807c9e6ea4fbf179f215d16f7..a91b0482acd85c0e3d682a29ef15541aab99777b 100644 (file)
@@ -349,7 +349,8 @@ Also see `insert-text-button'."
         (or (plist-member properties 'type)
             (plist-member properties :type))))
     (when (stringp beg)
-      (setq object (copy-sequence beg) beg 0 end (length object)))
+      (setq beg (copy-sequence beg)) ;; In case BEG is not mutable.
+      (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"))