From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Yuri Khan Newsgroups: gmane.emacs.help Subject: Re: Changing outline-minor-mode keybindings for texinfo files Date: Fri, 14 May 2021 23:20:12 +0700 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="6538"; mail-complaints-to="usenet@ciao.gmane.io" Cc: Help Gnu Emacs , Jean Louis To: michael-franzese@gmx.com Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Fri May 14 18:53:50 2021 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lhb4Q-0001Rl-4U for geh-help-gnu-emacs@m.gmane-mx.org; Fri, 14 May 2021 18:53:50 +0200 Original-Received: from localhost ([::1]:48686 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lhb4P-0002iw-0s for geh-help-gnu-emacs@m.gmane-mx.org; Fri, 14 May 2021 12:53:49 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:52136) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lhaY8-0002sT-NH for help-gnu-emacs@gnu.org; Fri, 14 May 2021 12:20:29 -0400 Original-Received: from mail-ua1-x934.google.com ([2607:f8b0:4864:20::934]:33524) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lhaY5-0006C3-N9 for help-gnu-emacs@gnu.org; Fri, 14 May 2021 12:20:28 -0400 Original-Received: by mail-ua1-x934.google.com with SMTP id h1so9813810uar.0 for ; Fri, 14 May 2021 09:20:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=LhjaVuaiXpyDYb0se8VBeVsc8nkcHkkwxKQEirIdGBM=; b=iZXgGsBhHnA2FSP7bMliYvrIoTcHzUwFuDJC5icJgksLaC6gMVs4x5a9LOdGOQG4Cb 0lAH4GR5Cc0/SDEz4+YYYCjRi8DKGd1nauonb1HpiuYSXQa6krX9lLo8CA6MXwIfhAIg KGqObul+5R5bDaoirVZuYBSTpu0B9urRW6PnJuCUXTD0VYO+K93dTpGLizhUxfQLrBeG J8Ntu2n9n5vrqHmUxoRrKDALEWCFvwtE6S3DhOtTCK+7/vV5eG4rsUOuoBpgvmgiESdp WZtWJQO7CUvKJ48UDwVW7r86svEbDD/cde89o71wzK9kMsLVPV4r2JgDHjjFm0XQbNBC bBEw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=LhjaVuaiXpyDYb0se8VBeVsc8nkcHkkwxKQEirIdGBM=; b=i6qPofW9hJ37/DHsDIa3s2SFxtlSOQR4/on8ycIBDBzrjJS/YdJF7RReeWzyvJDIPD lJKgybOHX7ne5ysCqSV7bOj8nW44MXBkBMZEpWcGaJ/WywdT//Rg4miOcKuvKjzAxl96 29YYNpFiFSnhksHtDOSdMOx1QY5gS4R02LpW6mx6GOADG8mGkYnggaOYeq2Q2lbQsD+u JLYtK34Q2DTiMKnldEc8q/ZEN7TZG+u3HBm9nt5Lp/4zKMIBnbag2Vqmmme0EbGjx5ms 8hN5MyET5y7fo0zXBQWwJORdUsdnmd8yVZtejMlTWt8KzIl23c7gwdQcso5NZjF459My qTKA== X-Gm-Message-State: AOAM533swpX3yo+iHU1xX8Zi3BAwLu3WpEN/+/JoehXgz62yLFDfYN59 yArjkC5ofMzPR2v5fQ+bsxjtsdDdLxkQZ+m6nTk= X-Google-Smtp-Source: ABdhPJwkJzDdsuWcQ8Gv5VOfOsDui1SHPZTQSJl8gaRbeVlCrisY9zx2BhhCp14rQQBbYAsx8rCP9s2brNScvC6hQc4= X-Received: by 2002:ab0:2b15:: with SMTP id e21mr32667304uar.102.1621009224139; Fri, 14 May 2021 09:20:24 -0700 (PDT) In-Reply-To: Received-SPF: pass client-ip=2607:f8b0:4864:20::934; envelope-from=yurivkhan@gmail.com; helo=mail-ua1-x934.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.23 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-mx.org@gnu.org Original-Sender: "help-gnu-emacs" Xref: news.gmane.io gmane.emacs.help:129776 Archived-At: On Fri, 14 May 2021 at 20:33, wrote: > Have wade to following adaptation which seems to work. Still I would val= ue > comments and points of view. > > (defun vmove-keytrigger () > "Visualises outline and moves texinfo code." This docstring is inaccurate, and uses the wrong grammatical form. (Docstrings, by convention, use the imperative form.) Better: "Set up keys for use in texinfo-mode." > (let ( (map texinfo-mode-map) ) > (define-key map (kbd "H-q") #'outline-hide-sublevels) > (define-key map (kbd "H-b") #'outline-hide-body) > (define-key map (kbd "H-") #'outline-move-subtree-up) > (define-key map (kbd "H-") #'outline-move-subtree-down) )) The let binding is redundant, you could call =E2=80=98define-key=E2=80=99 d= irectly on =E2=80=98texinfo-mode-map=E2=80=99: (defun vmove-keytrigger () "Set up keys for use in texinfo-mode." (define-key texinfo-mode-map (kbd "H-q") #'outline-hide-sublevels) (define-key texinfo-mode-map (kbd "H-b") #'outline-hide-body) (define-key texinfo-mode-map (kbd "H-") #'outline-move-subtree-up) (define-key texinfo-mode-map (kbd "H-") #'outline-move-subtree-dow= n) )) > (add-hook 'texinfo-mode-hook 'vmove-keytrigger) This too is excessive. You redefine these keys each time you open a new buffer in texinfo mode, but it is sufficient to define them once during an Emacs session. You cannot just put (define-key texinfo-mode-map =E2=80=A6) in your init file because the variable =E2=80=98texinfo-mode-map=E2=80=99 is probably not defined at the time of initialization, but you can defer that to the time when =E2=80=98texinfo=E2= =80=99 is loaded: (with-eval-after-load 'texinfo (define-key texinfo-mode-map (kbd "H-q") #'outline-hide-sublevels) (define-key texinfo-mode-map (kbd "H-b") #'outline-hide-body) (define-key texinfo-mode-map (kbd "H-") #'outline-move-subtree-up) (define-key texinfo-mode-map (kbd "H-") #'outline-move-subtree-down= )) (Note that =E2=80=98with-eval-after-load=E2=80=99 is a relatively new macro= ; on older Emacs versions, you might have to use =E2=80=98eval-after-load=E2=80=99 whi= ch is slightly less easy to use.)