2

I am trying to get the current weather inserted into my org roam dailies. Here is the default capture template I'm starting with, from https://systemcrafters.net/build-a-second-brain-in-emacs/keep-a-journal/ It seems to work quite well:

 (org-roam-dailies-capture-templates
    '(("d" "default" entry "* %<%I:%M %p>: %?"
       :if-new (file+head "%<%Y-%m-%d>.org" "#+title: %<%Y-%m-%d>\n"))))

I have installed the key bindings and key maps recommended in that site, too. Everything works well.

Next I add this function to my init.el:

  (defun org-roam-weather (current-node-ignored)
      "Return local weather as a string for org-roam capture."
    (shell-command-to-string "curl 'https://wttr.in?0T' 2>/dev/null"))

Then I replace the template lines above with

(org-roam-dailies-capture-templates
 '(("d" "default" entry "* %<%I:%M %p>\n${org-roam-weather}\n%?"
    :if-new (file+head "%<%Y-%m-%d>.org" "#+title: %<%Y-%m-%d>\n"))))

After doing so, and restarting emacs, I find that input in the window opened by org-roam-dailies-capture-today is really slow. The weather is inserted but input slows to a crawl until I close the capture window. Any idea how I can fix it?

Bonus question: should I maybe wrap the ascii art in a begin/end environment? I imagine I will seldom export dailies, but if I ever do so, it maybe makes sense to mark the region as monospace ascii art.

UPDATE: For some reason, the editing mode just does not like the wind direction arrow in the output from wttr.in . If I delete that one character, everything seems to speed up again. I do believe I have all my UTF-8, etc., settings correct (the arrow displays correctly, for example, except it has a box around it in Emacs that it doesn't have in the shell) but I will look again. wttr.in probably has a setting to simplify the character set, too.

As for wrapping the ascii art output, it seems #+begin_example/#+end_example is the right thing to do but I feel like it's overkill unless I decide to export a daily some day.

1 Answer 1

1

I have found an answer to my question. Place the line

(setq inhibit-compacting-font-caches t)

in init.el. See the discussion at unicode.txt slowness.

In addition, as mentioned in my question, I may decide to wrap the ASCII art in #+begin_example and #+end_example if I decide to export a daily, but until then I feel it is less cluttered without the environment.

And in case you are interested, I improved the dailies capture template including current date, time, topic, location, and weather:

(org-roam-dailies-capture-templates
 '(("d" "default" entry "* %<%Y-%m-%d> %<%I:%M %p>: %^{Topic}\n${org-roam-weather}\n%?"
    :if-new (file+head "%<%Y-%m-%d>.org" "#+title: %<%Y-%m-%d>\n"))))

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.