diff options
| author | Michael Albinus | 2011-10-12 20:32:35 +0200 |
|---|---|---|
| committer | Michael Albinus | 2011-10-12 20:32:35 +0200 |
| commit | 28dbc92f2ca5d862a9e517dca1ff11a4396b12f8 (patch) | |
| tree | 9060be635cd80fd582b9da60ee3a3f71df56babb | |
| parent | e1a3f5b1c846da7e304db52d81d011c875cbdd8e (diff) | |
| download | emacs-28dbc92f2ca5d862a9e517dca1ff11a4396b12f8.tar.gz emacs-28dbc92f2ca5d862a9e517dca1ff11a4396b12f8.zip | |
Fix Bug#6019, Bug#9315.
* files.el (set-auto-mode): Call `file-name-sans-versions' for the
complete `buffer-file-name', the local file name part could look
remotely (for example on VMS).
* net/ange-ftp.el (ange-ftp-run-real-handler): Make it an alias of
`tramp-run-real-handler'.
(ange-ftp-fix-name-for-vms): Handle the case, where `name' is
already quoted by '"'.
* net/tramp.el (tramp-rfn-eshadow-update-overlay): Ignore errors.
Let `file-name-handler-alist' be nil, the local file name part
could look remotely (for example on VMS).
| -rw-r--r-- | lisp/ChangeLog | 17 | ||||
| -rw-r--r-- | lisp/files.el | 4 | ||||
| -rw-r--r-- | lisp/net/ange-ftp.el | 28 | ||||
| -rw-r--r-- | lisp/net/tramp.el | 40 |
4 files changed, 58 insertions, 31 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 58a038676e7..62d7cc449ab 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,3 +1,20 @@ | |||
| 1 | 2011-10-12 Michael Albinus <michael.albinus@gmx.de> | ||
| 2 | |||
| 3 | Fix Bug#6019, Bug#9315. | ||
| 4 | |||
| 5 | * files.el (set-auto-mode): Call `file-name-sans-versions' for the | ||
| 6 | complete `buffer-file-name', the local file name part could look | ||
| 7 | remotely (for example on VMS). | ||
| 8 | |||
| 9 | * net/ange-ftp.el (ange-ftp-run-real-handler): Make it an alias of | ||
| 10 | `tramp-run-real-handler'. | ||
| 11 | (ange-ftp-fix-name-for-vms): Handle the case, where `name' is | ||
| 12 | already quoted by '"'. | ||
| 13 | |||
| 14 | * net/tramp.el (tramp-rfn-eshadow-update-overlay): Ignore errors. | ||
| 15 | Let `file-name-handler-alist' be nil, the local file name part | ||
| 16 | could look remotely (for example on VMS). | ||
| 17 | |||
| 1 | 2011-10-12 Stefan Monnier <monnier@iro.umontreal.ca> | 18 | 2011-10-12 Stefan Monnier <monnier@iro.umontreal.ca> |
| 2 | 19 | ||
| 3 | * textmodes/flyspell.el (flyspell-word): Move with-local-quit | 20 | * textmodes/flyspell.el (flyspell-word): Move with-local-quit |
diff --git a/lisp/files.el b/lisp/files.el index 8b05b62e524..6321cff91fd 100644 --- a/lisp/files.el +++ b/lisp/files.el | |||
| @@ -2629,12 +2629,12 @@ we don't actually set it to the same mode the buffer already has." | |||
| 2629 | (if buffer-file-name | 2629 | (if buffer-file-name |
| 2630 | (let ((name buffer-file-name) | 2630 | (let ((name buffer-file-name) |
| 2631 | (remote-id (file-remote-p buffer-file-name))) | 2631 | (remote-id (file-remote-p buffer-file-name))) |
| 2632 | ;; Remove backup-suffixes from file name. | ||
| 2633 | (setq name (file-name-sans-versions name)) | ||
| 2632 | ;; Remove remote file name identification. | 2634 | ;; Remove remote file name identification. |
| 2633 | (when (and (stringp remote-id) | 2635 | (when (and (stringp remote-id) |
| 2634 | (string-match (regexp-quote remote-id) name)) | 2636 | (string-match (regexp-quote remote-id) name)) |
| 2635 | (setq name (substring name (match-end 0)))) | 2637 | (setq name (substring name (match-end 0)))) |
| 2636 | ;; Remove backup-suffixes from file name. | ||
| 2637 | (setq name (file-name-sans-versions name)) | ||
| 2638 | (while name | 2638 | (while name |
| 2639 | ;; Find first matching alist entry. | 2639 | ;; Find first matching alist entry. |
| 2640 | (setq mode | 2640 | (setq mode |
diff --git a/lisp/net/ange-ftp.el b/lisp/net/ange-ftp.el index 41716dbdacd..488a4fdb976 100644 --- a/lisp/net/ange-ftp.el +++ b/lisp/net/ange-ftp.el | |||
| @@ -4412,14 +4412,16 @@ NEWNAME should be the name to give the new compressed or uncompressed file.") | |||
| 4412 | ;;; Define ways of getting at unmodified Emacs primitives, | 4412 | ;;; Define ways of getting at unmodified Emacs primitives, |
| 4413 | ;;; turning off our handler. | 4413 | ;;; turning off our handler. |
| 4414 | 4414 | ||
| 4415 | (defun ange-ftp-run-real-handler (operation args) | 4415 | ;(defun ange-ftp-run-real-handler (operation args) |
| 4416 | (let ((inhibit-file-name-handlers | 4416 | ; (let ((inhibit-file-name-handlers |
| 4417 | (cons 'ange-ftp-hook-function | 4417 | ; (cons 'ange-ftp-hook-function |
| 4418 | (cons 'ange-ftp-completion-hook-function | 4418 | ; (cons 'ange-ftp-completion-hook-function |
| 4419 | (and (eq inhibit-file-name-operation operation) | 4419 | ; (and (eq inhibit-file-name-operation operation) |
| 4420 | inhibit-file-name-handlers)))) | 4420 | ; inhibit-file-name-handlers)))) |
| 4421 | (inhibit-file-name-operation operation)) | 4421 | ; (inhibit-file-name-operation operation)) |
| 4422 | (apply operation args))) | 4422 | ; (apply operation args))) |
| 4423 | |||
| 4424 | (defalias 'ange-ftp-run-real-handler 'tramp-run-real-handler) | ||
| 4423 | 4425 | ||
| 4424 | (defun ange-ftp-real-file-name-directory (&rest args) | 4426 | (defun ange-ftp-real-file-name-directory (&rest args) |
| 4425 | (ange-ftp-run-real-handler 'file-name-directory args)) | 4427 | (ange-ftp-run-real-handler 'file-name-directory args)) |
| @@ -5005,7 +5007,11 @@ NEWNAME should be the name to give the new compressed or uncompressed file.") | |||
| 5005 | dir (and dir "/") | 5007 | dir (and dir "/") |
| 5006 | file)) | 5008 | file)) |
| 5007 | (error "name %s didn't match" name)) | 5009 | (error "name %s didn't match" name)) |
| 5008 | (let (drive dir file tmp) | 5010 | (let (drive dir file tmp quote) |
| 5011 | (if (string-match "\\`\".+\"\\'" name) | ||
| 5012 | (setq name (substring name 1 -1) | ||
| 5013 | quote "\"") | ||
| 5014 | (setq quote "")) | ||
| 5009 | (if (string-match "\\`/[^:]+:/" name) | 5015 | (if (string-match "\\`/[^:]+:/" name) |
| 5010 | (setq drive (substring name 1 | 5016 | (setq drive (substring name 1 |
| 5011 | (1- (match-end 0))) | 5017 | (1- (match-end 0))) |
| @@ -5014,9 +5020,9 @@ NEWNAME should be the name to give the new compressed or uncompressed file.") | |||
| 5014 | (if tmp | 5020 | (if tmp |
| 5015 | (setq dir (subst-char-in-string ?/ ?. (substring tmp 0 -1) t))) | 5021 | (setq dir (subst-char-in-string ?/ ?. (substring tmp 0 -1) t))) |
| 5016 | (setq file (file-name-nondirectory name)) | 5022 | (setq file (file-name-nondirectory name)) |
| 5017 | (concat drive | 5023 | (concat quote drive |
| 5018 | (and dir (concat "[" (if drive nil ".") dir "]")) | 5024 | (and dir (concat "[" (if drive nil ".") dir "]")) |
| 5019 | file))))) | 5025 | file quote))))) |
| 5020 | 5026 | ||
| 5021 | ;; (ange-ftp-fix-name-for-vms "/PUB$:/ANONYMOUS/SDSCPUB/NEXT/Readme.txt;1") | 5027 | ;; (ange-ftp-fix-name-for-vms "/PUB$:/ANONYMOUS/SDSCPUB/NEXT/Readme.txt;1") |
| 5022 | ;; (ange-ftp-fix-name-for-vms "/PUB$:[ANONYMOUS.SDSCPUB.NEXT]Readme.txt;1" t) | 5028 | ;; (ange-ftp-fix-name-for-vms "/PUB$:[ANONYMOUS.SDSCPUB.NEXT]Readme.txt;1" t) |
diff --git a/lisp/net/tramp.el b/lisp/net/tramp.el index 7ace2911501..adc66f6766c 100644 --- a/lisp/net/tramp.el +++ b/lisp/net/tramp.el | |||
| @@ -1606,24 +1606,28 @@ This is intended to be used as a minibuffer `post-command-hook' for | |||
| 1606 | `file-name-shadow-mode'; the minibuffer should have already | 1606 | `file-name-shadow-mode'; the minibuffer should have already |
| 1607 | been set up by `rfn-eshadow-setup-minibuffer'." | 1607 | been set up by `rfn-eshadow-setup-minibuffer'." |
| 1608 | ;; In remote files name, there is a shadowing just for the local part. | 1608 | ;; In remote files name, there is a shadowing just for the local part. |
| 1609 | (let ((end (or (tramp-compat-funcall | 1609 | (ignore-errors |
| 1610 | 'overlay-end (symbol-value 'rfn-eshadow-overlay)) | 1610 | (let ((end (or (tramp-compat-funcall |
| 1611 | (tramp-compat-funcall 'minibuffer-prompt-end)))) | 1611 | 'overlay-end (symbol-value 'rfn-eshadow-overlay)) |
| 1612 | (when | 1612 | (tramp-compat-funcall 'minibuffer-prompt-end)))) |
| 1613 | (file-remote-p | 1613 | (when |
| 1614 | (tramp-compat-funcall 'buffer-substring-no-properties end (point-max))) | 1614 | (file-remote-p |
| 1615 | (save-excursion | 1615 | (tramp-compat-funcall |
| 1616 | (save-restriction | 1616 | 'buffer-substring-no-properties end (point-max))) |
| 1617 | (narrow-to-region | 1617 | (save-excursion |
| 1618 | (1+ (or (string-match | 1618 | (save-restriction |
| 1619 | tramp-rfn-eshadow-update-overlay-regexp (buffer-string) end) | 1619 | (narrow-to-region |
| 1620 | end)) | 1620 | (1+ (or (string-match |
| 1621 | (point-max)) | 1621 | tramp-rfn-eshadow-update-overlay-regexp |
| 1622 | (let ((rfn-eshadow-overlay tramp-rfn-eshadow-overlay) | 1622 | (buffer-string) end) |
| 1623 | (rfn-eshadow-update-overlay-hook nil)) | 1623 | end)) |
| 1624 | (tramp-compat-funcall | 1624 | (point-max)) |
| 1625 | 'move-overlay rfn-eshadow-overlay (point-max) (point-max)) | 1625 | (let ((rfn-eshadow-overlay tramp-rfn-eshadow-overlay) |
| 1626 | (tramp-compat-funcall 'rfn-eshadow-update-overlay))))))) | 1626 | (rfn-eshadow-update-overlay-hook nil) |
| 1627 | file-name-handler-alist) | ||
| 1628 | (tramp-compat-funcall | ||
| 1629 | 'move-overlay rfn-eshadow-overlay (point-max) (point-max)) | ||
| 1630 | (tramp-compat-funcall 'rfn-eshadow-update-overlay)))))))) | ||
| 1627 | 1631 | ||
| 1628 | (when (boundp 'rfn-eshadow-update-overlay-hook) | 1632 | (when (boundp 'rfn-eshadow-update-overlay-hook) |
| 1629 | (add-hook 'rfn-eshadow-update-overlay-hook | 1633 | (add-hook 'rfn-eshadow-update-overlay-hook |