all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Michael Albinus <michael.albinus@gmx.de>
To: emacs-devel@gnu.org
Subject: Re: Tramp and `dired-listing-switches'
Date: Fri, 08 Dec 2023 10:35:32 +0100	[thread overview]
Message-ID: <878r65nijf.fsf@gmx.de> (raw)
In-Reply-To: <8734we5aom.fsf@dataswamp.org> (Emanuel Berg's message of "Thu, 07 Dec 2023 15:50:17 +0100")

Emanuel Berg <incal@dataswamp.org> writes:

Hi Emanuel,

> I'd like one setting for `dired-listing-switches' locally on
> Debian and one remotely with Tramp, on an OpenBSD system.
>
> If I use Tramp with the Debian setting (below), and list files
> on the remote server I don't get any listing since the options
> does not compute on what is another ls(1), not GNU ls but the BSD
> (OpenBSD?) one.

The canonical way to achieve this are connection-local
variables. Unfortunately, dired does not support them (shell we extend
this?). Therefore, the Tramp manual describes an alternative:

--8<---------------cut here---------------start------------->8---
   • Remote host does not understand default options for directory
     listing

     Emacs computes the ‘dired’ options based on the local host but if
     the remote host cannot understand the same ‘ls’ command, then set
     them with a hook as follows:

          (add-hook
           'dired-before-readin-hook
           (lambda ()
             (when (file-remote-p default-directory)
               (setq dired-actual-switches "-al"))))
--8<---------------cut here---------------end--------------->8---

You might extend the lambda to check for the host name in
default-directory, and apply this only for matching hosts. Something
like

--8<---------------cut here---------------start------------->8---
(when (string-equal (file-remote-p default-directory 'host) "machine.example")
--8<---------------cut here---------------end--------------->8---

Best regards, Michael.



  reply	other threads:[~2023-12-08  9:35 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-12-07 14:50 Tramp and `dired-listing-switches' Emanuel Berg
2023-12-08  9:35 ` Michael Albinus [this message]
2023-12-08 11:59   ` Eli Zaretskii
2023-12-08 12:08     ` Michael Albinus
2023-12-10 11:43       ` Michael Albinus
2023-12-12 20:07         ` Emanuel Berg
2023-12-13  7:13           ` Michael Albinus
2023-12-17 20:05             ` Emanuel Berg
2023-12-18  9:11               ` Michael Albinus
2023-12-17 20:23             ` Emanuel Berg
2023-12-09 14:29   ` Emanuel Berg
2023-12-09 15:33     ` tomas
2023-12-09 15:49       ` Emanuel Berg
2023-12-09 16:10         ` Emanuel Berg
2023-12-09 16:53           ` Emanuel Berg
2023-12-09 17:12             ` Emanuel Berg
2023-12-09 16:14         ` Emanuel Berg
2023-12-09 17:39         ` Michael Albinus
2023-12-10  5:23           ` Emanuel Berg
2023-12-10 11:25         ` Benjamin Riefenstahl
2023-12-10 11:48           ` tomas
2023-12-12 20:15             ` Emanuel Berg
2023-12-18  3:44 ` Emanuel Berg
2024-01-09  5:22   ` Emanuel Berg

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=878r65nijf.fsf@gmx.de \
    --to=michael.albinus@gmx.de \
    --cc=emacs-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.