diff options
| author | Michael Albinus | 2016-02-18 13:58:12 +0100 |
|---|---|---|
| committer | Michael Albinus | 2016-02-18 13:58:12 +0100 |
| commit | 466fc43182d1677c107856d4752ef4b6812baefe (patch) | |
| tree | 2a864f52998f7435f4aff79a15d3b67bce7afba6 /doc/misc | |
| parent | 5a0472e8ea9128f75bca04f5f65682ae8280c208 (diff) | |
| download | emacs-466fc43182d1677c107856d4752ef4b6812baefe.tar.gz emacs-466fc43182d1677c107856d4752ef4b6812baefe.zip | |
Reference `tramp-theme' in GNU ELPA.
* doc/misc/tramp.texi (Frequently Asked Questions):
Reference `tramp-theme' in GNU ELPA.
Diffstat (limited to 'doc/misc')
| -rw-r--r-- | doc/misc/tramp.texi | 69 |
1 files changed, 6 insertions, 63 deletions
diff --git a/doc/misc/tramp.texi b/doc/misc/tramp.texi index 294a3a9ecdf..0eb7334e84b 100644 --- a/doc/misc/tramp.texi +++ b/doc/misc/tramp.texi | |||
| @@ -2913,70 +2913,13 @@ the following code in @file{~/.emacs} file. | |||
| 2913 | 2913 | ||
| 2914 | 2914 | ||
| 2915 | @item | 2915 | @item |
| 2916 | How to get a Visual Warning when working with @samp{root} privileges | 2916 | How to get a Visual Warning when working with @samp{root} privileges? |
| 2917 | Host indication in the mode line? | ||
| 2917 | 2918 | ||
| 2918 | Get a modeline indication when working with @samp{root} privileges | 2919 | Install @file{tramp-theme} from GNU ELPA via Emacs' Package Manager. |
| 2919 | with the following code (tested with Emacs 22.1) in @file{~/.emacs} | 2920 | Enable it via @kbd{M-x load-theme @key{RET} tramp}. Further |
| 2920 | file: | 2921 | customization is explained in variable |
| 2921 | 2922 | @code{tramp-theme-face-remapping-alist}. | |
| 2922 | @lisp | ||
| 2923 | (defun my-mode-line-function () | ||
| 2924 | (when (string-match "^/su\\(do\\)?:" default-directory) | ||
| 2925 | (setq mode-line-format | ||
| 2926 | (format-mode-line mode-line-format 'font-lock-warning-face)))) | ||
| 2927 | |||
| 2928 | (add-hook 'find-file-hook 'my-mode-line-function) | ||
| 2929 | (add-hook 'dired-mode-hook 'my-mode-line-function) | ||
| 2930 | @end lisp | ||
| 2931 | |||
| 2932 | |||
| 2933 | @item | ||
| 2934 | How to get host indication in the mode line? | ||
| 2935 | |||
| 2936 | The following code (tested with Emacs 22.1) in @file{~/.emacs} file | ||
| 2937 | shows it: | ||
| 2938 | |||
| 2939 | @lisp | ||
| 2940 | (defconst my-mode-line-buffer-identification | ||
| 2941 | (list | ||
| 2942 | '(:eval | ||
| 2943 | (let ((host-name | ||
| 2944 | (if (file-remote-p default-directory) | ||
| 2945 | (tramp-file-name-host | ||
| 2946 | (tramp-dissect-file-name default-directory)) | ||
| 2947 | (system-name)))) | ||
| 2948 | (if (string-match "^[^0-9][^.]*\\(\\..*\\)" host-name) | ||
| 2949 | (substring host-name 0 (match-beginning 1)) | ||
| 2950 | host-name))) | ||
| 2951 | ": %12b")) | ||
| 2952 | |||
| 2953 | (setq-default | ||
| 2954 | mode-line-buffer-identification | ||
| 2955 | my-mode-line-buffer-identification) | ||
| 2956 | |||
| 2957 | (add-hook | ||
| 2958 | 'dired-mode-hook | ||
| 2959 | (lambda () | ||
| 2960 | (setq | ||
| 2961 | mode-line-buffer-identification | ||
| 2962 | my-mode-line-buffer-identification))) | ||
| 2963 | @end lisp | ||
| 2964 | |||
| 2965 | The mode line in Emacs 23.1 and later versions now contains an | ||
| 2966 | indication if @code{default-directory} for the current buffer is on a | ||
| 2967 | remote host. Moreover, the corresponding tool-tip shows the remote | ||
| 2968 | host name. The above @code{:eval} clause can also be simplified to | ||
| 2969 | show the host name in the mode line: | ||
| 2970 | |||
| 2971 | @lisp | ||
| 2972 | '(:eval | ||
| 2973 | (let ((host-name | ||
| 2974 | (or (file-remote-p default-directory 'host) | ||
| 2975 | (system-name)))) | ||
| 2976 | (if (string-match "^[^0-9][^.]*\\(\\..*\\)" host-name) | ||
| 2977 | (substring host-name 0 (match-beginning 1)) | ||
| 2978 | host-name))) | ||
| 2979 | @end lisp | ||
| 2980 | 2923 | ||
| 2981 | 2924 | ||
| 2982 | @item | 2925 | @item |