[GRASS-user] Re: changing comint-input-ring-file-name in process in shell

Seb spluque at gmail.com
Sun Nov 8 12:57:41 EST 2009


On Sat, 07 Nov 2009 15:44:09 -0600,
Seb <spluque at gmail.com> wrote:

> On Sat, 07 Nov 2009 00:10:28 -0700,
> Kevin Rodgers <kevin.d.rodgers at gmail.com> wrote:

[...]

>> How about:

>> (let ((comint-input-ring-file-name "/path/to/local/.bash_history"))
>> (shell))

> Thanks for the explanation Kevin.  There is no difference with your
> suggestion, however.  In the resulting shell buffer I see:

> ,-----[ C-h v comint-input-ring-file-name RET ]
>> comint-input-ring-file-name's value is "~/.bash_history" Local in
>> buffer *shell*; global value is nil
>> 
>> Documentation: If non-nil, name of the file to read/write input
>> history.  See also `comint-read-input-ring' and
>> `comint-write-input-ring'.
>> 
>> This variable is buffer-local, and is a good thing to set in mode
>> hooks.
>> 
>> You can customize this variable.
>> 
>> [back]
> `-----

> and cycling shows that: i.e. "M-n" and "M-p" cycle through
> ~/bash_history, rather than the value in the `let' statement.  This is
> strange.  This is on Emacs 23.

I eventually solved this with:

(defun grass (full-location)
  "Call grass with FULL-LOCATION arguments and set up a shell buffer
to work on. FULL-LOCATION must be a fully-qualified GRASS location;
i.e. it must include GISDBASE/LOCATION_NAME/MAPSET.

The GRASS process runs in a shell buffer, named *GRASS*."
  (interactive "DLocation: ")
  (let ((grassbuf "*GRASS*"))
    (shell grassbuf)
    (comint-send-string grassbuf (concat "grass " full-location "\n"))
    (setq comint-input-ring-file-name
	  (or (getenv "HISTFILE")
	      (concat (directory-file-name full-location)
		      "/.bash_history")))
    (comint-read-input-ring)))

Cc'ing the grass-user list where it might be of interest.

Thanks,

-- 
Seb



More information about the grass-user mailing list