I have the following code that runs figlet that has input as a range. How can I modify this code to check if b or e is not specified, make b to the start of the current buffer, and e end of the current buffer?
(defun figlet-region (&optional b e)
(interactive "r")
(shell-command-on-region b e "/opt/local/bin/figlet" (current-buffer) t)
(comment-region (mark) (point)))
(global-set-key (kbd "C-c C-x") 'figlet-region)
ADDED
Sean helped me to get an answer to this question
(defun figlet-region (&optional b e)
(interactive)
(let ((b (if mark-active (min (point) (mark)) (point-min)))
(e (if mark-active (max (point) (mark)) (point-max))))
(shell-command-on-region b e "/opt/local/bin/figlet" (current-buffer) t)
(comment-region (mark) (point))))
(global-set-key (kbd "C-c C-x") 'figlet-region)