From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Michael Albinus Newsgroups: gmane.emacs.devel Subject: rfn-eshadow.el and remote filenames Date: Wed, 12 Sep 2007 23:43:43 +0200 Message-ID: <874phzsgog.fsf@gmx.de> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Trace: sea.gmane.org 1189633229 22672 80.91.229.12 (12 Sep 2007 21:40:29 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Wed, 12 Sep 2007 21:40:29 +0000 (UTC) To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Wed Sep 12 23:40:26 2007 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1IVZwX-0001Lz-9O for ged-emacs-devel@m.gmane.org; Wed, 12 Sep 2007 23:40:17 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1IVZwW-0006Js-UC for ged-emacs-devel@m.gmane.org; Wed, 12 Sep 2007 17:40:16 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1IVZwT-0006Jk-TR for emacs-devel@gnu.org; Wed, 12 Sep 2007 17:40:13 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1IVZwS-0006JY-DM for emacs-devel@gnu.org; Wed, 12 Sep 2007 17:40:13 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1IVZwS-0006JV-Ay for emacs-devel@gnu.org; Wed, 12 Sep 2007 17:40:12 -0400 Original-Received: from mail.gmx.net ([213.165.64.20]) by monty-python.gnu.org with smtp (Exim 4.60) (envelope-from ) id 1IVZwR-0001H4-PE for emacs-devel@gnu.org; Wed, 12 Sep 2007 17:40:12 -0400 Original-Received: (qmail invoked by alias); 12 Sep 2007 21:40:09 -0000 Original-Received: from p57A232F2.dip0.t-ipconnect.de (EHLO arthur.alcatel.de) [87.162.50.242] by mail.gmx.net (mp043) with SMTP; 12 Sep 2007 23:40:09 +0200 X-Authenticated: #3708877 X-Provags-ID: V01U2FsdGVkX1+6D2BUrJK6Mxv34Zoq3Eq6IJeliNECMpTrjro0IJ pVWt3j0A/OyvDi User-Agent: Gnus/5.110007 (No Gnus v0.7) Emacs/22.1.50 (gnu/linux) X-Y-GMX-Trusted: 0 X-Detected-Kernel: Linux 2.6, seldom 2.4 (older, 4) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:78716 Archived-At: --=-=-= Hi, Tramp has an own implementation of substitute-in-file-name, which substitutes "//" and "/~" in the local filename part. In order to make it visible in the minibuffer, I'ld like to install the appended patch in the trunk. If you want to see it, type something like "/tmp//su::/etc//us " in the minibuffer, when opening a file. Any objections? Best regards, Michael. --=-=-= Content-Type: text/x-patch Content-Disposition: attachment *** /home/albinus/src/emacs/lisp/rfn-eshadow.el.~1.25.~ 2007-07-26 07:31:01.000000000 +0200 --- /home/albinus/src/emacs/lisp/rfn-eshadow.el 2007-09-12 23:21:52.000000000 +0200 *************** *** 130,135 **** --- 130,140 ---- (defvar rfn-eshadow-overlay) (make-variable-buffer-local 'rfn-eshadow-overlay) + ;; An overlay covering the shadowed local filename part of a remote + ;; filename (local to the minibuffer). + (defvar rfn-eshadow-remote-overlay) + (make-variable-buffer-local 'rfn-eshadow-remote-overlay) + ;;; Hook functions *************** *** 140,156 **** (when minibuffer-completing-file-name (setq rfn-eshadow-overlay (make-overlay (minibuffer-prompt-end) (minibuffer-prompt-end))) ;; Give rfn-eshadow-overlay the user's props. (let ((props (if window-system file-name-shadow-properties file-name-shadow-tty-properties))) (while props ! (overlay-put rfn-eshadow-overlay (pop props) (pop props)))) ;; Turn on overlay evaporation so that we don't have to worry about ;; odd effects when the overlay sits empty at the beginning of the ;; minibuffer. (overlay-put rfn-eshadow-overlay 'evaporate t) ;; Add our post-command hook, and make sure can remove it later. (add-to-list 'rfn-eshadow-frobbed-minibufs (current-buffer)) (add-hook 'post-command-hook #'rfn-eshadow-update-overlay nil t))) --- 145,167 ---- (when minibuffer-completing-file-name (setq rfn-eshadow-overlay (make-overlay (minibuffer-prompt-end) (minibuffer-prompt-end))) + (setq rfn-eshadow-remote-overlay + (make-overlay (minibuffer-prompt-end) (minibuffer-prompt-end))) ;; Give rfn-eshadow-overlay the user's props. (let ((props (if window-system file-name-shadow-properties file-name-shadow-tty-properties))) (while props ! (let ((prop (pop props)) ! (value (pop props))) ! (overlay-put rfn-eshadow-overlay prop value) ! (overlay-put rfn-eshadow-remote-overlay prop value)))) ;; Turn on overlay evaporation so that we don't have to worry about ;; odd effects when the overlay sits empty at the beginning of the ;; minibuffer. (overlay-put rfn-eshadow-overlay 'evaporate t) + (overlay-put rfn-eshadow-remote-overlay 'evaporate t) ;; Add our post-command hook, and make sure can remove it later. (add-to-list 'rfn-eshadow-frobbed-minibufs (current-buffer)) (add-hook 'post-command-hook #'rfn-eshadow-update-overlay nil t))) *************** *** 168,176 **** This is intended to be used as a minibuffer `post-command-hook' for `file-name-shadow-mode'; the minibuffer should have already been set up by `rfn-eshadow-setup-minibuffer'." (condition-case nil (let ((goal (substitute-in-file-name (minibuffer-contents))) ! (mid (overlay-end rfn-eshadow-overlay)) (start (minibuffer-prompt-end)) (end (point-max))) (unless --- 179,200 ---- This is intended to be used as a minibuffer `post-command-hook' for `file-name-shadow-mode'; the minibuffer should have already been set up by `rfn-eshadow-setup-minibuffer'." + ;; Shadow from the beginning. + (rfn-eshadow-do-overlay rfn-eshadow-overlay) + + ;; In remote files name, there is a shadowing just for the local part. + (let ((x (or (overlay-end rfn-eshadow-overlay) (minibuffer-prompt-end)))) + (when (file-remote-p (buffer-substring-no-properties x (point-max))) + (narrow-to-region + (1+ (or (string-match "/" (buffer-string) x) x)) (point-max)) + (rfn-eshadow-do-overlay rfn-eshadow-remote-overlay) + (widen)))) + + (defun rfn-eshadow-do-overlay (overlay) + "Apply `rfn-eshadow-overlay' to cover shadowed part of minibuffer input." (condition-case nil (let ((goal (substitute-in-file-name (minibuffer-contents))) ! (mid (overlay-end overlay)) (start (minibuffer-prompt-end)) (end (point-max))) (unless *************** *** 193,199 **** (if (rfn-eshadow-sifn-equal goal mid) (setq start mid) (setq end mid))) ! (move-overlay rfn-eshadow-overlay (minibuffer-prompt-end) start))) ;; `substitute-in-file-name' can fail on partial input. (error nil))) --- 217,223 ---- (if (rfn-eshadow-sifn-equal goal mid) (setq start mid) (setq end mid))) ! (move-overlay overlay (minibuffer-prompt-end) start))) ;; `substitute-in-file-name' can fail on partial input. (error nil))) --=-=-= Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Emacs-devel mailing list Emacs-devel@gnu.org http://lists.gnu.org/mailman/listinfo/emacs-devel --=-=-=--