;;; -*- lexical-binding: t -*- ;; ;; this file: ;; https://dataswamp.org/~incal/emacs-init/w3m/w3m-bookmark-more.el (require 'thingatpt) (require 'w3m-bookmark) (require 'w3m-tabs) (defun localhost () (interactive) (w3m-browse-url-new-tab "http://localhost") ) (defun w3m-show-bookmarks () (interactive) (switch-to-buffer (w3m-new-tab "bookmarks")) (w3m-bookmark-view t) ) (defun w3m-bookmark-dwim (url title) (interactive (if (use-region-p) (list w3m-current-url (buffer-substring-no-properties (region-beginning) (region-end)) ) (let ((url-at-point (thing-at-point 'url))) (if url-at-point (list url-at-point (read-string "title: ")) (let ((link-url (w3m-url-valid (w3m-anchor)))) (if link-url (list link-url (or (w3m-anchor-title) ; doesn't always work (thing-at-point 'word t) )) (list w3m-current-url w3m-current-title) )))))) (when (and url title) (w3m-bookmark-add url title) )) (defun w3m-edit-url-or-bookmarks () (interactive) (if (string= w3m-current-url "about://bookmark/") (w3m-bookmark-edit) (w3m-edit-current-url) )) (provide 'w3m-bookmark-more)