bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#15186: 24.3; verify-visited-file-modtime fail with tramp when the op


From: Michael Albinus
Subject: bug#15186: 24.3; verify-visited-file-modtime fail with tramp when the optional argument is omitted
Date: Mon, 26 Aug 2013 09:08:39 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux)

"Rémi Vanicat" <remi.vanicat@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.





reply via email to

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