• 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:

    Collections: Clothing, How Did They Make It? Part I: High Fiber

    This week we are starting the first of a four (?) part look at pre-modern textile production. As with our series on farming and iron, we are going to follow the sequence of production from the growing of fibers all the way to the finished object, with a f…

    via A Collection of Unmitigated Pedantry March 5, 2021

    Austerity is Inefficient

    Working on an emergency timetable for regional rail has made it clear how an environment of austerity requires tradeoffs that reduce efficiency. I already talked about how the Swiss electronics before concrete slogan is not about not spending money but ab…

    via Pedestrian Observations February 27, 2021

    The Troubling Ethics of Writing (A Speech from Ancient Sumer)

    (Translated from a transcript of an ancient Sumerian speech by Uruk's most well-respected Scriptological Ethicist) Writing is a profoundly dangerous technology: Access to writing was initially, and still remains, uneven. What's worse, the rich are m…

    via BLOG - Cullen O'Keefe February 15, 2021

    more     (via openring)


  • Posts
  • RSS
  • ◂◂RSS
  • Contact