浏览代码

add function set-terminal-header

pull/1/head
10sr 10 年前
父节点
当前提交
03a29a3340
共有 2 个文件被更改,包括 34 次插入1 次删除
  1. +32
    -1
      emacs.el
  2. +2
    -0
      shrc

+ 32
- 1
emacs.el 查看文件

@@ -2410,7 +2410,38 @@ this is test, does not rename files."
(yank)
(text-mode)
(current-local-map)
(goto-char (point-min)))))
(goto-char (point-min))
(yank)
(current-buffer))))

(defun set-terminal-header (string)
"Set terminal header STRING."
(let ((point (point))
(movecursor "\033[0;%dH")
(inverse "\033[7m")
(restore "\033[0m")
(cols (frame-parameter nil 'width))
(length (length string)))
(send-string-to-terminal (concat (format movecursor
(1+ (- cols length)))
inverse
string
restore))
(goto-char point)
(redraw-frame (current-frame))))

(run-with-idle-timer
1
t
(lambda ()
(set-terminal-header (concat " "
user-login-name
"@"
(car (split-string system-name
"\\."))
" "
(format-time-string "%Y/%m/%d %T %z")
" "))))

;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; ;; savage emacs


+ 2
- 0
shrc 查看文件

@@ -1248,8 +1248,10 @@ __my_set_header_line(){
printf "\033[0;0H"
# clear curent to eol
printf "\033[K"
# inverse color
printf "\033[7m"
printf "$1"
# restore color
printf "\033[0m"
# restore saved position
printf "\033[u"


正在加载...
取消
保存