Compare commits
No commits in common. "de123f7cea8f85449804e225c6fd940bc13a7293" and "c74eed5df1302c28ad8400125a7d20ce2afef9ca" have entirely different histories.
de123f7cea
...
c74eed5df1
6
init.el
6
init.el
@ -380,8 +380,6 @@
|
|||||||
db/pretty-print-xml
|
db/pretty-print-xml
|
||||||
db/bookmark-add-external
|
db/bookmark-add-external
|
||||||
db/bookmark-add-url
|
db/bookmark-add-url
|
||||||
db/bookmark-relocate
|
|
||||||
db/bookmark-bmenu-relocate
|
|
||||||
db/lookup-smime-key
|
db/lookup-smime-key
|
||||||
db/dired-from-shell-command
|
db/dired-from-shell-command
|
||||||
db/system-open
|
db/system-open
|
||||||
@ -2365,9 +2363,7 @@ eventuelly be set to nil, however)."
|
|||||||
(use-package bookmark
|
(use-package bookmark
|
||||||
:init (setq bookmark-default-file (expand-file-name "bookmarks" emacs-d-userdata)
|
:init (setq bookmark-default-file (expand-file-name "bookmarks" emacs-d-userdata)
|
||||||
bookmark-menu-confirm-deletion t
|
bookmark-menu-confirm-deletion t
|
||||||
bookmark-save-flag 1)
|
bookmark-save-flag 1))
|
||||||
:bind (:map bookmark-bmenu-mode-map
|
|
||||||
("R" . db/bookmark-bmenu-relocate)))
|
|
||||||
|
|
||||||
(use-package dumb-jump
|
(use-package dumb-jump
|
||||||
:commands (dumb-jump-xref-activate)
|
:commands (dumb-jump-xref-activate)
|
||||||
|
|||||||
@ -845,14 +845,14 @@ number of bytes has been inserted."
|
|||||||
HANDLER is a function receiving a single argument, namely
|
HANDLER is a function receiving a single argument, namely
|
||||||
LOCATION. If a bookmark named NAME is already present, replace
|
LOCATION. If a bookmark named NAME is already present, replace
|
||||||
it."
|
it."
|
||||||
(let ((new-record `((location . ,location)
|
(let ((new-record `((filename . ,location)
|
||||||
(handler . ,handler))))
|
(handler . ,handler))))
|
||||||
(bookmark-update-last-modified new-record)
|
(bookmark-update-last-modified new-record)
|
||||||
(bookmark-store name new-record nil)))
|
(bookmark-store name new-record nil)))
|
||||||
|
|
||||||
(defun db/bookmark-browse-url (bmk)
|
(defun db/bookmark-browse-url (bmk)
|
||||||
"Extract filename from bookmark BMK and apply `browse-url' to it."
|
"Extract filename from bookmark BMK and apply `browse-url' to it."
|
||||||
(browse-url (bookmark-location bmk)))
|
(browse-url (bookmark-get-filename bmk)))
|
||||||
|
|
||||||
;; https://takeonrules.com/2024/12/17/extending-built-in-emacs-bookmark-package/
|
;; https://takeonrules.com/2024/12/17/extending-built-in-emacs-bookmark-package/
|
||||||
(put 'db/bookmark-browse-url 'bookmark-handler-type "URL")
|
(put 'db/bookmark-browse-url 'bookmark-handler-type "URL")
|
||||||
@ -863,7 +863,7 @@ it."
|
|||||||
|
|
||||||
(defun db/bookmark-eww (bmk)
|
(defun db/bookmark-eww (bmk)
|
||||||
"Extract filename from bookmark BMK and apply `eww' to it."
|
"Extract filename from bookmark BMK and apply `eww' to it."
|
||||||
(eww (bookmark-location bmk)))
|
(eww (bookmark-get-filename bmk)))
|
||||||
|
|
||||||
(put 'db/bookmark-eww 'bookmark-handler-type "EWW")
|
(put 'db/bookmark-eww 'bookmark-handler-type "EWW")
|
||||||
|
|
||||||
@ -888,41 +888,6 @@ as completing instead."
|
|||||||
(interactive "sURL: \nsName: ")
|
(interactive "sURL: \nsName: ")
|
||||||
(db/bookmark-add-with-handler name url #'db/bookmark-eww))
|
(db/bookmark-add-with-handler name url #'db/bookmark-eww))
|
||||||
|
|
||||||
(defun db/bookmark-relocate (bookmark-name)
|
|
||||||
"Relocate BOOKMARK-NAME to another location.
|
|
||||||
|
|
||||||
Bookmarks with type “URL” or “EWW” can be set to arbitrary locations,
|
|
||||||
all other bookmarks are handled via the default `bookmark-relocate'
|
|
||||||
mechanism."
|
|
||||||
(interactive (list (bookmark-completing-read "Bookmark to relocate")))
|
|
||||||
(bookmark-maybe-load-default-file)
|
|
||||||
(let ((bmk-type (bookmark-type-from-full-record (bookmark-get-bookmark bookmark-name))))
|
|
||||||
;; TODO: it might be nice to use `cl-defmethod' instead for easier extensibility instead of
|
|
||||||
;; explicitly listing all currently available link types.
|
|
||||||
(cond
|
|
||||||
((member bmk-type '("URL" "EWW"))
|
|
||||||
(let ((newloc (read-string (format "Relocate %s to: " bookmark-name)
|
|
||||||
(bookmark-location bookmark-name))))
|
|
||||||
(when (bookmark-get-filename bookmark-name)
|
|
||||||
(bookmark-set-filename bookmark-name nil))
|
|
||||||
(bookmark-prop-set bookmark-name 'location newloc)
|
|
||||||
(bookmark-update-last-modified bookmark-name)
|
|
||||||
(setq bookmark-alist-modification-count
|
|
||||||
(1+ bookmark-alist-modification-count))
|
|
||||||
(when (bookmark-time-to-save-p)
|
|
||||||
(bookmark-save))
|
|
||||||
(bookmark-bmenu-surreptitiously-rebuild-list)))
|
|
||||||
(t (bookmark-relocate bookmark-name)))))
|
|
||||||
|
|
||||||
(defun db/bookmark-bmenu-relocate ()
|
|
||||||
"Change location of bookmark at point in `bookmark-bmenu-mode'.
|
|
||||||
Uses `db/bookmark-relocate'."
|
|
||||||
;; Adapted from `bookmark-bmenu-relocate'.
|
|
||||||
(interactive nil bookmark-bmenu-mode)
|
|
||||||
(let ((thispoint (point)))
|
|
||||||
(db/bookmark-relocate (bookmark-bmenu-bookmark))
|
|
||||||
(goto-char thispoint)))
|
|
||||||
|
|
||||||
|
|
||||||
;;; Switching Themes
|
;;; Switching Themes
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user