0

On some of my Linux machines, when I file-save-as, then the system file manager pops up and I can easily select destination. On other Linux Machines, I only get the emacs internal buffer save-as, which is clunky to use for me.

I went through all the config files in emacs but could not find how to set Save-As to always use the external system file-manager.

QUESTION: How do I force emacs to always use a popup file manager during Save-As ?

diyer
  • 1
  • By "the emacs internal buffer save-as", which you find clunky, do you mean the Emacs pop-up dialog for selecting a file name, or do you mean Emacs using only the minibuffer to let you choose the file name? – Drew Oct 24 '23 at 15:24
  • 1
    Are you aware of option use-file-dialog? Does that fit your needs here? – Drew Oct 24 '23 at 15:25
  • I mean that I DONT want the clunky mini-buffer, I want the popup system file-manager. – diyer Oct 24 '23 at 18:38

1 Answers1

1

Write a command that binds use-file-dialog to t, and use that command in place of write-file:

(defun my-save-as-cmd filename)
 "..."
 (interactive "FSave as file...")
 (let ((use-file-dialog  t))
   (write-file filename)))

(define-key [remap write-file] 'my-save-as-cmd)

use-file-dialog is a variable defined in `C source code'.

Its value is t

Documentation:

Non-nil means mouse commands use a file dialog to ask for files.

This applies to commands from menus and tool bar buttons even when they are initiated from the keyboard. If use-dialog-box is nil, that disables the use of a file dialog, regardless of the value of this variable.

You can customize this variable.

Drew
  • 77,472
  • 10
  • 114
  • 243
  • This did not help a bit.

    I toggled use-dialog-box (from nil default) and save-as still gives me the clunky mini-buffer file manager.

    – diyer Oct 24 '23 at 20:47
  • It seems that it was saved only for that particular session. I just pressed every save option to try and make it global and that seems to work. It now opens with a pop-up window as it used to do the last 25 years of emacs use. I find it really strange that on two identical installations on two different machines with the same emacs installed from apt repo, that one machine has emacs file-saves in mini-buffer, while the other opens an external file manager window. Does not make sense at all. Anyway it works now and I thank you very much for the help. – diyer Oct 24 '23 at 21:02