Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
67 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,71 @@ | ||
(prelude-require-package 'xquery-mode) | ||
(add-to-list 'default-frame-alist '(font . "Source Code Pro 12")) | ||
;(require 'ox-reveal) | ||
|
||
;; xquery mode | ||
(require 'xquery-mode) | ||
(autoload 'xquery-mode "xquery-mode" "XQuery mode" t ) | ||
(setq auto-mode-alist | ||
(append '(("\\.xqy$" . xquery-mode)) auto-mode-alist)) | ||
; disable scroll bar | ||
(scroll-bar-mode -1) | ||
|
||
(add-to-list 'default-frame-alist '(font . "Source Code Pro 12")) | ||
; eshell prompt | ||
; http://blog.liangzan.net/blog/2012/12/12/customizing-your-emacs-eshell-prompt/ | ||
|
||
(setq eshell-history-size 1024) | ||
(setq eshell-prompt-regexp "^[^#$]*[#$] ") | ||
|
||
(load "em-hist") ; So the history vars are defined | ||
(if (boundp 'eshell-save-history-on-exit) | ||
(setq eshell-save-history-on-exit t)) ; Don't ask, just save | ||
;(message "eshell-ask-to-save-history is %s" eshell-ask-to-save-history) | ||
(if (boundp 'eshell-ask-to-save-history) | ||
(setq eshell-ask-to-save-history 'always)) ; For older(?) version | ||
;(message "eshell-ask-to-save-history is %s" eshell-ask-to-save-history) | ||
|
||
(defun eshell/ef (fname-regexp &rest dir) (ef fname-regexp default-directory)) | ||
|
||
|
||
;;; ---- path manipulation | ||
|
||
(defun pwd-repl-home (pwd) | ||
(interactive) | ||
(let* ((home (expand-file-name (getenv "HOME"))) | ||
(home-len (length home))) | ||
(if (and | ||
(>= (length pwd) home-len) | ||
(equal home (substring pwd 0 home-len))) | ||
(concat "~" (substring pwd home-len)) | ||
pwd))) | ||
|
||
(defun curr-dir-git-branch-string (pwd) | ||
"Returns current git branch as a string, or the empty string if | ||
PWD is not in a git repo (or the git command is not found)." | ||
(interactive) | ||
(when (and (eshell-search-path "git") | ||
(locate-dominating-file pwd ".git")) | ||
(let ((git-output (shell-command-to-string (concat "cd " pwd " && git branch | grep '\\*' | sed -e 's/^\\* //'")))) | ||
(propertize (concat "[" | ||
(if (> (length git-output) 0) | ||
(substring git-output 0 -1) | ||
"(no branch)") | ||
"]") 'face `(:foreground "green")) | ||
))) | ||
|
||
;; battery mode | ||
(display-battery-mode 1) | ||
(setq eshell-prompt-function | ||
(lambda () | ||
(concat | ||
(propertize ((lambda (p-lst) | ||
(if (> (length p-lst) 3) | ||
(concat | ||
(mapconcat (lambda (elm) (if (zerop (length elm)) "" | ||
(substring elm 0 1))) | ||
(butlast p-lst 3) | ||
"/") | ||
"/" | ||
(mapconcat (lambda (elm) elm) | ||
(last p-lst 3) | ||
"/")) | ||
(mapconcat (lambda (elm) elm) | ||
p-lst | ||
"/"))) | ||
(split-string (pwd-repl-home (eshell/pwd)) "/")) 'face `(:foreground "yellow")) | ||
(or (curr-dir-git-branch-string (eshell/pwd))) | ||
(propertize "# " 'face 'default)))) | ||
|
||
;; ox-reveal for revealjs presentations | ||
(require 'ox-reveal) | ||
(setq eshell-highlight-prompt nil) |