unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#72298: Should python-mode-abbrev-table declare :parents python-base-mode-abbrev-table?
@ 2024-07-25 18:13 Ship Mints
  2024-07-25 18:33 ` Ship Mints
  0 siblings, 1 reply; 8+ messages in thread
From: Ship Mints @ 2024-07-25 18:13 UTC (permalink / raw)
  To: 72298

[-- Attachment #1: Type: text/plain, Size: 694 bytes --]

I was expecting that python-base-mode-abbrev-table would apply to both
python-mode and python-ts-mode buffers. python-ts-mode doesn't derive from
python-mode so the abbrev tables aren't shared by default. Unless I'm
missing something, using a base table doesn't work for me.

(define-abbrev-table 'python-mode-abbrev-table ()
  "Abbrev table for Python mode."
;; should this:
  :parents (list python-mode-skeleton-abbrev-table))
;; be defined thusly?
  :parents (list python-base-mode-abbrev-table
python-mode-skeleton-abbrev-table))

I tried to find guidance on this outside of hacking abbrev tables manually
to be shared. Perhaps other people have the same expectation.

Thank you,

Stephane

[-- Attachment #2: Type: text/html, Size: 1525 bytes --]

^ permalink raw reply	[flat|nested] 8+ messages in thread

* bug#72298: Should python-mode-abbrev-table declare :parents python-base-mode-abbrev-table?
  2024-07-25 18:13 bug#72298: Should python-mode-abbrev-table declare :parents python-base-mode-abbrev-table? Ship Mints
@ 2024-07-25 18:33 ` Ship Mints
  2024-08-17 13:53   ` Ship Mints
  0 siblings, 1 reply; 8+ messages in thread
From: Ship Mints @ 2024-07-25 18:33 UTC (permalink / raw)
  To: 72298

[-- Attachment #1: Type: text/plain, Size: 1040 bytes --]

An example of a personal hack to make this work could be to add something
like this to a python-mode-hook:

(if (derived-mode-p 'python-base-mode)
  (setq local-abbrev-table python-base-mode-abbrev-table))

On Thu, Jul 25, 2024 at 2:15 PM Ship Mints <shipmints@gmail.com> wrote:

> I was expecting that python-base-mode-abbrev-table would apply to both
> python-mode and python-ts-mode buffers. python-ts-mode doesn't derive from
> python-mode so the abbrev tables aren't shared by default. Unless I'm
> missing something, using a base table doesn't work for me.
>
> (define-abbrev-table 'python-mode-abbrev-table ()
>   "Abbrev table for Python mode."
> ;; should this:
>   :parents (list python-mode-skeleton-abbrev-table))
> ;; be defined thusly?
>   :parents (list python-base-mode-abbrev-table
> python-mode-skeleton-abbrev-table))
>
> I tried to find guidance on this outside of hacking abbrev tables manually
> to be shared. Perhaps other people have the same expectation.
>
> Thank you,
>
> Stephane
>

[-- Attachment #2: Type: text/html, Size: 2289 bytes --]

^ permalink raw reply	[flat|nested] 8+ messages in thread

* bug#72298: Should python-mode-abbrev-table declare :parents python-base-mode-abbrev-table?
  2024-07-25 18:33 ` Ship Mints
@ 2024-08-17 13:53   ` Ship Mints
  2024-08-24  8:45     ` Eli Zaretskii
  0 siblings, 1 reply; 8+ messages in thread
From: Ship Mints @ 2024-08-17 13:53 UTC (permalink / raw)
  To: 72298

