GNU bug report logs - #75486
[PATCH] Python: disable some unconditional messaging

Previous Next

Package: emacs;

Reported by: Vitaliy Chepelev <vitalij <at> gmx.com>

Date: Sat, 11 Jan 2025 06:38:01 UTC

Severity: minor

Tags: notabug, patch

Done: Eli Zaretskii <eliz <at> gnu.org>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 75486 in the body.
You can then email your comments to 75486 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#75486; Package emacs. (Sat, 11 Jan 2025 06:38:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Vitaliy Chepelev <vitalij <at> gmx.com>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Sat, 11 Jan 2025 06:38:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Vitaliy Chepelev <vitalij <at> gmx.com>
To: bug-gnu-emacs <at> gnu.org
Subject: [PATCH] Python: disable some unconditional messaging
Date: Sat, 11 Jan 2025 06:36:15 -0000
Severity: minor

This code disable function that used in one place and just do
 unconditional messaging about a indented block, I don't know for what.
 I guess, it was used for debuging
 python-info-dedenter-opening-block-position. This functions just call
 one function and message a result. Messaging happen when TAB key pressed
 as a part of python-indent-line-function.  I use master head to create
 this patch.

---
 lisp/progmodes/python.el | 16 +---------------
 1 file changed, 1 insertion(+), 15 deletions(-)

diff --git a/lisp/progmodes/python.el b/lisp/progmodes/python.el
index 16c296a8f86..4fa62ef927f 100644
--- a/lisp/progmodes/python.el
+++ b/lisp/progmodes/python.el
@@ -1897,8 +1897,7 @@ level."
                   (point)))))
     (save-excursion
       (indent-line-to
-       (python-indent-calculate-indentation previous))
-      (python-info-dedenter-opening-block-message))
+       (python-indent-calculate-indentation previous)))
     (when follow-indentation-p
       (back-to-indentation))))

@@ -6241,19 +6240,6 @@ likely an invalid python file."
           ;; sort by closer
           (nreverse opening-blocks))))))

