summaryrefslogtreecommitdiff
path: root/.config/emacs/init.el
diff options
context:
space:
mode:
authorLuke Shumaker <shumakl@purdue.edu>2015-09-22 15:29:32 -0400
committerLuke Shumaker <shumakl@purdue.edu>2015-09-22 15:29:32 -0400
commit8f8b4b4954c103aec63d836c99de01f31c887136 (patch)
tree4660e476de9b2fdee6374f8b51243355fcb65912 /.config/emacs/init.el
parent5c22284424454bbb89372399bda4ca0aef2f1f7c (diff)
parent6fd75fa99cc547ed9b9aa3657d698ac9552cc7f9 (diff)
Merge branch 'master' into purdue-cs/master
Diffstat (limited to '.config/emacs/init.el')
-rw-r--r--.config/emacs/init.el32
1 files changed, 30 insertions, 2 deletions
diff --git a/.config/emacs/init.el b/.config/emacs/init.el
index e14d0f5..90fda1b 100644
--- a/.config/emacs/init.el
+++ b/.config/emacs/init.el
@@ -149,7 +149,8 @@
"Use spaces for alignment"
(let ((indent-tabs-mode nil))
(apply orig-fun args)))
-(advice-add 'align-regexp :around #'align-regexp--use-spaces)
+(advice-add 'align-regexp :around
+ #'align-regexp--use-spaces)
(defun sh-smie-sh-rules--fix (args)
"Replace :after \"then\" with :after \"if\" because Emacs 24
@@ -157,7 +158,34 @@ sh-script.el is broken."
(if (equal args (list :after "then"))
(list :after "if")
args))
-(advice-add 'sh-smie-sh-rules :filter-args #'sh-smie-sh-rules--fix)
+(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)