From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Andreas Politz Newsgroups: gmane.emacs.bugs Subject: bug#15426: 24.3.50; Multibyte filenames and directory-files in unibyte buffer Date: Sat, 21 Sep 2013 11:35:52 +0200 Message-ID: <87a9j6h5zb.fsf@hochschule-trier.de> References: <87ob7nh22t.fsf@hochschule-trier.de> <831u4jl738.fsf@gnu.org> <83wqmbjoat.fsf@gnu.org> <87eh8jgqkp.fsf@hochschule-trier.de> <83vc1uk6ul.fsf@gnu.org> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Trace: ger.gmane.org 1379756236 22707 80.91.229.3 (21 Sep 2013 09:37:16 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sat, 21 Sep 2013 09:37:16 +0000 (UTC) Cc: 15426@debbugs.gnu.org To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sat Sep 21 11:37:19 2013 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1VNJcr-0005Ia-EA for geb-bug-gnu-emacs@m.gmane.org; Sat, 21 Sep 2013 11:37:17 +0200 Original-Received: from localhost ([::1]:59208 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VNJcr-0001fc-0Z for geb-bug-gnu-emacs@m.gmane.org; Sat, 21 Sep 2013 05:37:17 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:51355) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VNJci-0001fI-El for bug-gnu-emacs@gnu.org; Sat, 21 Sep 2013 05:37:13 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VNJcd-0003jM-3w for bug-gnu-emacs@gnu.org; Sat, 21 Sep 2013 05:37:08 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:44498) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VNJcd-0003iK-0h for bug-gnu-emacs@gnu.org; Sat, 21 Sep 2013 05:37:03 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.80) (envelope-from ) id 1VNJcc-0002dt-D0 for bug-gnu-emacs@gnu.org; Sat, 21 Sep 2013 05:37:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Andreas Politz Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 21 Sep 2013 09:37:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 15426 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 15426-submit@debbugs.gnu.org id=B15426.137975617910095 (code B ref 15426); Sat, 21 Sep 2013 09:37:02 +0000 Original-Received: (at 15426) by debbugs.gnu.org; 21 Sep 2013 09:36:19 +0000 Original-Received: from localhost ([127.0.0.1]:52791 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1VNJbu-0002ck-LJ for submit@debbugs.gnu.org; Sat, 21 Sep 2013 05:36:18 -0400 Original-Received: from gateway-a.fh-trier.de ([143.93.54.181]:33248) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1VNJbs-0002cU-1e for 15426@debbugs.gnu.org; Sat, 21 Sep 2013 05:36:16 -0400 X-Virus-Scanned: by Amavisd-new + McAfee uvscan + ClamAV [Rechenzentrum Hochschule Trier] Original-Received: from luca (dslb-178-004-102-077.pools.arcor-ip.net [178.4.102.77]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) (Authenticated sender: politza) by gateway-a.fh-trier.de (Postfix) with ESMTPSA id 1262517592B4; Sat, 21 Sep 2013 11:35:53 +0200 (CEST) Original-Received: from politza by luca with local (Exim 4.72) (envelope-from ) id 1VNJbU-00006E-9U; Sat, 21 Sep 2013 11:35:52 +0200 In-Reply-To: <83vc1uk6ul.fsf@gnu.org> (Eli Zaretskii's message of "Sat, 21 Sep 2013 09:48:50 +0300") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 140.186.70.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:78645 Archived-At: --=-=-= Content-Type: text/plain Eli Zaretskii writes: >> From: Andreas Politz >> >> (let ((d "/tmp/\303\204")) ;; utf-8 for german umlaut "A > > This makes d a unibyte string: > > (setq d "/tmp/\303\204") > "/tmp/\303\204" > > (multibyte-string-p d) > => nil > > Why would one do such a thing in the first place? OK. The thing is that Emacs does it. --=-=-= Content-Type: application/emacs-lisp Content-Disposition: inline; filename=multibyte-directory-list.el Content-Transfer-Encoding: quoted-printable ;; -*- coding: binary -*- ;; Save as .../mb-dir/foo.el, where mb-dir is a filename containing ;; multibytes. (let ((d ;; ../mb-dir/mb-dir/ (file-name-as-directory (expand-file-name (file-name-nondirectory (directory-file-name (file-name-directory (buffer-file-name)))) (file-name-directory (buffer-file-name)))))) (unless (file-exists-p d) (make-directory d)) (append (let ((d1 (car (directory-files (car (directory-files d t)) t)))) (list d1 (file-exists-p d1))) ;; switch to a multibyte buffer (with-temp-buffer (let ((d2 (car (directory-files (car (directory-files d t)) t)))) (list d2 (file-exists-p d1)))))) ;; =3D> (d1 nil d2 t) --=-=-= Content-Type: text/plain If I save this in mb-dir/foo.el, where mb-dir is a directory containing multi-bytes, the results (d1 and d2) of the same calls to `directory-list' are different in the uni-byte and multi-byte buffer. It seems that the 2 byte sequences of the UTF-8 characters are replaced by some 4 bytes. Anyway, the resulting filename d2 names a non-existent file. > "The minibuffer displays" is the key point here:[...] No, the key is that the file's existence depends on the buffer's multi-byte status, in which the code is evaluated. > >> I hope that clarifies it. -ap --=-=-=--