From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Vitaliy via "Bug reports for GNU Emacs, the Swiss army knife of text editors" Newsgroups: gmane.emacs.bugs Subject: bug#75109: [PATCH] indent.el Comments for indent-for-tab-command as a first step for refactoring. Date: Wed, 25 Dec 2024 21:48:58 -0000 Message-ID: <87o70zph6d.fsf@gmx.com> References: <87v7v7h1wp.fsf@gmx.com> Reply-To: Vitaliy Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="31640"; mail-complaints-to="usenet@ciao.gmane.io" To: 75109@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Thu Dec 26 05:34:16 2024 Return-path: Envelope-to: geb-bug-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 1tQfZf-00084W-Sh for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 26 Dec 2024 05:34:16 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tQfZV-0003cu-Sn; Wed, 25 Dec 2024 23:34:06 -0500 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 1tQfZU-0003cL-8l for bug-gnu-emacs@gnu.org; Wed, 25 Dec 2024 23:34:04 -0500 Original-Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tQfZT-0002cr-W1 for bug-gnu-emacs@gnu.org; Wed, 25 Dec 2024 23:34:04 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=debbugs.gnu.org; s=debbugs-gnu-org; h=MIME-Version:Date:References:In-Reply-To:From:To:Subject; bh=wxAQWqtgkfSHrSdQs+RluVj7JIBiFYO15PU4bNO0uxw=; b=RX47jtisvBXcHArmx/WHQ+cZezmvZbkAmqA4Z45axicC9lWBEqqz501XdN9ZVX9USUAH4iTdB8iKAXKIGd/2JQh8ZxdjquQ/k5wwPxX6X4FMUiVvYHoEQxjX+RNyjWlnImAB99WL2LhwcVlNXeTR8Ic2+gNtFi4B2rXkYh19c249tVsWuBQHsnetR5DOMfVx31D9JVbgMq7BGx0aggCr1sY4uZnmiPk+RsVhIMxaaegbnQ6zjRB++EDtSDL4HPr6G44Wi2xHO+McJHH7wenF0UgIyZGFTHVf8+e/zOuwAAxcrSrR3ghHdvKrJbbG5+Y7qJHlyJ9ajgUzSHqKHWhzwA==; Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1tQfZT-00062j-QW for bug-gnu-emacs@gnu.org; Wed, 25 Dec 2024 23:34:03 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Vitaliy Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 26 Dec 2024 04:34:03 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 75109 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.173518763723197 (code B ref -1); Thu, 26 Dec 2024 04:34:03 +0000 Original-Received: (at submit) by debbugs.gnu.org; 26 Dec 2024 04:33:57 +0000 Original-Received: from localhost ([127.0.0.1]:39687 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tQfZM-000622-SE for submit@debbugs.gnu.org; Wed, 25 Dec 2024 23:33:57 -0500 Original-Received: from lists.gnu.org ([209.51.188.17]:45044) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tQZFm-0002bl-3p for submit@debbugs.gnu.org; Wed, 25 Dec 2024 16:49:18 -0500 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 1tQZFk-0005KW-Ok for bug-gnu-emacs@gnu.org; Wed, 25 Dec 2024 16:49:17 -0500 Original-Received: from mout.gmx.net ([212.227.15.19]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tQZFj-0007O1-07 for bug-gnu-emacs@gnu.org; Wed, 25 Dec 2024 16:49:16 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmx.com; s=s31663417; t=1735163353; x=1735768153; i=vitalij@gmx.com; bh=wxAQWqtgkfSHrSdQs+RluVj7JIBiFYO15PU4bNO0uxw=; h=X-UI-Sender-Class:From:To:Subject:In-Reply-To:References:Date: Message-ID:MIME-Version:Content-Type:cc:content-transfer-encoding: content-type:date:from:message-id:mime-version:reply-to:subject: to; b=XgN8f4036jqfztHmVDEkkiEIMjkp8ZDsYDYNER2oldVJS3HXOqQsDZveluXuhFHU Huz+CONrH5QWtlIThvkaUtAY8Q6Q/H1qtP9znrVkZm+mT1RCJDF49HtsO0IAu6hyP IRIK6Thh9t8aWvgqpOnCmKiOft+ilS30g7Sb3VgsJmQ98oZd7QG+fnE2Ip4q1fmYu RpPKFtxAUWdQ4f3xRlaOyugPXJlc/rr11TLoCv8CLZqDODmLywn/gXtYR5BNyg9D/ jzVOHwJX7L6YHXrm6I5qa6xcYr7GZo+PJ7j8s3NVMQgaXElG80z4amYDFT5rrIYTw slTA1x+ApkJ3SCk50g== X-UI-Sender-Class: 724b4f7f-cbec-4199-ad4e-598c01a50d3a Original-Received: from localhost ([202.179.32.225]) by mail.gmx.net (mrgmx005 [212.227.17.184]) with ESMTPSA (Nemesis) id 1MSbxD-1sy8DO3wRF-00P31C for ; Wed, 25 Dec 2024 22:49:13 +0100 In-Reply-To: <87v7v7h1wp.fsf@gmx.com> X-Provags-ID: V03:K1:BjW1c5EigIyvhEaviObUqD8fmvXw/AIgF92TODVBzj+SzFNoeBe dFj75jnP5Ah9bO2yXEPpokdPi//J805BT/A6lXYMOJv4wZNrnaEVtjGYKkmpDY9H02ufbo0 q0Nwl9Ql7zFl610MwScccncVBBFIjXjHfsdjOP9Hjfzwwt0t7BAhnclr+FnrtR3AVM4ZVW0 iCp0DV0/Up5dWCA26LLCQ== UI-OutboundReport: notjunk:1;M01:P0:iCkac6caLy0=;k5HXLTrhM6tRS2PMNV5co3LxUvX UDSs2RRgZM5hxH6z9OwW0ftzPmuKntLMQGWG5Pk5EbUXsyWBpf6McqScOv5FEUa0Vu7HusCIS TlBikeH2/dQmcJgmGUjVxN+edvStCkvMWsQoDcYGw8o676XB7hYzmbcCRTY5G4SpVpG2oSs9e 6mINKYrN7tsmXIRXiSqVVEKKpi2jgphBV9sKLcqp4xZjQ8FItXdA71cw9T53pVNI+pFqaD58D P8ccWj4uimJUtmdCKlKlcNzRqbHUeOb7pyZyYG/avhRAwAgurMKT4zVov5bScWewdBQvfa/O2 2Q8WM/0TbxLxK4he+VWEOUxfk0bJTpHHxBdYVdpo4o3iwJtWvDbfRjGycGlUUERuizWTTrRB/ LpnSnxw9Cjm265xz5SL8r28YOuDtflMz2Q8RgUIT/fEJRmVdwYKuwAbJxQ/MS+PQf+1STmMfi 3gpgGPlfi7eATtkYHJo72DeM6Ouu9WJMV4bl0JZ+fhP1ouTAluQI+7hFelcd7itBmKR464QHH xGYywydIxVKLSxZ7Z4aeMhqlahiHgquCGEf/ivFokAUkNzwCAhMsuFfzNl7q3lAfrFqxOgibD BxwqZBz2RiFgVCG6KxnjazqIDauMbutGjQaeQn2YdAEBgUJf5clgQhosFWvj9Sd0AoIVaj/TJ dbfH8uFN4HaSMYmXgh9MxEd3f+vbj55y7eFHca+dwDYDXg2GNOOJMUrbEi3alln7DgoWHXXp4 IrpBvb88/q2XDLRzW6nrIvyKwOGjhtQRfkqCwL2Ae64K5LNtwAZFPSta5eAEB4LjwE6llpVg Received-SPF: pass client-ip=212.227.15.19; envelope-from=vitalij@gmx.com; helo=mout.gmx.net X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 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, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H2=-0.001, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-Mailman-Approved-At: Wed, 25 Dec 2024 23:33:54 -0500 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:297746 Archived-At: --=-=-= Content-Type: text/plain Content-Transfer-Encoding: quoted-printable Fixed "From" header inside of patch. Vitaliy writes: --=-=-= Content-Type: text/x-patch Content-Disposition: inline; filename=0001-Comment-for-indent-for-tab-command-as-a-first-step-t.patch >From 00c1dbbf729b1180963abb6743116ec4c8c6b5ad Mon Sep 17 00:00:00 2001 From: Vitaliy Date: Wed, 25 Dec 2024 21:26:05 +0000 Subject: [PATCH] Comment for indent-for-tab-command as a first step to refactoring. --- lisp/indent.el | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/lisp/indent.el b/lisp/indent.el index 74ef9183d95..613454918b8 100644 --- a/lisp/indent.el +++ b/lisp/indent.el @@ -160,6 +160,7 @@ prefix argument is ignored." ;; The region is active, indent it. ((use-region-p) (indent-region (region-beginning) (region-end))) + ;; *1.* inserts a tab character for special indentation cases. ((or ;; indent-to-left-margin is only meant for indenting, ;; so we force it to always insert a tab here. (eq indent-line-function 'indent-to-left-margin) @@ -172,15 +173,17 @@ prefix argument is ignored." (old-point (point)) (old-indent (current-indentation))) - ;; Indent the line. + ;; *2.* Indent the line with specified function (or (not (eq (indent--funcall-widened indent-line-function) 'noindent)) + ;; *3.* Indent comment (indent--default-inside-comment) + ;; *4.* Fallback to default indent function (when (or (<= (current-column) (current-indentation)) (not (eq tab-always-indent 'complete))) (indent--funcall-widened (default-value 'indent-line-function)))) (cond - ;; If the text was already indented right, try completion. + ;; *5.* If the text was already indented right, try completion. ((and (eq tab-always-indent 'complete) (eql old-point (point)) (eql old-tick (buffer-chars-modified-tick)) @@ -193,9 +196,9 @@ prefix argument is ignored." ('word-or-paren (not (memq syn '(2 4 5)))) ('word-or-paren-or-punct (not (memq syn '(2 4 5 1)))))))) (completion-at-point)) - - ;; If a prefix argument was given, rigidly indent the following - ;; sexp to match the change in the current line's indentation. + ;; *6* If a prefix argument was given, rigidly indent the + ;; following sexp to match the change in the current line's + ;; indentation. (arg (let ((end-marker (save-excursion -- 2.45.2 --=-=-= Content-Type: text/plain Content-Transfer-Encoding: quoted-printable > Tags: notabug > Package: indent.el > Version: master > Severity: wishlist > > In GNU Emacs master. > > #'indent-for-tab-command function now have strict steps, I hope in > future we will add ability to select on what orded they should go, as a > first step I suggest to comment them to separate. > This steps in unclear heap now: > -. **Check for Active Region**: If there is an active region, it indents= that region. > 1. **Handle Special Indentation Cases**: If the indentation function is = specific or certain conditions are met, it inserts a tab character. > 2. **Default Indentation Handling**: If neither of the above, it perform= s standard line indentation. > 3. **Check for Completion Conditions**: If specific conditions are met a= fter indentation, it triggers completion. > 4. **Rigid Indentation with Prefix Argument**: If a prefix argument is p= rovided, it rigidly indents the balanced expression to reflect the current= line's indentation. > From 00c1dbbf729b1180963abb6743116ec4c8c6b5ad Mon Sep 17 00:00:00 2001 > From: none > Date: Wed, 25 Dec 2024 21:26:05 +0000 > Subject: [PATCH] Comment for indent-for-tab-command as a first step to > refactoring. > > --- > lisp/indent.el | 13 ++++++++----- > 1 file changed, 8 insertions(+), 5 deletions(-) > > diff --git a/lisp/indent.el b/lisp/indent.el > index 74ef9183d95..613454918b8 100644 > --- a/lisp/indent.el > +++ b/lisp/indent.el > @@ -160,6 +160,7 @@ prefix argument is ignored." > ;; The region is active, indent it. > ((use-region-p) > (indent-region (region-beginning) (region-end))) > + ;; *1.* inserts a tab character for special indentation cases. > ((or ;; indent-to-left-margin is only meant for indenting, > ;; so we force it to always insert a tab here. > (eq indent-line-function 'indent-to-left-margin) > @@ -172,15 +173,17 @@ prefix argument is ignored." > (old-point (point)) > (old-indent (current-indentation))) > > - ;; Indent the line. > + ;; *2.* Indent the line with specified function > (or (not (eq (indent--funcall-widened indent-line-function) 'noin= dent)) > + ;; *3.* Indent comment > (indent--default-inside-comment) > + ;; *4.* Fallback to default indent function > (when (or (<=3D (current-column) (current-indentation)) > (not (eq tab-always-indent 'complete))) > (indent--funcall-widened (default-value 'indent-line-functi= on)))) > > (cond > - ;; If the text was already indented right, try completion. > + ;; *5.* If the text was already indented right, try completion. > ((and (eq tab-always-indent 'complete) > (eql old-point (point)) > (eql old-tick (buffer-chars-modified-tick)) > @@ -193,9 +196,9 @@ prefix argument is ignored." > ('word-or-paren (not (memq syn '(2 4 5)))) > ('word-or-paren-or-punct (not (memq syn '(2 4 5 1)= ))))))) > (completion-at-point)) > - > - ;; If a prefix argument was given, rigidly indent the following > - ;; sexp to match the change in the current line's indentation. > + ;; *6* If a prefix argument was given, rigidly indent the > + ;; following sexp to match the change in the current line's > + ;; indentation. > (arg > (let ((end-marker > (save-excursion > -- > 2.45.2 > > > -- > Best regards, > Vitaliy > Magic number: 7850B0B5E3F536601D2E6A9DE1C43E074A047699 =2D- Best regards, Magic number: 7850B0B5E3F536601D2E6A9DE1C43E074A047699 --=-=-=--