[ESS] Use of up arrow and down arrow keys

John Maindonald john.maindonald at anu.edu.au
Fri Jul 8 11:12:41 CEST 2005


I've just now moved to using Aquaemacs (Mac OS X), from

http://aquamacs.org/

I've had code in my .emacs file that binds the up arrow key
to <ESC>P, etc.  This does not work with Aquaemacs; I get
the message:
   "Symbol's value as variable is void: xemacs-flag"
Is there some way to make the up and down arrow (cursor)
keys work, with my setup?

John Maindonald.


(defun smart-comint-up ()
   "Implement the behaviour of the up arrow key in comint mode.  At
the end of buffer, do comint-previous-input, otherwise just move in
the buffer."
   (interactive)
   (let ((previous-region-status (if xemacs-flag (region-active-p) nil)))
     (if (= (point) (point-max))
	(comint-previous-input 1)
       (previous-line 1))
     (when previous-region-status
       (activate-region))))

(defun smart-comint-down ()
   "Implement the behaviour of the down arrow key in comint mode.  At
the end of buffer, do comint-next-input, otherwise just move in the
buffer."
   (interactive)
   (let ((previous-region-status (if xemacs-flag (region-active-p) nil)))
     (if (= (point) (point-max))
	(comint-next-input 1)
       (forward-line 1))
     (when previous-region-status
       (activate-region))))

;;; Set up the smart comint arrow keys.  See smart-comint-up/down.
(defun setup-smart-comint-arrow-keys ()
   "Set up the smart comint arrow keys.  See smart-comint-up/down."
   (local-set-key [up] 'smart-comint-up)
   (local-set-key [down] 'smart-comint-down))

;;; This hook will be called when entering several `comint' modes:
;;; 'gud/gdb', `shell', `term', `ielm', `tex-shell', 'inferior-ess'.
(mapcar #'(lambda (hook) (add-hook hook 'setup-smart-comint-arrow-keys))
	(list 'gdb-mode-hook 'shell-mode-hook 'term-mode-hook
	      'ielm-mode-hook 'tex-shell-hook 'inferior-ess-mode-hook))

On 15 Jun 2005, at 1:20 PM, Jonathan Baron wrote:

John Maindonald             email: john.maindonald at anu.edu.au
phone : +61 2 (6125)3473    fax  : +61 2(6125)5549
Centre for Bioinformation Science, Room 1194,
John Dedman Mathematical Sciences Building (Building 27)
Australian National University, Canberra ACT 0200.




More information about the ESS-help mailing list