From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Adham Omran Newsgroups: gmane.emacs.help Subject: Re: Enabling a mode if disabled Date: Thu, 13 Jul 2023 16:04:11 +0300 Message-ID: <877cr4gdys.fsf@nixos.mail-host-address-is-not-set> References: <0DIkIqiyIklbjUFI7W15z9m3NPVAwS1qw_Cse_wYDAoFUdaLIu_VpNDwhsoSf81obCclyYXPjr4Nz6zG8PiZE9lWYQoDc69knrbJY5jgAvs=@proton.me> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="1345"; mail-complaints-to="usenet@ciao.gmane.io" To: uzibalqa , uzibalqa via Users list for the GNU Emacs text editor Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Fri Jul 14 06:50:28 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 1qKAlA-0000CR-0P for geh-help-gnu-emacs@m.gmane-mx.org; Fri, 14 Jul 2023 06:50:28 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qKAke-0004wa-Bk; Fri, 14 Jul 2023 00:49:56 -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 1qJvzd-0004Df-B9 for help-gnu-emacs@gnu.org; Thu, 13 Jul 2023 09:04:26 -0400 Original-Received: from out1-smtp.messagingengine.com ([66.111.4.25]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qJvzW-0000Fa-J4 for help-gnu-emacs@gnu.org; Thu, 13 Jul 2023 09:04:24 -0400 Original-Received: from compute3.internal (compute3.nyi.internal [10.202.2.43]) by mailout.nyi.internal (Postfix) with ESMTP id 7845F5C00E8; Thu, 13 Jul 2023 09:04:14 -0400 (EDT) Original-Received: from mailfrontend1 ([10.202.2.162]) by compute3.internal (MEProxy); Thu, 13 Jul 2023 09:04:14 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-type:content-type:date:date :feedback-id:feedback-id:from:from:in-reply-to:in-reply-to :message-id:mime-version:references:reply-to:sender:subject :subject:to:to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender :x-sasl-enc; s=fm3; t=1689253454; x=1689339854; bh=OBuXzQE2AHPBn fdTxEV4NZ7pjZ5HISGYfM8cVfZOvGw=; b=il65mvGt10PqaRLjLaXEqdoTpmg4b MBPPhnnqIEgyuxY9uXg9nD0o7k0EpnbJ8Ybbz9bTr+oqhmmHzaNO3KwJS+wVZcRf 6LQTbN0k6Wprok1Km+Jddecuur+pLzbgvoQBDVlpuElyKylzW8hR7mpLIT9DITkZ cMAc4djQMxt77QucW/u9qo765CWmTckT4Er0ACPOXcbnxUPFi0ddUtztCFfCBSSR mnbdT/PO3b+IC6euTr7Y0WpUKpjiCk19xXLtlXzeV6G3an93001qzy8USgkD3tUw Zj+2CnaFd7hjk9a2Q5xLhzddxnfMe390qIxQHj2ZDzL7C7y1DWLVregFA== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedviedrfeeggdehlecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpefhvffujghffffkgggtsehttdertddttddtnecuhfhrohhmpeetughhrghmucfq mhhrrghnuceomhgrihhlsegrughhrghmqdhomhhrrghnrdgtohhmqeenucggtffrrghtth gvrhhnpefhkefhjeeuieefvdelvdelveehffetjefgjeeggfefhefhuefgiefgudfgvddv udenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpehmrg hilhesrgguhhgrmhdqohhmrhgrnhdrtghomh X-ME-Proxy: Feedback-ID: ie481464f:Fastmail Original-Received: by mail.messagingengine.com (Postfix) with ESMTPA; Thu, 13 Jul 2023 09:04:13 -0400 (EDT) In-Reply-To: <0DIkIqiyIklbjUFI7W15z9m3NPVAwS1qw_Cse_wYDAoFUdaLIu_VpNDwhsoSf81obCclyYXPjr4Nz6zG8PiZE9lWYQoDc69knrbJY5jgAvs=@proton.me> Received-SPF: pass client-ip=66.111.4.25; envelope-from=mail@adham-omran.com; helo=out1-smtp.messagingengine.com X-Spam_score_int: -25 X-Spam_score: -2.6 X-Spam_bar: -- X-Spam_report: (-2.6 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H3=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-Mailman-Approved-At: Fri, 14 Jul 2023 00:49:51 -0400 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:144275 Archived-At: uzibalqa 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