Request Re Aliases CD_LEAVE and CD_ENTER

Jun 2, 2008
386
2
Newton, MA
It would be helpful if the aliases CD_LEAVE and CD_ENTER would be executed only when there is an actual directory change. Right now, I'm getting things like this (with my debugging output):

Alias CD_LEAVE
%1=C:\Users\Jay\Dropbox
%2=C:\Users\Jay\Dropbox
Alias CD_ENTER
oldcwd=C:\Users\Jay\Dropbox
newcwd=C:\Users\Jay\Dropbox

As you can see, the directory was not actually changing.

I also just observed that performing "bat:vedit.btm" to launch my text editor via a script causes an invocation of the two aliases without any change of directory.

TCC(27.01.23): C:\tcmd\ver27>bat:vedit
Alias CD_LEAVE
%1=C:\tcmd\ver27
%2=C:\tcmd\ver27
Alias CD_ENTER
oldcwd=C:\tcmd\ver27
newcwd=C:\tcmd\ver27

TCC(27.01.23): C:\tcmd\ver27>

I want to use these aliases to run a batch file (autoex.btm, if present) when I first change to a new directory. It typically displays a file listing or some other information of use to a project that would be carried out in that directory (e.g., defining some special aliases or launching a program). So I really don't want those aliases running all the time when no change is actually taking place. They should run only when the CD or CDD command is run (or the automatic equivalents, e.g., the command c:\temp\).

In the past, I have done this with a very complex prompt variable that includes a lot of %@exec[] calls. That all worked fine in version 25. The new aliases could make things much easier if they worked better.

In addition, there is something about that complex prompt defintion that causes version 27 to crash very frequently. I very quickly had to stop using it and went back to version 25. It appears from my testing today that the problem arises from that prompt code.
 
May 20, 2008
11,538
103
Syracuse, NY, USA
Jay, did you try pointing CD_ENTER at a BTM file? When I do that, crazy things happen! ... so crazy that I can't figure out steps to demonstrate what happens.
 

rconn

Administrator
Staff member
May 14, 2008
12,404
152
CD_ENTER and CD_LEAVE are executed when a directory change is done in TCC; they do not verify that you're not trying to change to the existing directory. They are NOT tied only to CD & CDD; there are a lot of other actions that can trigger a directory change.

I am unlikely to change this as it would be a breaking change for users who are relying on the existing behavior. For what you're trying to do, it would be easier for you to create a CD & CDD alias.

Regarding your prompt - the only thing that has changed in the prompt code since v25 is the new $ metacharacter. If you can reproduce the error, please post your PROMPT string.
 
Similar threads
Thread starter Title Forum Replies Date
B Request Manual Key fails Support 3
rconn News Take Command v22 Request for Features Support 0
vefatica HELP request Support 4
dcantor Request for XenForo Support 2
S Fixed BDEBUGGER died on invalid watch request Support 4
M A somewhat humorous minor-request related to "Shift" command... Support 4
M How to do now or maybe a request for new functionality Support 3
M A request for a new feature for the "set" command... Support 5
M TCMD/TCC Feature Request... Support 4
M time /s - enhancement request Support 5
rconn Do NOT request return receipt! Support 7
dcantor Feature request for SENDMAIL Support 0
Jay Sage Parameter %$ Different in Aliases and BTMa Support 4
vefatica Questions about aliases. Support 1
Joe Caverly Expand all aliases on the command line Support 2
S Take Command crashes for aliases with length > 1015 Support 1
Joe Caverly SETLOCAL removes Aliases and Functions Support 3
vefatica Two @FUNCTIONs/aliases with the same name Support 4
D Can ANSI escape sequences be used in keystroke aliases? Support 8
Joe Caverly Documentation Aliases Overview Support 3
vefatica Display of special characters in aliases. Support 25
T aliases disappearing Support 22
J Autoexecute Keystroke Aliases Support 1
vefatica Aliases ... appending unused parameters? Support 2
cgunhouse Problem with CALL and Directory Aliases in V17 Support 9
MickeyF WAD 'if' and aliases don't mix so well Support 5
M How to? Logic in aliases... Support 3
J Saving aliases Support 21
vefatica Backquotes, aliases get 'em, BTMs don't? Support 1
vefatica Aliases global vs. local Support 12
R key aliases no longer working Support 2
newbie Test to ensure aliases are loaded Support 6
D Are local aliases inherited? Support 4
T FTP.CFG file aliases Support 5
vefatica @@key aliases cause new prompt? Support 16
J TCC Out of memory with aliases and functions Support 5
J Problem with aliases Support 6
P Quick help for aliases Support 3
R Alt-key aliases? Support 3
D LEAVE quits btm Support 5
old coot LEAVE appears to affect command-line arguments Support 11
old coot LEAVE in a DO /S fileset loop only leaves one subdirectory Support 4
Peter Murschall A little problem with LEAVE and COMMENT Support 5
vefatica Fixed LEAVE N not working Support 7

Similar threads