help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: changing comint-input-ring-file-name in process in shell


From: Seb
Subject: Re: changing comint-input-ring-file-name in process in shell
Date: Sun, 08 Nov 2009 11:57:41 -0600
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1.50 (gnu/linux)

On Sat, 07 Nov 2009 15:44:09 -0600,
Seb <address@hidden> wrote:

> On Sat, 07 Nov 2009 00:10:28 -0700,
> Kevin Rodgers <address@hidden> 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





reply via email to

[Prev in Thread] Current Thread [Next in Thread]