[-- Attachment #1: Type: text/plain, Size: 1232 bytes --]

Greetings. Curious if I'm barking up the wrong tree with this assessment...

On Thu, Jul 25, 2024 at 2:33 PM Ship Mints <shipmints@gmail.com> wrote:

> An example of a personal hack to make this work could be to add something
> like this to a python-mode-hook:
>
> (if (derived-mode-p 'python-base-mode)
>   (setq local-abbrev-table python-base-mode-abbrev-table))
>
> On Thu, Jul 25, 2024 at 2:15 PM Ship Mints <shipmints@gmail.com> wrote:
>
>> I was expecting that python-base-mode-abbrev-table would apply to both
>> python-mode and python-ts-mode buffers. python-ts-mode doesn't derive from
>> python-mode so the abbrev tables aren't shared by default. Unless I'm
>> missing something, using a base table doesn't work for me.
>>
>> (define-abbrev-table 'python-mode-abbrev-table ()
>>   "Abbrev table for Python mode."
>> ;; should this:
>>   :parents (list python-mode-skeleton-abbrev-table))
>> ;; be defined thusly?
>>   :parents (list python-base-mode-abbrev-table
>> python-mode-skeleton-abbrev-table))
>>
>> I tried to find guidance on this outside of hacking abbrev tables
>> manually to be shared. Perhaps other people have the same expectation.
>>
>> Thank you,
>>
>> Stephane
>>
>

[-- Attachment #2: Type: text/html, Size: 2803 bytes --]

^ permalink raw reply	[flat|nested] 8+ messages in thread

* bug#72298: Should python-mode-abbrev-table declare :parents python-base-mode-abbrev-table?
  2024-08-17 13:53   ` Ship Mints
@ 2024-08-24  8:45     ` Eli Zaretskii
  2024-08-24 11:29       ` kobarity
  0 siblings, 1 reply; 8+ messages in thread
From: Eli Zaretskii @ 2024-08-24  8:45 UTC (permalink / raw)
  To: Ship Mints, kobarity; +Cc: 72298

> From: Ship Mints <shipmints@gmail.com>
> Date: Sat, 17 Aug 2024 09:53:15 -0400
> 
> Greetings. Curious if I'm barking up the wrong tree with this assessment...
> 
> On Thu, Jul 25, 2024 at 2:33 PM Ship Mints <shipmints@gmail.com> wrote:
> 
>  An example of a personal hack to make this work could be to add something like this to a
>  python-mode-hook:
> 
>  (if (derived-mode-p 'python-base-mode)
>    (setq local-abbrev-table python-base-mode-abbrev-table))
> 
>  On Thu, Jul 25, 2024 at 2:15 PM Ship Mints <shipmints@gmail.com> wrote:
> 
>  I was expecting that python-base-mode-abbrev-table would apply to both python-mode and
>  python-ts-mode buffers. python-ts-mode doesn't derive from python-mode so the abbrev tables
>  aren't shared by default. Unless I'm missing something, using a base table doesn't work for me.
> 
>  (define-abbrev-table 'python-mode-abbrev-table ()
>    "Abbrev table for Python mode."
>  ;; should this:
>    :parents (list python-mode-skeleton-abbrev-table))
>  ;; be defined thusly?
>    :parents (list python-base-mode-abbrev-table python-mode-skeleton-abbrev-table))
> 
>  I tried to find guidance on this outside of hacking abbrev tables manually to be shared. Perhaps
>  other people have the same expectation.

kobarity, any comments?





^ permalink raw reply	[flat|nested] 8+ messages in thread

* bug#72298: Should python-mode-abbrev-table declare :parents python-base-mode-abbrev-table?
  2024-08-24  8:45     ` Eli Zaretskii
@ 2024-08-24 11:29       ` kobarity
  2024-08-24 14:14         ` Ship Mints
  0 siblings, 1 reply; 8+ messages in thread
From: kobarity @ 2024-08-24 11:29 UTC (permalink / raw)
  To: Eli Zaretskii, Ship Mints; +Cc: 72298

[-- Attachment #1: Type: text/plain, Size: 1505 bytes --]

Eli Zaretskii wrote:
> 
> > From: Ship Mints <shipmints@gmail.com>
> > Date: Sat, 17 Aug 2024 09:53:15 -0400
> > 
> > Greetings. Curious if I'm barking up the wrong tree with this assessment...
> > 
> > On Thu, Jul 25, 2024 at 2:33 PM Ship Mints <shipmints@gmail.com> wrote:
> > 
> >  An example of a personal hack to make this work could be to add something like this to a
> >  python-mode-hook:
> > 
> >  (if (derived-mode-p 'python-base-mode)
> >    (setq local-abbrev-table python-base-mode-abbrev-table))
> > 
> >  On Thu, Jul 25, 2024 at 2:15 PM Ship Mints <shipmints@gmail.com> wrote:
> > 
> >  I was expecting that python-base-mode-abbrev-table would apply to both python-mode and
> >  python-ts-mode buffers. python-ts-mode doesn't derive from python-mode so the abbrev tables
> >  aren't shared by default. Unless I'm missing something, using a base table doesn't work for me.
> > 
> >  (define-abbrev-table 'python-mode-abbrev-table ()
> >    "Abbrev table for Python mode."
> >  ;; should this:
> >    :parents (list python-mode-skeleton-abbrev-table))
> >  ;; be defined thusly?
> >    :parents (list python-base-mode-abbrev-table python-mode-skeleton-abbrev-table))
> > 
> >  I tried to find guidance on this outside of hacking abbrev tables manually to be shared. Perhaps
> >  other people have the same expectation.
> 
> kobarity, any comments?

It seems to me that the skeletons should be defined in
python-base-mode.  How about the attached patch?

[-- Attachment #2: 0001-Make-Python-skeletons-available-in-python-ts-mode-as.patch --]
[-- Type: application/octet-stream, Size: 1073 bytes --]

From d5e8f2b99f77939099b14c8893e02e4daa3b0cbe Mon Sep 17 00:00:00 2001
From: kobarity <kobarity@gmail.com>
Date: Sat, 24 Aug 2024 20:13:16 +0900
Subject: [PATCH] Make Python skeletons available in python-ts-mode as well

* lisp/progmodes/python.el (python-base-mode-abbrev-table):
Renamed from python-mode-abbrev-table to be available for both
python-mode and python-ts-mode.
---
 lisp/progmodes/python.el | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/lisp/progmodes/python.el b/lisp/progmodes/python.el
index a00289d6de9..fb4b9afc073 100644
--- a/lisp/progmodes/python.el
+++ b/lisp/progmodes/python.el
@@ -5390,8 +5390,8 @@ python-skeleton-define
               (format "Insert %s statement." name))
          ,@skel))))
 
