unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#18854: 25.0.50; Inferior Python mode should use derived-mode-p [with patch]
@ 2014-10-27 16:02 Ivan Andrus
  2014-10-27 17:45 ` Stefan Monnier
                   ` (2 more replies)
  0 siblings, 3 replies; 8+ messages in thread
From: Ivan Andrus @ 2014-10-27 16:02 UTC (permalink / raw)
  To: 18854

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

I maintain sage-mode which is implemented as a derived mode of
python-mode.  Likewise with inferior-sage-mode and inferior-python-mode.
There are some places in python-mode where major-mode is checked with
eq.  This causes some weird breakage when using sage-mode, particularly
it causes inferior-sage-mode to hang in some situations [1].  I could
probably work around it on the sage-mode side, but I think it makes
sense to use derived-mode-p instead, so I'm including this patch

-Ivan

[1] https://bitbucket.org/gvol/sage-mode/issue/42/run-sage-freezing-emacs-upon-launch

diff --git a/lisp/progmodes/python.el b/lisp/progmodes/python.el
index b230992..06f1ffe 100644
--- a/lisp/progmodes/python.el
+++ b/lisp/progmodes/python.el
@@ -2221,7 +2221,7 @@ Signals an error if no shell buffer is available for current buffer."
     (when (and python-shell--font-lock-buffer
                (buffer-live-p python-shell--font-lock-buffer))
       (kill-buffer python-shell--font-lock-buffer)
-      (when (eq major-mode 'inferior-python-mode)
+      (when (derived-mode-p 'inferior-python-mode)
         (setq python-shell--font-lock-buffer nil)))))
(defmacro python-shell-font-lock-with-font-lock-buffer (&rest body)
@@ -2238,7 +2238,7 @@ also `with-current-buffer'."
        (set-buffer python-shell--font-lock-buffer)
        (set (make-local-variable 'delay-mode-hooks) t)
        (let ((python-indent-guess-indent-offset nil))
-         (when (not (eq major-mode 'python-mode))
+         (when (not (derived-mode-p 'python-mode))
            (python-mode))
          ,@body))))
@@ -2501,7 +2501,7 @@ startup."
(defun python-shell-get-buffer ()
   "Return inferior Python buffer for current buffer.
If current buffer is in `inferior-python-mode', return it."
-  (if (eq major-mode 'inferior-python-mode)
+  (if (derived-mode-p 'inferior-python-mode)
       (current-buffer)
     (let* ((dedicated-proc-name (python-shell-get-process-name t))
            (dedicated-proc-buffer-name (format "*%s*" dedicated-proc-name))
@@ -3482,7 +3482,7 @@ The skeleton will be bound to python-skeleton-NAME."
(defun python-ffap-module-path (module)
   "Function for `ffap-alist' to return path for MODULE."
   (let ((process (or
-                  (and (eq major-mode 'inferior-python-mode)
+                  (and (derived-mode-p 'inferior-python-mode)
                        (get-buffer-process (current-buffer)))
                   (python-shell-get-process))))
     (if (not process)




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

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

* bug#18854: 25.0.50; Inferior Python mode should use derived-mode-p [with patch]
  2014-10-27 16:02 bug#18854: 25.0.50; Inferior Python mode should use derived-mode-p [with patch] Ivan Andrus
@ 2014-10-27 17:45 ` Stefan Monnier
  2014-10-27 22:14   ` Ivan Andrus
  2014-11-14 21:03   ` Ivan Andrus
  2014-11-15  5:28 ` Ivan Andrus
  2014-11-15 19:05 ` bug#18854: Fabián Ezequiel Gallina
  2 siblings, 2 replies; 8+ messages in thread
From: Stefan Monnier @ 2014-10-27 17:45 UTC (permalink / raw)
  To: Ivan Andrus; +Cc: 18854

> I maintain sage-mode which is implemented as a derived mode of
> python-mode.  Likewise with inferior-sage-mode and inferior-python-mode.
> There are some places in python-mode where major-mode is checked with
> eq.  This causes some weird breakage when using sage-mode, particularly
> it causes inferior-sage-mode to hang in some situations [1].  I could
> probably work around it on the sage-mode side, but I think it makes
> sense to use derived-mode-p instead, so I'm including this patch

Looks good, please install,


        Stefan





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

* bug#18854: 25.0.50; Inferior Python mode should use derived-mode-p [with patch]
  2014-10-27 17:45 ` Stefan Monnier
@ 2014-10-27 22:14   ` Ivan Andrus
  2014-11-14 21:03   ` Ivan Andrus
  1 sibling, 0 replies; 8+ messages in thread
From: Ivan Andrus @ 2014-10-27 22:14 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: 18854@debbugs.gnu.org

On 10/27/14, 11:45 AM, "Stefan Monnier" <monnier@iro.umontreal.ca> wrote:

>> I maintain sage-mode which is implemented as a derived mode of
>> python-mode.  Likewise with inferior-sage-mode and inferior-python-mode.
>> There are some places in python-mode where major-mode is checked with
>> eq.  This causes some weird breakage when using sage-mode, particularly
>> it causes inferior-sage-mode to hang in some situations [1].  I could
>> probably work around it on the sage-mode side, but I think it makes
>> sense to use derived-mode-p instead, so I'm including this patch
>
>Looks good, please install,

Cool, assuming you're talking to me.  :)  I've requested membership in the
Emacs group on Savannah.

-Ivan






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

* bug#18854: 25.0.50; Inferior Python mode should use derived-mode-p [with patch]
  2014-10-27 17:45 ` Stefan Monnier
  2014-10-27 22:14   ` Ivan Andrus
@ 2014-11-14 21:03   ` Ivan Andrus
  2014-11-15  3:14     ` Stefan Monnier
  2014-11-15 21:38     ` Glenn Morris
  1 sibling, 2 replies; 8+ messages in thread
From: Ivan Andrus @ 2014-11-14 21:03 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: 18854@debbugs.gnu.org

On 10/27/14, 11:45 AM, "Stefan Monnier" <monnier@iro.umontreal.ca> wrote:

>> I maintain sage-mode which is implemented as a derived mode of
>> python-mode.  Likewise with inferior-sage-mode and inferior-python-mode.
>> There are some places in python-mode where major-mode is checked with
>> eq.  This causes some weird breakage when using sage-mode, particularly
>> it causes inferior-sage-mode to hang in some situations [1].  I could
>> probably work around it on the sage-mode side, but I think it makes
>> sense to use derived-mode-p instead, so I'm including this patch
>
>Looks good, please install,
>
>
>        Stefan

I installed this on master .  I can backport to emacs-24 if that's
desirable.

I now realize I forgot to add "Fixes: debbugs:18854" to my commit message
(which presumably would close this bug).  Hopefully I didn't mess anything
else up too badly.

-Ivan






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

* bug#18854: 25.0.50; Inferior Python mode should use derived-mode-p [with patch]
  2014-11-14 21:03   ` Ivan Andrus
@ 2014-11-15  3:14     ` Stefan Monnier
  2014-11-15 21:38     ` Glenn Morris
  1 sibling, 0 replies; 8+ messages in thread
From: Stefan Monnier @ 2014-11-15  3:14 UTC (permalink / raw)
  To: Ivan Andrus; +Cc: 18854@debbugs.gnu.org

> I installed this on master .  I can backport to emacs-24 if that's
> desirable.

Yes, it would have been better to install it into emacs-24.


        Stefan





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

* bug#18854: 25.0.50; Inferior Python mode should use derived-mode-p [with patch]
  2014-10-27 16:02 bug#18854: 25.0.50; Inferior Python mode should use derived-mode-p [with patch] Ivan Andrus
  2014-10-27 17:45 ` Stefan Monnier
@ 2014-11-15  5:28 ` Ivan Andrus
  2014-11-15 19:05 ` bug#18854: Fabián Ezequiel Gallina
  2 siblings, 0 replies; 8+ messages in thread
From: Ivan Andrus @ 2014-11-15  5:28 UTC (permalink / raw)
  To: 18854@debbugs.gnu.org

On 11/14/14, 8:14 PM, "Stefan Monnier" <monnier@iro.umontreal.ca> wrote:

>> I installed this on master .  I can backport to emacs-24 if that's
>> desirable.
>
>Yes, it would have been better to install it into emacs-24.

Done.  Sorry for the mess.

-Ivan







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

* bug#18854:
  2014-10-27 16:02 bug#18854: 25.0.50; Inferior Python mode should use derived-mode-p [with patch] Ivan Andrus
  2014-10-27 17:45 ` Stefan Monnier
  2014-11-15  5:28 ` Ivan Andrus
@ 2014-11-15 19:05 ` Fabián Ezequiel Gallina
  2 siblings, 0 replies; 8+ messages in thread
From: Fabián Ezequiel Gallina @ 2014-11-15 19:05 UTC (permalink / raw)
  To: 18854-done


Closing just for cleanup.  I see this merged on master at f20a19d.






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

* bug#18854: 25.0.50; Inferior Python mode should use derived-mode-p [with patch]
  2014-11-14 21:03   ` Ivan Andrus
  2014-11-15  3:14     ` Stefan Monnier
@ 2014-11-15 21:38     ` Glenn Morris
  1 sibling, 0 replies; 8+ messages in thread
From: Glenn Morris @ 2014-11-15 21:38 UTC (permalink / raw)
  To: Ivan Andrus; +Cc: 18854@debbugs.gnu.org

Ivan Andrus wrote:

> I now realize I forgot to add "Fixes: debbugs:18854" to my commit message
> (which presumably would close this bug).

No, that doesn't close the bug (never has).
Close bugs by sending mail to 18854-done.





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

end of thread, other threads:[~2014-11-15 21:38 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-10-27 16:02 bug#18854: 25.0.50; Inferior Python mode should use derived-mode-p [with patch] Ivan Andrus
2014-10-27 17:45 ` Stefan Monnier
2014-10-27 22:14   ` Ivan Andrus
2014-11-14 21:03   ` Ivan Andrus
2014-11-15  3:14     ` Stefan Monnier
2014-11-15 21:38     ` Glenn Morris
2014-11-15  5:28 ` Ivan Andrus
2014-11-15 19:05 ` bug#18854: Fabián Ezequiel Gallina

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).