Function: eww-bookmark-yank

eww-bookmark-yank is an interactive and byte-compiled function defined in eww.el.gz.

Signature

(eww-bookmark-yank)

Documentation

Yank a previously killed bookmark to the current line.

Key Bindings

Source Code

;; Defined in /usr/src/emacs/lisp/net/eww.el.gz
(defun eww-bookmark-yank ()
  "Yank a previously killed bookmark to the current line."
  (interactive nil eww-bookmark-mode)
  (eww--bookmark-check-order-sort)
  (unless eww-bookmark-kill-ring
    (user-error "No previously killed bookmark"))
  (let* ((bookmark-at-point (nth 3 (vtable-current-object)))
         (index-bap (seq-position eww-bookmarks bookmark-at-point))
         ;; store in a list, for simpler concat
         (bookmark-to-insert (list (pop eww-bookmark-kill-ring)))
         (position (point)))
    (setq eww-bookmarks
          (if (= (point) (point-max))
              ;; special case: point is in the last line of the buffer,
              ;; so we know to append the bookmark at the end
              (progn
                (goto-char (point-min)) ; move inside the vtable instance
                (seq-concatenate 'list eww-bookmarks bookmark-to-insert))
            ;; TODO: a simpler way of doing this?
            (seq-concatenate 'list
                             (seq-subseq eww-bookmarks 0 index-bap)
                             bookmark-to-insert
                             (seq-subseq eww-bookmarks index-bap))))
    (eww-write-bookmarks)
    (vtable-revert-command)
    (vtable-beginning-of-table)
    (goto-char position)))