-(define-abbrev-table 'python-mode-abbrev-table ()
-  "Abbrev table for Python mode."
+(define-abbrev-table 'python-base-mode-abbrev-table ()
+  "Abbrev table for Python modes."
   :parents (list python-mode-skeleton-abbrev-table))
 
 (defmacro python-define-auxiliary-skeleton (name &optional doc &rest skel)
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* bug#72298: Should python-mode-abbrev-table declare :parents python-base-mode-abbrev-table?
  2024-08-24 11:29       ` kobarity
@ 2024-08-24 14:14         ` Ship Mints
  2024-08-25  0:34           ` kobarity
  0 siblings, 1 reply; 8+ messages in thread
From: Ship Mints @ 2024-08-24 14:14 UTC (permalink / raw)
  To: kobarity; +Cc: Eli Zaretskii, 72298

[-- Attachment #1: Type: text/plain, Size: 1714 bytes --]

Thank you. Will save confusion for people.

On Sat, Aug 24, 2024 at 7:30 AM kobarity <kobarity@gmail.com> wrote:

> Eli Zaretskii wrote:
> >
> > > From: Ship Mints <shipmints@gmail.com>
> > > Date: Sat, 17 Aug 2024 09:53:15 -0400
> > >
> > > Greetings. Curious if I'm barking up the wrong tree with this
> assessment...
> > >
> > > On Thu, Jul 25, 2024 at 2:33 PM Ship Mints <shipmints@gmail.com>
> wrote:
> > >
> > >  An example of a personal hack to make this work could be to add
> something like this to a
> > >  python-mode-hook:
> > >
> > >  (if (derived-mode-p 'python-base-mode)
> > >    (setq local-abbrev-table python-base-mode-abbrev-table))
> > >
> > >  On Thu, Jul 25, 2024 at 2:15 PM Ship Mints <shipmints@gmail.com>
> wrote:
> > >
> > >  I was expecting that python-base-mode-abbrev-table would apply to
> both python-mode and
> > >  python-ts-mode buffers. python-ts-mode doesn't derive from
> python-mode so the abbrev tables
> > >  aren't shared by default. Unless I'm missing something, using a base
> table doesn't work for me.
> > >
> > >  (define-abbrev-table 'python-mode-abbrev-table ()
> > >    "Abbrev table for Python mode."
> > >  ;; should this:
> > >    :parents (list python-mode-skeleton-abbrev-table))
> > >  ;; be defined thusly?
> > >    :parents (list python-base-mode-abbrev-table
> python-mode-skeleton-abbrev-table))
> > >
> > >  I tried to find guidance on this outside of hacking abbrev tables
> manually to be shared. Perhaps
> > >  other people have the same expectation.
> >
> > kobarity, any comments?
>
> It seems to me that the skeletons should be defined in
> python-base-mode.  How about the attached patch?
>

[-- Attachment #2: Type: text/html, Size: 2527 bytes --]

^ permalink raw reply	[flat|nested] 8+ messages in thread

* bug#72298: Should python-mode-abbrev-table declare :parents python-base-mode-abbrev-table?
  2024-08-24 14:14         ` Ship Mints
@ 2024-08-25  0:34           ` kobarity
  2024-08-31  9:43             ` Eli Zaretskii
  0 siblings, 1 reply; 8+ messages in thread
From: kobarity @ 2024-08-25  0:34 UTC (permalink / raw)
  To: Ship Mints, Eli Zaretskii; +Cc: 72298

[-- Attachment #1: Type: text/plain, Size: 253 bytes --]


Ship Mints wrote:
> Thank you. Will save confusion for people.

Thank you for your confirmation.

I forgot to include the bug ID in the commit message for the previous
patch, so I am attaching a revised version.  The patch itself has not
been changed.

[-- Attachment #2: 0001-Make-Python-skeletons-available-in-python-ts-mode-as.patch --]
[-- Type: application/octet-stream, Size: 1086 bytes --]

From 6f00df168c04a06b292bb2e21ec38cd325d1648d Mon Sep 17 00:00:00 2001
From: kobarity <kobarity@gmail.com>
Date: Sat, 24 Aug 2024 20:13:16 +0900
Subject: [PATCH] Make Python skeletons available in python-ts-mode as well

* lisp/progmodes/python.el (python-base-mode-abbrev-table):
Renamed from python-mode-abbrev-table to be available for both
python-mode and python-ts-mode.  (Bug#72298)
---
 lisp/progmodes/python.el | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/lisp/progmodes/python.el b/lisp/progmodes/python.el
index a00289d6de9..fb4b9afc073 100644
--- a/lisp/progmodes/python.el
+++ b/lisp/progmodes/python.el
@@ -5390,8 +5390,8 @@ python-skeleton-define
               (format "Insert %s statement." name))
          ,@skel))))
 
