unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* emacs: run-octave captures the shell directory tracker
@ 2007-09-21  9:44 Francesco Potorti`
  2007-09-21 10:29 ` Bug#443439: " Francesco Potorti`
  0 siblings, 1 reply; 9+ messages in thread
From: Francesco Potorti` @ 2007-09-21  9:44 UTC (permalink / raw)
  To: Debian Bug Tracking System, bug-gnu-emacs
  Cc: Francesco Potorti`, Gabriele Oligeri

Package: emacs
Version: 22.1+1-2
Severity: minor

I will try to work on this, but due to lack of time I am not sure I will
be able to.  Workaround is:

M-x shell RET
octave RET
M-x rename-buffer RET octave RET
M-x load-library RET octave-inf RET
M-x inferior-octave-mode RET

In GNU Emacs 22.1.1 (x86_64-pc-linux-gnu, GTK+ Version 2.10.13)

emacs -nw -Q
M-x run-octave RET (you need to have octave installed)
C-x o
M-x cd RET /var RET
M-x shell RET
M-x set-variable RET debug-on-error RET t RET
cd log RET	   (this is done inside the shell buffer)

Debugger entered--Lisp error: (error "No such directory found via CDPATH environment variable")
  signal(error ("No such directory found via CDPATH environment variable"))
  error("No such directory found via CDPATH environment variable")
  cd(#("log" 0 3 (fontified t)))
  inferior-octave-directory-tracker(#("cd log\n" 0 6 (fontified t) 6 7 nil))
  run-hook-with-args(inferior-octave-directory-tracker #("cd log\n" 0 6 (fontified t) 6 7 nil))
  comint-send-input()
  call-interactively(comint-send-input)

-- System Information:
Debian Release: lenny/sid
  APT prefers testing
  APT policy: (990, 'testing'), (500, 'testing-proposed-updates')
Architecture: amd64 (x86_64)

Kernel: Linux 2.6.18-4-amd64 (SMP w/2 CPU cores)
Locale: LANG=C, LC_CTYPE=it_IT@euro (charmap=ANSI_X3.4-1968) (ignored: LC_ALL set to C)
Shell: /bin/sh linked to /bin/bash

Versions of packages emacs depends on:
ii  emacs22-gtk [emacs22]         22.1+1-2   The GNU Emacs editor (with GTK use

emacs recommends no packages.

-- no debconf information




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

* Re: Bug#443439: emacs: run-octave captures the shell directory tracker
  2007-09-21  9:44 emacs: run-octave captures the shell directory tracker Francesco Potorti`
@ 2007-09-21 10:29 ` Francesco Potorti`
  2007-09-21 11:32   ` Andreas Schwab
  0 siblings, 1 reply; 9+ messages in thread
From: Francesco Potorti` @ 2007-09-21 10:29 UTC (permalink / raw)
  To: bug-gnu-emacs, 443439-maintonly, Octave bugs list
  Cc: Francesco Potorti`, Gabriele Oligeri

Shell mode is unusable together with octave inferior mode, because it
often loses the notion of current directory.  Appended is a patch.

Apparently there are two problems.

The facts: shell mode adds a directory tracker to comint input filters,
but only locally:

|  comint-input-filter-functions is a variable defined in `comint.el'.
|  Its value is
|  (shell-directory-tracker t)
|
|  Permanently local in buffer *shell*; global value is nil

However, octave-inf mode changes it also globally, and in fact, after
running M-x run-octave RET, one gets this in the shell buffer:

|  comint-input-filter-functions is a variable defined in `comint.el'.
|  Its value is
|  (shell-directory-tracker t)
|
|  Permanently local in buffer *shell*; global value is
|  (inferior-octave-directory-tracker)

My interpretation:

The first problem is that inferior-octave-mode sets
comint-input-filter-functions globally rather than locally only.

The second problem is that shell-mode uses the global value of
comint-input-filter-functions rather than the local one.

This patch solves (or hides?) the first problem and removes the
symptoms.  The second problem, if I diagnosed it correctly, is more
serious and I will not touch upon it.

2007-09-21  Francesco Potortì  <pot@gnu.org>

	* progmodes/octave-inf.el (inferior-octave-mode): make local the
	comint-input-filter-functions variable before setting it.


--- /usr/share/emacs/22.1/lisp/progmodes/octave-inf.el~	2007-01-21 04:20:44.000000000 +0100
+++ /usr/share/emacs/22.1/lisp/progmodes/octave-inf.el	2007-09-21 12:11:09.000000000 +0200
@@ -153,8 +153,9 @@ Entry to this mode successively runs the
 
   (setq comint-input-ring-file-name
 	(or (getenv "OCTAVE_HISTFILE") "~/.octave_hist")
-	comint-input-ring-size (or (getenv "OCTAVE_HISTSIZE") 1024)
-	comint-input-filter-functions '(inferior-octave-directory-tracker))
+	comint-input-ring-size (or (getenv "OCTAVE_HISTSIZE") 1024))
+  (set (make-local-variable 'comint-input-filter-functions)
+       '(inferior-octave-directory-tracker))
   (set (make-local-variable 'comint-dynamic-complete-functions)
        inferior-octave-dynamic-complete-functions)
   (comint-read-input-ring t)

If this patch is good, I can install it in the Emacs CVS.

-- 
Francesco Potortì (ricercatore)        Voice: +39 050 315 3058 (op.2111)
ISTI - Area della ricerca CNR          Fax:   +39 050 315 2040
via G. Moruzzi 1, I-56124 Pisa         Email: Potorti@isti.cnr.it
Web: http://fly.isti.cnr.it/           Key:   fly.isti.cnr.it/public.key





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

* Re: Bug#443439: emacs: run-octave captures the shell directory tracker
  2007-09-21 10:29 ` Bug#443439: " Francesco Potorti`
@ 2007-09-21 11:32   ` Andreas Schwab
  2007-09-21 11:47     ` Francesco Potorti`
  0 siblings, 1 reply; 9+ messages in thread
From: Andreas Schwab @ 2007-09-21 11:32 UTC (permalink / raw)
  To: Francesco Potorti`
  Cc: Octave bugs list, bug-gnu-emacs, 443439-maintonly,
	Gabriele Oligeri, Francesco Potorti`

Francesco Potorti` <pot@gnu.org> writes:

> The second problem is that shell-mode uses the global value of
> comint-input-filter-functions rather than the local one.

This is a feature, not a bug.

> --- /usr/share/emacs/22.1/lisp/progmodes/octave-inf.el~	2007-01-21 04:20:44.000000000 +0100
> +++ /usr/share/emacs/22.1/lisp/progmodes/octave-inf.el	2007-09-21 12:11:09.000000000 +0200
> @@ -153,8 +153,9 @@ Entry to this mode successively runs the
>  
>    (setq comint-input-ring-file-name
>  	(or (getenv "OCTAVE_HISTFILE") "~/.octave_hist")
> -	comint-input-ring-size (or (getenv "OCTAVE_HISTSIZE") 1024)
> -	comint-input-filter-functions '(inferior-octave-directory-tracker))
> +	comint-input-ring-size (or (getenv "OCTAVE_HISTSIZE") 1024))
> +  (set (make-local-variable 'comint-input-filter-functions)
> +       '(inferior-octave-directory-tracker))

This should use add-hook with LOCAL = t.

Andreas.

-- 
Andreas Schwab, SuSE Labs, schwab@suse.de
SuSE Linux Products GmbH, Maxfeldstraße 5, 90409 Nürnberg, Germany
PGP key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."




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

* Re: Bug#443439: emacs: run-octave captures the shell directory tracker
  2007-09-21 11:32   ` Andreas Schwab
@ 2007-09-21 11:47     ` Francesco Potorti`
  2007-09-21 15:44       ` John W. Eaton
  2007-09-22 18:41       ` Glenn Morris
  0 siblings, 2 replies; 9+ messages in thread
From: Francesco Potorti` @ 2007-09-21 11:47 UTC (permalink / raw)
  To: Andreas Schwab; +Cc: bug-gnu-emacs, Octave bugs list, 443439-maintonly

>This should use add-hook with LOCAL = t.

Good, thanks.  So here is a correct patch:

2007-09-21  Francesco Potortì  <pot@gnu.org>

	* progmodes/octave-inf.el (inferior-octave-mode): Use add-hook to
	add inferior-octave-directory-tracker to the buffer-local value
	of comint-input-filter-functions.

--- octave-inf.el	21 Sep 2007 12:19:05 +0200	1.31
+++ octave-inf.el	21 Sep 2007 13:38:20 +0200	
@@ -153,10 +153,11 @@ Entry to this mode successively runs the
 
   (setq comint-input-ring-file-name
 	(or (getenv "OCTAVE_HISTFILE") "~/.octave_hist")
-	comint-input-ring-size (or (getenv "OCTAVE_HISTSIZE") 1024)
-	comint-input-filter-functions '(inferior-octave-directory-tracker))
+	comint-input-ring-size (or (getenv "OCTAVE_HISTSIZE") 1024))
   (set (make-local-variable 'comint-dynamic-complete-functions)
        inferior-octave-dynamic-complete-functions)
+  (add-hook 'comint-input-filter-functions
+	'inferior-octave-directory-tracker nil t)
   (comint-read-input-ring t)
 
   (run-mode-hooks 'inferior-octave-mode-hook))





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

* Re: Bug#443439: emacs: run-octave captures the shell directory tracker
  2007-09-21 11:47     ` Francesco Potorti`
@ 2007-09-21 15:44       ` John W. Eaton
       [not found]         ` <E1IYl9C-00019F-27@tucano.isti.cnr.it>
  2007-09-22 18:41       ` Glenn Morris
  1 sibling, 1 reply; 9+ messages in thread
From: John W. Eaton @ 2007-09-21 15:44 UTC (permalink / raw)
  To: Francesco Potorti`
  Cc: Andreas Schwab, bug-gnu-emacs, Octave bugs list, 443439-maintonly

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset=unknown, Size: 1545 bytes --]

On 21-Sep-2007, Francesco Potorti` wrote:

| >This should use add-hook with LOCAL = t.
| 
| Good, thanks.  So here is a correct patch:
| 
| 2007-09-21  Francesco Potortì  <pot@gnu.org>
| 
| 	* progmodes/octave-inf.el (inferior-octave-mode): Use add-hook to
| 	add inferior-octave-directory-tracker to the buffer-local value
| 	of comint-input-filter-functions.
| 
| --- octave-inf.el	21 Sep 2007 12:19:05 +0200	1.31
| +++ octave-inf.el	21 Sep 2007 13:38:20 +0200	
| @@ -153,10 +153,11 @@ Entry to this mode successively runs the
|  
|    (setq comint-input-ring-file-name
|  	(or (getenv "OCTAVE_HISTFILE") "~/.octave_hist")
| -	comint-input-ring-size (or (getenv "OCTAVE_HISTSIZE") 1024)
| -	comint-input-filter-functions '(inferior-octave-directory-tracker))
| +	comint-input-ring-size (or (getenv "OCTAVE_HISTSIZE") 1024))
|    (set (make-local-variable 'comint-dynamic-complete-functions)
|         inferior-octave-dynamic-complete-functions)
| +  (add-hook 'comint-input-filter-functions
| +	'inferior-octave-directory-tracker nil t)
|    (comint-read-input-ring t)
|  
|    (run-mode-hooks 'inferior-octave-mode-hook))

This patch does not apply cleanly to the octave-inf.el file that is
distributed with Octave.  I think the octave-{inf,mod,hlp}.el files
that are included with Emacs have diverged from the versions that are
distributed with Octave.  It would be helpful if someone could
reconcile the differences.  Should we even continue to distribute
these files with Octave?

Thanks,

jwe




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

* Re: Bug#443439: emacs: run-octave captures the shell directory tracker
       [not found]           ` <je1wcs2aoy.fsf@sykes.suse.de>
@ 2007-09-21 18:10             ` Francesco Potorti`
  2007-09-21 19:29               ` Andreas Schwab
  0 siblings, 1 reply; 9+ messages in thread
From: Francesco Potorti` @ 2007-09-21 18:10 UTC (permalink / raw)
  To: Andreas Schwab
  Cc: GNU emacs bug list, Octave bugs list, 443439-maintonly,
	John W. Eaton

>> +  (set (make-local-variable 'comint-dynamic-complete-functions)
>> +       inferior-octave-dynamic-complete-functions)
>
>That is also a hook variable, so it should be set with add-hook.

However, in shell.el:

  (set (make-local-variable 'comint-dynamic-complete-functions)
       shell-dynamic-complete-functions)




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

* Re: Bug#443439: emacs: run-octave captures the shell directory tracker
  2007-09-21 18:10             ` Francesco Potorti`
@ 2007-09-21 19:29               ` Andreas Schwab
  0 siblings, 0 replies; 9+ messages in thread
From: Andreas Schwab @ 2007-09-21 19:29 UTC (permalink / raw)
  To: Francesco Potorti`
  Cc: GNU emacs bug list, Octave bugs list, 443439-maintonly,
	John W. Eaton

Francesco Potorti` <pot@gnu.org> writes:

>>> +  (set (make-local-variable 'comint-dynamic-complete-functions)
>>> +       inferior-octave-dynamic-complete-functions)
>>
>>That is also a hook variable, so it should be set with add-hook.
>
> However, in shell.el:
>
>   (set (make-local-variable 'comint-dynamic-complete-functions)
>        shell-dynamic-complete-functions)

Sorry, I misparsed it.  Both inferior-octave-dynamic-complete-functions
and shell-dynamic-complete-functions are hooks by itself, so this is ok.

Andreas.

-- 
Andreas Schwab, SuSE Labs, schwab@suse.de
SuSE Linux Products GmbH, Maxfeldstraße 5, 90409 Nürnberg, Germany
PGP key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."

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

* Re: Bug#443439: emacs: run-octave captures the shell directory tracker
  2007-09-21 11:47     ` Francesco Potorti`
  2007-09-21 15:44       ` John W. Eaton
@ 2007-09-22 18:41       ` Glenn Morris
  2007-09-22 20:13         ` Francesco Potorti`
  1 sibling, 1 reply; 9+ messages in thread
From: Glenn Morris @ 2007-09-22 18:41 UTC (permalink / raw)
  To: Francesco Potorti`; +Cc: bug-gnu-emacs

Francesco Potorti` wrote:

> 2007-09-21  Francesco Potortì  <pot@gnu.org>
>
> 	* progmodes/octave-inf.el (inferior-octave-mode): Use add-hook to
> 	add inferior-octave-directory-tracker to the buffer-local value
> 	of comint-input-filter-functions.


Don't forget to install this on the EMACS_22_BASE branch as well.
Thanks.




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

* Re: Bug#443439: emacs: run-octave captures the shell directory tracker
  2007-09-22 18:41       ` Glenn Morris
@ 2007-09-22 20:13         ` Francesco Potorti`
  0 siblings, 0 replies; 9+ messages in thread
From: Francesco Potorti` @ 2007-09-22 20:13 UTC (permalink / raw)
  To: Glenn Morris; +Cc: bug-gnu-emacs

>> 2007-09-21  Francesco Potortì  <pot@gnu.org>
>>
>> 	* progmodes/octave-inf.el (inferior-octave-mode): Use add-hook to
>> 	add inferior-octave-directory-tracker to the buffer-local value
>> 	of comint-input-filter-functions.
>
>Don't forget to install this on the EMACS_22_BASE branch as well.
>Thanks.

Thank you for reminding.  It's done now.





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

end of thread, other threads:[~2007-09-22 20:13 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-09-21  9:44 emacs: run-octave captures the shell directory tracker Francesco Potorti`
2007-09-21 10:29 ` Bug#443439: " Francesco Potorti`
2007-09-21 11:32   ` Andreas Schwab
2007-09-21 11:47     ` Francesco Potorti`
2007-09-21 15:44       ` John W. Eaton
     [not found]         ` <E1IYl9C-00019F-27@tucano.isti.cnr.it>
     [not found]           ` <je1wcs2aoy.fsf@sykes.suse.de>
2007-09-21 18:10             ` Francesco Potorti`
2007-09-21 19:29               ` Andreas Schwab
2007-09-22 18:41       ` Glenn Morris
2007-09-22 20:13         ` Francesco Potorti`

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