Thanks, Francis. That's a big help. Kevin Buchs' suggestion solves
this specific case, but I define macros frequently, and within those
macros I often want to move to either the beginning or end of a
narrowed region. I'm looking at (defun beginning-of-buffer ... in
simple.el, and it's not obvious to me why it should not be used in
Lisp programs. But as a programmer I'm more familiar with C and its
descendants. I only have a passing acquaintance with Lisp, so there
may be things that are obvious to an experienced Emacs-Lisp
programmer that are not obvious to me.
Mark
On 5/25/2012 2:24 PM, Francis Wright wrote:
Mark: If I run your macro with standard Emacs settings (having started it
with the -Q flag) then I see the problem that you describe, whereas if I run
with my normal settings then I don't. I think it's a question of how the
region is handled and the significant difference is that in my normal
environment I have Delete Selection Mode turned on, whereas by default it is
off. And it's the setting when the macro is defined that seems to matter.
If you look at the help for M-< it says "Don't use this command in Lisp
programs!", but by using it in a macro that's effectively what you are
doing. However, rather than worrying any further about precisely why your
macro is unreliable, I suggest you use Kevin Buchs' proposal.
Francis
|