Wednesday, 21 October 2009

Found a bug in emacs ange-ftp(used by tramp)

Ever troubled by tramp asking you the question

"changed on disk; really edit the buffer? (y, n, r or C-h) "

every time you try saving the file in a remote server? Unfortunately, I had been haunted by it for two months.

Emacs 23 and Emacs 22's tramp, when used in ftp method to edit file in a remote machine, has the problem above. The solution is simple.

1. Open your ange-ftp.el.gz. Mine is at ~/local/share/share/emacs/23.1/lisp/net/ange-ftp.el.gz.

2. Find the line
(restore-buffer-modified-p mod-p)
And comment it out using ;;

3. Save ange-ftp.el.gz.

4. Add a line in your .emacs:
(load-file "~/local/share/share/emacs/23.1/lisp/net/ange-ftp.el.gz")

Restart emacs and it should be OK. This solution is kind of ad-hoc but it works perfect for me. The saving modified file trigger will still be there when it should. I'll take further investigation to it during my leisure time.

1 comment: