diff options
| author | Lukas Fürmetz <fuermetz@mailbox.org> | 2018-11-15 22:36:54 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2018-11-15 22:36:54 +0100 |
| commit | 1dfbd1d5fc3cbd13fe54faccfa6bb2e1880abc9e (patch) | |
| tree | 40e66e706dfd1c05f9dfba698ba216fd733af69c /vterm.el | |
| parent | 141935df5fbd2e4c1dbeaf2bca0d69ab55af5b74 (diff) | |
| parent | df21bcb0e68b781ec13e97f929c9e3bcbc703540 (diff) | |
Merge pull request #32 from jixiuf/support-set-title
support set terminal title .
Diffstat (limited to 'vterm.el')
| -rw-r--r-- | vterm.el | 29 |
1 files changed, 26 insertions, 3 deletions
@@ -61,6 +61,22 @@ value with `add-hook'." :type 'hook :group 'vterm) +(defcustom vterm-set-title-hook nil + "Shell set title hook. + +those functions are called one by one, with 1 arguments. +`vterm-set-title-hook' should be a symbol, a hook variable. +The value of HOOK may be nil, a function, or a list of functions. +for example +(defun vterm--rename-buffer-as-title (title) + (rename-buffer (format \"vterm %s\" title))) +(add-hook 'vterm-set-title-hook 'vterm--rename-buffer-as-title) + +see http://tldp.org/HOWTO/Xterm-Title-4.html about how to set terminal title +for different shell. " + :type 'hook + :group 'vterm) + (defface vterm '((t :inherit default)) "Default face to use in Term mode." @@ -248,8 +264,10 @@ Feeds the size change to the virtual terminal." (defun vterm--delete-lines (line-num count &optional delete-whole-line) - "Delete lines from line-num. If option ‘kill-whole-line’ is non-nil, - then this command kills the whole line including its terminating newline" + "Delete COUNT lines from LINE-NUM. + + If option DELETE-WHOLE-LINE is non-nil, then this command kills + the whole line including its terminating newline" (save-excursion (when (vterm--goto-line line-num) (delete-region (point) (point-at-eol count)) @@ -258,7 +276,7 @@ Feeds the size change to the virtual terminal." (delete-char 1))))) (defun vterm--goto-line(n) - "If move succ return t" + "Go to line N and return true on success." (goto-char (point-min)) (let ((succ (eq 0 (forward-line (1- n))))) succ)) @@ -267,5 +285,10 @@ Feeds the size change to the virtual terminal." "Return the maximum line number." (line-number-at-pos (point-max))) +(defun vterm--set-title (title) + "Run the `vterm--set-title-hook' with TITLE as argument." + (run-hook-with-args 'vterm-set-title-hook title)) + + (provide 'vterm) ;;; vterm.el ends here |
