Prompt before running print commands.
authorChong Yidong <cyd@stupidchicken.com>
Sat, 20 Nov 2010 20:23:26 +0000 (15:23 -0500)
committerChong Yidong <cyd@stupidchicken.com>
Sat, 20 Nov 2010 20:23:26 +0000 (15:23 -0500)
* lpr.el (lpr-buffer, print-buffer, lpr-region, print-region):
Prompt user before actually printing.

lisp/ChangeLog
lisp/lpr.el

index 4fb7c84..0f0308b 100644 (file)
@@ -1,7 +1,13 @@
+2010-11-20  Chong Yidong  <cyd@stupidchicken.com>
+
+       * lpr.el (lpr-buffer, print-buffer, lpr-region, print-region):
+       Prompt user before actually printing.
+
 2010-11-18  Stefan Monnier  <monnier@iro.umontreal.ca>
 
        * simple.el (kill-new, kill-append, kill-region):
-       * comint.el (comint-kill-region): Make the yank-handler argument obsolete.
+       * comint.el (comint-kill-region): Make the yank-handler argument
+       obsolete.
 
 2010-11-17  Stefan Monnier  <monnier@iro.umontreal.ca>
 
index 51b68c1..812db4c 100644 (file)
@@ -152,7 +152,9 @@ The variable `lpr-page-header-program' specifies the program to use."
   "Print buffer contents without pagination or page headers.
 See the variables `lpr-switches' and `lpr-command'
 for customization of the printer command."
-  (interactive)
+  (interactive
+   (unless (y-or-n-p "Send current buffer to default printer? ")
+     (error "Cancelled")))
   (print-region-1 (point-min) (point-max) lpr-switches nil))
 
 ;;;###autoload
@@ -169,7 +171,9 @@ in the print command itself; we expect them to request pagination.
 
 See the variables `lpr-switches' and `lpr-command'
 for further customization of the printer command."
-  (interactive)
+  (interactive
+   (unless (y-or-n-p "Send current buffer to default printer? ")
+     (error "Cancelled")))
   (print-region-1 (point-min) (point-max) lpr-switches t))
 
 ;;;###autoload
@@ -177,7 +181,10 @@ for further customization of the printer command."
   "Print region contents without pagination or page headers.
 See the variables `lpr-switches' and `lpr-command'
 for customization of the printer command."
-  (interactive "r")
+  (interactive
+   (if (y-or-n-p "Send selected text to default printer? ")
+       (list (region-beginning) (region-end))
+     (error "Cancelled")))
   (print-region-1 start end lpr-switches nil))
 
 ;;;###autoload
@@ -194,7 +201,10 @@ in the print command itself; we expect them to request pagination.
 
 See the variables `lpr-switches' and `lpr-command'
 for further customization of the printer command."
-  (interactive "r")
+  (interactive
+   (if (y-or-n-p "Send selected text to default printer? ")
+       (list (region-beginning) (region-end))
+     (error "Cancelled")))
   (print-region-1 start end lpr-switches t))
 
 (defun print-region-1 (start end switches page-headers)