• Stefan Kangas's avatar
    Restore focus to Bookmark List after editing annotation · 7c30ad18
    Stefan Kangas authored
    There are two entry points to bookmark-edit-annotation-mode: the first
    when we add a bookmark and bookmark-use-annotations is non-nil; the
    second when bookmark-bmenu-edit-annotation is run from the bookmark
    list.  When editing is concluded, in the first case, we should just
    quit window.  In the second case, we should instead return to the
    bookmark list.
    
    * lisp/bookmark.el (text-property-search): Require.
    (bookmark-annotation-name): Make buffer-local and improve doc string.
    (bookmark--annotation-from-bookmark-list): New buffer-local variable.
    (bookmark-edit-annotation): New argument from-bookmark-list sets
    bookmark--annotation-from-bookmark-list.
    (bookmark-bmenu-edit-annotation): Call bookmark-edit-annotation with
    argument from-bookmark-list set to t.
    (bookmark-send-edited-annotation): When editing originated in the
    bookmark list, restore focus to bookmark list and move point back to
    edited bookmark. (Bug#20150)
    
    (bookmark-edit-annotation-mode): Fix typo.
    (bookmark-bmenu-buffer): New variable.
    (bookmark-bmenu-surreptitiously-rebuild-list)
    (bookmark-bmenu-list): Use it.
    
    * test/lisp/bookmark-tests.el (with-bookmark-bmenu-test): New macro.
    (bookmark-tests-set/bookmark-use-annotations-t)
    (bookmark-bmenu-edit-annotation/show-annotation)
    (bookmark-bmenu-send-edited-annotation)
    (bookmark-bmenu-send-edited-annotation/restore-focus): New test cases.
    7c30ad18
bookmark-tests.el 13.9 KB