emacs-devel
[Top][All Lists]
Advanced

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

shell-resync-dirs changes my cursor position


From: Chris Moore
Subject: shell-resync-dirs changes my cursor position
Date: Mon, 10 Sep 2007 14:07:18 +0200

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  <address@hidden>

        * 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)E<WEN8RUD:7)S+7!A=&-H+G1X=`#-4D%NVS`0
M/%NOV/IB2C$-T;8203D%!0KTW!>PU$HF(I$*207P[[L4K;0.>NRA/&F'L\N9
MT19%`?Z"PW#`87,2\#+W<"S+)Q!5<ZR:TR,\E%1OQ$%4YXQS_ILM2OB!TXU]
M;DK1B*<;.RON3ZRA+NM]+4ZP`'%2`LY`WSP#4'8<I6E!]E*;PY80`*9-0"=5
MT.^8)V3`4`!CD[,*6(^!_YR[#AV/`'H/3,W.H5GQ/,address@hidden&ZH$W/)TM#
MJ:;64;I7=,!&^8JW(@>V$&(?Q+XIXL!NXQ<6Q"(1%DF]#9:KBW2PD%?\^1F^
M=Q`N"*LV5!>+?G7J]]!:address@hidden<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
address@hidden'ZU\]!&)ZK=YNG0J&R)X!LQKW9V$*X3Q4_VS#L:C49A0PS68B<'+3WL
MXG.P2T\[]%>address@hidden;JM*\?Q;HL_Z=MXGU:B/NM^R#\L7R?]M+HX1^G]PM;
':>&SXP,`````
`
end




reply via email to

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