* 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
* bug#11656: 24.1.50; Info-\(next\|prev\)-reference: Add numeric prefix argument
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
0 siblings, 1 reply; 11+ messages in thread
From: Eli Zaretskii @ 2012-06-09 6:49 UTC (permalink / raw)
To: Christopher Schmidt; +Cc: 11656
> From: Christopher Schmidt <christopher@ch.ristopher.com>
> 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.
^ permalink raw reply [flat|nested] 11+ messages in thread
* bug#11656: 24.1.50; Info-\(next\|prev\)-reference: Add numeric prefix argument
2012-06-09 6:49 ` Eli Zaretskii
@ 2012-06-09 7:25 ` Christopher Schmidt
2012-06-09 7:46 ` Eli Zaretskii
2013-01-13 8:55 ` Christopher Schmidt
0 siblings, 2 replies; 11+ messages in thread
From: Christopher Schmidt @ 2012-06-09 7:25 UTC (permalink / raw)
To: 11656
[-- Attachment #1: Type: text/plain, Size: 1378 bytes --]
Eli Zaretskii <eliz@gnu.org> writes:
>> From: Christopher Schmidt <christopher@ch.ristopher.com>
>> 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 <tab>) with Info-forward-node (bound to
]).
Pressing <tab> 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 <tab>. 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.
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: Info-nextprev-reference-v2.diff --]
[-- Type: text/x-diff, Size: 4212 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 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)))))))
\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
* bug#11656: 24.1.50; Info-\(next\|prev\)-reference: Add numeric prefix argument
2012-06-09 7:25 ` Christopher Schmidt
@ 2012-06-09 7:46 ` Eli Zaretskii
2012-06-09 7:59 ` Christopher Schmidt
2013-01-13 8:55 ` Christopher Schmidt
1 sibling, 1 reply; 11+ messages in thread
From: Eli Zaretskii @ 2012-06-09 7:46 UTC (permalink / raw)
To: Christopher Schmidt; +Cc: 11656
> From: Christopher Schmidt <christopher@ch.ristopher.com>
> Date: Sat, 9 Jun 2012 08:25:29 +0100 (BST)
>
> > 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 <tab>) with Info-forward-node (bound to
> ]).
Yes, I did, sorry.
So you are saying that you frequently count the number of
cross-references to the one you want, and then type "C-u 10 TAB" or
some such?
^ permalink raw reply [flat|nested] 11+ messages in thread
* bug#11656: 24.1.50; Info-\(next\|prev\)-reference: Add numeric prefix argument
2012-06-09 7:46 ` Eli Zaretskii
@ 2012-06-09 7:59 ` Christopher Schmidt
2012-06-11 23:52 ` Juri Linkov
0 siblings, 1 reply; 11+ messages in thread
From: Christopher Schmidt @ 2012-06-09 7:59 UTC (permalink / raw)
To: 11656
Eli Zaretskii <eliz@gnu.org> writes:
> So you are saying that you frequently count the number of
> cross-references to the one you want, and then type "C-u 10 TAB" or
> some such?
Yes.
If the number of cross-references is greater than 10, I estimate. That
is, I use C-u C-u TAB and then continue with TAB or M-TAB. In the end
this is a lot easier and faster than using the mouse,
Info-virtual-index, etc.
Christopher
^ permalink raw reply [flat|nested] 11+ messages in thread
* bug#11656: 24.1.50; Info-\(next\|prev\)-reference: Add numeric prefix argument
2012-06-09 7:59 ` Christopher Schmidt
@ 2012-06-11 23:52 ` Juri Linkov
2012-06-24 15:15 ` Christopher Schmidt
0 siblings, 1 reply; 11+ messages in thread
From: Juri Linkov @ 2012-06-11 23:52 UTC (permalink / raw)
To: 11656
>> So you are saying that you frequently count the number of
>> cross-references to the one you want, and then type "C-u 10 TAB" or
>> some such?
>
> Yes.
>
> If the number of cross-references is greater than 10, I estimate. That
> is, I use C-u C-u TAB and then continue with TAB or M-TAB. In the end
> this is a lot easier and faster than using the mouse,
To choose a menu item by its number is possible by typing
`1', `2', `3', ..., `9'. But to help the user to select
the right number, every third `*' in the menu is highlighted
with the special face `info-menu-star'.
I wonder if it's possible to use a similar indication for references?
In any case, I think your patch is useful. If a node begins with the menu
(so there are no references before the menu beginning), menu indications
will help to give the right argument to `Info-next-reference' to arrive
to the reference of the menu item.
^ permalink raw reply [flat|nested] 11+ messages in thread
* bug#11656: 24.1.50; Info-\(next\|prev\)-reference: Add numeric prefix argument
2012-06-11 23:52 ` Juri Linkov
@ 2012-06-24 15:15 ` Christopher Schmidt
2012-06-24 15:23 ` Christopher Schmidt
0 siblings, 1 reply; 11+ messages in thread
From: Christopher Schmidt @ 2012-06-24 15:15 UTC (permalink / raw)
To: 11656
Juri Linkov <juri@jurta.org> writes:
> To choose a menu item by its number is possible by typing
> `1', `2', `3', ..., `9'. But to help the user to select
> the right number, every third `*' in the menu is highlighted
> with the special face `info-menu-star'.
>
> I wonder if it's possible to use a similar indication for references?
Well, menu items a densely packed whereas regular cross references are
usually spread around the node. I think this is not exactly helpful.
> In any case, I think your patch is useful. If a node begins with the
> menu (so there are no references before the menu beginning), menu
> indications will help to give the right argument to
> `Info-next-reference' to arrive to the reference of the menu item.
Thank you.
Is my second patch OK to commit?
Christopher
^ permalink raw reply [flat|nested] 11+ messages in thread
* bug#11656: 24.1.50; Info-\(next\|prev\)-reference: Add numeric prefix argument
2012-06-24 15:15 ` Christopher Schmidt
@ 2012-06-24 15:23 ` Christopher Schmidt
0 siblings, 0 replies; 11+ messages in thread
From: Christopher Schmidt @ 2012-06-24 15:23 UTC (permalink / raw)
To: 11656
Christopher Schmidt <christopher@ch.ristopher.com> writes:
> Is my second patch OK to commit?
I'd cross-reference this bug report in the ChangeLog of course...
Christopher
^ permalink raw reply [flat|nested] 11+ messages in thread
* bug#11656: 24.1.50; Info-\(next\|prev\)-reference: Add numeric prefix argument
2012-06-09 7:25 ` Christopher Schmidt
2012-06-09 7:46 ` Eli Zaretskii
@ 2013-01-13 8:55 ` Christopher Schmidt
2013-01-15 14:02 ` Stefan Monnier
1 sibling, 1 reply; 11+ messages in thread
From: Christopher Schmidt @ 2013-01-13 8:55 UTC (permalink / raw)
To: 11656
Christopher Schmidt <christopher@ch.ristopher.com> writes:
> Here is an improved version of my patch that also handles negative
> prefix arguments correctly.
Ping?
It would be great if someone applied this patch or got me green light so
I can apply it myself.
Christopher
^ permalink raw reply [flat|nested] 11+ messages in thread
* bug#11656: 24.1.50; Info-\(next\|prev\)-reference: Add numeric prefix argument
2013-01-13 8:55 ` Christopher Schmidt
@ 2013-01-15 14:02 ` Stefan Monnier
2013-02-01 17:01 ` Christopher Schmidt
0 siblings, 1 reply; 11+ messages in thread
From: Stefan Monnier @ 2013-01-15 14:02 UTC (permalink / raw)
To: 11656
>> Here is an improved version of my patch that also handles negative
>> prefix arguments correctly.
> Ping?
> It would be great if someone applied this patch or got me green light so
> I can apply it myself.
Sure, go ahead,
Stefan
^ permalink raw reply [flat|nested] 11+ messages in thread
* bug#11656: 24.1.50; Info-\(next\|prev\)-reference: Add numeric prefix argument
2013-01-15 14:02 ` Stefan Monnier
@ 2013-02-01 17:01 ` Christopher Schmidt
0 siblings, 0 replies; 11+ messages in thread
From: Christopher Schmidt @ 2013-02-01 17:01 UTC (permalink / raw)
To: 11656-done
Stefan Monnier <monnier@iro.umontreal.ca> writes:
>> It would be great if someone applied this patch or got me green light
>> so I can apply it myself.
>
> Sure, go ahead,
Installed in trunk.
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 external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.