Move eshell-handle-url to eshell library
This commit is contained in:
parent
cc4b99f7fc
commit
bc52f75609
2 changed files with 14 additions and 12 deletions
|
@ -148,15 +148,6 @@ MODE1 is enabled and vice-versa."
|
||||||
"Set the `disabled' property for each item in FUNCTIONS to nil."
|
"Set the `disabled' property for each item in FUNCTIONS to nil."
|
||||||
(mapc #'(lambda (f) (put f 'disabled nil)) functions))
|
(mapc #'(lambda (f) (put f 'disabled nil)) functions))
|
||||||
|
|
||||||
(defun oni:eshell-handle-url ()
|
|
||||||
(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)))))))
|
|
||||||
|
|
||||||
(defun oni:go-mode-func ()
|
(defun oni:go-mode-func ()
|
||||||
"Function for `go-mode-hook'."
|
"Function for `go-mode-hook'."
|
||||||
(setq indent-tabs-mode nil))
|
(setq indent-tabs-mode nil))
|
||||||
|
@ -774,7 +765,7 @@ If no direction is given, don't split."
|
||||||
(setq emms-player-mpd-music-directory "/mnt/music/mp3"))
|
(setq emms-player-mpd-music-directory "/mnt/music/mp3"))
|
||||||
|
|
||||||
(stante-after esh-mode
|
(stante-after esh-mode
|
||||||
(add-to-list 'eshell-output-filter-functions #'oni:eshell-handle-url)
|
(add-to-list 'eshell-output-filter-functions 'oni:eshell-buttonize-url)
|
||||||
(add-to-list 'eshell-output-filter-functions #'eshell-truncate-buffer))
|
(add-to-list 'eshell-output-filter-functions #'eshell-truncate-buffer))
|
||||||
|
|
||||||
(stante-after eww
|
(stante-after eww
|
||||||
|
|
|
@ -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
|
;; Copyright (C) 2015 Tom Willemse
|
||||||
|
|
||||||
|
@ -20,7 +20,7 @@
|
||||||
|
|
||||||
;;; Commentary:
|
;;; Commentary:
|
||||||
|
|
||||||
;; Here are some extra commands for eshell.
|
;; Here are some extra commands and functions for eshell.
|
||||||
|
|
||||||
;;; Code:
|
;;; Code:
|
||||||
|
|
||||||
|
@ -38,5 +38,16 @@ directory in it."
|
||||||
(eshell/cd project-dir)
|
(eshell/cd project-dir)
|
||||||
(error "Can't locate project root"))))
|
(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)
|
(provide 'oni-eshell)
|
||||||
;;; oni-eshell.el ends here
|
;;; oni-eshell.el ends here
|
||||||
|
|
Loading…
Reference in a new issue