GNU bug report logs -
#46003
prolog-mode: inferior prolog process not available when prolog-inferior-mode-hook is run
Previous Next
Reported by: Tim Lee <progscriptclone <at> gmail.com>
Date: Wed, 20 Jan 2021 08:34:01 UTC
Severity: normal
Fixed in version 29.1
Done: Lars Ingebrigtsen <larsi <at> gnus.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 46003 in the body.
You can then email your comments to 46003 AT debbugs.gnu.org in the normal way.
Toggle the display of automated, internal messages from the tracker.
Report forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#46003
; Package
emacs
.
(Wed, 20 Jan 2021 08:34:01 GMT)
Full text and
rfc822 format available.
Acknowledgement sent
to
Tim Lee <progscriptclone <at> gmail.com>
:
New bug report received and forwarded. Copy sent to
bug-gnu-emacs <at> gnu.org
.
(Wed, 20 Jan 2021 08:34:01 GMT)
Full text and
rfc822 format available.
Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):
I am using prolog-mode in Emacs 25.2. The following code shows that the
inferior prolog process is not available when prolog-inferior-mode-hook
is run:
(add-hook 'prolog-inferior-mode-hook
(lambda ()
(unless (get-buffer-process (current-buffer))
(warn "NO PROCESS!"))))
When I have above in my ~/.emacs, and when I start the Prolog REPL using
M-x run-prolog, the warning "NO PROCESS!" will appear, showing that the
inferior prolog process in not available when the hook is run.
I don't get this problem with the inferior mode hooks of other
programming languages (e.g. inferior-python-mode-hook,
inferior-lisp-mode-hook, inferior-scheme-mode-hook, etc.); their process
is available when their hook is run. I assume that there is problem with
prolog-mode.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#46003
; Package
emacs
.
(Wed, 27 Jan 2021 06:12:02 GMT)
Full text and
rfc822 format available.
Message #8 received at 46003 <at> debbugs.gnu.org (full text, mbox):
Is it a requirement for a buffer in a inferior-mode to always have a
process?
When you call run-prolog or prolog-consult-buffer, if a prolog process
is not running, a *prolog* buffer is created, prolog-inferior-mode is
activated in the buffer and THEN the process itself is run. Relevant code
from prolog-ensure-process function.
(with-current-buffer (get-buffer-create "*prolog*")
(prolog-inferior-mode)
...
(apply 'make-comint-in-buffer "prolog" (current-buffer)
(prolog-program-name) nil (prolog-program-switches)))
I assume this was required because (prolog-inferior-mode) sets up the
variables required for (prolog-program-name) and (prolog-program-switches).
If the relevant variables are inherited from the buffer from which run-prolog is
called then, this bug fix[1] will remove this dependency and prolog-inferior-mode
can be activated after the process is created.
[1]: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=45795
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#46003
; Package
emacs
.
(Tue, 07 Jun 2022 14:39:02 GMT)
Full text and
rfc822 format available.
Message #11 received at 46003 <at> debbugs.gnu.org (full text, mbox):
k3tu0isui <at> gmail.com writes:
> I assume this was required because (prolog-inferior-mode) sets up the
> variables required for (prolog-program-name) and (prolog-program-switches).
Those are computed before we enter prolog-inferior-mode, though... Oh,
because you've fixed that in an earlier applied patch.
> If the relevant variables are inherited from the buffer from which
> run-prolog is called then, this bug fix[1] will remove this dependency
> and prolog-inferior-mode can be activated after the process is
> created.
>
> [1]: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=45795
OK, then I'm applying this patch to Emacs 29, which should fix this bug
report:
diff --git a/lisp/progmodes/prolog.el b/lisp/progmodes/prolog.el
index 8382c4bd09..9598209f5e 100644
--- a/lisp/progmodes/prolog.el
+++ b/lisp/progmodes/prolog.el
@@ -1355,8 +1355,6 @@ prolog-ensure-process
(error "This Prolog system has defined no interpreter"))
(unless (comint-check-proc "*prolog*")
(with-current-buffer (get-buffer-create "*prolog*")
- (prolog-inferior-mode)
-
;; The "INFERIOR=yes" hack is for SWI-Prolog 7.2.3 and earlier,
;; which assumes it is running under Emacs if either INFERIOR=yes or
;; if EMACS is set to a nonempty value. The EMACS setting is
@@ -1369,6 +1367,7 @@ prolog-ensure-process
(cons "INFERIOR=yes" process-environment))))
(apply 'make-comint-in-buffer "prolog" (current-buffer)
pname nil pswitches))
+ (prolog-inferior-mode)
(unless prolog-system
;; Setup auto-detection.
--
(domestic pets only, the antidote for overdose, milk.)
bloggy blog: http://lars.ingebrigtsen.no
bug marked as fixed in version 29.1, send any further explanations to
46003 <at> debbugs.gnu.org and Tim Lee <progscriptclone <at> gmail.com>
Request was from
Lars Ingebrigtsen <larsi <at> gnus.org>
to
control <at> debbugs.gnu.org
.
(Tue, 07 Jun 2022 14:40:02 GMT)
Full text and
rfc822 format available.
bug archived.
Request was from
Debbugs Internal Request <help-debbugs <at> gnu.org>
to
internal_control <at> debbugs.gnu.org
.
(Wed, 06 Jul 2022 11:24:04 GMT)
Full text and
rfc822 format available.
This bug report was last modified 1 year and 295 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.