The Complete Computing Environment

Focused Text Editing

(provide 'cce/focused-mode)

Focus begets Flow State, the instinctive state of understanding. Flow is a cousin of the meditative Observer State, and striving for it is a similar practice. We strip distractions, and provide only the tools needed to focus on the task at hand. I aim to achieve flow, primarily, in long-form text composition and in working closely with a code base. The two tasks are interrelated. I often find flow in certain types of games like Traditional Roguelikes and 4X games, but that is out of scope for a Concept Operating System.

Working closely with a code base is about being able to quickly follow loose-threads by wandering through a code base and building a mental model of how modules interact and interplay. Most codebases are not developed through Literate Programming, of course, so modeling this interplay is often left to code comments, and tools like ctags and the language server project, which I explore on other pages.

Creating Text

The creation of text is a process that I aim to perfect in building this Knowledge Management tool.

It happens in stages.

The first stage is a simple train of thought, a flow of consciousness. For that, I simply need shit to get out of the way and let me write. When I am doing late-night ideation, I am simply trying to let thoughts flow together, and capture the ones which appear meaningful or worth refining. Org Journal is a fine tool for this, frankly, and I am hoping to integrate that in to my system now that I am working with mobile linux as part of my physical computing inventory.

After I sort of just stream a bunch of thought in to paper or pixel, I edit it down in to a set of anchor paragraphs, the core arguments or the cores points I am trying to make, and then I build support for those things. I validate my hypothesis. Sometimes the hypothesis shifts dramatically as I work, of course, as I discover new facts and integrate them in to my thinking. This process can happen in fits and starts over weeks and months, I will come back to the same set of documents every few days for a month or more before it's "done". This gives me a first draft.

At this point, the document is either done, or it enters a stage of public vetting. A lot of my thoughts are simply "done", I don't even know if people read the blog posts that I publish, and frankly it's not for you all, it's for me. The act of publishing a creation on the internet today is an invitation for editors to speak. I don't always want or care to hear the voices of editors, many voices I simply discount – I share my content "publicly" but only because that same modern internet has made publishing content to a small group nearly impossible. I hope my friends and I can build a better world for that, indeed that's what the Arcology project is building towards.

Reading and Editing Text

Focus Mode is an Emacs minor mode which dims text that isn't in the paragraph my point is in. In reading and writing code, focus-mode provides an easy way to walk through text a paragraph at a time. Being able to tackle a reading a paragraph at a time is a good way to keep my eye on a paragraph if I am reading while I am on the bus, or what have you.

(use-package focus
  :after cce/hydra-dipswitch ;; for the hack
  (define-key              focus-mode-map (kbd "j") #'focus-next-thing)
  (define-key              focus-mode-map (kbd "k") #'focus-prev-thing)
  (evil-define-key 'normal focus-mode-map (kbd "j") #'focus-next-thing)
  (evil-define-key 'normal focus-mode-map (kbd "k") #'focus-prev-thing))

This function is from Tasshin Fogleman's .emacs.d and is an easy keybinding to switch between narrow and wide views of a buffer, iteratively between region, source block, subtree, and function.

(defun narrow-or-widen-dwim (p)
  "If the buffer is narrowed, it widens. Otherwise, it narrows
intelligently.  Intelligently means: region, org-src-block,
org-subtree, or defun, whichever applies first.  Narrowing to
org-src-block actually calls `org-edit-src-code'.

With prefix P, don't widen, just narrow even if buffer is already
  (interactive "P")
  (declare (interactive-only))
  (cond ((and (buffer-narrowed-p) (not p)) (widen))
        ((and (boundp 'org-src-mode) org-src-mode (not p))
         (narrow-to-region (region-beginning) (region-end)))
        ((derived-mode-p 'org-mode)
         (cond ((ignore-errors (org-edit-src-code)))
               (t (org-narrow-to-subtree))))
        ((derived-mode-p 'prog-mode) (narrow-to-defun))
        (t (error "Please select a region to narrow to"))))

(with-eval-after-load 'evil-leader
  (evil-leader/set-key (kbd "n") #'narrow-or-widen-dwim))

Fringe Mode is a way to control how wide the "fringe" of my windows (see Modern Interface Terms) are. When I am trying to read a document, increasing the size of the fringe is a simple way to constrain the width of the text and keep it easy to keep the entire text in my "visual memory". For text which is let to be very wide, it's often difficult for me to keep track of lines when I am moving to the next line.

(when (boundp 'fringe-styles)
  (add-to-list 'fringe-styles '("focus 150" . 150))
  (add-to-list 'fringe-styles '("focus 500" . 500))
  (add-to-list 'fringe-styles '("focus 300" . 300)))

I wrap these commands in a simple command: flow. I type <SPC><SPC>flow or M-x flow and I get dropped in to a flow session, which includes a branch to eventually go in to Code Surfing Mode. When I am done, I type <SPC><SPC>end flow<RET> and it returns me to my main state.

(defun end-flow ()
  (focus-mode -1)
  (fringe-mode nil))

(defun cce/flow-text ()
  (fringe-mode (alist-get "focus 300" fringe-styles nil nil #'equal))

(defun flow ()
  "Start a flow session. Make the current buffer easy to surf."
  (cond ((derived-mode-p 'text-mode)
         (call-interactively #'cce/flow-text))
        ((derived-mode-p 'prog-mode)
         (call-interactively #'cce/flow-prog)))
  (message "Take a deep breath and let's begin."))

Flowing through Code

Focusing on a bit of code or text comes in two varieties for me; one is the highlighting of a symbol, either manually or with auto-highlight-symbol. The other is the opposite, dimming everything but exactly what I'm trying to grok right now.

This little fellow, auto-highlight-symbol, tags all occurrences of the symbol under the cursor.