eri*_*icx 13 emacs freebsd emacs24
自从升级到emacs 24.x我每次打开目录时都看到了这个错误.整个错误是:
ls does not support --dired; see `dired-use-ls-dired' for more details.
Run Code Online (Sandbox Code Playgroud)
查看变量,可以发现:
dired-use-ls-dired is a variable defined in `dired.el'.
Its value is nil
Original value was unspecified
Documentation:
Non-nil means Dired should pass the "--dired" option to "ls".
The special value of `unspecified' means to check explicitly, and
save the result in this variable. This is performed the first
time `dired-insert-directory' is called.
Note that if you set this option to nil, either through choice or
because your "ls" program does not support "--dired", Dired
will fail to parse some "unusual" file names, e.g. those with leading
spaces. You might want to install ls from GNU Coreutils, which does
support this option. Alternatively, you might want to use Emacs's
own emulation of "ls", by using:
(setq ls-lisp-use-insert-directory-program nil)
(require 'ls-lisp)
This is used by default on MS Windows, which does not have an "ls" program.
Note that `ls-lisp' does not support as many options as GNU ls, though.
For more details, see Info node `(emacs)ls in Lisp'.
You can customize this variable.
Run Code Online (Sandbox Code Playgroud)
我在FreeBSD上运行; 所以默认ls不是GNU'ish并且不提供--dired选项.我真的不想在我的所有服务器上安装GNU coreutilities.
有人对ls上面提到的lisp 替代品有任何经验吗?
大概dired.el是dired-use-ls-dired在加载时设置为非零的东西,并且在我第一次查看目录时我会不断地破坏它?dired-use-ls-dired在我的设置为零.emacs将安静的消息?
有没有人认为不能直接上班可能代表安全问题?即由空白组成的文件名是否仍然不可见?
也许我应该测试上面的一些......
当支持linux操作系统时,macOS命令ls不支持--dired选项!
(when (string= system-type "darwin")
(setq dired-use-ls-dired nil))
Run Code Online (Sandbox Code Playgroud)
在这种情况下,您也可以尝试使用 gnu-ls,您可以安装此实用程序,请看这里how-to-replace-mac-os-x-utilities-with-gnu-core-utilities
在我的情况下,我同时维护,并且 gnu 核心实用程序以“g”为前缀。
如果您使用 gls,则启用 --dired 参数
man gls
Run Code Online (Sandbox Code Playgroud)
NAME ls - 列出目录内容
概要 ls [选项]... [文件]...
描述 列出有关文件的信息(默认为当前目录)。如果未指定 -cftuvSUX 或 --sort,则按字母顺序对条目进行排序。
Run Code Online (Sandbox Code Playgroud)Mandatory arguments to long options are mandatory for short options too. .... -d, --directory list directories themselves, not their contents ....
which gls
/usr/local/bin/gls
Run Code Online (Sandbox Code Playgroud)
然后我们也配置了 emacs:
(when (string= system-type "darwin")
(setq dired-use-ls-dired t
insert-directory-program "/usr/local/bin/gls"
dired-listing-switches "-aBhl --group-directories-first"))
Run Code Online (Sandbox Code Playgroud)
然后你可以使用这个:
大概 dired.el 在加载时将 dired-use-ls-dired 设置为非零,并且我在第一次查看目录时不断地破坏它?在我的 .emacs 中将 dired-use-ls-dired 设置为 nil 会使该消息安静吗?
我认为你说的是正确的。将值自定义为nil. (如果这没有帮助,您可以随时删除您的自定义。)
| 归档时间: |
|
| 查看次数: |
3968 次 |
| 最近记录: |