From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: michael-franzese@gmx.com Newsgroups: gmane.emacs.help Subject: Changing outline-minor-mode keybindings for texinfo files Date: Fri, 14 May 2021 20:13:28 +0200 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="17523"; mail-complaints-to="usenet@ciao.gmane.io" Cc: Help Gnu Emacs , Jean Louis To: Yuri Khan Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Fri May 14 20:15:08 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 1lhcL5-0004LG-St for geh-help-gnu-emacs@m.gmane-mx.org; Fri, 14 May 2021 20:15:07 +0200 Original-Received: from localhost ([::1]:48036 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lhcL4-0000Mp-Uj for geh-help-gnu-emacs@m.gmane-mx.org; Fri, 14 May 2021 14:15:06 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:46572) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lhcKA-0000Ln-Rz for help-gnu-emacs@gnu.org; Fri, 14 May 2021 14:14:10 -0400 Original-Received: from mout.gmx.net ([212.227.15.15]:53835) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lhcK5-00029t-Ae for help-gnu-emacs@gnu.org; Fri, 14 May 2021 14:14:10 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=badeba3b8450; t=1621016009; bh=LdQ9MTEVjFJSbtSwmg/mS82tNHUwUZNpLFPTETmdrxs=; h=X-UI-Sender-Class:From:To:Cc:Subject:Date:In-Reply-To:References; b=PMvmbTISSB9KRAjuYwOoOlGFyTWFvV+zokU/uqZIV3onQmEb0XhlAY1ckbN0PfmH7 kXqhIgVwHFLIDC07aY4b4O156yX0nOpIKP+dBF9hPx7nFNz2SOEM5ST4XV4ezfVEeT 6mZoHI4eChK4ybulQeSyd44JInMBYViYenna0Z+Q= X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c Original-Received: from [213.165.168.94] ([213.165.168.94]) by web-mail.gmx.net (3c-app-mailcom-bs04.server.lan [172.19.170.170]) (via HTTP); Fri, 14 May 2021 20:13:28 +0200 Importance: normal Sensitivity: Normal In-Reply-To: X-UI-Message-Type: mail X-Priority: 3 X-Provags-ID: V03:K1:A75JTT/u3j82iO/nHHj9gm34ZA+9mPIzY7naDfWfK1ZJnVPAgrRutU+lDEPAsBmnuO/Nn K4bn1p8IXRLEmMk55QIIHnaUdB5y0iFLeBXGGaXvXZ56aV+pWDsDs6Kfa06cX/BpfnUyvLfPEJNx AtlHXl589xCsAHgHaS8q1ooTxym/fI9Kp9V0IvyDNYtzdEHg7EZVnPsHNTGUbY3uV0sowxEvXB56 evJbxyshpHe0BjL09Z2I+S3+32N4elA83dLk4iS/AP9AmmWlel6nTHpL1FusjwwCGy3/LEpi79mr Vg= X-UI-Out-Filterresults: notjunk:1;V03:K0:Bx/rHxygnyw=:3c5ItCaHjzYxipqQtqpnOj Vn9ejH5J+M/FutBK7grzenK4qT1wWwnPXA4brz8PZDiGVh7Mq7AioZoHU5UKY7IU6FxHzDLvj PpdyhoDqSkzQZQoc98n4owU1I4SYYUa6rGMPvlbyPEDQqWCo/9Ji3vWZBMiyeykMFmRY3ebCI HVZt6Nk4O1n7NdLbC248ZKp0slNY2NDZ1TrgmbBIMvsAphFN8ZvXlL364ybka8eRUcoycTW9u BbChOBvC7uyoIn3B8BVwddVTupC6Vs6KWxiWr+UzuzDYCvQXtqmm9m6wtcLLzibsu6p6qNtx2 lXLzzQc3WztvKceHO/4iOlGrHIq+T3HcBlQ8yInhVxRAG0TZ9hbpgSWYq1iK9zQkcJ5nwPYme czqMIg6B9m+IB+LAIsLsDLbcAJLjymUTWgRrSziKR5pi4V+OqHaKoID5IwS949cH93MZnMIzc 4aC0lSH6Ol2lQ4zhVWsZYOqsUkdQkN3sOHgV5iVhy82tYt39oohnXvzl9sbwiNKRUGh0c1JlC DEMpVPSEu/GUpqqGBcBmZ2QYyytimoA1lJllmmoJBootEap+eWe9Vuz2sVIa/uiKOhcgifkYx Q+4nerYpYTURLzgji37FJsTYmiFCg3QPeklZiInOyqQopFhRjDcPOjnYHuq1NCtTQvtVBVREN ydReaPx+ahTWJgCsHw4w4e4dMgl2H8ucvjCw7y7Rz8W+STHLv0o+Y6//ufbi7urQc49KnldBf nN1eaiQB9SJ7Iu5EN9uKgnqL4Pbd34zp7tpTPweWTZuCrHB5EE+kNbMpERMMvXuRnAF9DV3m Received-SPF: pass client-ip=212.227.15.15; envelope-from=michael-franzese@gmx.com; helo=mout.gmx.net X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, 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:129778 Archived-At: Can with-eval-after-load be included inside a function? > Sent: Saturday, May 15, 2021 at 4:20 AM > From: "Yuri Khan" > To: michael-franzese@gmx=2Ecom > Cc: "Help Gnu Emacs" , "Jean Louis" > Subject: Re: Changing outline-minor-mode keybindings for texinfo files > > On Fri, 14 May 2021 at 20:33, wrote: >=20 > > Have wade to following adaptation which seems to work=2E Still I woul= d value > > comments and points of view=2E > > > > (defun vmove-keytrigger () > > "Visualises outline and moves texinfo code=2E" >=20 > This docstring is inaccurate, and uses the wrong grammatical form=2E > (Docstrings, by convention, use the imperative form=2E) Better: >=20 > "Set up keys for use in texinfo-mode=2E" >=20 > > (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) )) >=20 > The let binding is redundant, you could call =E2=80=98define-key=E2=80= =99 directly on > =E2=80=98texinfo-mode-map=E2=80=99: >=20 > (defun vmove-keytrigger () > "Set up keys for use in texinfo-mode=2E" > (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) )) >=20 >=20 > > (add-hook 'texinfo-mode-hook 'vmove-keytrigger) >=20 > This too is excessive=2E 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=2E 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 o= f > initialization, but you can defer that to the time when =E2=80=98texinfo= =E2=80=99 is > loaded: >=20 > (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-d= own)) >=20 >=20 > (Note that =E2=80=98with-eval-after-load=E2=80=99 is a relatively new ma= cro; on older > Emacs versions, you might have to use =E2=80=98eval-after-load=E2=80=99 = which is > slightly less easy to use=2E) >