From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Jambunathan K Newsgroups: gmane.emacs.help Subject: Re: view-mode keymap Date: Thu, 03 Jan 2013 11:58:55 +0530 Message-ID: <87ehi2ixug.fsf@gmail.com> References: <87sj6mi7p5.fsf@casa.home> <87sj6j8y1q.fsf@casa.home> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1357194308 15694 80.91.229.3 (3 Jan 2013 06:25:08 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 3 Jan 2013 06:25:08 +0000 (UTC) Cc: help-gnu-emacs@gnu.org To: Daimrod Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Thu Jan 03 07:25:25 2013 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1TqeEy-0001Jv-FN for geh-help-gnu-emacs@m.gmane.org; Thu, 03 Jan 2013 07:25:20 +0100 Original-Received: from localhost ([::1]:60978 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TqeEj-00013J-BE for geh-help-gnu-emacs@m.gmane.org; Thu, 03 Jan 2013 01:25:05 -0500 Original-Received: from eggs.gnu.org ([208.118.235.92]:51666) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TqeEc-000133-IQ for help-gnu-emacs@gnu.org; Thu, 03 Jan 2013 01:25:00 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TqeEb-0006hr-6Q for help-gnu-emacs@gnu.org; Thu, 03 Jan 2013 01:24:58 -0500 Original-Received: from mail-da0-f53.google.com ([209.85.210.53]:46729) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TqeEb-0006h6-02 for help-gnu-emacs@gnu.org; Thu, 03 Jan 2013 01:24:57 -0500 Original-Received: by mail-da0-f53.google.com with SMTP id x6so6809423dac.40 for ; Wed, 02 Jan 2013 22:24:56 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=x-received:from:to:cc:subject:references:date:in-reply-to :message-id:user-agent:mime-version:content-type; bh=v03CHtj5B3qWwVoRvNjWHvVMvYaXyg+Ftg0TU73uACU=; b=MrSyGJTldnMfGMcJLPWI/0EeH58w9dTCaWjo1P+a13ouY8t6VAf32t+LrsVvHKj5nM /w8Di5XPOURo8KT9VYKDI6rtqGsI/hFD36o9Wtj5jcHtD9YPMWAWFS38USk2bxaL+V+J h3UFUMOYpRFa+k+aCH+b+hY/RDnBLSx+G4Vt1gHIDMzcBZ+2Ay1es6Guwx4y9tTMYTMo QCgP0IXM2ORompS/hLaKN71gnc/ExDNKhLr2gyDaQx+2iVa/nC7ZqlBXwFQAfKJCznH/ FiFb0hm6jzJri7Be+uIunr1OQUmUBNCIDNjtfnrNTpGBQz8XqZVsI7D8M8VWlBXBqNhc ao1A== X-Received: by 10.68.247.39 with SMTP id yb7mr152777356pbc.15.1357194296050; Wed, 02 Jan 2013 22:24:56 -0800 (PST) Original-Received: from debian-6.05 ([115.184.117.5]) by mx.google.com with ESMTPS id bi8sm26927248pab.15.2013.01.02.22.24.52 (version=TLSv1/SSLv3 cipher=OTHER); Wed, 02 Jan 2013 22:24:55 -0800 (PST) In-Reply-To: <87sj6j8y1q.fsf@casa.home> (daimrod@gmail.com's message of "Wed, 02 Jan 2013 15:22:25 +0100") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [fuzzy] X-Received-From: 209.85.210.53 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:88399 Archived-At: Daimrod writes: > Jambunathan K writes: > >> I think, `make-composed-keymap' can help here. >> >> >>> I like `view-mode' but it conflicts with others minor mode map (paredit >>> in my case). >>> >>> I would like to know if there is a better way to make a keymap that >>> takes precedence over the others than manipulating >>> `minor-mode-map-alist'. >>> >>> Here is my current implementation: >>> >>> (add-hook 'view-mode-hook >>> (lambda () >>> ;; Makes sure `view-mode-map' is the first minor mode map >>> ;; available in `minor-mode-map-alist', because in case of >>> ;; conflicting bindings, the first one is used. >>> (unless (eq 'view-mode (caar minor-mode-map-alist)) >>> (setf minor-mode-map-alist >>> (cons (cons 'view-mode view-mode-map) >>> (cl-remove 'view-mode minor-mode-map-alist >>> :key #'car)))))) > > I've looked at it but I don't see how it can help. I don't want to > create a new keymap, I want `view-mode-map' to take priority over other > keymaps. I was hoping that something like this (use-local-map (make-composed-keymap view-mode-map (current-local-map))) will put `view-mode-map' on top of the keymap stack and thus overwrite paredit's bindings. I see that DEL (backspace) key is shared between view-mode and paredit. My little experimentation that the above snippet failst to produce the effect expected by me. Do you think I am reading the doc of the APIs (used above) incorrectly? > > I've looked at the documentation and it seems that changing the order in > `minor-mode-map-alist' is the only way to manage priorities between > keymap, because they shouldn't conflict in there first place. --