configure_backup/elisp/kit.el

35 lines
1015 B
EmacsLisp
Raw Permalink Normal View History

2014-01-22 14:57:46 +08:00
#!/usr/bin/emacs --script
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; NAME
2014-01-22 18:01:06 +08:00
;; kit.el ---- an example elisp script, which is
;; used to calculate intern salary.
2014-01-22 14:57:46 +08:00
;;
;; USAGE
2014-01-22 18:01:06 +08:00
;; emacs -Q --script kit.el iday
;; ./kit.el iday
2014-01-22 14:57:46 +08:00
;;
;; NOTE
;; #!/ shebang works for emacs22 and later.
;;
2014-01-22 18:01:06 +08:00
;; AUTHOR
;; Aborn Jiang (aborn.jiang@gmail.com)
2014-01-22 14:57:46 +08:00
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;(print argv)
(message "input argument are %s" argv)
2014-01-22 16:41:12 +08:00
(message "system-type:%s system-name:%s" system-type system-name)
(defun cal-salary (iday)
"Calculate the salary for intern in shanghai"
(interactive "p")
2014-01-22 18:01:06 +08:00
(setq total (* iday 180))
(if (> total 800)
2014-01-22 19:11:17 +08:00
(setq value (+ 800 (* 0.8 (- total 800)))
tvalue (- total value)) ;; if true
(setq value total ;; else part
2014-01-22 18:01:06 +08:00
tvalue 0))
(message "You have worked %d day(s), and salary is %d, tax is %d." iday value tvalue)
2014-01-22 16:41:12 +08:00
)
2014-01-22 19:11:17 +08:00
(cal-salary (string-to-number (elt argv 0)))