December 29, 2006

Emacs tips #3 : automatically making scripts executable

Posted in Emacs at 15:01 by theBlackDragon

I don’t remember where I found this snippet (maybe comp.emacs) but it’s mighty useful so I thought I’d share it with you:

; Sets +x on scripts stating with a shebang
(if (< emacs-major-version 22)
       (add-hook 'after-save-hook
                 '(lambda ()
                    (progn
                      (and (save-excursion
                             (save-restriction
                               (widen)
                               (goto-char (point-min))
                               (save-match-data
                         (looking-at "^#!"))))
                           (shell-command (concat "chmod u+x "
                             buffer-file-name))
                           (message (concat "Saved as script: "
                             buffer-file-name))))))
       (add-hook 'after-save-hook
         'executable-make-buffer-file-executable-if-script-p))

Emacs versions below 22 need the former, longer method while Emacs 22 can use the oneliner in the last line.

Advertisements

December 2, 2006

The Job

Posted in Life, the Universe and Everything at 12:48 by theBlackDragon

I started working for Tri-ennium as a Java develeper yesterday. It’s been only one day now but I’m looking forward to it. Only time will tell whether my enthusiasm will last though 😉

On another note I’ll be moving to my own place by the end of this or the start of next month, I hope to stay online during that period but it’s very well possible that I’ll be without internet access for some time. Will be nice to finally have a place to really call my own 🙂