From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.help Subject: Re: [External] : Tab completion and electric-indent-mode Date: Sat, 18 Jun 2022 09:44:59 +0300 Message-ID: <83pmj6o4gk.fsf@gnu.org> References: <83zgibnw34.fsf@gnu.org> Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="31167"; mail-complaints-to="usenet@ciao.gmane.io" To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Sat Jun 18 08:47:39 2022 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 1o2SF7-0007ss-78 for geh-help-gnu-emacs@m.gmane-mx.org; Sat, 18 Jun 2022 08:47:37 +0200 Original-Received: from localhost ([::1]:58052 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1o2SF5-0001Rh-Kn for geh-help-gnu-emacs@m.gmane-mx.org; Sat, 18 Jun 2022 02:47:35 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:54036) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o2SCh-0001RM-DE for help-gnu-emacs@gnu.org; Sat, 18 Jun 2022 02:45:07 -0400 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]:59086) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o2SCh-00063Q-3t for help-gnu-emacs@gnu.org; Sat, 18 Jun 2022 02:45:07 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=xBaAlIyVXtxj0GfwEUWp6oNDpeCHBaKQO55L2tGxEhw=; b=LU9P0dGAczR1 ev8mvm/aliTyrE7+3b5HbJ+XZ4+Twvtjw8zgutqrpJm8AdFWQZSagt0LGTjacXJtuYkqskVOXUw0I PS4oGTxBBKQHrVCNmi8vH6bJInhDzQ5tNJ3E/wkOV+n3I7E1E7uk/pTHXVAR3gnJLoPYDtaDyEtz4 99voJ3Tm5GNFSHdowlFLsPZ1ypyq00Dutff7x9iVx0upLNj1Qsbob5itmXtZuzkaMgIbeMYX9JcXN X6S39c21RCQEtMQ6i8nvgcq3B3QRKUcvY6Lh64NcibCPar2dGyaiudshzp8uAVwHJL273xlTAHuiq GHeSo2GXvsA/XVF1ji2HPw==; Original-Received: from [87.69.77.57] (port=1457 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o2SCb-0005V2-Ti for help-gnu-emacs@gnu.org; Sat, 18 Jun 2022 02:45:04 -0400 In-Reply-To: (carlmarcos@tutanota.com) 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" Xref: news.gmane.io gmane.emacs.help:137911 Archived-At: > Date: Sat, 18 Jun 2022 05:45:06 +0200 (CEST) > From: carlmarcos@tutanota.com > Cc: help-gnu-emacs@gnu.org > > But before you do, I suggest to check the latest code, because the > above quotations are obsolete. > > Have looked /emacs/lisp/electric.el which now describes command loop for `electric' modes. > > Still think there should be clear explanations on the level of indentations emacs does. > This is because reindentation typically refers to an indentation enhancement compared to > some basic indentation method. "On-the-Fly Reindentation" also has difficulty of interpretation. > Does there exist indentation that is "Not On-the-Fly"? What would that do? > > Have viewed the main repository > > define-minor-mode electric-indent-mode > > says > > When enabled, this reindents whenever the hook `electric-indent-functions' > returns non-nil, I do not find the comment informative regarding the types of > reindents. I don't know in which place you looked, but the above is just a small part of what the doc string says. You omitted the parts that are supposed to answer your questions. In particular, the doc string does attempt to explain what "reindent" means. > electric-indent-functions states that it is a special hook run to decide whether to auto-indent. Why are you focusing on electric-indent-functions? In most cases, the cause of electric reindentation is not that function, but what the rest of the sentence says: ...or if you insert one of the "electric characters". > Additionally, reindent means that an indentation scheme would have been applied > already, supposedly composed of a simpler indent scheme. > > Can information be introduced on how indentation and re-indentation works and the conditions > by which indentation is applied? What exactly indentation and reindentation do depends on the current major mode. electric-indent-mode just makes the mode-specific indentation to happen automatically in certain situations, where Emacs thinks the user expects reindentation. If you want to know how a specific major mode indents text, you need to look for answers in that mode, not in electric-indent-mode, because the latter simply cannot give you the answer. > There needs to be clear explanations of what indentation and reindentation do and under what > conditions as the current information is developer targeted but not user targeted. Here's the full doc string of electric-indent-mode in the current development version of Emacs: Toggle on-the-fly reindentation of text lines (Electric Indent mode). When enabled, this reindents whenever the hook `electric-indent-functions' returns non-nil, or if you insert one of the "electric characters". The electric characters normally include the newline, but can also include other characters as needed by the major mode; see `electric-indent-chars' for the actual list. By "reindent" we mean remove any existing indentation, and then indent the line according to context and rules of the major mode. This is a global minor mode. To toggle the mode in a single buffer, use `electric-indent-local-mode'. Given that electric-indent-mode doesn't know (and doesn't care) about the major-mode's specific indentation rules, the above explains what the minor mode itself does, including what is meant by "reindentation". The rest of the details are in the documentation of the major modes, and you should look there for more information.