From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.ciao.gmane.io!not-for-mail From: Nick Dokos Newsgroups: gmane.emacs.help Subject: Re: Turning off sh-electric-here-document-mode? Date: Wed, 13 May 2020 21:25:41 -0400 Message-ID: <878shvxq7e.fsf@alphaville.usersys.redhat.com> References: <24a35cbe-f315-d95b-218b-6849d69954b1@gmail.com> <9543d2b3-4b7a-ef7e-78db-46d36900d82f@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Injection-Info: ciao.gmane.io; posting-host="ciao.gmane.io:159.69.161.202"; logging-data="76254"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) To: help-gnu-emacs@gnu.org Cancel-Lock: sha1:1JgAgA0c5GdBW6EQVWA9pz9P0iU= Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Thu May 14 03:26:22 2020 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 1jZ2di-000JkK-7a for geh-help-gnu-emacs@m.gmane-mx.org; Thu, 14 May 2020 03:26:22 +0200 Original-Received: from localhost ([::1]:59432 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jZ2dh-0002Oo-9M for geh-help-gnu-emacs@m.gmane-mx.org; Wed, 13 May 2020 21:26:21 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:35880) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jZ2dH-0002Oi-K1 for help-gnu-emacs@gnu.org; Wed, 13 May 2020 21:25:57 -0400 Original-Received: from ciao.gmane.io ([159.69.161.202]:52730) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jZ2dH-0006ms-0Y for help-gnu-emacs@gnu.org; Wed, 13 May 2020 21:25:55 -0400 Original-Received: from list by ciao.gmane.io with local (Exim 4.92) (envelope-from ) id 1jZ2dB-000J9k-LW for help-gnu-emacs@gnu.org; Thu, 14 May 2020 03:25:49 +0200 X-Injected-Via-Gmane: http://gmane.org/ Received-SPF: pass client-ip=159.69.161.202; envelope-from=geh-help-gnu-emacs@m.gmane-mx.org; helo=ciao.gmane.io X-detected-operating-system: by eggs.gnu.org: First seen = 2020/05/13 20:29:57 X-ACL-Warn: Detected OS = Linux 3.11 and newer [fuzzy] X-Spam_score_int: 3 X-Spam_score: 0.3 X-Spam_bar: / X-Spam_report: (0.3 / 5.0 requ) BAYES_00=-1.9, DKIM_ADSP_CUSTOM_MED=0.001, FORGED_GMAIL_RCVD=1, FREEMAIL_FORGED_FROMDOMAIN=0.001, FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.249, NML_ADSP_CUSTOM_MED=0.9, SPF_PASS=-0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.23 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" Xref: news.gmane.io gmane.emacs.help:123087 Archived-At: Douglas Lewan writes: > On 5/13/20 7:22 AM, Philipp Stephani wrote: >> Am Mi., 13. Mai 2020 um 02:51 Uhr schrieb Douglas Lewan : >>> OK. I'm sure I'm missing something obvious here. >>> >>> I want to turn off sh-electric-here-document-mode, but all the obvious >>> things seem to fail. I've put every one of the following in my .emacs, >>> but I still get here-documents in shell-script-mode. >>> >>> (sh-electric-here-document-mode nil) >>> >>> (sh-electric-here-document-mode 0) >>> >>> (sh-electric-here-document-mode -1) >>> >>> (sh-electric-here-document-mode) >>> >>> How do I do this? Thanks in advance. >>> >> >> It's a local mode, so all of those will only enable it in whatever >> buffer is current while evaluating your ~/.emacs (probably the scratch >> buffer). You need to customize sh-mode-hook instead. > > Indeed, that's where I started. My current .emacs contains the > following code: > > (add-hook 'sh-mode-hook (lambda () >       (setq sh-electric-here-document-mode nil))) > > Here's the documentation for the variable sh-electric-here-document-mode: > > sh-electric-here-document-mode is a variable defined in `sh-script.el'. > Its value is nil > Local in buffer aaa.sh; global value is the same. > >   Automatically becomes buffer-local when set. > > Documentation: > Non-nil if Sh-Electric-Here-Document mode is enabled. > Use the command `sh-electric-here-document-mode' to change this > variable. > Basically, the variable `sh-electric-here-document-mode' is an indicator light: you are supposed to look at it, but setting it to nil is basically smashing it: it no longer tells you the state of the underlying switch but that does not change the state of the switch. The switch is the *function* `sh-electric-here-document-mode': you call it with e.g -1 as its argument to turn the mode off (which as a side effect turns the indicator light off, i.e. sets the above variable to nil). See the doc string of the function for details. The point however is that sh-electric-here-document-mode is on by default *because* sh-mode-hook already contains the function that turns it on, so what you really want to do is delete that function from the hook: (remove-hook 'sh-mode-hook 'sh-electric-here-document-mode) should do it. -- Nick "There are only two hard problems in computer science: cache invalidation, naming things, and off-by-one errors." -Martin Fowler