1

I need to check numbers in a buffer each on a line against an external paper sheet

To make this easier I would like to make the window very narrow to see only one (or max. two) lines. However shrink-window stops at three lines.

Any way to overcome this limitation of shrink-window?

Drew
  • 75,699
  • 9
  • 109
  • 225
halloleo
  • 1,215
  • 9
  • 23

3 Answers3

2

C-hv window-min-height

The minimum total height, in lines, of any window. The value has to accommodate one text line, a mode and header line, a horizontal scroll bar and a bottom divider, if present. A value less than ‘window-safe-min-height’ is ignored. The value of this variable is honored when windows are resized or split.

I found this with M-x apropos-variable RET height RET

phils
  • 48,657
  • 3
  • 76
  • 115
  • With this variable I was able to shrink the window to **two** lines, but not to **one** line. – halloleo Jul 05 '20 at 13:39
  • This is true, even if I set `window-min-height` to 1 (and `window-safe-min-height` is 1 as well). – halloleo Jul 05 '20 at 13:51
  • The minimum is one editing line **plus** whatever additional lines are needed to display those other items. If you have none of the other items (including disabling the mode line!) then you can have a window which is *just* that one single editing line. (I just tested this in Emacs 26.3 in a terminal.) – phils Jul 05 '20 at 15:06
  • You are correct: **without** mode line I do get the window down to 1 _content_ line. However, **with** mode line this doesn't seem to be possible: I always end up with two _content_ lines. Very strange! – halloleo Jul 10 '20 at 06:29
1

Would it suit your purpose if you had a command which searched for the next line in the buffer which has a number in it and then showed you just that line?

(defun go-to-next-line-with-number ()
  (interactive)
  (widen)
  (unless (bobp)
    (end-of-line))
  (when (search-forward-regexp "[0-9]" nil 0)
    (save-excursion
      (narrow-to-region (progn (beginning-of-line) (point))
                        (progn (end-of-line) (point))))))

Assign this command to a key, then go to the beginning of the buffer. Calling this command will go to the first line with a number and show you only this line. When you have done whatever editing you need to do to this line, call it again to go to the next line with a number and so on until you reach the end of the buffer.

If this is close but not precisely what you need, tell me more exactly what would help.

Aidan Schofield
  • 514
  • 3
  • 5
1

The following shows one line of content and the modeline for me:

(setq window-safe-min-height 0)
(setq window-min-height 0)

I would love to have a way to make the content completely collapse for an acme editor style. Sadly I haven't found the way.

  • How cool is this! I didn't know about `window-safe-min-height`. Just read the doco though. It says: "_The absolute minimum number of lines of any window. Anything less might crash Emacs._", so with `(setq window-safe-min-height 0)` I might live on the edge... – halloleo Sep 14 '21 at 02:41
  • Yeah, `(setq window-safe-min-height -1)` kind of does what I want, but sometimes the modelines merges into eachother :) – Rune Kaagaard Sep 14 '21 at 06:29
  • You kinda *did* know about `window-safe-min-height` because it was mentioned in the earlier answer, and you commented on it ;) I wonder if the behaviour around minimum values has changed since then. – phils Sep 14 '21 at 23:32