Finder service not working in Aquamacs

40 views
Skip to first unread message

Robert Goldman

unread,
Jan 15, 2020, 2:32:12 PM1/15/20
to Development of Aquamacs Emacs

I have Aquamacs as follows:

Aquamacs 3.5 GNU Emacs 25.3.50.1 (x86_64-apple-darwin16.7.0, NS appkit-1504.83 Version 10.12.6 (Build 16G2016))
dated 2019-08-18 rev. 70b7398da506a9a53867909fa12e5cb3a07ba5c9
Copyright (C) 2017 Free Software Foundation, Inc.

Running on Catalina, 10.15.2

I opened a file in Aquamacs, and stumbled on the "services" menu on the tab for the file buffer. One of the options is "Show in Finder."

This does not work for me. When I select it, Aquamacs does bring the Finder into focus, but it just brings up the last accessed Finder window, and does not open the folder containing the file from Aquamacs.

I have tried this on multiple files and got the same results.

I tried to test it on Aquamacs without customizations and ... found no "Services" menu item on buffer tabs. So I don't know if this is just me, but if it is, I have no idea what customization would give me a (non-functioning) "Services" submenu.

Bill Rising

unread,
Jan 15, 2020, 3:33:56 PM1/15/20
to aquamac...@googlegroups.com
I see the same behavior with the same setup.

You could well already know this, but if you could put the following in your .emacs file:

(global-set-key "\C-co" (lambda () (interactive) (shell-command "open .")))

Then you'll be able to open files in the Finder with C-c o.

Bill
> --
> You received this message because you are subscribed to the Google Groups "aquamacs-devel" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to aquamacs-deve...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/aquamacs-devel/C9ABD87C-D2DE-4B41-95C6-4C16A138CF9C%40gmail.com.

Jean-Christophe Helary

unread,
Jan 16, 2020, 1:37:48 PM1/16/20
to aquamac...@googlegroups.com
Robert,

The "Open in Finder" service is a service provided by Finder. It is not a service that you can set from Emacs. It is available to all the applications that add a "Service" submenu to their contextual menu but works only with Applications that provide the proper information to the OS.

Emacs provides other services:

emacs - Email Selection
emacs - New Buffer Containing Selection
emacs - Open Selected Files
emacs - Send Email to Selected Adresses



Jean-Christophe Helary
-----------------------------------------------
http://mac4translators.blogspot.com @brandelune


Jean-Christophe Helary

unread,
Jan 16, 2020, 1:37:48 PM1/16/20
to aquamac...@googlegroups.com


> On Jan 16, 2020, at 5:33, 'Bill Rising' via aquamacs-devel <aquamac...@googlegroups.com> wrote:
>
> I see the same behavior with the same setup.
>
> You could well already know this, but if you could put the following in your .emacs file:
>
> (global-set-key "\C-co" (lambda () (interactive) (shell-command "open .")))

There is also a package that's called "reveal-in-finder" and that works very well.

There are also a few other packages that interact with macos.

Robert Goldman

unread,
Jan 16, 2020, 1:58:38 PM1/16/20
to aquamac...@googlegroups.com
Sorry, I'm not sure I follow: I get it that the Open in Finder service
is provided by the Finder. What I don't understand is why it is not
correctly invoked by Aquamacs.

It seems like at least under some settings, Aquamacs can expose this
service through pull-down menus on the tabs, but that it cannot send the
Finder the information it is expecting.

I'd be happy to try to hack on this if it can be done in the Emacs Lisp
space, but if it requires Objective C or Swift, I'd be out of my depth.

Thanks!
R

Win Treese

unread,
Jan 17, 2020, 1:40:31 PM1/17/20
to aquamacs-devel

> On Jan 16, 2020, at 1:58 PM, Robert Goldman <rpgo...@sift.info> wrote:
>
> Sorry, I'm not sure I follow: I get it that the Open in Finder service is provided by the Finder. What I don't understand is why it is not correctly invoked by Aquamacs.
>
> It seems like at least under some settings, Aquamacs can expose this service through pull-down menus on the tabs, but that it cannot send the Finder the information it is expecting.
>
> I'd be happy to try to hack on this if it can be done in the Emacs Lisp space, but if it requires Objective C or Swift, I'd be out of my depth.

