unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: bojohan+news@dd.chalmers.se (Johan Bockgård)
To: emacs-devel@gnu.org
Subject: Re: find-file annoyance
Date: Wed, 17 Oct 2007 11:31:01 +0200	[thread overview]
Message-ID: <yoijprzeqe96.fsf@remote4.student.chalmers.se> (raw)
In-Reply-To: b4my7e2tuk1.fsf@jpl.org

Katsumi Yamaoka <yamaoka@jpl.org> 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  <bojohan@gnu.org>

	* 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

  parent reply	other threads:[~2007-10-17  9:31 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-10-17  1:10 find-file annoyance Katsumi Yamaoka
2007-10-17  2:27 ` Miles Bader
2007-10-17  9:31 ` Johan Bockgård [this message]
2007-10-17 18:50   ` Michael Albinus
2007-10-17 23:54     ` Katsumi Yamaoka
2007-10-18 22:50       ` Katsumi Yamaoka

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=yoijprzeqe96.fsf@remote4.student.chalmers.se \
    --to=bojohan+news@dd.chalmers.se \
    --cc=emacs-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).