unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* Double-click opens the wrong file
@ 2017-11-01  3:07 Nick Helm
  2017-11-01  3:26 ` Drew Adams
  2017-11-01  3:49 ` Eli Zaretskii
  0 siblings, 2 replies; 6+ messages in thread
From: Nick Helm @ 2017-11-01  3:07 UTC (permalink / raw)
  To: help-emacs

Occasionally, when I double click a file to edit it, Emacs will visit a
different file instead.

Repeated double clicking visits a succession of incorrect files, until
Emacs eventually settles on the right one.

The files are all ones I have been working with recently, although not
necessarily in Emacs. The visited file need not be in the same location
or even exist at all – Emacs will quite happily visit a recently deleted
file.

Only double clicking files associated with Emacs (26.0.90) seems to be
affected. Visiting with find-file, drag and drop, and the menu-bar, as
well as other versions of Emacs, have the expected behaviour.

I would open a bug, but it feels like an OS problem (I'm on macOS
10.12.6), rather than a flaw in Emacs.

Any ideas what's going on or how to fix/debug this issue?



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

* RE: Double-click opens the wrong file
  2017-11-01  3:07 Double-click opens the wrong file Nick Helm
@ 2017-11-01  3:26 ` Drew Adams
  2017-11-01  7:53   ` Nick Helm
  2017-11-01  3:49 ` Eli Zaretskii
  1 sibling, 1 reply; 6+ messages in thread
From: Drew Adams @ 2017-11-01  3:26 UTC (permalink / raw)
  To: Nick Helm, help-emacs

> Occasionally, when I double click a file to edit it, Emacs will visit a
> different file instead.
> 
> Repeated double clicking visits a succession of incorrect files, until
> Emacs eventually settles on the right one.
> 
> The files are all ones I have been working with recently, although not
> necessarily in Emacs. The visited file need not be in the same location
> or even exist at all – Emacs will quite happily visit a recently deleted
> file.
> 
> Only double clicking files associated with Emacs (26.0.90) seems to be
> affected. Visiting with find-file, drag and drop, and the menu-bar, as
> well as other versions of Emacs, have the expected behaviour.
> 
> I would open a bug, but it feels like an OS problem (I'm on macOS
> 10.12.6), rather than a flaw in Emacs.
> 
> Any ideas what's going on or how to fix/debug this issue?

One place to start is to use `C-h k' and then double-click
wherever you notice the problem.  That should at least tell
you what Emacs command is being invoked by that double-click.



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

* Re: Double-click opens the wrong file
  2017-11-01  3:07 Double-click opens the wrong file Nick Helm
  2017-11-01  3:26 ` Drew Adams
@ 2017-11-01  3:49 ` Eli Zaretskii
  2017-11-01  7:27   ` Nick Helm
  1 sibling, 1 reply; 6+ messages in thread
From: Eli Zaretskii @ 2017-11-01  3:49 UTC (permalink / raw)
  To: help-gnu-emacs

> From: Nick Helm <nick@tenpoint.co.nz>
> Date: Wed, 01 Nov 2017 16:07:04 +1300
> 
> Occasionally, when I double click a file to edit it, Emacs will visit a
> different file instead.

Please tell how you set this up, and in what application do you
double-click on a file to have it visited in Emacs.

Also, is the file actually visited displayed near the name you clicked
on, or is it entirely unrelated?

IOW, please add details.

Thanks.



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

* Re: Double-click opens the wrong file
  2017-11-01  3:49 ` Eli Zaretskii
@ 2017-11-01  7:27   ` Nick Helm
  2017-11-01 19:38     ` Eli Zaretskii
  0 siblings, 1 reply; 6+ messages in thread
From: Nick Helm @ 2017-11-01  7:27 UTC (permalink / raw)
  To: help-gnu-emacs

On Wed,  1 Nov 2017, Eli Zaretskii wrote:

>> Occasionally, when I double click a file to edit it, Emacs will visit
>> a different file instead.
>
> Please tell how you set this up, and in what application do you
> double-click on a file to have it visited in Emacs.
>
> Also, is the file actually visited displayed near the name you clicked
> on, or is it entirely unrelated?
>
> IOW, please add details.

