[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
mark-sexp signals "Containing expression ends prematurely"
From: |
Florian Kaufmann |
Subject: |
mark-sexp signals "Containing expression ends prematurely" |
Date: |
30 Aug 2006 05:47:45 -0700 |
User-agent: |
G2/0.2 |
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
- mark-sexp signals "Containing expression ends prematurely",
Florian Kaufmann <=