unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* mark-sexp signals "Containing expression ends prematurely"
@ 2006-08-30 12:47 Florian Kaufmann
  2006-08-30 14:14 ` rgb
  2006-08-30 15:23 ` Drew Adams
  0 siblings, 2 replies; 3+ messages in thread
From: Florian Kaufmann @ 2006-08-30 12:47 UTC (permalink / raw)


Hello

I'm trying to write a defun which which takes point or the current
region and extends the region at both side by an sexp. This is what I
wrote so far

(defun mark-whole-sexp ()
  (interactive)
  (if (region-exists-p) (if (> (point) (mark))
(exchange-point-and-mark)))
  (mark-sexp -1)
  (exchange-point-and-mark)
  (mark-sexp 1))

I intend to use it in c++ source files, so c++ minor mode (from cc mode
package) is enabled.

However if point or mark bump into a curly brace, that is { or },
mark-sexp signal the "Containing expression ends prematurely" error.
What I want to do in this case is that the region should extend only on
the other side until the whole { } bock is in the region. If I then
call mark-whole-sexp again, the region should extend again around the
sexp preceding and following the block { }.

Has somebody any ideas? Of course I don't expect a final solution, I'm
happy if you can direct me to the right functions I have to use, which
help I then can look up myself.

Thank you

Flo

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2006-08-30 15:23 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-08-30 12:47 mark-sexp signals "Containing expression ends prematurely" Florian Kaufmann
2006-08-30 14:14 ` rgb
2006-08-30 15:23 ` Drew Adams

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).