Sorry, I should have been much clearer.

The issue occurs when I double click a file on my desktop or in a file
browser window. That is, I click on a file within the OS and rely on the
OS's file association mechanism to visit the file in Emacs.

I can reproduce the issue with this generalised recipe:

+ Launch Emacs using the GUI bundle Emacs.app
+ Within Emacs, find-file ~/work/file1.org. Edit, save, kill.
+ Within Emacs, find-file ~/config/file2.txt. Edit, save, kill.
+ With the mouse, click on the OS desktop. Emacs loses focus.
+ On the desktop, double click file3.el (~/Desktop/file3.el).
+ Focus returns to Emacs. Emacs visits file1.org.
+ Return to the desktop and again double click file3.el.
+ Emacs gains focus and visits file2.txt.
+ Double click file3.el a third time.
+ Emacs gains focus and opens file3.el as expected.

The file that actually opens following the double click is not logically
or physically close to (in file-system or GUI terms) the clicked file.
They are chronologically linked, however – that is, they are visited in
the same order as my original edits.

Thanks.



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

* Re: Double-click opens the wrong file
  2017-11-01  3:26 ` Drew Adams
@ 2017-11-01  7:53   ` Nick Helm
  0 siblings, 0 replies; 6+ messages in thread
From: Nick Helm @ 2017-11-01  7:53 UTC (permalink / raw)
  To: Drew Adams; +Cc: help-emacs

On Wed,  1 Nov 2017 at 16:26:56 +1300, Drew Adams wrote:

>> Occasionally, when I double click a file to edit it, Emacs will visit
>> a different file instead.
>
> One place to start is to use `C-h k' and then double-click wherever
> you notice the problem. That should at least tell you what Emacs
> command is being invoked by that double-click.

That's good advice. I had no idea C-h k could capture incoming events
from the OS...

Priming C-h k and double clicking a file on the desktop points me toward
`ns-open-file-select-line' which is bound to <ns-open-file-line>. I
guess the latter is the incoming event.

The docstring also mentions `ns-input-file', which looks like it
contains the name of the file from the incoming event. The next time the
issue occurs, this will be one to watch.

Thanks.



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

* Re: Double-click opens the wrong file
  2017-11-01  7:27   ` Nick Helm
@ 2017-11-01 19:38     ` Eli Zaretskii
  0 siblings, 0 replies; 6+ messages in thread
From: Eli Zaretskii @ 2017-11-01 19:38 UTC (permalink / raw)
  To: help-gnu-emacs

> From: Nick Helm <nick@tenpoint.co.nz>
> Date: Wed, 01 Nov 2017 20:27:08 +1300
> 
> + Launch Emacs using the GUI bundle Emacs.app
> + Within Emacs, find-file ~/work/file1.org. Edit, save, kill.
> + Within Emacs, find-file ~/config/file2.txt. Edit, save, kill.
> + With the mouse, click on the OS desktop. Emacs loses focus.
> + On the desktop, double click file3.el (~/Desktop/file3.el).
> + Focus returns to Emacs. Emacs visits file1.org.
> + Return to the desktop and again double click file3.el.
> + Emacs gains focus and visits file2.txt.
> + Double click file3.el a third time.
> + Emacs gains focus and opens file3.el as expected.
> 
> The file that actually opens following the double click is not logically
> or physically close to (in file-system or GUI terms) the clicked file.
> They are chronologically linked, however – that is, they are visited in
> the same order as my original edits.

Please report this as a bug, so that our NS experts could take care of
this.

Thanks.



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

end of thread, other threads:[~2017-11-01 19:38 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-11-01  3:07 Double-click opens the wrong file Nick Helm
2017-11-01  3:26 ` Drew Adams
2017-11-01  7:53   ` Nick Helm
2017-11-01  3:49 ` Eli Zaretskii
2017-11-01  7:27   ` Nick Helm
2017-11-01 19:38     ` Eli Zaretskii

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).