|
From: | Stefan Monnier |
Subject: | Re: creating a function that works for active region or whole buffer |
Date: | Mon, 28 Jan 2013 09:02:10 -0500 |
User-agent: | Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux) |
> (setq current-block-start-line (line-number-at-pos > (region-beginning) ) > current-block-end-line (line-number-at-pos (region-end) ) ) > ;; ...else use the whole buffer > (setq current-block-start-line (line-number-at-pos (point-min) ) > current-block-end-line (line-number-at-pos (point-max) ) ) ) goto-line and line-number-at-pos are expensive operations that count (and re-count and re-re-count every time) the number of LF chars from the beginning of the buffer. Stefan
[Prev in Thread] | Current Thread | [Next in Thread] |