2016-04-25 Emacs News

Links from reddit.com/r/emacs, /r/orgmode, Hacker News, planet.emacsen.org, Youtube, the changes to the Emacs NEWS file, and emacs-devel.

Past Emacs News round-ups

Weekly review: Week ending April 22, 2016

Lots of medical-related conversations this week. I called the eye clinic to follow up on A-‘s timeline. She’s scheduled for an impression under general anesthesia in June. I also called the cardiologist’s office to ask about her slow wealthweight gain, and they recommended seeing the pediatrician earlier than our scheduled appointment. We saw the pediatrician, and she isn’t worried about A- yet (she’s in the 25th percentile for length and weight). A- was definitely not happy about the physical exam, though, and the vaccine injections didn’t help. She was a bit fussier for two days, and now she seems back to normal. We’ll see the pediatrician again in two weeks for another vaccine and another weighing. Sometimes I wonder if I should also be building up a record for A- at home, but since it doesn’t seem easy to get a copy of medical notes, I guess I’ll have to leave that up to her primary care provider.

The downside of all this phoning around was that I’ve been stuck playing an embarrassing game of phone tag. I’m currently looking around for more options in terms of pediatricians or family doctors in case I can find someone with excellent rapport. I forgot that I had meeting assist turned on and plenty of optional activities on my calendar, so I missed a few calls. I’ve set up call forwarding and I’m experimenting with a free service that provides voicemail (fongo.com), so we’ll see if that helps.

It was a good week for cooking variety. I prepared lots of ingredients last weekend for Cobb salad and an assortment of burger toppings, and we turned leftovers into pizza. I like this new habit we’re building. Cutting up ingredients in advance makes complex meals easier to throw together.

We took advantage of the warm and sunny spring weather to rake the yard and start the garden. The strawberries and sorrel have already started coming back. I planted some peas, bitter melon, and coriander. Maybe in a week or two, when frost becomes much less likely, I’ll buy a few cherry tomato starters. I wonder if I can get lettuce and spinach growing this year, or if there are other things I can grow for salads and herbs.

I joined the babywearing walk in High Park, but bailed halfway through because A- was getting a bit fussy. Good timing, actually, as she had one of those big poops when I got home. It’s starting to become hat weather, too. I tried making her a hat, but the dome was too shallow and the brim wasn’t stiff enough. Fortunately, I have lots of spare fabric, so I can just try again. I’ll probably start by trying a stiffer brim.

Quite a few other social things, too. W-‘s mom brought some soup over, and I visited Jen, Ewan, and E-. Lola and Lolo also virtually dropped in via Facebook video calling, and A- cooed at them for a while. =)

I took some time to systematically think about kaizen: continuous, small improvements. One of the little improvements I’ve been planning was making Emacs survive X freezes a little more gracefully. I got emacs --daemon working on my system and I managed to write a blog post about it. Hooray for being able to tinker! I also tweaked my tracker a little bit more. Now that I save the state on the server, I can use other apps without worrying about losing the start of my nursing timer, which means I can read stuff in Google Play Books or Overdrive while nursing. Yay!

Also, while updating some paperwork, I noticed that I’d used a 25% gross up rate instead of 18% for the past two years. It turns out that there’s a straightforward web interface for updating both T5s and personal tax returns. Yay Canada Revenue Agency!

I’ll probably pull back a little on social things next week as I sort out communications and return various calls, although I’d like to make it out to the Hacklab members’ meeting on Wednesday.

Slowly making things better!

2016-04-24a Week ending 2016-04-22 -- index card #journal #weekly

output

Blog posts

Sketches

