help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

elisp search-forward problem - function stops on search failed error


From: acomber
Subject: elisp search-forward problem - function stops on search failed error
Date: Thu, 11 Apr 2013 04:24:34 -0700 (PDT)

I wrote a function to replace tab characters with a string as in:

(defun do-cols () 
  "convert tab char to html td delim"
  (interactive)
  (goto-char (point-min)) 
     (while (search-forward "\t")
        (insert "
")
     )
) 

which works fine but on finishing I see in the command window: Search
failed: "    "

I think that when this error occurs the lisp function stops running.
That doesn't matter for simple use of do-cols but I want to call the
function from a bigger lisp function and I think if this error occurs
then the calling lisp function stops processing.

so anyway, I changed the function like this:

(defun do-cols () 
  "convert tab char to html td delim"
  (interactive)
  (goto-char (point-min)) 
     (while (search-forward "\t", nil, t)
        (insert "
")
     )
)

But this function does nothing, get error:

Symbol's value as variable is void: \,

How can I fix do-cols so it actually works and will allow a calling
function to continue processing to next line?

eg I might want:

(defun do-table () 
  "convert word table to html"
  (interactive)
  (goto-char (point-min)) 
  (do-cols)
  (do-rows)
)




--
View this message in context: 
http://emacs.1067599.n5.nabble.com/elisp-search-forward-problem-function-stops-on-search-failed-error-tp283469.html
Sent from the Emacs - Help mailing list archive at Nabble.com.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]