summaryrefslogtreecommitdiff
path: root/lisp/km-util.el
diff options
context:
space:
mode:
Diffstat (limited to 'lisp/km-util.el')
-rw-r--r--lisp/km-util.el11
1 files changed, 11 insertions, 0 deletions
diff --git a/lisp/km-util.el b/lisp/km-util.el
index 8957862..40672d7 100644
--- a/lisp/km-util.el
+++ b/lisp/km-util.el
@@ -34,5 +34,16 @@
(--filter (with-current-buffer it (derived-mode-p mode))
(buffer-list)))
+(defun km/region-or-buffer-line-bounds ()
+ "Return line bounds for region.
+If region is active, return postions that mark the beginning of
+the first line and end of the last line that the region touches.
+If there is no active region, return a the minimum and maximum
+point in the buffer."
+ (if (use-region-p)
+ (list (progn (goto-char (region-beginning)) (point-at-bol))
+ (progn (goto-char (region-end)) (1+ (point-at-eol))))
+ (list (point-min) (point-max))))
+
(provide 'km-util)
;;; km-util.el ends here