Tuesday, 29 July 2008

Emacs org-mode bindings

« org-mode for emacs | Main | Javascript conventions »

As I have continued to play with org-mode for emacs, I cannot seem to get over the rebinding of meta-right, meta-left, and so forth. As such I remap them to super-right, super-left and so on. Changing the "s" right after concat to an "H" should remap to use the hyper key. No word on coke bottle bindings yet.

(add-hook 'org-mode-hook
	  '(lambda nil
	     (if (lookup-key (current-local-map) (kbd "M-<down>"))
		 (let ((annoying-bindings '("M-S-<down>" "M-S-<left>" "M-S-<return>" "M-S-<right>" "M-S-<up>" "M-<down>" "M-<left>" "M-<return>" "M-<right>" "M-<tab>" "M-<up>")))
		   (mapc (lambda (binding)
			   (let* ((original-binding (eval `(kbd ,binding)))
				  (new-binding (eval `(kbd ,(concat "s" (substring binding 1)))))
				  (bound-function (lookup-key (current-local-map) original-binding)))
			     (message (format "rebinding %s to %s for %s" original-binding new-binding bound-function))
			     (local-unset-key original-binding)
			     (local-set-key new-binding bound-function)
			     ))
			 annoying-bindings)
	       
		   (message "setting other keys")
		   (local-set-key  (kbd "s-o")
				   '(lambda ()
				      (interactive)
				      (org-open-at-point)
				      (delete-other-windows)))
		   (local-set-key (kbd "s-t") 'org-todo-list)))))
Posted by james at 7:23 PM in emacs

 

[Trackback URL for this entry]

Your comment:

(not displayed)
 
 
 

Live Comment Preview:

 
« July »
SunMonTueWedThuFriSat
  12345
6789101112
13141516171819
20212223242526
2728293031