65 lines
2.6 KiB
EmacsLisp
65 lines
2.6 KiB
EmacsLisp
|
;; (C) Copyright Collin J. Doering 2014
|
||
|
;;
|
||
|
;; This program is free software: you can redistribute it and/or modify
|
||
|
;; it under the terms of the GNU General Public License as published by
|
||
|
;; the Free Software Foundation, either version 3 of the License, or
|
||
|
;; (at your option) any later version.
|
||
|
;;
|
||
|
;; This program is distributed in the hope that it will be useful,
|
||
|
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||
|
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||
|
;; GNU General Public License for more details.
|
||
|
;;
|
||
|
;; You should have received a copy of the GNU General Public License
|
||
|
;; along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||
|
|
||
|
;; File: eshell.el
|
||
|
;; Author: Collin J. Doering <collin.doering@rekahsoft.ca>
|
||
|
;; Date: Oct 22, 2014
|
||
|
|
||
|
;; TODO: make a function to toggle the eshell; given a the universal argument the following can occur:
|
||
|
;; - if numerical then opens the nth scratch buffer "*eshell*<n>"
|
||
|
;; - if no args then open a new eshell
|
||
|
;; Bind a key to switch to eshell
|
||
|
(define-key ctl-x-4-map "e" 'eshell)
|
||
|
|
||
|
;; Force ediff sessions to run in the same frame
|
||
|
(setq ediff-window-setup-function 'ediff-setup-windows-plain)
|
||
|
|
||
|
;; Set some eshell options
|
||
|
(setq eshell-scroll-to-bottom-on-input t)
|
||
|
;; *BROKEN*
|
||
|
;;(setq eshell-scroll-to-bottom-on-output t)
|
||
|
|
||
|
;; Commands that require a little more then a dumb-term
|
||
|
(setq eshell-visual-commands '("vi" "screen" "top" "less" "more" "lynx" "ncftp" "vim" "ncmpcpp" "irssi" "mc" "alsamixer" "/usr/bin/sudo"))
|
||
|
|
||
|
(defun eshell/catbuf (buffer-name)
|
||
|
"Given a buffer-name returns the contents of said buffer"
|
||
|
(interactive "bBuffer: ")
|
||
|
(save-excursion
|
||
|
(let ((code-buf (get-buffer buffer-name)))
|
||
|
(if (null code-buf) (concat "The buffer given \"" buffer-name "\" does not exist")
|
||
|
(set-buffer code-buf)
|
||
|
(buffer-string)))))
|
||
|
|
||
|
(defun eshell/find-file-ext (fp)
|
||
|
"Finds a single file or a list of files matching a regxp and returns a list of their respective buffers"
|
||
|
(interactive)
|
||
|
(if (listp fp) (mapcar #'find-file fp)
|
||
|
(list (find-file fp))))
|
||
|
|
||
|
(defun eshell/ff (fp &rest other-fps)
|
||
|
"A FP is either a file path (relative or absolute) or a regexp which eshell converts to a
|
||
|
list of stings (file paths) which match the regexp (likely using file-expand-widcards).
|
||
|
eshell/ff takes one or more file paths and opens them in the current buffer returning a list
|
||
|
consisting of lists of buffers opened by each respective FP argument."
|
||
|
(interactive)
|
||
|
(mapcar #'eshell/find-file-ext (cons fp other-fps)))
|
||
|
|
||
|
(defun eshell/clear ()
|
||
|
"04Dec2001 - sailor, to clear the eshell buffer."
|
||
|
(interactive)
|
||
|
(let ((inhibit-read-only t))
|
||
|
(erase-buffer)))
|