Hi
I've also another problem with emacs lisp:
(defun url (url name)
(interactive "sURL: \nsName: ")
(cond
(t
(insert "<a href=\"" url ".html\" onMouseover=\"li('" url "')\"
onMouseout=\"li('.')\">" name "</a>"))))
(find-file "d:/jo/v2/des.js")
(search-forward-regexp "\\<%s\\>" (substring url 0 1))
the problem: how can I search for (substring url 0 1) ??
short explanation of the whole thing:
I type the url and the name of my link in the minibuffer. The link is
inserted. Then the function opens the file "des.js" where a list with
descriptions of the links is. now I want to search this list for the
first character of url and then I want to proof if there's already
a description of the link or not. if not, I want to insert the
description.
the list in des.js looks like this:
// a
if(n.charAt(0) == "a") {
if(n == "a..") {
parent.oben.f1.link.value = "Description of the link";
}
}
this is ok and I hope I'm able to solve this, but the problem is that
I don't know how to search for (substring url 0 1)
thanks..
Marcel
·········@gmx.de (Marcel Schmittfull) writes:
> Hi
> I've also another problem with emacs lisp:
>
> (defun url (url name)
> (interactive "sURL: \nsName: ")
> (cond
>
> (t
> (insert "<a href=\"" url ".html\" onMouseover=\"li('" url "')\"
> onMouseout=\"li('.')\">" name "</a>"))))
>
> (find-file "d:/jo/v2/des.js")
>
> (search-forward-regexp "\\<%s\\>" (substring url 0 1))
>
> the problem: how can I search for (substring url 0 1) ??
Like this:
(search-forward (substring url 0 1))
Or like this:
(re-search-forward (format "\\<%s\\>" (substring url 0 1)))
May I suggest that you obtain a copy of the Elisp manual? It's
available in a variety of formats from
http://www.gnu.org/manual/elisp/
(and GNU mirrors worldwide, I imagine).
> short explanation of the whole thing:
> I type the url and the name of my link in the minibuffer. The link is
> inserted. Then the function opens the file "des.js" where a list with
> descriptions of the links is. now I want to search this list for the
> first character of url and then I want to proof if there's already
> a description of the link or not. if not, I want to insert the
> description.
>
> the list in des.js looks like this:
>
> // a
> if(n.charAt(0) == "a") {
>
> if(n == "a..") {
> parent.oben.f1.link.value = "Description of the link";
> }
> }
>
>
> this is ok and I hope I'm able to solve this, but the problem is that
> I don't know how to search for (substring url 0 1)
>
> thanks..
> Marcel
--
Evgeny
The Soviet Union does not exist any more in its present format.