• Posts
  • RSS
  • ◂◂RSS
  • Contact

  • Learning more about emacs

    October 29th, 2009
    programming, tech  [html]
    When I first started using emacs, I chose it because I figured I might someday want my editor to be able to to something crazy, and emacs had the best chance of being up for the crazyness. Over the past five years or so, this hasn't actually turned out to be the case: almost everything I've wanted that's at all complex has made more sense as a stand alone program. This meant I'd not even learned how to write new functions for emacs. So today I learned how. Each of these entries is separated by a little bit of code that looks like:
      <a name="2009-10-29"></a><h3>Thursday October 29 2009:</h3>
      <div class="pt">
    
        <h3></h3>
    
      </div>
        
    I'd been typing this in by hand, but today I decided to automate this. It turns out emacs supports the unix date syntax, so my dates become something like "%Y-%m-%d" and "%A %B %d %Y:". Very handy. The rest is just inserting characters:
      (defun start-news-entry ()
        (interactive)
        (insert (format-time-string
           "  <a name=\"%Y-%m-%d\"></a><h3>%A %B %d %Y:</h3>"))
        (newline)
        (insert "  <div class=\"pt\">")  (newline)  (newline)
        (insert "    <h3></h3>") (newline) (newline) (newline)
        (insert "  </div>") (newline))
        
    So now I can just do "M-x start-news-entry" and not delay my urgent news-thoughts with mindless formatting. Yay.

    Comment via: facebook

    Recent posts on blogs I like:

    What I've been doing instead of writing

    I’ve been too busy with work to write much recently, but in lieu of that, here’s a batch of links to other stuff I’ve been doing elsewhere. The thing I’m most excited about: Wave raises $200m from Sequoia, Stripe, Founders Fund and Ribbit at a $1.7b valuati…

    via benkuhn.net September 11, 2021

    Some reasons to measure

    A question I get asked with some frequency is: why bother measuring X, why not build something instead? More bluntly, in a recent conversation with a newsletter author, his comment on some future measurement projects I wanted to do (in the same vein as ot…

    via Posts on Dan Luu August 27, 2021

    Songs about terrible relationships

    [Spoilers for several old musicals.] TV Tropes lists dozens of examples of the “I want” song (where the hero of a musical sings about their dream of escaping their small surroundings). After watching a bunch of musicals on maternity leave, I’m wondering h…

    via The whole sky July 17, 2021

    more     (via openring)


  • Posts
  • RSS
  • ◂◂RSS
  • Contact