From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: "Chris Moore" Newsgroups: gmane.emacs.devel Subject: shell-resync-dirs changes my cursor position Date: Mon, 10 Sep 2007 14:07:18 +0200 Message-ID: NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Trace: sea.gmane.org 1189428444 19039 80.91.229.12 (10 Sep 2007 12:47:24 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Mon, 10 Sep 2007 12:47:24 +0000 (UTC) To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Mon Sep 10 22:47:11 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 1IUpYl-0002MT-EO for ged-emacs-devel@m.gmane.org; Mon, 10 Sep 2007 22:08:39 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1IUi4O-0003ef-TR for ged-emacs-devel@m.gmane.org; Mon, 10 Sep 2007 08:08:48 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1IUi4L-0003e7-Br for emacs-devel@gnu.org; Mon, 10 Sep 2007 08:08:45 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1IUi4J-0003dY-Od for emacs-devel@gnu.org; Mon, 10 Sep 2007 08:08:44 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1IUi4J-0003dP-Bk for emacs-devel@gnu.org; Mon, 10 Sep 2007 08:08:43 -0400 Original-Received: from el-out-1112.google.com ([209.85.162.179]) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1IUi4I-0004OD-UC for emacs-devel@gnu.org; Mon, 10 Sep 2007 08:08:43 -0400 Original-Received: by el-out-1112.google.com with SMTP id m34so108064ele for ; Mon, 10 Sep 2007 05:08:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=beta; h=domainkey-signature:received:received:message-id:date:from:to:subject:mime-version:content-type:content-transfer-encoding:content-disposition; bh=GuUefqUoL876jclC9fUhuFMmQ0KPDNeJKjGrNHNfuSw=; b=oZmzGCRJU+taT/SM0TavdvDWDHnNkFIewLQrVNCb3xHbaLzbsRnE/ox2WhG4ru8U54Y1GU49tOmiv45GwtLi9g1D0mLcn8vDHi1hK5p7pGWR+DIRlyS9jc0ALya0e9D/0RYSstZnAwMTxBi0p1IxcMKNKw6J4+aR1sV58qmv4HM= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=beta; h=received:message-id:date:from:to:subject:mime-version:content-type:content-transfer-encoding:content-disposition; b=ZWrBM0EIuURD40/zO699CjdjZJ2OvbTkwvDKITFxvceGhoVcimtP+az3ngRtrsBY1nUD6yDGorMfvWIhLMm6//pLnBW4hxopn8cm01d86VCxSyqI1Pv1D38WJ5yQknlfPj2rUeuP3v+NK7vJzLH4OgZ2EGG/qXRSWg3fQGHbTt8= Original-Received: by 10.142.229.4 with SMTP id b4mr217038wfh.1189426038385; Mon, 10 Sep 2007 05:07:18 -0700 (PDT) Original-Received: by 10.143.4.2 with HTTP; Mon, 10 Sep 2007 05:07:18 -0700 (PDT) Content-Disposition: inline X-Detected-Kernel: Linux 2.4-2.6 (Google crawlbot) 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:78431 Archived-At: I'm editing a long shell command in a *shell* buffer. Part way through I try completing a filename and notice that the default-directory isn't synced with the shell's working directory, so I run M-x dirs RET to sync it. That resets my cursor position to the start of the line I was editing, rather than leaving it where I was before. I was trying to complete a filename, so I'd like now to just be able to hit TAB and do so, rather than trying to find the place I was at before. Here's a patch and changelog (and uuencoded patch in case the patch gets messed up by my mail client again): 2007-09-10 Chris Moore * shell.el (shell-resync-dirs): Restore the cursor position to its previous location after syncing. *** shell.el 31 Aug 2007 15:25:36 +0200 1.154 --- shell.el 10 Sep 2007 14:01:17 +0200 *************** *** 808,813 **** --- 808,814 ---- command again." (interactive) (let* ((proc (get-buffer-process (current-buffer))) + (starting-point (set-marker (make-marker) (point))) (pmark (process-mark proc))) (goto-char pmark) ;; If the process echoes commands, don't insert a fake command in *************** *** 852,858 **** (setq shell-dirstack (cdr ds) shell-last-dir (car shell-dirstack)) (shell-dirstack-message)) ! (error (message "Couldn't cd"))))))) ;; For your typing convenience: (defalias 'dirs 'shell-resync-dirs) --- 853,861 ---- (setq shell-dirstack (cdr ds) shell-last-dir (car shell-dirstack)) (shell-dirstack-message)) ! (error (message "Couldn't cd"))))) ! (goto-char starting-point) ! (set-marker starting-point nil))) ;; For your typing convenience: (defalias 'dirs 'shell-resync-dirs) begin 644 shell-resync-dirs-patch.txt.gz M'XL(")DRY48``W-H96QL+7)EPU$HF(I$*207P[[L4K;0.>NRA/&F'L\N9 MT19%`?Z"PW#`87,2\#+W<"S+)Q!5V$&(?Q+XIXL!NXQ<6Q"(1%DF]#9:KBW2PD%?\^1F^ M=Q`N"*LV5!>+?G7J]]!:LPN@C4<70$)'.CYRT.;O,5;'?5W5*492N(D*R,Q; M^C.\U8ZL*I*L6@>M7VP0*]T.TH=(H5N2>]^1'*=Y=Q=\)/&R1R)\H4B`H7,V MQI9@V'ZU\]!&)ZK=YNG0J&R)X!LQKW9V$*X3Q4_VS#L:C49A0PS68B<'+3WL MXG.P2T\[]%>C%@5Y6I;JM*\?Q;HL_Z=MXGU:B/NM^R#\L7R?]M+HX1^G]PM; ':>&SXP,````` ` end