emacs-devel
[Top][All Lists]
Advanced

[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: Jason Rumney
Subject: Re: [gmane.emacs.bugs] Emacs fails to start properly if the current working directory is on a vfat or ntfs filesystem
Date: Mon, 25 Feb 2008 23:58:12 +0000
User-agent: Thunderbird 2.0.0.9 (Windows/20071031)

Richard Stallman wrote:
# is not the problem, at least for vfat and ntfs filesystems. The problem that was reported was with the *s in #*scratch*#12345xyz#.

I see.  So it is a matter of changing certain chars when they appear
in buffer names.  That seems harmless; make-auto-save-file-name
already does some such transformations.  There's no harm adding more.

Here is a patch against EMACS_22_BASE. Chong, Stefan, is it OK to check this in now, or do you want to leave the branch until after 22.2 is released and only fix it in the trunk now.


*** files.el.~1.896.2.38.~      2008-02-24 16:51:32.796875000 +0000
--- files.el    2008-02-25 23:54:34.618303900 +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,4593 ----
      (let ((buffer-name (buffer-name))
          (limit 0)
          file-name)
!       ;; Eliminate all slashes, backslashes, wildcards and other
!       ;; characters that are not valid in VFAT/NTFS filesystems.
        ;; Quote % also, to keep distinct names distinct.
!       ;; 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 "[/\\%?*:<>|\"\000-\037]" buffer-name limit)
        (let* ((character (aref buffer-name (match-beginning 0)))
               (replacement
                (cond ((eq character ?%) "%%")
                      ((eq character ?/) "%+")
!                     ((eq character ?\\) "%-")
!                     ((eq character ??) "%!")
!                     ((eq character ?*) "%#")
!                     ((eq character ?\") "%'")
!                     ((eq character ?<) "%(")
!                     ((eq character ?>) "%)")
!                     ((eq character ?|) "%_")
!                     ((eq character ?:) "%;")
!                     ;; Control characters. ^@ to ^Z match their standard
!                     ;; mappings (ie ^A is represented as %A)
!                     ((< character 27) (concat "%" (+ character ?@)))
!                     ;; The last few are a bit arbitrary, since the standard
!                     ;; notation uses invalid characters and characters we
!                     ;; have already used above.
!                     ((< character 32)
!                      (concat "%" (+ (- character 27) ?0))))))
          (setq buffer-name (replace-match replacement t t buffer-name))
          (setq limit (1+ (match-end 0)))))
        ;; Generate the file name.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]