tramp-devel
[Top][All Lists]
Advanced

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

Re: xemacs tramp - naive fix


From: Peter Gordon
Subject: Re: xemacs tramp - naive fix
Date: Sun, 10 Jun 2007 15:11:55 +0300

Hi Michael,

I just had a look at the code in tramp.el, and added the lines 
;; pmg 
          (set-buffer-modified-p nil) 

It seems to me that set-buffer-modified-p should be set after
insert-file-contents.

Regards,

Peter
  



(defun tramp-handle-insert-file-contents
  (filename &optional visit beg end replace)
  "Like `insert-file-contents' for tramp files."
  (barf-if-buffer-read-only)
  (setq filename (expand-file-name filename))
  (with-parsed-tramp-file-name filename nil
    (if (not (file-exists-p filename))
        (progn
          (when visit
            (setq buffer-file-name filename)
            (set-visited-file-modtime)
            (set-buffer-modified-p nil))
          (signal 'file-error
                  (format "File `%s' not found on remote host" filename))
          (list (expand-file-name filename) 0))
      ;; `insert-file-contents-literally' takes care to avoid calling
      ;; jka-compr.  By let-binding inhibit-file-name-operation, we
      ;; propagate that care to the file-local-copy operation.
      (let ((local-copy
             (let ((inhibit-file-name-operation
                    (when (eq inhibit-file-name-operation
                              'insert-file-contents)
                      'file-local-copy)))
               (file-local-copy filename)))
            coding-system-used result)
        (when visit
          (setq buffer-file-name filename)
          (set-visited-file-modtime)
          (set-buffer-modified-p nil))
        (tramp-message-for-buffer
         multi-method method user host
         9 "Inserting local temp file `%s'..." local-copy)
        (setq result (insert-file-contents local-copy nil beg end replace))
        ;; Now `last-coding-system-used' has right value.  Remember it.
        (when (boundp 'last-coding-system-used)
          (setq coding-system-used (symbol-value 'last-coding-system-used)))
        (tramp-message-for-buffer
         multi-method method user host
         9 "Inserting local temp file `%s'...done" local-copy)
        (delete-file local-copy)
        (when (boundp 'last-coding-system-used)
          (set 'last-coding-system-used coding-system-used))
;; pmg 
          (set-buffer-modified-p nil) 

        (list (expand-file-name filename)
              (second result))))))




On Sun, 2007-06-10 at 14:37 +0300, Peter Gordon wrote:
> Hi Michael,
> 
> Is this what you wanted?
> If you want more debugging output, just ask.
> 
> 
> Regards,
> 
> Peter
> 
> 
> 
> 
> Emacs  : XEmacs 21.5  (beta28) "fuki" [Lucid] (i686-pc-linux) of Sun Jun 10 
> 2007 on tigger
> Package: tramp (2.0.55)
> 
> current state:
> ==============
> (setq
>  tramp-ls-command nil
>  tramp-test-groks-nt nil
>  tramp-file-exists-command nil
>  tramp-current-multi-method nil
>  tramp-current-method "scp"
>  tramp-current-user nil
>  tramp-current-host "10.10.12.30"
>  tramp-auto-save-directory nil
>  tramp-default-method "scp"
>  tramp-rsh-end-of-line "\n"
>  tramp-default-password-end-of-line "\n"
>  tramp-remote-path '("/usr/xpg4/bin" "/bin" "/usr/bin" "/usr/sbin" 
> "/usr/local/bin" "/usr/ccs/bin" "/local/bin" "/local/freeware/bin"
>                    "/local/gnu/bin" "/usr/freeware/bin" "/usr/pkg/bin" 
> "/usr/contrib/bin")
>  tramp-login-prompt-regexp ".*ogin\\( .*\\)?: *"
>  ;; variable encoded due to non-printable characters
>  tramp-password-prompt-regexp (base64-decode-string 
> "Xi4qXChbcFBdYXNzd29yZFx8cGFzc3BocmFzZVwpLio6AD8gKg==")
>  tramp-wrong-passwd-regexp "^.*\\(Connection \\(?:closed\\|refused\\)\\|Host 
> key verification failed\\.\\|Login \\(?:Incorrect\\|incorrect\\)\\|Name or 
> service not known\\|Permission denied\\.\\|Sorry, try 
> again\\.\\).*\\|^.*\\(Received signal [0-9]+\\).*"
>  tramp-yesno-prompt-regexp "\\(Are you sure you want to continue connecting 
> (yes/no)\\?\\)\\s-*"
>  tramp-yn-prompt-regexp "\\(Store key in cache\\? (y/n)\\|Update cached 
> key\\? (y/n, Return cancels connection)\\)\\s-*"
>  tramp-terminal-prompt-regexp "\\(TERM = (.*)\\|Terminal type\\? 
> \\[.*\\]\\)\\s-*"
>  tramp-temp-name-prefix "tramp."
>  tramp-file-name-structure '("^/\\[\\(\\([a-zA-Z_0-9-]+\\)/\\)?\\(\\([^:/     
> ]*\\)@\\)?\\([a-zA-Z0-9_.#-]*\\)\\]\\(.*$\\)" 2 4 5 6)
>  tramp-file-name-regexp "\\`/\\[.*\\]"
>  tramp-multi-file-name-structure 
> '("^/\\[\\(\\([a-zA-Z_0-9-]+\\)\\)?\\(\\(/%s\\)+\\)?\\]\\(.*$\\)" 2 3 -1)
>  tramp-multi-file-name-hop-structure '("\\([a-zA-Z_0-9-]+\\):\\([^:/  
> ]*\\)@\\([a-zA-Z0-9_.#-]*\\)" 1 2 3)
>  tramp-multi-methods '("multi" "multiu")
>  tramp-multi-connection-function-alist '(("telnet" tramp-multi-connect-telnet 
> "telnet %h%n") ("rsh" tramp-multi-connect-rlogin "rsh %h -l %u%n")
>                                        ("remsh" tramp-multi-connect-rlogin 
> "remsh %h -l %u%n")
>                                        ("ssh" tramp-multi-connect-rlogin "ssh 
> %h -l %u%n")
>                                        ("ssht" tramp-multi-connect-rlogin 
> "ssh %h -e none -t -t -l %u%n")
>                                        ("su" tramp-multi-connect-su "su - 
> %u%n") ("sudo" tramp-multi-connect-su "sudo -u %u -s -p Password:%n"))
>  tramp-methods '(("smb")
>                ("rcp" (tramp-connection-function tramp-open-connection-rsh) 
> (tramp-login-program "rsh") (tramp-copy-program "rcp")
>                 (tramp-remote-sh "/bin/sh") (tramp-login-args nil) 
> (tramp-copy-args nil) (tramp-copy-keep-date-arg "-p")
>                 (tramp-password-end-of-line nil))
>                ("scp" (tramp-connection-function tramp-open-connection-rsh) 
> (tramp-login-program "ssh") (tramp-copy-program "scp")
>                 (tramp-remote-sh "/bin/sh") (tramp-login-args ("-e" "none")) 
> (tramp-copy-args nil) (tramp-copy-keep-date-arg "-p")
>                 (tramp-password-end-of-line nil))
>                ("scp1" (tramp-connection-function tramp-open-connection-rsh) 
> (tramp-login-program "ssh") (tramp-copy-program "scp")
>                 (tramp-remote-sh "/bin/sh") (tramp-login-args ("-1" "-e" 
> "none")) (tramp-copy-args ("-1")) (tramp-copy-keep-date-arg "-p")
>                 (tramp-password-end-of-line nil))
>                ("scp2" (tramp-connection-function tramp-open-connection-rsh) 
> (tramp-login-program "ssh") (tramp-copy-program "scp")
>                 (tramp-remote-sh "/bin/sh") (tramp-login-args ("-2" "-e" 
> "none")) (tramp-copy-args ("-2")) (tramp-copy-keep-date-arg "-p")
>                 (tramp-password-end-of-line nil))
>                ("scp1_old" (tramp-connection-function 
> tramp-open-connection-rsh) (tramp-login-program "ssh1") (tramp-copy-program 
> "scp1")
>                 (tramp-remote-sh "/bin/sh") (tramp-login-args ("-e" "none")) 
> (tramp-copy-args nil) (tramp-copy-keep-date-arg "-p")
>                 (tramp-password-end-of-line nil))
>                ("scp2_old" (tramp-connection-function 
> tramp-open-connection-rsh) (tramp-login-program "ssh2") (tramp-copy-program 
> "scp2")
>                 (tramp-remote-sh "/bin/sh") (tramp-login-args ("-e" "none")) 
> (tramp-copy-args nil) (tramp-copy-keep-date-arg "-p")
>                 (tramp-password-end-of-line nil))
>                ("rsync" (tramp-connection-function tramp-open-connection-rsh) 
> (tramp-login-program "ssh") (tramp-copy-program "rsync")
>                 (tramp-remote-sh "/bin/sh") (tramp-login-args ("-e" "none")) 
> (tramp-copy-args ("-e" "ssh")) (tramp-copy-keep-date-arg "-t")
>                 (tramp-password-end-of-line nil))
>                ("remcp" (tramp-connection-function tramp-open-connection-rsh) 
> (tramp-login-program "remsh") (tramp-copy-program "rcp")
>                 (tramp-remote-sh "/bin/sh") (tramp-login-args nil) 
> (tramp-copy-args nil) (tramp-copy-keep-date-arg "-p")
>                 (tramp-password-end-of-line nil))
>                ("rsh" (tramp-connection-function tramp-open-connection-rsh) 
> (tramp-login-program "rsh") (tramp-copy-program nil)
>                 (tramp-remote-sh "/bin/sh") (tramp-login-args nil) 
> (tramp-copy-args nil) (tramp-copy-keep-date-arg nil)
>                 (tramp-password-end-of-line nil))
>                ("ssh" (tramp-connection-function tramp-open-connection-rsh) 
> (tramp-login-program "ssh") (tramp-copy-program nil)
>                 (tramp-remote-sh "/bin/sh") (tramp-login-args ("-e" "none")) 
> (tramp-copy-args nil) (tramp-copy-keep-date-arg nil)
>                 (tramp-password-end-of-line nil))
>                ("ssh1" (tramp-connection-function tramp-open-connection-rsh) 
> (tramp-login-program "ssh") (tramp-copy-program nil)
>                 (tramp-remote-sh "/bin/sh") (tramp-login-args ("-1" "-e" 
> "none")) (tramp-copy-args ("-1")) (tramp-copy-keep-date-arg nil)
>                 (tramp-password-end-of-line nil))
>                ("ssh2" (tramp-connection-function tramp-open-connection-rsh) 
> (tramp-login-program "ssh") (tramp-copy-program nil)
>                 (tramp-remote-sh "/bin/sh") (tramp-login-args ("-2" "-e" 
> "none")) (tramp-copy-args ("-2")) (tramp-copy-keep-date-arg nil)
>                 (tramp-password-end-of-line nil))
>                ("ssh1_old" (tramp-connection-function 
> tramp-open-connection-rsh) (tramp-login-program "ssh1") (tramp-copy-program 
> nil)
>                 (tramp-remote-sh "/bin/sh") (tramp-login-args ("-e" "none")) 
> (tramp-copy-args nil) (tramp-copy-keep-date-arg nil)
>                 (tramp-password-end-of-line nil))
>                ("ssh2_old" (tramp-connection-function 
> tramp-open-connection-rsh) (tramp-login-program "ssh2") (tramp-copy-program 
> nil)
>                 (tramp-remote-sh "/bin/sh") (tramp-login-args ("-e" "none")) 
> (tramp-copy-args nil) (tramp-copy-keep-date-arg nil)
>                 (tramp-password-end-of-line nil))
>                ("remsh" (tramp-connection-function tramp-open-connection-rsh) 
> (tramp-login-program "remsh") (tramp-copy-program nil)
>                 (tramp-remote-sh "/bin/sh") (tramp-login-args nil) 
> (tramp-copy-args nil) (tramp-copy-keep-date-arg nil)
>                 (tramp-password-end-of-line nil))
>                ("telnet" (tramp-connection-function 
> tramp-open-connection-telnet) (tramp-login-program "telnet") 
> (tramp-copy-program nil)
>                 (tramp-remote-sh "/bin/sh") (tramp-login-args nil) 
> (tramp-copy-args nil) (tramp-copy-keep-date-arg nil)
>                 (tramp-password-end-of-line nil))
>                ("su" (tramp-connection-function tramp-open-connection-su) 
> (tramp-login-program "su") (tramp-copy-program nil)
>                 (tramp-remote-sh "/bin/sh") (tramp-login-args ("-" "%u")) 
> (tramp-copy-args nil) (tramp-copy-keep-date-arg nil)
>                 (tramp-password-end-of-line nil))
>                ("sudo" (tramp-connection-function tramp-open-connection-su) 
> (tramp-login-program "sudo") (tramp-copy-program nil)
>                 (tramp-remote-sh "/bin/sh") (tramp-login-args ("-u" "%u" "-s" 
> "-p" "Password:")) (tramp-copy-args nil)
>                 (tramp-copy-keep-date-arg nil) (tramp-password-end-of-line 
> nil))
>                ("multi" (tramp-connection-function 
> tramp-open-connection-multi) (tramp-login-program nil) (tramp-copy-program 
> nil)
>                 (tramp-remote-sh "/bin/sh") (tramp-login-args nil) 
> (tramp-copy-args nil) (tramp-copy-keep-date-arg nil)
>                 (tramp-password-end-of-line nil))
>                ("scpc" (tramp-connection-function tramp-open-connection-rsh) 
> (tramp-login-program "ssh") (tramp-copy-program "scp")
>                 (tramp-remote-sh "/bin/sh") (tramp-login-args ("-o" 
> "address@hidden:%%p" "-o" "ControlMaster=yes" "-e" "none"))
>                 (tramp-copy-args ("-o" "address@hidden:%%p" "-o" 
> "ControlMaster=auto")) (tramp-copy-keep-date-arg "-p")
>                 (tramp-password-end-of-line nil))
>                ("scpx" (tramp-connection-function tramp-open-connection-rsh) 
> (tramp-login-program "ssh") (tramp-copy-program "scp")
>                 (tramp-remote-sh "/bin/sh") (tramp-login-args ("-e" "none" 
> "-t" "-t" "/bin/sh")) (tramp-copy-args nil)
>                 (tramp-copy-keep-date-arg "-p") (tramp-password-end-of-line 
> nil))
>                ("sshx" (tramp-connection-function tramp-open-connection-rsh) 
> (tramp-login-program "ssh") (tramp-copy-program nil)
>                 (tramp-remote-sh "/bin/sh") (tramp-login-args ("-e" "none" 
> "-t" "-t" "/bin/sh")) (tramp-copy-args nil)
>                 (tramp-copy-keep-date-arg nil) (tramp-password-end-of-line 
> nil))
>                ("krlogin" (tramp-connection-function 
> tramp-open-connection-rsh) (tramp-login-program "krlogin") 
> (tramp-copy-program nil)
>                 (tramp-remote-sh "/bin/sh") (tramp-login-args ("-x")) 
> (tramp-copy-args nil) (tramp-copy-keep-date-arg nil)
>                 (tramp-password-end-of-line nil))
>                ("plink" (tramp-connection-function tramp-open-connection-rsh) 
> (tramp-login-program "plink") (tramp-copy-program nil)
>                 (tramp-remote-sh "/bin/sh") (tramp-login-args ("-ssh")) 
> (tramp-copy-args nil) (tramp-copy-keep-date-arg nil)
>                 (tramp-password-end-of-line "xy"))
>                ("plink1" (tramp-connection-function 
> tramp-open-connection-rsh) (tramp-login-program "plink") (tramp-copy-program 
> nil)
>                 (tramp-remote-sh "/bin/sh") (tramp-login-args ("-1" "-ssh")) 
> (tramp-copy-args nil) (tramp-copy-keep-date-arg nil)
>                 (tramp-password-end-of-line "xy"))
>                ("pscp" (tramp-connection-function tramp-open-connection-rsh) 
> (tramp-login-program "plink") (tramp-copy-program "pscp")
>                 (tramp-remote-sh "/bin/sh") (tramp-login-args ("-ssh")) 
> (tramp-copy-args nil) (tramp-copy-keep-date-arg "-p")
>                 (tramp-password-end-of-line "xy"))
>                ("fcp" (tramp-connection-function tramp-open-connection-rsh) 
> (tramp-login-program "fsh") (tramp-copy-program "fcp")
>                 (tramp-remote-sh "/bin/sh -i") (tramp-login-args ("sh" "-i")) 
> (tramp-copy-args nil) (tramp-copy-keep-date-arg "-p")
>                 (tramp-password-end-of-line nil))
>                )
>  tramp-end-of-output "///f50771c8fa9a62458bd3b07328743ae2"
>  tramp-coding-commands '(("mimencode -b" "mimencode -u -b" 
> base64-encode-region base64-decode-region)
>                        ("mmencode -b" "mmencode -u -b" base64-encode-region 
> base64-decode-region)
>                        ("recode data..base64" "recode base64..data" 
> base64-encode-region base64-decode-region)
>                        ("uuencode xxx" "uudecode -o /dev/stdout" 
> tramp-uuencode-region uudecode-decode-region)
>                        ("uuencode xxx" "uudecode -o -" tramp-uuencode-region 
> uudecode-decode-region)
>                        ("uuencode xxx" "uudecode -p" tramp-uuencode-region 
> uudecode-decode-region)
>                        ("uuencode xxx" "tramp_uudecode" tramp-uuencode-region 
> uudecode-decode-region)
>                        ("tramp_encode_with_module" "tramp_decode_with_module" 
> base64-encode-region base64-decode-region)
>                        ("tramp_encode" "tramp_decode" base64-encode-region 
> base64-decode-region))
>  tramp-actions-before-shell '((tramp-password-prompt-regexp 
> tramp-action-password) (tramp-login-prompt-regexp tramp-action-login)
>                             (shell-prompt-pattern tramp-action-succeed) 
> (tramp-shell-prompt-pattern tramp-action-succeed)
>                             (tramp-wrong-passwd-regexp 
> tramp-action-permission-denied) (tramp-yesno-prompt-regexp tramp-action-yesno)
>                             (tramp-yn-prompt-regexp tramp-action-yn) 
> (tramp-terminal-prompt-regexp tramp-action-terminal)
>                             (tramp-process-alive-regexp 
> tramp-action-process-alive))
>  tramp-actions-copy-out-of-band '((tramp-password-prompt-regexp 
> tramp-action-password) (tramp-wrong-passwd-regexp 
> tramp-action-permission-denied)
>                                 (tramp-copy-failed-regexp 
> tramp-action-copy-failed) (tramp-process-alive-regexp 
> tramp-action-out-of-band))
>  tramp-multi-actions '((tramp-password-prompt-regexp 
> tramp-multi-action-password) (tramp-login-prompt-regexp 
> tramp-multi-action-login)
>                      (shell-prompt-pattern tramp-multi-action-succeed) 
> (tramp-shell-prompt-pattern tramp-multi-action-succeed)
>                      (tramp-wrong-passwd-regexp 
> tramp-multi-action-permission-denied)
>                      (tramp-process-alive-regexp 
> tramp-multi-action-process-alive))
>  tramp-terminal-type "dumb"
>  ;; variable encoded due to non-printable characters
>  tramp-shell-prompt-pattern (base64-decode-string 
> "XlteIyQlPgpdKlsjJCU+XSAqXCgbXFtbMC05O10qW2EtekEtWl0gKlwpKg==")
>  tramp-chunksize nil
>  tramp-backup-directory-alist nil
>  tramp-bkup-backup-directory-info nil
>  shell-prompt-pattern "^[^#$%>\n]*[#$%>] *"
>  backup-by-copying nil
>  backup-by-copying-when-linked nil
>  backup-by-copying-when-mismatch t
>  backup-by-copying-when-privileged-mismatch 200
>  password-cache t
>  password-cache-expiry 16
>  backup-directory-alist nil
>  file-name-handler-alist '(("^/\\([[][^]]*\\)?$" . 
> tramp-completion-file-name-handler) ("\\`/\\[.*\\]" . tramp-file-name-handler)
>                          ("^/[^/:]+:" . remote-path-file-handler-function) 
> ("\\`/:" . file-name-non-special))
>  )
> 
> 
> <#part type="text/plain" encoding=base64 disposition=attachment 
> buffer="*tramp/scp 10.10.12.30*" description="*tramp/scp 10.10.12.30*">
> <#/part>
> 
> 
> 
> On Sun, 2007-06-10 at 12:58 +0200, Michael Albinus wrote:
> > Peter Gordon <address@hidden> writes:
> > 
> > > So I started using tramp instead. It works well, except that when I open 
> > > a file, it is marked as changed. What I need is 
> > > for the file to be marked as unchanged when I first open it, and only 
> > > when I make a change should it be marked as changed.
> > >
> > > Is there a patch or a workaround?
> > 
> > Tramp shouldn't give such a false indication. Could you, please, send a
> > bug report via "M-x tramp-submit-bug"? This will give us more
> > information. The debug buffer should be appended too (see the manual
> > about the settings).
> > 
> > > Thanks,
> > >
> > > Peter
> > 
> > Best regards, Michael.
> 
> 
> 
> _______________________________________________
> Tramp-devel mailing list
> address@hidden
> http://lists.gnu.org/mailman/listinfo/tramp-devel





reply via email to

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