56 lines
5.5 KiB
Plaintext
56 lines
5.5 KiB
Plaintext
<h2>Reducing Friction on Adding Placeholders for My Future Self</h2>
|
||
|
||
<div class="margin">
|
||
|
||
<p><small>This post further builds on <span><cite><a class="u-url" href="https://takeonrules.com/2021/09/17/slowing-down-to-synthesize/">Slowing Down to Synthesize</a></cite></span> and also incorporates ideas from <cite><a class="u-url p-name" href="https://alexschroeder.ch/wiki/2021-09-17_Writing_to_learn" rel="cite">Alex Schroeder: 2021-09-17 Writing to learn</a></cite>.</small></p>
|
||
</div>
|
||
|
||
<p>When I started at Forem, there were lots of new web pages that I didn’t want to forget. I wanted to annotate and tag those web pages. I chose not to use my browser’s bookmarks and instead chose to create an <span>
|
||
<span>Org-mode</span> <small><a class="ref" href="https://takeonrules.com/site-map/glossary/#abbr-dfn-ORG-MODE" rel="tag opener" title="Other site-wide references of “Org-mode”">🔍</a></small></span> document. That document resides in my private repository for <a href="https://forem.com">Forem</a> <span>
|
||
<span>Org-roam</span> <small><a class="ref" href="https://takeonrules.com/site-map/glossary/#abbr-dfn-ORG-ROAM" rel="tag opener" title="Other site-wide references of “Org-roam”">🔍</a></small></span> directory.</p>
|
||
<h2 id="crash-course-org-mode">Crash Course Org Mode</h2>
|
||
<p>Here is one of the several entries in my Dashboard:</p>
|
||
<pre><code>
|
||
** [[https://forem.team/][Forem Team 🌱]] :communication:documentation:
|
||
|
||
This is where we have long-running conversations
|
||
</code></pre>
|
||
<p>The leading <code>**</code> indicates a heading level two in org-mode; analog to Markdown’s <code>##</code>.</p>
|
||
<p>The <code>[[url][text]]</code> is a link and it’s text.</p>
|
||
<p>The <code>:communication:documentation:</code> are two tags that I’ve assigned to that heading. And last the <code>This is where&hellip;</code> is a paragraph description.</p>
|
||
<p>My goal was to write down and remember these different sources of possible information or tools to use.</p>
|
||
<h2 id="scripting-the-dashboard">Scripting the Dashboard</h2>
|
||
<p>With a place to capture the data, I then <a href="https://github.com/jeremyf/dotzshrc/blob/5f23a950ee92c3ce0aa0e7dbd5746df2aa49412a/bin/dashboard">wrote a Ruby script</a> to open each of those web pages in my default browser. I wrapped that Ruby script with an <span>
|
||
<span>Emacs</span> <small><a class="ref" href="https://takeonrules.com/site-map/glossary/#abbr-dfn-EMACS" rel="tag opener" title="Other site-wide references of “Emacs”">🔍</a></small></span> function. Later, I replaced that Ruby script with a <a href="https://github.com/BurntSushi/ripgrep">ripgrep</a> invocation.</p>
|
||
<p>I mapped that Emacs function <kbd>Cmd</kbd>+<kbd>Opt</kbd>+<kbd>Ctrl</kbd>+<kbd>d</kbd> to open my dashbard files in the browser. I also added a bit of logic that said if you first type Emacs’s universal modifier (e.g., <code>C-u</code>, that is <kbd>Ctrl</kbd>+<kbd>u</kbd>) then invoke the function it will instead open the Dashboard’s source file.</p>
|
||
<p>Below is that code:</p>
|
||
<pre><code>
|
||
;; In OS X this is CMD+OPT+CTRL+d
|
||
(global-set-key (kbd "C-M-s-d") 'jnf/open-dashboard)
|
||
(cl-defun jnf/open-dashboard (&key (filename jnf/forem-dashboard-filename))
|
||
"For the given FILENAME open the links in the default browser.
|
||
|
||
With the universal prefix (e.g. C-u) open the file instead."
|
||
(interactive)
|
||
(if (equal current-prefix-arg nil)
|
||
(call-process-shell-command
|
||
;; Double escaped because I'm passing this
|
||
;; string to the command line.
|
||
(concat "rg \"\\[\\[(.*)\\]\\[\" "
|
||
filename
|
||
" --only-matching"
|
||
" | rg \"[^\\[|\\]]+\" --only-matching"
|
||
" | xargs open"))
|
||
(find-file filename)))
|
||
</code></pre>
|
||
<p>Let’s dive into the above <a href="https://github.com/BurntSushi/ripgrep">ripgrep</a> command (for convenience I’m removing the double escaping):</p>
|
||
<p>First we have <code>rg "\[\[(.*)\]\[" filename --only-matching</code>. That command finds only the <code>[[url]</code> portion in the given filename.</p>
|
||
<p>Then we pipe that to <code>rg "[^\[|\]]+" --only-matching</code>. This further narrows that search to only select the <code>url</code>.</p>
|
||
<p>And last, I pipe this to <code>xargs open</code>. In essence, that then runs the <code>open</code> command from <span><abbr title="Macintosh Operating System X">OS X</abbr></span> on each of the matching <span><abbr title="Uniform Resource Locators">URLs</abbr></span>.<span class="sidenote-number"><small class="side">
|
||
<code>open</code> on a <abbr title="Uniform Resource Locator">URL</abbr> string will open that <abbr title="Uniform Resource Locator">URL</abbr> in the default browser.
|
||
</small></span>
|
||
</p>
|
||
<p>My plans for this function are to prompt for a tag, and limit opening only web pages with matching tags. So far, I haven’t needed it.</p>
|
||
<h2 id="conclusion">Conclusion</h2>
|
||
<p>In the early days of a new job, there’s a lot of information intake. I created a Dashboard document to provide a consistent place to capture that information; I knew I didn’t want to lose track of it. The Dashboard document reduces the friction of deciding where to put things.</p>
|
||
<p>It was rather quick to write up the functions (Ruby, Ripgrep, and Lisp). Most important to me, is that writing these functions helps re-iterate that my text editor configuration is a continual work in progress. My text editor is an extension of my current understanding, and I should use it and extend it to help me learn and capture ideas.</p> |