[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
wmanip.el - minor fix to deal with buffer-local minor-mode-map
From: |
Ian Zimmerman |
Subject: |
wmanip.el - minor fix to deal with buffer-local minor-mode-map |
Date: |
Tue, 31 Jan 2006 17:41:27 -0800 (PST) |
User-agent: |
Gnus/5.09 (Gnus v5.9.0) Emacs/21.4 |
;;; wmanip.el --- manipulate windows from the keyboard
;; Copyright (C) Ian Zimmerman, December 2002
;; Terms: GNU General Public License, Version 2
(defvar wmanip-mode nil
"The global flag for the wmanip minor mode.")
(defun wmanip-mode (&optional arg)
"Set or toggle the wmanip minor mode.
\\<wmanip-mode-map> This mode provides a keyboard interface to the window
manipulation commands {enlarge,shrink}-window{,-horizontally} which is
actually usable. The keybindings for these commands that are built
into Emacs (C-x^, C-x{, C-x}) are terrible because to repeating them
means stretching your hands back and forth over the keyboard.
\\[other-window] - Select the ARG'th different window on this frame.
\\[enlarge-window] - Make current window ARG lines bigger.
\\[shrink-window] - Make current window ARG lines smaller.
\\[enlarge-window-horizontally] - Make current window ARG columns \
wider.
\\[shrink-window-horizontally] - Make current window ARG columns narrower."
(interactive "P")
(or (assq 'wmanip-mode minor-mode-alist)
(setq minor-mode-alist
(cons '(wmanip-mode " Wmanip") minor-mode-alist)))
(let ((goal
(if (null arg) (not wmanip-mode)
(> (prefix-numeric-value arg) 0))))
(if (or (and goal wmanip-mode) (and (not goal) (not wmanip-mode))) nil
(setq wmanip-mode (not (null goal)))
(force-mode-line-update 'all))))
(defsubst turn-on-wmanip-mode ()
"Turn on the wmanip minor mode."
(interactive)
(wmanip-mode 1))
(defsubst turn-off-wmanip-mode ()
"Turn off the wmanip minor mode."
(interactive)
(wmanip-mode 0))
(defvar wmanip-mode-map nil
"Keymap used in wmanip mode.")
(if wmanip-mode-map
()
(setq wmanip-mode-map (make-sparse-keymap))
(suppress-keymap wmanip-mode-map)
(define-key wmanip-mode-map "o" 'other-window)
(define-key wmanip-mode-map "\M-\e" 'turn-off-wmanip-mode)
(define-key wmanip-mode-map "/" 'enlarge-window)
(define-key wmanip-mode-map "\\" 'shrink-window)
(define-key wmanip-mode-map "[" 'shrink-window-horizontally)
(define-key wmanip-mode-map "]" 'enlarge-window-horizontally))
(or (assq 'wmanip-mode minor-mode-map-alist)
(setq minor-mode-map-alist
(cons (cons 'wmanip-mode wmanip-mode-map) minor-mode-map-alist)))
(provide 'wmanip)
;;; wmanip.el ends here
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- wmanip.el - minor fix to deal with buffer-local minor-mode-map,
Ian Zimmerman <=