* How to see the value of each char in a string? @ 2002-11-26 6:37 David Combs 2002-11-26 17:31 ` Kai Großjohann 2002-11-26 18:44 ` Barry Margolin 0 siblings, 2 replies; 17+ messages in thread From: David Combs @ 2002-11-26 6:37 UTC (permalink / raw) How to see the value of each char in a (long) string? Here's why I need to do that: In *shell*, (using csh), I yanked a command onto after the shell-promt, hit <return>, and got BEEP. I started hitting C-c's, couldn't kill the command I had given. Whenever I hit another <return>, I'd get echoed a ^G. I opened another window (er, frame, X-window), did a ps -ef | egrep '\<ls\>', and got nothing. Any ideas? (Also, how do you kill a command -- especially if you can't seem to find it via "ps"?) Thanks! David ^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: How to see the value of each char in a string? 2002-11-26 6:37 How to see the value of each char in a string? David Combs @ 2002-11-26 17:31 ` Kai Großjohann 2002-12-04 10:14 ` David Combs 2002-11-26 18:44 ` Barry Margolin 1 sibling, 1 reply; 17+ messages in thread From: Kai Großjohann @ 2002-11-26 17:31 UTC (permalink / raw) dkcombs@panix.com (David Combs) writes: > (Also, how do you kill a command -- especially if you > can't seem to find it via "ps"?) Maybe with pstree or something. The csh has been started by Emacs and the command has been started by the csh. So that's how you can find it. kai -- ~/.signature is: umop ap!sdn (Frank Nobis) ^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: How to see the value of each char in a string? 2002-11-26 17:31 ` Kai Großjohann @ 2002-12-04 10:14 ` David Combs 2002-12-04 17:53 ` Kai Großjohann 2002-12-05 10:42 ` Kester Clegg 0 siblings, 2 replies; 17+ messages in thread From: David Combs @ 2002-12-04 10:14 UTC (permalink / raw) [-- Warning: decoded text below may be mangled, UTF-8 assumed --] [-- Attachment #1: Type: text/plain, Size: 489 bytes --] In article <843cpob5lz.fsf@lucy.cs.uni-dortmund.de>, Kai Großjohann <kai.grossjohann@uni-duisburg.de> wrote: >dkcombs@panix.com (David Combs) writes: > >> (Also, how do you kill a command -- especially if you >> can't seem to find it via "ps"?) > >Maybe with pstree or something. The csh has been started by Emacs >and the command has been started by the csh. So that's how you can >find it. Like I said, that pstree is really cool. What other suych things like that are there? David ^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: How to see the value of each char in a string? 2002-12-04 10:14 ` David Combs @ 2002-12-04 17:53 ` Kai Großjohann 2002-12-05 10:42 ` Kester Clegg 1 sibling, 0 replies; 17+ messages in thread From: Kai Großjohann @ 2002-12-04 17:53 UTC (permalink / raw) dkcombs@panix.com (David Combs) writes: > Like I said, that pstree is really cool. > > What other suych things like that are there? Off-topic alert. How about dirtree... PS: Does anyone have a port of dired-nested to recent Emacsen, or perhaps a reimplementation? (It used to be called dired-nstd to be precise.) I really miss it. -- ~/.signature is: umop ap!sdn (Frank Nobis) ^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: How to see the value of each char in a string? 2002-12-04 10:14 ` David Combs 2002-12-04 17:53 ` Kai Großjohann @ 2002-12-05 10:42 ` Kester Clegg 1 sibling, 0 replies; 17+ messages in thread From: Kester Clegg @ 2002-12-05 10:42 UTC (permalink / raw) dkcombs@panix.com (David Combs) writes: > Like I said, that pstree is really cool. > > What other suych things like that are there? ps xf will give a 'tree' output as well. -- ************************************************************************ Kester Clegg Dept. of Computer Science, Research Assistant (UTC) University of York, Tel (01904) 43 27 49 email: kester at cs.york.ac.uk ************************************************************************ ^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: How to see the value of each char in a string? 2002-11-26 6:37 How to see the value of each char in a string? David Combs 2002-11-26 17:31 ` Kai Großjohann @ 2002-11-26 18:44 ` Barry Margolin 2002-11-27 7:36 ` David Combs 1 sibling, 1 reply; 17+ messages in thread From: Barry Margolin @ 2002-11-26 18:44 UTC (permalink / raw) In article <arv4rj$qdk$1@panix2.panix.com>, David Combs <dkcombs@panix.com> wrote: >How to see the value of each char in a (long) string? > >Here's why I need to do that: > >In *shell*, (using csh), I yanked a command onto after the >shell-promt, hit <return>, and got BEEP. > >I started hitting C-c's, couldn't kill the command I had >given. > >Whenever I hit another <return>, I'd get echoed a ^G. My guess is that the command included a pipe to "more", and that's more's prompt. Full-screen programs like this don't work well in the *shell* buffer. Try typing "q" to get out. I don't understand what this problem has to do with your original question about seeing the value of each character in a string. -- Barry Margolin, barmar@genuity.net Genuity, Woburn, MA *** DON'T SEND TECHNICAL QUESTIONS DIRECTLY TO ME, post them to newsgroups. Please DON'T copy followups to me -- I'll assume it wasn't posted to the group. ^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: How to see the value of each char in a string? 2002-11-26 18:44 ` Barry Margolin @ 2002-11-27 7:36 ` David Combs 2002-11-27 9:04 ` Oliver Scholz 0 siblings, 1 reply; 17+ messages in thread From: David Combs @ 2002-11-27 7:36 UTC (permalink / raw) In article <viPE9.21$fP2.761@paloalto-snr1.gtei.net>, Barry Margolin <barmar@genuity.net> wrote: >In article <arv4rj$qdk$1@panix2.panix.com>, >David Combs <dkcombs@panix.com> wrote: >>How to see the value of each char in a (long) string? >> >>Here's why I need to do that: >> >>In *shell*, (using csh), I yanked a command onto after the >>shell-promt, hit <return>, and got BEEP. >> >>I started hitting C-c's, couldn't kill the command I had >>given. >> >>Whenever I hit another <return>, I'd get echoed a ^G. > >My guess is that the command included a pipe to "more", and that's more's >prompt. Full-screen programs like this don't work well in the *shell* >buffer. Try typing "q" to get out. > >I don't understand what this problem has to do with your original question >about seeing the value of each character in a string. It doesn't have anything to do with it, except that I was puzzled by what it was doing, with all the BEEPS I was getting. The real question is: how to find the value of each char in a string. Is there a function that already does that? Maybe someone can show me the two or three lines of elisp code to show the string with, for each char, its numerical value (er, index, I guess). Like, for "foo": f 146 o 157 o 157 Easy to whip out something that? (Would take me *many hours*, with my lack of elisp ability!) Thanks! David ^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: How to see the value of each char in a string? 2002-11-27 7:36 ` David Combs @ 2002-11-27 9:04 ` Oliver Scholz 2002-11-27 18:50 ` David Combs 0 siblings, 1 reply; 17+ messages in thread From: Oliver Scholz @ 2002-11-27 9:04 UTC (permalink / raw) dkcombs@panix.com (David Combs) writes: [...] > The real question is: how to find the value of each > char in a string. > > Is there a function that already does that? > > Maybe someone can show me the two or three lines > of elisp code to show the string with, for each char, > its numerical value (er, index, I guess). > > Like, for "foo": > > f 146 > o 157 > o 157 [...] (mapcar 'identity "foo") Oliver -- 7 Frimaire an 211 de la Révolution Liberté, Egalité, Fraternité! ^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: How to see the value of each char in a string? 2002-11-27 9:04 ` Oliver Scholz @ 2002-11-27 18:50 ` David Combs 2002-11-27 19:22 ` Barry Margolin 2002-11-28 10:07 ` Oliver Scholz 0 siblings, 2 replies; 17+ messages in thread From: David Combs @ 2002-11-27 18:50 UTC (permalink / raw) In article <ur8d7crj3.fsf@ID-87814.user.dfncis.de>, Oliver Scholz <alkibiades@gmx.de> wrote: >dkcombs@panix.com (David Combs) writes: >[...] >> The real question is: how to find the value of each >> char in a string. >> >> Is there a function that already does that? >> >> Maybe someone can show me the two or three lines >> of elisp code to show the string with, for each char, >> its numerical value (er, index, I guess). >> >> Like, for "foo": >> >> f 146 >> o 157 >> o 157 >[...] > >(mapcar 'identity "foo") > > Oliver Cool -- and the last thing I would have ever thought of. Now, for elisp-lesson #2, how to add to that the non-numerical representation, eg: (146 157 157 ) (146 157 157) ("f" "o" "o") Like, for "foo123foo": (146 157 157 061 063 146 157 157) ("f" "o" "o" "2" "3" "f" "o" "o") , or, if fill-column happens to be 20: (146 157 157 061 ("f" "o" "o" "2" 063 146 157 157) "3" "f" "o" "o") Like, maybe running through the string twice, each time saving the result, and while generating each one, inserting three newlines every so often, Perhaps, if a char is messy to print, eg ^L, then something without quotes, eg "^L" (but no quotes, so it fits). ---- Even a skeleton would be a big help; then maybe others would add suggestions, etc. Fun. ------------------------------------------------------- ------------------------------------------------------- Here's the reason for my question: figuring out this (taken from *shell*): 20 ==/dkcjunk/pstree-19.3==> ls /tfile11--myexternals-opt \a\a\a\a\a\a\a\a\a\a\a\a\a\a\a\a\a\a\a\a\a\a\a\a\a\a\a What in the world caused all those ^G's? Here's the dired-listing of that dir: /opt6/tfile11--myexternals-opt: total 28 drwxr-xr-x 10 root other 512 Nov 8 03:50 . drwxr-xr-x 15 root root 512 Nov 8 22:51 .. drwxr-xr-x 2 dkc other 512 Mar 15 2002 Acrobat3.2 drwxrwxr-x 3 root bin 512 Jan 11 1996 appconfig drwxrwxr-x 2 root bin 512 Jan 12 1996 bin lrwxrwxrwx 1 root other 16 Nov 8 03:50 examples -> ./share/examples drwxrwxrwx 42 root other 2048 Jul 18 2001 gnu lrwxrwxrwx 1 root other 15 Nov 8 03:50 include -> ./share/include drwxrwxr-x 4 root bin 512 Jan 12 1996 lib drwx------ 2 root root 512 Aug 16 1995 lost+found lrwxrwxrwx 1 root other 11 Nov 8 03:50 man -> ./share/man drwxr-xr-x 3 root other 512 Apr 8 1996 opt drwxr-xr-x 3 root other 512 Apr 8 1996 var Looks ok to me. (Heck, any ideas on *this* problem?) Oh, here I do the ls from a dttool: 16 ==/home/dkc==> j 17 ==/home/dkc==> ls /opt6/tfile11--myexternals-op /opt6/tfile11--myexternals-op: No such file or directory 18 ==/home/dkc==> , and I copy/pasted the dirname from the top of the dired-buf. Thanks, David (confused) ^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: How to see the value of each char in a string? 2002-11-27 18:50 ` David Combs @ 2002-11-27 19:22 ` Barry Margolin 2002-11-29 22:24 ` David Combs 2002-11-28 10:07 ` Oliver Scholz 1 sibling, 1 reply; 17+ messages in thread From: Barry Margolin @ 2002-11-27 19:22 UTC (permalink / raw) In article <as345n$h78$1@reader1.panix.com>, David Combs <dkcombs@panix.com> wrote: >>(mapcar 'identity "foo") >> >> Oliver > >Cool -- and the last thing I would have ever thought of. > >Now, for elisp-lesson #2, how to add to that the >non-numerical representation, eg: > >(146 157 157 ) >(146 157 157) >("f" "o" "o") (mapcar 'string "foo") >Here's the reason for my question: figuring out this (taken >from *shell*): > > > 20 ==/dkcjunk/pstree-19.3==> ls /tfile11--myexternals-opt > \a\a\a\a\a\a\a\a\a\a\a\a\a\a\a\a\a\a\a\a\a\a\a\a\a\a\a > > >What in the world caused all those ^G's? Something was trying to ring the bell, but I'm not sure what. -- Barry Margolin, barmar@genuity.net Genuity, Woburn, MA *** DON'T SEND TECHNICAL QUESTIONS DIRECTLY TO ME, post them to newsgroups. Please DON'T copy followups to me -- I'll assume it wasn't posted to the group. ^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: How to see the value of each char in a string? 2002-11-27 19:22 ` Barry Margolin @ 2002-11-29 22:24 ` David Combs 2002-11-30 7:28 ` Barry Margolin 0 siblings, 1 reply; 17+ messages in thread From: David Combs @ 2002-11-29 22:24 UTC (permalink / raw) In article <zX8F9.57$sA6.786@paloalto-snr1.gtei.net>, Barry Margolin <barmar@genuity.net> wrote: >In article <as345n$h78$1@reader1.panix.com>, >David Combs <dkcombs@panix.com> wrote: ><snip> >>Here's the reason for my question: figuring out this (taken >>from *shell*): >> >> >> 20 ==/dkcjunk/pstree-19.3==> ls /tfile11--myexternals-opt >> \a\a\a\a\a\a\a\a\a\a\a\a\a\a\a\a\a\a\a\a\a\a\a\a\a\a\a >> >> >>What in the world caused all those ^G's? > >Something was trying to ring the bell, but I'm not sure what. The problem is -- how to get *out* of it! ^C^C does nothing. Nor does my keying a ^G or several of them. ----- Now, I don't want to kill emacs -- just that one job I started from *shell*. An easy way to get stuck in the ^G's output is to, at a *shell* prompt, simply do "man <something longer than one page>. Like this: 9 ==/dkcjunk/pstree-19.3==> man whatis *** output flushed *** <<<=== I did a ^O here. (subsequent ^O's: no effect) \a \a FILES \a /usr/share/man/windex \a Table of contents and keyword database \a \a Note how each time I hit a <return> it types out only *one* line. And yet again (due to this my advertent man whatis (should have done M-x man)), I'm forced to rename the *shell* buffer to something else, and M-x shell a new one. (I'll wait a bit first, before doing that.) ------ I just tried a trick (failed) to do a ps -ef (I'm running solaris) without a new *shell* -- from a dired-buffer, I did "!" and then "ps -ef", but didn't work. Ok, from another cde-window I found it and killed it; *shell* now cured. --- (Just found why the dired ! ps -ef didn't work -- got the direded file as arg; ! ps -ef ; echo does work. So does ! ps -ef # Someone ought to document that, in the emacs manual.) --- But my main question still is -- shouldn't I be able to kill that man command from *within* that same *shell* buffer? Any ideas? David ^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: How to see the value of each char in a string? 2002-11-29 22:24 ` David Combs @ 2002-11-30 7:28 ` Barry Margolin 2002-11-30 17:22 ` Kai Großjohann 0 siblings, 1 reply; 17+ messages in thread From: Barry Margolin @ 2002-11-30 7:28 UTC (permalink / raw) In article <as8pes$d3r$1@reader1.panix.com>, David Combs <dkcombs@panix.com> wrote: >In article <zX8F9.57$sA6.786@paloalto-snr1.gtei.net>, >Barry Margolin <barmar@genuity.net> wrote: >>In article <as345n$h78$1@reader1.panix.com>, >>David Combs <dkcombs@panix.com> wrote: >><snip> >>>Here's the reason for my question: figuring out this (taken >>>from *shell*): >>> >>> >>> 20 ==/dkcjunk/pstree-19.3==> ls /tfile11--myexternals-opt >>> \a\a\a\a\a\a\a\a\a\a\a\a\a\a\a\a\a\a\a\a\a\a\a\a\a\a\a >>> >>> >>>What in the world caused all those ^G's? >> >>Something was trying to ring the bell, but I'm not sure what. > >The problem is -- how to get *out* of it! > >^C^C does nothing. > >Nor does my keying a ^G or several of them. I thought I answered this in my earlier post: You're running "more" or "less", which uses "q" as the command to exit. -- Barry Margolin, barmar@genuity.net Genuity, Woburn, MA *** DON'T SEND TECHNICAL QUESTIONS DIRECTLY TO ME, post them to newsgroups. Please DON'T copy followups to me -- I'll assume it wasn't posted to the group. ^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: How to see the value of each char in a string? 2002-11-30 7:28 ` Barry Margolin @ 2002-11-30 17:22 ` Kai Großjohann 2002-12-02 10:12 ` Barry Margolin 0 siblings, 1 reply; 17+ messages in thread From: Kai Großjohann @ 2002-11-30 17:22 UTC (permalink / raw) Barry Margolin <barmar@genuity.net> writes: > I thought I answered this in my earlier post: You're running "more" or > "less", which uses "q" as the command to exit. It is, however, somewhat surprising that running any command in a shell buffer makes C-x k and C-c C-c and so on fail to work. Hm. -- ~/.signature is: umop ap!sdn (Frank Nobis) ^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: How to see the value of each char in a string? 2002-11-30 17:22 ` Kai Großjohann @ 2002-12-02 10:12 ` Barry Margolin 2002-12-02 17:53 ` Kai Großjohann 0 siblings, 1 reply; 17+ messages in thread From: Barry Margolin @ 2002-12-02 10:12 UTC (permalink / raw) [-- Warning: decoded text below may be mangled, UTF-8 assumed --] [-- Attachment #1: Type: text/plain, Size: 988 bytes --] In article <84isyfas6t.fsf@lucy.cs.uni-dortmund.de>, Kai Großjohann <kai.grossjohann@uni-duisburg.de> wrote: >Barry Margolin <barmar@genuity.net> writes: > >> I thought I answered this in my earlier post: You're running "more" or >> "less", which uses "q" as the command to exit. > >It is, however, somewhat surprising that running any command in a >shell buffer makes C-x k and C-c C-c and so on fail to work. What makes you think they're failing? They're sending the usual signal to the program running in the shell buffer. Some applications handle this signal. differently from others. Many interactive applications use SIGINT (what C-c C-c sends) as the way to get back to their prompt, rather than terminate the program completely, and I think less is like this. -- Barry Margolin, barmar@genuity.net Genuity, Woburn, MA *** DON'T SEND TECHNICAL QUESTIONS DIRECTLY TO ME, post them to newsgroups. Please DON'T copy followups to me -- I'll assume it wasn't posted to the group. ^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: How to see the value of each char in a string? 2002-12-02 10:12 ` Barry Margolin @ 2002-12-02 17:53 ` Kai Großjohann 0 siblings, 0 replies; 17+ messages in thread From: Kai Großjohann @ 2002-12-02 17:53 UTC (permalink / raw) Barry Margolin <barmar@genuity.net> writes: > Many interactive applications use SIGINT (what C-c C-c sends) as the > way to get back to their prompt, rather than terminate the program > completely, and I think less is like this. Oh. Uh. Ah! -- ~/.signature is: umop ap!sdn (Frank Nobis) ^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: How to see the value of each char in a string? 2002-11-27 18:50 ` David Combs 2002-11-27 19:22 ` Barry Margolin @ 2002-11-28 10:07 ` Oliver Scholz 2002-11-29 23:57 ` David Combs 1 sibling, 1 reply; 17+ messages in thread From: Oliver Scholz @ 2002-11-28 10:07 UTC (permalink / raw) dkcombs@panix.com (David Combs) writes: [...] > , or, if fill-column happens to be 20: > > (146 157 157 061 > ("f" "o" "o" "2" > > 063 146 157 157) > "3" "f" "o" "o") > > Like, maybe running through the string twice, each > time saving the result, and while generating each one, > inserting three newlines every so often, [...] Well, I think it is not possible (or at least very messy) to do this using the graphical representation of lists. What you wrote above would be the list (146 157 157 061 ("f" "o" "o" "2" 063 146 157 157) "3" "f" "o" "o") I must admit that I am not entirely sure that I understand what you want, despite your eplanation of your problem with `ls'. Maybe something like this? (require 'cl) (defun dc-display-ascii (string) (interactive "sString: ") (let ((standard-output (current-buffer))) (pp (mapcar* 'cons (mapcar 'string string) (mapcar 'identity string))))) If you only want a convenient way to browse the ascii value of the chars in a string or buffer, you might want to have a look at the package ascii.el <URL: http://www.cpqd.com.br/~vinicius/emacs/ascii.el.gz>. Oliver -- 8 Frimaire an 211 de la Révolution Liberté, Egalité, Fraternité! ^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: How to see the value of each char in a string? 2002-11-28 10:07 ` Oliver Scholz @ 2002-11-29 23:57 ` David Combs 0 siblings, 0 replies; 17+ messages in thread From: David Combs @ 2002-11-29 23:57 UTC (permalink / raw) In article <uisyixb0z.fsf@ID-87814.user.dfncis.de>, Oliver Scholz <alkibiades@gmx.de> wrote: >dkcombs@panix.com (David Combs) writes: >[...] >> , or, if fill-column happens to be 20: >> >> (146 157 157 061 >> ("f" "o" "o" "2" >> >> 063 146 157 157) >> "3" "f" "o" "o") >> >> Like, maybe running through the string twice, each >> time saving the result, and while generating each one, >> inserting three newlines every so often, >[...] > >Well, I think it is not possible (or at least very messy) to do this >using the graphical representation of lists. What you wrote above >would be the list > >(146 157 157 061 ("f" "o" "o" "2" 063 146 157 157) "3" "f" "o" "o") > >I must admit that I am not entirely sure that I understand what you >want, despite your eplanation of your problem with `ls'. Maybe >something like this? > >(require 'cl) > >(defun dc-display-ascii (string) > (interactive "sString: ") > (let ((standard-output (current-buffer))) > (pp (mapcar* 'cons > (mapcar 'string string) > (mapcar 'identity string))))) > Yes, thanks, does the trick. >If you only want a convenient way to browse the ascii value of the >chars in a string or buffer, you might want to have a look at the >package ascii.el <URL: http://www.cpqd.com.br/~vinicius/emacs/ascii.el.gz>. Now, *that* is one neat little tool! How does one find out that such tools exist? Thanks! David ^ permalink raw reply [flat|nested] 17+ messages in thread
end of thread, other threads:[~2002-12-05 10:42 UTC | newest] Thread overview: 17+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2002-11-26 6:37 How to see the value of each char in a string? David Combs 2002-11-26 17:31 ` Kai Großjohann 2002-12-04 10:14 ` David Combs 2002-12-04 17:53 ` Kai Großjohann 2002-12-05 10:42 ` Kester Clegg 2002-11-26 18:44 ` Barry Margolin 2002-11-27 7:36 ` David Combs 2002-11-27 9:04 ` Oliver Scholz 2002-11-27 18:50 ` David Combs 2002-11-27 19:22 ` Barry Margolin 2002-11-29 22:24 ` David Combs 2002-11-30 7:28 ` Barry Margolin 2002-11-30 17:22 ` Kai Großjohann 2002-12-02 10:12 ` Barry Margolin 2002-12-02 17:53 ` Kai Großjohann 2002-11-28 10:07 ` Oliver Scholz 2002-11-29 23:57 ` David Combs
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).