Calling functions with optional arguments from the mini-buffer

Surely one of the first things VIers want to know as do the rest of us is how to move forward N characters (or backward or whatever) from the mini-buffer in EMACS. Here is how it is done, using the universal argument. So to move forward 100 chars:

C:u 100, C:f

ADDENDUM:01/13/13
Thanks FUCO for providing a better solution:

There’s also a faster way. Just hold down control key (or meta key, by default the binding is on both) and type the number, then execute the command or invoke minibuffer with M-x
So, C-2 C-0 C-f will move you 20 characters. It’s neat because you don’t have to release control, you just hit the rest of the keys in sequence.

This is How Easy it is to Make Changes to DrRacket

DrRacket is open-source (LGPL) editor for Racket. Sometimes you want to make changes to it. For example today I wanted to enable online compilation on single-core machines. Here is how easy it is to do it:

  1. Assuming that DrRacket is already installed. This is a normal installation using the installer; you do not typically have to check out the Git repo to make changes.
  2. Asked Robby how to make the change. Robby is super everybody knows that, he explained the fix. The check for enabling the feature is in module-language.rkt. Here are the steps
  3. cd /opt/racket/5.3.1/collects/drracket/private/
    sudo cp module-language.rkt module-language.rkt-ORG
    # Made the change
    # View it
    diff module-language.rkt module-language.rkt-ORG
    1329,1330c1329
    <                    ;;(> (processor-count) 1))
    <                    (> (processor-count) 0))
    ---
    >                    (> (processor-count) 1))
    1348,1349c1347
    <                    ;;(> (processor-count) 1))
    <                    (> (processor-count) 0))
    ---
    >                    (> (processor-count) 1))
    # Tell Racket to recompile that collection (aka library)
    sudo raco setup -l drracket
    # Restart DrRacket
    
  4. Now the online compilation indicator shows up and errors are automatically flagged.
  5. It works fine on a 1.6GHz Pentium with 2GB of RAM.

Hope this gave you a taste of how easily and quickly you can try new stuff out in DrRacket itself.
Here is how it looks with it turned on:

DrRacket for the Truly Impatient V02

DrRacket is a wonderful editor. It is so feature rich that the first time you begin using it, you may end up missing out on how powerful and pleasant it is to use due to the multitude of options and features. The following is my attempt to share the most useful and interesting features and get a new-user up and running and feeling really good about it as quickly as possible.
Continue reading “DrRacket for the Truly Impatient V02”

Installing Jess 71p2 in Eclipse 4.2

  1. Downloaded “Eclipse IDE for Java Developers”.
  2. The file name is “eclipse-java-juno-SR1-win32.zip”.
  3. This is release number 4.2 (Juno).
  4. Extracted the archive. Started Eclipse and stopped it.
  5. Extracted Jess plugins to the desired dir.
  6. Started Jess. Verified it’s presence.
  7. Installed GEF by using the built in “Juno” repository and searching for “GEF”. It showed up under “Modeling”. The installation took 10 minutes.
  8. Restarted Eclipse.

When you run this sample program:

(reset)
; define the counter
(deftemplate counter
  (slot count (type integer) (default 0)))
; define the rule
(defrule switchme
  ?p <- (counter {count < 10})
  =>
  (printout t ?p.count crlf)
  (bind ?p.count (+ ?p.count 1)))
; initialise counter
(deffunction init ()
  (assert (counter (count 1))))
;initialise program
(init)
;run program
(run)

Then you get a nice structure breakdown and syntax-highlighting:

You can set breakpoints and get debug information:

Here is the Rete network:

Good to know it is available, not that I know the value of it yet! I’m just investigating the plugins.
Next step is to do the studying!

Geiser 0.2.1 ELPA Package

Here is an ELPA package for the Geiser library.
The code is original from the author, I just packaged it up!
Here is one way to install it:

(require 'package)
(when (not (package-installed-p 'geiser))
  (url-copy-file
 "https://www.wisdomandwonder.com/wp-content/uploads/2012/09/geiser-0.2.1.tar"
 "/tmp/geiser-0.2.1.tar"
 t)
  (package-install-file "/tmp/geiser-0.2.1.tar"))

Emacs Pretty Mode Plus ELPA Package

Here is an ELPA package for the pretty-mode.el library.
The code functionality is original from the author, I just tweaked the pretty symbols and packaged it up!
Here is one way to install it:

(url-copy-file
 "https://www.wisdomandwonder.com/wp-content/uploads/2012/09/pretty-mode-plus-1.0.tar"
 "/tmp/pretty-mode-plus-1.0.tar"
 t)
(require 'package)
(package-install-file "/tmp/pretty-mode-plus-1.0.tar")

Addendum: 09/29/12
Fixed the package definition and now it is on Marmalade here.
Addendum: 11/29/12
Added Jess mode support.