From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Juri Linkov Newsgroups: gmane.emacs.devel Subject: Re: Global keymaps Date: Sun, 29 Jun 2008 22:28:09 +0300 Organization: JURTA Message-ID: <8763rsf3cm.fsf@jurta.org> References: <4853F884.7000609@gmail.com> <7dbe73ed0806141442h342f8ff0u83863f3980a7e229@mail.gmail.com> <48545D78.8080103@gmail.com> <4854E536.8040407@gmail.com> <87k5gql900.fsf@jurta.org> <87hcbt59s6.fsf@jurta.org> <87y74ubfnc.fsf@jurta.org> <87fxr1fe7d.fsf@jurta.org> <87ej6l5ffi.fsf@catnip.gol.com> <87bq1mxyem.fsf@jurta.org> <87prq2z9lo.fsf@catnip.gol.com> <87tzfd5wdh.fsf@jurta.org> <87r6agjnc8.fsf@jurta.org> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1214768161 23768 80.91.229.12 (29 Jun 2008 19:36:01 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sun, 29 Jun 2008 19:36:01 +0000 (UTC) Cc: emacs-devel@gnu.org, Miles Bader To: Stefan Monnier Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sun Jun 29 21:36:47 2008 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1KD2hR-0004gH-Px for ged-emacs-devel@m.gmane.org; Sun, 29 Jun 2008 21:36:38 +0200 Original-Received: from localhost ([127.0.0.1]:47465 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1KD2gZ-0004HD-9P for ged-emacs-devel@m.gmane.org; Sun, 29 Jun 2008 15:35:43 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1KD2gV-0004H8-Fs for emacs-devel@gnu.org; Sun, 29 Jun 2008 15:35:39 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1KD2gT-0004Gw-U2 for emacs-devel@gnu.org; Sun, 29 Jun 2008 15:35:38 -0400 Original-Received: from [199.232.76.173] (port=45772 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1KD2gT-0004Gt-OQ for emacs-devel@gnu.org; Sun, 29 Jun 2008 15:35:37 -0400 Original-Received: from relay01.kiev.sovam.com ([62.64.120.200]:2434) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1KD2gO-0001nD-PW; Sun, 29 Jun 2008 15:35:33 -0400 Original-Received: from [83.170.232.243] (helo=smtp.svitonline.com) by relay01.kiev.sovam.com with esmtp (Exim 4.67) (envelope-from ) id 1KD2gM-0008D9-84; Sun, 29 Jun 2008 22:35:30 +0300 In-Reply-To: (Stefan Monnier's message of "Sun, 29 Jun 2008 14:03:01 -0400") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.60 (x86_64-pc-linux-gnu) X-Scanner-Signature: d6f54fc49b391dd6658b0b3e8f81a7e7 X-DrWeb-checked: yes X-SpamTest-Envelope-From: juri@jurta.org X-SpamTest-Group-ID: 00000000 X-SpamTest-Header: Trusted X-SpamTest-Info: Profiles 4144 [June 29 2008] X-SpamTest-Info: {received from trusted relay: common white list} X-SpamTest-Info: {HEADERS: header Content-Type found without required header Content-Transfer-Encoding} X-SpamTest-Method: white ip list X-SpamTest-Rate: 10 X-SpamTest-Status: Trusted X-SpamTest-Status-Extended: trusted X-SpamTest-Version: SMTP-Filter Version 3.0.0 [0278], KAS30/Release X-detected-kernel: by monty-python.gnu.org: FreeBSD 4.8-5.1 (or MacOS X 10.2-10.3) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:100158 Archived-At: >> The package bookmark.el already defines a map `bookmark-map', >> but it is not bound to any key by default. It also adds >> three keys to the `C-x r' prefix as: > >> ;;;###autoload (define-key ctl-x-map "rb" 'bookmark-jump) >> ;;;###autoload (define-key ctl-x-map "rm" 'bookmark-set) >> ;;;###autoload (define-key ctl-x-map "rl" 'bookmark-bmenu-list) > >> So it seems inevitable to create a new map `ctl-x-r-map' and bind >> these key to it as: > >> ;;;###autoload (define-key ctl-x-r-map "b" 'bookmark-jump) >> ;;;###autoload (define-key ctl-x-r-map "m" 'bookmark-set) >> ;;;###autoload (define-key ctl-x-r-map "l" 'bookmark-bmenu-list) > >> Alternatively, when multiple inheritance will be available, a keymap >> with these three keys could be named as `bookmark-mixin-map' to be >> merged with register and rectangle maps in ctl-x-r-map. > > Yes, Please review the following patch. It creates a new keymap ctl-x-r-map, and moves its keybindings to their corresponding files rect.el and register.el. The file bookmark.el already has these autoloads, so this patch just changes ctl-x-map to ctl-x-r-map in bookmark.el. It also creates new keymaps `abbrev-map' and `narrow-map' (it seems this name is better as an identifier than `narrowing-map'), and rebinds global keys to these maps. Index: lisp/bindings.el =================================================================== RCS file: /sources/emacs/emacs/lisp/bindings.el,v retrieving revision 1.208 diff -c -r1.208 bindings.el *** lisp/bindings.el 25 Jun 2008 20:17:07 -0000 1.208 --- lisp/bindings.el 29 Jun 2008 19:27:01 -0000 *************** *** 700,709 **** ;These commands are defined in editfns.c ;but they are not assigned to keys there. (put 'narrow-to-region 'disabled t) ! (define-key ctl-x-map "nn" 'narrow-to-region) ! (define-key ctl-x-map "nw" 'widen) ! ;; (define-key ctl-x-map "n" 'narrow-to-region) ! ;; (define-key ctl-x-map "w" 'widen) ;; Quitting (define-key global-map "\e\e\e" 'keyboard-escape-quit) --- 700,713 ---- ;These commands are defined in editfns.c ;but they are not assigned to keys there. (put 'narrow-to-region 'disabled t) ! ! (defvar narrow-map (make-sparse-keymap) ! "Keymap for narrowing commands.") ! (defalias 'narrow-map-prefix narrow-map) ! (define-key ctl-x-map "n" 'narrow-map-prefix) ! ! (define-key narrow-map "n" 'narrow-to-region) ! (define-key narrow-map "w" 'widen) ;; Quitting (define-key global-map "\e\e\e" 'keyboard-escape-quit) *************** *** 744,753 **** (define-key esc-map "!" 'shell-command) (define-key esc-map "|" 'shell-command-on-region) ! (define-key global-map [?\C-x right] 'next-buffer) ! (define-key global-map [?\C-x C-right] 'next-buffer) ! (define-key global-map [?\C-x left] 'previous-buffer) ! (define-key global-map [?\C-x C-left] 'previous-buffer) (let ((map minibuffer-local-map)) (define-key map "\en" 'next-history-element) --- 748,757 ---- (define-key esc-map "!" 'shell-command) (define-key esc-map "|" 'shell-command-on-region) ! (define-key ctl-x-map [right] 'next-buffer) ! (define-key ctl-x-map [C-right] 'next-buffer) ! (define-key ctl-x-map [left] 'previous-buffer) ! (define-key ctl-x-map [C-left] 'previous-buffer) (let ((map minibuffer-local-map)) (define-key map "\en" 'next-history-element) *************** *** 809,815 **** (defvar goto-map (make-sparse-keymap) "Keymap for navigation commands.") ! (define-key esc-map "g" goto-map) (define-key goto-map "g" 'goto-line) (define-key goto-map "\M-g" 'goto-line) --- 813,820 ---- (defvar goto-map (make-sparse-keymap) "Keymap for navigation commands.") ! (defalias 'goto-map-prefix goto-map) ! (define-key esc-map "g" 'goto-map-prefix) (define-key goto-map "g" 'goto-line) (define-key goto-map "\M-g" 'goto-line) *************** *** 820,826 **** (defvar search-map (make-sparse-keymap) "Keymap for search related commands.") ! (define-key esc-map "s" search-map) (define-key search-map "o" 'occur) (define-key search-map "hr" 'highlight-regexp) --- 825,832 ---- (defvar search-map (make-sparse-keymap) "Keymap for search related commands.") ! (defalias 'search-map-prefix search-map) ! (define-key esc-map "s" 'search-map-prefix) (define-key search-map "o" 'occur) (define-key search-map "hr" 'highlight-regexp) *************** *** 1089,1113 **** (define-key ctl-x-4-map "m" 'compose-mail-other-window) (define-key ctl-x-5-map "m" 'compose-mail-other-frame) ! (define-key ctl-x-map "r\C-@" 'point-to-register) ! (define-key ctl-x-map [?r ?\C-\ ] 'point-to-register) ! (define-key ctl-x-map "r " 'point-to-register) ! (define-key ctl-x-map "rj" 'jump-to-register) ! (define-key ctl-x-map "rs" 'copy-to-register) ! (define-key ctl-x-map "rx" 'copy-to-register) ! (define-key ctl-x-map "ri" 'insert-register) ! (define-key ctl-x-map "rg" 'insert-register) ! (define-key ctl-x-map "rr" 'copy-rectangle-to-register) ! (define-key ctl-x-map "rn" 'number-to-register) ! (define-key ctl-x-map "r+" 'increment-register) ! (define-key ctl-x-map "rc" 'clear-rectangle) ! (define-key ctl-x-map "rk" 'kill-rectangle) ! (define-key ctl-x-map "rd" 'delete-rectangle) ! (define-key ctl-x-map "ry" 'yank-rectangle) ! (define-key ctl-x-map "ro" 'open-rectangle) ! (define-key ctl-x-map "rt" 'string-rectangle) ! (define-key ctl-x-map "rw" 'window-configuration-to-register) ! (define-key ctl-x-map "rf" 'frame-configuration-to-register) (define-key esc-map "q" 'fill-paragraph) (define-key ctl-x-map "." 'set-fill-prefix) --- 1095,1105 ---- (define-key ctl-x-4-map "m" 'compose-mail-other-window) (define-key ctl-x-5-map "m" 'compose-mail-other-frame) ! ! (defvar ctl-x-r-map (make-sparse-keymap) ! "Keymap for subcommands of C-x r.") ! (defalias 'ctl-x-r-prefix ctl-x-r-map) ! (define-key ctl-x-map "r" 'ctl-x-r-prefix) (define-key esc-map "q" 'fill-paragraph) (define-key ctl-x-map "." 'set-fill-prefix) *************** *** 1127,1142 **** (define-key ctl-x-map "np" 'narrow-to-page) ;; (define-key ctl-x-map "p" 'narrow-to-page) ! (define-key ctl-x-map "al" 'add-mode-abbrev) ! (define-key ctl-x-map "a\C-a" 'add-mode-abbrev) ! (define-key ctl-x-map "ag" 'add-global-abbrev) ! (define-key ctl-x-map "a+" 'add-mode-abbrev) ! (define-key ctl-x-map "aig" 'inverse-add-global-abbrev) ! (define-key ctl-x-map "ail" 'inverse-add-mode-abbrev) ! ;; (define-key ctl-x-map "a\C-h" 'inverse-add-global-abbrev) ! (define-key ctl-x-map "a-" 'inverse-add-global-abbrev) ! (define-key ctl-x-map "ae" 'expand-abbrev) ! (define-key ctl-x-map "a'" 'expand-abbrev) ;; (define-key ctl-x-map "\C-a" 'add-mode-abbrev) ;; (define-key ctl-x-map "\+" 'add-global-abbrev) ;; (define-key ctl-x-map "\C-h" 'inverse-add-mode-abbrev) --- 1119,1139 ---- (define-key ctl-x-map "np" 'narrow-to-page) ;; (define-key ctl-x-map "p" 'narrow-to-page) ! (defvar abbrev-map (make-sparse-keymap) ! "Keymap for abbrev commands.") ! (defalias 'abbrev-map-prefix abbrev-map) ! (define-key ctl-x-map "a" 'abbrev-map-prefix) ! ! (define-key abbrev-map "l" 'add-mode-abbrev) ! (define-key abbrev-map "\C-a" 'add-mode-abbrev) ! (define-key abbrev-map "g" 'add-global-abbrev) ! (define-key abbrev-map "+" 'add-mode-abbrev) ! (define-key abbrev-map "ig" 'inverse-add-global-abbrev) ! (define-key abbrev-map "il" 'inverse-add-mode-abbrev) ! ;; (define-key abbrev-map "\C-h" 'inverse-add-global-abbrev) ! (define-key abbrev-map "-" 'inverse-add-global-abbrev) ! (define-key abbrev-map "e" 'expand-abbrev) ! (define-key abbrev-map "'" 'expand-abbrev) ;; (define-key ctl-x-map "\C-a" 'add-mode-abbrev) ;; (define-key ctl-x-map "\+" 'add-global-abbrev) ;; (define-key ctl-x-map "\C-h" 'inverse-add-mode-abbrev) Index: lisp/bookmark.el =================================================================== RCS file: /sources/emacs/emacs/lisp/bookmark.el,v retrieving revision 1.114 diff -c -r1.114 bookmark.el *** lisp/bookmark.el 25 Jun 2008 16:51:32 -0000 1.114 --- lisp/bookmark.el 29 Jun 2008 19:27:14 -0000 *************** *** 217,225 **** ;; Set up these bindings dumping time *only*; ;; if the user alters them, don't override the user when loading bookmark.el. ! ;;;###autoload (define-key ctl-x-map "rb" 'bookmark-jump) ! ;;;###autoload (define-key ctl-x-map "rm" 'bookmark-set) ! ;;;###autoload (define-key ctl-x-map "rl" 'bookmark-bmenu-list) ;;;###autoload (defvar bookmark-map --- 217,225 ---- ;; Set up these bindings dumping time *only*; ;; if the user alters them, don't override the user when loading bookmark.el. ! ;;;###autoload (define-key ctl-x-r-map "b" 'bookmark-jump) ! ;;;###autoload (define-key ctl-x-r-map "m" 'bookmark-set) ! ;;;###autoload (define-key ctl-x-r-map "l" 'bookmark-bmenu-list) ;;;###autoload (defvar bookmark-map Index: lisp/rect.el =================================================================== RCS file: /sources/emacs/emacs/lisp/rect.el,v retrieving revision 1.58 diff -c -r1.58 rect.el *** lisp/rect.el 6 May 2008 07:57:48 -0000 1.58 --- lisp/rect.el 29 Jun 2008 19:27:18 -0000 *************** *** 31,36 **** --- 31,44 ---- ;; intrusive and fill lines with whitespaces only when needed. A few functions ;; are untouched though, as noted above their definition. + ;;; Global key bindings + + ;;;###autoload (define-key ctl-x-r-map "c" 'clear-rectangle) + ;;;###autoload (define-key ctl-x-r-map "k" 'kill-rectangle) + ;;;###autoload (define-key ctl-x-r-map "d" 'delete-rectangle) + ;;;###autoload (define-key ctl-x-r-map "y" 'yank-rectangle) + ;;;###autoload (define-key ctl-x-r-map "o" 'open-rectangle) + ;;;###autoload (define-key ctl-x-r-map "t" 'string-rectangle) ;;; Code: Index: lisp/register.el =================================================================== RCS file: /sources/emacs/emacs/lisp/register.el,v retrieving revision 1.60 diff -c -r1.60 register.el *** lisp/register.el 6 May 2008 07:57:48 -0000 1.60 --- lisp/register.el 29 Jun 2008 19:27:35 -0000 *************** *** 28,33 **** --- 28,49 ---- ;; pieces of buffer state to named variables. The entry points are ;; documented in the Emacs user's manual. + ;;; Global key bindings + + ;;;###autoload (define-key ctl-x-r-map "\C-@" 'point-to-register) + ;;;###autoload (define-key ctl-x-r-map [?\C-\ ] 'point-to-register) + ;;;###autoload (define-key ctl-x-r-map " " 'point-to-register) + ;;;###autoload (define-key ctl-x-r-map "j" 'jump-to-register) + ;;;###autoload (define-key ctl-x-r-map "s" 'copy-to-register) + ;;;###autoload (define-key ctl-x-r-map "x" 'copy-to-register) + ;;;###autoload (define-key ctl-x-r-map "i" 'insert-register) + ;;;###autoload (define-key ctl-x-r-map "g" 'insert-register) + ;;;###autoload (define-key ctl-x-r-map "r" 'copy-rectangle-to-register) + ;;;###autoload (define-key ctl-x-r-map "n" 'number-to-register) + ;;;###autoload (define-key ctl-x-r-map "+" 'increment-register) + ;;;###autoload (define-key ctl-x-r-map "w" 'window-configuration-to-register) + ;;;###autoload (define-key ctl-x-r-map "f" 'frame-configuration-to-register) + ;;; Code: (defvar register-alist nil Index: lisp/expand.el =================================================================== RCS file: /sources/emacs/emacs/lisp/expand.el,v retrieving revision 1.22 diff -c -r1.22 expand.el *** lisp/expand.el 6 May 2008 07:57:34 -0000 1.22 --- lisp/expand.el 29 Jun 2008 19:27:55 -0000 *************** *** 427,434 **** (goto-char (aref expand-pos expand-index)) (run-hooks 'expand-jump-hook)))) ! ;;;###autoload (define-key ctl-x-map "ap" 'expand-jump-to-previous-slot) ! ;;;###autoload (define-key ctl-x-map "an" 'expand-jump-to-next-slot) (defun expand-build-list (len l) "Build a vector of offset positions from the list of positions." --- 427,434 ---- (goto-char (aref expand-pos expand-index)) (run-hooks 'expand-jump-hook)))) ! ;;;###autoload (define-key abbrev-map "p" 'expand-jump-to-previous-slot) ! ;;;###autoload (define-key abbrev-map "n" 'expand-jump-to-next-slot) (defun expand-build-list (len l) "Build a vector of offset positions from the list of positions." -- Juri Linkov http://www.jurta.org/emacs/