From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: uzibalqa Newsgroups: gmane.emacs.help Subject: Re: Enabling a mode if disabled Date: Thu, 13 Jul 2023 14:18:44 +0000 Message-ID: References: <0DIkIqiyIklbjUFI7W15z9m3NPVAwS1qw_Cse_wYDAoFUdaLIu_VpNDwhsoSf81obCclyYXPjr4Nz6zG8PiZE9lWYQoDc69knrbJY5jgAvs=@proton.me> <877cr4gdys.fsf@nixos.mail-host-address-is-not-set> 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="21692"; mail-complaints-to="usenet@ciao.gmane.io" Cc: uzibalqa via Users list for the GNU Emacs text editor To: Adham Omran Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Thu Jul 13 16:19:52 2023 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 1qJxAe-0005Q4-3K for geh-help-gnu-emacs@m.gmane-mx.org; Thu, 13 Jul 2023 16:19:52 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qJx9t-0000XB-HB; Thu, 13 Jul 2023 10:19:05 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qJx9p-0000Wg-Ng for help-gnu-emacs@gnu.org; Thu, 13 Jul 2023 10:19:03 -0400 Original-Received: from mail-4318.protonmail.ch ([185.70.43.18]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qJx9n-0000dp-2x for help-gnu-emacs@gnu.org; Thu, 13 Jul 2023 10:19:01 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=proton.me; s=protonmail; t=1689257936; x=1689517136; bh=66xoEFKO1AkZz/s9G2Y4/nWI1Q7VebfMDip/dFxnNF0=; h=Date:To:From:Cc:Subject:Message-ID:In-Reply-To:References: Feedback-ID:From:To:Cc:Date:Subject:Reply-To:Feedback-ID: Message-ID:BIMI-Selector; b=VjxsbaO7u/zwCt9NM3RbU+xGnlSMi8Pk4nx8lKE1vEYv5S5TbpEIczI1acMeOs/rR /OitHOquTScX2X2j1b7IXyWg8Wmg2NeKVMClRV8hRRZgaQzK1DvVKgEn11FQxjhj6m G7FgQ+sA70kbDOUwy+IDZW2hN5WfedP6Cn3Mpef4h8PnN38B7LC+4tulOTmwQeKNM3 doORyw8b4cPRW0S4/fz9cyvbZ5RxdT6vx5ZZVq4hADkdxNPoHl4FfNu8AarIXc3Tyj /ipRu/j6aMihra+u2YiKSO4+HwyRYjmk7CD37r12THO/ooNJ6PiTyw+cpqObRm63cH G6+FzDqLWdubQ== In-Reply-To: <877cr4gdys.fsf@nixos.mail-host-address-is-not-set> Feedback-ID: 52887082:user:proton Received-SPF: pass client-ip=185.70.43.18; envelope-from=uzibalqa@proton.me; helo=mail-4318.protonmail.ch X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.29 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-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.help:144260 Archived-At: ------- Original Message ------- On Friday, July 14th, 2023 at 1:04 AM, Adham Omran w= rote: > uzibalqa uzibalqa@proton.me writes: >=20 > > I want to enable scroll-bar only if the mode happens to be disabled. An= d > > conversely to disable it if it is enabled. What can I do? > >=20 > > (scroll-bar-mode 1) >=20 >=20 > A hook should useful here. >=20 > (defun my-scroll-bar-mode-hook () > (if (eq major-mode 'org-mode) > (scroll-bar-mode 1) > (scroll-bar-mode -1))) >=20 > (add-hook 'after-change-major-mode-hook 'my-scroll-bar-mode-hook) >=20 > Use the proper hook depending on when you want the change to occur. > Here it occurs after calling *-mode. >=20 > Adham Omran The test should be done upon scroll-bar-mode rather than some other major m= ode.