"Time before `bookmark-bmenu-search' updates the display."
:type 'number)
-(defcustom bookmark-fontify t
- "Whether to colorize a bookmarked line.
-If non-nil, setting a bookmark will colorize the current line with
-`bookmark-face'."
+(defcustom bookmark-set-fringe-mark t
+ "Whether to set a fringe mark at bookmarked lines."
:type 'boolean
:version "28.1")
(defface bookmark-face
'((((class grayscale)
(background light))
- :background "DimGray")
+ :foreground "DimGray")
(((class grayscale)
(background dark))
- :background "LightGray")
+ :foreground "LightGray")
(((class color)
(background light))
- :foreground "White" :background "DarkOrange1")
+ :background "White" :foreground "DarkOrange1")
(((class color)
(background dark))
- :foreground "Black" :background "DarkOrange1"))
+ :background "Black" :foreground "DarkOrange1"))
"Face used to highlight current line."
:version "28.1")
(defvar bookmark-history nil
"The history list for bookmark functions.")
-(defun bookmark--fontify ()
+(define-fringe-bitmap 'bookmark-fringe-mark
+ "\x3c\x7e\xff\xff\xff\xff\x7e\x3c")
+
+(defun bookmark--set-fringe-mark ()
"Apply a colorized overlay to the bookmarked location.
-See user option `bookmark-fontify'."
- (let ((bm (make-overlay (point-at-bol)
- (min (point-max) (1+ (point-at-eol))))))
+See user option `bookmark-set-fringe-mark'."
+ (let ((bm (make-overlay (point-at-bol) (point-at-bol))))
(overlay-put bm 'category 'bookmark)
- (overlay-put bm 'face 'bookmark-face)))
+ (overlay-put bm 'before-string
+ (propertize
+ "x" 'display
+ `(left-fringe bookmark-fringe-mark bookmark-face)))))
-(defun bookmark--unfontify (bm)
+(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-fontify'."
+See user option `bookmark-set-fringe'."
(let ((filename (cdr (assq 'filename bm)))
(pos (cdr (assq 'position bm)))
overlays found temp)
(dolist (buf (buffer-list))
(with-current-buffer buf
(when (equal filename buffer-file-name)
- (setq overlays (overlays-at pos))
+ (setq overlays (overlays-in pos pos))
(while (and (not found) (setq temp (pop overlays)))
(when (eq 'bookmark (overlay-get temp 'category))
(delete-overlay (setq found temp))))))))))
;; 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))
+ (when bookmark-set-fringe-mark
+ (bookmark--remove-fringe-mark bm))
;; Modify using the new (NAME . ALIST) format.
(setcdr bm alist))
;; Ask for an annotation buffer for this bookmark
(when bookmark-use-annotations
(bookmark-edit-annotation str))
- (when bookmark-fontify
- (bookmark--fontify))))
+ (when bookmark-set-fringe-mark
+ (bookmark--set-fringe-mark))))
(setq bookmark-yank-point nil)
(setq bookmark-current-buffer nil)))
(if win (set-window-point win (point))))
;; FIXME: we used to only run bookmark-after-jump-hook in
;; `bookmark-jump' itself, but in none of the other commands.
- (when bookmark-fontify
- (let ((overlays (overlays-at (point)))
+ (when bookmark-set-fringe-mark
+ (let ((overlays (overlays-in (point) (point)))
temp found)
(while (and (not found) (setq temp (pop overlays)))
(when (eq 'bookmark (overlay-get temp 'category))
(setq found t)))
(unless found
- (bookmark--fontify))))
+ (bookmark--set-fringe-mark))))
(run-hooks 'bookmark-after-jump-hook)
(if bookmark-automatically-show-annotations
;; if there is an annotation for this bookmark,
(bookmark-maybe-historicize-string bookmark-name)
(bookmark-maybe-load-default-file)
(let ((will-go (bookmark-get-bookmark bookmark-name 'noerror)))
- (bookmark--unfontify will-go)
+ (bookmark--remove-fringe-mark will-go)
(setq bookmark-alist (delq will-go bookmark-alist))
;; Added by db, nil bookmark-current-bookmark if the last
;; occurrence has been deleted