all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* String to Vector
@ 2010-02-03 17:40 Johan Andersson
  2010-02-03 17:55 ` Lennart Borgman
  0 siblings, 1 reply; 8+ messages in thread
From: Johan Andersson @ 2010-02-03 17:40 UTC (permalink / raw)
  To: help-gnu-emacs

[-- Attachment #1: Type: text/plain, Size: 345 bytes --]

Hi,

How can I convert for example the string: "M-x" to the vector: "[?\M-x]"?

(string-to-vector "M-x") will not give me the correct vector. I will give me
the vector for each part of the string.

I want to do something like this:
(execute-kbd-macro
 (vconcat
  (string-to-vector "M-x ")
  (string-to-vector "linum-mode ")
  (vector 'return)))

[-- Attachment #2: Type: text/html, Size: 535 bytes --]

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

* Re: String to Vector
  2010-02-03 17:40 Johan Andersson
@ 2010-02-03 17:55 ` Lennart Borgman
  2010-02-03 18:07   ` Johan Andersson
  0 siblings, 1 reply; 8+ messages in thread
From: Lennart Borgman @ 2010-02-03 17:55 UTC (permalink / raw)
  To: Johan Andersson; +Cc: help-gnu-emacs

On Wed, Feb 3, 2010 at 6:40 PM, Johan Andersson <johan.rejeep@gmail.com> wrote:
> Hi,
> How can I convert for example the string: "M-x" to the vector: "[?\M-x]"?

Is it something like this you are looking for:

    (edmacro-parse-keys "M-x")




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

* Re: String to Vector
  2010-02-03 17:55 ` Lennart Borgman
@ 2010-02-03 18:07   ` Johan Andersson
  2010-02-03 18:10     ` Lennart Borgman
  0 siblings, 1 reply; 8+ messages in thread
From: Johan Andersson @ 2010-02-03 18:07 UTC (permalink / raw)
  To: Lennart Borgman; +Cc: help-gnu-emacs

