A Curious Programmer: Jared


Storing Session History

A little while ago we were talking about writing a little emacs-based application to enable the users to help themselves. The beginning of this tool needs a light-weight dired using emacs buttons to use for navigating around the filesystem. Today we will look at adding functionality to remember which files and directories have been accessed previously.

First of all we need some variables to store the directories and files in.

(defvar file-editor-current-dir nil)

(defvar file-editor-save-dirs nil)
(defvar file-editor-save-dirs '(a b c))
(defvar file-editor-save-files nil)

Then we provide a customizable variable where the history will be saved between emacs sessions.

(defcustom file-editor-history-file "~/.file-editor-history"
  "File in which the file-editor history is saved between invocations.
Variables stored are: `file-editor-save-dirs', `file-editor-save-files'."
  :type 'string
  :group 'file-editor)

We will frequently be adding the same file and directory into the lists and we don’t want to get dupes. I could use a data structure that helps avoid dupes or I could just sort the lists and remove adjacent dupes. Guess which option I chose.

(defun remove-dupes (list)
  (let (tmp-list head)
    (while list
      (setq head (pop list))
      (unless (equal head (car list))
        (push head tmp-list)))
    (reverse tmp-list)))

(defun file-editor-sort-history ()
  (setq file-editor-save-dirs
        (remove-dupes (sort file-editor-save-dirs #'string<)))
  (setq file-editor-save-files
        (remove-dupes (sort file-editor-save-files #'string<))))

ido has code that stores history between sessions. I’ve stolen most of it to save the file editor history. (ido-pp ...) pretty prints the variable contents into the buffer, e.g. something like this.

;; ----- file-editor-save-dirs -----

( "dir1" "dir2" "dir3" )
(require 'ido)

(defun file-editor-save-history ()
  "Save file-editor history between sessions."
  (let ((buf (get-buffer-create " *file-editor data*"))
        (version-control 'never))
    (unwind-protect
        (with-current-buffer buf
          (erase-buffer)
          (file-editor-sort-history)
          (ido-pp 'file-editor-save-dirs)
          (ido-pp 'file-editor-save-files)
          (write-file file-editor-history-file nil))
      (kill-buffer buf))))

When it comes time to load the history back, (read (current-buffer)) loads it back into the variables. You can see the use of unwind-protect and condtion-case in the code below as I talked about in my emacs lisp error handling post.

(defun file-editor-load-history ()
  (let ((file (expand-file-name file-editor-history-file)) buf)
    (when (file-readable-p file)
      (let ((buf (get-buffer-create " *file-editor data*")))
        (unwind-protect
            (with-current-buffer buf
              (erase-buffer)
              (insert-file-contents file)
              (condition-case nil
                  (setq file-editor-save-dirs (read (current-buffer))
                        file-editor-save-files (read (current-buffer)))
                (error nil)))
          (kill-buffer buf))))))

The obvious time to save the history is when we exit emacs.

(defun file-editor-kill-emacs-hook ()
  (file-editor-save-history))

(add-hook 'kill-emacs-hook 'file-editor-kill-emacs-hook)

Modifications To The Original Code

The way we choose which files and directories will be remembered is each time a file is opened, the parent directory and the file including full path are added to the appropriate variable.

(defun file-editor-open-file-editor-file (button)
  (let ((parent (button-get button 'parent))
        (file (button-get button 'file))
        (file-complete (concat parent "/" file)))
    (push parent file-editor-save-dirs)        
    (push file-complete file-editor-save-files)
    (find-file file-complete)
    (file-editor-mode)
    (longlines-mode 1)))

We need to extend the file-editor-default-dirs function to display the previously stored directories and files.

(defun file-editor-default-dirs ()
  (let ((buffer (get-buffer-create "*file-editor-dir-list*")))
    (with-current-buffer buffer
      (let ((inhibit-read-only t))
        (erase-buffer)
        (file-editor-sort-history)

        (insert "*** Default File List ***\n\n")

        (dolist (dir file-editor-default-dirs)
          (file-editor-insert-opendir-button "" dir))

        (when file-editor-save-dirs
          (insert "\n")
          (dolist (dir file-editor-save-dirs)
            (file-editor-insert-opendir-button "" dir)))

        (when file-editor-save-files
          (insert "\n")
          (dolist (file file-editor-save-files)
            (insert-text-button file 'parent "" 'file file
                                :type 'open-file-editor)))))))

And for some future functionality I am thinking about we also store the current directory that is being visited.

(defun file-editor-dir-list (parent)
  (let ((buffer (get-buffer-create "*file-editor-dir-list*")))
    (with-current-buffer buffer
      (let ((inhibit-read-only t) files dirs)
        (setq parent (expand-file-name parent))
        (setq file-editor-current-dir parent)
        (erase-buffer)
        ;; ...
))))
-1:-- Jared (Post Jared)--L0--C0--July 02, 2009 09:45 PM

Kyle Sexton: The origin of the name Ada Grace

People have been asking how we came up with the name Ada Grace for our daughter so I thought that I would share where the names came from.

The name Ada comes from Ada Lovelace, known as the “first programmer” back in the early 1800s.  You can read more about her here, http://en.wikipedia.org/wiki/Ada_Lovelace.  Ada Lovelace was friends with a man named Charles Babbage, who designed a general purpose computer known as the analytical engine.  She wrote a series of notes about the machine including a method for calculating a sequence of Bernoulli numbers.  Based on those notes, she is widely considered the world’s first computer programmer.

‘Grace’ also comes from a remarkable woman who dealt with computers and programming, Grace Hopper.  She was a computer scientist and US naval officer.  You can read more about her here, http://en.wikipedia.org/wiki/Grace_Hopper.  She was a true pioneer in computer science, developing the first compiler for a programming language, among other notable accomplishments.  The famous quotation “It’s easier to ask forgiveness than it is to get permission” is often attributed to her (hopefully Ada won’t use that against me!).  She has a military vessel named after her, the USS Hopper.  Very few US military vessels are named after women.

In choosing the names, I wanted to pick women that were pioneers.  Both of those women fit the category.  Plus, we can now say that Ada Grace is named after the person who wrote the first programming language (Ada Lovelace) and the person who found the first computer bug (Grace Hopper).

-1:-- The origin of the name Ada Grace (Post kyle)--L0--C0--July 02, 2009 07:57 PM

Jason McBrayer: Getting html articles in Gnus to obey browse-url-browser-function

I use Gnus for email, and frequently get emails with an html part. In some cases, I even /want/ to receive emails with an html part, as with RSS feeds that have been translated to Gnus groups via rss2email, in which I sometimes want to see images inline so I don't have to click through to the original article. Like most people viewing html emails in Gnus, I let emacs-w3m handle the translation of html to text. The problem with this is that then hitting return on a link will use w3m to follow the link, /not/ the browser you have specified in browse-url-browser-function.

This little code snippet fixes that. I'm not sure it's ideal in all ways. But it works for me currently.

(eval-after-load "w3m"
  '(progn
     (defun jfm/open-url-dwim (&optional url)
       (interactive)
       (if (equal browse-url-browser-function 'w3m-browse-url)
           (w3m-browse-url url)
         (if (equal (face-at-point) 'w3m-anchor-face)
             (w3m-view-url-with-external-browser url)
           (browse-url url))))
     (define-key gnus-article-mode-map (kbd "<return>") 'jfm/open-url-dwim)))
-1:-- Getting html articles in Gnus to obey browse-url-browser-function (Post)--L0--C0--July 02, 2009 11:30 AM

Flickr tag 'emacs': Org Mode Unicorn Logo

greg.newman posted a photo:

Org Mode Unicorn Logo

This is a redo of the old org-mode logo using it's original color scheme. I provided this to the guys for their submission to the Source Forge Community Awards

-1:-- Org Mode Unicorn Logo (Post nobody@flickr.com (greg.newman))--L0--C0--July 02, 2009 10:35 AM

Brian Zwahr: I Got This (key)Board On Lockdown

The longer I use emacs, I find myself sticking to my keyboard's home row. Even in my pre-emacs days I was already starting to ignore my mouse, but these days if I can't do something without mostly remaining on "asdf" and "jkl;", I either find a way, create a way, or (rarely) learn to deal with it (and/or try to avoid it). That is not just for emacs either. Other programs, even my tiling window manager, are all used mostly by keyboard. As you can imagine, I've learned a lot of keyboard shortcuts.

As a side note (but not a tangent, I promise!), one of the things I like about vi and vim (yeah, yeah, boo, hiss, etc.) is its use of h, j, k, and l for movement. (I don't like having to switch modes to do so, however, which requires leaving the home row to press escape [though I have read of techniques to set, for instance, 'jj' or 'jk' (typed really fast) to the same as escape for going from insert mode back to visual mode], but that's getting into tangent land, so I digress.) I like using these keys for movement because it allows me to stay on the home row and not have to move my hands to the arrow keys. While I have thought about what emacs would be like if its movement keybindings were closer to vi's (i.e. C-j instead of C-n for next-line), I've become quite accustomed to using emacs' defaults for moving around.

This, of course, sometimes requires extended and extensive holding down of the control key. This is also true when doing something like cutting/pasting lines and moving. For instance, to switch two lines of text, I have to go to the beginning of the first line then press: C-k, C-n, C-y. Of course, I don't actually press control three times, since I (improperly, I think) use only my left hand for control. I hold down control and press k, n, y, then release. While this small, three command example is no problem, sometimes I do major editing which requires holding down the control key for quite some time. This can be uncomfortable, problematic, and lead to the infamous emacs pinky, even if using caps lock as a control key.

Certain that someone else has found this a hassle and done something about it, I looked around and found control-lock. It works much like caps lock: you turn it on (with C-z) then all keys pressed are interpreted as if control is being pressed. So, instead of pressing C-n ten times to move down ten lines (I know, I know, prefix arguments and all that... this is just an example!), I can simply press C-z, then press (or hold down) n. Pressing z, which translates into C-z, exits control-lock.

I have to say, I have found control-lock extremely helpful mostly when editing a file. Typically, when I'm writing or coding, I don't do much that requires the control key except deleting a few characters and slight cursor movement. It's when I'm going back and editing that I use a lot of control commands back-to-back. That is where control-lock comes in very handy. It saves time, effort, and discomfort. I highly recommend it.
-1:-- I Got This (key)Board On Lockdown (Post bzwahr (noreply@blogger.com))--L0--C0--June 30, 2009 10:35 PM

Aaron Hawley: Iran is not a twitter revolution

Reese Erlich is a freelance journalist and author who's been covering recent events in Iran -- *from Iran* and not just his computer chair like many in the mainstream media have.

He recently countered "left-wing Doubting Thomas arguments" in an article on Common Dreams .org. In his arguments, I found these observations about Iranians "fighting for political, social and economic justice" inspiring.

[...]

Assertion: The U.S. has a long history of meddling in Iran, so it must be behind the current unrest.

[...]

Frankly, based on my observations, no one was leading the demonstrations. During the course of the week after the elections, the mass movement evolved from one protesting vote fraud into one calling for much broader freedoms. You could see it in the changing composition of the marches. There were not only upper middle class kids in tight jeans and designer sun glasses. There were growing numbers of workers and women in very conservative chadors.

Iranian youth particularly resented President Ahmadinejad's support for religious militia attacks on unmarried young men and women walking together and against women not covering enough hair with their hijab. Workers resented the 24 percent annual inflation that robbed them of real wage increases. Independent trade unionists were fighting for decent wages and for the right to organize.

Some demonstrators wanted a more moderate Islamic government. Others advocated a separation of mosque and state, and a return to parliamentary democracy they had before the 1953 coup. But virtually everyone believes that Iran has the right to develop nuclear power, including enriching uranium. Iranians support the Palestinians in their fight against Israeli occupation, and they want to see the U.S. get out of Iraq.

So if the [sic] CIA was manipulating the demonstrators, it was doing a piss poor job.

[...]

See also Erlich's Iran is not a twitter revolution.

-1:-- Iran is not a twitter revolution (Post)--L0--C0--June 29, 2009 09:27 PM

emacspeak: Launching Favorite Media Via Hot Keys

Launching Oft-Played Media On The Complete Audio Desktop

Command emacspeak-multimedia lets you launch all forms of local and remote media. However this stil requires you to specify the media location --- and this requires a bunch of keystrokes that you end up repeating for selecting media that you play often, e.g., from your private music collection. No more extra keystrokes, you can now have Emacspeak automatically assign suitable hotkeys for launching emacspeak-media on your favorite audio collections.

How It Works

  • Customize Emacspeak option emacspeak-media-location-bindings using Emacs' Custom interface:
    M-x customize-variable --- 
    
    press C-H V in emacspeak.
  • Click ins to insert a key/location pair.
  • Click save to persist the binding.
  • pressing the assigned hotkey will automatically launch emacspeak-multimedia on the predefined location --- emacs will prompt you with regular filename completion for media resources found in that directory.

In my own case, I have favorites defined on hyper-<n> so I can define upto 10 hotkey assignments for media locations.Once launched, Emacspeak automatically switches to the media player buffer; note that this is different from how emacspeak-multimedia normally works. The justification: this hotkey interface is ideally suited to remote controls, joysticks, and any other peripheral via which you can deliver input to Emacs.

-1:-- Launching Favorite Media Via Hot Keys (Post T. V. Raman (noreply@blogger.com))--L0--C0--June 29, 2009 11:53 AM

A Curious Programmer: Jared


Org Mode

The wonderful Org mode has deservedly been getting a lot of [word] press recently. This is a really great tutorial. There is a nice customization guide at orgmode.org. endperform talks about using it for time tracking and remembering useful tricks. Emacs-fu has an article on generating html with org-mode. ByteBaker talks about using it to organise papers he downloaded and to make a wiki.

My Emacs Posts

I’ve started a series about a light-weight alternative to dired mode. Part two, which will remember locations you have visited previously is on the way.

A quick mention of longlines-mode got a comment about visual-line-mode which is the replacement in Emacs 23 onwards. I’ve switched over and it does seem better. longlines-mode was fairly reliable, but occasionally it would forget that it was supposed to be wrapping words and I would need to disable it and enable it.

Other Emacs Posts

alieniloquent talks about using advice to disable other window is you use the universal prefix (C-u). Nice trick.

Aneesh Kumar has post on switching from vim to emacs, or actually viper. As I use vim a lot, I’ve tried viper in the past but I always found that it made accessing various emacs commands harder (or maybe just different) than it is in vanilla emacs so I always switched back.

Armin Sadeghi says that his two favourite editors are SlickEdit and Emacs.

The big difference between SlickEdit and Emacs is that SlickEdit is commercial software and Emacs is open source.

If that is the big difference, why not just use Emacs?

-1:-- Jared (Post Jared)--L0--C0--June 28, 2009 03:30 PM

Flickr tag 'emacs': Twitter on Emacs

jasonwryan posted a photo:

Twitter on Emacs

-1:-- Twitter on Emacs (Post nobody@flickr.com (jasonwryan))--L0--C0--June 27, 2009 11:57 PM

Yoni Rabkin Katzenell: Potential vs. kinetic interest

Here is a potentially interesting article about "... allowing Emacs Lisp and R4RS Scheme to share data structures".

Interest is a conservative force, so you'll get all of the potential interesting-ness of the article as kinetic interesting-ness (minus the friction) if you read it (I haven't yet).
-1:-- Potential vs. kinetic interest (Post)--L0--C0--June 27, 2009 09:43 PM

Flickr tag 'emacs': Threads list buffer

Sphinx The Geek posted a photo:

Threads list buffer

Threads buffer. Columns are misaligned badly.

www.emacswiki.org/emacs/GDB-MI

-1:-- Threads list buffer (Post nobody@flickr.com (Sphinx The Geek))--L0--C0--June 27, 2009 05:11 PM

Chris Ball: Microfinance in Ayacucho

My awesome sister-in-law Suzy is in Ayacucho, Peru, volunteering for Kiva for around nine months. One of the difficulties with poverty relief charities is that people feel a disconnect between their donation and the result, and Kiva works around this problem by personalizing the process of making a loan to a specific entrepreneur. Kiva also empowers recipients by organizing loans that the recipients are expected to pay back.

Suzy's working with a local microfinance organization, interviewing potential borrowers and uploading their profiles to the main Kiva site for lenders to see. She's posted twice to the main Kiva Fellows blog now, and I hereby humbly present her posts. You should read them.

-1:-- Microfinance in Ayacucho (Post Chris Ball)--L0--C0--June 27, 2009 04:17 AM

Flickr tag 'emacs': Tiwtter from Emacs on Arch

jasonwryan posted a photo:

Tiwtter from Emacs on Arch

-1:-- Tiwtter from Emacs on Arch (Post nobody@flickr.com (jasonwryan))--L0--C0--June 27, 2009 03:46 AM

Alex Schroeder: ELIM

I managed to build ELIM on Mac OS X and wasted about three hours of my life. Wow!

That’s what I get for trying to avoid Fink and MacPorts.

I got an error when installing glib: it requires gtkdoc-rebase, which is part of gtk-doc, which requires gnome-doc-utils, which requires ScrollKeeper, which requires the DocBook DTD in the system catalog, which I was too lazy to install manually. It turns out that I can ignore the installation error for glib!

Later, I tried ignoring the missing ScrollKeeper error and discovered that it was possible to install gnome-doc-utils, but then configuration of gtk-doc fails because the DocBook DTD is still required.

More time wasted. Why can’t I just read a book!?

Tags:

-1:-- ELIM (Post)--L0--C0--June 27, 2009 01:02 AM

Aaron Hawley: How the culture is hostile to women

I've written before how I believe that a lot of women aren't recruited or drawn into all levels of computing because the culture is male-centered and therefore not attractive to women. I also believe a symptom of this disease -- that also only adds to make the situation even worse -- are the outright sexist and misogynistic acts by men. Often, such harassment is acted out in private or in electronic forums -- these incidents are well-documented. However, occasionally this hostility bubbles up and boils over into public and in-person situations.

This month, there was a presentation at a Flash conference that sounded completely absurd. Read about it at Prude or Professional? by Courtney Remes at the [info]geekgirlsguide.

Earlier this year there was a similar presentation at a Ruby conference. See Why Rails is Still Ghetto by [info]sarahmei and gender and sex at gogaruco by [info]Sarah Allen for reports from a third of the women who attended the conference (2 out of 6 is one-third) and found the presentation offensive.

On all this, I prefer to just quote some of what [info]volsunga wrote in Porn. Ruby. *headdesk* rather than adding more meta-discussion to these controversies. It is stated well.

[...] This is the classic "it's more offensive for you to say I'm a sexist than for me to actually be sexist!" response. People with an agenda (usually those sneaky feminists) choose to find something offensive so they can have a whine and call someone mean names, like "sexist". But what's at stake here isn't that the presentation was offensive per se, but that the context was inappropriate and potentially alienating to women developers, in an environment that's already default male by dint of numbers.

There's also the classic "you could just ignore it if you don't like it" defence. [...]

This presumes that people who don't like pictures of naked women went along just so they could complain. But even if everyone who thought they might not like the talk didn't go, it'll still be wrong to show it; the very presence of such a slideshow at the event creates an atmosphere where women are "them", where some content is made solely for men, but as if "male" is "default". [...]

And it doesn't matter if it was intentional -- no one really thinks [the presenter] sat down and schemed to offend women in advance -- and by refocusing on intention [the presenter] is able to get away with all that "poor little me" stuff in his post, as if his whole character has been impugned.

Newsflash: there's a difference between saying "you're a sexist/racist/homophobe" and "some of the stuff you just did/said contributed to the sexist/racist/homophobic culture around X".

Message to Ruby developers who think this is out of control/proportion/just a bit silly: all your rights to nod sympathetically/join in when someone bemoans the lack of women developers are entirely removed (for ever) if when women do speak up, you pull this self-pitying, I'm-a-nice-guy-really, its-not-my-fault, thats-just-the-way-I-roll, stop-complaining bullshit. And if those who complained then get painted as moralistic, shrill and angry for the sake of it.

There are various posts up and around about why this has become a blame game, and that it's counter-productive. It wouldn't be a blame game if there had been less bombastic denial and more listening on the part of the speaker in the first place. Blame games stop when someone puts their hands up and scrutinises their behaviour. So get on with it.

A fun resource I found while poking around in this is Derailing for Dummies.

-1:-- How the culture is hostile to women (Post)--L0--C0--June 26, 2009 03:04 PM

Flickr tag 'emacs': emacs-identica

jasonwryan posted a photo:

emacs-identica

Posting to Identi.ca from Emacs on my Arch Eee PC...

-1:-- emacs-identica (Post nobody@flickr.com (jasonwryan))--L0--C0--June 26, 2009 07:37 AM

Flickr tag 'emacs': GNU Dance

adacampos posted a photo:

GNU Dance

-1:-- GNU Dance (Post nobody@flickr.com (adacampos))--L0--C0--June 26, 2009 12:10 AM

Flickr tag 'emacs': Ballet & GNU

adacampos posted a photo:

Ballet & GNU

-1:-- Ballet & GNU (Post nobody@flickr.com (adacampos))--L0--C0--June 26, 2009 12:04 AM

Emacs-fu: jumping back to past locations

With the pop-global-mark-command, you can quickly jump back to the locations you were before, like tracking back your bread crumbs.

A typical example of this is when doing some programming and looking up some function in another file, which refers to a function in yet another file, and so on – for example, see navigating through source code using tags.

Press C-x C-SPC (the default key binding for pop-global-mark) to make your journey back to where you came from; it works in a cyclical fashion as well, so you can go on and on.

Quite useful – you may want to use a more convenient key binding though. Admittedly, it's hard to come up with any intuitive keybinding which is not already taken by something else…

-1:-- jumping back to past locations (Post djcb (noreply@blogger.com))--L0--C0--June 25, 2009 11:28 PM

Brian Zwahr: jira-mode pt. 1

Well, folks, it's been only a matter of time. I've begun working on my first major mode project. Where I work we use Jira for bug tracking, ticketing, and support requests. Naturally, like any obsessed emacs user, I found myself wondering "how can I work with Jira without leaving emacs?" Of course, the first obvious answer was to use the Jira web interface via the w3m web browser in emacs. However, not everything worked.

So, I did what I always do in situations like these: I went to EmacsWiki. After a quick search I found jira.el, an elisp file for working with Jira via XMLRPC written by Dave Benjamin. I tried it out, and it worked. It is quite incomplete, though. Therefore, I decided to start adding to it.

For instance, it could get the information for a ticket, but couldn't add comments or even add new tickets. I started adding all this functionality and found myself thinking it would be great to have a jira-mode that I could set in a buffer where I could do things like press "r" to refresh a ticket, "c" to create a new one, etc. I looked around, and noone else seems to have made anything like this, so I decided I would.

As of now, I have a working mode, with some customizable faces, that can create tickets, refresh tickets, update tickets, list projects, and a few other basic functions. I am adding more and more to jira-mode and will definitely keep an update on it. I will probably re-post it back to EmacsWiki at some point. For now, I just want to get it useable and practical.

That said, I have to say, its incredibly easier to write a major mode than I had anticipated. Of course, the more complicated the application, the more complicated the mode will be to write. I'm rather pleased with what I've done so far and, as I've said, will post updates about jira-mode here as I make more breakthroughs.

So, keep an eye out for pt. 2!
-1:-- jira-mode pt. 1 (Post bzwahr (noreply@blogger.com))--L0--C0--June 25, 2009 05:24 PM

Aaron Hawley: Drivable Motor Vehicle Act

I noticed an old comment posted to someone's site by [info]Matthew Davidson who wrote a car metaphor for free software. This is a commonly used metaphor device, but I think it's especially good. (I *swear* I didn't find this in a search for my own surname).


I drive a little Toyota hatchback. I do so because I got it relatively cheap from my sister-in-law. This was possible because she owned the car, [instead of having] a non-transferable license to use the car under certain conditions.

I know how to pump up the tyres and refill the thing that squirts water on the windscreen. That's all I know about maintaining the vehicle, and probably all I ever will know. I take it to the local mechanic of my choice every couple of years and he fustigates the Smoot-Hawley flanges or whatever for me, at what I can only assume is a reasonable price.

I am very glad that the bonnet was not locked shut at the factory by Toyota, and that there is not a Drivable Motor Vehicle Act (DMVA) to make it a criminal offense for anybody to attempt to service their own car, or pay somebody other than the manufacturer to service it. I may not personally know the first thing about its [sic] inner workings, but if I suspect I'm being charged to much for some work on my car, I can go a few hundred metres up the road to the next mechanic who can provide me with a quote.

Most of these mechanics probably chose this trade after opening up the bonnet of their own car and having a playful poke around, the same way I learned how to program computers. Now as Richard Stallman would say, the ethical issues around car manufacturing and software manufacturing are not the same; I don't have the legal right to make a perfect copy of my car, but that's okay because I don't have the practical means to do so -- no matter how much technical skill I am able to acquire, and neither does anybody but very large corporations, so losing that freedom (through patents) doesn't cost me anything, while potentially delivering the benefits to society that the patent system [for car manufacturing] is supposed to provide.

But if somebody paid me to write some software for them and I said "okay, I'll write it for you, but only under the condition that you don't copy it or attempt to fix or improve it yourself, or pay somebody else to fix or improve it," that would be a very bad deal for the customer, because the means to do these things are so cheap that you are practically only paying for the time of the person who does the work (or not, if you do it yourself). It would be such a bad deal in fact, that if I managed to convince a sucker to fall for it, I would have to regard my own behaviour as unethical.

Granted there aren't as many programmers as motor vehicle mechanics in my town, but that can and should change. Already I can point to half a dozen people I know who could (and hopefully will) become as familiar with the inner workings of [the free software package] Drupal as myself with only a little effort. As this begins to happen across a wide range of software the real cost of proprietary software (as opposed to the mere price tag), and the benefits of freedom, will become apparent to even the most non-technical users.


Speaking of "tryes", "metres" and "bonnets"; the end software patents campaign needs help documenting the patent issue in Australia and New Zealand, among other locales.
-1:-- Drivable Motor Vehicle Act (Post)--L0--C0--June 24, 2009 09:27 PM

@emacs: emacs: Screenshot of Emacs running on G1 http://bit.ly/gzW6C (via @learnemacs -&gt; @alecmuffett -&gt; @philjackson)

emacs: Screenshot of Emacs running on G1 http://bit.ly/gzW6C (via @learnemacs -> @alecmuffett -> @philjackson)
-1:-- emacs: Screenshot of Emacs running on G1 http://bit.ly/gzW6C
 (via @learnemacs -&gt; @alecmuffett -&gt; @philjackson) (Post)--L0--C0--June 24, 2009 06:21 PM

Yoni Rabkin Katzenell: No emacs-ditz and some hardware hacks

I tried out emacs-ditz, but decided to ditch it before giving it a chance. The command-line interface to ditz is so spartan that adding an Emacs interface seems at best superfluous and at worst baroque. This is of course in praise of ditz.


I built myself the Polyvinyl-chloride do-it-yourself laptop stand. I had originally seen it on lifehacker. I've added 8 non-slip surfaces to the contact points with the table and laptop as little leather squares from an old belt stuck in place with contact cement.


Orr and I made pasta with our new pasta machine. I used some generic pasta flour mixed with buckwheat flour. Making it was fun (2 year old + flour + water == happy 2 year old) but the results weren't amazingly tasty, just kind of OK. I'll try to get some semolina flour for the next try.
-1:-- No emacs-ditz and some hardware hacks (Post)--L0--C0--June 24, 2009 11:03 AM

Trey Jackson: Emacs Tip #31: kill-other-buffers-of-this-file-name

A friend mentioned he wanted a way to get rid of all the other buffers visiting files that of the same file name. I instantly realized this was something I'd wanted for a long time without knowing it.My usage is that I'm often viewing different versions of the same file, usually in different sandboxes. And, I might also have older versions checked out, whose file names are the same, but end
-1:-- Emacs Tip #31: kill-other-buffers-of-this-file-name (Post BFW (noreply@blogger.com))--L0--C0--June 24, 2009 11:28 AM

Flickr tag 'emacs': Meadow * Meadow

kawacho posted a photo:

Meadow * Meadow

Meadow スプラッシュ画面の T シャツの写真をスプラッシュ画面にしてみた。

-1:-- Meadow * Meadow (Post nobody@flickr.com (kawacho))--L0--C0--June 24, 2009 02:35 AM

Flickr tag 'emacs': Meadow T シャツ 2 枚

kawacho posted a photo:

Meadow T シャツ 2 枚

-1:-- Meadow T シャツ 2 枚 (Post nobody@flickr.com (kawacho))--L0--C0--June 24, 2009 01:01 AM

Emacs-fu: setting fonts

NOTE: if you like Org-Mode, please go and vote for it in SourceForge Community Choice Award – it's in the Most Likely to Change Change the Way You Do Everything-category.


For pleasant working with emacs, one of the more important things is choosing the right font ('face'). Especially within a windowing system, and especially with Emacs 23, there are a lot of possibilities. I am thinking from the Linux/X-Window perspective here – the support for anti-aliased fonts makes things look so much nicer – as discussed before.

On X, there are different ways to set your font. One way is through the menu (Options/Set default font.../). We can also set it in our .emacs, with (set-default-font "<font>"), or using ~/.Xdefaults. The latter method makes emacs-startup quite a bit faster, but this may have become less important in the age of emacs –daemon (Emacs 23).

barb wire

In either case – .emacs or .Xdefaults – you must provide some string describing the font. Up to Emacs-23, under X you had to use the 'barb wire'-style X font description, which you could get from a tool like UI-designers' dream xfontsel; the font description would then look something like:

  -*-bitstream vera sans mono-medium-r-*-*-*-120-*-*-*-*-iso8859-*

emacs 23

In the brave new world of Emacs 23, on X, you can also use the somewhat clearer Fontname-<size> format. You can get a list of the fonts installed on your system with the fc-list commond; if you only want to get the monospaced fonts, use

 $ fc-list :spacing=mono

For details, see the FontConfig user manual.

Note that installing fonts under X is rather easy as well these days; in most cases all you need to do is put the .ttf-files in your ~/.fonts directory and all will be find, although some program might require a restart.

Once you have chosen a font, you can put it in your ~/.Xdefaults:

Emacs.font: Envy Code R-10

and don't forget to run xrdb ~/.Xdefaults afterwards, to tell X about the changes. All of this should happen before you start emacs.

Alternatively, you can put in your .emacs something like:

(if (eq system-type 'windows-nt)
  (set-default-font "-outline-Consolas-normal-r-normal-normal-14-97-96-96-c-*-iso8859-1"))

(if (eq window-system 'x)
  (set-default-font "Inconsolata-11"))

This will set a different default font, based on whether you are running on Windows or X. You can freely adapt it to your own desires of course.

Side note: if there is yellow in the code snippet above, that is because of hightlighting lines that are too long.

face value

There are many fonts; which one is the 'best' for you, obviously depends on personal taste and also what you want to with it. As I use emacs for coding but also for reading e-mails and writing documents, there are some things that are important for me:

  • monospace
  • most important: clear and crisp, even when using smaller font sizes;
  • clearly separate O (capital O) and 0 (zero);
  • support italic display;
  • support the characters I might use (incl. accented characters and some greek ones).

Following these rules, I found the Envy Code R font to work very nicely. It's not fully Free though: Free to use but distribution prohibited. Raph Levien's Inconsolata is nice as well and truly Free; it does not provide an italic font though (at least it does not show in Emacs). Here's a list of programming fonts.

more

Hmmm… I wanted to write some small entry… And there is so much more to say about fonts. As often, EmacsWiki has a lot of information; for example about FontSets, which allow you to use a sort-of combination-font, which is nice if you have to work with mixed character sets (Latin, Arabic, CJK etc.).

Also, the emacs-fu entry on zooming in/out is useful in this context, even though Emacs 23 has gained something similar by default.

Also, the entry on color theming may be interesting, in this entry we only look at the default font, but you can change fonts governing only part of emacs as well; see M-x list-faces-display.

Or get information about the font at point with C-u C-x =.

-1:-- setting fonts (Post djcb (noreply@blogger.com))--L0--C0--June 24, 2009 02:01 AM

A Curious Programmer: Jared


In the real world

  • we don’t get to choose Ruby just because we want to
  • we don’t have time to implement perfect solutions
  • we don’t go back and fix ugly but working code
  • the second law of thermodynamics always holds
  • copy/paste and singleton are not the root of all evil
  • Java/C++/Perl are not dying
  • we still need to write code that works in IE
  • for most programmers IDEs are better than emacs or vim
  • two journeyman programmers are better than one rockstar

And in blogworld bloggers often forget that the plural of anecdote is not data.

-1:-- Jared (Post Jared)--L0--C0--June 23, 2009 08:35 PM

@emacs: emacs: @chneukirchen, you're welcome!

emacs: @chneukirchen, you're welcome!
-1:-- emacs: @chneukirchen, you're welcome! (Post)--L0--C0--June 23, 2009 08:09 PM

Flickr tag 'emacs': もう一枚

kawacho posted a photo:

もう一枚

CA3A0038

-1:-- もう一枚 (Post nobody@flickr.com (kawacho))--L0--C0--June 23, 2009 12:07 PM