emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Nicolas Girard <nicolas.girard@nerim.net>
To: emacs-orgmode@gnu.org
Subject: org-follow-link-in-same-window
Date: Sat, 27 Jun 2009 10:41:52 +0200	[thread overview]
Message-ID: <51b0095d0906270141s598f5a8fq8aac0f928cccf10d@mail.gmail.com> (raw)


[-- Attachment #1.1: Type: text/plain, Size: 1637 bytes --]

Hi all,
when clicking on a link, I whish I could choose between
- following it in another window (the current behaviour, which I'm often
fine with, but not always);
- following it in the same window

I tried to create a new function, org-follow-link-in-same-window, and bind
it to a key.

As for the key binding, I couldn't get down-mouse-2 to work, as initially
expected. I tried the following bindings:

(add-hook 'org-load-hook
      '(lambda ()
         (define-key org-mouse-map [C-down-mouse-1]
'org-follow-link-in-same-window)
         (define-key org-mouse-map [down-mouse-2]
'org-follow-link-in-same-window)
         (define-key org-mouse-map [C-down-mouse-2]
'org-follow-link-in-same-window)
         (define-key org-mouse-map [s-down-mouse-1]
'org-follow-link-in-same-window)
         (define-key org-mouse-map [s-mouse-1]
'org-follow-link-in-same-window)))

I found none of them to work *but* the latest, [s-mouse-1].
(I'm not fond of incantations, so when emacs leaves me under the impression
that some kind of black magic is happening, I always feel a little upset.
Anyway, i'm digressing, and after all I'm fine with [s-mouse-1].)

Now, as for the function, I came to the following:

(defun org-follow-link-in-same-window (ev)
  (interactive "e")
  (let ((org-display-internal-link-with-indirect-buffer t))
    (save-excursion
      (set-buffer (window-buffer (posn-window (event-end ev))))
    (select-window (posn-window (event-end ev)))
    (org-open-at-mouse ev)))

which doesn't work. I mean, it does follow the link, but not in the same
window.

Could you please give me a hand on this ?

Thanks in advance,
Nicolas

[-- Attachment #1.2: Type: text/html, Size: 1846 bytes --]

[-- Attachment #2: Type: text/plain, Size: 204 bytes --]

_______________________________________________
Emacs-orgmode mailing list
Remember: use `Reply All' to send replies to the list.
Emacs-orgmode@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode

             reply	other threads:[~2009-06-27  8:41 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-06-27  8:41 Nicolas Girard [this message]
2009-06-27  9:38 ` org-follow-link-in-same-window Carsten Dominik
2009-06-27 10:25   ` org-follow-link-in-same-window Nicolas Girard

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.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=51b0095d0906270141s598f5a8fq8aac0f928cccf10d@mail.gmail.com \
    --to=nicolas.girard@nerim.net \
    --cc=emacs-orgmode@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/org-mode.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).