From: "Chris Moore" <christopher.ian.moore@gmail.com>
To: emacs-devel@gnu.org
Subject: shell-resync-dirs changes my cursor position
Date: Mon, 10 Sep 2007 14:07:18 +0200 [thread overview]
Message-ID: <a9691ee20709100507u1585a2b3scd6d4af5cff5a964@mail.gmail.com> (raw)
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
next reply other threads:[~2007-09-10 12:07 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-09-10 12:07 Chris Moore [this message]
2007-09-10 12:21 ` shell-resync-dirs changes my cursor position 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
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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=a9691ee20709100507u1585a2b3scd6d4af5cff5a964@mail.gmail.com \
--to=christopher.ian.moore@gmail.com \
--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 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.