help-gnu-emacs
[Top][All Lists]
Advanced

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

Re: Changing outline-minor-mode keybindings for texinfo files


From: Yuri Khan
Subject: Re: Changing outline-minor-mode keybindings for texinfo files
Date: Fri, 14 May 2021 23:00:14 +0700

On Fri, 14 May 2021 at 21:06, Jean Louis <bugs@gnu.support> wrote:

> > (defun vmove-keytrigger ()
> >    "Visualises outline and moves texinfo code."
> >
> >    (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) ))
> >
> > (add-hook 'texinfo-mode-hook 'vmove-keytrigger)
>
> In my opinion that hook, when it runs, internally get that all
> defined, but once function finishes, nothing yields out of it, because
> it is within `let' enclosure and because you are working on a
> temporary variable `map'.

No, because ‘map’ is a reference to the same object that
‘texinfo-mode-map’ refers to. Within the functions, they are two names
of the same data structure. Changes made through one name within the
function are then visible through the other name after the function
returns.



reply via email to

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