* elisp syntax for .emacs code beginners help (inserting "" marks example)
@ 2009-09-03 8:14 rpd
0 siblings, 0 replies; 6+ messages in thread
From: rpd @ 2009-09-03 8:14 UTC (permalink / raw
To: Help-gnu-emacs
Hi
Anyone know of a good elisp primer/tutorial to learn the syntax?
As an example I have this code (in a defun command):
(insert "[Event ""]\n")
which when I call this, it outputs [Event ]
BUT what I want is [Event " "]
So somehow I need the quote marks to show!
I have googled to find out about writing elisp code but haven't got to a
simple tutorial yet (I have a copy of elisp manual but it is quite big!-take
a long time to go through!).
I will fiddle around with the " " code above (maybe try escaping with \"\
\"\).
However if anyone can tell me how to do this & point me to a good simple
tutorial as I try to start to write some elisp code for my .emacs file I
would be very grateful.
I look forward to any helpful reply, thanks
--
View this message in context: http://www.nabble.com/elisp-syntax-for-.emacs-code-beginners-help-%28inserting-%22%22-marks-example%29-tp25271571p25271571.html
Sent from the Emacs - Help mailing list archive at Nabble.com.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: elisp syntax for .emacs code beginners help (inserting "" marks example)
[not found] <mailman.5929.1251965649.2239.help-gnu-emacs@gnu.org>
@ 2009-09-03 8:19 ` Anders Wirzenius
2009-09-04 7:22 ` rpd
0 siblings, 1 reply; 6+ messages in thread
From: Anders Wirzenius @ 2009-09-03 8:19 UTC (permalink / raw
To: help-gnu-emacs
rpd <richard@dickinson350.freeserve.co.uk> writes:
> Hi
> Anyone know of a good elisp primer/tutorial to learn the syntax?
>
> As an example I have this code (in a defun command):
> (insert "[Event ""]\n")
> which when I call this, it outputs [Event ]
> BUT what I want is [Event " "]
>
> So somehow I need the quote marks to show!
> I have googled to find out about writing elisp code but haven't got to a
> simple tutorial yet (I have a copy of elisp manual but it is quite big!-take
> a long time to go through!).
>
> I will fiddle around with the " " code above (maybe try escaping with \"\
> \"\).
> However if anyone can tell me how to do this & point me to a good simple
> tutorial as I try to start to write some elisp code for my .emacs file I
> would be very grateful.
>
> I look forward to any helpful reply, thanks
try
(insert "[Event \" \"]\n")
--
Anders
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: elisp syntax for .emacs code beginners help (inserting "" marks example)
2009-09-03 8:19 ` elisp syntax for .emacs code beginners help (inserting "" marks example) Anders Wirzenius
@ 2009-09-04 7:22 ` rpd
2009-09-04 10:26 ` Sean Sieger
2009-09-05 16:37 ` Tyler Smith
0 siblings, 2 replies; 6+ messages in thread
From: rpd @ 2009-09-04 7:22 UTC (permalink / raw
To: Help-gnu-emacs
Hi Anders
Thanks for your helpful reply. Your suggestion works...
This code: (insert "[Event \"\"]\n") does show the quotation marks &
outputs:
[Event ""] <<<which is what I wanted ie quotation marks showing.
Then I wanted to insert whitespace between the quotation marks. Again I
cannot find documentation for doing this but this code:
(insert "[Event \" \ \ \ \"]\n") does output spaces between the quotation
marks ie it outputs:
[Event " "]
(using space-backslash escaped syntax)
Is there clear documentation in any lisp/elisp or emacs help manuals
anywhere to help one learn this syntax?
Anyway I have sorted this by trial & error & through the help forum. Thanks
very much for your help, regards
Anders Wirzenius-2 wrote:
>
> rpd <richard@dickinson350.freeserve.co.uk> writes:
>
>> Hi
>> Anyone know of a good elisp primer/tutorial to learn the syntax?
>>
>> As an example I have this code (in a defun command):
>> (insert "[Event ""]\n")
>> which when I call this, it outputs [Event ]
>> BUT what I want is [Event " "]
>>
>> So somehow I need the quote marks to show!
>> I have googled to find out about writing elisp code but haven't got to a
>> simple tutorial yet (I have a copy of elisp manual but it is quite
>> big!-take
>> a long time to go through!).
>>
>> I will fiddle around with the " " code above (maybe try escaping with \"\
>> \"\).
>> However if anyone can tell me how to do this & point me to a good simple
>> tutorial as I try to start to write some elisp code for my .emacs file I
>> would be very grateful.
>>
>> I look forward to any helpful reply, thanks
>
> try
> (insert "[Event \" \"]\n")
>
> --
> Anders
>
>
--
View this message in context: http://www.nabble.com/elisp-syntax-for-.emacs-code-beginners-help-%28inserting-%22%22-marks-example%29-tp25271571p25288843.html
Sent from the Emacs - Help mailing list archive at Nabble.com.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: elisp syntax for .emacs code beginners help (inserting "" marks example)
2009-09-04 7:22 ` rpd
@ 2009-09-04 10:26 ` Sean Sieger
2009-09-04 20:43 ` rpd
2009-09-05 16:37 ` Tyler Smith
1 sibling, 1 reply; 6+ messages in thread
From: Sean Sieger @ 2009-09-04 10:26 UTC (permalink / raw
To: help-gnu-emacs
rpd <richard@dickinson350.freeserve.co.uk> writes:
[Event ""] <<<which is what I wanted ie quotation marks showing.
Then I wanted to insert whitespace between the quotation marks.
Maybe I don't understand what you are trying to accomplish, but rather
than create whitespace between the double quotes, wouldn't you have
point end up between the them, ready to edit: [Event "|"]? Certainly
you can appropriate the code for that from another library.
Please forgive me if this is from `left field'.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: elisp syntax for .emacs code beginners help (inserting "" marks example)
2009-09-04 10:26 ` Sean Sieger
@ 2009-09-04 20:43 ` rpd
0 siblings, 0 replies; 6+ messages in thread
From: rpd @ 2009-09-04 20:43 UTC (permalink / raw
To: Help-gnu-emacs
Hi Sean
Good point (pun?!)-Thanks-that is a cool idea.
I won't pursue it just now but I hope to bear it in mind & investigate doing
this somtime later.
Best wishes
Sean Sieger wrote:
>
> rpd <richard@dickinson350.freeserve.co.uk> writes:
>
> [Event ""] <<<which is what I wanted ie quotation marks showing.
>
> Then I wanted to insert whitespace between the quotation marks.
>
> Maybe I don't understand what you are trying to accomplish, but rather
> than create whitespace between the double quotes, wouldn't you have
> point end up between the them, ready to edit: [Event "|"]? Certainly
> you can appropriate the code for that from another library.
>
> Please forgive me if this is from `left field'.
>
>
>
>
>
--
View this message in context: http://www.nabble.com/elisp-syntax-for-.emacs-code-beginners-help-%28inserting-%22%22-marks-example%29-tp25271571p25301663.html
Sent from the Emacs - Help mailing list archive at Nabble.com.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: elisp syntax for .emacs code beginners help (inserting "" marks example)
2009-09-04 7:22 ` rpd
2009-09-04 10:26 ` Sean Sieger
@ 2009-09-05 16:37 ` Tyler Smith
1 sibling, 0 replies; 6+ messages in thread
From: Tyler Smith @ 2009-09-05 16:37 UTC (permalink / raw
To: rpd, Emacs Help
rpd wrote:
> Then I wanted to insert whitespace between the quotation marks. Again I
> cannot find documentation for doing this but this code:
>
> (insert "[Event \" \ \ \ \"]\n") does output spaces between the quotation
> marks ie it outputs:
>
>
Everything between double quotes gets inserted. This means that if you
want to insert a double quote, you need to escape it. If you don't emacs
interprets the second quote as the end of the string to be inserted, and
the third quote as the beginning of another quote.
Spaces are not special. As you've already seen, any space occurring
between two quotes gets inserted. Escaping has no effect on spaces,
except to make your code uglier. So you could use:
(insert "[Event \" \"]\n")
> [Event " "]
>
> (using space-backslash escaped syntax)
>
> Is there clear documentation in any lisp/elisp or emacs help manuals
> anywhere to help one learn this syntax?
>
>
Most Emacs distributions come bundled with the very useful Introduction
to emacs lisp as part of the info system. Ctrl-h i opens the info
browser, and you'll find the Intro to emacs lisp listed under the
heading Emacs. It's a very gentle introduction to elisp programming. If
you already know how to program in elisp, then the documentation for
escape syntax is found in the node Character type in the elisp manual.
You can get there by evaluating (info "(elisp)Character type"), or just
by browsing through the elisp manual in the info system.
HTH,
Tyler
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2009-09-05 16:37 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <mailman.5929.1251965649.2239.help-gnu-emacs@gnu.org>
2009-09-03 8:19 ` elisp syntax for .emacs code beginners help (inserting "" marks example) Anders Wirzenius
2009-09-04 7:22 ` rpd
2009-09-04 10:26 ` Sean Sieger
2009-09-04 20:43 ` rpd
2009-09-05 16:37 ` Tyler Smith
2009-09-03 8:14 rpd
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.