summaryrefslogtreecommitdiff
path: root/.config/emacs
diff options
context:
space:
mode:
authorLuke Shumaker <lukeshu@sbcglobal.net>2015-08-22 03:51:52 -0400
committerLuke Shumaker <lukeshu@sbcglobal.net>2015-09-22 15:27:18 -0400
commit1ae109d7abae11a327f362bfdfb623ac0ac770e0 (patch)
tree5bf25f17077d4477c4a18a401081493076a8c28a /.config/emacs
parentef71eedb6bcc3889128af24df3aa668dde3e2c6f (diff)
Clean up bash configuration, and bash-emacs integration
Diffstat (limited to '.config/emacs')
-rw-r--r--.config/emacs/init.el26
1 files changed, 26 insertions, 0 deletions
diff --git a/.config/emacs/init.el b/.config/emacs/init.el
index e635b77..90fda1b 100644
--- a/.config/emacs/init.el
+++ b/.config/emacs/init.el
@@ -161,6 +161,32 @@ sh-script.el is broken."
(advice-add 'sh-smie-sh-rules :filter-args
#'sh-smie-sh-rules--fix)
+;; Ideally, figuring this out should be done by uniquify, but I
+;; haven't determined how to get uniquify to think that it manages the
+;; term buffer.
+(defun term-get-short-cwd ()
+ ;; local base=$PWD
+ ;; local suffix=''
+ ;; # The regex here is a list of directory names
+ ;; # that aren't really helpful, and that the
+ ;; # parent directory should be included also.
+ ;; if [[ $base =~ (/(src|pkg|doc|pkg-libre|src-libre|trunk|tags|branches))*$ ]]; then
+ ;; suffix=$BASH_REMATCH
+ ;; base=${base%$suffix}
+ ;; fi
+ ;; base=${base##*/}
+ ;; echo ${base}${suffix}
+ (directory-file-name default-directory))
+(defun term-handle-ansi-terminal-messages--uniquify (args)
+ (rename-buffer (concat
+ (replace-regexp-in-string "<.*>$" "" (buffer-name))
+ "<"
+ (term-get-short-cwd)
+ ">")
+ t))
+(advice-add 'term-handle-ansi-terminal-messages :after
+ #'term-handle-ansi-terminal-messages--uniquify)
+
(require 'go-mode-load nil t)