Subject: 24.3; make hideshow use outline-minor-mode-prefix or a similar hs-minor-mode-prefix

From: Susanne Oberhauser <[email-masked]>
Date: Tue, 10 Sep 2013 18:51:46 +0200

Hi,

hideshow mode has the prefix C-c @ hard coded in it's minor mode map.

C-c @ on a german keyboard actually is  C-c M-q

That makes  C-c @ C-h  into  C-c AltGr-q C-h  which is slow and puts my
fingers at risk :)

Now outline minor mode allows to simply define the minor mode prefix to
something more convenient.

I'd love to have this in hideshow mode, too, e.g. along the lines in the
patch below.

Thanks,

S.

=== modified file 'lisp/progmodes/hideshow.el'
--- lisp/progmodes/hideshow.el	2013-03-05 17:13:01 +0000
+++ lisp/progmodes/hideshow.el	2013-09-10 16:28:05 +0000
@@ -335,6 +335,13 @@
 as how to set its `display' property.  See `hs-make-overlay' and
 info node `(elisp)Overlays'.")
 
+(defcustom hs-minor-mode-prefix "\C-c@"
+  "Prefix key to use for hideshow commands in hideshow minor mode.
+The value of this variable is only checked as part of loading hideshow mode.
+After that, changing the prefix key requires manipulating keymaps."
+  :type 'string
+  :group 'hideshow)
+
 ;;---------------------------------------------------------------------------
 ;; internal variables
 
@@ -343,14 +350,16 @@
 Use the command `hs-minor-mode' to toggle or set this variable.")
 
 (defvar hs-minor-mode-map
-  (let ((map (make-sparse-keymap)))
-    ;; These bindings roughly imitate those used by Outline mode.
-    (define-key map "\C-c@\C-h"	      'hs-hide-block)
-    (define-key map "\C-c@\C-s"	      'hs-show-block)
-    (define-key map "\C-c@\C-\M-h"    'hs-hide-all)
-    (define-key map "\C-c@\C-\M-s"    'hs-show-all)
-    (define-key map "\C-c@\C-l"	      'hs-hide-level)
-    (define-key map "\C-c@\C-c"	      'hs-toggle-hiding)
+  (let ((map (make-sparse-keymap))
+	(prefixed-map (make-sparse-keymap)))
+    ;; These bindings very roughly imitate those used by Outline mode.
+    (define-key prefixed-map "\C-h"	      'hs-hide-block)
+    (define-key prefixed-map "\C-s"	      'hs-show-block)
+    (define-key prefixed-map "\C-\M-h"        'hs-hide-all)
+    (define-key prefixed-map "\C-\M-s"        'hs-show-all)
+    (define-key prefixed-map "\C-l"	      'hs-hide-level)
+    (define-key prefixed-map "\C-c"	      'hs-toggle-hiding)
+    (define-key map hs-minor-mode-prefix prefixed-map)
     (define-key map [(shift mouse-2)] 'hs-mouse-toggle-hiding)
     map)
   "Keymap for hideshow minor mode.")

In GNU Emacs 24.3.1 (x86_64-suse-linux-gnu, GTK+ Version 3.6.4)
 of 2013-06-15 on build35
Windowing system distributor `The X.Org Foundation', version 11.0.11302000
System Description:	openSUSE 12.3 (x86_64)

-- 
Susanne Oberhauser                     SUSE LINUX Products GmbH
+49-911-74053-574	               Maxfeldstraße 5
Processes and Infrastructure           90409 Nürnberg
GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer, HRB 16746 (AG Nürnberg)