This one's a little weird and I don't开发者_StackOverflow want to mess with it if someone else has already found the answer. On OS/X (observed in Snow Leopard and Lion) EMACS 23.3, when I attempt to dired my dropbox directory, I get the following error in ls-lisp-insert-directory
ls-lisp-insert-directory: Format specifier doesn't match argument type
it works fine on other directories through.
Any ideas?
There are some odd "files" in the "file-alist" returned for Dropbox directories by the "ls-lisp-insert-directory" function (in "ls-lisp.el") that don't have all the "normal" file attributes. This causes the error that you're encountering. You should report this to the GNU Emacs development list so that it can be fixed properly. In the meantime, you can work around this by cloning the "ls-lisp-insert-directory" function in your Emacs init file and by adding the following "or" code to the existing "setq" assignments for "fuid", "fgid", and "file-size" (the "or" ensures that the values are initialized to "" or 0 in the scenario where the value is nil - since this code is only trying to find the largest values, it's fine to do this) as follows:
;; Find the appropriate format for displaying uid, gid, and
;; file size, by finding the longest strings among all the
;; files we are about to display.
(dolist (elt file-alist)
(setq attr (cdr elt)
fuid (or (nth 2 attr) "")
uid-len (if (stringp fuid) (string-width fuid)
(length (format "%d" fuid)))
fgid (or (nth 3 attr) "")
gid-len (if (stringp fgid) (string-width fgid)
(length (format "%d" fgid)))
file-size (or (nth 7 attr) 0))
(if (> uid-len max-uid-len)
You will need to ensure that you
(require 'ls-lisp)
before the redefinition of the "ls-lisp-insert-directory" function.
精彩评论