Archive for the ‘javascript’ Category

Studyflow (NL/Amsterdam) is looking for Clojure talent.

Wednesday, May 21st, 2014

At Studyflow we’re looking for a Clojure programmer who wants to join the team.

We’ll be at the Amsterdam Clojure Meetup if you want to talk to us. Or contact us via the links above.

See the incredible emacs config.

Saturday, November 3rd, 2012

Because people asked: my current emacs configuration is at

Note that it will not work as is, as it depends on my local file tree and specific installs from marmalade. So it’s mostly useful as a raw bucket of references to interesting stuff. Oh, and it includes my personal color theme, which may be an interesting example of emacs 24’s new color-theme functionalities.

Announcement: ring-upload-progress

Saturday, September 18th, 2010

I’ve forked off ring.middleware.multipart-params into a new library called ring.middleware.upload-progress

It’s a bit rough-and-ready for now, and it uses the session to store the shared state about current uploads, which is probably not the best way to go about it – I’m thinking about introducing a new lower-level mechanism for low-memory shared state based on clojure’s STM tools, since this kind of thing is interesting for more than just uploads – but it does work as long as you’re not doing anything too fancy (if you’re worried, you can use a separate session store just for this info).

For the interested: the code is at github.

I’ve got some working “upload progress bar” javascript and routing code too, but it’s not in this project, so for now, you’ll have to roll your own.

I’ll get a clojars release done as soon as I’m satisfied this stuff is usable. Probably in the next few days.

Rambling on Javascript: “Constructors considered mildly confusing”

Monday, February 11th, 2008

In which I poke your eye with the details of prototypes and constructors in JavaScript. Includes pretty diagrams! Read it here:
Constructors considered mildly confusing.

Arc is released

Wednesday, January 30th, 2008

As one or two of my readers may know, Arc is a project by Paul Graham to produce a new Lisp/Scheme dialect for the future. Up till now details about it have been very sparse, but today the first version was released.

From the notes:

Arc embodies just about every form of political incorrectness possible in a programming language. It doesn’t have strong typing, or even type declarations; it uses overlays on hash tables instead of conventional objects; its macros are unhygienic; it doesn’t distinguish between falsity and the empty list, or between form and content in web pages; it doesn’t have modules or any predefined form of encapsulation except closures; it doesn’t support any character sets except ascii. Such things may have their uses, but there’s also a place for a language that skips them, just as there is a place in architecture for markers as well as laser printers.

Sounds like a combo of JavaScript and Common Lisp to me, though I’m slightly disappointed about the (current) use of ASCII as the only charset.

When I’ve played with it a bit I may post more.

Get it here!

Update: here’s a tutorial


Emacs Javascript mode update

Thursday, November 29th, 2007

I partially fixed an issue with comments inside quoted strings. You can now use // inside a quoted string and it won’t be seen as a comment. Especially useful if you’ve got a URL in a string.

/* … */ style comments inside quoted strings are still seen as comments, since fixing that seems to be pretty complicated.

Get the javascript.el file here.

Karl Landström’s homepage is weg (en nu weer terug)

Sunday, November 11th, 2007

Is al eerder gebeurd, dus hopelijk is het tijdelijk.

Dus in de tussentijd is hier ook de originele javascript.el die ik gebruikt heb voor mijn versie.

update: Karl’s nieuwe homepage is hier.

Javascript regex en string literal highlighting in Emacs

Wednesday, October 31st, 2007

De beste javascript mode voor Emacs is deze van Karl Landström. Hij heeft alleen moeite met het correct detecteren van strings en regexes:


Niet leuk als je de source van jQuery opent. (Waarschuwing, dit crasht emacs!)

Ook niet leuk is dat Emacs’ ingebouwde syntax-table niet overweg kan
met de complete overloading van / in Javascript (als deel-operator, regex quote, en 2 soorten commentaar marker). Boeh voor Emacs!

De oplossing is dan om alle auto-quoting uit te zetten en het zelf te doen. Kan je net zulke ingewikkelde syntax mee highlighten als je wilt. Hoera voor Emacs!

Relevante passages:

;; --- Syntax Table And Parsing ---

(defvar javascript-mode-syntax-table
  (let ((table (make-syntax-table)))
    (c-populate-syntax-table table)

    ;; switch off build-in quoted string detection
    ;; since that just makes it really hard to detect
    ;; regular expressions and comments
    ;; this also has the benefit that multiline strings
    ;; are now not recognized as strings (since javascript does
    ;; not allow them)
    (modify-syntax-entry ?' "." table)
    (modify-syntax-entry ?\" "." table)

    ;; The syntax class of underscore should really be `symbol' ("_")
    ;; but that makes matching of tokens much more complex as e.g.
    ;; "\\" matches part of e.g. "_xyz" and "xyz_abc". Defines
    ;; it as word constituent for now.
    (modify-syntax-entry ?_ "w" table)

  "Syntax table used in JavaScript mode.")
(defconst js-quoted-string-re "\\(\".*?[^\\]\"\\|'.*?[^\\]'\\)")
(defconst js-quoted-string-or-regex-re "\\(/.*?[^\\]/\\w*\\|\".*?[^\\]\"\\|'.*?[^\\]'\\)")

(defconst js-font-lock-keywords-1
   (list js-function-heading-1-re 1 font-lock-function-name-face)
   (list js-function-heading-2-re 1 font-lock-function-name-face)

   ;; detect literal strings following a + operator
   (list (concat "+[ \t]*" js-quoted-string-re)  1 font-lock-string-face)

   ;; detect literal strings used in "literal object" keys
   (list (concat "[,{][ \t]*" js-quoted-string-re "[ \t]*:" ) 1 font-lock-string-face)

   ;; detects strings and regexes when assigned, passed, returned
   ;; used as an object key string (i.e. bla["some string"]), when used
   ;; as a literal object value (i.e. key: "string"), used as an array
   ;; element, or when they appear as the first expression on a line
   ;; and a few other hairy cases
   (list (concat "[=(:,;[][ \t]*" js-quoted-string-or-regex-re)  1 font-lock-string-face)
   (list (concat "^[ \t]*"      js-quoted-string-or-regex-re) 1 font-lock-string-face)
   (list (concat "return[ \t]*" js-quoted-string-or-regex-re) 1 font-lock-string-face)

   ;; detect "autoquoted" object properties... clases with "switch { ...  default: }"
   ;; may not be worth the trouble
   (list "\\(^[ \t]*\\|[,{][ \t]*\\)\\(\\w+\\):" 2 font-lock-string-face))

  "Level one font lock.")

En dan:

Patch is onderweg naar Karl. In de tussentijd kun je hier mijn versie downloaden.