home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!cs.utexas.edu!sdd.hp.com!elroy.jpl.nasa.gov!swrinde!news.dell.com!texsun!digi!kgallagh
- From: kgallagh@digi.lonestar.org (Kevin Gallagher)
- Newsgroups: alt.religion.emacs
- Subject: Re: What does (point) point at?
- Message-ID: <1992Nov22.215430.3176@digi.lonestar.org>
- Date: 22 Nov 92 21:54:30 GMT
- References: <DOOM.92Nov21200251@elaine6.Stanford.EDU>
- Distribution: alt
- Organization: DSC Communications Corp, Plano, TX
- Lines: 34
-
- In article <DOOM.92Nov21200251@elaine6.Stanford.EDU> doom@elaine6.Stanford.EDU (Joseph Brenner) writes:
- >In emacs lisp, you can evaluate (point) to find out where
- >the point is. How do you find out what is at this point in
- >the file? For example, I might want to do one thing if the
- >cursor is on some white space, and another thing if it's on
- >a character, but I can only think of the most kludgy ways of
- >checking which is the case.
- >
- >(How's this: put the cursor somewhere. Record the location.
- >Do a search for a space. Compare location to the recorded
- >location. If the location has changed, you know it wasn't a
- >space.
- >
- >There's gotta be a better way.)
-
- Without moving point, the following code tests if the character following
- point is a white space, according to the definition of white space in the
- syntax table.
-
- (eq ?\ (char-syntax (following-char))
-
- Note, there are 2 blanks after the back slash character. (For more
- information, check out Chapter 30, Syntax Tables, in the GNU Emacs Lisp
- Reference Manual, Edition 1.03.)
-
- From a programming view, point always lies BETWEEN two characters, while the
- cursor lies on top of the character immediately following point. (This is all
- explained in section 1.1, Point, of the GNU Emacs Manual.) Thus, the function
- "following-char" returns the character under the cursor.
- --
- ----------------------------------------------------------------------------
- Kevin Gallagher kgallagh@digi.lonestar.org OR ...!uunet!digi!kgallagh
- DSC Communications Corporation Addr: MS 152, 1000 Coit Rd, Plano, TX 75075
- ----------------------------------------------------------------------------
-