[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Enabling a mode if disabled
From: |
Adham Omran |
Subject: |
Re: Enabling a mode if disabled |
Date: |
Thu, 13 Jul 2023 16:04:11 +0300 |
uzibalqa <uzibalqa@proton.me> writes:
> I want to enable scroll-bar only if the mode happens to be disabled. And
> conversely to disable it if it is enabled. What can I do?
>
> (scroll-bar-mode 1)
A hook should useful here.
(defun my-scroll-bar-mode-hook ()
(if (eq major-mode 'org-mode)
(scroll-bar-mode 1)
(scroll-bar-mode -1)))
(add-hook 'after-change-major-mode-hook 'my-scroll-bar-mode-hook)
Use the proper hook depending on when you want the change to occur.
Here it occurs after calling *-mode.
Adham Omran