ReverseFlux

w3m

Feb 3rd, 2017
61
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.44 KB | None | 0 0
  1. ;;change default browser for 'browse-url' to w3m
  2. (setq browse-url-browser-function 'w3m-goto-url-new-session)
  3.  
  4. ;;change w3m user-agent to android
  5. (setq w3m-user-agent "Mozilla/5.0 (Linux; U; Android 2.3.3; zh-tw; HTC_Pyramid Build/GRI40) AppleWebKit/533.1 (KHTML, like Gecko) Version/4.0 Mobile Safari/533.")
  6.  
  7. ;;quick access hacker news
  8. (defun hn ()
  9. (interactive)
  10. (browse-url "http://news.ycombinator.com"))
  11.  
  12. ;;quick access reddit
  13. (defun reddit (reddit)
  14. "Opens the REDDIT in w3m-new-session"
  15. (interactive (list
  16. (read-string "Enter the reddit (default: psycology): " nil nil "psychology" nil)))
  17. (browse-url (format "http://m.reddit.com/r/%s" reddit))
  18. )
  19.  
  20. ;;i need this often
  21. (defun wikipedia-search (search-term)
  22. "Search for SEARCH-TERM on wikipedia"
  23. (interactive
  24. (let ((term (if mark-active
  25. (buffer-substring (region-beginning) (region-end))
  26. (word-at-point))))
  27. (list
  28. (read-string
  29. (format "Wikipedia (%s):" term) nil nil term)))
  30. )
  31. (browse-url
  32. (concat
  33. "http://en.m.wikipedia.org/w/index.php?search="
  34. search-term
  35. ))
  36. )
  37.  
  38. ;;when I want to enter the web address all by hand
  39. (defun w3m-open-site (site)
  40. "Opens site in new w3m session with 'http://' appended"
  41. (interactive
  42. (list (read-string "Enter website address(default: w3m-home):" nil nil w3m-home-page nil )))
  43. (w3m-goto-url-new-session
  44. (concat "http://" site)))
Add Comment
Please, Sign In to add comment