unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#11656: 24.1.50; Info-\(next\|prev\)-reference: Add numeric prefix argument
@ 2012-06-09  3:41 Christopher Schmidt
  2012-06-09  6:49 ` Eli Zaretskii
  0 siblings, 1 reply; 11+ messages in thread
From: Christopher Schmidt @ 2012-06-09  3:41 UTC (permalink / raw)
  To: 11656

[-- Attachment #1: Type: text/plain, Size: 214 bytes --]

Hi,

this patch adds the optional numeric prefix argument COUNT to
Info-next-reference and Info-prev-reference.  This argument makes the
functions do The Right Thing, that is, repeat the functionality COUNT
times.

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: Info-nextprev-reference.diff --]
[-- Type: text/x-diff, Size: 4071 bytes --]

=== modified file 'lisp/ChangeLog'
--- lisp/ChangeLog	2012-06-09 02:26:47 +0000
+++ lisp/ChangeLog	2012-06-09 03:37:42 +0000
@@ -1,3 +1,8 @@
+2012-06-09  Christopher Schmidt  <christopher@ch.ristopher.com>
+
+	* info.el (Info-next-reference, Info-prev-reference): Add numeric
+	prefix argument.
+
 2012-06-09  Stefan Monnier  <monnier@iro.umontreal.ca>
 
 	* emacs-lisp/macroexp.el (macroexp--expand-all): Only autoload

=== modified file 'lisp/info.el'
--- lisp/info.el	2012-06-08 04:23:26 +0000
+++ lisp/info.el	2012-06-09 03:16:29 +0000
@@ -2914,48 +2914,58 @@
 	(select-window (posn-window (event-start e))))
     (Info-scroll-down)))
 
-(defun Info-next-reference (&optional recur)
-  "Move cursor to the next cross-reference or menu item in the node."
-  (interactive)
-  (let ((pat "\\*note[ \n\t]+\\([^:]+\\):\\|^\\* .*:\\|[hf]t?tps?://")
-	(old-pt (point))
-	(case-fold-search t))
-    (or (eobp) (forward-char 1))
-    (or (re-search-forward pat nil t)
-	(progn
-	  (goto-char (point-min))
-	  (or (re-search-forward pat nil t)
-	      (progn
-		(goto-char old-pt)
-		(user-error "No cross references in this node")))))
-    (goto-char (or (match-beginning 1) (match-beginning 0)))
-    (if (looking-at "\\* Menu:")
-	(if recur
-	    (user-error "No cross references in this node")
-	  (Info-next-reference t))
-      (if (looking-at "^\\* ")
-	  (forward-char 2)))))
+(defun Info-next-reference (&optional recur count)
+  "Move cursor to the next cross-reference or menu item in the node.
+If COUNT is non-nil (interactively with a prefix arg), jump over
+COUNT cross-references."
+  (interactive "i\np")
+  (unless count
+    (setq count 1))
+  (while (unless (zerop count) (setq count (1- count)))
+    (let ((pat "\\*note[ \n\t]+\\([^:]+\\):\\|^\\* .*:\\|[hf]t?tps?://")
+	  (old-pt (point))
+	  (case-fold-search t))
+      (or (eobp) (forward-char 1))
+      (or (re-search-forward pat nil t)
+	  (progn
+	    (goto-char (point-min))
+	    (or (re-search-forward pat nil t)
+		(progn
+		  (goto-char old-pt)
+		  (user-error "No cross references in this node")))))
+      (goto-char (or (match-beginning 1) (match-beginning 0)))
+      (if (looking-at "\\* Menu:")
+	  (if recur
+	      (user-error "No cross references in this node")
+	    (Info-next-reference t))
+	(if (looking-at "^\\* ")
+	    (forward-char 2))))))
 
-(defun Info-prev-reference (&optional recur)
-  "Move cursor to the previous cross-reference or menu item in the node."
-  (interactive)
-  (let ((pat "\\*note[ \n\t]+\\([^:]+\\):\\|^\\* .*:\\|[hf]t?tps?://")
-	(old-pt (point))
-	(case-fold-search t))
-    (or (re-search-backward pat nil t)
-	(progn
-	  (goto-char (point-max))
-	  (or (re-search-backward pat nil t)
-	      (progn
-		(goto-char old-pt)
-		(user-error "No cross references in this node")))))
-    (goto-char (or (match-beginning 1) (match-beginning 0)))
-    (if (looking-at "\\* Menu:")
-	(if recur
-	    (user-error "No cross references in this node")
-	  (Info-prev-reference t))
-      (if (looking-at "^\\* ")
-	  (forward-char 2)))))
+(defun Info-prev-reference (&optional recur count)
+  "Move cursor to the previous cross-reference or menu item in the node.
+If COUNT is non-nil (interactively with a prefix arg), jump over
+COUNT cross-references."
+  (interactive "i\np")
+  (unless count
+    (setq count 1))
+  (while (unless (zerop count) (setq count (1- count)))
+    (let ((pat "\\*note[ \n\t]+\\([^:]+\\):\\|^\\* .*:\\|[hf]t?tps?://")
+	  (old-pt (point))
+	  (case-fold-search t))
+      (or (re-search-backward pat nil t)
+	  (progn
+	    (goto-char (point-max))
+	    (or (re-search-backward pat nil t)
+		(progn
+		  (goto-char old-pt)
+		  (user-error "No cross references in this node")))))
+      (goto-char (or (match-beginning 1) (match-beginning 0)))
+      (if (looking-at "\\* Menu:")
+	  (if recur
+	      (user-error "No cross references in this node")
+	    (Info-prev-reference t))
+	(if (looking-at "^\\* ")
+	    (forward-char 2))))))
 \f
 (defvar Info-index-nodes nil
   "Alist of cached index node names of visited Info files.


[-- Attachment #3: Type: text/plain, Size: 21 bytes --]


        Christopher

^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2013-02-01 17:01 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-06-09  3:41 bug#11656: 24.1.50; Info-\(next\|prev\)-reference: Add numeric prefix argument Christopher Schmidt
2012-06-09  6:49 ` Eli Zaretskii
2012-06-09  7:25   ` Christopher Schmidt
2012-06-09  7:46     ` Eli Zaretskii
2012-06-09  7:59       ` Christopher Schmidt
2012-06-11 23:52         ` Juri Linkov
2012-06-24 15:15           ` Christopher Schmidt
2012-06-24 15:23             ` Christopher Schmidt
2013-01-13  8:55     ` Christopher Schmidt
2013-01-15 14:02       ` Stefan Monnier
2013-02-01 17:01         ` Christopher Schmidt

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).