1

(On MacOS, emacsclient in -nw mode ) when point is at a xlsx file in a dired buffer, how can I open the xlsx file with MS-Excel.

I have Excel installed in the Mac. and the xlsx file extension is associated with excel.

1

On OSX/MacOS, type:   ! and then the word open and then hit RET.

0

In your init file:

  • Require built-in library dired-x.el, which makes option dired-guess-shell-alist-user available.

  • Customize option dired-guess-shell-alist-user, to tell Emacs that you want to associate, in Dired at least, MS-Excel with a *.xlsx file.

  • In Dired, use ! (followed by RET) on an xlsx file, to open it with MS Excel.

C-h v dired-guess-shell-alist-user says something like this:

dired-guess-shell-alist-user is a variable defined in dired-x.el.

Its value is nil

Documentation:

User-defined alist of rules for suggested commands.

These rules take precedence over the predefined rules in the variable dired-guess-shell-alist-default (to which they are prepended).

Each element of this list looks like

(REGEXP COMMAND...)

where each COMMAND can either be a string or a Lisp expression that evaluates to a string. If this expression needs to consult the name of the file for which the shell commands are being requested, it can access that file name as the variable file. If several COMMANDs are given, the first one will be the default and the rest will be added temporarily to the history and can be retrieved with M-x previous-history-element (M-p) .

The variable dired-guess-shell-case-fold-search controls whether REGEXP is matched case-sensitively.

You can customize this variable.

0

I have the following config (simplified version):

(use-package dired
  :ensure nil
  :defer t
  :commands (dired dired-jump dired-jump-other-window)
  :bind (("C-x C-j" . dired-jump)
         ("C-x 4 C-j" . dired-jump-other-window)
         :map dired-mode-map
         ("<C-return>" . haba/dired-open-in-os))
  :config
  (defun haba/dired-open-in-os ()
    "Open file/folder under cursor in OS."
    (interactive)
    (let ((file (ignore-errors (dired-get-file-for-visit))))
      (browse-url (file-truename file)))))

And with <C-return> I can open all files using OS handlers. XLSX in Excel, DOCX in Word, etc.

I didn't check if it works on OSX though. :)

PS

Emacs 26 has a new binding W in dired that might work out of the box. But there is no windows build yet and I can't check it.

PPS

So in Emacs 26.1 you can use W to open XLSX files in Excel.

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.