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

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

Re: What's a better regexp for 'sentence-end' variable??


From: gebser
Subject: Re: What's a better regexp for 'sentence-end' variable??
Date: Wed, 19 Feb 2003 13:41:37 -0500

Oliver Scholz at 15:06 (UTC+0100) on Tue, 18 Feb 2003 said:

= gebser@ameritech.net writes:
= [...]
= > Because I do considerable editing of html and similar types of files, I
= > wanted to add to the standard definition of "sentence-end". I.e., I
= > wanted emacs to consider an end of sentence such character sequences
= > which have ".", "?", or "!" when they are followed by either a "<" or
= > ">".
= 
= [...]
= > (defcustom sentence-end (purecopy "[.?!][]\<>\"')}]*\\($\\| $\\|\t\\|  
= > \\)[ \t\n]*")
= 
= What is the `purecopy' in your code good for? You didn't change this
= in the source code, did you? ;-)

Ya got me.  That's what's used in paragraphs.el where "sentence-end" is 
defined.

= 
= [...]
= > I want the cursor to land on top of the ">" or "<" character immediately
= > after string comprising the standard definition.  That is, given:
= >
= > end.</p>
= >
= > hitting M-e would place the cursor after the period.
= 
= I would do it with a simple bit of Elisp.  You could put something
= like the following into your ~/.emacs:
= 
= 
= (defun my-html-forward-sentence ()
=   (interactive)
=   (save-match-data
=     (if (re-search-forward "\\([.?!]\\)<" nil t)
=       (goto-char (match-end 1))
=       (goto-char (point-max)))))

This is pretty much what I wanted.  Thanks.

= 
= (define-key sgml-mode-map (kbd "M-e") 'my-html-forward-sentence)

This didn't go.  An error told me that I don't have the path (to psgml).  
I haven't been able to figure that one out yet.


Thanks again,
ken




reply via email to

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