Replies: 3 comments 5 replies
-
Welcome Karsten! Thanks for stopping by, I hope you stick around. History expansion itself was not tied to the bash mode, but the histreedit and histverify options were -- I've made those available using the regular 'set' command. Relevant commits: 7b25709, 0761824, f792c4b, 89184ea, 893df4d, 0a71a8a, d507847, f1e5a19 On my wishlist: allow multibyte histchars, so I could use, e.g., § instead of ! (my Mac has a § key that rarely gets used and would be great for that purpose). I might work on that sometime, but if you'd like to and have the time, please feel free to go right ahead. |
Beta Was this translation helpful? Give feedback.
-
Hi Martijn, I'm pretty sure that in my initial code history expansion was tied to bash mode. Probably dgk moved it at some point of time. Honestly, I never used history expansion, neither with ksh nor with bash. To me it's a rather annoying feature. How many times did bash f**k up my command line, because I accidentally typed an unquoted ! somewhere? Countless times. So I always turn it off. Regarding multibyte characters, I think my implementation is completely broken anyways. I have no idea how ksh handles multibyte characters, but I would look into how it's done in edit/completion.c. There are many calls to mbchar(). I guess every string pointer increment in hexpand.c would have to be replaced with that. Remember that the characters for history expansion are taken from the environment variable histchars, when set (see hist_setchars() in hexpand.c). § is still in ASCII range, so you could probably just get away with simply setting histchars to "§". You can set up to three characters there. If there are none or less than three are set, the defaults are '!', '^' and '#'. For fully enabling multibyte characters you would have to treat the histchars variable accordingly, that means changing the hist_setchars() function, any access to hc[3] array in hist_expand and in edit/completion.c, fmtx() as well. I hope that helps a little. I don't know if I will have time for looking into it, as I'm just applying for a new job. I stumbled in here, because I was looking for something interesting to put into my CV, and having had the honor to work with dgk and gsf surely was interesting :) |
Beta Was this translation helpful? Give feedback.
-
I'm going to be a bit off topic now - just sharing memories,. The AT&T or Bell guys had great ideas, without them, we wouldn't have UNIX at all. I worked with UWIN in the early 2000s. UWIN was absolutely not free, a commercial product. I visited the labs in 2002 when I was on vacation in NYC. dgk and gsf invited me to have talk there about my work with UWIN. Of course I did this. It was really inspiring day, especially seeing gsf wearing shorts and toesies and discovering that dgk's office was even more messy than mine. And they showed me the office space where Bjarne Stroustrup invented C++. dgk then asked me if I had some spare time. It was about the bash compatibility mode. His idea was to have ksh emulate any Bourne shell descendant shell out there, the most prominent being bash and zsh. Of course I opted in. Most of the stuff that is now deleted came from me. I wrote it over a few weeks, history expansion took me a day or two. Bash mode was clearly dgk's idea, I only contributed as much as I could in my spare time. I feel no anger that my code has been removed. At least history expansion is still there, which I would not recommend to use anyways :) |
Beta Was this translation helpful? Give feedback.
-
I am the author of the bash style history expansion (src/cmd/ksh83/edit/hexpand.c), which I wrote for dgk in 2002 because I was bored a bit and he had it on his to-do list. It was tied to SHOPT_BASH I think, but this seems to be gone now, which might be a good sign.
I wrote some more small bash compatibility stuff about 12 years ago, but the source code is lost and I never got it to dgk. Honestly, I don't remember what I did.
Keep up the good work!
Cheers,
Karsten
Beta Was this translation helpful? Give feedback.
All reactions