[OS X Emacs] Select all: how to *not* jump to the beginning of the file + how to not change the selection?

Hofert Jan Marius marius.hofert at math.ethz.ch
Wed Sep 21 17:05:47 EDT 2011

Dear Piet, Elliott, Jack, and David,

thanks a lot for helping. As a newbie I have tons of these questions [some other you might see in the near future :-)], even after reading some blogs, emacswiki etc.. This list helps me a lot getting used to the "best practices". 

In contrast to what I thought, Elliott's solution with remembering the position works quite well and is useful in other context as well (not just selecting a region).

I also tried Piet's suggestion:
(1) C-<SPC> # set a mark
(2) then move the cursor somewhere else; apply a command to the selected region etc.
(3) C-U C-<SPC> # brings you back to the original cursor position.
Pretty nice and fairly simple :-)

Still, not being able to select all without moving is a slight drawback, for example, when you want to show some code to students on a beamer... it's a bit like a presentation where the presenter jumps between the slides [which I find quite distracting]. But maybe the goal should be just not to use such moves. I hope that learning emacs a bit better over time will bring this "aha"-effect that some things I just don't need to do.

Concerning David's suggestion, I tried:
(1) M-"mouse-drag" # this selected the chosen region and gave it a different color
(2) M-w # tried to copy it
(3) C-y # tried to paste it
But it wasn't pasted the copied region, it was pasted something from the clipboard which I copied there some time ago. [I'm sure I understood something wrong here]
Copying is still something I don't feel comfortable with: On the Mac I use CMD + C all the time. As far as I know, in Aquamacs the same should work. Sometimes it does, sometimes it doesn't. I guess it depends on the mode but I should narrow down this behavior more clearly. Since M-w always works I am wondering if one can hard-bind CMD + C to execute M-w when in Aquamacs (via some kind of global key definition)...



On 2011-09-21, at 22:39 , David Reitter wrote:

> On Sep 21, 2011, at 4:25 PM, Piet van Oostrum wrote:
>> And as has been said,
>> selecting all without moving the current position is impossible in
>> Emacs. But it wouldn't be hard to change C-x h / Cmd-A such that it
>> saves the current position and introduce another key to return to
>> it. 
> There is always the secondary selection (e.g., Option/Meta+mouse-drag). I have experimented with an automatic mechanism to set the region before executing any command, and reverting the point back to where it was, but there the tricky bit is to decide for which commands to do this.
> Secondly, making a secondary selection does not scroll the window.  This would have to be taken care of.
> --
> http://aquamacs.org -- Aquamacs: Emacs on Mac OS X
> http://aquamacs.org/donate -- Could we help you? Return the favor and support the Aquamacs Project!_____________________________________________________________
> MacOSX-Emacs mailing list
> MacOSX-Emacs at email.esm.psu.edu
> http://email.esm.psu.edu/mailman/listinfo/macosx-emacs
> List Archives: http://dir.gmane.org/gmane.emacs.macintosh.osx

More information about the MacOSX-Emacs mailing list