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

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

Re: [h-e-w] Why do replace commands sometimes not work?


From: Francis Wright
Subject: Re: [h-e-w] Why do replace commands sometimes not work?
Date: Sat, 26 May 2012 14:06:17 +0100

I think the problem is that M-< does more than just move point to (point-min); it may also run (push-mark). You should be able to stop that happening by calling beginning-of-buffer with a universal argument, i.e. use C-u M-<. You might like to see if that helps.

 

Francis

 

From: address@hidden [mailto:address@hidden On Behalf Of MBR
Sent: 25 May 2012 8:25 pm
To: Francis Wright
Cc: address@hidden; 'Raymond Zeitler'
Subject: Re: [h-e-w] Why do replace commands sometimes not work?

 

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
 

reply via email to

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