Sfoglia il codice sorgente

add function set-terminal-header

pull/1/head
10sr 10 anni fa
parent
commit
03a29a3340
2 ha cambiato i file con 34 aggiunte e 1 eliminazioni
  1. +32
    -1
      emacs.el
  2. +2
    -0
      shrc

+ 32
- 1
emacs.el Vedi File

@@ -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 Vedi File

@@ -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"


Caricamento…
Annulla
Salva