summaryrefslogtreecommitdiffstats
path: root/emacs/.emacs.d/site-lisp/oni-eshell.el
diff options
context:
space:
mode:
Diffstat (limited to 'emacs/.emacs.d/site-lisp/oni-eshell.el')
-rw-r--r--emacs/.emacs.d/site-lisp/oni-eshell.el15
1 files changed, 13 insertions, 2 deletions
diff --git a/emacs/.emacs.d/site-lisp/oni-eshell.el b/emacs/.emacs.d/site-lisp/oni-eshell.el
index 02d49a0..c0d3d13 100644
--- a/emacs/.emacs.d/site-lisp/oni-eshell.el
+++ b/emacs/.emacs.d/site-lisp/oni-eshell.el
@@ -1,4 +1,4 @@
-;;; oni-eshell.el --- Extra Eshell commands -*- lexical-binding: t; -*-
+;;; oni-eshell.el --- Extra Eshell commands and functions -*- lexical-binding: t; -*-
;; Copyright (C) 2015 Tom Willemse
@@ -20,7 +20,7 @@
;;; Commentary:
-;; Here are some extra commands for eshell.
+;; Here are some extra commands and functions for eshell.
;;; Code:
@@ -38,5 +38,16 @@ directory in it."
(eshell/cd project-dir)
(error "Can't locate project root"))))
+;;;###autoload
+(defun oni:eshell-buttonize-url ()
+ "Turn every URL into a clickable button."
+ (save-excursion
+ (goto-char eshell-last-output-start)
+ (while (re-search-forward
+ "https?://[^ \n]+" eshell-last-output-end :noerror)
+ (make-button (match-beginning 0) (match-end 0)
+ 'action (lambda (button)
+ (browse-url (button-label button)))))))
+
(provide 'oni-eshell)
;;; oni-eshell.el ends here