GNU bug report logs -
#15186
24.3; verify-visited-file-modtime fail with tramp when the optional argument is omitted
Previous Next
Reported by: "Rémi Vanicat" <remi.vanicat <at> gmail.com>
Date: Sun, 25 Aug 2013 18:56:01 UTC
Severity: normal
Found in version 24.3
Done: Michael Albinus <michael.albinus <at> gmx.de>
Bug is archived. No further changes may be made.
Full log
Message #10 received at 15186-done <at> debbugs.gnu.org (full text, mbox):
"Rémi Vanicat" <remi.vanicat <at> gmail.com> writes:
Hi Rémi,
> With the following command:
> (defun foo ()
> (interactive)
> (verify-visited-file-modtime))
>
> Let's open some file with tramp and sudo:
>
> C-xC-f /sudo::/etc/passwd
>
> then M-x foo will failed with
> "byte-code: Wrong type argument: stringp, nil"
Thanks for the report!
I've fixed this in the trunk. You could test the following patch (line
numbers to be adapted):
--8<---------------cut here---------------start------------->8---
=== modified file 'lisp/net/tramp-sh.el'
--- lisp/net/tramp-sh.el 2013-08-17 10:20:15 +0000
+++ lisp/net/tramp-sh.el 2013-08-26 06:57:32 +0000
@@ -1234,14 +1234,14 @@
;; This function makes the same assumption as
;; `tramp-sh-handle-set-visited-file-modtime'.
-(defun tramp-sh-handle-verify-visited-file-modtime (buf)
+(defun tramp-sh-handle-verify-visited-file-modtime (&optional buf)
"Like `verify-visited-file-modtime' for Tramp files.
At the time `verify-visited-file-modtime' calls this function, we
already know that the buffer is visiting a file and that
`visited-file-modtime' does not return 0. Do not call this
function directly, unless those two cases are already taken care
of."
- (with-current-buffer buf
+ (with-current-buffer (or buf (current-buffer))
(let ((f (buffer-file-name)))
;; There is no file visiting the buffer, or the buffer has no
;; recorded last modification time, or there is no established
--8<---------------cut here---------------end--------------->8---
Best regards, Michael.
This bug report was last modified 11 years and 332 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.