all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* shell-resync-dirs changes my cursor position
@ 2007-09-10 12:07 Chris Moore
  2007-09-10 12:21 ` Chris Moore
  0 siblings, 1 reply; 8+ messages in thread
From: Chris Moore @ 2007-09-10 12:07 UTC (permalink / raw)
  To: emacs-devel

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  <dooglus@gmail.com>

	* 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/,^S!]@`\T&ZH$W/)TM#
MJ:;64;I7=,!&^8JW(@>V$&(?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

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2007-09-13  7:26 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-09-10 12:07 shell-resync-dirs changes my cursor position Chris Moore
2007-09-10 12:21 ` Chris Moore
2007-09-10 19:17   ` Davis Herring
2007-09-10 23:55   ` Richard Stallman
2007-09-11  0:36     ` Davis Herring
2007-09-11 10:36       ` Chris Moore
2007-09-12  8:46         ` Richard Stallman
2007-09-13  7:26           ` Glenn Morris

Code repositories for project(s) associated with this external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.