This is a repost with additional information. I've managed to find a fix, but 
I'd like to understand what happened, and perhaps clean up some ancient code.

For the last few days, I've been struggling with a problem with Cygwin Emacs 
after reinstalling Cygwin, which I haven't had to do for a while.

I discovered that when I create the first shell buffer, it works fine. When I 
create the second shell buffer, it fails with this:
------------------
   bash: cannot set terminal process group (-1): Inappropriate ioctl for device
   bash: no job control in this shell
----------------

After I got away from the computer for a while, I realized that I might be able 
to narrow this down.  I thought that this might be a problem with the small 
façade package I wrote over "shell" a few decades ago, but I realized that if I 
just start Emacs and manually switch to a buffer and run "shell" and then do 
that again, that is basically the same thing.  I found that that repeats the 
problem.

So then I looked at my .emacs file, and I noticed the following.  Note that 
this is another block of code that I haven't changed in many years. I know that 
several of these lines are obsolete now, even some that aren't causing my 
problem:
------------------
(defun my-shell-mode-hook ()
;(add-hook 'comint-output-filter-functions
;           'shell-strip-ctrl-m nil t)
  (add-hook 'comint-output-filter-functions
            'comint-watch-for-password-prompt nil t)
  (setq explicit-shell-file-name "bash")
  ;; For subprocesses invoked via the shell
  ;; (e.g., "shell -c command")
  (setq shell-file-name explicit-shell-file-name)
  (ansi-color-for-comint-mode-on)
  (shell-strip-ctrl-m)
  (setq shell-prompt-pattern "^\[[A-z0-9]+:[A-z0-9/]+\] ")
  (local-set-key "\C-xs" 'cycle-go-shell)
  (local-set-key "\C-xS" 'cycle-find-shell-or-shells-buffer-list)
  (local-set-key "\C-j" 'lfd-send-input)
  (local-set-key [f5] 'comint-previous-matching-input-from-input)
  (local-set-key [f12] 'compilation-shell-minor-mode)
  )
-----------------

For most of this, I can't even remember what it was for.  I tried commenting 
out portions of this and retesting, and I finally narrowed it down to the two 
sets of the related "file-name" variables. When I comment both of those out and 
retest, the problem doesn't occur.  I see that the new value of 
"shell-file-name" is "/bin/bash", instead of the "bash" value that I was 
hardcoding before.  Certainly less code is better than more code, especially if 
it works, but it would be useful to understand if something changed recently 
that might have caused that error.

I also briefly examined some of these other blocks, and I see that apparently 
"shell-strip-ctrl-m" is obsolete.  Is it best to have this?:

    (add-hook 'comint-output-filter-functions
        'comint-strip-ctrl-m nil t)


-- 
Problem reports:      https://cygwin.com/problems.html
FAQ:                  https://cygwin.com/faq/
Documentation:        https://cygwin.com/docs.html
Unsubscribe info:     https://cygwin.com/ml/#unsubscribe-simple

Reply via email to