[Emacs[Lisp][Meadow] An Introduction to Programming in Emacs Lisp Chapter 06
オレ,前回 Exercise を間違えてた。Chapter06 の Exercise だった。orz
Chapter 06
- save-restriction
- special-form
- narrowingされていればその状態を保存
- bodyを実行
- 保存しておいたnarrowingを復旧
Exercise 5.5
というわけで,Chapter06 の Exercise は Chapter05 の方に書いてしまったので,
こちらでは,Chapter05 の Exercise をば。
;;; Exercise 5.5 (defun my-greater-or-less (&optional arg) "Tell whether ARG is greater or less than fill-column." (interactive "P") (let (num) (if arg (setq num (prefix-numeric-value arg)) (setq num 56)) (cond ((> num fill-column) (message "%d is greater than fill-column(%d)" num fill-column)) ((< num fill-column) (message "%d is less than fill-column(%d)" num fill-column)) (t (message "%d is equal to fill-column(%d)" num fill-column))))) ;; お試し (my-greater-or-less 10) ; => "10 is less than fill-column(70)" (my-greater-or-less 70) ; => "70 is equal to fill-column(70)" (my-greater-or-less 71) ; => "71 is greater than fill-column(70)"
おつかれちゃん。