mirror of
git://git.sv.gnu.org/emacs.git
synced 2026-02-16 17:24:23 +00:00
Eliminate bookmark-maybe-historicize-string duplicates
* lisp/bookmark.el (bookmark-maybe-historicize-string): Use 'add-to-history' to respect history-delete-duplicates and the 'history-length property. (Bug#76137)
This commit is contained in:
parent
34d353cd72
commit
788380cf6a
3 changed files with 13 additions and 3 deletions
7
etc/NEWS
7
etc/NEWS
|
|
@ -472,6 +472,13 @@ default), the 'whitespace-cleanup' function will now add the newline.
|
|||
|
||||
** Bookmark
|
||||
|
||||
---
|
||||
*** Bookmark history now saves each bookmark only once.
|
||||
Previously, the variable 'bookmark-history' accumulated duplicate
|
||||
bookmark names when bookmark features were used interactively. This
|
||||
made their history larger than necessary for frequent bookmark users.
|
||||
Bookmark names are now saved uniquely.
|
||||
|
||||
---
|
||||
*** New user option 'bookmark-bmenu-type-column-width'.
|
||||
This user option controls the width of the type column on the bookmark
|
||||
|
|
|
|||
|
|
@ -603,7 +603,7 @@ from other commands that pass in the bookmark name, so
|
|||
`completing-read' never gets a chance to set `bookmark-history'."
|
||||
`(or
|
||||
(called-interactively-p 'interactive)
|
||||
(setq bookmark-history (cons ,string bookmark-history))))
|
||||
(add-to-history 'bookmark-history ,string)))
|
||||
|
||||
(defvar bookmark-make-record-function 'bookmark-make-record-default
|
||||
"A function that should be called to create a bookmark record.
|
||||
|
|
|
|||
|
|
@ -193,9 +193,12 @@ the lexically-bound variable `buffer'."
|
|||
(should (equal (bookmark-prop-get bmk 'filename) "prop")))))
|
||||
|
||||
(ert-deftest bookmark-tests-maybe-historicize-string ()
|
||||
(let ((bookmark-history))
|
||||
(let ((bookmark-history)
|
||||
(history-delete-duplicates t))
|
||||
(bookmark-maybe-historicize-string "foo")
|
||||
(should (equal (car bookmark-history) "foo"))))
|
||||
(bookmark-maybe-historicize-string "foo")
|
||||
(should (equal (car bookmark-history) "foo"))
|
||||
(should (= 1 (length bookmark-history)))))
|
||||
|
||||
(defun bookmark-remove-last-modified (bmk)
|
||||
(assoc-delete-all 'last-modified bmk))
|
||||
|
|
|
|||
Loading…
Reference in a new issue