# Focus in when writing

**URL:** <https://org-roam.discourse.group/t/focus-in-when-writing/3433>\
**Category:** Tips\
**Created:** [April 16, 2024, 2:53am UTC](https://org-roam.discourse.group/t/focus-in-when-writing/3433 "2024-04-16T02:53:00Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![akashp](https://yyz2.discourse-cdn.com/free1/user_avatar/org-roam.discourse.group/akashp/32/1383_2.png) [@akashp](https://org-roam.discourse.group/u/akashp)\
**Post date:** [April 16, 2024, 2:53am UTC](https://org-roam.discourse.group/t/focus-in-when-writing/3433/1 "2024-04-16T02:53:00Z")

</div>

Sometimes when i am writing something – the spread from east to west is annoying on a widescreen – the modeline also gives redundant information that are annoying – so I created this small mode to focus in on the job. Only creates the padding for org files since when writing elisp code the breadth is actually useful.

```auto
(defun focus-mode--backend (&optional left right)
  (interactive)
  (when (eq major-mode 'org-mode)
  (set-window-margins (selected-window)
		      (if left
			  left
			20)
		      (if right
			  right
			20))))

(define-minor-mode focus-mode 
"Toggle focus mode to adjust window margins."
  :global t
  :init-value nil
  :lighter " f🎯"
  (if focus-mode
      (progn
	(add-hook 'window-state-change-hook #'focus-mode--backend)
	(setq-default mode-line-format '(
					 " "
					 "%n"
					 " "
					 "%b"
					 " "
					 "[%*]"
					 ""
					 " f🎯"
					 " "
					 mode-name
					 )))
    (progn
      (remove-hook 'window-state-change-hook #'focus-mode--backend)
      (focus-mode--backend 0 0)
      (setq-default mode-line-format '("%e" mode-line-front-space
 (:propertize
  ("" mode-line-mule-info mode-line-client mode-line-modified mode-line-remote)
  display
  (min-width
   (1.0)))
 mode-line-frame-identification mode-line-buffer-identification " " mode-line-position
 (vc-mode vc-mode)
 " " mode-line-modes mode-line-misc-info mode-line-end-spaces))
      )))

```

---

<div class="post-metadata">

**Author:** ![agibragimov](https://yyz2.discourse-cdn.com/free1/user_avatar/org-roam.discourse.group/agibragimov/32/589_2.png) [@agibragimov](https://org-roam.discourse.group/u/agibragimov)\
**Post date:** [April 18, 2024, 9:53pm UTC](https://org-roam.discourse.group/t/focus-in-when-writing/3433/2 "2024-04-18T21:53:23Z")

</div>

Beautiful. I like this kind of snippets of the kind: “My editor does this thing in an annoying fashion, that’s probably in the whole world bothers only me. And here’s how I fixed it…”

In the non-Emacs world, it would sound like “My editor does this thing in such an annoying fashion that everyone complains about it until they get used to it… and there’s no good workaround here…”