Focus areas and time review

  • Business (1.3h – 0%)
    • ☐ Pay myself a dividend
    • Earn (0.0h – 0% of Business)
    • Build (0.6h – 43% of Business)
      • Drawing (0.0h)
      • Paperwork (0.5h)
    • Connect (0.7h – 56% of Business)
  • Relationships (2.0h – 1%)
    • ☑ Take pictures of baby clothes from Jen
    • ☑ Have W-‘s mom over
    • ☑ Maybe check out babywearing social
    • A-
      • ☑ Ask breastfeeding clinic for other places that take patients
      • ☑ Call cardio nurse and ask about slow weight gain and possibly fortifying
      • ☑ Follow up with Eye Clinic
      • ☑ 2-month appointment with pediatrician
      • ☑ Call Four Villages
      • ☑ Call midwives and ask for other referrals
      • ☐ Call TD and ask about RESP
  • Discretionary – Productive (15.3h – 9%)
    • Coding
      • ☑ Plot baby weight
      • ☑ Add bath note
      • ☑ Add duration column
      • ☑ Label axis nicely
      • ☑ Set up search engine
      • ☑ Add ending now / after start buttons
      • ☑ Move nursing timer to database
    • Emacs (0.6h – 0% of all)
      • ☑ [#A] Do another Emacs News review
      • ☑ Keep Emacs alive through X crashes by running it in the background with –daemon
      • ☐ [#A] Do another Emacs News review
    • Gardening
      • ☑ Clean up yard
      • ☑ Plant peas
    • Kaizen
      • ☑ Set up home screen shortcuts to things I’m reading, or organize them in apps
      • ☑ Line up better reading on my phone
      • ☑ Normalize recorded audio
      • ☑ Think about phone
      • ☑ Disable touchpad in init script
    • Sewing (2.3h)
      • ☑ Look for a baby sun hat pattern
      • ☑ Go to Fabricland
    • Writing (2.3h)
  • Discretionary – Play (0.8h – 0%)
  • Personal routines (31.1h – 18%)
  • Unpaid work (58.5h – 34%)
    • Childcare (50.7h – 30% of total)
  • Sleep (59.7h – 35% – average of 8.5 per day)

Keep Emacs alive through X crashes by running it in the background with –daemon

I periodically have to kill and restart my X server when it freezes. I probably have the wrong configuration, since it starts off in low-graphics mode until I manually restart the graphical login manager (I’m using sddm). Anyway, since it’s been hard to debug and fix that issue, I figured I’d address the part that really bugs me when I restart X: dealing with ungraceful Emacs exits. M-x recover-session does a decent job of restoring my modified files and I usually remember to call it from the scratch screen, but sometimes I forget, and then I end up losing changes.

I started taking advantage of the fact that I used (server-start) to enable other Emacs clients to connect to the same process. Whenever I needed to restart X, I’d first switch to a console, use emacsclient -c to connect to Emacs, and use M-x save-buffers-kill-emacs to close my Emacs neatly. Still, starting my Emacs from X meant that I had to restart Emacs each time I restarted X.

It turns out that you can run Emacs as a background process with emacs --daemon and then connect to it with emacsclient -c. When I did that, though, the emacsclient frame didn’t have my color theme applied. This after-make-frame-functions addition fixes that:

(defun my/setup-color-theme ()
  (interactive)
  (color-theme-solarized-dark)
  (set-face-foreground 'secondary-selection "darkblue")
  (set-face-background 'secondary-selection "lightblue")
  (set-face-background 'font-lock-doc-face "black")
  (set-face-foreground 'font-lock-doc-face "wheat")
  (set-face-background 'font-lock-string-face "black")
  (set-face-foreground 'org-todo "green")
  (set-face-background 'org-todo "black"))
(add-hook 'after-make-frame-functions
          (lambda (frame)
            (select-frame frame)
            (my/setup-color-theme)))

Once I got emacs --daemon and emacsclient -c working to my satisfaction, I decided to go one step further and get it to run automatically when I start my computer. I tried the init script at https://www.emacswiki.org/emacs/EmacsAsDaemon . My Linux install uses systemd, so enabling the init script resulted in a message about a missing service file. I removed the init script and created this ~/.config/systemd/user/emacs.service instead:

[Unit]
Description=Emacs: the extensible, self-documenting text editor

[Service]
Type=forking
ExecStart=/usr/local/bin/emacs --daemon
ExecStop=/usr/local/bin/emacsclient --eval "(progn (setq kill-emacs-hook 'nil) (kill-emacs))"
Restart=always
TimeoutStartSec=0

[Install]
WantedBy=default.target

and then I ran these commands as my regular user account:

systemctl --user enable emacs
systemctl --user start emacs

Then I changed the emacs in my ~/.xsession to emacsclient -c, so that a new X session would connect to the existing session instead of starting a new one. That way, Emacs automatically started as my user whenever I restarted the computer, and I connected to that process when I started X.

Still, restarting X caused the Emacs daemon to crash. This is a GTK-related bug which emacs --daemon warns you about. I recompiled Emacs using ./configure --with-x-toolkit=lucid; make; make install. It seems to work fine now; I can ungracefully restart X, and my Emacs stays the same. Bonus: because Emacs gets initialized when I start my computer and all I need to do is connect to that process, when I log in, it feels like Emacs starts up really quickly.

Final touches: I noticed that TRAMP couldn’t find my SSH keyring, so it got stuck waiting for my passphrase when I tried running remote scripts in Org Babel like so:

#+begin_src sh :dir [email protected]:~
perl library-new.pl Business
#+end_src

Because my SSH socket looks like /tmp/ssh-BLAHBLAHBLAH/agent.PROCESSID, the SSH_AUTH_SOCK setting (Environment=SSH_AUTH_SOCK=%t/keyring/ssh) described on EmacsWiki didn’t work for me. This snippet from https://github.com/nhoffman/.emacs.d/blob/master/init.org worked, though.

(defun my/ssh-refresh ()
  "Reset the environment variable SSH_AUTH_SOCK"
  (interactive)
  (let (ssh-auth-sock-old (getenv "SSH_AUTH_SOCK"))
    (setenv "SSH_AUTH_SOCK"
            (car (split-string
                  (shell-command-to-string
                   "ls -t $(find /tmp/ssh-* -user $USER -name 'agent.*' 2> /dev/null)"))))
    (message
     (format "SSH_AUTH_SOCK %s --> %s"
             ssh-auth-sock-old (getenv "SSH_AUTH_SOCK")))))
(my/ssh-refresh)

Also, emacs --daemon didn’t pick up the default browser I’d configured in KDE. Opening URL links from Org Mode started a separate Chromium process instead of using Google Chrome. I fixed that by switching from browse-url-default-browser to browse-url-generic, like so:

(setq browse-url-generic-program "google-chrome")
(setq browse-url-browser-function 'browse-url-generic)

Let’s see how this works!

2016-04-18 Emacs News

Links from reddit.com/r/emacs, /r/orgmode, Hacker News, planet.emacsen.org, Youtube, the changes to the Emacs NEWS file, and emacs-devel.

Past Emacs News round-ups

Weekly review: Week ending April 15, 2016

Graduated from midwife care this week. A-‘s slow weight gain is something to keep an eye on, but we’re not going to worry until the pediatrician tells us to worry. Might be related to her ventricular septal defect, since that’s a common symptom. She’s alert and looks happy, though, so that’s good.

I made it out to Hacklab for Eric’s practice talk on his Epic Quest of Awesome. It was great to hear the update to his talk, and I picked up a couple of new tips (including an impressive chart from the Actionable Gamification website). We gave him some feedback on his talk, too.

It finally feels like spring, so I’m working on making salads part of our household routine. Lots of walking, too: 37k steps over 5.5 hours total, including a nice walk to the midwives.

Filed our personal taxes, yay! I did most of the data entry last month, and I doublechecked everything this week. I compared it to 2014 for extra safety, too. Nice to still be able to crunch the numbers!

Kaizen tweaks this week:

  • Adding buttons to my tracker makes updating baby-related data much easier (nursing, mood, sleep).
  • If I brush my teeth and shower after dinner instead of before bed, then that gives us more flexibility for A-‘s bedtime routine.
  • Wearing cargo pants or scrubs means that I can keep a notepad and a pen handy, which lets me jot down ideas while nursing or settling A-.
  • Using peep-dired and writing an Emacs Lisp function to rename files makes organizing photos easier.
  • Red peppers do okay in the freezer, so I put together a bunch of fajita starters to make future dinners smoother.
  • Grapes and celery can be pre-sliced for Waldorf salad.

2016-04-17a Week ending 2016-04-15 -- index card #journal #weekly output

Blog posts

Sketches

Focus areas and time review

  • Business (1.1h – 0%)
    • Earn (0.0h – 0% of Business)
    • Build (0.5h – 50% of Business)
      • Drawing (0.0h)
      • Paperwork (0.5h)
    • Connect (0.5h – 49% of Business)
  • Relationships (4.9h – 2%)
    • ☑ Add more functions to baby tracker
    • ☑ Hang out with Jen
    • ☑ Check out Eric Boyd’s talk at Hacklab
    • ☑ Midwife final checkup
    • ☑ Maybe check out babywearing social
  • Discretionary – Productive (9.5h – 5%)
    • Emacs (1.1h – 0% of all)
      • ☑ Fix evil plan SVGs
      • ☑ Write some Emacs Lisp to help with organizing photos
      • ☑ Keep Emacs alive through X crashes by running it in the background with –daemon
    • ☑ Update credit card for Paypal
    • ☑ Clean up yard
    • ☑ Plant peas
    • Sewing (0.0h)
      • ☑ Look for a baby sun hat pattern
    • Writing (0.3h)
  • Discretionary – Play (1.7h – 1%)
  • Personal routines (21.1h – 12%)
  • Unpaid work (76.2h – 45%)
    • Childcare (66.8h – 39% of total)
  • Sleep (53.6h – 31% – average of 7.7 per day)

2016-04-11 Emacs News

Links from reddit.com/r/emacs, /r/orgmode, Hacker News, planet.emacsen.org, Youtube, the changes to the Emacs NEWS file, and emacs-devel.

Past Emacs News round-ups