JeanLouis

How I found out about GNU Emacs

GNU Emacs editor I know since 1999, as that was the first time I learned directly about the GNU Operating System. In fact I was so much frustrated with the non-functioning Windoze, that I went out in the evening looking for GNU.

I did not look for “Linux”, I looked for GNU. At one time in past I have seen GNU is Not Unix CD-ROM somewhere on a bookshelf in bookstore in Stuttgart, Germany. I have tried to understand what it means, and my understanding was wrong. I understood that GNU is Unix, and I understood that GNU GPL license is yet another proprietary license, which I did not like. I was copying software without obeying any type of licenses. And I was convinced that due to that proprietary GNU GPL license, the CD-ROM was pretty expensive, something like 160 Deutschmarks.

Still, one thing I knew, as once back in time, I have seen UNIX Terminals, and main computer in a closed, window kind of a room, elevated from ground to avoid even possible floods, and from that visit to military facilities, I knew that UNIX has multi-tasking abilities. That is what I knew and that was reason why I was searching for GNU. Windoze totally blocked after 1 day of Internet downloading, as my intention was to make a search engine.

It was too late for me that day to find GNU, the large bookstore Wittwer was closed. So I went to the train station, and there was one bookstore still open. I did not know what is Linux, I was basically sick and tired of proprietary software. But I did find Linux book with CD-ROM and references to GNU, so I paid about 100 Deutschmarks, I was sweating to spit this much money out, but I hoped to change for better.

Later I did find out by reading the licenses and understanding that I have actually got free software.

And most of information I have got directly from GNU Emacs and manifesto of Dr. Richard Stallman.

I have been using GNU Emacs for my everyday work and programming, but it was little clumsy, it blocked sometimes, crashed often, but I could save sessions. For some time I avoided using it, and used Vim editor and it was usable pretty much, but not as flexible. Later in time I switched back to GNU Emacs, and I am using it today, but I can switch easily to VI mode and use any vi-like editor or any Emacs-like editor.

It is my main tool for operating on a GNU system.

All my employees must go through GNU Emacs tutorial, and they do it within one hour, and later they edit text, and it works. Basic editing functions are simple and usable just by everyone.

units.el

Let us say I need to quickly calculate US dollar conversion to Tanzanian shilling, so I am pressing C-x 7 u and Emacs is asking me how much? I say 100, and it asks me 100 of what? So I complete the answer as usdollar and then it asks me to what I wish to convert? I complete the answer and get Tanzanian shilling. The answer is stored in register, I keep it on number 7. Now if I want to enter the answer into the buffer, I do C-x r i 7 and I have it. Otherwise I have read the answer in the mini buffer.

If the cursor is on some number, you can use that number to convert it to some other unit.

;;;; units.el interfaces with GNU Units http://www.gnu.org/software/units
;;;; Very much used in our program http://www.StartYourOwnGoldMine.com

(defun units-value (from to)
  "Returns the result from units program"
  (string-trim-right
   (shell-command-to-string
    (format "units -t '%s' '%s'" from to))))

(defun list-of-lists (&rest args)
  "Helper function for units completion"
  (let ((list '()))
    (dolist (item args)
      (push (cons item item) list))
    list))

;;; This is the completion list. You can simply add items which you use the most.

(setq units-completion-list
        (list-of-lists "usdollar" "euro"
                       "croatiakuna" "bosniaconvertiblemark" "serbiadinar"
                       "denmarkkrona" "norwaykrone" "swedenkrona" "finlandmarkka"
                       "tanzaniashilling" "ugandaschilling" "kenyaschilling"
                       "meter" "inch" "feet" "foot" "cm" "mm"
                       "mesh" "micron"))

(setq *units-register* 55) ;; number 7, you can set it on other key here

(defun units-complete (prompt)
  "Completion for units"
  (completing-read prompt units-completion-list nil t nil))

(defun units ()
  "Interfaces with units program and prints results into buffer"
  (interactive)
  (let* ((current-word (current-word :strict t))
         (register-char (char-to-string *units-register*))
           (from (if current-word current-word
                   (format "%s %s"
                           (string-trim (read-from-minibuffer "How much:"))
                           (units-complete "Unit:"))))
           (initial-unit (when current-word
                           (units-complete
                            (format "You have %s of what:" current-word))))
           (to (units-complete "You want:"))
           (result (if current-word
                       (units-value (concat from " " initial-unit) to)
                     (units-value from to))))
       (unless (or (string-empty-p (string-trim from))
                   (string-empty-p (string-trim to)))
         (set-register *units-register* (string-trim-right result))
         (message (format "%s %s -- value is on register for key %s" result to register-char)))))

(global-set-key (kbd "C-x 7 u") 'units)

;;; You can change register