Subject: Re: bug#15426: 24.3.50; Multibyte filenames and directory-files in unibyte buffer

From: Andreas Politz <[email-masked]>
Date: Fr, 20 Sep 2013 20:51:09 +0200

Eli Zaretskii <[email-masked]> writes:

> Why did you need to do something like that, and in what real-life use
> case?

By default buffer for PDF files are in unibyte mode.  I use
doc-view-mode and store some custom data in some directory below it's
cache directory, which I want to remove, when the buffer gets killed.
The removing of this directory (e.g. .doc-view/FILENAME-83432/data/) is
done with delete-directory, but fails, if FILENAME contains multibyte
character (see below).  So I am actually not inserting anything into a
buffer.

Debugger entered--Lisp error: (file-error "Removing old name" "no such file or directory" "/home/politza/.emacs.d/.doc-view-cache/\301\203\300\204.pdf-52cb45a94cb1cf895aea4dba33da58be/.pdf-util-cache/pdf-render-temp-file/b5366a2d2ac98dae978423083f8b09e5cddc705d.png")
  delete-file("/home/politza/.emacs.d/.doc-view-cache/\301\203\300\204.pdf-52cb45a94cb1cf895aea4dba33da58be/.pdf-util-cache/pdf-render-temp-file/b5366a2d2ac98dae978423083f8b09e5cddc705d.png" nil)
  #[257 "\301.!@\302=\203.\303.\300\304#\207\305.\304\"\207" [t file-attributes t delete-directory nil delete-file] 5 "\n\n(fn FILE)"]("/home/politza/.emacs.d/.doc-view-cache/\301\203\300\204.pdf-52cb45a94cb1cf895aea4dba33da58be/.pdf-util-cache/pdf-render-temp-file/b5366a2d2ac98dae978423083f8b09e5cddc705d.png")
  mapc(#[257 "\301.!@\302=\203.\303.\300\304#\207\305.\304\"\207" [t file-attributes t delete-directory nil delete-file] 5 "\n\n(fn FILE)"] ("/home/politza/.emacs.d/.doc-view-cache/\301\203\300\204.pdf-52cb45a94cb1cf895aea4dba33da58be/.pdf-util-cache/pdf-render-temp-file/b5366a2d2ac98dae978423083f8b09e5cddc705d.png"))
  delete-directory("/home/politza/.emacs.d/.doc-view-cache/\303\204.pdf-52cb45a94cb1cf895aea4dba33da58be/.pdf-util-cache/pdf-render-temp-file" t nil)
  #[257 "\301.!@\302=\203.\303.\300\304#\207\305.\304\"\207" [t file-attributes t delete-directory nil delete-file] 5 "\n\n(fn FILE)"]("/home/politza/.emacs.d/.doc-view-cache/\303\204.pdf-52cb45a94cb1cf895aea4dba33da58be/.pdf-util-cache/pdf-render-temp-file")
  mapc(#[257 "\301.!@\302=\203.\303.\300\304#\207\305.\304\"\207" [t file-attributes t delete-directory nil delete-file] 5 "\n\n(fn FILE)"] ("/home/politza/.emacs.d/.doc-view-cache/\303\204.pdf-52cb45a94cb1cf895aea4dba33da58be/.pdf-util-cache/pdf-render-temp-file"))
  delete-directory("/home/politza/.emacs.d/.doc-view-cache/Ä.pdf-52cb45a94cb1cf895aea4dba33da58be/.pdf-util-cache/" t)
  (progn (delete-directory dir t))
  (if (and dir (file-exists-p dir)) (progn (delete-directory dir t)))
  (let ((dir (pdf-util-cache--get-root-dir))) (if (and dir (file-exists-p dir)) (progn (delete-directory dir t))))
  pdf-util-cache-clear-all()
  kill-buffer("Ä.pdf")
  call-interactively(kill-buffer nil nil)
  command-execute(kill-buffer)

-ap