aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStefan Monnier2007-08-08 19:44:55 +0000
committerStefan Monnier2007-08-08 19:44:55 +0000
commit4cb071a4bd34c40215e88ca8fa31eec0e796def9 (patch)
treeb556750e1c526654cf9820efcf95f0c88deeaaf9
parentea1711904fd349350ae115269d0fb0e611b45dd9 (diff)
downloademacs-4cb071a4bd34c40215e88ca8fa31eec0e796def9.tar.gz
emacs-4cb071a4bd34c40215e88ca8fa31eec0e796def9.zip
(Man-next-section): Make sure we do not move backward.
-rw-r--r--lisp/man.el10
1 files changed, 7 insertions, 3 deletions
diff --git a/lisp/man.el b/lisp/man.el
index 56539072439..03003a46d1b 100644
--- a/lisp/man.el
+++ b/lisp/man.el
@@ -64,7 +64,7 @@
64;; ========== Features ========== 64;; ========== Features ==========
65;; + Runs "man" in the background and pipes the results through a 65;; + Runs "man" in the background and pipes the results through a
66;; series of sed and awk scripts so that all retrieving and cleaning 66;; series of sed and awk scripts so that all retrieving and cleaning
67;; is done in the background. The cleaning commands are configurable. 67;; is done in the background. The cleaning commands are configurable.
68;; + Syntax is the same as Un*x man 68;; + Syntax is the same as Un*x man
69;; + Functionality is the same as Un*x man, including "man -k" and 69;; + Functionality is the same as Un*x man, including "man -k" and
70;; "man <section>", etc. 70;; "man <section>", etc.
@@ -1291,14 +1291,18 @@ The following key bindings are currently in effect in the buffer:
1291(defun Man-next-section (n) 1291(defun Man-next-section (n)
1292 "Move point to Nth next section (default 1)." 1292 "Move point to Nth next section (default 1)."
1293 (interactive "p") 1293 (interactive "p")
1294 (let ((case-fold-search nil)) 1294 (let ((case-fold-search nil)
1295 (start (point)))
1295 (if (looking-at Man-heading-regexp) 1296 (if (looking-at Man-heading-regexp)
1296 (forward-line 1)) 1297 (forward-line 1))
1297 (if (re-search-forward Man-heading-regexp (point-max) t n) 1298 (if (re-search-forward Man-heading-regexp (point-max) t n)
1298 (beginning-of-line) 1299 (beginning-of-line)
1299 (goto-char (point-max)) 1300 (goto-char (point-max))
1300 ;; The last line doesn't belong to any section. 1301 ;; The last line doesn't belong to any section.
1301 (forward-line -1)))) 1302 (forward-line -1))
1303 ;; But don't move back from the starting point (can happen if `start'
1304 ;; is somewhere on the last line).
1305 (if (< (point) start) (goto-char start))))
1302 1306
1303(defun Man-previous-section (n) 1307(defun Man-previous-section (n)
1304 "Move point to Nth previous section (default 1)." 1308 "Move point to Nth previous section (default 1)."