]> git.eshelyaron.com Git - emacs.git/commitdiff
When bookmark is overwritten, unfontify its previous position
authorChristopher League <league@contrapunctus.net>
Sun, 25 Jul 2021 07:37:36 +0000 (09:37 +0200)
committerLars Ingebrigtsen <larsi@gnus.org>
Sun, 25 Jul 2021 10:23:33 +0000 (12:23 +0200)
* lisp/bookmark.el (bookmark-store): When the bookmark-fontify option
is non-nil, setting or jumping to bookmarks will colorize them using
`bookmark-face'.  With this change, overwriting a bookmark will remove
the fontification at its former position (bug#49725).

lisp/bookmark.el

index 52b96fd2038a47d7ffb3ab559ae49051c4432b2d..ff9b8ab1388d54185acbb37a1a9079b106041826 100644 (file)
@@ -561,10 +561,14 @@ old one."
     (set-text-properties 0 (length stripped-name) nil stripped-name)
     (if (and (not no-overwrite)
              (bookmark-get-bookmark stripped-name 'noerror))
-        ;; already existing bookmark under that name and
-        ;; no prefix arg means just overwrite old bookmark
-        ;; Use the new (NAME . ALIST) format.
-        (setcdr (bookmark-get-bookmark stripped-name) alist)
+        ;; Already existing bookmark under that name and
+        ;; no prefix arg means just overwrite old bookmark.
+        (let ((bm (bookmark-get-bookmark stripped-name)))
+          ;; First clean up if previously location was fontified.
+          (when bookmark-fontify
+            (bookmark--unfontify bm))
+          ;; Modify using the new (NAME . ALIST) format.
+          (setcdr bm alist))
 
       ;; otherwise just cons it onto the front (either the bookmark
       ;; doesn't exist already, or there is no prefix arg.  In either