emacs
This commit is contained in:
parent
54bf4091fd
commit
8cf4fc59e7
3 changed files with 815 additions and 940 deletions
|
@ -1,13 +1,13 @@
|
||||||
EMACS = emacs
|
EMACS = emacs
|
||||||
|
|
||||||
files = init.el init.elc eshell-init.el eshell-init.elc
|
files = init.el init.elc
|
||||||
install-files = $(addprefix install-,$(files)) install-loaddefs.el
|
install-files = $(addprefix install-,$(files))
|
||||||
submodules = eshell
|
submodules = eshell
|
||||||
install-submodules = $(addprefix install-,$(submodules))
|
install-submodules = $(addprefix install-,$(submodules))
|
||||||
|
|
||||||
.PHONY: all $(submodules) install $(install-submodules) $(install-files)
|
.PHONY: all $(submodules) install $(install-submodules) $(install-files)
|
||||||
|
|
||||||
all: loaddefs.el $(files) $(submodules)
|
all: $(files) $(submodules)
|
||||||
|
|
||||||
$(submodules):
|
$(submodules):
|
||||||
$(MAKE) -C $@/
|
$(MAKE) -C $@/
|
||||||
|
@ -15,10 +15,6 @@ $(submodules):
|
||||||
$(filter %.elc,$(files)): %.elc: %.el
|
$(filter %.elc,$(files)): %.elc: %.el
|
||||||
$(EMACS) -batch -eval "(byte-compile-file \"$^\")"
|
$(EMACS) -batch -eval "(byte-compile-file \"$^\")"
|
||||||
|
|
||||||
loaddefs.el: $(files)
|
|
||||||
$(EMACS) -batch -eval "(let ((generated-autoload-file \"${CURDIR}/loaddefs.el\")) \
|
|
||||||
(update-directory-autoloads \"${CURDIR}\"))"
|
|
||||||
|
|
||||||
install: $(install-files) $(install-submodules)
|
install: $(install-files) $(install-submodules)
|
||||||
|
|
||||||
$(install-files): install-%: $*
|
$(install-files): install-%: $*
|
||||||
|
|
|
@ -1,64 +0,0 @@
|
||||||
;; Eshell settings
|
|
||||||
(eval-when-compile
|
|
||||||
'(load "init.el"))
|
|
||||||
|
|
||||||
(eval-after-load "em-term"
|
|
||||||
'(add-to-list 'eshell-visual-commands
|
|
||||||
"unison"))
|
|
||||||
|
|
||||||
(defun oni:eshell-mode-func ()
|
|
||||||
"Function for `eshell-mode-hook'."
|
|
||||||
(setq truncate-lines nil))
|
|
||||||
|
|
||||||
(defun oni:eshell-prompt-function ()
|
|
||||||
(let ((status (if (zerop eshell-last-command-status) ?+ ?-))
|
|
||||||
(hostname (shell-command-to-string "hostname"))
|
|
||||||
(dir (abbreviate-file-name (eshell/pwd)))
|
|
||||||
(branch
|
|
||||||
(shell-command-to-string
|
|
||||||
"git branch --contains HEAD 2>/dev/null | sed -e '/^[^*]/d'"))
|
|
||||||
(userstatus (if (zerop (user-uid)) ?# ?$)))
|
|
||||||
(concat
|
|
||||||
(propertize (char-to-string status)
|
|
||||||
'face `(:foreground ,(if (= status ?+)
|
|
||||||
(oni:color chameleon-1)
|
|
||||||
(oni:color scarlet-red-2))))
|
|
||||||
" "
|
|
||||||
(propertize (substring hostname 0 -1) 'face 'mode-line-buffer-id)
|
|
||||||
" "
|
|
||||||
(propertize (oni:shorten-dir dir) 'face 'font-lock-string-face)
|
|
||||||
" "
|
|
||||||
(when (not (string= branch ""))
|
|
||||||
(propertize
|
|
||||||
;; Cut off "* " and "\n"
|
|
||||||
(substring branch 2 -1)
|
|
||||||
'face 'font-lock-function-name-face))
|
|
||||||
" \n"
|
|
||||||
(propertize (char-to-string userstatus)
|
|
||||||
'face `(:foreground ,(oni:color sky-blue-1)))
|
|
||||||
"> ")))
|
|
||||||
|
|
||||||
;;;###autoload
|
|
||||||
(defun oni:raise-eshell ()
|
|
||||||
"Start or switch back to `eshell'. Also change directories to
|
|
||||||
current working directory."
|
|
||||||
(interactive)
|
|
||||||
(let ((dir (file-name-directory
|
|
||||||
(or (buffer-file-name) "~/")))
|
|
||||||
(hasfile (not (eq (buffer-file-name) nil))))
|
|
||||||
(eshell)
|
|
||||||
(if (and hasfile (eq eshell-process-list nil))
|
|
||||||
(progn
|
|
||||||
(eshell/cd dir)
|
|
||||||
(eshell-reset)))))
|
|
||||||
|
|
||||||
(defun oni:shorten-dir (dir)
|
|
||||||
"Shorten a directory, (almost) like fish does it."
|
|
||||||
(while (string-match "\\(/\\.?[^./]\\)[^/]+/" dir)
|
|
||||||
(setq dir (replace-match "\\1/" nil nil dir)))
|
|
||||||
dir)
|
|
||||||
|
|
||||||
(setq eshell-prompt-regexp "^[#$]> ")
|
|
||||||
(setq eshell-highlight-prompt nil)
|
|
||||||
(setq eshell-prompt-function 'oni:eshell-prompt-function)
|
|
||||||
(add-hook 'eshell-mode-hook 'oni:eshell-mode-func)
|
|
1561
emacs/init.el
1561
emacs/init.el
File diff suppressed because it is too large
Load diff
Loading…
Reference in a new issue