;; deactivate some bling (dolist (mode '(tool-bar-mode blink-cursor-mode menu-bar-mode scroll-bar-mode)) (when (fboundp mode) (funcall mode -1)))
You can find code like this and similar stuff in my Emacs config, which is a lot better organized than it used to be.
When I scrolled down, however, I noticed something else: Bastien hides the mode-line completely. I’m using @algernon’s Brutalist Dark theme, which has visible mode-lines but the inactive mode-line is not readable (foreground and background colour are the same). It’s less distracting. Still, I started wondering.
With minor tweaks, I added the following:
(defvar-local hide-mode-line nil) (define-minor-mode hidden-mode-line-mode "Minor mode to hide the mode-line in the current buffer." :init-value nil :global nil :group 'editing-basics (if hidden-mode-line-mode (setq hide-mode-line mode-line-format mode-line-format nil) (setq mode-line-format hide-mode-line hide-mode-line nil)) (force-mode-line-update) ;; Apparently force-mode-line-update is not always enough to ;; redisplay the mode-line (redraw-display) (when (and (called-interactively-p 'interactive) hidden-mode-line-mode) (run-with-idle-timer 0 nil 'message (concat "Hidden Mode Line Mode enabled. " "Use M-x hidden-mode-line-mode to make the mode-line appear.")))) ;; Activate hidden-mode-line-mode (hidden-mode-line-mode 1) ;; Hide the mode-line in all new buffers (add-hook 'after-change-major-mode-hook 'hidden-mode-line-mode) ;; Use F12 to toggle modelines (global-set-key (kbd "<f12>") 'hidden-mode-line-mode)
I’m liking it! And when I occasionally want to see something – mostly the column I’m at while I’m writing the first line of a git commit message – I can quickly use F12 to see it.
I remember in the old days I needed the mode-line to track IRC activity. These days, however, with me being connected to a bunch of Discord channels that I never read, and a bunch of Mastodon accounts, all via Bitlbee, the actual mode-line is far less useful than it used to be.
I continued scrolling down on Bastien’s page and saw the centred Emacs window (using the fringes). This would actually work very well for me, since I always use Emacs in full-screen mode. I recommend it! But if you’re not a big user of C-x 3 to split the window into two side-by-side windows, then all your text is going to on the left side of your monitor. Not good! Not good.
So here we go:
;; center the window by adding a very wide fringe (define-minor-mode center-window-mode "Minor mode to center the window using wide fringes." :init-value nil :global t :group 'editing-basics (if (not center-window-mode) (set-fringe-style nil);; default (set-fringe-mode (/ (- (frame-pixel-width) (* (+ fill-column 4) (frame-char-width))) 2)))) (center-window-mode 1) ;; Use F9 to toggle centering (global-set-key (kbd "<f9>") 'center-window-mode)
This uses the fill-column to calculate the width of the fringes. If you’re suddenly in a buffer with a different fill-column, just use F9 F9 to toggle it off and on again, and the new fill-column value is taken into account.
I’m sure this could be smarter, but it basically works for me. When I’m programming, I often use up to 120 characters per line; the fill-column only affects comments. I therefore leave it where it is and just toggle the centring of the window. The font-size I prefer to use and the width of my laptop screen give me about 125 characters per line max. Those two or three characters don’t make a big difference in the left margin, so I don’t really need code to do <f9> C-u 120 C-x f <f9> – I tried it and it wasn’t worth it.
So here we are.
Actually, let me get back to the window splitting issue again. I started talking with @ckeen and I think my main problem with Emacs is that it’s hard to keep the window configuration stable. As soon as you start using help, man pages, IRC, and the like, you’re going to mess up your window config. I use Winner Mode to get back to stuff I’ve set up but it’s mind numbing and so I most often just use C-x 0, C-x 1, and C-x 2. C-x 3 is reserved for the rare occasions where I need to compare something side by side and it’s not an ediff situation.
Back when I was interested in this (2012), I tried to write code to force all activities to stay inside one window and failed. What I wanted was “what happens in a window, stays in a window” – and I guess I’d still be interested in working code. It’s just that I gave up on it.