How to determine if current buffer is tramp buffer in Emacs

Tramp is Emacs’ way to access remote files, e.g. via SSH. To determine if the current buffer is accessing a tramp file (e.g. to not try to run gtags or similar), try this:

(not (tramp-tramp-file-p (buffer-file-name (current-buffer))))

Leave a Reply

Your email address will not be published.