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

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

[h-e-w] Find sexp at cursor


From: Gallucci, David
Subject: [h-e-w] Find sexp at cursor
Date: Mon, 19 Nov 2001 11:28:56 -0500

This is a piece of lisp I wrote to find current sexp at cursor. The problem
is with substrings. For instance, if the current sexp under the cursor is
foo, running this code will advance to the next instance of foo as expected.
If I execute again, it advances to foo-bar, since the foo substring is
actually part of foo-bar. But now all subsequent searches are looking for
foo-bar, and not the originally intended string "foo". It seems that I need
to somehow persist the orignal search string between calls.

(defun dg-f-search-sexp-at-cursor ()
  "Searches forward for word under cursor."
  (interactive)
  (if (not (search-forward (current-word) nil t))
      (message (format "\"%s\" not found." (current-word)))))

Thanks,

Dave Gallucci




reply via email to

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