From: Yuri Khan <yuri.v.khan@gmail.com>
To: michael-franzese@gmx.com
Cc: Help Gnu Emacs <help-gnu-emacs@gnu.org>, Jean Louis <bugs@gnu.support>
Subject: Re: Changing outline-minor-mode keybindings for texinfo files
Date: Fri, 14 May 2021 23:20:12 +0700 [thread overview]
Message-ID: <CAP_d_8W16mUajEodpE84LzqT2vwZKes0oYh+k05HVu-LDfup4w@mail.gmail.com> (raw)
In-Reply-To: <trinity-7b0b7d1a-a437-4344-9bf2-adb5a447253b-1620999119372@3c-app-mailcom-bs04>
On Fri, 14 May 2021 at 20:33, <michael-franzese@gmx.com> wrote:
> Have wade to following adaptation which seems to work. Still I would value
> 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-<up>") #'outline-move-subtree-up)
> (define-key map (kbd "H-<down>") #'outline-move-subtree-down) ))
The let binding is redundant, you could call ‘define-key’ directly on
‘texinfo-mode-map’:
(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-<up>") #'outline-move-subtree-up)
(define-key texinfo-mode-map (kbd "H-<down>") #'outline-move-subtree-down) ))
> (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 …) in your init file because the variable
‘texinfo-mode-map’ is probably not defined at the time of
initialization, but you can defer that to the time when ‘texinfo’ 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-<up>") #'outline-move-subtree-up)
(define-key texinfo-mode-map (kbd "H-<down>") #'outline-move-subtree-down))
(Note that ‘with-eval-after-load’ is a relatively new macro; on older
Emacs versions, you might have to use ‘eval-after-load’ which is
slightly less easy to use.)
next prev parent reply other threads:[~2021-05-14 16:20 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-05-14 5:47 Changing outline-minor-mode keybindings for texinfo files michael-franzese
2021-05-14 7:28 ` michael-franzese
2021-05-14 9:51 ` Jean Louis
2021-05-14 10:04 ` michael-franzese
2021-05-14 12:24 ` michael-franzese
2021-05-14 13:31 ` michael-franzese
2021-05-14 14:03 ` Jean Louis
2021-05-14 16:00 ` Yuri Khan
2021-05-14 16:19 ` michael-franzese
2021-05-14 18:49 ` Jean Louis
2021-05-15 21:10 ` tomas
2021-05-14 16:20 ` Yuri Khan [this message]
2021-05-14 16:36 ` michael-franzese
2021-05-14 20:10 ` Yuri Khan
2021-05-15 5:25 ` michael-franzese
2021-05-15 5:58 ` Yuri Khan
2021-05-15 6:07 ` michael-franzese
2021-05-15 6:35 ` Yuri Khan
2021-05-15 5:59 ` michael-franzese
2021-05-15 6:02 ` Yuri Khan
2021-05-15 6:21 ` michael-franzese
2021-05-15 6:36 ` Yuri Khan
2021-05-15 8:40 ` michael-franzese
2021-05-15 9:00 ` Yuri Khan
2021-05-15 10:48 ` michael-franzese
2021-05-14 18:13 ` michael-franzese
2021-05-14 13:55 ` Jean Louis
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=CAP_d_8W16mUajEodpE84LzqT2vwZKes0oYh+k05HVu-LDfup4w@mail.gmail.com \
--to=yuri.v.khan@gmail.com \
--cc=bugs@gnu.support \
--cc=help-gnu-emacs@gnu.org \
--cc=michael-franzese@gmx.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.