[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Executing part of the code instead of another
From: |
Christopher Dimech |
Subject: |
Re: Executing part of the code instead of another |
Date: |
Wed, 7 Oct 2020 02:55:11 +0200 |
I have been trying to do the following
(setq optn 1)
(if (= optn 1)
( global-unset-key (kbd "C-<home>") )
( global-unset-key (kbd "C-<end>") )
( global-unset-key (kbd "C-<mouse-4>") )
( global-unset-key (kbd "C-<mouse-5>") )
( global-set-key (kbd "C-<home>")
(lambda () (interactive) (scroll-down 1)) ; Scrolls the page Down
)
( global-set-key (kbd "C-<end>")
(lambda () (interactive) (scroll-up 1)) ; Scrolls the page Up
)
( global-set-key (kbd "C-<mouse-4>")
(lambda () (interactive) (scroll-down 1)) ; Scrolls the page Down
)
( global-set-key (kbd "C-<mouse-5>")
(lambda () (interactive) (scroll-up 1)) ; Scrolls the page Up
)
)
> Sent: Wednesday, October 07, 2020 at 2:50 AM
> From: "Emanuel Berg via Users list for the GNU Emacs text editor"
> <help-gnu-emacs@gnu.org>
> To: help-gnu-emacs@gnu.org
> Subject: Re: Executing part of the code instead of another
>
> Christopher Dimech wrote:
>
> > I would like to have some numeric if condition so
> > I can set some keybindings when variable a has
> > value 1, but if variable a is 2, I want to set
> > a different set of keybindings. How can I do it?
>
> It is probably better to base this on the many
> different Emacs _modes_, but to answer your question:
>
> (if (= var-a 1)
> (do-something)
> (do-something-else) )
>
> --
> underground experts united
> http://user.it.uu.se/~embe8573
> https://dataswamp.org/~incal
>
>
>
- Executing part of the code instead of another, Christopher Dimech, 2020/10/06
- Re: Executing part of the code instead of another, Emanuel Berg, 2020/10/06
- Re: Executing part of the code instead of another,
Christopher Dimech <=
- Re: Executing part of the code instead of another, Emanuel Berg, 2020/10/06
- Re: Executing part of the code instead of another, Christopher Dimech, 2020/10/07
- Re: Executing part of the code instead of another, Emanuel Berg, 2020/10/07
- Re: Executing part of the code instead of another, Robert Pluim, 2020/10/07
- Re: Executing part of the code instead of another, Christopher Dimech, 2020/10/07
- Re: Executing part of the code instead of another, Nick Dokos, 2020/10/07
- Re: Executing part of the code instead of another, Christopher Dimech, 2020/10/07
- Re: Executing part of the code instead of another, Gregory Heytings, 2020/10/07
- Re: Executing part of the code instead of another, Emanuel Berg, 2020/10/07
- Re: Executing part of the code instead of another, Robert Pluim, 2020/10/07