emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] set-temporary-overlay-map improvement and make windresize ex


From: Vitalie Spinu
Subject: Re: [PATCH] set-temporary-overlay-map improvement and make windresize exit on other commands
Date: Sun, 09 Jun 2013 19:12:16 +0200
User-agent: Gnus/5.130008 (Ma Gnus v0.8) Emacs/24.3 (gnu/linux)

 >> Stefan Monnier <address@hidden>
 >> on Sun, 09 Jun 2013 12:03:55 -0400 wrote:

[...]

 >> Second patch is to windresize. Depending on the value of
 >> windresize-exit-on-other-command, windresize will exit on any other
 >> command than those defined in windresize-map. I set it to t by
 >> default. It seems like a nicer default given the discussion on current
 >> thread.

 > I don't think it's worth the trouble to keep the
 > "windresize-exit-on-other-command==nil" option.

I agree. It also leads to a simpler code, so here it is.

The patch is against elpa branch. It does rely on 'on-exit argument for
set-temporary-overlay-map in my other patch. So it makes sense only if
windresize becomes part of emacs proper (thing that I infer conceivable
from your previous posts). Otherwise an explicit check for versions
should be introduced and also windresize-exit-on-other-command probably
kept.

    Vitalie

>From e2784f98c2c7e2a34d03e6b81553c902573854f8 Mon Sep 17 00:00:00 2001
From: Vitalie Spinu <address@hidden>
Date: Sun, 9 Jun 2013 18:55:19 +0200
Subject: [PATCH] windresize: exit on other commands

* packages/windresize/windresize.el: remove `windresize-other-char'
  (windresize): use `set-temporary-overlay-map' instead of
  `overriding-local-map'
  (windresize-map): Don't bind M-x and C-h in `windresize-map'
---
 packages/windresize/windresize.el | 19 +------------------
 1 file changed, 1 insertion(+), 18 deletions(-)

diff --git a/packages/windresize/windresize.el 
b/packages/windresize/windresize.el
index e13dd3f..7378b46 100755
--- a/packages/windresize/windresize.el
+++ b/packages/windresize/windresize.el
@@ -156,9 +156,6 @@ conflicts between keybindings."
 
 (defvar windresize-map
   (let ((map (make-sparse-keymap)))
-    (define-key map [remap self-insert-command] 'windresize-other-char)
-    (define-key map (kbd "M-x") 'windresize-other-char)
-    (define-key map (kbd "C-h") 'windresize-other-char)
     ;; move borders outwards or shrink/enlarge
     (define-key map [left] 'windresize-left)
     (define-key map [right] 'windresize-right)
@@ -240,19 +237,6 @@ conflicts between keybindings."
     map)
   "Keymap for `windresize'.")
 
-(defun windresize-other-char ()
-  "Show a message instead of processing `self-insert-command'."
-  (interactive)
-  (let* ((key (if current-prefix-arg
-                 (substring (this-command-keys)
-                            universal-argument-num-events)
-               (this-command-keys))))
-    (cond ((vectorp key) (ding))
-         ((stringp key)
-          ;; send warning for only no warning for complex keys and
-          ;; mouse events
-          (setq windresize-msg
-                (cons (format "[`%s' not bound]" key) 1))))))
 
 ;;; Aliases:
 
@@ -364,8 +348,7 @@ will set the new window configuration and exit.
                 (current-window-configuration))
     (setq windresize-buffer (current-buffer))
     ;; set overriding map and pre/post-command hooks
-    (setq overriding-terminal-local-map windresize-map)
-    (setq overriding-local-map-menu-flag t)
+    (set-temporary-overlay-map windresize-map t 'windresize-exit)
     (windresize-add-command-hooks)
     ;; set the initial message
     (setq windresize-msg
-- 
1.8.1.2


reply via email to

[Prev in Thread] Current Thread [Next in Thread]