;;; -*- lexical-binding: t -*- ;;; ;;; this file: ;;; http://user.it.uu.se/~embe8573/emacs-init/w3m/bookmarks.el ;;; https://dataswamp.org/~incal/emacs-init/w3m/bookmarks.el (require 'w3m-bookmark) (require 'w3m-tabs) (defun localhost () (interactive) (w3m-browse-url-new-tab "http://localhost") ) ;; swamp (defun browse-swamp (&optional section) (interactive "P") (let*((hp-url "https://dataswamp.org/~incal") (url (format "%s/%s" hp-url (or section ""))) ) (w3m-browse-url-new-tab url) )) (defun browse-swamp-conf-zsh () (interactive) (browse-swamp "conf/.zsh")) (defun browse-swamp-conf-emacs () (interactive) (browse-swamp "emacs-init")) ;; Emacs-w3m bookmarks (defvar w3m-bookmark-url "about://bookmark/") (setq w3m-home-page w3m-bookmark-url) (defun w3m-show-bookmarks () (interactive) (switch-to-buffer (w3m-new-tab "bookmarks")) (w3m-bookmark-view t) ) (defun w3m-bookmark-dwim (url &optional title) (interactive (if (use-region-p) (list w3m-current-url (buffer-substring (region-beginning) (region-end))) (let ((url-at-point (thing-at-point 'url))) (if url-at-point (list url-at-point) (let ((link-url (w3m-url-valid (w3m-anchor)))) (if link-url (list link-url) ; (w3m-anchor-title) here DNC (list w3m-current-url w3m-current-title) )))))) (w3m-bookmark-add url title) ) (defun w3m-edit-url-or-bookmarks () (interactive) (if (string= w3m-current-url w3m-bookmark-url) (w3m-bookmark-edit) (w3m-edit-current-url) )) (provide 'bookmarks)