-(define-abbrev-table 'python-mode-abbrev-table ()
-  "Abbrev table for Python mode."
+(define-abbrev-table 'python-base-mode-abbrev-table ()
+  "Abbrev table for Python modes."
   :parents (list python-mode-skeleton-abbrev-table))
 
 (defmacro python-define-auxiliary-skeleton (name &optional doc &rest skel)
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* bug#72298: Should python-mode-abbrev-table declare :parents python-base-mode-abbrev-table?
  2024-08-25  0:34           ` kobarity
@ 2024-08-31  9:43             ` Eli Zaretskii
  0 siblings, 0 replies; 8+ messages in thread
From: Eli Zaretskii @ 2024-08-31  9:43 UTC (permalink / raw)
  To: kobarity; +Cc: shipmints, 72298-done

> Date: Sun, 25 Aug 2024 09:34:19 +0900
> From: kobarity <kobarity@gmail.com>
> Cc: 72298@debbugs.gnu.org
> 
> Ship Mints wrote:
> > Thank you. Will save confusion for people.
> 
> Thank you for your confirmation.
> 
> I forgot to include the bug ID in the commit message for the previous
> patch, so I am attaching a revised version.  The patch itself has not
> been changed.

Thanks, installed on the emacs-30 branch, and closing the bug.





^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2024-08-31  9:43 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-07-25 18:13 bug#72298: Should python-mode-abbrev-table declare :parents python-base-mode-abbrev-table? Ship Mints
2024-07-25 18:33 ` Ship Mints
2024-08-17 13:53   ` Ship Mints
2024-08-24  8:45     ` Eli Zaretskii
2024-08-24 11:29       ` kobarity
2024-08-24 14:14         ` Ship Mints
2024-08-25  0:34           ` kobarity
2024-08-31  9:43             ` Eli Zaretskii

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).