Subject: bug#12380: other window related commands broken

From: Doug Morgan <[email-masked]>
Date: Sat, 08 Sep 2012 18:34:40 -0700

First, here is what the debugger says when I try to "Send Bug Report:..."
Debugger entered--Lisp error: (wrong-type-argument stringp nil)
   file-name-directory(nil)
   byte-code("\300\301\302\303\304!!\"\305BC\207" [format "hides 
\\(%s.*\\)" file-name-directory locate-library "simple.el" (1 
font-lock-warning-face)] 5)
   (defvar load-path-shadows-font-lock-keywords (byte-code 
"\300\301\302\303\304!!\"\305BC\207" [format "hides \\(%s.*\\)" 
file-name-directory locate-library "simple.el" (1 
font-lock-warning-face)] 5) 
("/usr/share/emacs/24.2/lisp/emacs-lisp/shadow.elc" . 3268))
   list-load-path-shadows(t)
   report-emacs-bug("other window splitting again" [24 50 24 2 
(help-echo #<frame emacs@Doug-PC 0x20068800> "mouse-1, mouse-2: sort by 
size" #<window 8 on *Buffer List*> #(" CRM Buffer                Size  
Mode              File\n" 0 1 (display (space :align-to 0)) 1 4 (face 
fixed-pitch) 4 5 (display (space :align-to 4)) 5 11 (keymap (keymap (13 
. Buffer-menu-sort-by-column) (follow-link . mouse-face) (mouse-2 . 
Buffer-menu-sort-by-column) (header-line keymap (mouse-2 . 
Buffer-menu-sort-by-column) (mouse-1 . Buffer-menu-sort-by-column))) 
mouse-face highlight help-echo "mouse-1, mouse-2: sort by buffer" column 
2) 11 27 (display (space :align-to 26)) 27 31 (column 3 help-echo 
"mouse-1, mouse-2: sort by size" mouse-face highlight keymap (keymap (13 
. Buffer-menu-sort-by-column) (follow-link . mouse-face) (mouse-2 . 
Buffer-menu-sort-by-column) (header-line keymap (mouse-2 . 
Buffer-menu-sort-by-column) (mouse-1 . Buffer-menu-sort-by-column)))) 31 
33 (display (space :align-to 32)) 33 37 (keymap (keymap (13 . 
Buffer-menu-sort-by-column) (follow-link . mouse-face) (mouse-2 . 
Buffer-menu-sort-by-column) (header-line keymap (mouse-2 . 
Buffer-menu-sort-by-column) (mouse-1 . Buffer-menu-sort-by-column))) 
mouse-face highlight help-echo "mouse-1, mouse-2: sort by mode" column 
4) 37 51 (display (space :align-to 50)) 51 55 (keymap (keymap (13 . 
Buffer-menu-sort-by-column) (follow-link . mouse-face) (mouse-2 . 
Buffer-menu-sort-by-column) (header-line keymap (mouse-2 . 
Buffer-menu-sort-by-column) (mouse-1 . Buffer-menu-sort-by-column))) 
mouse-face highlight help-echo "mouse-1, mouse-2: sort by file" column 
5) 55 56 (display (space :align-to 55))) 28) (help-echo #<frame 
emacs@Doug-PC 0x20068800> "Major mode\nmouse-1: Display major mode 
menu\nmouse-2: Show help for major mode\nmouse-3: Toggle minor modes" 
#<window 8 on *Buffer List*> #("Buffer Menu" 0 11 (local-map (keymap 
(mode-line keymap (down-mouse-3 keymap (abbrev-mode menu-item "Abbrev 
(Abbrev)" abbrev-mode :help "Automatically expand abbreviations" :button 
...) (auto-fill-mode menu-item "Auto fill (Fill)" auto-fill-mode :help 
"Automatically insert new lines" :button ...) (auto-revert-mode 
menu-item "Auto revert (ARev)" auto-revert-mode :help "Revert the buffer 
when the file on disk changes" :button ...) (auto-revert-tail-mode 
menu-item "Auto revert tail (Tail)" auto-revert-tail-mode :help "Revert 
the tail of the buffer when buffer grows" :enable ... :button ...) 
(flyspell-mode menu-item "Flyspell (Fly)" flyspell-mode :help "Spell 
checking on the fly" :button ...) (font-lock-mode menu-item "Font Lock" 
font-lock-mode :help "Syntax coloring" :button ...) (glasses-mode 
menu-item "Glasses (o^o)" glasses-mode :help "Insert virtual separators 
to make long identifiers easy to read" :button ...) (hide-ifdef-mode 
menu-item "Hide ifdef (Ifdef)" hide-ifdef-mode :help "Show/Hide code 
within #ifdef constructs" :button ...) (highlight-changes-mode menu-item 
"Highlight changes (Chg)" highlight-changes-mode :help "Show changes in 
the buffer in a distinctive color" :button ...) (outline-minor-mode 
menu-item "Outline (Outl)" outline-minor-mode :help "" :button ...) 
(overwrite-mode menu-item "Overwrite (Ovwrt)" overwrite-mode :help 
"Overwrite mode: typed characters replace existing text" :button ...) 
"Minor Modes") (mouse-2 . describe-mode) (down-mouse-1 menu-item "Menu 
Bar" ignore :filter (lambda ... ...)))) mouse-face mode-line-highlight 
help-echo "Major mode\nmouse-1: Display major mode menu\nmouse-2: Show 
help for major mode\nmouse-3: Toggle minor modes")) 9) (help-echo 
#<frame emacs@Doug-PC 0x20068800> "mouse-1: Select (drag to 
resize)\nmouse-2: Make current window occupy the whole frame\nmouse-3: 
Remove current window from display" #<window 8 on *Buffer List*> #("   " 
0 3 (help-echo "mouse-1: Select (drag to resize)\nmouse-2: Make current 
window occupy the whole frame\nmouse-3: Remove current window from 
display")) 0) (help-echo #<frame emacs@Doug-PC 0x20068800> "Buffer 
name\nmouse-1: previous buffer\nmouse-3: next buffer" #<window 8 on 
*Buffer List*> #("%12b" 0 4 (local-map (keymap (header-line keymap 
(mouse-3 . mode-line-next-buffer) (down-mouse-3 . ignore) (mouse-1 . 
mode-line-previous-buffer) (down-mouse-1 . ignore)) (mode-line keymap 
(mouse-3 . mode-line-next-buffer) (mouse-1 . 
mode-line-previous-buffer))) mouse-face mode-line-highlight help-echo 
"Buffer name\nmouse-1: previous buffer\nmouse-3: next buffer" face 
mode-line-buffer-id)) 1) (help-echo #<frame emacs@Doug-PC 0x20068800> 
"Read a directory, to operate on its files" nil nil 0) (help-echo 
#<frame emacs@Doug-PC 0x20068800> "Make text in active region stand out 
in color (Transient Mark mode)" nil nil 0) (help-echo #<frame 
emacs@Doug-PC 0x20068800> "Highlight matching/mismatched parentheses at 
cursor (Show Paren mode)" nil nil 0) (help-echo #<frame emacs@Doug-PC 
0x20068800> "Automatically fill text while typing (Auto Fill mode)" nil 
nil 0) (help-echo #<frame emacs@Doug-PC 0x20068800> "Ignore letter-case 
in search commands" nil nil 0) (help-echo #<frame emacs@Doug-PC 
0x20068800> "Use C-z/C-x/C-c/C-v keys for undo/cut/copy/paste" nil nil 
0) (help-echo #<frame emacs@Doug-PC 0x20068800> "Uniquify buffer names 
by adding parent directory names" nil nil 0) (help-echo #<frame 
emacs@Doug-PC 0x20068800> "Visit files of previous session when 
restarting Emacs" nil nil 0) (help-echo #<frame emacs@Doug-PC 
0x20068800> "Uniquify buffer names by adding parent directory names" nil 
nil 0) (help-echo #<frame emacs@Doug-PC 0x20068800> "Use C-z/C-x/C-c/C-v 
keys for undo/cut/copy/paste" nil nil 0) (help-echo #<frame 
emacs@Doug-PC 0x20068800> "Ignore letter-case in search commands" nil 
nil 0) (help-echo #<frame emacs@Doug-PC 0x20068800> "Use C-z/C-x/C-c/C-v 
keys for undo/cut/copy/paste" nil nil 0) (help-echo #<frame 
emacs@Doug-PC 0x20068800> "Uniquify buffer names by adding parent 
directory names" nil nil 0) (help-echo #<frame emacs@Doug-PC 0x20068800> 
"Visit files of previous session when restarting Emacs" nil nil 0) 
(help-echo #<frame emacs@Doug-PC 0x20068800> "Whether the cursor blinks 
(Blink Cursor mode)" nil nil 0) (help-echo #<frame emacs@Doug-PC 
0x20068800> "Enter Lisp debugger when an error is signaled" nil nil 0) 
(help-echo #<frame emacs@Doug-PC 0x20068800> "Enter Lisp debugger when 
C-g is pressed" nil nil 0) (help-echo #<frame emacs@Doug-PC 0x20068800> 
"Enter Lisp debugger when an error is signaled" nil nil 0) (help-echo 
#<frame emacs@Doug-PC 0x20068800> "Whether the cursor blinks (Blink 
Cursor mode)" nil nil 0) (help-echo #<frame emacs@Doug-PC 0x20068800> 
"Visit files of previous session when restarting Emacs" nil nil 0) 
(help-echo #<frame emacs@Doug-PC 0x20068800> "Whether the cursor blinks 
(Blink Cursor mode)" nil nil 0) (help-echo #<frame emacs@Doug-PC 
0x20068800> "Enter Lisp debugger when an error is signaled" nil nil 0) 
(menu-bar) options debug-on-error (help-echo #<frame emacs@Doug-PC 
0x20068800> "Cut (kill) text in region between mark and current 
position" nil nil 0) (help-echo #<frame emacs@Doug-PC 0x20068800> "Learn 
how to use Emacs" nil nil 0) (help-echo #<frame emacs@Doug-PC 
0x20068800> "Learn how to use Emacs (choose a language)" nil nil 0) 
(help-echo #<frame emacs@Doug-PC 0x20068800> "Frequently asked (and 
answered) questions about Emacs" nil nil 0) (help-echo #<frame 
emacs@Doug-PC 0x20068800> "New features of this version" nil nil 0) 
(help-echo #<frame emacs@Doug-PC 0x20068800> "Read about known problems 
with Emacs" nil nil 0) (help-echo #<frame emacs@Doug-PC 0x20068800> 
"Send e-mail to Emacs maintainers" nil nil 0) (help-echo #<frame 
emacs@Doug-PC 0x20068800> "Our doctor will help you feel better" nil nil 
0) (help-echo #<frame emacs@Doug-PC 0x20068800> "Send e-mail to Emacs 
maintainers" nil nil 0) (menu-bar) help-menu send-emacs-bug-report])
   call-interactively(report-emacs-bug nil nil)

It's in a window named *Backtrace* so I hope that is the backtrace you want.

I almost thought I was going crazy, I could not reproduce the problem.  
Then I found the missing trick is to widen the entire emacs window.  
Then I read your email more carefully and checked that 
split_window_threshold was 160 and that it was changed/introduced in 
23.1 (which is about when I first started noticing the problem but 
figured I'd wait for an new version before reporting it - long suffering 
is my middle name).  I did exactly flip my usage of vertical and 
horizontal splitting from the emacs usage of the term.  I should have 
said "One of the windows **splits horizontally**(!!) ".  In any case the 
bad split is into two side-by-side windows. The to-my-taste poor 
splitting happens when (window-total-width) >= 164.

The problem is fixed by setting split-width-threshold to 500. Thank 
you!  I did try setting it to nil as the variable's documentation 
suggests and the customization dialog told me the value of the variable 
needed to be an integer.  Don't know if it accepted nil anyway or 
rejected it or what, but 500 sure works. Thanks again.

I do think split-width-threshold should default to never splitting 
horizontally (I've got the right word this time), but that's just 
decades of never have wide windows automatically split horizontally 
talking.  Maybe it will seem perfectly natural to someone not shocked to 
see it.

On second thought, I wouldn't so much mind emacs splitting a window 
horizontally when I just have one window visible at the time.  That 
might actually be nice.  However, when I already have my screen split in 
two, but vertically, I think it's a bad idea without redeeming qualities 
to split one of the windows horizontally instead of just jumping to the 
"other" already open window.

So, I'm changing my bug report to say that emacs should never 
automatically introduce any new split for M-x M-b (and similar commands) 
when it already has two or more open windows (regardless of how they are 
arranged).  The problem is just a bit deeper than simply changing the 
value of split-width-threshold.

Doug

On 9/8/2012 1:18 AM, martin rudalics wrote:
> > I had only tested it with "emacs -q" (forgot about the Q version).
> > However, retesting with "emacs -Q" gives the same behavior.
>
> Interesting.
>
> > Also, the
> > menu only has "Send Bug Report..." which doesn't work for me "Wrong 
> type
> > argument: string, nil" after I enter a subject title (never having set
> > up emacs to handle mail).
>
> This should not happen.  Can you get us a backtrace by checking the
> "Enter Debugger on Error" entry in the Options menu before trying the
> "Send Bug Report...".  (My apologies if this has been reported before
> and already fixed.)
>
> > Inside the unsent email buffer was this interesting looking text 
> (and it
> > looked like it would go to [email-masked] so I'm cc'ing that:
>
> Tha's what we need ;-)
>
> > In GNU Emacs 24.2.1 (i686-pc-cygwin, GTK+ Version 2.24.11)
> >  of 2012-08-27 on fiona
>
> I suppose the following
>
> > Major mode: Dired by name
>
> is not part of the recipe?  Anyway, back to your first report. Does
>
> >> One of the windows **splits vertically**(!!)
>
> mean that the new window appears on the right of another window or below
> it?  Also please tell us which window was split - the upper one or the
> lower one.  If the new window appears below, then in the window that
> gets split please do (before the split):
>
> M-: (window-total-height) RET
>
> and
>
> C-h v split-height-threshold
>
> If the new window appears on the right, please do
>
> M-: (window-total-width) RET
>
> and
>
> C-h v split-width-threshold
>
> instead.  In either case, tell us what gets printed by these.
>
> Thanks, martin
>