Search code examples
macosemacsaquamacs

Making Aquamacs scrolling more like Emacs


When I used emacs, I used to be able to set the mark and highlight full pages for yanking using C-v, or scroll-up. However, in Aquamacs if I set the mark then hit C-v it loses the mark and stops highlighting. I noticed that in Aquamacs C-v is instead mapped to aquamacs-page-down, so I tried adding the following command to my site file:

(define-key osx-key-mode-map "C-v" 'scroll-up)

and this didn't successfully remap the key. I then tried something similar:

(define-key global-map "\C-v" 'scroll-up)

and still nothing. Aquamacs very stubbornly hangs onto the mapping to aquamacs-page-down. I noticed, however, that there's an additional function, aquamacs-page-down-extend-region, which does exactly what I'm talking about. Its key sequence, however, is , and I have no idea how to input that. I tried "shift-control-v" to no avail.

Has anyone been able to get Aquamacs to scroll pages while maintaining the mark?


Solution

  • I've found a way to get this to work, for posterity's sake.

    Paste this into the .emacs file:

    ;; Enable scrolling to maintain mark if set
    (defun scroll-down-maintain-mark ()
      (interactive)
      (if mark-active
          (aquamacs-page-down-extend-region)
        (aquamacs-page-down)))
    
    (defun scroll-up-maintain-mark ()
      (interactive)
      (if mark-active
          (aquamacs-page-up-extend-region)
        (aquamacs-page-up)))
    
    (define-key global-map "\C-v" #'scroll-down-maintain-mark)
    (define-key global-map "\M-v" #'scroll-up-maintain-mark)