-;;; lmc.el --- Little Man Computer in Elisp
+;;; lmc.el --- Little Man Computer in Elisp -*- lexical-binding:t -*-
-;; Copyright (C) 2011, 2013 Free Software Foundation, Inc.
+;; Copyright (C) 2011, 2013, 2014 Free Software Foundation, Inc.
;; Author: Stefan Monnier <monnier@iro.umontreal.ca>
-;; Version: 1.2
+;; Version: 1.3
;; This program is free software; you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
(let ((word (car word))
(label (nth 1 word))
(code (nth 2 word)))
- (let ((basepos (point))
- (base (current-column)))
+ (let () ;; ((basepos (point)) (base (current-column)))
(if (and label (symbolp label))
(insert (symbol-name label)))
;; (when (>= (current-column) (+ base tab-width))
(2 (lmc-font-lock-label)))
(".$" (0 (lmc-font-lock-opcode)))))
-(defun lmc-after-change (beg end len)
+(defun lmc-after-change (beg end _len)
(unless inhibit-read-only
(save-excursion
;; Replace any TAB or NL inserted, which could interfere with parsing.
(make-variable-buffer-local 'lmc-pc)
(defvar lmc-acc nil "LMC accumulator.")
(make-variable-buffer-local 'lmc-acc)
-(defvar lmc-output nil "Past LMC output,")
+(defvar lmc-output nil "Past LMC output.")
(make-variable-buffer-local 'lmc-output)
(defvar lmc--stopped nil "State where we stopped.")
(defun lmc-tool-bar-to-string (&optional map)
(let ((res ""))
(map-keymap
- (lambda (k v)
+ (lambda (_k v)
(when (eq (car v) 'menu-item)
(let* ((label (nth 1 v))
(cmd (nth 2 v))
(setq lmc--stopped (lmc--state))
(force-mode-line-update)
(message "Done.")))
- (IN (setq lmc-acc (mod (read-number "Enter a number") 1000))
+ (IN (setq lmc-acc (mod (read-number "Enter a number: ") 1000))
(incf lmc-pc))
(OUT (message "Output: %03d" lmc-acc)
(push (format "%03d" lmc-acc) lmc-output)
(cond
((> (nth 0 (syntax-ppss)) 0) nil)
((looking-at "(") tab-width)
- ((not (looking-at comment-start-skip)) 0)
+ ((not (looking-at comment-start-skip))
+ (if (looking-at "[ \t]*$") tab-width 0))
((not (looking-at "\\s<\\s<")) nil)
((save-excursion (forward-comment (- (point))) (bobp)) 0)
(t (forward-comment (point-max)) (lmc-asm-indentation)))))