[-- Attachment #1: Type: text/plain, Size: 876 bytes --]

In Emacs, it's all about finding the functions. Yes, Lennart that's the
function I'm looking for.

But can you execute the chain without concatenating the vectors? I would
rather be able to do something like this:
(progn
  (execute-kbd-macro (edmacro-parse-keys "M-x"))
  (execute-kbd-macro (edmacro-parse-keys "linum-mode"))
  (execute-kbd-macro (vector 'return)))

I want the above to give me the same result as this:
(execute-kbd-macro
 (vconcat
  (edmacro-parse-keys "M-x")
  (edmacro-parse-keys "linum-mode")
  (vector 'return)))

On Wed, Feb 3, 2010 at 5:55 PM, Lennart Borgman
<lennart.borgman@gmail.com>wrote:

> On Wed, Feb 3, 2010 at 6:40 PM, Johan Andersson <johan.rejeep@gmail.com>
> wrote:
> > Hi,
> > How can I convert for example the string: "M-x" to the vector: "[?\M-x]"?
>
> Is it something like this you are looking for:
>
>    (edmacro-parse-keys "M-x")
>

[-- Attachment #2: Type: text/html, Size: 1468 bytes --]

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

* Re: String to Vector
  2010-02-03 18:07   ` Johan Andersson
@ 2010-02-03 18:10     ` Lennart Borgman
  2010-02-03 20:21       ` Johan Andersson
  0 siblings, 1 reply; 8+ messages in thread
From: Lennart Borgman @ 2010-02-03 18:10 UTC (permalink / raw)
  To: Johan Andersson; +Cc: help-gnu-emacs

On Wed, Feb 3, 2010 at 7:07 PM, Johan Andersson <johan.rejeep@gmail.com> wrote:
> In Emacs, it's all about finding the functions. Yes, Lennart that's the
> function I'm looking for.
> But can you execute the chain without concatenating the vectors? I would
> rather be able to do something like this:
> (progn
>   (execute-kbd-macro (edmacro-parse-keys "M-x"))
>   (execute-kbd-macro (edmacro-parse-keys "linum-mode"))
>   (execute-kbd-macro (vector 'return)))
> I want the above to give me the same result as this:
> (execute-kbd-macro
>  (vconcat
>   (edmacro-parse-keys "M-x")
>   (edmacro-parse-keys "linum-mode")
>   (vector 'return)))


I have no idea. I do not use keyboard macros that way.

But if you really want to know I guess the easiest way is just
trial-and-error. Record a keyboard macro, save it and examine how it
looks.




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

* Re: String to Vector
       [not found] <mailman.649.1265218832.14305.help-gnu-emacs@gnu.org>
@ 2010-02-03 19:40 ` Stefan Monnier
  2010-02-03 22:05   ` Johan Andersson
  2010-02-03 22:16 ` Pascal J. Bourguignon
  1 sibling, 1 reply; 8+ messages in thread
From: Stefan Monnier @ 2010-02-03 19:40 UTC (permalink / raw)
  To: help-gnu-emacs

> How can I convert for example the string: "M-x" to the vector: "[?\M-x]"?

(kbd "M-x")  =>  [?\M-x]  (which gets printed as [134217848])


        Stefan


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

* Re: String to Vector
  2010-02-03 18:10     ` Lennart Borgman
@ 2010-02-03 20:21       ` Johan Andersson
  0 siblings, 0 replies; 8+ messages in thread
From: Johan Andersson @ 2010-02-03 20:21 UTC (permalink / raw)
  To: Lennart Borgman; +Cc: help-gnu-emacs

[-- Attachment #1: Type: text/plain, Size: 979 bytes --]

Ok, thanks!

On Wed, Feb 3, 2010 at 6:10 PM, Lennart Borgman
<lennart.borgman@gmail.com>wrote:

> On Wed, Feb 3, 2010 at 7:07 PM, Johan Andersson <johan.rejeep@gmail.com>
> wrote:
> > In Emacs, it's all about finding the functions. Yes, Lennart that's the
> > function I'm looking for.
> > But can you execute the chain without concatenating the vectors? I would
> > rather be able to do something like this:
> > (progn
> >   (execute-kbd-macro (edmacro-parse-keys "M-x"))
> >   (execute-kbd-macro (edmacro-parse-keys "linum-mode"))
> >   (execute-kbd-macro (vector 'return)))
> > I want the above to give me the same result as this:
> > (execute-kbd-macro
> >  (vconcat
> >   (edmacro-parse-keys "M-x")
> >   (edmacro-parse-keys "linum-mode")
> >   (vector 'return)))
>
>
> I have no idea. I do not use keyboard macros that way.
>
> But if you really want to know I guess the easiest way is just
> trial-and-error. Record a keyboard macro, save it and examine how it
> looks.
>

[-- Attachment #2: Type: text/html, Size: 1458 bytes --]

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

* Re: String to Vector
  2010-02-03 19:40 ` String to Vector Stefan Monnier
@ 2010-02-03 22:05   ` Johan Andersson
  0 siblings, 0 replies; 8+ messages in thread
From: Johan Andersson @ 2010-02-03 22:05 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: help-gnu-emacs

[-- Attachment #1: Type: text/plain, Size: 303 bytes --]

Thats true. How come I didn't think of that...  Thanks

On Wed, Feb 3, 2010 at 7:40 PM, Stefan Monnier <monnier@iro.umontreal.ca>wrote:

> > How can I convert for example the string: "M-x" to the vector: "[?\M-x]"?
>
> (kbd "M-x")  =>  [?\M-x]  (which gets printed as [134217848])
>
>
>        Stefan
>

[-- Attachment #2: Type: text/html, Size: 655 bytes --]

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

* Re: String to Vector
       [not found] <mailman.649.1265218832.14305.help-gnu-emacs@gnu.org>
  2010-02-03 19:40 ` String to Vector Stefan Monnier
@ 2010-02-03 22:16 ` Pascal J. Bourguignon
  1 sibling, 0 replies; 8+ messages in thread
From: Pascal J. Bourguignon @ 2010-02-03 22:16 UTC (permalink / raw)
  To: help-gnu-emacs

Johan Andersson <johan.rejeep@gmail.com> writes:
> How can I convert for example the string: "M-x" to the vector: "[?\M-x]"?

I use the kbd macro: (kbd "M-x") --> [134217848]
Notice that                  ?\M-x == 134217848

-- 
__Pascal Bourguignon__


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

end of thread, other threads:[~2010-02-03 22:16 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <mailman.649.1265218832.14305.help-gnu-emacs@gnu.org>
2010-02-03 19:40 ` String to Vector Stefan Monnier
2010-02-03 22:05   ` Johan Andersson
2010-02-03 22:16 ` Pascal J. Bourguignon
2010-02-03 17:40 Johan Andersson
2010-02-03 17:55 ` Lennart Borgman
2010-02-03 18:07   ` Johan Andersson
2010-02-03 18:10     ` Lennart Borgman
2010-02-03 20:21       ` Johan Andersson

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.