Hi, Robert. This is a pretty interesting question, and I’m not sure what’s going on. Some observations:

1. When I select the Aquamacs->Services->Show in Finder menu item (latest Aquamacs version, on Mojave), nothing happens. The Finder doesn’t even get raised.

2. If I select Aquamacs->Services->New Email with Selection menu item, and I have selected text in a buffer, it creates a new email message in Mail.app with the selected text.

3. On my system, at least, the File->Reveal in Finder menu item works as expected.

So my guess would be that there’s something not quite right in how Aquamacs deals the Services menu. A quick look suggests that the place to start looking is in src/nsfns.m, in the Objective-C code, but I haven’t looked at it more closely.

If someone is interested in looking at the code, that would be great. Sometimes, even if you’re not comfortable writing Objective-C, it’s possible to figure out what the problem is, which helps out a lot.

We should definitely add a bug report for this so we can fix it at some point.

Thanks for sending it along—sorry the answer isn’t more clear now!

- Win

Win Treese
tre...@acm.org
Aquamacs maintainer




Robert Goldman

unread,
Jan 17, 2020, 2:58:06 PM1/17/20
to aquamacs-devel
On 17 Jan 2020, at 12:40, Win Treese wrote:

> 2. If I select Aquamacs->Services->New Email with Selection menu item,
> and I have selected text in a buffer, it creates a new email message
> in Mail.app with the selected text.

FWIW, it would also be nice if there was an option to create a new mail
message with the contents of the buffer (or the buffer-file?) as an
attachment.
>
> 3. On my system, at least, the File->Reveal in Finder menu item works
> as expected.

Mine, too.

Win Treese

unread,
Jan 17, 2020, 3:41:45 PM1/17/20
to aquamac...@googlegroups.com


> On Jan 17, 2020, at 2:58 PM, Robert Goldman <rpgo...@sift.info> wrote:
>
> On 17 Jan 2020, at 12:40, Win Treese wrote:
>
>> 2. If I select Aquamacs->Services->New Email with Selection menu item, and I have selected text in a buffer, it creates a new email message in Mail.app with the selected text.
>
> FWIW, it would also be nice if there was an option to create a new mail message with the contents of the buffer (or the buffer-file?) as an attachment.

That would be convenient.

I think both of those would be straightforward to implement in elisp using the do-applescript function for running AppleScript in Aquamacs, maybe along with code to add them to an appropriate menu.

- Win

Jean-Christophe Helary

unread,
Jan 17, 2020, 8:07:54 PM1/17/20
to aquamac...@googlegroups.com
That's what I have in my init file:

;;; envoie un buffer dans le corps d'un mail
(defun jc-send-buffer-as-mail ()
(interactive)
(let ((mail-user-agent 'message-user-agent)
(buf (current-buffer)))
(compose-mail)
(save-excursion
(message-goto-body)
(insert-buffer buf))))

Jean-Christophe Helary

unread,
Jan 17, 2020, 8:13:15 PM1/17/20
to aquamac...@googlegroups.com


> On Jan 18, 2020, at 3:40, Win Treese <tre...@acm.org> wrote:
>
> So my guess would be that there’s something not quite right in how Aquamacs deals the Services menu. A quick look suggests that the place to start looking is in src/nsfns.m, in the Objective-C code, but I haven’t looked at it more closely.
>
> If someone is interested in looking at the code, that would be great. Sometimes, even if you’re not comfortable writing Objective-C, it’s possible to figure out what the problem is, which helps out a lot.

I remember when I "fixed" the behavior of the "open selected files" emacs service, I had very little knowledge of elisp and close to 0 knowledge of C, but I tried things and got a lot of help from the emacs-devel list and eventually produced some code that was accepted in master.

So there is nothing to worry about not knowing enough about such and such language. One can learn by trying. That's what free software is about.
Reply all
Reply to author
Forward
0 new messages