From: "Drew Adams" <drew.adams@oracle.com>
To: <emacs-devel@gnu.org>
Subject: info.el patch to open node in new window [was: generate 3) S-mouse-2: follow link in new window]
Date: Tue, 25 Sep 2007 16:39:26 -0700 [thread overview]
Message-ID: <BNELLINCGFJLDJIKDGACAECMCDAA.drew.adams@oracle.com> (raw)
In-Reply-To: <BNELLINCGFJLDJIKDGACOEABCDAA.drew.adams@oracle.com>
[-- Attachment #1: Type: text/plain, Size: 1738 bytes --]
> > > (defun Info-mouse-follow-nearest-node-new-window (click)
> > > "Open the link at the mouse pointer in a new window."
> > > (interactive "e")
> > > (Info-mouse-follow-nearest-node click t)) ; t no good now
> > >
> > > But that particular implementation no longer works, because
> > > someone over the course of Emacs 22 development removed the
> > > optional FORK argument to `Info-follow-nearest-node' and
> > > `Info-mouse-follow-nearest-node'. (Why?)
> >
> > `Info-mouse-follow-nearest-node' never had the FORK argument.
> > `Info-follow-nearest-node' still has it, but there were plans to
> > remove it.
>
> You're right, on both counts. I think I left in the above code hoping that
> FORK would be added in response to my request for it: 2006-01-08, Subject
> "Info-mouse-follow-nearest-node should take prefix arg to fork". I had
> forgotten that thread. Richard's response was to wait until after the
> release (22). Your response was that FORK was a deprecated feature
> (presumably you were referring to the non-mouse command).
I was wrong. I had forgotten that I had (trivially) redefined
`Info-mouse-follow-nearest-node' to accept the optional FORK arg and pass it
to `Info-try-follow-nearest-node'. The reason my code was no longer working
was that I had made another, conflicting mouse binding elsewhere - my bad.
It works fine now. Attached are patches for info.el and etc/NEWS to add
these two commands:
* Info-follow-nearest-node-other-window
* Info-mouse-follow-nearest-node-other-window
It binds the former to `S-RET' and the latter to `S-down-mouse-2'.
Change log entry:
* info.el (Info-follow-nearest-node)
(Info-mouse-follow-nearest-node): New commands,
bound to S-RET, S-down-mouse-2.
[-- Attachment #2: info-2007-09-25.patch --]
[-- Type: application/octet-stream, Size: 3337 bytes --]
*** info-CVS-2007-09-25.el Tue Sep 25 16:07:54 2007
--- info-patched-2007-09-25.el Tue Sep 25 16:14:40 2007
***************
*** 3079,3094 ****
(t
(error "No %s around position %d" errorstring pos))))))))
! (defun Info-mouse-follow-nearest-node (click)
"\\<Info-mode-map>Follow a node reference near point.
! Like \\[Info-menu], \\[Info-follow-reference], \\[Info-next], \\[Info-prev] or \\[Info-up] command, depending on where you click.
! At end of the node's text, moves to the next node, or up if none."
! (interactive "e")
(mouse-set-point click)
! (and (not (Info-try-follow-nearest-node))
(save-excursion (forward-line 1) (eobp))
(Info-next-preorder)))
(defun Info-follow-nearest-node (&optional fork)
"Follow a node reference near point.
If point is on a reference, follow that reference. Otherwise,
--- 3079,3102 ----
(t
(error "No %s around position %d" errorstring pos))))))))
! (defun Info-mouse-follow-nearest-node (click &optional fork)
"\\<Info-mode-map>Follow a node reference near point.
! Like \\[Info-menu], \\[Info-follow-reference], \\[Info-next], \\[Info-prev] or \\[Info-up] \
! command, depending on where you click.
! At end of the node's text, moves to the next node, or up if none.
!
! With a prefix argument, open the node in a separate window."
! (interactive "e\nP")
(mouse-set-point click)
! (and (not (Info-try-follow-nearest-node fork))
(save-excursion (forward-line 1) (eobp))
(Info-next-preorder)))
+ (defun Info-mouse-follow-nearest-node-new-window (click)
+ "Open the link at the mouse pointer in a new window."
+ (interactive "e")
+ (Info-mouse-follow-nearest-node click t))
+
(defun Info-follow-nearest-node (&optional fork)
"Follow a node reference near point.
If point is on a reference, follow that reference. Otherwise,
***************
*** 3111,3116 ****
--- 3119,3129 ----
t)))
(error "Point neither on reference nor in menu item description")))
+ (defun Info-follow-nearest-node-new-window ()
+ "Open the link near the text cursor in a new window."
+ (interactive)
+ (Info-follow-nearest-node t))
+
;; Common subroutine.
(defun Info-try-follow-nearest-node (&optional fork)
"Follow a node reference near point. Return non-nil if successful.
***************
*** 3151,3156 ****
--- 3164,3170 ----
(define-key Info-mode-map "." 'beginning-of-buffer)
(define-key Info-mode-map " " 'Info-scroll-up)
(define-key Info-mode-map "\C-m" 'Info-follow-nearest-node)
+ (define-key Info-mode-map [S-return] 'Info-follow-nearest-node-new-window)
(define-key Info-mode-map "\t" 'Info-next-reference)
(define-key Info-mode-map "\e\t" 'Info-prev-reference)
(define-key Info-mode-map [(shift tab)] 'Info-prev-reference)
***************
*** 3200,3205 ****
--- 3214,3220 ----
(define-key Info-mode-map "," 'Info-index-next)
(define-key Info-mode-map "\177" 'Info-scroll-down)
(define-key Info-mode-map [mouse-2] 'Info-mouse-follow-nearest-node)
+ (define-key Info-mode-map [S-down-mouse-2] 'Info-mouse-follow-nearest-node-new-window)
(define-key Info-mode-map [follow-link] 'mouse-face)
)
Diff finished. Tue Sep 25 16:17:34 2007
[-- Attachment #3: NEWS-23-2007-09-25.patch --]
[-- Type: application/octet-stream, Size: 624 bytes --]
*** NEWS-23-2007-09-25.txt Tue Sep 25 16:30:12 2007
--- NEWS-23-2007-09-25-patched.txt Tue Sep 25 16:35:12 2007
***************
*** 97,102 ****
--- 97,107 ----
** The new command `display-time-world' starts an updating time display
using several time zones, in a buffer.
+ ** Info mode has new commands
+ Info-follow-nearest-node-other-window and
+ Info-mouse-follow-nearest-node-other-window, bound to S-RET and
+ S-down-mouse-2, respectively.
+ \f
* Startup Changes in Emacs 23.1
** New user option `initial-buffer-choice' specifies what to display
Diff finished. Tue Sep 25 16:35:43 2007
[-- Attachment #4: Type: text/plain, Size: 142 bytes --]
_______________________________________________
Emacs-devel mailing list
Emacs-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-devel
next prev parent reply other threads:[~2007-09-25 23:39 UTC|newest]
Thread overview: 43+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-09-23 9:47 generate 1) virtual index and 2) other pages for Info; 3) S-mouse-2: follow link in new window Drew Adams
2007-09-23 11:09 ` Bastien
2007-09-23 12:03 ` generate 2) other pages for Info Juri Linkov
2007-09-23 12:38 ` Lennart Borgman (gmail)
2007-09-23 14:17 ` Bastien
2007-09-23 19:18 ` Eli Zaretskii
2007-09-24 0:27 ` Bastien
2007-09-23 21:54 ` Richard Stallman
2007-09-23 11:41 ` generate 1) virtual index Juri Linkov
2007-09-23 16:43 ` Drew Adams
2007-09-23 20:42 ` Juri Linkov
2007-09-24 7:09 ` Drew Adams
2007-09-23 11:45 ` generate 2) other pages for Info Juri Linkov
2007-09-23 12:00 ` generate 3) S-mouse-2: follow link in new window Juri Linkov
2007-09-23 16:44 ` Drew Adams
2007-09-23 19:14 ` Lennart Borgman (gmail)
2007-09-23 20:42 ` Drew Adams
2007-09-24 0:20 ` Johan Bockgård
2007-09-24 1:22 ` Stefan Monnier
2007-09-24 2:01 ` Drew Adams
2007-09-24 18:20 ` Richard Stallman
2007-09-27 21:21 ` Drew Adams
2007-09-27 21:34 ` David Kastrup
2007-09-27 21:34 ` Stefan Monnier
2007-09-27 21:41 ` Drew Adams
2007-09-27 21:53 ` Drew Adams
2007-09-28 19:04 ` Richard Stallman
2007-09-28 19:33 ` Drew Adams
2007-09-28 22:22 ` David Kastrup
2007-09-30 2:19 ` Drew Adams
2007-09-30 8:54 ` David Kastrup
2007-09-30 23:37 ` Drew Adams
2007-09-30 23:49 ` David Kastrup
2007-10-01 1:36 ` Richard Stallman
2007-09-25 23:39 ` Drew Adams [this message]
2007-09-26 8:56 ` info.el patch to open node in new window [was: generate 3) S-mouse-2: follow link in new window] Juri Linkov
2007-09-26 15:02 ` Drew Adams
2007-09-29 22:44 ` info.el patch to open node in new window Juri Linkov
2007-09-30 2:19 ` Drew Adams
2007-09-29 22:41 ` generate 3) S-mouse-2: follow link " Juri Linkov
2007-09-30 2:19 ` Drew Adams
2007-09-29 22:43 ` Juri Linkov
2007-09-30 2:18 ` Drew Adams
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=BNELLINCGFJLDJIKDGACAECMCDAA.drew.adams@oracle.com \
--to=drew.adams@oracle.com \
--cc=emacs-devel@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).