{"action":"opened","issue":{"url":"https://api.github.com/repos/syl20bnr/spacemacs/issues/2386","labels_url":"https://api.github.com/repos/syl20bnr/spacemacs/issues/2386/labels{/name}","comments_url":"https://api.github.com/repos/syl20bnr/spacemacs/issues/2386/comments","events_url":"https://api.github.com/repos/syl20bnr/spacemacs/issues/2386/events","html_url":"https://github.com/syl20bnr/spacemacs/issues/2386","id":96896981,"number":2386,"title":"Highlight remote buffer name in mode line","user":{"login":"izahn","id":321235,"avatar_url":"https://avatars.githubusercontent.com/u/321235?v=3","gravatar_id":"","url":"https://api.github.com/users/izahn","html_url":"https://github.com/izahn","followers_url":"https://api.github.com/users/izahn/followers","following_url":"https://api.github.com/users/izahn/following{/other_user}","gists_url":"https://api.github.com/users/izahn/gists{/gist_id}","starred_url":"https://api.github.com/users/izahn/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/izahn/subscriptions","organizations_url":"https://api.github.com/users/izahn/orgs","repos_url":"https://api.github.com/users/izahn/repos","events_url":"https://api.github.com/users/izahn/events{/privacy}","received_events_url":"https://api.github.com/users/izahn/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2015-07-23T20:19:19Z","updated_at":"2015-07-23T20:19:19Z","closed_at":null,"body":"I'm a long-time emacs user, using spacemacs for only a couple of days. So far I miss very little from my old emacs configuration, and am really impressed with spacemacs.\r\n\r\nOne small thing I do miss is highlighting remote buffers in the mode-line. This way if you are visiting a remote file with the same name as a local file you are also visiting you never get confused about which is which. \r\n\r\nI tried adding the relevant bit from my old config so I could submit this as a pull request, but I couldn't figure out where/how exactly the mode line is configured in spacemacs. The relevant bit from my config are below. The important bits are defining the format string (`(defconst my-mode-line-buffer-identification ...`) and adding `(powerline-raw my-mode-line-buffer-identification nil 'l)` to the `(lhs (list ...` in `mode-line-format`.\r\n\r\nIf someone can point me toward the entry point for modifying the mode-line in spacemacs I'll be happy to submit a PR, or feel free to grab anything useful from the code below if you want to implement this in spacemacs.\r\n\r\nThanks.\r\n\r\n```elisp\r\n;; face for remote files in modeline\r\n(defface my-mode-line-attention\r\n'((t (:foreground \"magenta\" :weight bold)))\r\n \"face for calling attention to modeline\")\r\n\r\n;; highlight hostname if on remote\r\n(defconst my-mode-line-buffer-identification\r\n  '(:eval\r\n    (list\r\n     (propertize\r\n      (if (file-remote-p default-directory 'host)\r\n          (progn\r\n      (let ((host-name\r\n             (or (file-remote-p default-directory 'host)\r\n                 (system-name))))\r\n        (if (string-match \"^[^0-9][^.]*\\\\(\\\\..*\\\\)\" host-name)\r\n            (substring host-name 0 (match-beginning 1))\r\n          host-name)))\r\n        \"\")\r\n      'face\r\n      (if (file-remote-p default-directory 'host)\r\n          'my-mode-line-attention\r\n        'mode-line-buffer-id))\r\n   (propertize \": %b\"\r\n               'face\r\n                 (if (file-remote-p default-directory 'host)\r\n                     'my-mode-line-attention\r\n                   'mode-line-buffer-id)))))\r\n\r\n;; powerline theme using above info about remote hosts.\r\n(defun powerline-my-theme ()\r\n  \"Setup the default mode-line.\"\r\n  (interactive)\r\n  (setq-default mode-line-format\r\n                '(\"%e\"\r\n                  (:eval\r\n                   (let* ((active (powerline-selected-window-active))\r\n                          (mode-line (if active 'mode-line 'mode-line-inactive))\r\n                          (face1 (if active 'powerline-active1 'powerline-inactive1))\r\n                          (face2 (if active 'powerline-active2 'powerline-inactive2))\r\n                          (separator-left (intern (format \"powerline-%s-%s\"\r\n                                                          powerline-default-separator\r\n                                                          (car powerline-default-separator-dir))))\r\n                          (separator-right (intern (format \"powerline-%s-%s\"\r\n                                                           powerline-default-separator\r\n                                                           (cdr powerline-default-separator-dir))))\r\n                          (lhs (list (powerline-raw \"%*\" nil 'l)\r\n                                     (powerline-buffer-size nil 'l)\r\n                                     (powerline-raw mode-line-mule-info nil 'l)\r\n                                     (powerline-raw mode-line-remote nil 'l)\r\n                                     (powerline-raw my-mode-line-buffer-identification nil 'l)\r\n                                     (when (and (boundp 'which-func-mode) which-func-mode)\r\n                                       (powerline-raw which-func-format nil 'l))\r\n                                     (powerline-raw \" \")\r\n                                     (funcall separator-left mode-line face1)\r\n                                     (when (boundp 'erc-modified-channels-object)\r\n                                       (powerline-raw erc-modified-channels-object face1 'l))\r\n                                     (powerline-major-mode face1 'l)\r\n                                     (powerline-process face1)\r\n                                     (powerline-minor-modes face1 'l)\r\n                                     (powerline-narrow face1 'l)\r\n                                     (powerline-raw \" \" face1)\r\n                                     (funcall separator-left face1 face2)\r\n                                     (powerline-vc face2 'r)))\r\n                          (rhs (list (powerline-raw global-mode-string face2 'r)\r\n                                     (funcall separator-right face2 face1)\r\n                                     (powerline-raw \"%4l\" face1 'l)\r\n                                     (powerline-raw \":\" face1 'l)\r\n                                     (powerline-raw \"%3c\" face1 'r)\r\n                                     (funcall separator-right face1 mode-line)\r\n                                     (powerline-raw \" \")\r\n                                     (powerline-raw \"%6p\" nil 'r)\r\n                                     (powerline-hud face2 face1))))\r\n                     (concat (powerline-render lhs)\r\n                             (powerline-fill face2 (powerline-width rhs))\r\n                             (powerline-render rhs)))))))\r\n\r\n(powerline-my-theme)\r\n```\r\n\r\n"}}