From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Christopher Schmidt Newsgroups: gmane.emacs.bugs Subject: bug#11656: 24.1.50; Info-\(next\|prev\)-reference: Add numeric prefix argument Date: Sat, 9 Jun 2012 08:25:29 +0100 (BST) Message-ID: <874nqleylg@ch.ristopher.com> References: <877gvh5f0k@ch.ristopher.com> <83vcj1t1xb.fsf@gnu.org> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Trace: dough.gmane.org 1339226807 24055 80.91.229.3 (9 Jun 2012 07:26:47 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Sat, 9 Jun 2012 07:26:47 +0000 (UTC) To: 11656@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sat Jun 09 09:26:46 2012 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1SdG4L-0003m5-JP for geb-bug-gnu-emacs@m.gmane.org; Sat, 09 Jun 2012 09:26:45 +0200 Original-Received: from localhost ([::1]:34250 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SdG4L-0008S2-Do for geb-bug-gnu-emacs@m.gmane.org; Sat, 09 Jun 2012 03:26:45 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:36626) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SdG4H-0008RD-J1 for bug-gnu-emacs@gnu.org; Sat, 09 Jun 2012 03:26:43 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SdG4F-0000V2-HJ for bug-gnu-emacs@gnu.org; Sat, 09 Jun 2012 03:26:41 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:54386) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SdG4F-0000Uw-BM for bug-gnu-emacs@gnu.org; Sat, 09 Jun 2012 03:26:39 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.72) (envelope-from ) id 1SdG6Y-0002dr-Dm for bug-gnu-emacs@gnu.org; Sat, 09 Jun 2012 03:29:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Christopher Schmidt Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 09 Jun 2012 07:29:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 11656 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.133922689010098 (code B ref -1); Sat, 09 Jun 2012 07:29:02 +0000 Original-Received: (at submit) by debbugs.gnu.org; 9 Jun 2012 07:28:10 +0000 Original-Received: from localhost ([127.0.0.1]:35699 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1SdG5f-0002cm-TN for submit@debbugs.gnu.org; Sat, 09 Jun 2012 03:28:10 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:53861) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1SdG5c-0002ce-6w for submit@debbugs.gnu.org; Sat, 09 Jun 2012 03:28:05 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SdG3G-0000Fr-5Z for submit@debbugs.gnu.org; Sat, 09 Jun 2012 03:25:40 -0400 Original-Received: from lists.gnu.org ([208.118.235.17]:43250) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SdG3F-0000Fl-Vn for submit@debbugs.gnu.org; Sat, 09 Jun 2012 03:25:38 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:36375) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SdG3E-00086U-0s for bug-gnu-emacs@gnu.org; Sat, 09 Jun 2012 03:25:37 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SdG3B-0000F8-Pk for bug-gnu-emacs@gnu.org; Sat, 09 Jun 2012 03:25:35 -0400 Original-Received: from ristopher.com ([146.185.21.93]:34434 helo=saturn.ch.ristopher.com) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SdG3B-0000Es-9k for bug-gnu-emacs@gnu.org; Sat, 09 Jun 2012 03:25:33 -0400 Original-Received: by saturn.ch.ristopher.com (Postfix, from userid 0) id 7ED77202D5; Sat, 9 Jun 2012 08:25:29 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=ch.ristopher.com; s=mail; t=1339226729; bh=FA1/raQIaqc96x53F0+cB/OsL4zbT7WQjB1wIqGrn3o=; h=From:To:Subject:In-Reply-To:References:Message-ID:MIME-Version: Content-Type:Date; b=hhLeASWUCVv3vSH4Pub54H7hHSdzgiV7UIyq4eDQo0mQoVINnqRVVMzquWDfiZrl8 qpi5KIXEL9QjMktJRHJfwQAcoGzEZbDQ6M4X1rrD0NsQxPYSBmvYu2pY8WUi6MqN4h iIXuBfLAev3QWv/B3Iy6XFxbBpjRGswbEGXMh4ck= In-Reply-To: <83vcj1t1xb.fsf@gnu.org> (Eli Zaretskii's message of "Sat, 09 Jun 2012 09:49:36 +0300") Mail-Followup-To: bug-gnu-emacs@gnu.org X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6, seldom 2.4 (older, 4) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) X-Received-From: 140.186.70.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:60794 Archived-At: --=-=-= Content-Type: text/plain Eli Zaretskii writes: >> From: Christopher Schmidt >> Date: Sat, 9 Jun 2012 04:41:16 +0100 (BST) >> >> 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. > > Thanks. Can you present a use case where this functionality is > needed? Specifically, I wonder how a user would know how many Next or > Prev nodes she needs to go to get to whatever she is looking for. ^^^^^ Uhm, Info-next-reference and Info-prev-reference navigate within the cross references in the current buffer. I think you mistake Info-next-reference (bound to ) with Info-forward-node (bound to ]). Pressing in combination with a prefix argument is just a lot easier, faster and less intrusive than the use of any regular movement commands or a repeated pressing of . A prefix argument that specifies the repeat count is also pretty consistent with most other movement commands, especially forward-button. To me, this is The Right Thing. At least this is what my subconscious, which takes over when I navigate within the first three nodes after pressing C-h i, told me. Here is an improved version of my patch that also handles negative prefix arguments correctly. --=-=-= Content-Type: text/x-diff Content-Disposition: attachment; filename=Info-nextprev-reference-v2.diff === 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 + + * info.el (Info-next-reference, Info-prev-reference): Add numeric + prefix argument. + 2012-06-09 Stefan Monnier * 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 07:09:28 +0000 @@ -2914,48 +2914,62 @@ (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)) + (if (< count 0) + (Info-prev-reference recur (- count)) + (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)) + (if (< count 0) + (Info-next-reference recur (- count)) + (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))))))) (defvar Info-index-nodes nil "Alist of cached index node names of visited Info files. --=-=-= Content-Type: text/plain Christopher --=-=-=--