[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [gmane.emacs.bugs] Emacs fails to start properly if the current work
From: |
Stefan Monnier |
Subject: |
Re: [gmane.emacs.bugs] Emacs fails to start properly if the current working directory is on a vfat or ntfs filesystem |
Date: |
Tue, 26 Feb 2008 10:18:43 -0500 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/23.0.60 (gnu/linux) |
> OK, here's a revised patch that accepts only ASCII alphanumerics, -, _, .,
> ~, # and +, and percent encodes all others.
> It's not strict URL encoding, since multibyte characters will be translated
> to more than two hex characters, but as far as I can tell the encoding
> doesn't have to be reversable, just give unique names that don't contain
> invalid characters, so I think it is good enough. On the trunk it is cheap
> and easy to convert to utf-8, so we could properly URL encode them there.
> *** files.el.~1.896.2.38.~ 2008-02-24 16:51:32.796875000 +0000
> --- files.el 2008-02-26 09:27:34.078125000 +0000
> ***************
> *** 4561,4575 ****
> (let ((buffer-name (buffer-name))
> (limit 0)
> file-name)
> ! ;; Eliminate all slashes and backslashes by
> ! ;; replacing them with sequences that start with %.
> ! ;; Quote % also, to keep distinct names distinct.
> ! (while (string-match "[/\\%]" buffer-name limit)
> (let* ((character (aref buffer-name (match-beginning 0)))
> (replacement
> ! (cond ((eq character ?%) "%%")
> ! ((eq character ?/) "%+")
> ! ((eq character ?\\) "%-"))))
> (setq buffer-name (replace-match replacement t t buffer-name))
> (setq limit (1+ (match-end 0)))))
> ;; Generate the file name.
> --- 4561,4576 ----
> (let ((buffer-name (buffer-name))
> (limit 0)
> file-name)
> ! ;; Restrict the characters used in the file name to those which
> ! ;; are known to be safe on all filesystems, url-encoding the
> ! ;; rest.
> ! ;; We do this on all platforms, because even if we are not
> ! ;; running on DOS/Windows, the current directory may be on a
> ! ;; mounted VFAT filesystem, such as a USB memory stick.
> ! (while (string-match "[^A-Za-z0-9-_.~#+]" buffer-name limit)
> (let* ((character (aref buffer-name (match-beginning 0)))
> (replacement
> ! (format "%%%02X" character)))
> (setq buffer-name (replace-match replacement t t buffer-name))
> (setq limit (1+ (match-end 0)))))
> ;; Generate the file name.
Looks good. Feel free to install it on the 22 branch (assuming you've
actually tested it, of course).
Stefan
- Re: [gmane.emacs.bugs] Emacs fails to start properly if the current working directory is on a vfat or ntfs filesystem, (continued)
- Re: [gmane.emacs.bugs] Emacs fails to start properly if the current working directory is on a vfat or ntfs filesystem, Eli Zaretskii, 2008/02/24
- Re: [gmane.emacs.bugs] Emacs fails to start properly if the current working directory is on a vfat or ntfs filesystem, Richard Stallman, 2008/02/24
- Re: [gmane.emacs.bugs] Emacs fails to start properly if the current working directory is on a vfat or ntfs filesystem, Jason Rumney, 2008/02/24
- Re: [gmane.emacs.bugs] Emacs fails to start properly if the current working directory is on a vfat or ntfs filesystem, Richard Stallman, 2008/02/25
- Re: [gmane.emacs.bugs] Emacs fails to start properly if the current working directory is on a vfat or ntfs filesystem, Jason Rumney, 2008/02/25
- Re: [gmane.emacs.bugs] Emacs fails to start properly if the current working directory is on a vfat or ntfs filesystem, Stefan Monnier, 2008/02/25
- Re: [gmane.emacs.bugs] Emacs fails to start properly if the current working directory is on a vfat or ntfs filesystem, Chong Yidong, 2008/02/25
- Re: [gmane.emacs.bugs] Emacs fails to start properly if the current working directory is on a vfat or ntfs filesystem, Stefan Monnier, 2008/02/25
- Re: [gmane.emacs.bugs] Emacs fails to start properly if the current working directory is on a vfat or ntfs filesystem, Jason Rumney, 2008/02/26
- Re: [gmane.emacs.bugs] Emacs fails to start properly if the current working directory is on a vfat or ntfs filesystem, Jason Rumney, 2008/02/26
- Re: [gmane.emacs.bugs] Emacs fails to start properly if the current working directory is on a vfat or ntfs filesystem,
Stefan Monnier <=
- Re: [gmane.emacs.bugs] Emacs fails to start properly if the current working directory is on a vfat or ntfs filesystem, Richard Stallman, 2008/02/24
Re: [gmane.emacs.bugs] Emacs fails to start properly if the current working directory is on a vfat or ntfs filesystem, Richard Stallman, 2008/02/24