From 6c7fbd2d9d2eb6daa8adeeef4229c9ace20ef7b1 Mon Sep 17 00:00:00 2001 From: Tom Willemse Date: Sun, 29 Dec 2013 15:46:44 +0100 Subject: Make URLs clickable in eshell --- .emacs.d/init.el | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to '.emacs.d/init.el') diff --git a/.emacs.d/init.el b/.emacs.d/init.el index 93f7c20..6ac9ea5 100644 --- a/.emacs.d/init.el +++ b/.emacs.d/init.el @@ -1382,6 +1382,18 @@ If no direction is given, don't split." (electric-indent-mode -1) +(defun oni:eshell-handle-url () + (save-excursion + (goto-char eshell-last-output-start) + (while (re-search-forward + "http://[^ \n]+" eshell-last-output-end :noerror) + (make-button (match-beginning 0) (match-end 0) + 'action (lambda (button) + (browse-url (button-label button))))))) + +(stante-after esh-mode + (add-to-list 'eshell-output-filter-functions #'oni:eshell-handle-url)) + (provide 'init) ;;; init.el ends here -- cgit v1.2.3-54-g00ecf