is there any way know there is set-mark beginning and where is the start point query in lisp
+1
A:
I'd recommend turning on transient-mark-mode
(setq transient-mark-mode t)
transient-mark-mode
will highlight the region between the mark and your current point.
Alternatively, you can press C-x C-x
to jump between the current point and the mark to see where the mark is set.
Ryan McGeary
2009-12-20 00:56:12
thanks Ryan, how programming in lisp to know mark-mode is mark now
leedit
2009-12-20 02:29:48
+3
A:
Use the variable mark-active
:
mark-active is a variable defined in `C source code'.
Its value is nil
Local in buffer whole-line-or-region.el; global value is nil
Automatically becomes buffer-local when set in any fashion.
Documentation:
Non-nil means the mark and region are currently active in this buffer.
You might also want to check if mark === point, if it's really a region you're looking for:
(if (and mark-active
(/= (point) (mark)))
If you want to write a function that requires a region be defined, you can use interactive
, like so:
(defun my-fn-that-requires-a-region (beg end)
"Some documentation string mentioning BEG and END."
(interactive "r")
(message "%d / %d" beg end))
If called interactively, mark must be set or an error is generated. Called programatically, any two values must be passed in; no validation of the parameters is done.
Joe Casadonte
2009-12-20 03:11:18