Compare commits
2 Commits
ff30cbdf58
...
3dbc9604d4
| Author | SHA1 | Date | |
|---|---|---|---|
| 3dbc9604d4 | |||
| fc58eb56f4 |
@ -2235,39 +2235,12 @@ PARAMS may contain the following values:
|
|||||||
(bookmark-jump bookmark))
|
(bookmark-jump bookmark))
|
||||||
|
|
||||||
(defun db/org-bookmark-store-link ()
|
(defun db/org-bookmark-store-link ()
|
||||||
"Store a link to the bookmark at point.
|
"Store a link to the bookmark at point."
|
||||||
|
(let (bookmark)
|
||||||
When in Dired, try to find bookmark that points to the file at
|
(when (eq major-mode 'bookmark-bmenu-mode)
|
||||||
point. When in a buffer associated with a file, try to find a
|
(setq bookmark (bookmark-bmenu-bookmark))
|
||||||
bookmark that points to this file. Note that in this case, for
|
(org-link-store-props :link (concat "bookmark:" bookmark)
|
||||||
performance reasons, equality checks between file names is not
|
:description bookmark))))
|
||||||
done with `file-equal-p', which seems to be too slow on Windows;
|
|
||||||
a simple `string=' is used instead, which may not be completely
|
|
||||||
accurate in certain cases."
|
|
||||||
(let (file bookmark bmks)
|
|
||||||
(cond ((eq major-mode 'dired-mode)
|
|
||||||
(setq file (abbreviate-file-name (dired-get-filename))))
|
|
||||||
((buffer-file-name (buffer-base-buffer))
|
|
||||||
(setq file (abbreviate-file-name
|
|
||||||
(buffer-file-name (buffer-base-buffer))))))
|
|
||||||
(if (not file)
|
|
||||||
(when (eq major-mode 'bookmark-bmenu-mode)
|
|
||||||
(setq bookmark (bookmark-bmenu-bookmark)))
|
|
||||||
(when (setq bmks
|
|
||||||
(->> (bookmark-all-names)
|
|
||||||
(-map (lambda (name)
|
|
||||||
(if (string= file
|
|
||||||
(abbreviate-file-name
|
|
||||||
(bookmark-location name)))
|
|
||||||
name)))
|
|
||||||
(delete nil)))
|
|
||||||
(setq bookmark
|
|
||||||
(if (eq 1 (length bmks))
|
|
||||||
(car bmks)
|
|
||||||
(completing-read "Bookmark: " bmks nil t nil nil (car bmks))))))
|
|
||||||
(if bookmark
|
|
||||||
(org-link-store-props :link (concat "bookmark:" bookmark)
|
|
||||||
:description bookmark))))
|
|
||||||
|
|
||||||
|
|
||||||
;;; End
|
;;; End
|
||||||
|
|||||||
@ -865,6 +865,8 @@ it."
|
|||||||
"Extract filename from bookmark BMK and apply `eww' to it."
|
"Extract filename from bookmark BMK and apply `eww' to it."
|
||||||
(eww (bookmark-get-filename bmk)))
|
(eww (bookmark-get-filename bmk)))
|
||||||
|
|
||||||
|
(put 'db/bookmark-eww 'bookmark-handler-type "EWW")
|
||||||
|
|
||||||
(defun db/bookmark-add-external (location name)
|
(defun db/bookmark-add-external (location name)
|
||||||
"Add NAME as bookmark to LOCATION that is opened by the operating system.
|
"Add NAME as bookmark to LOCATION that is opened by the operating system.
|
||||||
Offers simple completing from the list of recently opened files.
|
Offers simple completing from the list of recently opened files.
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user