Function: bookmark--remove-fringe-mark
bookmark--remove-fringe-mark is a byte-compiled function defined in
bookmark.el.gz.
Signature
(bookmark--remove-fringe-mark BM)
Documentation
Remove a bookmark's colorized overlay.
BM is a bookmark as returned from function bookmark-get-bookmark.
See user option bookmark-fringe-mark.
Source Code
;; Defined in /usr/src/emacs/lisp/bookmark.el.gz
(defun bookmark--remove-fringe-mark (bm)
"Remove a bookmark's colorized overlay.
BM is a bookmark as returned from function `bookmark-get-bookmark'.
See user option `bookmark-fringe-mark'."
(let ((filename (cdr (assq 'filename bm)))
(pos (cdr (assq 'position bm)))
;; Don't expand file names for non-existing remote connections.
(non-essential t)
overlays found temp)
(when (and pos filename)
(dolist (buf (buffer-list))
(with-current-buffer buf
(let ((bkmk-fname (ignore-errors (bookmark-buffer-file-name))))
(when bkmk-fname
;; Normalize both filenames before comparing, because the
;; filename we receive from the bookmark wasn't
;; necessarily generated by `bookmark-buffer-file-name'.
;; For example, bookmarks set in Info nodes get a filename
;; based on `Info-current-file', and under certain
;; circumstances that can be an unexpanded path (e.g.,
;; when the Info page was under your home directory).
(let ((this-fname-normalized (expand-file-name filename))
(bkmk-fname-normalized (expand-file-name bkmk-fname)))
(when (equal this-fname-normalized bkmk-fname-normalized)
(setq overlays
(save-excursion
(save-restriction
;; Suppose bookmark "foo" was earlier set at
;; location X in a file, but now the file is
;; narrowed such that X is outside the
;; restriction. Then the `goto-char' below
;; would go to the wrong place and thus the
;; wrong overlays would be fetched. This is
;; why we temporarily `widen' before
;; fetching.
;;
;; (This circumstance can easily arise when
;; a bookmark was set on Info node X but now
;; the "*info*" buffer is showing some other
;; node Y, with X and Y physically located
;; in the same file, as is often the case
;; with Info nodes. See bug #70019, for
;; example.)
(widen)
(goto-char pos)
(overlays-in (pos-bol) (1+ (pos-bol))))))
(while (and (not found) (setq temp (pop overlays)))
(when (eq 'bookmark (overlay-get temp 'category))
(delete-overlay (setq found temp)))))))))))))