title: How to get the home directory of a login for a buffer in emacs using elisp?
body: <p>I want a uniform way to get the home directory path. For both normal buffers and those loaded via tramp.
  I am trying to make comint for shell use the history file in the login for a buffer. ie local file if normal buffers, and remote file for tramp buffers.</p>
  
  <pre class="lang-lisp prettyprint-override"><code>    (add-hook 'shell-mode-hook 'my-shell-mode-hook)
        (defun my-shell-mode-hook ()
          (setq comint-input-ring-file-name
                (substitute-in-file-name "~/.zsh_history"))
          ;; Ignore timestamps in history file.  Assumes that zsh
          ;; EXTENDED_HISTORY option is in use.
          (setq comint-input-ring-separator "\n: \\([0-9]+\\):\\([0-9]+\\);")
          (comint-read-input-ring t))
  </code></pre>