:version "24.1")
(setq region-extract-function
- (lambda (method)
- (when (region-beginning)
- (cond
- ((eq method 'bounds)
- (list (cons (region-beginning) (region-end))))
- ((eq method 'delete-only)
- (delete-region (region-beginning) (region-end)))
- (t
- (filter-buffer-substring (region-beginning) (region-end) method))))))
+ (lambda (method)
+ ;; This call either signals an error (if there is no region)
+ ;; or returns a number.
+ (let ((beg (region-beginning)))
+ (cond
+ ((eq method 'bounds)
+ (list (cons beg (region-end))))
+ ((eq method 'delete-only)
+ (delete-region beg (region-end)))
+ (t
+ (filter-buffer-substring beg (region-end) method))))))
(defvar region-insert-function
(lambda (lines)