emacs-devel
[Top][All Lists]
Advanced

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

Re: find-file annoyance


From: Johan Bockgård
Subject: Re: find-file annoyance
Date: Wed, 17 Oct 2007 11:31:01 +0200
User-agent: Gnus/5.110007 (No Gnus v0.7) Emacs/23.0.50 (gnu/linux)

Katsumi Yamaoka <address@hidden> writes:

> When I invoke C-x C-f, clear the minibuffer, enter a remote file name
> like "/frp.example.com:~/foo", and type C-a or C-b in order to correct
> the host name to "ftp.example.com", I cannot move the point to the
> place before "~" or ":". Only <backspace> does it but I have to retype
> the whole host name. In addition, I usually did `C-x C-f C-a C-k C-g'
> in order to copy the directory name of the dired buffer to the
> kill-ring. Is there a way to make it behave like Emacs 22.1?

tramp-rfn-eshadow-update-overlay uses narrowing in a way that moves
point (the old point was outside the limits). It needs to save-excursion.
(This patch also replaces a call to `widen' with save-restriction.)


2007-10-17  Johan Bockgård  <address@hidden>

        * net/tramp.el (tramp-rfn-eshadow-update-overlay): Save excursion.
        Use `save-restriction' rather than `widen'.


Index: tramp.el
===================================================================
RCS file: /cvsroot/emacs/emacs/lisp/net/tramp.el,v
retrieving revision 1.146
diff -c -r1.146 tramp.el
*** tramp.el    10 Oct 2007 04:55:30 -0000      1.146
--- tramp.el    17 Oct 2007 09:17:42 -0000
***************
*** 2092,2103 ****
                          (symbol-value 'rfn-eshadow-overlay))
                 (funcall (symbol-function 'minibuffer-prompt-end)))))
      (when (file-remote-p (buffer-substring-no-properties end (point-max)))
!       (narrow-to-region
!        (1+ (or (string-match "/" (buffer-string) end) end)) (point-max))
!       (let ((rfn-eshadow-overlay tramp-rfn-eshadow-overlay)
!           (rfn-eshadow-update-overlay-hook nil))
!       (funcall (symbol-function 'rfn-eshadow-update-overlay)))
!       (widen))))
  
  (when (boundp 'rfn-eshadow-update-overlay-hook)
    (add-hook 'rfn-eshadow-update-overlay-hook
--- 2092,2104 ----
                          (symbol-value 'rfn-eshadow-overlay))
                 (funcall (symbol-function 'minibuffer-prompt-end)))))
      (when (file-remote-p (buffer-substring-no-properties end (point-max)))
!       (save-excursion
!       (save-restriction
!         (narrow-to-region
!          (1+ (or (string-match "/" (buffer-string) end) end)) (point-max))
!         (let ((rfn-eshadow-overlay tramp-rfn-eshadow-overlay)
!               (rfn-eshadow-update-overlay-hook nil))
!           (funcall (symbol-function 'rfn-eshadow-update-overlay))))))))
  
  (when (boundp 'rfn-eshadow-update-overlay-hook)
    (add-hook 'rfn-eshadow-update-overlay-hook


-- 
Johan Bockgård





reply via email to

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