emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Tramp and `dired-listing-switches'


From: Emanuel Berg
Subject: Tramp and `dired-listing-switches'
Date: Thu, 07 Dec 2023 15:50:17 +0100
User-agent: Gnus/5.13 (Gnus v5.13)

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.

[ OT: I never understood if all BSDs use the same toolchain or
  if they have different tools as well, if anyone knows that? ]

Anyway, I wrote this to cycle between sets of
`dired-listing-switches' options. Optimally, it would be done
automatically so one don't have to strike the command.
Maybe one can use `tramp-bsd-unames' and
`tramp-check-remote-uname' to automate it.

Cycling the sets works, but I don't know if that method is the
cleanest way to do it. It uses a lexical let-closure and
`setf', `cdr' and `last' to make it circular.

Also, after cycling, how can I revert the the dired buffer?
`revert-buffer' doesn't seem to do it, nothing happens, but
cycling the option, then killing the buffer and revisiting
it, works. Files are displayed with the new set in play.

(setq dired-listing-switches
  "-AGlX --group-directories-first -I \"*.meta\" -I \"#*#\" -I \"*.elc\"")

(let*((dired-ls-opts (list dired-listing-switches "-Al"))
      (_ (setf (cdr (last dired-ls-opts)) dired-ls-opts)) )
  (defun dired-ls-opts-cycle ()
    (interactive)
    (setq dired-listing-switches (pop dired-ls-opts)) )
  (declare-function dired-ls-opts-cycle nil)
  (defalias 'lc #'dired-ls-opts-cycle) )

-- 
underground experts united
https://dataswamp.org/~incal




reply via email to

[Prev in Thread] Current Thread [Next in Thread]