aboutsummaryrefslogtreecommitdiffstats
path: root/lisp
diff options
context:
space:
mode:
authorNicolas Petton2017-06-19 14:43:39 +0200
committerNicolas Petton2017-06-19 14:43:39 +0200
commitb2fcba448486ced5c75e666a0ce964aebccf4aa5 (patch)
tree6d909fa5045e30406ff3c9c3cb8527d3f6a94de1 /lisp
parentae98cdf9431604d0f722f1db217ca06debfbb7b6 (diff)
downloademacs-b2fcba448486ced5c75e666a0ce964aebccf4aa5.tar.gz
emacs-b2fcba448486ced5c75e666a0ce964aebccf4aa5.zip
Revert "Add current-line in simple.el"
This reverts commit ae98cdf9431604d0f722f1db217ca06debfbb7b6.
Diffstat (limited to 'lisp')
-rw-r--r--lisp/simple.el29
1 files changed, 11 insertions, 18 deletions
diff --git a/lisp/simple.el b/lisp/simple.el
index e3b7665bf5a..a5565ab6e73 100644
--- a/lisp/simple.el
+++ b/lisp/simple.el
@@ -1270,25 +1270,18 @@ and the greater of them is not at the start of a line."
1270 done))) 1270 done)))
1271 (- (buffer-size) (forward-line (buffer-size))))))) 1271 (- (buffer-size) (forward-line (buffer-size)))))))
1272 1272
1273(defun line-number-at-pos (&optional pos absolute-p) 1273(defun line-number-at-pos (&optional pos)
1274 "Return buffer line number at position POS. 1274 "Return (narrowed) buffer line number at position POS.
1275If POS is nil, use current buffer location. 1275If POS is nil, use current buffer location.
1276 1276Counting starts at (point-min), so the value refers
1277If ABSOLUTE-P is nil, the default, counting starts 1277to the contents of the accessible portion of the buffer."
1278at (point-min), so the value refers to the contents of the 1278 (let ((opoint (or pos (point))) start)
1279accessible portion of the (potentially narrowed) buffer. If 1279 (save-excursion
1280ABSOLUTE-P is non-nil, ignore any narrowing and return the 1280 (goto-char (point-min))
1281absolute line number." 1281 (setq start (point))
1282 (save-restriction 1282 (goto-char opoint)
1283 (when absolute-p 1283 (forward-line 0)
1284 (widen)) 1284 (1+ (count-lines start (point))))))
1285 (let ((opoint (or pos (point))) start)
1286 (save-excursion
1287 (goto-char (point-min))
1288 (setq start (point))
1289 (goto-char opoint)
1290 (forward-line 0)
1291 (1+ (count-lines start (point)))))))
1292 1285
1293(defun what-cursor-position (&optional detail) 1286(defun what-cursor-position (&optional detail)
1294 "Print info on cursor position (on screen and within buffer). 1287 "Print info on cursor position (on screen and within buffer).