-(define-obsolete-function-alias
-  'python-info-closing-block-message
-  #'python-info-dedenter-opening-block-message "24.4")
-
-(defun python-info-dedenter-opening-block-message  ()
-  "Message the first line of the block the current statement closes."
-  (let ((point (python-info-dedenter-opening-block-position)))
-    (when point
-        (message "Closes %s" (save-excursion
-                               (goto-char point)
-                               (buffer-substring
-                                (point) (line-end-position)))))))
-
 (defun python-info-dedenter-statement-p ()
   "Return point if current statement is a dedenter.
 Sets `match-data' to the keyword that starts the dedenter
--
2.45.2




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#75486; Package emacs. (Sat, 11 Jan 2025 08:07:02 GMT) Full text and rfc822 format available.

Message #8 received at 75486 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Vitaliy Chepelev <vitalij <at> gmx.com>, kobarity <kobarity <at> gmail.com>
Cc: 75486 <at> debbugs.gnu.org
Subject: Re: bug#75486: [PATCH] Python: disable some unconditional messaging
Date: Sat, 11 Jan 2025 10:05:59 +0200
> Date: Sat, 11 Jan 2025 06:36:15 -0000
> From:  Vitaliy Chepelev via "Bug reports for GNU Emacs,
>  the Swiss army knife of text editors" <bug-gnu-emacs <at> gnu.org>
> 
> Severity: minor
> 
> This code disable function that used in one place and just do
>  unconditional messaging about a indented block, I don't know for what.
>  I guess, it was used for debuging
>  python-info-dedenter-opening-block-position. This functions just call
>  one function and message a result. Messaging happen when TAB key pressed
>  as a part of python-indent-line-function.  I use master head to create
>  this patch.

Thanks.  kobarity, any comments about the usefulness of this function?
The code looks like it's there on purpose, not for debugging, but I
don't use python.el.





Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#75486; Package emacs. (Sat, 11 Jan 2025 12:04:02 GMT) Full text and rfc822 format available.

Message #11 received at 75486 <at> debbugs.gnu.org (full text, mbox):

From: kobarity <kobarity <at> gmail.com>
To: Eli Zaretskii <eliz <at> gnu.org>, Vitaliy Chepelev <vitalij <at> gmx.com>
Cc: 75486 <at> debbugs.gnu.org
Subject: Re: bug#75486: [PATCH] Python: disable some unconditional messaging
Date: Sat, 11 Jan 2025 21:02:57 +0900
Eli Zaretskii wrote:
> 
> > Date: Sat, 11 Jan 2025 06:36:15 -0000
> > From:  Vitaliy Chepelev via "Bug reports for GNU Emacs,
> >  the Swiss army knife of text editors" <bug-gnu-emacs <at> gnu.org>
> > 
> > Severity: minor
> > 
> > This code disable function that used in one place and just do
> >  unconditional messaging about a indented block, I don't know for what.
> >  I guess, it was used for debuging
> >  python-info-dedenter-opening-block-position. This functions just call
> >  one function and message a result. Messaging happen when TAB key pressed
> >  as a part of python-indent-line-function.  I use master head to create
> >  this patch.
> 
> Thanks.  kobarity, any comments about the usefulness of this function?
> The code looks like it's there on purpose, not for debugging, but I
> don't use python.el.

Yes, I think it's working as expected.  Try the following example.

#+begin_src python
if a == 1:
    if b == 2:
        if c == 3:
            pass
        else:
#+end_src

If you enter the last "else:", Emacs displays "Closes if c == 3:".
This means that this "else:" corresponds to the "if c == 3:".

You can change the indentation by hitting the TAB key several times on
the else line.  Each time you do this, Emacs will display the
corresponding if statement.

For example, Emacs displays "Closes if b == 2:" when the "else:" is
indented as follows:

#+begin_src python
if a == 1:
    if b == 2:
        if c == 3:
            pass
    else:
#+end_src

Of course, in this case it is easy to find the corresponding if
statement.  However, in practice, many lines can go in between the if
statements and disappear from the screen.  This feature would be
useful in such cases.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#75486; Package emacs. (Sat, 25 Jan 2025 08:44:03 GMT) Full text and rfc822 format available.

Message #14 received at 75486 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: kobarity <kobarity <at> gmail.com>
Cc: vitalij <at> gmx.com, 75486 <at> debbugs.gnu.org
Subject: Re: bug#75486: [PATCH] Python: disable some unconditional messaging
Date: Sat, 25 Jan 2025 10:43:30 +0200
tags 75486 notabug
close 75486
thanks

> Date: Sat, 11 Jan 2025 21:02:57 +0900
> From: kobarity <kobarity <at> gmail.com>
> Cc: 75486 <at> debbugs.gnu.org
> 
> Eli Zaretskii wrote:
> > 
> > > Date: Sat, 11 Jan 2025 06:36:15 -0000
> > > From:  Vitaliy Chepelev via "Bug reports for GNU Emacs,
> > >  the Swiss army knife of text editors" <bug-gnu-emacs <at> gnu.org>
> > > 
> > > Severity: minor
> > > 
> > > This code disable function that used in one place and just do
> > >  unconditional messaging about a indented block, I don't know for what.
> > >  I guess, it was used for debuging
> > >  python-info-dedenter-opening-block-position. This functions just call
> > >  one function and message a result. Messaging happen when TAB key pressed
> > >  as a part of python-indent-line-function.  I use master head to create
> > >  this patch.
> > 
> > Thanks.  kobarity, any comments about the usefulness of this function?
> > The code looks like it's there on purpose, not for debugging, but I
> > don't use python.el.
> 
> Yes, I think it's working as expected.  Try the following example.
> 
> #+begin_src python
> if a == 1:
>     if b == 2:
>         if c == 3:
>             pass
>         else:
> #+end_src
> 
> If you enter the last "else:", Emacs displays "Closes if c == 3:".
> This means that this "else:" corresponds to the "if c == 3:".
> 
> You can change the indentation by hitting the TAB key several times on
> the else line.  Each time you do this, Emacs will display the
> corresponding if statement.
> 
> For example, Emacs displays "Closes if b == 2:" when the "else:" is
> indented as follows:
> 
> #+begin_src python
> if a == 1:
>     if b == 2:
>         if c == 3:
>             pass
>     else:
> #+end_src
> 
> Of course, in this case it is easy to find the corresponding if
> statement.  However, in practice, many lines can go in between the if
> statements and disappear from the screen.  This feature would be
> useful in such cases.

Thanks.  No further comments in 2 weeks, so I'm now closing this bug.




Added tag(s) notabug. Request was from Eli Zaretskii <eliz <at> gnu.org> to control <at> debbugs.gnu.org. (Sat, 25 Jan 2025 08:44:04 GMT) Full text and rfc822 format available.

bug closed, send any further explanations to 75486 <at> debbugs.gnu.org and Vitaliy Chepelev <vitalij <at> gmx.com> Request was from Eli Zaretskii <eliz <at> gnu.org> to control <at> debbugs.gnu.org. (Sat, 25 Jan 2025 08:44:04 GMT) Full text and rfc822 format available.

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#75486; Package emacs. (Sun, 26 Jan 2025 14:32:02 GMT) Full text and rfc822 format available.

Message #21 received at 75486 <at> debbugs.gnu.org (full text, mbox):

From: kobarity <kobarity <at> gmail.com>
To: Vitaliy Chepelev <vitalij <at> gmx.com>, Eli Zaretskii <eliz <at> gnu.org>
Cc: 75486 <at> debbugs.gnu.org
Subject: Re: bug#75486: [PATCH] Python: disable some unconditional messaging
Date: Sun, 26 Jan 2025 23:31:22 +0900
Vitaliy Chepelev wrote:
> 
> This messaging should be disabled by default or at least with flag to
>  disable this. Everyone use own eyes to see where they indent. looking
>  to bottom everytime is excessive work.
> 
> kobarity <kobarity <at> gmail.com> writes:
> 
> > Eli Zaretskii wrote:
> >>
> >> > Date: Sat, 11 Jan 2025 06:36:15 -0000
> >> > From:  Vitaliy Chepelev via "Bug reports for GNU Emacs,
> >> >  the Swiss army knife of text editors" <bug-gnu-emacs <at> gnu.org>
> >> >
> >> > Severity: minor
> >> >
> >> > This code disable function that used in one place and just do
> >> >  unconditional messaging about a indented block, I don't know for what.
> >> >  I guess, it was used for debuging
> >> >  python-info-dedenter-opening-block-position. This functions just call
> >> >  one function and message a result. Messaging happen when TAB key pressed
> >> >  as a part of python-indent-line-function.  I use master head to create
> >> >  this patch.
> >>
> >> Thanks.  kobarity, any comments about the usefulness of this function?
> >> The code looks like it's there on purpose, not for debugging, but I
> >> don't use python.el.
> >
> > Yes, I think it's working as expected.  Try the following example.
> >
> > #+begin_src python
> > if a == 1:
> >     if b == 2:
> >         if c == 3:
> >             pass
> >         else:
> > #+end_src
> >
> > If you enter the last "else:", Emacs displays "Closes if c == 3:".
> > This means that this "else:" corresponds to the "if c == 3:".
> >
> > You can change the indentation by hitting the TAB key several times on
> > the else line.  Each time you do this, Emacs will display the
> > corresponding if statement.
> >
> > For example, Emacs displays "Closes if b == 2:" when the "else:" is
> > indented as follows:
> >
> > #+begin_src python
> > if a == 1:
> >     if b == 2:
> >         if c == 3:
> >             pass
> >     else:
> > #+end_src
> >
> > Of course, in this case it is easy to find the corresponding if
> > statement.  However, in practice, many lines can go in between the if
> > statements and disappear from the screen.  This feature would be
> > useful in such cases.

I think it's good to CC to debbugs.

If it is so hard to see the bottom and you don't need that
information, then it would be easy to ignore it.

If it still bothers you, how about disabling it by putting the
following code to init.el?

(advice-add 'python-info-dedenter-opening-block-message :override (lambda ()))




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Mon, 24 Feb 2025 12:24:18 GMT) Full text and rfc822 format available.

This bug report was last modified 116 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.